File size: 387 Bytes
41f1ee1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import rdflib
import json
g = rdflib.Graph()
g.parse("./introspector.ttl")
knows_query = """
SELECT DISTINCT ?aname ?bname
WHERE {
?a ?b .
?a foaf:name ?aname .
?b foaf:name ?bname .
}"""
def data():
# qres = g.query(knows_query)
res = []
for x in g:
res.append(x)
return res
if __name__ == "__main__":
print(json.dumps(data(),indent=2))
|