1 package org.simantics.db.layer0.request;
3 import java.util.Collection;
4 import java.util.HashSet;
7 import org.simantics.db.ReadGraph;
8 import org.simantics.db.Resource;
9 import org.simantics.db.common.request.ResourceRead;
10 import org.simantics.db.exception.DatabaseException;
11 import org.simantics.layer0.Layer0;
14 * @author Tuukka Lehtonen
17 public class LinkedFrom extends ResourceRead<Set<Resource>> {
19 public LinkedFrom(Resource resource) {
24 public Set<Resource> perform(ReadGraph graph) throws DatabaseException {
25 Layer0 L0 = Layer0.getInstance(graph);
26 HashSet<Resource> result = new HashSet<>();
27 Collection<Resource> linkees = graph.getObjects(resource, L0.IsLinkedTo_Inverse);
28 result.addAll(linkees);
29 for (Resource linkee : linkees) {
30 Set<Resource> deep = graph.sync(new LinkedFrom(linkee));