You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by rob-metalinkage April 23, 2021
If both graph has multiple blank nodes graph diff fails to detect matches. It succeeds for a single blank node case.
code:
from pprint import pprint
from rdflib import Graph
from rdflib.compare import graph_diff, to_canonical_graph
g1t = """@prefix : <http://test.org#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:C1 a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:minCardinality "1"^^xsd:int ;
owl:onProperty rdfs:label
] ;
rdfs:label "C1"@en ."""
g2t = g1t + """ :C2 a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:minCardinality "1"^^xsd:int ;
owl:onProperty rdfs:comment
] ;
rdfs:label "C2"@en ."""
g1 = Graph()
g2 = Graph()
g1.parse(data=g1t, format='turtle')
# g1.parse(source="profile.ttl", format='turtle')
#g2.parse(source="source.ttl", format='turtle')
g2.parse(data=g2t, format='turtle')
in_both, in_first, in_second = graph_diff(g1,g2)
print("should be empty as all in g1 is in g2")
pprint(in_first.serialize(format='turtle'))
in_both, in_first, in_second = graph_diff(g1,g1)
print("should be empty as all in g1 is in g1")
pprint(in_first.serialize(format='turtle'))
output: (which should be things only in first (in g1) - g2 is g1 + stuff so this should always be empty..
should be empty as all in g1 is in g2
(b'@prefix ns1: <http://www.w3.org/2002/07/owl#> .\n@prefix rdfs: <http://ww'
b'w.w3.org/2000/01/rdf-schema#> .\n@prefix xsd: <http://www.w3.org/2001/XML'
b'Schema#> .\n\n<http://test.org#C1> rdfs:subClassOf [ a ns1:Restriction ;\n '
b' ns1:minCardinality "1"^^xsd:int ;\n ns1:onProperty '
b'rdfs:label ] .\n\n')
should be empty as all in g1 is in g1
b'\n'
The text was updated successfully, but these errors were encountered:
aucampia
added
needs more work
The PR needs more work before being merged or further reviewed.
bug
Something isn't working
and removed
needs more work
The PR needs more work before being merged or further reviewed.
labels
Apr 9, 2022
This tracks #1294 which was a bug but incorrectly converted to a discussion #1610.
The xfail test for this is here:
rdflib/test/test_graph/test_canonicalization.py
Lines 526 to 568 in 1cba9d8
I likely will never have time to rewrite this properly, but I will refer to this issue to keep track of it.
Discussed in #1610
Originally posted by rob-metalinkage April 23, 2021
If both graph has multiple blank nodes graph diff fails to detect matches. It succeeds for a single blank node case.
code:
The text was updated successfully, but these errors were encountered: