Scroll to navigation

RDF::Redland::Model(3pm) User Contributed Perl Documentation RDF::Redland::Model(3pm)

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

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.
Create a new model from an existing RDF::Redland::Model MODEL (copy constructor).

METHODS

Return the size of the model (number of statements).
Synchronise the model to the underlying storage.
Add a new statement to the model with SUBJECT, PREDICATE and OBJECT. These can be RDF::Redland::Node, RDF::Redland::URI or perl URI objects.
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 RDF::Redland::Statement STATEMENT or the statement formed by NODE NODE NODE to the model. If the optional CONTEXT is given, associate it with that context. Any of NODE or CONTEXT can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.
Add the statements from the RDF::Redland::Stream STREAM to the model. If the optional CONTEXT is given, associate it with that context. CONTEXT can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.
Remove RDF::Redland::Statement STATEMENT or the statement formed by NODE NODE NODE from the model. If the optional CONTEXT is given, remove only the statement stored with that context. Any of NODE or CONTEXT can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.
Remove all RDF::Redland::Statement STATEMENTs from the model with the given CONTEXT context. CONTEXT can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.
Return non 0 if the model contains RDF::Redland::Statement STATEMENT.
Return a new RDF::Redland::Stream object seralising the entire model, or just those statements with CONTEXT, as RDF::Redland::Statement objects. If given, CONTEXT can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.
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). If CONTEXT is given, finds statements only in that context.

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.

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.
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.
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.
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.
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.
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.
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.
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.
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.
Get all context RDF::Redland::Node objects in the model
Get/set a model feature. The feature is named via RDF::Redland::URI URI and the value is a RDF::Redland::Node. If VALUE is given, the feature is set to that value, otherwise the current value is returned.
Execute the QUERY RDF::Redland::Query against the model returning a result set RDF::Redland::QueryResults or undef on failure.
Load content from URI into the model, guessing the parser.
Serialize the model to a syntax. If no serializer name is given, the default serializer RDF/XML is used.

OLDER METHODS

Return a new RDF::Redland::Stream object seralising the model as RDF::Redland::Statement objects. Replaced by as_stream to reduce confusion with the RDF::Redland::Serializer class.

SEE ALSO

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

AUTHOR

Dave Beckett - http://www.dajobe.org/

2024-03-17 perl v5.38.2