.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RDF::Trine::Parser 3pm" .TH RDF::Trine::Parser 3pm "2014-10-24" "perl v5.20.1" "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::Trine::Parser \- RDF Parser class .SH "VERSION" .IX Header "VERSION" This document describes RDF::Trine::Parser version 1.011 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use RDF::Trine::Parser; \& \& RDF::Trine::Parser\->parse_url_into_model( $url, $model ); \& \& my $parser = RDF::Trine::Parser\->new( \*(Aqturtle\*(Aq ); \& $parser\->parse_into_model( $base_uri, $rdf, $model ); \& \& $parser\->parse_file_into_model( $base_uri, \*(Aqdata.ttl\*(Aq, $model ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" RDF::Trine::Parser is a base class for \s-1RDF\s0 parsers. It may be used as a factory class for constructing parser objects by name or media type with the \f(CW\*(C`new\*(C'\fR method, or used to abstract away the logic of choosing a parser based on the media type of \s-1RDF\s0 content retrieved over the network with the \&\f(CW\*(C`parse_url_into_model\*(C'\fR method. .SH "METHODS" .IX Header "METHODS" .ie n .IP """media_type""" 4 .el .IP "\f(CWmedia_type\fR" 4 .IX Item "media_type" Returns the canonical media type associated with this parser. .ie n .IP """media_types""" 4 .el .IP "\f(CWmedia_types\fR" 4 .IX Item "media_types" Returns the media types associated with this parser. .ie n .IP """parser_by_media_type ( $media_type )""" 4 .el .IP "\f(CWparser_by_media_type ( $media_type )\fR" 4 .IX Item "parser_by_media_type ( $media_type )" Returns the parser class appropriate for parsing content of the specified media type. Returns undef if not appropriate parser is found. .ie n .IP """guess_parser_by_filename ( $filename )""" 4 .el .IP "\f(CWguess_parser_by_filename ( $filename )\fR" 4 .IX Item "guess_parser_by_filename ( $filename )" Returns the best-guess parser class to parse a file with the given filename. Defaults to RDF::Trine::Parser::RDFXML if not appropriate parser is found. .ie n .IP """new ( $parser_name, @args )""" 4 .el .IP "\f(CWnew ( $parser_name, @args )\fR" 4 .IX Item "new ( $parser_name, @args )" Returns a new RDF::Trine::Parser object for the parser with the specified name (e.g. \*(L"rdfxml\*(R" or \*(L"turtle\*(R"). If no parser with the specified name is found, throws a RDF::Trine::Error::ParserError exception. .Sp Any \f(CW@args\fR will be passed through to the format-specific parser constructor. .Sp If \f(CW@args\fR contains the key-value pair \f(CW\*(C`(canonicalize => 1)\*(C'\fR, literal value canonicalization will be attempted during parsing with warnings being emitted for invalid lexical forms for recognized datatypes. .ie n .IP """parse_url_into_model ( $url, $model [, %args] )""" 4 .el .IP "\f(CWparse_url_into_model ( $url, $model [, %args] )\fR" 4 .IX Item "parse_url_into_model ( $url, $model [, %args] )" Retrieves the content from \f(CW$url\fR and attempts to parse the resulting \s-1RDF\s0 into \f(CW$model\fR using a parser chosen by the associated content media type. .Sp If \f(CW%args\fR contains a \f(CW\*(Aqcontent_cb\*(Aq\fR key with a \s-1CODE\s0 reference value, that callback function will be called after a successful response as: .Sp .Vb 1 \& $content_cb\->( $url, $content, $http_response_object ) .Ve .Sp If \f(CW%args\fR contains a \f(CW\*(Aquseragent\*(Aq\fR key with a LWP::UserAgent object value, that object is used to retrieve the requested \s-1URL\s0 without any configuration (such as setting the Accept: header) which would ordinarily take place. Otherwise, the default user agent (\*(L"default_useragent\*(R" in RDF::Trine) is cloned and configured to retrieve content that will be acceptable to any available parser. .ie n .IP """parse_into_model ( $base_uri, $data, $model [, context => $context] )""" 4 .el .IP "\f(CWparse_into_model ( $base_uri, $data, $model [, context => $context] )\fR" 4 .IX Item "parse_into_model ( $base_uri, $data, $model [, context => $context] )" Parses the bytes in \f(CW$data\fR, using the given \f(CW$base_uri\fR. For each \s-1RDF\s0 statement parsed, will call \f(CW\*(C`$model\->add_statement( $statement )\*(C'\fR. .ie n .IP """parse_file_into_model ( $base_uri, $fh, $model [, context => $context] )""" 4 .el .IP "\f(CWparse_file_into_model ( $base_uri, $fh, $model [, context => $context] )\fR" 4 .IX Item "parse_file_into_model ( $base_uri, $fh, $model [, context => $context] )" Parses all data read from the filehandle or file \f(CW$fh\fR, using the given \f(CW$base_uri\fR. For each \s-1RDF\s0 statement parsed, will call \&\f(CW\*(C`$model\->add_statement( $statement )\*(C'\fR. .ie n .IP """parse_file ( $base_uri, $fh, $handler )""" 4 .el .IP "\f(CWparse_file ( $base_uri, $fh, $handler )\fR" 4 .IX Item "parse_file ( $base_uri, $fh, $handler )" Parses all data read from the filehandle or file \f(CW$fh\fR, using the given \&\f(CW$base_uri\fR. If \f(CW$fh\fR is a filename, this method can guess the associated parse. For each \s-1RDF\s0 statement parsed, \f(CW\*(C`$handler\->( $st )\*(C'\fR is called. .ie n .IP """parse ( $base_uri, $rdf, \e&handler )""" 4 .el .IP "\f(CWparse ( $base_uri, $rdf, \e&handler )\fR" 4 .IX Item "parse ( $base_uri, $rdf, &handler )" .PD 0 .ie n .IP """new_bnode_prefix ()""" 4 .el .IP "\f(CWnew_bnode_prefix ()\fR" 4 .IX Item "new_bnode_prefix ()" .PD Returns a new prefix to be used in the construction of blank node identifiers. If either Data::UUID or UUID::Tiny are available, they are used to construct a globally unique bnode prefix. Otherwise, an empty string is returned. .ie n .IP """default_accept_header""" 4 .el .IP "\f(CWdefault_accept_header\fR" 4 .IX Item "default_accept_header" Returns the default \s-1HTTP\s0 Accept header value used in requesting \s-1RDF\s0 content (e.g. in \&\*(L"parse_url_into_model\*(R") that may be parsed by one of the available RDF::Trine::Parser subclasses. .Sp By default, \s-1RDF/XML\s0 and Turtle are preferred over other media types. .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to through the GitHub web interface at . .SH "AUTHOR" .IX Header "AUTHOR" Gregory Todd Williams \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2006\-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.