A set of SPARQL examples that are used in different SIB resources
Proteins with high-frequency missense variants involved in bacterial infection, with dbSNP identifiers and position on the canonical isoform
PREFIX : <http://nextprot.org/rdf/>
PREFIX db: <http://nextprot.org/rdf/db/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX so: <http://purl.obolibrary.org/obo/SO_>
SELECT DISTINCT ?entry ?umlsTerm (str(?snpac) as ?varid) ?pos (str(?orgaa) as ?orgAA) (str(?varaa) as ?varAA) WHERE {
SERVICE <https://rdf.disgenet.org/sparql> {
SELECT DISTINCT ?protein ?variantTitle ?umlsTerm
WHERE {
?vda sio:SIO_000628 ?umls, ?variant .
?umls dcterms:title ?umlsTerm ; skos:exactMatch ?doid .
?doid rdfs:subClassOf+ <http://purl.obolibrary.org/obo/DOID_104> . # DO id for bacterial infection
?variant a so:0001583 ; dcterms:title ?variantTitle . # Missense variant
?variant so:associated_with ?gene .
?variant sio:SIO_000223 ?altAl .
?altAl rdf:type <http://purl.obolibrary.org/obo/GENO_0000476>; sio:SIO_000900 ?altAlFreq .
?altAlFreq a sio:SIO_001367; sio:SIO_000300 ?altAlFreqVal .
filter(?altAlFreqVal > 0.01) # freq > 1%
?gene a ncit:C16612; sio:SIO_010078 ?protein .
}
}
BIND(IRI(replace(str(?protein),"purl","www")) AS ?unipage) .
?entry :swissprotPage ?unipage .
?entry :isoform ?iso .
?iso :swissprotDisplayed true .
?iso :variant ?var .
?var :evidence /:reference ?xref .
?xref :provenance db:dbSNP; :accession ?snpac .
?var :start ?pos ; :original ?orgaa; :variation ?varaa .
filter(contains(?snpac,str(?variantTitle))) # matches the exact same variant Disgenet returned
} order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?altAl")
v12("?altAlFreq")
v4("?altAlFreqVal")
v9("?doid")
v1("?entry"):::projected
v10("?gene")
v15("?iso")
v22("?orgAA")
v19("?orgaa"):::projected
v18("?pos"):::projected
v13("?protein")
v2("?snpac"):::projected
v6("?umls")
v8("?umlsTerm"):::projected
v14("?unipage")
v16("?var")
v23("?varAA")
v20("?varaa"):::projected
v7("?variant")
v3("?variantTitle")
v21("?varid")
v5("?vda")
v17("?xref")
a1((" "))
c26([":db/dbSNP"]):::iri
c12([http://purl.obolibrary.org/obo/GENO_0000476]):::iri
c7([http://purl.obolibrary.org/obo/DOID_104]):::iri
c14(["sio:SIO_001367"]):::iri
c9(["so:0001583"]):::iri
c16(["ncit:C16612"]):::iri
c21(["true^^xsd:boolean"]):::literal
f0[["contains(?snpac,str(?variantTitle))"]]
f0 --> v2
f0 --> v3
subgraph s1["https://rdf.disgenet.org/sparql"]
style s1 stroke-width:4px;
f1[["?altAlFreqVal > '0.01^^xsd:decimal'"]]
f1 --> v4
v5 --"sio:SIO_000628"--> v6
v5 --"sio:SIO_000628"--> v7
v6 --"dcterms:title"--> v8
v6 --"skos:exactMatch"--> v9
v9 --"rdfs:subClassOf"--> c7
v7 --"a"--> c9
v7 --"dcterms:title"--> v3
v7 --"so:associated_with"--> v10
v7 --"sio:SIO_000223"--> v11
v11 --"a"--> c12
v11 --"sio:SIO_000900"--> v12
v12 --"a"--> c14
v12 --"sio:SIO_000300"--> v4
v10 --"a"--> c16
v10 --"sio:SIO_010078"--> v13
end
bind2[/"replace(str(?protein),'purl','www')"/]
v13 --o bind2
bind2 --as--o v14
v1 --":swissprotPage"--> v14
v1 --":isoform"--> v15
v15 --":swissprotDisplayed"--> c21
v15 --":variant"--> v16
v16 --":evidence"--> a1
a1 --":reference"--> v17
v17 --":provenance"--> c26
v17 --":accession"--> v2
v16 --":start"--> v18
v16 --":original"--> v19
v16 --":variation"--> v20
bind3[/"str(?snpac)"/]
v2 --o bind3
bind3 --as--o v21
bind4[/"str(?orgaa)"/]
v19 --o bind4
bind4 --as--o v22
bind5[/"str(?varaa)"/]
v20 --o bind5
bind5 --as--o v23