-
Notifications
You must be signed in to change notification settings - Fork 576
Open
Labels
breaking changeThis involves or proposes breaking RDFLib's public API.This involves or proposes breaking RDFLib's public API.
Description
If I run the following code:
from rdflib import Graph, Namespace
data = """
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ns: <https://example.com/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <https://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
ns:08429fce-4d70-4be4-9c64-ffc80f554ea7
a skos:Concept .
"""
EX = Namespace("https://example.com/")
graph = Graph()
graph.bind("ex", EX)
graph.parse(data=data, format="turtle")
graph.print(format="turtle")
It will print:
@prefix ns: <https://example.com/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
ns:08429fce-4d70-4be4-9c64-ffc80f554ea7 a skos:Concept ;
skos:definition "definition" ;
skos:prefLabel "label" .
I would have expected the bind to persist through the life of the graph object and print the following result:
@prefix ex: <https://example.com/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
ex:08429fce-4d70-4be4-9c64-ffc80f554ea7 a skos:Concept ;
skos:definition "definition" ;
skos:prefLabel "label" .
If I swap the two lines from:
graph.bind("ex", EX)
graph.parse(data=data, format="turtle")
to:
graph.parse(data=data, format="turtle")
graph.bind("ex", EX)
it then prints what I expect.
Is this the expected behaviour where calling the parse()
method overwrites prefix bindings in the graph's namespace manager?
Metadata
Metadata
Assignees
Labels
breaking changeThis involves or proposes breaking RDFLib's public API.This involves or proposes breaking RDFLib's public API.