예제 #1
0
 public function testManagerRegisterResource()
 {
     $uow = new UnitOfWork($this->manager, 'fooUrl');
     $res = $this->getMockedResource('FooClass', 'uri:foo:1234', $this->getMockedGraph('FooClass', 'uri:foo:1234'));
     $uow->registerResource($res);
     $this->assertTrue($uow->isRegistered($res));
     $retrieved = $uow->retrieveResource($res->getUri());
     $this->assertEquals($res, $retrieved);
 }
예제 #2
0
 /**
  * Proceeds to a copy of resource provided as argument and stores it.
  *
  * @param BaseResource $resource
  *
  * @return BaseResource
  */
 public function takeSnapshot($resource)
 {
     $res = $this->resource($resource->getUri());
     $graph = $resource->getGraph();
     foreach ($graph->toRdfPhp() as $resource2 => $properties) {
         if ($resource2 !== $res->getUri()) {
             continue;
         }
         if (!$this->unitOfWork->isManagementBlackListed($resource2)) {
             foreach ($properties as $property => $values) {
                 foreach ($values as $value) {
                     if ($value['type'] === 'bnode' || $value['type'] === 'uri') {
                         $this->addResource($resource2, $property, $value['value']);
                     } elseif ($value['type'] === 'literal') {
                         $this->addLiteral($resource2, $property, Literal::create($value['value'], isset($value['lang']) ? $value['lang'] : null, isset($value['datatype']) ? $value['datatype'] : null));
                     } else {
                     }
                 }
             }
         }
     }
     return $res;
 }
예제 #3
0
파일: Manager.php 프로젝트: conjecto/nemrod
 /**
  * calls Managers UnitOfWork commit function.
  */
 public function flush()
 {
     $this->unitOfWork->commit();
 }