sbd-data-book

allTitaniaResources.rq

Code examples: curl

SPARQL

PREFIX sbd:  <https://www.sbd4nano.eu/rdf/#>
PREFIX sbdbel:  <https://www.sbd4nano.eu/bel/#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX npo: <http://purl.bioontology.org/ontology/npo#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX enm: <http://purl.enanomapper.org/onto/>
PREFIX sio: <http://semanticscience.org/resource/SIO_>
PREFIX sbdbel2:  <https://h2020-sbd4nano.github.io/sbdbel/>

SELECT DISTINCT ?superclasses (SAMPLE(?superclassesLabel_) AS ?superclassesLabel) ?type (COUNT(DISTINCT ?resource) AS ?count)
WHERE {
  VALUES ?superclasses { npo:NPO_1541 npo:NPO_1486 enm:ENM_9000077 } # metal oxide, TiO2, JRCNM01005a
  ?nm rdfs:subClassOf* ?superclasses .
  ?superclasses rdfs:label ?superclassesLabel_ .
  OPTIONAL {
    ?resource a ?type ;
              sbdbel:NP | sio:000332 | sbdbel2:NP ?nm .
    ?type rdfs:label ?typeLabel .
  }
} GROUP BY ?superclasses ?superclassesLabel ?type
  ORDER BY DESC(?count)

run

Output

superclasses type count
Metal Oxide https://www.sbd4nano.eu/rdf/#Model 12
Metal Oxide https://www.sbd4nano.eu/rdf/#Database 7
Metal Oxide https://www.sbd4nano.eu/rdf/#Dataset 7
Metal Oxide https://h2020-sbd4nano.github.io/sbdbel/CausalAssertion 6
R-TiO2 https://www.sbd4nano.eu/rdf/#Dataset 1
R-TiO2 0
Metal Oxide 0
JRCNM01005a 0

Code examples

curl

curl -s https://raw.githubusercontent.com/h2020-sbd4nano/sbd-data-book/master/sparql/allTitaniaResources.rq | sed 's+<lang/>+en+' > allTitaniaResources.rq

curl -H "Accept: text/tab-separated-values" -G https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/sparql --data-urlencode query@allTitaniaResources.rq

This SPARQL query is available under CCZero.