-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Don't use
publicID
as the name for the default graph.
When parsing data into a `ConjunctiveGraph` or `Dataset`, the triples in the default graphs in the sources were loaded into a graph named `publicID`. This behaviour has been changed, and now the triples from the default graph in source RDF documents will be loaded into `ConjunctiveGraph.default_context` or `Dataset.default_context`. The `publicID` parameter to `ConjunctiveGraph.parse` and `Dataset.parse` constructors will now only be used as the base URI for relative URI resolution.
- Loading branch information
Showing
26 changed files
with
448 additions
and
167 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
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,45 @@ | ||
.. _upgrade4to5: Upgrading from RDFLib version 6 to 7 | ||
|
||
============================================ | ||
Upgrading 6 to 7 | ||
============================================ | ||
|
||
New behaviour for ``publicID`` in ``parse`` methods. | ||
---------------------------------------------------- | ||
|
||
Before version 7, the ``publicID`` argument to the | ||
:meth:`~rdflib.graph.ConjunctiveGraph.parse` and | ||
:meth:`~rdflib.graph.Dataset.parse` methods was used as the name for the default | ||
graph, and triples from the default graph in a source were loaded into the graph | ||
named ``publicID``. | ||
|
||
In version 7, the ``publicID`` argument is only used as the base URI for relative | ||
URI resolution as defined in `IETF RFC 3986 | ||
<https://datatracker.ietf.org/doc/html/rfc3986#section-5.1.4>`_. | ||
|
||
To accommodate this change, ensure that use of the ``publicID`` argument is | ||
consistent with the new behaviour. | ||
|
||
If you want to load triples from a format that does not support named graphs | ||
into a named graph, use the following code: | ||
|
||
.. code-block:: python | ||
from rdflib import ConjunctiveGraph | ||
cg = ConjunctiveGraph() | ||
cg.get_context("example:graph_name").parse("http://example.com/source.trig", format="trig") | ||
If you want to move triples from the default graph into a named graph, use the | ||
following code: | ||
|
||
.. code-block:: python | ||
from rdflib import ConjunctiveGraph | ||
cg = ConjunctiveGraph() | ||
cg.parse("http://example.com/source.trig", format="trig") | ||
destination_graph = cg.get_context("example:graph_name") | ||
for triple in cg.default_context.triples((None, None, None)): | ||
destination_graph.add(triple) | ||
cg.default_context.remove(triple) |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"quad_count": 6, | ||
"quad_count": 8, | ||
"exact_match": true | ||
} |
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 |
---|---|---|
@@ -1,56 +1,65 @@ | ||
{ | ||
"@graph": [ | ||
{ | ||
"@graph": [ | ||
"@graph": [ | ||
{ | ||
"@id": "example:s20", | ||
"example:p20": { | ||
"@id": "example:o20" | ||
} | ||
"@id": "example:s10", | ||
"example:p10": { | ||
"@id": "example:o10" | ||
} | ||
}, | ||
{ | ||
"@id": "example:s21", | ||
"example:p21": { | ||
"@id": "example:o21" | ||
} | ||
"@id": "example:s01", | ||
"example:p01": { | ||
"@id": "example:o01" | ||
} | ||
}, | ||
{ | ||
"@id": "example:s00", | ||
"example:p00": { | ||
"@id": "example:o02" | ||
} | ||
}, | ||
{ | ||
"@id": "example:s11", | ||
"example:p11": { | ||
"@id": "example:o11" | ||
} | ||
}, | ||
{ | ||
"@id": "example:g3", | ||
"@graph": [ | ||
{ | ||
"@id": "example:s31", | ||
"example:p31": { | ||
"@id": "example:o31" | ||
} | ||
}, | ||
{ | ||
"@id": "example:s30", | ||
"example:p30": { | ||
"@id": "example:o30" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"@id": "example:g2", | ||
"@graph": [ | ||
{ | ||
"@id": "example:s21", | ||
"example:p21": { | ||
"@id": "example:o21" | ||
} | ||
}, | ||
{ | ||
"@id": "example:s20", | ||
"example:p20": { | ||
"@id": "example:o20" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"@id": "example:g2" | ||
}, | ||
{ | ||
"@id": "example:s00", | ||
"p00": "example:o02" | ||
}, | ||
{ | ||
"@id": "example:s01", | ||
"p01": "example:o01" | ||
}, | ||
{ | ||
"@id": "example:s10", | ||
"p10": "example:o10" | ||
}, | ||
{ | ||
"@id": "example:s11", | ||
"p11": "example:o11" | ||
], | ||
"@context": { | ||
"example": "http://example.org/" | ||
} | ||
], | ||
"@context": { | ||
"p10": { | ||
"@id": "http://example.org/p10", | ||
"@type": "@id" | ||
}, | ||
"p01": { | ||
"@id": "http://example.org/p01", | ||
"@type": "@id" | ||
}, | ||
"p00": { | ||
"@id": "http://example.org/p00", | ||
"@type": "@id" | ||
}, | ||
"p11": { | ||
"@id": "http://example.org/p11", | ||
"@type": "@id" | ||
}, | ||
"example": "http://example.org/" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<http://example.org/s00> <http://example.org/p00> <http://example.org/o02> . | ||
<http://example.org/s01> <http://example.org/p01> <http://example.org/o01> . | ||
<http://example.org/s10> <http://example.org/p10> <http://example.org/o10> . | ||
<http://example.org/s01> <http://example.org/p01> <http://example.org/o01> . | ||
<http://example.org/s00> <http://example.org/p00> <http://example.org/o02> . | ||
<http://example.org/s11> <http://example.org/p11> <http://example.org/o11> . | ||
<http://example.org/s20> <http://example.org/p20> <http://example.org/o20> <http://example.org/g2> . | ||
<http://example.org/s21> <http://example.org/p21> <http://example.org/o21> <http://example.org/g2> . | ||
<http://example.org/s20> <http://example.org/p20> <http://example.org/o20> <http://example.org/g2> . | ||
<http://example.org/s31> <http://example.org/p31> <http://example.org/o31> <http://example.org/g3> . | ||
<http://example.org/s30> <http://example.org/p30> <http://example.org/o30> <http://example.org/g3> . |
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 @@ | ||
<http://example.org/subject> <http://example.org/predicate> <http://example.org/object> . |
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,2 @@ | ||
<http://example.org/subject> | ||
<http://example.org/predicate> <http://example.org/object> . |
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
Oops, something went wrong.