sparql-examples

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

View the Project on GitHub sib-swiss/sparql-examples

neXtProt/NXQ_00258

Proteins involved in diseases due to intronic variants with one selected publication

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX so: <http://purl.obolibrary.org/obo/SO_>

SELECT DISTINCT ?entry (str(?gen) as ?gene) ?diseaseTitle ?sampleArticle WHERE {
 SERVICE <https://rdf.disgenet.org/sparql> {
 SELECT DISTINCT ?protein ?diseaseTitle (sample(?article) as ?sampleArticle) WHERE {
 ?vda sio:SIO_000628 ?variant,?disease .
	?vda sio:SIO_000772 ?article .
 ?disease a sio:SIO_010299 ; dcterms:title ?diseaseTitle . # true disease, use ncit:C7057 for traits
 ?variant a so:0001627 ; dcterms:title ?variantTitle . # intron variant
 ?variant so:associated_with ?gene .
 ?gene a ncit:C16612; sio:SIO_010078 ?protein .
 } group by ?protein ?diseaseTitle
 }
 BIND(IRI(replace(str(?protein),"purl","www")) AS ?unipage) .
 ?entry :swissprotPage ?unipage .
 ?entry :gene / :recommendedName / rdfs:label ?gen .
} order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?article")
  v4("?disease")
  v6("?diseaseTitle"):::projected 
  v1("?entry"):::projected 
  v12("?gen"):::projected 
  v13("?gene")
  v9("?protein")
  v10("?sampleArticle"):::projected 
  v11("?unipage")
  v3("?variant")
  v7("?variantTitle")
  v2("?vda")
  a1((" "))
  a2((" "))
  c9(["ncit:C16612"]):::iri 
  c5(["sio:SIO_010299"]):::iri 
  c7(["so:0001627"]):::iri 
  subgraph s1["https://rdf.disgenet.org/sparql"]
    style s1 stroke-width:4px;
    v2 --"sio:SIO_000628"-->  v3
    v2 --"sio:SIO_000628"-->  v4
    v2 --"sio:SIO_000772"-->  v5
    v4 --"a"-->  c5
    v4 --"dcterms:title"-->  v6
    v3 --"a"-->  c7
    v3 --"dcterms:title"-->  v7
    v3 --"so:associated_with"-->  v13
    v13 --"a"-->  c9
    v13 --"sio:SIO_010078"-->  v9
    bind1[/"sample(?article)"/]
    v5 --o bind1
    bind1 --as--o v10
  end
  bind2[/"replace(str(?protein),'purl','www')"/]
  v9 --o bind2
  bind2 --as--o v11
  v1 --":swissprotPage"-->  v11
  v1 --":gene"-->  a1
  a1 --":recommendedName"-->  a2
  a2 --"rdfs:label"-->  v12
  bind3[/"str(?gen)"/]
  v12 --o bind3
  bind3 --as--o v13