Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-RDF CPAN distribution.

Report information
The Basics
Id: 31308
Status: resolved
Priority: 0/
Queue: Test-RDF

People
Owner: kjetilk [...] cpan.org
Requestors: gwilliams [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.0.3
Fixed in: (no value)



Subject: graph equivalence depends on serialization ordering.
The rdf_eq() function seems to depend on the ordering of statements in the serialized RDF given as arguments. Since the underlying RDF graph isn't changing when statements are re- ordered in the serialization, this is a significant bug. I suspect the problem is caused by Redland's serializer assigning bnodes in an ordering based on the serialization, and this is causing problems in your graph equivalence checking. I've attached two test files that compare the same two graphs. On my MacBook Pro with perl 5.8.8 and Test::RDF 0.0.3, the first (test_rdfeq_pass.pl) passes the test, while the second (test_rdfeq_fail.pl) fails the test. The only difference between the two files is a re-ordering of nodes in the turtle in the variable $second.
Subject: test_rdfeq_pass.pl
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use Test::RDF; my $first = <<'END'; @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Bob" . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:bob@home> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r536 . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Alice" . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:alice@work> . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r540 . END my $second = <<'END'; @base <http://example.com/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Bob" . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:bob@home> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r525 . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Alice" . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:alice@work> . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r526 . END rdf_eq( turtle => \$first, turtle => \$second, 'equal' );
Subject: test_rdfeq_fail.pl
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use Test::RDF; my $first = <<'END'; @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Bob" . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:bob@home> . [] rdf:subject _:r1197141877r45959r540 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r536 . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Alice" . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:alice@work> . [] rdf:subject _:r1197141877r45959r536 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r540 . END my $second = <<'END'; @base <http://example.com/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Bob" . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:bob@home> . [] rdf:subject _:r1197141877r45959r526 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r525 . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/mbox> ; rdf:object <mailto:alice@work> . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/knows> ; rdf:object _:r1197141877r45959r526 . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate rdf:type ; rdf:object <http://xmlns.com/foaf/0.1/Person> . [] rdf:subject _:r1197141877r45959r525 ; rdf:predicate <http://xmlns.com/foaf/0.1/name> ; rdf:object "Alice" . END rdf_eq( turtle => \$first, turtle => \$second, 'equal' );
Should be solved with the upload of 0.10, since that uses RDF::Trine's isomorphism method.