Source for file ResIterator.php
Documentation is available at ResIterator.php
* ----------------------------------------------------------------------------------
* ----------------------------------------------------------------------------------
* Implementation of a resource iterator.
* This Iterator should be used in a for-loop like:
* $it = $ontClass->listInstances();
* for ($it->rewind(); $it->valid(); $it->next())
* $currentResource=$it->current();
* @version $Id: fsource_resModel__resModelResIterator.php.html,v 1.10 2006/06/26 12:34:14 tgauss Exp $
* @author Daniel Westphal <mail at d-westphal dot de>
* Holds a reference to the assoiated ResModel / OntModel
* If the current resource is valid
* @var obejct ResResource
* The subject to search for.
* @var object ResResource
* The predicate to search for.
* @var object ResResource
* The object to search for.
* @var object ResResource
* If the resource, we're intrested in is the subject (s), predicate(p),
* or object (o) of the found statements
* Defines the type of resource, we'd like to receive.
* If set, each resource will first be checked, if it's
* $subject, $predicate, and $object are used like inf find().
* $getSPO supports the strings 's', 'p', and 'o' to return
* either the subject, predicate, or object of the result statements.
* $returnType supports the strings 'ResProperty', 'ResLiteral',
* 'OntProperty', 'OntClass', and 'Individual' and returns the resources
* @param object ResResource $subject
* @param object ResResource $predicate
* @param object ResResource $object
* @param object ResModel $associatedModel
* @param string $returnType
function ResIterator($subject,$predicate,$object,$getSPO,& $associatedModel,$returnType =
false)
* Resets iterator list to start
* Says if there are additional items left in the list
* Moves Iterator to the next item in the list
* Returns the current item
* Returns the next Resource (subject, predicate,
* or object of the next matching statement).
* @return object resResource
if ($nextStatement ===
null)
$object =
$nextStatement->getObject();
$hasCorrectLanguage=
false;
$hasCorrectLanguage=
true;
} while (!$hasCorrectLanguage);
if ($nextStatement ===
null)
* Returns the key of the current item
* Sets that only Literals with the matching
* language should be returned
* Returns the $resource as an instance of the type
* specified in $this->returnType.
* @param object ResResource
* @return object ResResource
$newLiteral =
$this->associatedModel->createLiteral($resource->getLabel(),$resource->getLanguage());
$newLiteral->setDatatype($resource->getDatatype());
Documentation generated on Mon, 26 Jun 2006 14:26:06 +0200 by phpDocumentor 1.3.0RC6