+ public static String getPossibleRootRelativePath(ReadGraph graph, Resource r) throws DatabaseException {\r
+ Resource indexRoot = graph.syncRequest(new PossibleIndexRoot(r));\r
+ String uri = graph.getPossibleURI(r);\r
+ if (indexRoot != null && uri != null) {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ Set<Resource> types = graph.getTypes(indexRoot);\r
+ if (!types.contains(L0.Ontology)) {\r
+ Resource indexRootParent = graph.getPossibleObject(indexRoot, L0.PartOf);\r
+ if (indexRootParent != null) {\r
+ String rootParentUri = graph.getPossibleURI(indexRootParent);\r
+ if (rootParentUri != null) {\r
+ return URIStringUtils.unescape( uri.substring(rootParentUri.length()+1) );\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return uri;\r
+ }\r
+\r