+ if (uri != null)
+ return getPossibleVariable(graph, uri);
+ Resource parent = CommonDBUtils.getPossibleOwner(graph, resource);
+ if (parent == null)
+ return null;
+ Variable possibleVariable = getPossibleVariable(graph, parent);
+ if (possibleVariable == null)
+ return null;
+ String possibleName = graph.getPossibleRelatedValue(resource, Layer0.getInstance(graph).HasName, Bindings.STRING);
+ if (possibleName == null)
+ possibleName = VariableUtils.unnamedResourceName(resource);
+ Variable possibleChild = possibleVariable.getPossibleChild(graph, possibleName);
+ if (possibleChild != null)
+ return possibleChild;
+ for (Variable v : possibleVariable.getChildren(graph)) {
+ Resource vr = v.getPossibleRepresents(graph);
+ if (vr != null && vr.equals(resource)) {
+ return v;
+ }
+ }
+ return null;