A set of SPARQL examples that are used in different SIB resources
Diseases/phenotypes associated with coding variants and associated publications for a given gene
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 sio: <http://semanticscience.org/resource/>
PREFIX so: <http://purl.obolibrary.org/obo/SO_>
SELECT DISTINCT ?entry (str(?umlsTerm) as ?umlsTermSTR) (str(?snpac) as ?varid) ?pos (str(?orgaa) as ?orgAA) (str(?varaa) as ?varAA) ?article WHERE {
SERVICE <https://rdf.disgenet.org/sparql> {
?vda sio:SIO_000628 ?umls, ?variant .
?vda sio:SIO_000772 ?article .
?umls dcterms:title ?umlsTerm.
{?umls a sio:SIO_010299 .} # disease
union
{?umls a sio:SIO_010056 .} # or phenotype
?variant a so:0001583 ; dcterms:title ?variantTitle . # Missense variant
?variant so:associated_with ?gene .
?gene a ncit:C16612; sio:SIO_010078 ?protein .
?gene sio:SIO_000205 ?gname.
filter(contains(str(?gname),"HBB")) # Hemoglobin gene (NX_P68871)
}
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
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?article"):::projected
v12("?entry"):::projected
v9("?gene")
v3("?gname")
v13("?iso")
v21("?orgAA")
v17("?orgaa"):::projected
v16("?pos"):::projected
v10("?protein")
v1("?snpac"):::projected
v5("?umls")
v8("?umlsTerm"):::projected
v19("?umlsTermSTR")
v11("?unipage")
v14("?var")
v22("?varAA")
v18("?varaa"):::projected
v6("?variant")
v2("?variantTitle")
v20("?varid")
v4("?vda")
v15("?xref")
a1((" "))
c7(["sio:SIO_010299"]):::iri
c8(["sio:SIO_010056"]):::iri
c22([":db/dbSNP"]):::iri
c9(["so:0001583"]):::iri
c11(["ncit:C16612"]):::iri
c17(["true^^xsd:boolean"]):::literal
f0[["contains(?snpac,str(?variantTitle))"]]
f0 --> v1
f0 --> v2
subgraph s1["https://rdf.disgenet.org/sparql"]
style s1 stroke-width:4px;
f1[["contains(str(?gname),'HBB')"]]
f1 --> v3
v4 --"sio:SIO_000628"--> v5
v4 --"sio:SIO_000628"--> v6
v4 --"sio:SIO_000772"--> v7
v5 --"dcterms:title"--> v8
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v5 --"a"--> c8
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v5 --"a"--> c7
end
union0r <== or ==> union0l
end
v6 --"a"--> c9
v6 --"dcterms:title"--> v2
v6 --"so:associated_with"--> v9
v9 --"a"--> c11
v9 --"sio:SIO_010078"--> v10
v9 --"sio:SIO_000205"--> v3
end
bind2[/"replace(str(?protein),'purl','www')"/]
v10 --o bind2
bind2 --as--o v11
v12 --":swissprotPage"--> v11
v12 --":isoform"--> v13
v13 --":swissprotDisplayed"--> c17
v13 --":variant"--> v14
v14 --":evidence"--> a1
a1 --":reference"--> v15
v15 --":provenance"--> c22
v15 --":accession"--> v1
v14 --":start"--> v16
v14 --":original"--> v17
v14 --":variation"--> v18
bind3[/"str(?umlsTerm)"/]
v8 --o bind3
bind3 --as--o v19
bind4[/"str(?snpac)"/]
v1 --o bind4
bind4 --as--o v20
bind5[/"str(?orgaa)"/]
v17 --o bind5
bind5 --as--o v21
bind6[/"str(?varaa)"/]
v18 --o bind6
bind6 --as--o v22