blob: c2bd5e46c90616503cf59d21f47a53d8fdb3bfb4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
|