A set of SPARQL examples that are used in different SIB resources
Retrieve images of 'Anas' (Ducks) from the European Environmental Agency databases (federated query).
PREFIX eunisSpecies: <http://eunis.eea.europa.eu/rdf/species-schema.rdf#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT
?taxon
?ncbiTaxid
?eunisTaxon
?eunisName
?image
WHERE
{
GRAPH <http://sparql.uniprot.org/taxonomy>
{
?taxon a up:Taxon .
# Taxon subclasses are materialized, do not use rdfs:subClassOf+
?taxon rdfs:subClassOf taxon:8835 .
BIND(strafter(str(?taxon), 'onomy/') AS ?ncbiTaxid)
}
SERVICE <https://semantic.eea.europa.eu/sparql>
{
?eunisTaxon a eunisSpecies:SpeciesSynonym ;
eunisSpecies:binomialName ?eunisName ;
eunisSpecies:sameSpeciesNCBI ?ncbiTaxid ;
<http://xmlns.com/foaf/0.1/depiction> ?image .
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?eunisName"):::projected
v3("?eunisTaxon"):::projected
v5("?image"):::projected
v2("?ncbiTaxid"):::projected
v1("?taxon"):::projected
c7(["eunisSpecies:SpeciesSynonym"]):::iri
c5(["taxon:8835"]):::iri
c2(["up:Taxon"]):::iri
v1 --"a"--> c2
v1 --"rdfs:subClassOf"--> c5
bind0[/"substring-after(str(?taxon),'onomy/')"/]
v1 --o bind0
bind0 --as--o v2
subgraph s1["https://semantic.eea.europa.eu/sparql"]
style s1 stroke-width:4px;
v3 --"a"--> c7
v3 --"eunisSpecies:binomialName"--> v4
v3 --"eunisSpecies:sameSpeciesNCBI"--> v2
v3 --http://xmlns.com/foaf/0.1/depiction--> v5
end