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_09628

Check there are no entries in the Ion channels variants portal that do not have the GO molecular function Voltage-gated sodium channel activity (GO:0005248)

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

select distinct ?entry where {
  values ?gene
  {"SCN1A" "SCN2A" "SCN3A" "SCN4A" "SCN5A" "SCN8A" "SCN9A" "SCN10A" "SCN11A"} # space-separated

  ?entry :gene / :name  / rdfs:label ?genename .
  bind (str(?genename) as ?gn) # here we convert "xxx"^^xsd:string to "xxx" to match the values
  filter(?gn = ?gene)
  filter not exists {?entry :isoform /:goMolecularFunction /:term cv:GO_0005248.} # Voltage-gated sodium channel activity
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?entry"):::projected 
  v4("?gene")
  v4("?genename")
  v5("?gn")
  a3((" "))
  a4((" "))
  a1((" "))
  a2((" "))
  c4([":terminology/GO_0005248"]):::iri 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --":isoform"-->  e0a1
    e0a1 --":goMolecularFunction"-->  e0a2
    e0a2 --":term"-->  e0c4
    e0v1("?entry"):::projected 
    e0a1((" ")):::projected 
    e0a2((" ")):::projected 
    e0c4([":terminology/GO_0005248"]):::iri 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> c1
  f0 --> a1
  f0 --> c2
  f0 --> a2
  f0 --> c3
  f0 --> c4
  v1 --":isoform"-->  a1
  a1 --":goMolecularFunction"-->  a2
  a2 --":term"-->  c4
  f1[["?gn = ?gene"]]
  f1 --> v5
  f1 --> v4
  bind2[/VALUES ?gene/]
  bind2-->v4
  bind20(["SCN1A"])
  bind20 --> bind2
  bind21(["SCN2A"])
  bind21 --> bind2
  bind22(["SCN3A"])
  bind22 --> bind2
  bind23(["SCN4A"])
  bind23 --> bind2
  bind24(["SCN5A"])
  bind24 --> bind2
  bind25(["SCN8A"])
  bind25 --> bind2
  bind26(["SCN9A"])
  bind26 --> bind2
  bind27(["SCN10A"])
  bind27 --> bind2
  bind28(["SCN11A"])
  bind28 --> bind2
  v1 --":gene"-->  a3
  a3 --":name"-->  a4
  a4 --"rdfs:label"-->  v4
  bind3[/"str(?genename)"/]
  v4 --o bind3
  bind3 --as--o v5