SemanticWeb::OAI::ORE::Model - Module for model component of an OAI-ORE Resource Map


In essence, the model is simply a set of triples and we thus store them in a triple store provided by RDF::Core::Model, RDF::Core::Storage etc..



SemanticWeb::OAI::ORE::Model->new(%args) or SemanticWeb::OAI::ORE::Model->new($rdf_model)

Create new relationships object as part of a resource map.

If supplied with a single argument that is a RDF::Core::Model then that object is blessed into this class an returned. Otherwise a new RDF::Core::Model object is created and any %args are passed to the creator.


Add either another model object or a single statement to this $model. Returns the number of statements added.


Add relationship where the object is a resource (URI).


Add relationship where the object is a literal.


Returns the number of statements or relationships.


Return an array reference to all triples each as a four element array with [subject, predicate, object, object_is_literal] for each statement.

FIXME - should perhaps implement iterator or similar...


Return an array of objects from triples where the subject and predicate are as specified. Will return an empty array if there are no matches.

If $only is not specified then the objects matching will be returned.

If $only is RESOURCE then only resource labels will be included, if LITERAL then only literal labels will be returned.


Wrapper around objects_matching to get the first literal matching the specified condition, else retursn undef. Ignores any other matches.



Take an RDF model of type RDF::Core::Model in $self and a Resource Map URI $uri_rem. Attempt to parse/interpret it as a resource map. Will croak if parsing fails so usual call would be to wrap in an eval:

  eval {
  if ($@) {
    # oops

If $rem is supplied then this is expected to be a SemanticWeb::OAI::ORE::ReM object with methods uri(), aggregation(), creator() and timestamp_as_iso8601() which are used to set these values for easy reference.

The requirements are based mainly on the table given in


Find all the CREATOR objects (resources or literals) for $uri.


Return timestamp literal associated with $uri_rem. There must be just one otherwise nothing (error) will be returned.


Error handling. Will use similar error method of $self->{errobj} if that is set. Otherwise handles here.


These routines support examination of the model to pull out key reference points and information such as the Resource Map URI or the Aggregation URI.


Attempt to find the Resource Map. Returns the appropriate Resource object if successful, nothing otherwise.


Wrapper around $model->find_rem that returns a URI on success, nothing otherwise.


Find the Aggregation in this Resource Map. Returns the appropriate Resource object if successful, nothing otherwise.

Valid options are:

 uri_rem -> Resurce Map URI,


Wrapper around $model->find_aggregation that returns a URI on success, nothing otherwise.


These are low-level data dump methods. It is expected that normally the methods provided via SemanticWeb::OAI::ORE::ReM::serialize will be used.


Very simple dump of this object as N3. No prefixes are used and the triples are sorted alphabetically by line unless $unsorted is set true (in which case the output will be essentially random).

See SemanticWeb::OAI::ORE::N3 for "pretty printing" methods.


Simple RDF XML dump, returns string. For more sophisticated output see SemanticWeb::OAI::ORE::RDFXML.




Simeon Warner


Copyright 2007-2010 Simeon Warner.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.