sparql-examples

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

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

Query_106

rq turtle/ttl

Cell lines resistant to benzamides (a class of chemical compound)

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select distinct ?cl ?cl_name
('resistant to' as ?link) ?compound_ac (substr(?label2,0,30) as ?compound_name)
('which is more specific than' as ?relation)  ?generic_component
where {
  #values ?generic_component { "cyclic compound" } . # large class of chemical compound
  values ?generic_component { "benzamides"  } .     # uncomment to use another large class of chemical compound
  ?concept1 skos:prefLabel ?generic_component .      # get concept from its label (concept1)
  ?concept1 skos:notation ?code1 .                   # get notation code of the concept
  ?cl cello:hasResistance ?compound .                # cell line with resistance to some chemical compound
  ?cl cello:recommendedName ?cl_name .
  ?compound cello:isIdentifiedByXref ?concept2.      # get concept identifying the chemical compound (concept2)
  ?concept2 cello:more_specific_than+ ?concept1 .	 # concept2 must be equal or more specific than concept1
  ?concept2 skos:notation ?compound_ac .		     # get notation of concept 2
  ?concept2 skos:prefLabel ?label2.                  # get label of concept 2
}
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?cl"):::projected 
  v6("?cl_name"):::projected 
  v3("?code1")
  v5("?compound")
  v8("?compound_ac"):::projected 
  v11("?compound_name")
  v2("?concept1")
  v7("?concept2")
  v1("?generic_component"):::projected 
  v9("?label2"):::projected 
  v10("?link")
  v12("?relation")
  bind0[/VALUES ?generic_component/]
  bind0-->v1
  bind00(["benzamides"])
  bind00 --> bind0
  v2 --"skos:prefLabel"-->  v1
  v2 --"skos:notation"-->  v3
  v4 --"cello:hasResistance"-->  v5
  v4 --"cello:recommendedName"-->  v6
  v5 --"cello:isIdentifiedByXref"-->  v7
  v7 --"cello:more_specific_than"-->  v2
  v7 --"skos:notation"-->  v8
  v7 --"skos:prefLabel"-->  v9
  bind1[/"'resistant to'"/]
  bind1 --as--o v10
  bind2[/"substring(?label2,'0^^xsd:integer','30^^xsd:integer')"/]
  v9 --o bind2
  bind2 --as--o v11
  bind3[/"'which is more specific than'"/]
  bind3 --as--o v12