@Override
public Object getValue(ReadGraph graph, Variable context) throws DatabaseException {
StandardGraphPropertyVariable variable = (StandardGraphPropertyVariable)context;
- return new ConnectionImpl2(context.getParent(graph), variable.property.predicate);
+ return new ConnectionImpl(context.getParent(graph), variable.property.predicate);
}
@Override
}
+ public static class StructuralChildMapOfResource extends ResourceRead<Map<String, Resource>> {
+
+ public StructuralChildMapOfResource(Resource resource) {
+ super(resource);
+ }
+
+ @Override
+ public Map<String, Resource> perform(ReadGraph graph) throws DatabaseException {
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);
+ Resource type = graph.getPossibleType(resource, STR.Component);
+ if(type != null) {
+ Resource definition = graph.getPossibleObject(type, STR.IsDefinedBy);
+ if(definition != null) {
+ Map<String, Resource> map = graph.syncRequest(new UnescapedChildMapOfResource(definition));
+ if (!map.isEmpty())
+ return map;
+ }
+ }
+ Map<String, Resource> directChildren = graph.syncRequest(new UnescapedChildMapOfResource(resource));
+ return directChildren;
+ }
+
+ }
+
+ public static class StructuralChildMapOfResourceT extends ResourceRead<Map<String, Resource>> {
+
+ public StructuralChildMapOfResourceT(Resource resource) {
+ super(resource);
+ }
+
+ @Override
+ public Map<String, Resource> perform(ReadGraph graph) throws DatabaseException {
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);
+ Resource definition = graph.getPossibleObject(resource, STR.IsDefinedBy);
+ if(definition != null) {
+ Map<String, Resource> map = graph.syncRequest(new UnescapedChildMapOfResource(definition));
+ if (!map.isEmpty())
+ return map;
+ }
+ return Collections.emptyMap();
+ }
+
+ }
+
+ static class StructuralRunChildMapOfResource extends ResourceRead<Map<String, Resource>> {
+
+ public StructuralRunChildMapOfResource(Resource resource) {
+ super(resource);
+ }
+
+ public Map<String, Resource> fromContext(ReadGraph graph, Resource context) throws DatabaseException {
+ return graph.sync(new StructuralChildMapOfResource(context));
+ }
+
+ @Override
+ public Map<String, Resource> perform(ReadGraph graph) throws DatabaseException {
+
+ Layer0 L0 = Layer0.getInstance(graph);
+ SimulationResource SIMU = SimulationResource.getInstance(graph);
+ Resource model = graph.sync(new PossibleIndexRoot(resource));
+ if(graph.isInstanceOf(model, L0.RVIContext)) {
+ return fromContext(graph, model);
+ }
+ Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration);
+ if(configuration != null) {
+ if(graph.isInstanceOf(configuration, L0.RVIContext)) {
+ return fromContext(graph, configuration);
+ }
+ }
+
+ return Collections.emptyMap();
+
+ }
+
+ }
+
private static class SubstructureRequest extends VariableRead<List<SubstructureElement>> {
public SubstructureRequest(Variable context) {
super(context);