diff -r a2342f26c9de -r b0b56e0f8c7f server/src/app/Repositories/RdfDocumentRepository.php --- a/server/src/app/Repositories/RdfDocumentRepository.php Fri Jan 15 15:27:56 2016 +0100 +++ b/server/src/app/Repositories/RdfDocumentRepository.php Fri Jan 15 15:35:00 2016 +0100 @@ -40,6 +40,9 @@ $newGraph->add($doc->uri, "http://www.europeana.eu/schemas/edm/aggregatedCHO", $doc->doc); $newGraph->add($doc->doc, "rdf:type", $newGraph->resource("http://www.europeana.eu/schemas/edm/ProvidedCHO")); $newGraph->add($doc->doc, "http://purl.org/dc/elements/1.1/title", $doc->title); + if(isset($doc->lang)) { + $newGraph->add($doc->doc, "http://purl.org/dc/elements/1.1/language", $doc->lang); + } if(isset($doc->issued)) { $newGraph->add($doc->doc, "http://purl.org/dc/terms/issued", $doc->issued); } @@ -55,10 +58,11 @@ public function all() { return $this->queryDocs( - "SELECT DISTINCT ?uri ?doc ?title ?issued ?modified". + "SELECT DISTINCT ?uri ?doc ?title ?issued ?modified ?lang". " WHERE {". " GRAPH ?uri { ?doc a .". " ?doc ?title.". + " OPTIONAL {?doc ?lang.} ". " OPTIONAL {?doc ?issued.} ". " OPTIONAL {?doc ?modified.} }". " } ORDER BY ?uri" @@ -79,7 +83,8 @@ return null; } - return new Document($docUri, $doc); + // clone the graph to force the URI + return new Document($docUri, new Graph($docUri, $doc->toRdfPhp())); } @@ -143,10 +148,11 @@ $offset = max(0,($page - 1) * $perPage); $query = - "SELECT DISTINCT ?uri ?doc ?title ?issued ?modified". + "SELECT DISTINCT ?uri ?doc ?title ?issued ?modified ?lang". " WHERE {". " GRAPH ?uri { ?doc a .". " ?doc ?title.". + " OPTIONAL {?doc ?lang.} ". " OPTIONAL {?doc ?issued.} ". " OPTIONAL {?doc ?modified.} }". " } ORDER BY ?uri OFFSET $offset LIMIT $perPage";