\r
private BijectionMap<Statement, Statement> comparableStatements = new BijectionMap<Statement, Statement>();\r
private BijectionMap<Resource, Resource> comparableResources = new BijectionMap<Resource, Resource>();\r
- \r
+ private Set<Resource> processedResources = new HashSet<Resource>();\r
\r
private ResourceComparator comparator;\r
\r
strong.addAll(rels);\r
}\r
\r
- public void clearRels() {\r
- traversed.clear();\r
- tested.clear();\r
- nonTraversed.clear();\r
- nonTested.clear();\r
- }\r
\r
public void test(ReadGraph g) throws DatabaseException {\r
this.g = g;\r
objectsLeft.push(r1);\r
objectsRight.push(r2);\r
\r
- \r
- \r
- \r
Set<Statement> unreliableLeft = new HashSet<Statement>();\r
Set<Statement> unreliableRight = new HashSet<Statement>();\r
\r
Resource r1 = objectsLeft.pop();\r
Resource r2 = objectsRight.pop();\r
\r
-// if (r1.getResourceId() == 42543612 ||\r
-// r1.getResourceId() == 42729524 ||\r
-// r1.getResourceId() == 42729506) {\r
-// System.out.println("test " + r1 + " " + r2);\r
-// }\r
- \r
if (r1.equals(r2))\r
continue;\r
- \r
- if (comparableResources.contains(r1, r2)) {\r
- //System.out.println("already tested " + NameUtils.getSafeName(g, r1) + " " + NameUtils.getSafeName(g, r2));\r
+ \r
+ if (processedResources.contains(r1))\r
continue;\r
- }\r
- if (comparableResources.containsLeft(r1) || comparableResources.containsRight(r2)) {\r
+ processedResources.add(r1);\r
+ \r
+ \r
+ if(!comparableResources.contains(r1, r2) && (comparableResources.containsLeft(r1)||comparableResources.containsRight(r2))) {\r
throw new DatabaseException("Comparator error: Trying to map " + r1 + " to " + r2 + " while mappings " + r1 + " to " + comparableResources.getRight(r1) + " and " + comparableResources.getLeft(r2) + " to " + r2 + " exist.");\r
}\r
- comparableResources.map(r1, r2);\r
\r
//System.out.println("test " + NameUtils.getSafeName(g, r1) + " " + NameUtils.getSafeName(g, r2));\r
compareProps(r1, r2);\r
}\r
\r
for (Resource ol : objectLeft.getKeys()) {\r
-// if (ol.getResourceId() == 42729506) {\r
-// System.out.println();\r
-// }\r
// all statements to the left side object\r
List<Statement> left = objectLeft.getValues(ol);\r
// all subjects that have statements to the left side object (ol)\r
List<Statement> right = matchingOR.getValues(or);\r
Pair<int[], int[]> indices = matchingStatements.get(or);\r
\r
- //comparableResources.map(ol, or);\r
+ comparableResources.map(ol, or);\r
objectsLeft.add(ol);\r
objectsRight.add(or);\r
for (int l = 0; l < left.size(); l++) {\r
Resource or = matchingPaths.keySet().iterator().next();\r
objectsLeft.add(ol);\r
objectsRight.add(or);\r
+ comparableResources.map(ol, or);\r
Collection<Statement> statementsLeft = objectLeft.getValues(ol);\r
Collection<Statement> statementsRight = objectRight.getValues(or);\r
unreliableLeft.removeAll(statementsLeft);\r
unreliableRight.removeAll(statementsRight);\r
- System.out.println();\r
+ System.out.println("Compare not implemented");\r
} else {\r
- System.out.println();\r
+ System.out.println("Compare not implemented");\r
}\r
}\r
}\r
}\r
\r
private void addComparable(Statement left, Statement right, boolean process) {\r
-// if (left.getObject().getResourceId() == 42543612 ||\r
-// left.getObject().getResourceId() == 42729524 ||\r
-// left.getObject().getResourceId() == 42729506) {\r
-// System.out.println("test " + r1 + " " + r2);\r
-// }\r
comparableStatements.map(left, right);\r
- if (!process) {\r
- comparableResources.map(left.getObject(), right.getObject());\r
- }\r
+ comparableResources.map(left.getObject(), right.getObject());\r
}\r
\r
public List<Statement> filterAsserted(Resource r, Collection<Statement> in) throws ServiceException {\r