Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SPARQL query to retrieve and display IIIF image annotations (created with Mirador and SimpleAnnotationServer, stored in Sesame). See http://demos.biblissima-condorcet.fr/ovide-moralise/
PREFIX exif: <http://www.w3.org/2003/12/exif/ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX cnt: <http://www.w3.org/2011/content#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX sc: <http://iiif.io/api/presentation/2#>
PREFIX sc1: <http://www.shared-canvas.org/ns/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX iiif: <http://iiif.io/api/image/2#>
PREFIX dctypes: <http://purl.org/dc/dcmitype/>
PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX svcs: <http://rdfs.org/sioc/services#>
SELECT DISTINCT ?anno ?canvas ?content ?fragment ?datecreated ?datemodified ?tag ?manifest ?manifestLabel ?canvasLabel ?attribution ?iiifurl ?iiifprofile
WHERE {
?anno rdf:type oa:Annotation .
GRAPH ?anno {
?anno oa:hasBody ?body ;
oa:hasTarget ?target ;
dcterms:created ?datecreated .
OPTIONAL {
?anno dcterms:modified ?datemodified .
}
OPTIONAL {
?anno oa:hasBody ?tagBody .
?tagBody rdf:type oa:Tag ;
cnt:chars ?tag .
}
?body cnt:chars ?content ;
rdf:type dctypes:Text .
?target oa:hasSource ?canvas ;
oa:hasSelector ?selector .
OPTIONAL { ?target dcterms:isPartOf ?manifest .}
?selector oa:default ?default .
?default rdf:value ?fragment .
} .
OPTIONAL {
GRAPH ?manifest {
?manifest rdfs:label ?manifestLabel .
OPTIONAL { ?manifest sc:attributionLabel ?attribution .}
?canvas rdfs:label ?canvasLabel .
?imageAnno oa:hasTarget ?canvas ;
oa:hasBody ?image .
{ ?image svcs:has_service ?iiifurl } UNION { ?image sc1:hasRelatedService ?iiifurl }
{ ?iiifurl dcterms:conformsTo ?iiifprofile } UNION { ?iiifurl doap:implements ?iiifprofile }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment