# HG changeset patch # User ymh # Date 1473354946 -7200 # Node ID ef32bf573d9c46bd99faf7da538a4e21246648d8 # Parent a4d8618c2f1b415103c0ab6840630c4198f44031 correct error in test with empty document returned by query diff -r a4d8618c2f1b -r ef32bf573d9c server/src/app/Repositories/RdfDocumentRepository.php --- a/server/src/app/Repositories/RdfDocumentRepository.php Tue Sep 06 16:50:41 2016 +0200 +++ b/server/src/app/Repositories/RdfDocumentRepository.php Thu Sep 08 19:15:46 2016 +0200 @@ -89,6 +89,11 @@ } private function getResGraph($doc) { + + if(empty((array)$doc)) { + return null; + } + $newGraph = new Graph($doc->uri->getUri()); $newGraph->add($doc->uri, "rdf:type", $newGraph->resource("http://www.openarchives.org/ore/terms/Aggregation")); $newGraph->add($doc->uri, "http://www.europeana.eu/schemas/edm/aggregatedCHO", $doc->doc); @@ -136,6 +141,9 @@ $docs = $this->sparqlClient->query(self::BASE_DOC_QUERY.$limitsClausesStr); foreach($docs as $doc) { $graph = $this->getResGraph($doc); + if(is_null($graph)) { + continue; + } $uri = $doc->uri->getUri(); $resDocs[$uri] = $graph; } @@ -150,6 +158,9 @@ $docs = $this->sparqlClient->query(sprintf($query, $filterUris)); foreach($docs as $doc) { $graph = $this->getResGraph($doc); + if(is_null($graph)) { + continue; + } $uri = $doc->uri->getUri(); if(array_key_exists($uri, $resDocs)) {