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_09412

Check there are no entries whose gene is not located either on chromosome 1-22, X, Y, MT, or unknown

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

select distinct ?entry ?chr where {
  ?entry :gene  ?gene .
  ?gene :chromosome ?chr .
  filter (?chr not in ("1"^^xsd:string,
	"2"^^xsd:string,
	"3"^^xsd:string,
	"4"^^xsd:string,
	"5"^^xsd:string,
	"6"^^xsd:string,
	"7"^^xsd:string,
	"8"^^xsd:string,
	"9"^^xsd:string,
	"10"^^xsd:string,
	"11"^^xsd:string,
	"12"^^xsd:string,
	"13"^^xsd:string,
	"14"^^xsd:string,
	"15"^^xsd:string,
	"16"^^xsd:string,
	"17"^^xsd:string,
	"18"^^xsd:string,
	"19"^^xsd:string,
	"20"^^xsd:string,
	"21"^^xsd:string,
	"22"^^xsd:string,
	"X"^^xsd:string,
	"Y"^^xsd:string,
	"MT"^^xsd:string,
	"unknown"^^xsd:string))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?chr"):::projected 
  v2("?entry"):::projected 
  v3("?gene")
  f0[["?chr != '1'?chr != '2'?chr != '3'?chr != '4'?chr != '5'?chr != '6'?chr != '7'?chr != '8'?chr != '9'?chr != '10'?chr != '11'?chr != '12'?chr != '13'?chr != '14'?chr != '15'?chr != '16'?chr != '17'?chr != '18'?chr != '19'?chr != '20'?chr != '21'?chr != '22'?chr != 'X'?chr != 'Y'?chr != 'MT'?chr != 'unknown'"]]
  f0 --> v1
  v2 --":gene"-->  v3
  v3 --":chromosome"-->  v1