sparql-examples

A set of SPARQL examples that are used in different GerBI resources

View the Project on GitHub German-BioImaging/sparql-examples

007

rq turtle/ttl

Image map annotation keys and usage counts

Use at


  PREFIX owl: <http://www.w3.org/2002/07/owl#>
  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  PREFIX dcterms: <http://purl.org/dc/terms/>
  PREFIX dc: <http://purl.org/dc/elements/1.1/>
  PREFIX omecore: <https://ld.openmicroscopy.org/core/>
  PREFIX omekg: <https://ld.openmicroscopy.org/omekg#>
  PREFIX obda: <https://w3id.org/obda/vocabulary#>
  PREFIX xml: <http://www.w3.org/XML/1998/namespace/>
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
  PREFIX kv: <http://www.openmicroscopy.org/ns/default/>
  PREFIX idr: <https://idr.openmicroscopy.org/>
  PREFIX up: <http://purl.uniprot.org/core/>
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?key (COUNT(?value) AS ?n_usage)
WHERE {
  ?img a omecore:Image;
       omecore:hasAnnotation/omecore:mapEntry [
           omecore:key ?key;
           omecore:value ?value
       ] .
}
GROUP BY ?key
ORDER BY DESC(?n_usage)

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?img")
  v3("?key"):::projected 
  v5("?n_usage")
  v4("?value"):::projected 
  a2((" "))
  a1((" "))
  c2([https://ld.openmicroscopy.org/core/Image]):::iri 
  v2 --"a"-->  c2
  a1 --https://ld.openmicroscopy.org/core/key-->  v3
  a1 --https://ld.openmicroscopy.org/core/value-->  v4
  v2 --https://ld.openmicroscopy.org/core/hasAnnotation-->  a2
  a2 --https://ld.openmicroscopy.org/core/mapEntry-->  a1
  bind1[/"count(?value)"/]
  v4 --o bind1
  bind1 --as--o v5