Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo 980 resolution #1495

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions test/test_980.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from rdflib import Graph


def test_980():
"""
The problem that this test ensures rdflib solves is that, previous to PR #1108, the
parsing of two triples with the same n-triples Blank Nodes IDs, here _:0, would
result in triples with the same rdflib internal BN IDs, e.g.
rdflib.term.BNode('Ne3fd8261b37741fca22d502483d88964'), see the Issue #980. They
should have different IDs.
"""
graph1 = """
_:0 <http://purl.obolibrary.org/obo/RO_0002350> <http://www.gbif.org/species/0000001> .
"""
graph2 = """
_:0 <http://purl.obolibrary.org/obo/RO_0002350> <http://www.gbif.org/species/0000002> .
"""

g = Graph()
g.parse(data=graph1, format="nt")
g.parse(data=graph2, format="nt")

subs = 0
for s in g.subjects(None, None):
subs += 1

# we must see two different BN subjects
assert subs == 2