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_DEREF_003

Query for an Entry Instance e.g entry:NX_Q8WZ42

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX entry: <http://nextprot.org/rdf/entry/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

CONSTRUCT {
    ?INSTANCE rdf:type ?type.
    ?INSTANCE :gene ?gene.
    ?INSTANCE :existence ?existence.
    ?INSTANCE :swissprotPage ?swissprotPage.
    ?INSTANCE skos:exactMatch ?skos.
    ?INSTANCE :isoformCount ?isoformCount.
    ?INSTANCE :isoform ?isoform.
    ?INSTANCE :classifiedWith ?classifiedWith.
    ?INSTANCE :recommendedName [rdfs:label ?recommendedName ;].
}
WHERE {
        ?INSTANCE rdf:type ?type.
        ?INSTANCE :gene ?gene.
        ?INSTANCE :existence ?existence.
        ?INSTANCE :swissprotPage ?swissprotPage.
        ?INSTANCE skos:exactMatch ?skos.
        ?INSTANCE :isoformCount ?isoformCount.
        {
           ?INSTANCE :isoform ?isoform.
            ?isoform :canonicalIsoform "true"^^xsd:boolean.
        } union {
            ?INSTANCE :classifiedWith ?classifiedWith.
        } union {
            ?INSTANCE :recommendedName / rdfs:label ?recommendedName.
        }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?INSTANCE"):::projected 
  v19("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab4134")
  v21("?_const_19b813e_uri"):::projected 
  v14("?_const_300ea0f3_uri"):::projected 
  v17("?_const_50476c81_uri"):::projected 
  v15("?_const_73e8c46b_uri"):::projected 
  v20("?_const_9285ccfc_uri"):::projected 
  v12("?_const_d448e45d_uri"):::projected 
  v13("?_const_eb7cadfa_uri"):::projected 
  v16("?_const_ef819d0e_uri"):::projected 
  v18("?_const_f4648cc1_uri"):::projected 
  v11("?_const_f5e5585a_uri"):::projected 
  v9("?classifiedWith"):::projected 
  v4("?existence"):::projected 
  v3("?gene"):::projected 
  v8("?isoform"):::projected 
  v7("?isoformCount"):::projected 
  v10("?recommendedName"):::projected 
  v6("?skos"):::projected 
  v5("?swissprotPage"):::projected 
  v2("?type"):::projected 
  a1((" ")):::projected 
  c9(["true^^xsd:boolean"]):::literal 
  v1 --"a"-->  v2
  v1 --":gene"-->  v3
  v1 --":existence"-->  v4
  v1 --":swissprotPage"-->  v5
  v1 --"skos:exactMatch"-->  v6
  v1 --":isoformCount"-->  v7
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      v1 --":recommendedName"-->  a1
      a1 --"rdfs:label"-->  v10
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v1 --":classifiedWith"-->  v9
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v1 --":isoform"-->  v8
    v8 --":canonicalIsoform"-->  c9
  end
  union0r <== or ==> union0l
  end
  bind0[/""a""/]
  bind0 --as--o v11
  bind1[/"':gene'"/]
  bind1 --as--o v12
  bind2[/"':existence'"/]
  bind2 --as--o v13
  bind3[/"':swissprotPage'"/]
  bind3 --as--o v14
  bind4[/"'skos:exactMatch'"/]
  bind4 --as--o v15
  bind5[/"':isoformCount'"/]
  bind5 --as--o v16
  bind6[/"':isoform'"/]
  bind6 --as--o v17
  bind7[/"':classifiedWith'"/]
  bind7 --as--o v18
  bind8[/""/]
  bind8 --as--o v19
  bind9[/"'rdfs:label'"/]
  bind9 --as--o v20
  bind10[/"':recommendedName'"/]
  bind10 --as--o v21