Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Optimized sparql object queries.

  • Loading branch information...
rasvaan committed Oct 30, 2016
1 parent 63c511b commit df8fc661a23918dd49d4a4730172697fa4972594
Showing with 27 additions and 18 deletions.
  1. +18 −0 sparql_queries
  2. +9 −18 src/helpers/objects.js
@@ -1,3 +1,21 @@
############### filter query ###############
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?aggregation ?rights ?object ?view ?title ?creator
WHERE {
?object rdf:type edm:ProvidedCHO .
?object dc:description ?description .
FILTER ( lang(?description) = "nl" && regex(?description, " oehoe ", "i") )
?aggregation edm:aggregatedCHO ?object .
?aggregation edm:isShownBy ?view .
?aggregation edm:rights ?rights .
?object dc:title ?title .
?object dc:creator ?creatorId .
?creatorId skos:prefLabel ?creator .
}

############### annotation concept query ###############
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
@@ -86,7 +86,7 @@ module.exports = {
// only filter, since we have no suitable concepts to query for
let filter = (parameters.common_name_nl || parameters.common_name).toLowerCase();
const query = this.sparqlObjectQueries(filter)['edm_filter_desciption'];

console.log(query);
return tripleStore.query(platform, query.query).then((values) => {
return _this.processSparqlAggregations(values, 'dctype:Image');
}).then((aggregations) => {
@@ -121,6 +121,7 @@ module.exports = {

for (let i=0; i<results.length; i++) {
const result = results[i];
console.log(result);
const index = uris.indexOf(result.aggregation.value);

// see if already present in aggregations
@@ -133,6 +134,7 @@ module.exports = {
// extend information object when possible
if (result.creator) culturalObject.addCreator(result.creator.value);
if (result.title) culturalObject.addTitle(result.title.value);
if (result.description) culturalObject.addDescription(result.description.value);

let aggregation = new Aggregation(
result.aggregation.value,
@@ -168,15 +170,9 @@ module.exports = {
"?aggregation edm:aggregatedCHO ?object . " +
"?aggregation edm:isShownBy ?view . " +
"?aggregation edm:rights ?rights . " +
"OPTIONAL { " +
" ?object dc:title ?title . " +
" FILTER ( lang(?title) = \"en\" ) " +
"} " +
"OPTIONAL { " +
" ?object dc:creator ?creatorId . " +
" ?creatorId skos:prefLabel ?creator . " +
" FILTER ( lang(?creator) = \"en\" ) " +
"} " +
"?object dc:title ?title . " +
"?object dc:creator ?creatorId . " +
"?creatorId skos:prefLabel ?creator . " +
"} ",
"name": "description filter"
},
@@ -195,14 +191,9 @@ module.exports = {
"?aggregation edm:aggregatedCHO ?object . " +
"?aggregation edm:isShownBy ?view . " +
"?aggregation edm:rights ?rights . " +
"OPTIONAL { " +
" ?object dc:title ?title . " +
" FILTER ( lang(?title) = \"en\" ) " +
"} " +
"OPTIONAL { " +
" ?object dc:creator ?creatorId . " +
" ?creatorId skos:prefLabel ?creator . " +
" FILTER ( lang(?creator) = \"en\" ) " +
"?object dc:title ?title . " +
"?object dc:creator ?creatorId . " +
"?creatorId skos:prefLabel ?creator . " +
"} " +
"} ",
"name": "description filter"

0 comments on commit df8fc66

Please sign in to comment.
You can’t perform that action at this time.