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.UnaryRead;
10 import org.simantics.db.exception.DatabaseException;
12 public class ClassificationsRequest extends UnaryRead<Collection<Resource>, Set<String>> {
14 public ClassificationsRequest(Collection<Resource> principalTypes) {
15 super(principalTypes);
19 public Set<String> perform(ReadGraph graph) throws DatabaseException {
20 Set<String> result = new HashSet<String>(parameter.size());
21 Set<Resource> allTypes = new HashSet<Resource>(parameter);
22 for(Resource principalType : parameter) allTypes.addAll(graph.getSupertypes(principalType));
23 for(Resource type : allTypes) {
24 String uri = graph.getPossibleURI(type);
25 if(uri != null) result.add(uri);