/** * */ public function setBNodes($uri, $property, Graph $graph) { $uri = $this->_rm->getNamespaceRegistry()->expand($uri); if (empty($this->registeredResources[$uri])) { throw new Exception('no parent resource'); } /** @var \Conjecto\Nemrod\Resource $owningResource */ $owningResource = $this->registeredResources[$uri]; /* @var Graph $graph */ $owningGraph = $owningResource->getGraph(); $owningGraph->delete($uri, $property); /** @var BaseResource $res */ foreach ($graph->allResources($uri, $property) as $res) { $bnode = $owningGraph->newBNode(); $owningGraph->add($uri, $property, $bnode); $rdfPhp = $res->getGraph()->toRdfPhp(); // if (!empty($rdfPhp[$res->getUri()])) { foreach ($rdfPhp[$res->getUri()] as $prop => $vals) { foreach ($vals as $val) { $bnode->set($prop, $val['value']); } } } } }