-
Notifications
You must be signed in to change notification settings - Fork 578
Open
Labels
Milestone
Description
Using the same blank id in two queries will merge the blank nodes in the graph. This is not correct since the context for a blank node in a sparql query is limited to the query.
The SPARQL 1.1 spec says:
That is, the INSERT DATA statement only allows to insert ground triples. Blank nodes in QuadDatas are assumed to be disjoint from the blank nodes in the Graph Store, i.e., will be inserted with "fresh" blank nodes. (https://www.w3.org/TR/2013/REC-sparql11-update-20130321/#insertData)
See the following in example:
import rdflib
g = rdflib.Graph()
g.serialize(format="turtle").decode("utf-8")
# empty
g.update('INSERT DATA { _:a <urn:label> "A bnode" }')
g.serialize(format="turtle").decode("utf-8")
# @prefix ns1: <urn:> .
# [] ns1:label "A bnode" .
g.update('INSERT DATA { _:a <urn:label> "Bnode 2" }')
g.serialize(format="turtle").decode("utf-8")
# @prefix ns1: <urn:> .
# [] ns1:label "A bnode",
# "Bnode 2" .
I would expect:
…
g.update('INSERT DATA { _:a <urn:label> "Bnode 2" }')
g.serialize(format="turtle").decode("utf-8")
# @prefix ns1: <urn:> .
# [] ns1:label "A bnode" .
# [] ns1:label "Bnode 2" .