sparql-examples

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

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

005

rq turtle/ttl

Map image Gene Identifer URLs from Project:201 from TAIR accessions to uniprot protein IDs.

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#>
PREFIX idrprj: <https://idr.openmicroscopy.org/Project/>
prefix database: <http://purl.uniprot.org/database/>
prefix taxon: <http://purl.uniprot.org/taxonomy/>

select distinct ?tair_accession ?protein where {
  idrprj:201 dcterms:hasPart/dcterms:hasPart ?img .
  ?img omecore:hasAnnotation/omecore:mapEntry [omecore:key ?key; omecore:value ?gene_identifier] ;
       ^dcterms:hasPart/^dcterms:hasPart ?prj .
  values ?key {"Gene Identifier"}
  bind(iri(concat("http://purl.uniprot.org/tair/", ?gene_identifier)) as ?tair_accession)

  service <https://sparql.uniprot.org/sparql> {
    ?protein a up:Protein;
             rdfs:seeAlso ?tair_accession ;
             up:organism taxon:3702 .
    ?tair_accession up:database database:TAIR ;
    }
}
limit 100

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?gene_identifier")
  v1("?img")
  v5("?key")
  v4("?prj")
  v6("?protein"):::projected 
  v5("?tair_accession"):::projected 
  a1((" "))
  a3((" "))
  a2((" "))
  a4((" "))
  c12(["taxon:3702"]):::iri 
  c14([http://purl.uniprot.org/database/TAIR]):::iri 
  c9(["up:Protein"]):::iri 
  c1([https://idr.openmicroscopy.org/Project/201]):::iri 
  c1 --"dcterms:hasPart"-->  a1
  a1 --"dcterms:hasPart"-->  v1
  a2 --https://ld.openmicroscopy.org/core/key-->  v5
  a2 --https://ld.openmicroscopy.org/core/value-->  v3
  v1 --https://ld.openmicroscopy.org/core/hasAnnotation-->  a3
  a3 --https://ld.openmicroscopy.org/core/mapEntry-->  a2
  a4 --"dcterms:hasPart"-->  v1
  v4 --"dcterms:hasPart"-->  a4
  bind0[/VALUES ?key/]
  bind0-->v5
  bind00(["Gene Identifier"])
  bind00 --> bind0
  bind1[/"concat('http://purl.uniprot.org/tair/',?gene_identifier)"/]
  v3 --o bind1
  bind1 --as--o v5
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v6 --"a"-->  c9
    v6 --"rdfs:seeAlso"-->  v5
    v6 --"up:organism"-->  c12
    v5 --"up:database"-->  c14
  end