Source for file DatasetMem.php
Documentation is available at DatasetMem.php
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
* In-memory implementation of a RDF dataset.
* A RDF dataset set is a collection of named RDF graphs.
* @version $Id: fsource_dataset__datasetDatasetMem.php.html,v 1.8 2006/06/26 12:34:12 tgauss Exp $
* @author Daniel Westphal (http://www.d-westphal.de)
* @author Chris Bizer <chris@bizer.de>
* Reference to a Memmodel that holds the default graph.
* Name of the DatasetMem.
* List of all NamedGraphs.
* You can supply a Dataset name.
// === Graph level methods ========================
* Sets the Datasets name.
* Returns the Datasets name.
* Adds a NamedGraph to the set. Will replace a NamedGraph with the same name that is already in the set.
$graphNameURI=
$graph->getGraphName();
$this->graphs[$graphNameURI]=
&$graph;
* Overwrites the existting default graph.
* Returns a reference to the defaultGraph
* Returns true, if an defaultGraph exists. False otherwise .
* Removes a NamedGraph from the set. Nothing happens
* if no graph with that name is contained in the set.
unset
($this->graphs[$graphName]);
* Tells wether the Dataset contains a NamedGraph.
return (isset
($this->graphs[$graphName])===
true);
* Returns the NamedGraph with a specific name from the Dataset.
* Changes to the graph will be reflected in the set.
* @return NamedGraphMem or NULL
if (!isset
($this->graphs[$graphName])) return NULL;
return ($this->graphs[$graphName]);
* Returns the names of the namedGraphs in this set as strings in an array.
* Creates a new NamedGraph and adds it to the set. An existing
* graph with the same name will be replaced.The name of the NamedGraph to be created ; must be an URI
* Deletes all NamedGraphs from the set.
* Returns the number of NamedGraphs in the set. Empty graphs
* Returns the NamedGraph with a specific offset in the dataset.
* Changes to the graph will be reflected in the set.
* @return NamedGraphMem or null
foreach ($this->graphs as $graph)
* Returns an iterator over all {@link NamedGraph}s in the set.
* @return IteratorAllGraphsMem
* Tells wether the set contains any NamedGraphs.
* Adds all named graphs of the other dataset to this dataset.
function addAll($otherDataset)
for($iterator =
$otherDataset->listNamedGraphs(); $iterator->valid(); $iterator->next())
$current=
$iterator->current();
$this->graphs[$current->getGraphName()]=
$current;
if ($otherDataset->hasDefaultGraph())
// === Quad level methods ========================
* Adds a quad to the Dataset. The argument must not contain any
* wildcards. If the quad is already present, nothing happens. A new
* named graph will automatically be created if necessary.
$graphName=
$quad->getGraphName();
$this->graphs[$graphName->getLabel()]->add($quad->getStatement());
* Tells wether the Dataset contains a quad or
* quads matching a pattern.
* @param Resource $graphName
* @param Resource $subject
* @param Resource $predicate
* @param Resource $object
function containsQuad($graphName,$subject,$predicate,$object)
return ($this->graphs[$graphName->getLabel()]->findFirstMatchingStatement($subject,$predicate,$object)!=
null);
foreach ($this->graphs as $graph)
if ($graph->findFirstMatchingStatement($subject,$predicate,$object)!=
null)
* Deletes a Quad from the RDF dataset.
$graphName=
$quad->getGraphName();
return ($this->graphs[$graphName->getLabel()]->remove($quad->getStatement())!=
null);
foreach ($this->graphs as $graph)
$graph->remove($quad->getStatement());
* Counts the Quads in the RDF dataset. Identical Triples in
* different NamedGraphs are counted individually.
foreach ($this->graphs as $graph)
* Finds Statements that match a quad pattern. The argument may contain
* @param Resource or Null
* @param Resource or Null
* @param Resource or Null
function &findInNamedGraphs($graph,$subject,$predicate,$object,$returnAsTriples =
false)
return $findGraph->iterFind($subject,$predicate,$object);
* Finds Statements that match a pattern in the default Graph. The argument may contain
* @param Resource or Null
* @param Resource or Null
* @param Resource or Null
return $this->defaultGraph->iterFind($subject,$predicate,$object);
Documentation generated on Mon, 26 Jun 2006 14:25:21 +0200 by phpDocumentor 1.3.0RC6