1 package org.simantics.structural2.queries;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.common.request.ResourceRead;
8 import org.simantics.db.common.uri.UnescapedChildMapOfResource;
9 import org.simantics.db.exception.DatabaseException;
10 import org.simantics.structural.stubs.StructuralResource2;
12 public class StructuralChildMapOfResource extends ResourceRead<Map<String, Resource>> {
14 public StructuralChildMapOfResource(Resource resource) {
19 public Map<String, Resource> perform(ReadGraph graph) throws DatabaseException {
20 StructuralResource2 STR = StructuralResource2.getInstance(graph);
21 Resource type = graph.getPossibleType(resource, STR.Component);
23 Resource definition = graph.getPossibleObject(type, STR.IsDefinedBy);
24 if(definition != null) {
25 Map<String, Resource> map = graph.syncRequest(new UnescapedChildMapOfResource(definition));
30 Map<String, Resource> directChildren = graph.syncRequest(new UnescapedChildMapOfResource(resource));
31 return directChildren;