-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from joernhees/fix_query_update_initns
Graph.update() uses own namespaces if none given, fixes #579
- Loading branch information
Showing
2 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# test for https://github.com/RDFLib/rdflib/issues/579 | ||
|
||
from rdflib import Graph, URIRef, Literal, Namespace | ||
from rdflib.namespace import FOAF, RDF | ||
|
||
g = Graph() | ||
g.bind('foaf', FOAF) | ||
n = Namespace("http://myname/") | ||
g.add((n.bob, FOAF.name, Literal('bb'))) | ||
# query is successful. | ||
assert len(g.query("select ?n where { ?n foaf:name 'bb' . }")) == 1 | ||
# update is not. | ||
g.update("delete where { ?e foaf:name 'ss' .}") | ||
assert len(g) == 1 | ||
g.update("delete where { ?e foaf:name 'bb' .}") | ||
assert len(g) == 0 |