| 1 |
<?xml version="1.0" encoding="iso-8859-1"?> |
| 2 |
<?xml version="1.0"?> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
<head> |
| 5 |
<title>Redland RDF Application Framework - Perl RDF::Redland::Parser Class</title> |
| 6 |
</head> |
| 7 |
<body> |
| 8 |
|
| 9 |
<h1 style="text-align:center">Redland RDF Application Framework - Perl RDF::Redland::Parser Class</h1> |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
<div name="index"> |
| 14 |
<p><a name="__index__"></a></p> |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
</div> |
| 29 |
|
| 30 |
|
| 31 |
<h2><a name="name">NAME</a></h2> |
| 32 |
<p>RDF::Redland::Parser - Redland RDF Syntax Parsers Class</p> |
| 33 |
|
| 34 |
<h2><a name="synopsis">SYNOPSIS</a></h2> |
| 35 |
<pre> |
| 36 |
use RDF::Redland; |
| 37 |
</pre> |
| 38 |
<pre> |
| 39 |
... |
| 40 |
my $parser=new RDF::Redland::Parser("rdfxml"); |
| 41 |
my $parser2=new RDF::Redland::Parser(undef, "application/rdf+xml); |
| 42 |
</pre> |
| 43 |
<pre> |
| 44 |
# Return as an RDF::Redland::Stream |
| 45 |
my $stream=$parser->parse_as_stream($source_uri, $base_uri); |
| 46 |
|
| 47 |
# Store in an RDF::Redland::Model |
| 48 |
$parser->parse_into_model($source_uri, $base_uri, $model); |
| 49 |
</pre> |
| 50 |
|
| 51 |
<h2><a name="description">DESCRIPTION</a></h2> |
| 52 |
<p>This class represents parsers of various syntaxes that can deliver a RDF model either as a RDF::Redland::Stream of RDF::Redland::Statement objects or directly into an RDF::Redland::Model object.</p> |
| 53 |
|
| 54 |
<h2><a name="constructors">CONSTRUCTORS</a></h2> |
| 55 |
<dl> |
| 56 |
<dt><strong><a name="new_name_mime_type_uri" class="item">new [NAME [MIME_TYPE [URI]]]</a></strong></dt> |
| 57 |
<dd> |
| 58 |
<p>Create a new RDF::Redland::Parser object for a syntax parser named <em>NAME</em>, with MIME Type <em>MIME_TYPE</em> and/or URI <em>URI</em>. Any field can be undef or omitted; if all are omitted, a parser that provides MIME Type application/rdf+xml will be requested.</p> |
| 59 |
</dd> |
| 60 |
</dl> |
| 61 |
|
| 62 |
<h2><a name="methods">METHODS</a></h2> |
| 63 |
<dl> |
| 64 |
<dt><strong><a name="parse_as_stream_source_uri_base_uri" class="item">parse_as_stream SOURCE_URI BASE_URI</a></strong></dt> |
| 65 |
<dd> |
| 66 |
<p>Parse the syntax at the RDF::Redland::URI <em>SOURCE_URI</em> with optional base RDF::Redland::URI <em>BASE_URI</em>. If the base URI is given then the content is parsed as if it was at the base URI rather than the source URI.</p> |
| 67 |
<p>Returns an RDF::Redland::Stream of RDF::Redland::Statement objects or undef on failure.</p> |
| 68 |
</dd> |
| 69 |
<dt><strong><a name="parse_into_model_source_uri_base_uri_model_handler" class="item">parse_into_model SOURCE_URI BASE_URI MODEL [HANDLER]</a></strong></dt> |
| 70 |
<dd> |
| 71 |
<p>Parse the syntax at the RDF::Redland::URI <em>SOURCE_URI</em> with optional base RDF::Redland::URI <em>BASE_URI</em> into RDF::Redland::Model <em>MODEL</em>. If the base URI is given then the content is parsed as if it was at the base URI rather than the source URI.</p> |
| 72 |
<p>If the optional <em>HANDLER</em> is given, it is a reference to a sub with the signature sub <code>handler($$$$$$$$$)</code> { my($code, $level, $facility, $message, $line, $column, $byte, $file, $uri)=@_; ... } that receives errors in parsing.</p> |
| 73 |
</dd> |
| 74 |
<dt><strong><a name="parse_string_as_stream_string_base_uri" class="item">parse_string_as_stream STRING BASE_URI</a></strong></dt> |
| 75 |
<dd> |
| 76 |
<p>Parse the syntax in <em>STRING</em> with required base RDF::Redland::URI <em>BASE_URI</em>.</p> |
| 77 |
<p>Returns an RDF::Redland::Stream of RDF::Redland::Statement objects or undef on failure.</p> |
| 78 |
</dd> |
| 79 |
<dt><strong><a name="parse_string_into_model_string_base_uri_model_handler" class="item">parse_string_into_model STRING BASE_URI MODEL [HANDLER]</a></strong></dt> |
| 80 |
<dd> |
| 81 |
<p>Parse the syntax in <em>STRING</em> with required base RDF::Redland::URI <em>BASE_URI</em> into RDF::Redfland::Model <em>MODEL</em>.</p> |
| 82 |
<p>If the optional <em>HANDLER</em> is given, it is a reference to a sub with the signature sub <code>handler($$$$$$$$$)</code> { my($code, $level, $facility, $message, $line, $column, $byte, $file, $uri)=@_; ... } that receives errors in parsing.</p> |
| 83 |
</dd> |
| 84 |
<dt><strong><a name="feature_uri_value" class="item">feature URI [VALUE]</a></strong></dt> |
| 85 |
<dd> |
| 86 |
<p>Get/set a parser feature. The feature is named via RDF::Redland::URI <em>URI</em> and the value is a RDF::Redland::Node. If <em>VALUE</em> is given, the feature is set to that value, otherwise the current value is returned.</p> |
| 87 |
</dd> |
| 88 |
<dt><strong><a name="namespaces_seen" class="item">namespaces_seen</a></strong></dt> |
| 89 |
<dd> |
| 90 |
<p>Get the set of namespace declarations seen during parsing as a hash of key:prefix string (may be ''), value: RDF::Redland::URI objects.</p> |
| 91 |
</dd> |
| 92 |
</dl> |
| 93 |
|
| 94 |
<h2><a name="see_also">SEE ALSO</a></h2> |
| 95 |
<p><a href="URI.html">the RDF::Redland::URI manpage</a></p> |
| 96 |
|
| 97 |
<h2><a name="author">AUTHOR</a></h2> |
| 98 |
<p>Dave Beckett - <a href="http://www.dajobe.org/">http://www.dajobe.org/</a></p> |
| 99 |
<hr /> |
| 100 |
|
| 101 |
<p>(C) Copyright 2000-2011 <a href="http://www.dajobe.org/">Dave Beckett</a>, (C) Copyright 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 102 |
|
| 103 |
</body> |
| 104 |
</html> |