-
Notifications
You must be signed in to change notification settings - Fork 587
Closed
Description
Data in Trig format cannot be processed by RDFLib.
Let us assume the following data including graphs (example copied from RDFlib documentation)
GraphString = '''
PREFIX eg: <http://example.com/person/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
eg:graph-1 {
eg:drewp a foaf:Person .
eg:drewp eg:says "Hello World" .
}
eg:graph-2 {
eg:nick a foaf:Person .
eg:nick eg:says "Hi World" .
}
'''
Next, let's parse this data into a Graph object:
someGraph = Graph()
someGraph.parse(data=GraphString , format="trig")
Let us query the graph:
someQuery = someGraph.query('''
select ?s
where {
?s ?p ?o
}
''')
If we then go through the result set, there is unexpectedly nothing:
for row in someQuery:
print (str(row.s))
This does not lead to any result, whereas I would expect the following bindings for the variable ?s .
http://example.com/person/drewp
http://example.com/person/nick
http://example.com/person/drewp
http://example.com/person/nick
If I prepare the data differently by removing the explicit graphs, I do get the expected results:
GraphString = '''
PREFIX eg: <http://example.com/person/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
eg:drewp a foaf:Person .
eg:drewp eg:says "Hello World" .
eg:nick a foaf:Person .
eg:nick eg:says "Hi World" .
'''
Result of the query:
http://example.com/person/drewp
http://example.com/person/nick
http://example.com/person/drewp
http://example.com/person/nick
Perhaps I am mistaken in this and I should work in a different way with rdflib graph objects in Python that contain trig data, but it does seem incorrect behavior from purely a triples & sparql point of view.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels