NAME

RDF::Core::Parser - RDF Parser

DESCRIPTION

A module for parsing XML documents containing RDF data. It's based on XML::Parser. Parser goes through XML and calls what is referenced in Assert option for each statement found.

SYNOPSIS

use RDF::Core::Parser;

my %options = (Assert => \&handleAssert,
               BaseURI => "http://www.foo.com/",
               InlineURI => "http://www.bar.com/"
              );
my $parser = new RDF::Core::Parser(%options);
$parser->parseFile('./rdfFile.xml');
#or
$parser->parse($rdfString);

Interface

  • new(%options)

    Available options are

    • Assert

      A reference to a subroutine, that is called for every assertion that parser generates.

    • BaseURI

      A base URI of parsed document. It will be used to resolve relative URI references.

    • InlineURI

      Inline URI is used to generate URIs for anonymous (inline) resources.

  • parse($string)

  • parseFile($fileName)

Assert handler

Assert handler is called with key value pairs in a parameters array.

Keys are:

  • subject_ns, subject_name, subject_uri

    namespace, local value and URI of subject

  • predicate_ns, predicate_name, predicate_uri

    namespace, local value and URI of predicate

  • object_ns, object_name, object_uri

    namespace, local value and URI of object, if the object is a resource

    or

  • object_literal

    object value for literal

LICENSE

This package is subject to the MPL (or the GPL alternatively).

AUTHOR

Ginger Alliance, rdf@gingerall.cz

SEE ALSO

RDF::Core::Model::Parser