Redland RDF Application Framework - Perl RDF::Redland::Model Class

NAME

RDF::Redland::Model - Redland RDF Model Class

SYNOPSIS

  use RDF::Redland;
  my $storage=new RDF::Redland::Storage("hashes", "test", "new='yes',hash-type='memory'");
  my $model=new RDF::Redland::Model($storage, "");
  ...
  my(@sources)=$model->targets($predicate_node, $object_node);
  ...

DESCRIPTION

Manipulate the RDF model.

CONSTRUCTORS

new STORAGE OPTIONS_STRING
new_with_options STORAGE OPTIONS_HASH
Create a new RDF::Redland::Model object using RDF::Redland::Storage object STORAGE with a options. The options can be given either as a string in the first form as OPTIONS_STRING. The options take the form key1='value1',key2='value2'. The quotes are required. In the second case OPTIONS_HASH is a reference to a Perl hash of options.
new_from_model MODEL
Create a new model from an existing RDF::Redland::Model MODEL (copy constructor).

METHODS

size
Return the size of the model (number of statements).
add SUBJECT PREDICATE OBJECT
Add a new statement to the model with RDF::Redland::Node SUBJECT, PREDICATE and OBJECT.
add_typed_literal_statement SUBJECT PREDICATE STRING [XML_LANGUAGE [DATATYPE]]
Add a new statement to the model containing a typed literal string object STRING with (optional) XML language (xml:lang attribute) XML_LANGUAGE and (optional) datatype URI DATATYPE. XML_LANGUAGE or DATATYPE can either or both be set to undef.
add_statement STATEMENT [CONTEXT]
Add RDF::Redland::Statement STATEMENT to the model. If the optional RDF:Redland::Node CONTEXT is given, associate it with that context.
add_statements STREAM [CONTEXT]
Add the statements from the RDF::Redland::Stream STREAM to the model. If the optional RDF:Redland::Node CONTEXT is given, associate it with that context.
remove_statement STATEMENT [CONTEXT]
Remove RDF::Redland::Statement STATEMENT from the model. If the optional RDF:Redland::Node CONTEXT is given, remove only the statement stored with that context.
remove_context_statements CONTEXT
Remove all RDF::Redland::Statement STATEMENTs from the model with the given RDF:Redland::Node CONTEXT context.
contains_statement STATEMENT
Return non 0 if the model contains RDF::Redland::Statement STATEMENT.
serialise
Return a new RDF::Redland::Stream object seralising the model as RDF::Redland::Statement objects.
find_statements STATEMENT
Find all matching statements in the model matching partial RDF::Redland::Statement STATEMENT (any of the subject, predicate, object RDF::Redland::Node can be undef).

In an array context, returns an array of the matching RDF::Redland::Statement objects. In a scalar context, returns the RDF::Redland::Stream object representing the results.

sources ARC TARGET
Get all source RDF::Redland::Node objects for a given arc ARC, target TARGET> RDF::Redland::Node objects as a list of RDF::Redland::Node objects.
arcs SOURCE TARGET
Get all arc RDF::Redland::Node objects for a given source SOURCE, target TARGET RDF::Redland::Node objects as a list of RDF::Redland::Node objects.
targets SOURCE ARC
Get all target RDF::Redland::Node objects for a given source SOURCE, arc ARC RDF::Redland::Node objects as a list of RDF::Redland::Node objects.
sources_iterator ARC TARGET
Get all source RDF::Redland::Node objects for a given arc ARC, target TARGET RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.
arcs_iterator SOURCE TARGET
Get all arc RDF::Redland::Node objects for a given source SOURCE, target TARGET RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.
targets_iterator SOURCE ARC
Get all target RDF::Redland::Node objects for a given source SOURCE, arc ARC RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.
source ARC TARGET
Get one source RDF::Redland::Node object that matches a given arc ARC, target TARGET RDF::Redland::Node objects or undef if there is no match.
arc SOURCE TARGET
Get one arc RDF::Redland::Node object that matches a given source SOURCE, target TARGET RDF::Redland::Node objects or undef if there is no match.
target SOURCE ARC
Get one target RDF::Redland::Node object that matches a given source SOURCE, arc ARC RDF::Redland::Node objects or undef if there is no match.

SEE ALSO

the RDF::Redland::Storage manpage, the RDF::Redland::Node manpage and the RDF::Redland::Statement manpage

AUTHOR

Dave Beckett - http://purl.org/net/dajobe/


Copyright 2000-2003 Dave Beckett, Institute for Learning and Research Technology, University of Bristol