Skip to content

Commit

Permalink
Added more useful queries for TiO2
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed May 20, 2024
1 parent b3b5bdb commit f1569b9
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 7 deletions.
10 changes: 6 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ Issues, comments, questions can be reported [here](https://github.com/h2020-sbd4
5.3. [Relationships by outcome](relationships.md#relationships-by-outcome) <br />
5.4. [All relationships](relationships.md#all-relationships) <br />
6. [Titanium Oxide](tio2.md) <br />
6.1. [Causal relationships](tio2.md#causal-relationships) <br />
6.1.1. [All metal oxides](tio2.md#all-metal-oxides) <br />
6.2. [TiO2 datasets](tio2.md#tio2-datasets) <br />
6.3. [TiO2 Models](tio2.md#tio2-models) <br />
6.1. [Resources](tio2.md#resources) <br />
6.2. [Causal relationships](tio2.md#causal-relationships) <br />
6.2.1. [All tatanium dioxides](tio2.md#all-tatanium-dioxides) <br />
6.2.2. [All metal oxides](tio2.md#all-metal-oxides) <br />
6.3. [TiO2 datasets](tio2.md#tio2-datasets) <br />
6.4. [TiO2 Models](tio2.md#tio2-models) <br />
7. [Carbon nanotubes](cnt.md) <br />
7.1. [Causal relationships](cnt.md#causal-relationships) <br />
7.2. [Carbon nanotube datasets](cnt.md#carbon-nanotube-datasets) <br />
Expand Down
94 changes: 94 additions & 0 deletions docs/sparql/allTitaniaResources.code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# allTitaniaResources.rq

**Code examples:** [curl](#curl)

### SPARQL

```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](https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/?q=PREFIX%20sbd%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Frdf%2F%23%3E%0APREFIX%20sbdbel%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Fbel%2F%23%3E%0APREFIX%20dcterms%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0APREFIX%20npo%3A%20%3Chttp%3A%2F%2Fpurl.bioontology.org%2Fontology%2Fnpo%23%3E%0APREFIX%20obo%3A%20%3Chttp%3A%2F%2Fpurl.obolibrary.org%2Fobo%2F%3E%0APREFIX%20enm%3A%20%3Chttp%3A%2F%2Fpurl.enanomapper.org%2Fonto%2F%3E%0APREFIX%20sio%3A%20%3Chttp%3A%2F%2Fsemanticscience.org%2Fresource%2FSIO_%3E%0APREFIX%20sbdbel2%3A%20%20%3Chttps%3A%2F%2Fh2020-sbd4nano.github.io%2Fsbdbel%2F%3E%0A%0ASELECT%20DISTINCT%20%3Fsuperclasses%20%28SAMPLE%28%3FsuperclassesLabel_%29%20AS%20%3FsuperclassesLabel%29%20%3Ftype%20%28COUNT%28DISTINCT%20%3Fresource%29%20AS%20%3Fcount%29%0AWHERE%20%7B%0A%20%20VALUES%20%3Fsuperclasses%20%7B%20npo%3ANPO_1541%20npo%3ANPO_1486%20enm%3AENM_9000077%20%7D%20%23%20metal%20oxide%2C%20TiO2%2C%20JRCNM01005a%0A%20%20%3Fnm%20rdfs%3AsubClassOf*%20%3Fsuperclasses%20.%0A%20%20%3Fsuperclasses%20rdfs%3Alabel%20%3FsuperclassesLabel_%20.%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fresource%20a%20%3Ftype%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20sbdbel%3ANP%20%7C%20sio%3A000332%20%7C%20sbdbel2%3ANP%20%3Fnm%20.%0A%20%20%20%20%3Ftype%20rdfs%3Alabel%20%3FtypeLabel%20.%0A%20%20%7D%0A%7D%20GROUP%20BY%20%3Fsuperclasses%20%3FsuperclassesLabel%20%3Ftype%0A%20%20ORDER%20BY%20DESC%28%3Fcount%29%0A)


### Output

<table>
<tr>
<td><b>superclasses</b></td>
<td><b>type</b></td>
<td><b>count</b></td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Model</td>
<td>12</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Database</td>
<td>7</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Dataset</td>
<td>7</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://h2020-sbd4nano.github.io/sbdbel/CausalAssertion</td>
<td>6</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1486">R-TiO2</a></td>
<td>https://www.sbd4nano.eu/rdf/#Dataset</td>
<td>1</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1486">R-TiO2</a></td>
<td></td>
<td>0</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td></td>
<td>0</td>
</tr>
<tr>
<td><a href="http://purl.enanomapper.org/onto/ENM_9000077">JRCNM01005a</a></td>
<td></td>
<td>0</td>
</tr>
</table>

## Code examples

### curl

```shell
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 [email protected]
```

This SPARQL query is available under CCZero.
45 changes: 45 additions & 0 deletions docs/sparql/allTitaniumOxideRelationships.code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# allTitaniumOxideRelationships.rq

**Code examples:** [curl](#curl)

### SPARQL

```sparql
PREFIX sbd: <https://www.sbd4nano.eu/rdf/#>
PREFIX sbdbel: <https://www.sbd4nano.eu/bel/#>
PREFIX npo: <http://purl.bioontology.org/ontology/npo#>
SELECT DISTINCT
?superclass (SAMPLE(?superclassLabel_) AS ?superclassLabel)
?nm (SAMPLE(?nmLabel_) AS ?nmLabel)
(COUNT(DISTINCT ?relation) AS ?relations)
WHERE {
VALUES ?ca { sbdbel:CausalAssertion sbd:CausalAssertion }
VALUES ?superclass { npo:NPO_1486 }
?nm rdfs:subClassOf* ?superclass ; rdfs:label ?nmLabel_ .
?superclass rdfs:label ?superclassLabel_ .
?relation a ?ca ; sbdbel:NP ?nm .
} GROUP BY ?superclass ?nm
```

[run](https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/?q=PREFIX%20sbd%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Frdf%2F%23%3E%0APREFIX%20sbdbel%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Fbel%2F%23%3E%0APREFIX%20npo%3A%20%3Chttp%3A%2F%2Fpurl.bioontology.org%2Fontology%2Fnpo%23%3E%0A%0ASELECT%20DISTINCT%0A%20%20%3Fsuperclass%20%28SAMPLE%28%3FsuperclassLabel_%29%20AS%20%3FsuperclassLabel%29%0A%20%20%3Fnm%20%28SAMPLE%28%3FnmLabel_%29%20AS%20%3FnmLabel%29%0A%20%20%28COUNT%28DISTINCT%20%3Frelation%29%20AS%20%3Frelations%29%0AWHERE%20%7B%0A%20%20VALUES%20%3Fca%20%7B%20sbdbel%3ACausalAssertion%20sbd%3ACausalAssertion%20%7D%0A%20%20VALUES%20%3Fsuperclass%20%7B%20npo%3ANPO_1486%20%7D%0A%20%20%3Fnm%20rdfs%3AsubClassOf*%20%3Fsuperclass%20%3B%20rdfs%3Alabel%20%3FnmLabel_%20.%0A%20%20%3Fsuperclass%20rdfs%3Alabel%20%3FsuperclassLabel_%20.%0A%20%20%3Frelation%20a%20%3Fca%20%3B%20sbdbel%3ANP%20%3Fnm%20.%0A%7D%20GROUP%20BY%20%3Fsuperclass%20%3Fnm%0A)


### Output

<table>
<tr>
</tr>
</table>

## Code examples

### curl

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

curl -H "Accept: text/tab-separated-values" -G https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/sparql --data-urlencode [email protected]
```

This SPARQL query is available under CCZero.
88 changes: 87 additions & 1 deletion docs/tio2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Titanium Oxide

Because the eNanoMapper ontology [<a href="#citeref1">1</a>] is loaded, we can take advantage of the
hierarchy of the ontology. For example, we can list all <a name="tp1">titania</a>'s (npo:NPO_1486)
hierarchy of the ontology. For example, we can list all <a name="tp1">titania</a>'s (`npo:NPO_1486`)
with this SPARQL:

**SPARQL** [sparql/allTitanias.rq](sparql/allTitanias.code.html) ([run](https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/?q=PREFIX%20npo%3A%20%3Chttp%3A%2F%2Fpurl.bioontology.org%2Fontology%2Fnpo%23%3E%0APREFIX%20obo%3A%20%3Chttp%3A%2F%2Fpurl.obolibrary.org%2Fobo%2F%3E%0A%0ASELECT%20DISTINCT%20%3Fnm%20%28SAMPLE%28%3FnmLabel_%29%20AS%20%3FnmLabel%29%0AWHERE%20%7B%0A%20%20VALUES%20%3Fsuperclass%20%7B%20npo%3ANPO_1486%20obo%3ACHEBI_51050%20%7D%0A%20%20%3Fnm%20rdfs%3AsubClassOf*%20%3Fsuperclass%20%3B%20rdfs%3Alabel%20%3FnmLabel_%20.%0A%7D%20GROUP%20BY%20%3Fnm%0A))
Expand Down Expand Up @@ -115,6 +115,63 @@ This gives us this list of nanomaterials:
</tr>
</table>

## Resources

Using the hierarchy, we can find resources about a specific nanomaterial or about any of its
superclasses:

<sparq>allTitaniaResources</sparql>

This returns:

<table>
<tr>
<td><b>superclasses</b></td>
<td><b>type</b></td>
<td><b>count</b></td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Model</td>
<td>12</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Database</td>
<td>7</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://www.sbd4nano.eu/rdf/#Dataset</td>
<td>7</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td>https://h2020-sbd4nano.github.io/sbdbel/CausalAssertion</td>
<td>6</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1486">R-TiO2</a></td>
<td>https://www.sbd4nano.eu/rdf/#Dataset</td>
<td>1</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1486">R-TiO2</a></td>
<td></td>
<td>0</td>
</tr>
<tr>
<td><a href="http://purl.bioontology.org/ontology/npo#NPO_1541">Metal Oxide</a></td>
<td></td>
<td>0</td>
</tr>
<tr>
<td><a href="http://purl.enanomapper.org/onto/ENM_9000077">JRCNM01005a</a></td>
<td></td>
<td>0</td>
</tr>
</table>

## Causal relationships

This approach can be used to find datasets, models, causal relationships, etc applicable to a certain
Expand Down Expand Up @@ -153,6 +210,35 @@ But for a specific material, such relationships may not exist:
In that case, we can better look for relationships for the class of nanoforms this
material is part of.

### All tatanium dioxides

For example, we can list all relationships for all metal oxides:

**SPARQL** [sparql/allTitaniumOxideRelationships.rq](sparql/allTitaniumOxideRelationships.code.html) ([run](https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/?q=PREFIX%20sbd%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Frdf%2F%23%3E%0APREFIX%20sbdbel%3A%20%20%3Chttps%3A%2F%2Fwww.sbd4nano.eu%2Fbel%2F%23%3E%0APREFIX%20npo%3A%20%3Chttp%3A%2F%2Fpurl.bioontology.org%2Fontology%2Fnpo%23%3E%0A%0ASELECT%20DISTINCT%0A%20%20%3Fsuperclass%20%28SAMPLE%28%3FsuperclassLabel_%29%20AS%20%3FsuperclassLabel%29%0A%20%20%3Fnm%20%28SAMPLE%28%3FnmLabel_%29%20AS%20%3FnmLabel%29%0A%20%20%28COUNT%28DISTINCT%20%3Frelation%29%20AS%20%3Frelations%29%0AWHERE%20%7B%0A%20%20VALUES%20%3Fca%20%7B%20sbdbel%3ACausalAssertion%20sbd%3ACausalAssertion%20%7D%0A%20%20VALUES%20%3Fsuperclass%20%7B%20npo%3ANPO_1486%20%7D%0A%20%20%3Fnm%20rdfs%3AsubClassOf*%20%3Fsuperclass%20%3B%20rdfs%3Alabel%20%3FnmLabel_%20.%0A%20%20%3Fsuperclass%20rdfs%3Alabel%20%3FsuperclassLabel_%20.%0A%20%20%3Frelation%20a%20%3Fca%20%3B%20sbdbel%3ANP%20%3Fnm%20.%0A%7D%20GROUP%20BY%20%3Fsuperclass%20%3Fnm%0A))
```sparql
PREFIX sbd: <https://www.sbd4nano.eu/rdf/#>
PREFIX sbdbel: <https://www.sbd4nano.eu/bel/#>
PREFIX npo: <http://purl.bioontology.org/ontology/npo#>
SELECT DISTINCT
?superclass (SAMPLE(?superclassLabel_) AS ?superclassLabel)
?nm (SAMPLE(?nmLabel_) AS ?nmLabel)
(COUNT(DISTINCT ?relation) AS ?relations)
WHERE {
VALUES ?ca { sbdbel:CausalAssertion sbd:CausalAssertion }
VALUES ?superclass { npo:NPO_1486 }
?nm rdfs:subClassOf* ?superclass ; rdfs:label ?nmLabel_ .
?superclass rdfs:label ?superclassLabel_ .
?relation a ?ca ; sbdbel:NP ?nm .
} GROUP BY ?superclass ?nm
```

But this still returns no relationships:

<table>
<tr>
</tr>
</table>

### All metal oxides

For example, we can list all relationships for all metal oxides:
Expand Down
29 changes: 29 additions & 0 deletions grlc/allTitaniaResources.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#+ endpoint: https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/sparql
#+ endpoint_in_url: False
#+ enumerate:
#+ - lang:
#+ - en,en


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)

23 changes: 23 additions & 0 deletions grlc/allTitaniumOxideRelationships.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#+ endpoint: https://sbd4nanolandscape.rdf.bigcat-bioinformatics.org/sparql
#+ endpoint_in_url: False
#+ enumerate:
#+ - lang:
#+ - en,en


PREFIX sbd: <https://www.sbd4nano.eu/rdf/#>
PREFIX sbdbel: <https://www.sbd4nano.eu/bel/#>
PREFIX npo: <http://purl.bioontology.org/ontology/npo#>

SELECT DISTINCT
?superclass (SAMPLE(?superclassLabel_) AS ?superclassLabel)
?nm (SAMPLE(?nmLabel_) AS ?nmLabel)
(COUNT(DISTINCT ?relation) AS ?relations)
WHERE {
VALUES ?ca { sbdbel:CausalAssertion sbd:CausalAssertion }
VALUES ?superclass { npo:NPO_1486 }
?nm rdfs:subClassOf* ?superclass ; rdfs:label ?nmLabel_ .
?superclass rdfs:label ?superclassLabel_ .
?relation a ?ca ; sbdbel:NP ?nm .
} GROUP BY ?superclass ?nm

21 changes: 21 additions & 0 deletions sparql/allTitaniaResources.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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)
15 changes: 15 additions & 0 deletions sparql/allTitaniumOxideRelationships.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX sbd: <https://www.sbd4nano.eu/rdf/#>
PREFIX sbdbel: <https://www.sbd4nano.eu/bel/#>
PREFIX npo: <http://purl.bioontology.org/ontology/npo#>

SELECT DISTINCT
?superclass (SAMPLE(?superclassLabel_) AS ?superclassLabel)
?nm (SAMPLE(?nmLabel_) AS ?nmLabel)
(COUNT(DISTINCT ?relation) AS ?relations)
WHERE {
VALUES ?ca { sbdbel:CausalAssertion sbd:CausalAssertion }
VALUES ?superclass { npo:NPO_1486 }
?nm rdfs:subClassOf* ?superclass ; rdfs:label ?nmLabel_ .
?superclass rdfs:label ?superclassLabel_ .
?relation a ?ca ; sbdbel:NP ?nm .
} GROUP BY ?superclass ?nm
Loading

0 comments on commit f1569b9

Please sign in to comment.