equal
deleted
inserted
replaced
87 public function getSparqlClient() { |
87 public function getSparqlClient() { |
88 return $this->sparqlClient; |
88 return $this->sparqlClient; |
89 } |
89 } |
90 |
90 |
91 private function getResGraph($doc) { |
91 private function getResGraph($doc) { |
|
92 |
|
93 if(empty((array)$doc)) { |
|
94 return null; |
|
95 } |
|
96 |
92 $newGraph = new Graph($doc->uri->getUri()); |
97 $newGraph = new Graph($doc->uri->getUri()); |
93 $newGraph->add($doc->uri, "rdf:type", $newGraph->resource("http://www.openarchives.org/ore/terms/Aggregation")); |
98 $newGraph->add($doc->uri, "rdf:type", $newGraph->resource("http://www.openarchives.org/ore/terms/Aggregation")); |
94 $newGraph->add($doc->uri, "http://www.europeana.eu/schemas/edm/aggregatedCHO", $doc->doc); |
99 $newGraph->add($doc->uri, "http://www.europeana.eu/schemas/edm/aggregatedCHO", $doc->doc); |
95 $newGraph->add($doc->doc, "rdf:type", $newGraph->resource("http://www.europeana.eu/schemas/edm/ProvidedCHO")); |
100 $newGraph->add($doc->doc, "rdf:type", $newGraph->resource("http://www.europeana.eu/schemas/edm/ProvidedCHO")); |
96 if(isset($doc->title)) { |
101 if(isset($doc->title)) { |
134 } |
139 } |
135 |
140 |
136 $docs = $this->sparqlClient->query(self::BASE_DOC_QUERY.$limitsClausesStr); |
141 $docs = $this->sparqlClient->query(self::BASE_DOC_QUERY.$limitsClausesStr); |
137 foreach($docs as $doc) { |
142 foreach($docs as $doc) { |
138 $graph = $this->getResGraph($doc); |
143 $graph = $this->getResGraph($doc); |
|
144 if(is_null($graph)) { |
|
145 continue; |
|
146 } |
139 $uri = $doc->uri->getUri(); |
147 $uri = $doc->uri->getUri(); |
140 $resDocs[$uri] = $graph; |
148 $resDocs[$uri] = $graph; |
141 } |
149 } |
142 |
150 |
143 if(count($resDocs) == 0) { |
151 if(count($resDocs) == 0) { |
148 |
156 |
149 foreach(self::ADDITIONAL_DOC_QUERIES as $query) { |
157 foreach(self::ADDITIONAL_DOC_QUERIES as $query) { |
150 $docs = $this->sparqlClient->query(sprintf($query, $filterUris)); |
158 $docs = $this->sparqlClient->query(sprintf($query, $filterUris)); |
151 foreach($docs as $doc) { |
159 foreach($docs as $doc) { |
152 $graph = $this->getResGraph($doc); |
160 $graph = $this->getResGraph($doc); |
|
161 if(is_null($graph)) { |
|
162 continue; |
|
163 } |
153 |
164 |
154 $uri = $doc->uri->getUri(); |
165 $uri = $doc->uri->getUri(); |
155 if(array_key_exists($uri, $resDocs)) { |
166 if(array_key_exists($uri, $resDocs)) { |
156 $resDocs[$uri] = Utils::mergeGraphs($resDocs[$uri], $graph); |
167 $resDocs[$uri] = Utils::mergeGraphs($resDocs[$uri], $graph); |
157 } else { |
168 } else { |