1 package org.simantics.document.linking.report.templates;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.document.linking.ontology.DocumentLink;
9 class SourceParentHierarchyWithPropComparator extends ResourceNameComparator {
12 public SourceParentHierarchyWithPropComparator(ReadGraph graph, Resource model) {
14 sl = DocumentLink.getInstance(graph);
17 public int compare(Resource o1, Resource o2) {
19 Resource r1 = graph.getSingleObject(o1, sl.hasSource_Inverse);
20 Resource r2 = graph.getSingleObject(o2, sl.hasSource_Inverse);
21 List<Resource> path1 = getPath(r1);
22 List<Resource> path2 = getPath(r2);
23 int count = Math.min(path1.size(), path2.size());
26 for (; i < count; i++) {
27 comp = super.compare(path1.get(i), path2.get(i));
31 if (path1.size() < path2.size())
33 else if (path2.size() > path1.size())
36 Resource rel1 = graph.getPossibleObject(o1, sl.consernsRelation);
37 Resource rel2 = graph.getPossibleObject(o2, sl.consernsRelation);
40 return super.compare(rel1,rel2);
42 } else if (rel2 != null)
46 } catch (Exception e) {