Skip to content

Inconsistent behavor of initN in update and query  #579

Closed
@colinfang

Description

@colinfang

The doc says

If you pass no initNs argument, the namespaces registered with the graphs namespace_manager are used

However, it doesn't seem true for update.

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.
g.query("select ?n where { ?n foaf:name 'bb' . }")
# update is not.
g.update("""
    delete { ?e ?p ?o }
    where {
        ?e foaf:name 'ss' .
    }""")
Exception: Unknown namespace prefix : foaf

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions