Chris Beer created JENA-805:
-------------------------------
Summary: Graph#isIsomorphicWith should use semantic equivalence
when comparing blank nodes
Key: JENA-805
URL: https://issues.apache.org/jira/browse/JENA-805
Project: Apache Jena
Issue Type: Bug
Components: Jena
Affects Versions: Jena 2.12.1
Reporter: Chris Beer
Priority: Minor
It appears that Graph#isIsomorphicWith appears to use syntactic equivalence
when comparing blank nodes:
https://github.com/apache/jena/blob/master/jena-core/src/main/java/com/hp/hpl/jena/graph/impl/GraphMatcher.java#L27
It should probably use semantic equivalence instead, or, at the very least,
respect the RDF 1.1 equivalence of plain literals and xsd:string-typed literals.
Here is an example that I believe should be considered isomorphic:
{code}
@Test
public void isomorphismShouldRespectPlainLiteralEquivalence() {
// Without worrying about a blank node, isomorphism works fine:
Model model1 = ModelFactory.createDefaultModel();
model1.read(IOUtils.toInputStream("<info:x> <info:y> \"x\""), "",
"TTL");
Model model2 = ModelFactory.createDefaultModel();
model2.read(IOUtils.toInputStream("<info:x> <info:y>
\"x\"^^<http://www.w3.org/2001/XMLSchema#string>"), "", "TTL");
assertTrue(model1.isIsomorphicWith(model2)); // WORKS
// Now with a blank node:
Model model3 = ModelFactory.createDefaultModel();
model3.read(IOUtils.toInputStream("<info:x> <info:y> [ <info:z> \"x\"
]"), "", "TTL");
Model model4 = ModelFactory.createDefaultModel();
model4.read(IOUtils.toInputStream("<info:x> <info:y> [ <info:z>
\"x\"^^<http://www.w3.org/2001/XMLSchema#string> ]"), "", "TTL");
assertTrue(model3.isIsomorphicWith(model4)); // BROKEN
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)