sparql-examples

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

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

003

rq turtle/ttl

Count the number of unique image map annotation keys

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 (count(distinct ?key) as ?nkey) where {
  ?img a omecore:Image;
       omecore:hasAnnotation/omecore:mapEntry/omecore:key ?key .
  }

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