Binding rviBinding = databoard.getBindingUnchecked( RVI.class );
return RVI.empty(rviBinding);
}
- Variable base = variable.getParent(graph);
- while(!isRVIBase(graph, base)) base = base.getParent(graph);
- RVIPart part = getRVIPart(graph, variable);
- return new RVIBuilder(base.getRVI(graph)).append(part).toRVI();
+ else {
+ Variable base = variable.getParent(graph);
+ while(!isRVIBase(graph, base)) base = base.getParent(graph);
+ RVIPart part = getRVIPart(graph, variable);
+ return new RVIBuilder(base.getRVI(graph)).append(part).toRVI();
+ }
+ }
+
+ @Override
+ public RVI getPossibleRVI(ReadGraph graph, Variable variable) throws DatabaseException {
+ if (Variables.isContext(graph, variable)) {
+ Databoard databoard = graph.getService( Databoard.class );
+ Binding rviBinding = databoard.getBindingUnchecked( RVI.class );
+ return RVI.empty(rviBinding);
+ }
+ else {
+ Variable base = variable.getParent(graph);
+ if(base == null) return null;
+ while(!isRVIBase(graph, base)) {
+ base = base.getParent(graph);
+ if(base == null) return null;
+ }
+ RVIPart part = getRVIPart(graph, variable);
+ if(part == null) return null;
+ RVI baseRVI = base.getPossibleRVI(graph);
+ if(baseRVI == null) return null;
+ return new RVIBuilder(baseRVI).append(part).toRVI();
+ }
}
protected boolean isPartOfComponentType(ReadGraph graph, Resource resource)
@Override
protected Variable resolveChild(ReadGraph graph, Variable variable, Resource resource) throws DatabaseException {
Collection<Resource> path = getRVIPath(graph, variable, resource);
- if(path == null) throw new MissingVariableException("Didn't find a variable related to " + resource + ".", resource);
- for(Resource r : path) variable = variable.browse(graph, r);
+ if (path == null)
+ throw new MissingVariableException("Didn't find a variable related to " + resource + ".", resource);
+ for (Resource r : path)
+ variable = variable.browse(graph, r);
return variable;
}
-
+
@Override
protected Variable resolveChild(ReadGraph graph, Variable variable, GuidRVIPart part) throws DatabaseException {
Collection<Resource> path = getRVIPath(graph, variable, part);
- if(path == null) throw new MissingVariableException("Didn't find a variable related to " + part + ".");
- for(Resource r : path) variable = variable.browse(graph, r);
+ if (path == null)
+ throw new MissingVariableException("Didn't find a variable related to " + part + ".", variable.getPossibleRepresents(graph));
+ for (Resource r : path)
+ variable = variable.browse(graph, r);
return variable;
}