1 package org.simantics.district.network.techtype.requests;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.request.ResourceRead;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.district.network.ontology.DistrictNetworkResource;
8 import org.simantics.layer0.Layer0;
10 public class TechTypeTableKeyName extends ResourceRead<String> {
12 public TechTypeTableKeyName(Resource table) {
17 public String perform(ReadGraph graph) throws DatabaseException {
18 Layer0 L0 = Layer0.getInstance(graph);
19 DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
21 Resource type = graph.getPossibleObject(resource, DN.TechType_TechTypeTable_HasComponentType);
23 for (Resource r : graph.getObjects(type, L0.DomainOf)) {
24 Resource accessor = graph.getPossibleObject(r, L0.valueAccessor);
25 if (accessor.equals(DN.TechType_Functions_techTypeCodeValueAccessor)) {
26 return graph.getRelatedValue2(r, L0.HasName);