diff options
author | Arun Isaac | 2021-08-27 05:49:11 -0500 |
---|---|---|
committer | Arun Isaac | 2021-08-27 05:49:11 -0500 |
commit | b6cb5c4d2c64781122223d4ee100a0d6f3dd03b9 (patch) | |
tree | 0b53ac191d07c4599d2b58c0d2a96561bcb23cf1 /rdf.py | |
download | gn-transform-databases-b6cb5c4d2c64781122223d4ee100a0d6f3dd03b9.tar.gz |
Initial commit
Diffstat (limited to 'rdf.py')
-rw-r--r-- | rdf.py | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +import os.path +from pathlib import Path +from rdflib import Graph + +graph = Graph() +graph.parse(location=os.path.join(Path.home(), 'data/dump/dump.ttl'), + format='text/turtle') + +query = """ +PREFIX gn: <https://genenetwork.org/> + +SELECT ?name ?binomial +WHERE { + ?species rdf:type gn:species . + ?strain rdf:type gn:strain . + ?strain gn:name "JN9" . + ?strain gn:strainOfSpecies ?species . + + ?species gn:name ?name . + ?species gn:binomialName ?binomial . +} +""" + +for result in graph.query(query): + print(result) |