Пример #1
0
 public function hydrateResources($options = array())
 {
     if (!array_key_exists('rdf:type', $options)) {
         throw new MissingOptionsException('Missing key rdf:type in options');
     }
     $resources = $this->graph->allOfType($options['rdf:type']);
     $collectionUri = uniqid('collection:');
     $collection = new Collection($collectionUri, $this->graph);
     //building collection
     foreach ($resources as $resource) {
         $collection->append($resource);
     }
     $this->rm->getUnitOfWork()->blackListCollection($collection);
     foreach ($resources as $resource) {
         $this->rm->getUnitOfWork()->registerResource($resource);
     }
     return $collection;
 }
Пример #2
0
 /**
  * @param Collection $coll
  */
 public function blackListCollection(Collection $coll)
 {
     //going to first element.
     $coll->rewind();
     $ptr = $coll;
     $head = $ptr->get('rdf:first');
     $next = $ptr->get('rdf:rest');
     //putting all structure collection on a blacklist
     while ($head) {
         $this->_rm->getUnitOfWork()->managementBlackList($next->getUri());
         $head = $next->get('rdf:first');
         $next = $next->get('rdf:rest');
     }
     //and resetting pointer of collection
     $coll->rewind();
 }