Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Jena 2.12.1
-
None
Description
It appears that Graph#isIsomorphicWith appears to use syntactic equivalence when comparing blank nodes:
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:
@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 }