.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RDF::Redland::Parser 3pm" .TH RDF::Redland::Parser 3pm 2024-03-17 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME RDF::Redland::Parser \- Redland RDF Syntax Parsers Class .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use RDF::Redland; \& \& ... \& my $parser=new RDF::Redland::Parser("rdfxml"); \& my $parser2=new RDF::Redland::Parser(undef, "application/rdf+xml); \& \& # Return as an RDF::Redland::Stream \& my $stream=$parser\->parse_as_stream($source_uri, $base_uri); \& \& # Store in an RDF::Redland::Model \& $parser\->parse_into_model($source_uri, $base_uri, $model); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .SH CONSTRUCTORS .IX Header "CONSTRUCTORS" .IP "new [NAME [MIME_TYPE [URI]]]" 4 .IX Item "new [NAME [MIME_TYPE [URI]]]" Create a new RDF::Redland::Parser object for a syntax parser named \fINAME\fR, with MIME Type \fIMIME_TYPE\fR and/or URI \fIURI\fR. Any field can be undef or omitted; if all are omitted, a parser that provides MIME Type application/rdf+xml will be requested. .SH METHODS .IX Header "METHODS" .IP "parse_as_stream SOURCE_URI BASE_URI" 4 .IX Item "parse_as_stream SOURCE_URI BASE_URI" Parse the syntax at the RDF::Redland::URI \fISOURCE_URI\fR with optional base RDF::Redland::URI \fIBASE_URI\fR. If the base URI is given then the content is parsed as if it was at the base URI rather than the source URI. .Sp Returns an RDF::Redland::Stream of RDF::Redland::Statement objects or undef on failure. .IP "parse_into_model SOURCE_URI BASE_URI MODEL [HANDLER]" 4 .IX Item "parse_into_model SOURCE_URI BASE_URI MODEL [HANDLER]" Parse the syntax at the RDF::Redland::URI \fISOURCE_URI\fR with optional base RDF::Redland::URI \fIBASE_URI\fR into RDF::Redland::Model \fIMODEL\fR. If the base URI is given then the content is parsed as if it was at the base URI rather than the source URI. .Sp If the optional \fIHANDLER\fR is given, it is a reference to a sub with the signature sub handler($$$$$$$$$) { my($code, \f(CW$level\fR, \f(CW$facility\fR, \f(CW$message\fR, \f(CW$line\fR, \f(CW$column\fR, \f(CW$byte\fR, \f(CW$file\fR, \f(CW$uri\fR)=@_; ... } that receives errors in parsing. .IP "parse_string_as_stream STRING BASE_URI" 4 .IX Item "parse_string_as_stream STRING BASE_URI" Parse the syntax in \fISTRING\fR with required base RDF::Redland::URI \fIBASE_URI\fR. .Sp Returns an RDF::Redland::Stream of RDF::Redland::Statement objects or undef on failure. .IP "parse_string_into_model STRING BASE_URI MODEL [HANDLER]" 4 .IX Item "parse_string_into_model STRING BASE_URI MODEL [HANDLER]" Parse the syntax in \fISTRING\fR with required base RDF::Redland::URI \fIBASE_URI\fR into RDF::Redfland::Model \fIMODEL\fR. .Sp If the optional \fIHANDLER\fR is given, it is a reference to a sub with the signature sub handler($$$$$$$$$) { my($code, \f(CW$level\fR, \f(CW$facility\fR, \f(CW$message\fR, \f(CW$line\fR, \f(CW$column\fR, \f(CW$byte\fR, \f(CW$file\fR, \f(CW$uri\fR)=@_; ... } that receives errors in parsing. .IP "feature URI [VALUE]" 4 .IX Item "feature URI [VALUE]" Get/set a parser feature. The feature is named via RDF::Redland::URI \&\fIURI\fR and the value is a RDF::Redland::Node. If \fIVALUE\fR is given, the feature is set to that value, otherwise the current value is returned. .IP namespaces_seen 4 .IX Item "namespaces_seen" Get the set of namespace declarations seen during parsing as a hash of key:prefix string (may be ''), value: RDF::Redland::URI objects. .SH "SEE ALSO" .IX Header "SEE ALSO" RDF::Redland::URI .SH AUTHOR .IX Header "AUTHOR" Dave Beckett \- http://www.dajobe.org/