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
}\r
\r
for (Resource ol : objectLeft.getKeys()) {\r
-\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
sLeft.add(s.getSubject());\r
sRight.add(comparableResources.getRight(s.getSubject()));\r
}\r
+ \r
+ // check if object left can be reliably identified by available statements\r
+ // if there are any objects on the left side with similar statements, object left cannot be mapped.\r
+ boolean hasSimilar = false;\r
+ MapList<Resource, Statement> comparableOLeft = new MapList<Resource, Statement>();\r
+ for (Resource sl : sLeft) {\r
+ for (Statement s : subjectLeft.getValues(sl)) {\r
+ if (!s.getObject().equals(ol)) {\r
+ comparableOLeft.add(s.getObject(),s);\r
+ }\r
+ }\r
+ }\r
+ \r
+ for (Resource similarOl : comparableOLeft.getKeys()) {\r
+ List<Statement> similarLeft = comparableOLeft.getValues(similarOl);\r
+ if (similarLeft.size() == left.size()) {\r
+ boolean useL[] = new boolean[left.size()];\r
+ boolean useSL[] = new boolean[left.size()];\r
+ for (int i = 0; i < left.size(); i++) {\r
+ useL[i] = false;\r
+ useSL[i] = false;\r
+ }\r
+ for (int i = 0; i < left.size(); i++) {\r
+ for (int j = 0; j < left.size(); j++) {\r
+ if (useSL[j])\r
+ continue;\r
+ Resource pl = left.get(i).getPredicate();\r
+ Resource psl = similarLeft.get(j).getPredicate();\r
+ if (pl.equals(psl)) {\r
+ useL[i] = true;\r
+ useSL[j] = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ boolean diff = false;\r
+ for (int i = 0; i < left.size(); i++) {\r
+ if (!useL[i] || !useSL[i]) {\r
+ diff = true;\r
+ }\r
+ }\r
+ if (!diff) {\r
+ hasSimilar = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ \r
+ if (hasSimilar)\r
+ continue;\r
+ \r
+ \r
// all objects that subjects on the right side point to. Object left has its matching resource among these, if it has matching resource\r
MapList<Resource,Statement> possibleOR = new MapList<Resource, Statement>();\r
for (Resource sr : sRight) {\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