Dan Pokorny > RDF-Core-0.51 > RDF::Core::Serializer

Download:
RDF-Core-0.51.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  4
Open  3
View/Report Bugs
Source  

NAME ^

RDF::Core::Serializer - produce XML code for RDF model

SYNOPSIS ^

  require RDF::Core::Serializer;

  my %options = (getSubjects => \&getSubjectsHandler,
                 getNamespaces => \&getNamespacesHandler,
                 getStatements => \&getStatementsHandler,
                 countStatements => \&countStatementsHandler,
                 existsStatement => \&existsStatementHandler,
                 BaseURI => 'http://www.foo.com/',
                );
  my $serializer = new RDF::Core::Serializer(%options);
  $serializer->serialize;

DESCRIPTION ^

Serializer takes RDF data provided by handlers and generates a XML document. Besides the trivial job of generating one description for one statement the serializer attempts to group statements with common subject into one description and makes referenced descriptions nested into referencing ones. Using baseURI option helps to keep relative resources instead of making them absolute. Blank nodes are preserved where possible, though the new rdf:nodeID attribute production is not implemented yet.

Interface

Handlers

getSubjects should return an array of references, each reference pointing to an array of one item ($subject), where $subject is a reference to RDF::Core::Resource. (I.e. $subject = $returnValue->[$someElementOfArray]->[0])

getNamespaces should return a hash reference where keys are namespaces and values are namespace prefixes. There must be a rdf namespace present with value 'rdf'

getStatements($subject, $predicate, $object) should return all statements that match given mask. That is the statements' subject is equal to $subject or $subject is not defined and the same for predicate and subject. Return value is a reference to RDF::Core::Enumerator object.

countStatements($subject, $predicate, $object) should return number of statements that match given mask.

existsStatement($subject, $predicate, $object) should return true if exists statement that matches given mask and false otherwise.

LICENSE ^

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

AUTHOR ^

Ginger Alliance, rdf@gingerall.cz

SEE ALSO ^

 FileHandle, RDF::Core::Model::Serializer, RDF::Core::Enumerator
syntax highlighting: