package org.simantics.db.layer0.request; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.exception.DatabaseException; public class ClassificationsRequest extends UnaryRead, Set> { public ClassificationsRequest(Collection principalTypes) { super(principalTypes); } @Override public Set perform(ReadGraph graph) throws DatabaseException { Set result = new HashSet(parameter.size()); Set allTypes = new HashSet(parameter); for(Resource principalType : parameter) allTypes.addAll(graph.getSupertypes(principalType)); for(Resource type : allTypes) { String uri = graph.getPossibleURI(type); if(uri != null) result.add(uri); } return result; } }