SemanticWeb::OAI::ORE::ReM - Module implementing OAI-ORE Resource Map object


This class is designed to provide convenient ways to interact with OAI-ORE resource maps from Perl code. It as based around a data model class SemanticWeb::OAI::ORE::Model which is the RDF model and may be accessed directly via $rem->model. The access methods here are intended to hide the RDF and instead work more naturally with the constraints and language of OAI-ORE.

Written against the v1.0 OAI-ORE specification (


An ORE Resource Map is comprised of two things:

1) a URI indicating its location

2) an RDF graph expressing the relationship between an aggregation and aggreted resources

This class encapsulates these two things ($rem->uri and $rem->model), some other useful informatino about paring and serialization methods, and provides routines to create/read, update, and write the resource map.


For simple case where we have simply a set of aggregated resources and minimal metadata is required:

 use SemanticWeb::OAI::ORE::ReM;

 my $rem=SemanticWeb::OAI::ORE::ReM->new('ar'=>['uri:1','uri:2']);
 print $rem->serialize('rdfxml');


 use SemanticWeb::OAI::ORE::ReM;
 my $rem=SemanticWeb::OAI::ORE::ReM->new;



Create a new Resource Map (ReM) object. The resource map is comprised of a URI (URI-R) and a set of triples, the model.

Any %args supplied are used to set the object variables. As a shorthand for construction argument C{ar} may be used to provide an arrayref of aggregated resources which are added using $rem-aggregated_resources($args{ar})>.


Set or access the identity of the ReM (URI-R). This should be the first thing set when building a Resource Map. The validity of the URI is checked with check_valid_uri(..).


Set or access the model (see SemanticWeb::OAI::ORE::Model) of this Resource Map. It is usually expected that ORE specific accessor methods such as aggregated_resources, creator and such will be used to add data to the model when building a resource map.

See SemanticWeb::OAI::ORE::Model for details of how the model may be accessed and manipulated, and also methods that follow for convenient accessors to ORE elements.

Will always return the reference to the model object so one can do things such as:



Set or access the URI of the Aggregation described by this ReM (URI-A). Must be set after the URI of the Resource Map (URI-R) and would usually be the second thing set when building a resource map from scratch.

WARNING - this routine does not have the facility to update all occurrences in the model if changed when other statements (e.g. aggregated resources or metadata) have been added that reference the aggregation.


Set or access the creator of the ReM. Returns If there is more than one creator then the first will be returned. Returns nothing if there is no creator set.


 The identity of the authoring authority (human, organization, or agent) of 
 the Resource Map, using the dcterms:creator predicate, with an object that MUST 
 be a reference to a Resource of type L<>. This MAY 
 then be the subject of the following triples:

 * A triple with the predicate foaf:name and an object that is a text string 
   containing some descriptive name of the authoring authority.

 * A triple with the predicate foaf:mbox and an object that is a URI that is 
   the email address of the authoring authority.


Assumes one creator. Wrapper around $rem->creators() that does the same thing except in the case where there are multiple creators it will return just the first.


Set or access the creator as a URI of the ReM.


Set or access the option creation timestamp of the ReM. Returns now if not set. Type should be either CREATED or MODIFIED constant. Usually called via created_as_unix() or modified_as_unix() wrappers.

Will set if timestamp if $timestamp is defined.


Set or access the creation timestamp of the ReM as a Unix timestamp.

Will set timestamp if $timestamp is defined.


Set or access the modification timestamp of the ReM as a Unix timestamp.

Will set timestamp if $timestamp is defined.


Set or access the timestamp of the rem as an ISO8601 string. Type should be either CREATED or MODIFIED constant. Usually called via created_as_iso8601() or modified_as_iso8601() wrappers.

Will set timetstamp if $timestamp is defined.


Returns the current system time as an iso8601 string


Set or access the creation timestamp of the ReM as a ISO8601 timestamp.

Will set timestamp if $timestamp is defined.


Set or access the creation timestamp of the ReM as a ISO8601 timestamp.

Will set timestamp if $timestamp is defined.


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 for $rem-aggregation_metadata> that will take just the first matching literal, or return undef if there a no matches.


Set or access the aggregated resources list.


This method will never remove an aggregated resource from this ReM. Use delete_aggregated_resources to remove or clear the set of aggregated resources for this ReM. Returns a list of all the aggregated resources.


Set of access the rights for this resource map. Permits only one rights statement to be associated with the resource map. Returns undef if no rights value is set.


Run validation checks on the resource map model. Returns true (1) on succes, false (nothing) on failures. Errors set in errstr.



Parse resource $uri_rem. Get it from $src, where $src may be either a string containing the representation to be parsed, or an open filehandle. If $src is not set then attempt to download from $uri_rem using parseuri().

To parse a file directly, use the parsefile() wrapper. To parse a URI directly, use the parseuri() wrapper.

Will run validation checks on the resource map model obtained. Set $rem-die_level(RECKLESS)> to ignore errors.

Will return true (1) on success, false (undef) on failure. Will have set errstr on failure.


Wrapper for parse($format,$uri_rem,$src)> which does nothing with $format and $uri_rem but opens $file and passes the reulting filehandle on to $rem-parse(...)>. Returns undef if the file cannot be opened, otherwise return values as for $rem-parse(...)>.


Simple wrapper for parse($format,$uri_rem,$src)> that downloads $uri_rem with LWP::Simple before passing it on. Returns undef if $uri_rem cannot be downloaded, otherwise return values as for $rem-parse(...)>.


Serialize in default format which has accessor $rem-default_format>.


Serialize in $format. This will use and call the appropriate writer class.

$rem->errstr($str) or $rem->errstr

Resets the error string to $str if $str provided.

Returns a string, either the error string if set, else ''.


Add to the error string. Will append \n if not present in $str.


Log and/or report an error $msg at level $level. Intended mainly for internal use and use by particular format classes.


Check that the supplied $uri is valid and create $rem-err> if not. Returns true if valid, false otherwise.


Details of the Open Archive Initiative, including both the OAI-ORE and OAI-PMH specification are found at

This module is the primary class for support of OAI-ORE resource maps. Other parts include: SemanticWeb::OAI::ORE::Model SemanticWeb::OAI::ORE::N3 SemanticWeb::OAI::ORE::Trix

Support for the OAI-PMH protocol is provided by other modules including SemanticWeb::OAI::Harvester.


Simeon Warner, <simeon at>


Support for Atom format output is not yet provided, this should be SemanticWeb::OAI::ORE::Atom.

Please report any bugs or feature requests to bug-net-oai-ore at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc SemanticWeb::OAI::ORE

You can also look for information at:


Copyright 2007-2010 Simeon Warner.

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