NAME
RDF::Trine::Parser - RDF Parser class
VERSION
This document describes RDF::Trine::Parser version 0.124_02
SYNOPSIS
use RDF::Trine::Parser;
RDF::Trine::Parser->parse_url_into_model( $url, $model );
my $parser = RDF::Trine::Parser->new( 'turtle' );
$parser->parse_into_model( $base_uri, $rdf, $model );
$parser->parse_file_into_model( $base_uri, 'data.ttl', $model );
DESCRIPTION
RDF::Trine::Parser is a base class for RDF parsers. It may be used as a factory class for constructing parser objects by name or media type with the new
method, or used to abstract away the logic of choosing a parser based on the media type of RDF content retrieved over the network with the parse_url_into_model
method.
METHODS
new ( $parser_name, @args )
-
Returns a new RDF::Trine::Parser object for the parser with the specified name (e.g. "rdfxml" or "turtle"). If no parser with the specified name is found, throws a RDF::Trine::Error::ParserError exception.
Any
@args
will be passed through to the format-specific parser constructor.If
@args
contains the key-value pair(canonicalize => 1)
, literal value canonicalization will be attempted during parsing with warnings being emitted for invalid lexical forms for recognized datatypes. parse_url_into_model ( $url, $model [, %args] )
-
Retrieves the content from
$url
and attempts to parse the resulting RDF into$model
using a parser chosen by the associated content media type. parse_into_model ( $base_uri, $data, $model [, context => $context] )
-
Parses the
$data
, using the given$base_uri
. For each RDF statement parsed, will call$model->add_statement( $statement )
. parse_file_into_model ( $base_uri, $fh, $model [, context => $context] )
-
Parses all data read from the filehandle
$fh
, using the given$base_uri
. For each RDF statement parsed, will call$model->add_statement( $statement )
. parse_file ( $base, $fh, $handler )
parse ( $base_uri, $rdf, \&handler )
parse_into_model ( $base_uri, $data, $model )
canonicalize_literal_value ( $string, $datatype )
-
If
$datatype
is a recognized datatype, returns the canonical lexical representation of the value$string
. Otherwise returns$string
.Currently, xsd:integer, xsd:decimal, and xsd:boolean are canonicalized. Additionaly, invalid lexical forms for xsd:float, xsd:double, and xsd:dateTime will trigger a warning.
AUTHOR
Gregory Todd Williams <gwilliams@cpan.org>
COPYRIGHT
Copyright (c) 2006-2010 Gregory Todd Williams. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.