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_09629

Check there are no entries in the Ion channels variants portal that do not have a variant phenotype annotation

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 /:proteoform /:phenotypicVariation ?phenotype} # No phenotype annotation
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?entry"):::projected 
  v5("?gene")
  v5("?genename")
  v6("?gn")
  v2("?phenotype")
  a3((" "))
  a4((" "))
  a1((" "))
  a2((" "))
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --":isoform"-->  e0a1
    e0a1 --":proteoform"-->  e0a2
    e0a2 --":phenotypicVariation"-->  e0v2
    e0v1("?entry"):::projected 
    e0v2("?phenotype"):::projected 
    e0a1((" ")):::projected 
    e0a2((" ")):::projected 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> c1
  f0 --> a1
  f0 --> c2
  f0 --> a2
  f0 --> c3
  f0 --> v2
  v1 --":isoform"-->  a1
  a1 --":proteoform"-->  a2
  a2 --":phenotypicVariation"-->  v2
  f1[["?gn = ?gene"]]
  f1 --> v6
  f1 --> v5
  bind2[/VALUES ?gene/]
  bind2-->v5
  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"-->  v5
  bind3[/"str(?genename)"/]
  v5 --o bind3
  bind3 --as--o v6