[ https://issues.apache.org/jira/browse/COMMONSRDF-38?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stian Soiland-Reyes resolved COMMONSRDF-38. ------------------------------------------- Resolution: Fixed Assignee: Stian Soiland-Reyes Fixed by also doing internal mapping in {{Triple}} methods, e.g. {code} private Triple internallyMap(Triple triple) { BlankNodeOrIRI newSubject = (BlankNodeOrIRI) internallyMap(triple .getSubject()); IRI newPredicate = (IRI) internallyMap(triple.getPredicate()); RDFTerm newObject = internallyMap(triple.getObject()); // Check if any of the object references changed during the mapping, to // avoid creating a new Triple object if possible if (newSubject == triple.getSubject() && newPredicate == triple.getPredicate() && newObject == triple.getObject()) { return triple; } else { return factory.createTriple(newSubject, newPredicate, newObject); } } @Override public boolean contains(Triple triple) { return triples.contains(internallyMap(triple)); } @Override public void add(Triple triple) { triples.add(internallyMap(triple)); } @Override public void remove(Triple triple) { triples.remove(internallyMap(triple)); } {code} > simple Graph.contains(Triple) does not map bnodes consistently > -------------------------------------------------------------- > > Key: COMMONSRDF-38 > URL: https://issues.apache.org/jira/browse/COMMONSRDF-38 > Project: Apache Commons RDF > Issue Type: Bug > Affects Versions: 0.2.0 > Reporter: Stian Soiland-Reyes > Assignee: Stian Soiland-Reyes > > .. but relies on Triple.equals() - which then would not do the expected > mapping of "foreign" bnodes (as happens on Graph.add(Triple) > This means it's behaviour differs from .contains(s,p,o) and .remove(s,p,o). > The solution should be to do internal mapping also on the Triple methods, if > needed. -- This message was sent by Atlassian JIRA (v6.3.4#6332)