Source for file ResContainer.php
Documentation is available at ResContainer.php
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
* This Class defines methods for accessing RDF container resources.
* These methods operate on the RDF statements contained in a model.
* @version $Id: fsource_resModel__resModelResContainer.php.html,v 1.10 2006/06/26 12:34:14 tgauss Exp $
* @author Daniel Westphal <mail at d-westphal dot de>
* Holds a ResResource of this container type rdf:Seq, rdf:Alt, or rdf:Bag
* Add a new value to a container.
* The new value is added as the last element of the container.
* @param object ResResource/ResLiteral $object
//type this container, if it isn't already typed
$actualSize=
$this->size();
//add the object to the last position
* Determine whether the container contains a value
* @param obejct ResResource/ResLiteral $resResource
//get all container's properties
//if the property matches a container membership property
//check, if it's the value, we're looking for.
if ($resResource->equals($statement->getObject()))
* Returns true, if this resource is a container from type rdf:Alt
return ($this->containerType->getURI()==
RDF_NAMESPACE_URI.
RDF_ALT);
* Returns true, if this resource is a container from type rdf:Bag
return ($this->containerType->getURI()==
RDF_NAMESPACE_URI.
RDF_BAG);
* Returns true, if this resource is a container from type rdf:Seq
return ($this->containerType->getURI()==
RDF_NAMESPACE_URI.
RDF_SEQ);
* Get an array of all resources that are values of this container
$predicateLabel=
$statement->getLabelPredicate();
* Remove a value from the container.
* Once removed, the values in the container with a higher ordinal value are renumbered.
* The renumbering algorithm depends on the type of container.
* @param obejct ResResource/ResLiteral $resResource
$deleteFromIndex=
array();
//get all container members
//check each container member if it equals the resoure to be removed
foreach ($memberIndex as $key =>
$value)
//save the statements positio in the container
if($object->equals($value))
//delete all found container members
foreach ($deleteFromIndex as $index)
//renumber all members with higher ordinal numbers than the deleted one
for ($i =
$index;$i <
count($memberIndex); $i++
)
* Returns the number values in the container.
* Checks, if a predicate label fits a container membership property rdf:_n
* @param string $predicateLabel
return substr($predicateLabel,0,strlen(RDF_NAMESPACE_URI.
'_')) ==
RDF_NAMESPACE_URI.
'_';
* Get the ordinal number from a membership property rdf:_n
* @param string $predicateLabel
return (int)
substr($predicateLabel,strlen(RDF_NAMESPACE_URI.
'_'));
* Get a membership property rdf:_n with index $int
Documentation generated on Mon, 26 Jun 2006 14:26:05 +0200 by phpDocumentor 1.3.0RC6