1 package org.simantics.district.network.ontology;
3 import org.simantics.db.RequestProcessor;
4 import org.simantics.db.Resource;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.request.Read;
7 import org.simantics.db.Session;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.service.QueryControl;
11 public class DistrictNetworkResource {
13 public final Resource ActionContext;
14 public final Resource ActionContext_newDiagramContribution;
15 public final Resource Actions;
16 public final Resource Actions_NewDNDiagram;
17 public final Resource AddLayerToDNDiagramTemplate;
18 public final Resource Bidirectional;
19 public final Resource Bidirectional_Inverse;
20 public final Resource BrowseContext;
21 public final Resource Composite;
22 public final Resource Connection;
23 public final Resource Diagram;
24 public final Resource EPSG_4326;
25 public final Resource Edge;
26 public final Resource EdgeDefaultMapping;
27 public final Resource EdgeDefaultMapping_Inverse;
28 public final Resource EdgeMappingParameterType;
29 public final Resource Edge_HasDiameter;
30 public final Resource Edge_HasDiameter_Inverse;
31 public final Resource Functions;
32 public final Resource Functions_compositeInstantiator;
33 public final Resource Functions_convertToValue;
34 public final Resource Functions_defaultEdgeMappingModifier;
35 public final Resource Functions_defaultVertexMappingModifier;
36 public final Resource Functions_enumerationValues;
37 public final Resource Functions_mappingModifier;
38 public final Resource HasEndVertex;
39 public final Resource HasEndVertex_Inverse;
40 public final Resource HasInLayerTag;
41 public final Resource HasInLayerTag_Inverse;
42 public final Resource HasMapping;
43 public final Resource HasMapping_Inverse;
44 public final Resource HasSRID;
45 public final Resource HasSRID_Inverse;
46 public final Resource HasSRTEXT;
47 public final Resource HasSRTEXT_Inverse;
48 public final Resource HasSpatialRefSystem;
49 public final Resource HasSpatialRefSystem_Inverse;
50 public final Resource HasStartVertex;
51 public final Resource HasStartVertex_Inverse;
52 public final Resource Images;
53 public final Resource Images_ConfigurationFolder;
54 public final Resource InLayer;
55 public final Resource Layer;
56 public final Resource Mapping;
57 public final Resource MappingParameterType;
58 public final Resource Mapping_Base;
59 public final Resource Mapping_ComponentType;
60 public final Resource Mapping_ComponentType_Inverse;
61 public final Resource Mapping_EdgeMapping;
62 public final Resource Mapping_EdgeMapping_Bidirectional;
63 public final Resource Mapping_EdgeMapping_Bidirectional_Inverse;
64 public final Resource Mapping_EdgeMapping_DiameterAttribute;
65 public final Resource Mapping_EdgeMapping_DiameterAttribute_Inverse;
66 public final Resource Mapping_EdgeMapping_LengthAttribute;
67 public final Resource Mapping_EdgeMapping_LengthAttribute_Inverse;
68 public final Resource Mapping_InputTerminal;
69 public final Resource Mapping_InputTerminal_Inverse;
70 public final Resource Mapping_OutputTerminal;
71 public final Resource Mapping_OutputTerminal_Inverse;
72 public final Resource Mapping_Terminal;
73 public final Resource Mapping_TerminalPair;
74 public final Resource Mapping_Terminals;
75 public final Resource Mapping_Terminals_Inverse;
76 public final Resource Mapping_VertexMapping;
77 public final Resource Mapping_VertexMapping_ElevationAttribute;
78 public final Resource Mapping_VertexMapping_ElevationAttribute_Inverse;
79 public final Resource SpatialRefSystem;
80 public final Resource Vertex;
81 public final Resource VertexDefaultMapping;
82 public final Resource VertexDefaultMapping_Inverse;
83 public final Resource VertexMappingParameterType;
85 public static class URIs {
86 public static final String ActionContext = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext";
87 public static final String ActionContext_newDiagramContribution = "http://www.simantics.org/DistrictNetwork-1.0/ActionContext/newDiagramContribution";
88 public static final String Actions = "http://www.simantics.org/DistrictNetwork-1.0/Actions";
89 public static final String Actions_NewDNDiagram = "http://www.simantics.org/DistrictNetwork-1.0/Actions/NewDNDiagram";
90 public static final String AddLayerToDNDiagramTemplate = "http://www.simantics.org/DistrictNetwork-1.0/AddLayerToDNDiagramTemplate";
91 public static final String Bidirectional = "http://www.simantics.org/DistrictNetwork-1.0/Bidirectional";
92 public static final String Bidirectional_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Bidirectional/Inverse";
93 public static final String BrowseContext = "http://www.simantics.org/DistrictNetwork-1.0/BrowseContext";
94 public static final String Composite = "http://www.simantics.org/DistrictNetwork-1.0/Composite";
95 public static final String Connection = "http://www.simantics.org/DistrictNetwork-1.0/Connection";
96 public static final String Diagram = "http://www.simantics.org/DistrictNetwork-1.0/Diagram";
97 public static final String EPSG_4326 = "http://www.simantics.org/DistrictNetwork-1.0/EPSG_4326";
98 public static final String Edge = "http://www.simantics.org/DistrictNetwork-1.0/Edge";
99 public static final String EdgeDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping";
100 public static final String EdgeDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/EdgeDefaultMapping/Inverse";
101 public static final String EdgeMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/EdgeMappingParameterType";
102 public static final String Edge_HasDiameter = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter";
103 public static final String Edge_HasDiameter_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Edge/HasDiameter/Inverse";
104 public static final String Functions = "http://www.simantics.org/DistrictNetwork-1.0/Functions";
105 public static final String Functions_compositeInstantiator = "http://www.simantics.org/DistrictNetwork-1.0/Functions/compositeInstantiator";
106 public static final String Functions_convertToValue = "http://www.simantics.org/DistrictNetwork-1.0/Functions/convertToValue";
107 public static final String Functions_defaultEdgeMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultEdgeMappingModifier";
108 public static final String Functions_defaultVertexMappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/defaultVertexMappingModifier";
109 public static final String Functions_enumerationValues = "http://www.simantics.org/DistrictNetwork-1.0/Functions/enumerationValues";
110 public static final String Functions_mappingModifier = "http://www.simantics.org/DistrictNetwork-1.0/Functions/mappingModifier";
111 public static final String HasEndVertex = "http://www.simantics.org/DistrictNetwork-1.0/HasEndVertex";
112 public static final String HasEndVertex_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasEndVertex_Inverse";
113 public static final String HasInLayerTag = "http://www.simantics.org/DistrictNetwork-1.0/HasInLayerTag";
114 public static final String HasInLayerTag_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasInLayerTag/Inverse";
115 public static final String HasMapping = "http://www.simantics.org/DistrictNetwork-1.0/HasMapping";
116 public static final String HasMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasMapping/Inverse";
117 public static final String HasSRID = "http://www.simantics.org/DistrictNetwork-1.0/HasSRID";
118 public static final String HasSRID_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasSRID/Inverse";
119 public static final String HasSRTEXT = "http://www.simantics.org/DistrictNetwork-1.0/HasSRTEXT";
120 public static final String HasSRTEXT_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasSRTEXT/Inverse";
121 public static final String HasSpatialRefSystem = "http://www.simantics.org/DistrictNetwork-1.0/HasSpatialRefSystem";
122 public static final String HasSpatialRefSystem_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasSpatialRefSystem/Inverse";
123 public static final String HasStartVertex = "http://www.simantics.org/DistrictNetwork-1.0/HasStartVertex";
124 public static final String HasStartVertex_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/HasStartVertex_Inverse";
125 public static final String Images = "http://www.simantics.org/DistrictNetwork-1.0/Images";
126 public static final String Images_ConfigurationFolder = "http://www.simantics.org/DistrictNetwork-1.0/Images/ConfigurationFolder";
127 public static final String InLayer = "http://www.simantics.org/DistrictNetwork-1.0/InLayer";
128 public static final String Layer = "http://www.simantics.org/DistrictNetwork-1.0/Layer";
129 public static final String Mapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping";
130 public static final String MappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/MappingParameterType";
131 public static final String Mapping_Base = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Base";
132 public static final String Mapping_ComponentType = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/ComponentType";
133 public static final String Mapping_ComponentType_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/ComponentType/Inverse";
134 public static final String Mapping_EdgeMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping";
135 public static final String Mapping_EdgeMapping_Bidirectional = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/Bidirectional";
136 public static final String Mapping_EdgeMapping_Bidirectional_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/Bidirectional/Inverse";
137 public static final String Mapping_EdgeMapping_DiameterAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/DiameterAttribute";
138 public static final String Mapping_EdgeMapping_DiameterAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/DiameterAttribute/Inverse";
139 public static final String Mapping_EdgeMapping_LengthAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/LengthAttribute";
140 public static final String Mapping_EdgeMapping_LengthAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/EdgeMapping/LengthAttribute/Inverse";
141 public static final String Mapping_InputTerminal = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/InputTerminal";
142 public static final String Mapping_InputTerminal_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/InputTerminal/Inverse";
143 public static final String Mapping_OutputTerminal = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/OutputTerminal";
144 public static final String Mapping_OutputTerminal_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/OutputTerminal/Inverse";
145 public static final String Mapping_Terminal = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminal";
146 public static final String Mapping_TerminalPair = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/TerminalPair";
147 public static final String Mapping_Terminals = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals";
148 public static final String Mapping_Terminals_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/Terminals/Inverse";
149 public static final String Mapping_VertexMapping = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping";
150 public static final String Mapping_VertexMapping_ElevationAttribute = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ElevationAttribute";
151 public static final String Mapping_VertexMapping_ElevationAttribute_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/Mapping/VertexMapping/ElevationAttribute/Inverse";
152 public static final String SpatialRefSystem = "http://www.simantics.org/DistrictNetwork-1.0/SpatialRefSystem";
153 public static final String Vertex = "http://www.simantics.org/DistrictNetwork-1.0/Vertex";
154 public static final String VertexDefaultMapping = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping";
155 public static final String VertexDefaultMapping_Inverse = "http://www.simantics.org/DistrictNetwork-1.0/VertexDefaultMapping/Inverse";
156 public static final String VertexMappingParameterType = "http://www.simantics.org/DistrictNetwork-1.0/VertexMappingParameterType";
159 public static Resource getResourceOrNull(ReadGraph graph, String uri) {
161 return graph.getResource(uri);
162 } catch(DatabaseException e) {
163 System.err.println(e.getMessage());
168 public DistrictNetworkResource(ReadGraph graph) {
169 ActionContext = getResourceOrNull(graph, URIs.ActionContext);
170 ActionContext_newDiagramContribution = getResourceOrNull(graph, URIs.ActionContext_newDiagramContribution);
171 Actions = getResourceOrNull(graph, URIs.Actions);
172 Actions_NewDNDiagram = getResourceOrNull(graph, URIs.Actions_NewDNDiagram);
173 AddLayerToDNDiagramTemplate = getResourceOrNull(graph, URIs.AddLayerToDNDiagramTemplate);
174 Bidirectional = getResourceOrNull(graph, URIs.Bidirectional);
175 Bidirectional_Inverse = getResourceOrNull(graph, URIs.Bidirectional_Inverse);
176 BrowseContext = getResourceOrNull(graph, URIs.BrowseContext);
177 Composite = getResourceOrNull(graph, URIs.Composite);
178 Connection = getResourceOrNull(graph, URIs.Connection);
179 Diagram = getResourceOrNull(graph, URIs.Diagram);
180 EPSG_4326 = getResourceOrNull(graph, URIs.EPSG_4326);
181 Edge = getResourceOrNull(graph, URIs.Edge);
182 EdgeDefaultMapping = getResourceOrNull(graph, URIs.EdgeDefaultMapping);
183 EdgeDefaultMapping_Inverse = getResourceOrNull(graph, URIs.EdgeDefaultMapping_Inverse);
184 EdgeMappingParameterType = getResourceOrNull(graph, URIs.EdgeMappingParameterType);
185 Edge_HasDiameter = getResourceOrNull(graph, URIs.Edge_HasDiameter);
186 Edge_HasDiameter_Inverse = getResourceOrNull(graph, URIs.Edge_HasDiameter_Inverse);
187 Functions = getResourceOrNull(graph, URIs.Functions);
188 Functions_compositeInstantiator = getResourceOrNull(graph, URIs.Functions_compositeInstantiator);
189 Functions_convertToValue = getResourceOrNull(graph, URIs.Functions_convertToValue);
190 Functions_defaultEdgeMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultEdgeMappingModifier);
191 Functions_defaultVertexMappingModifier = getResourceOrNull(graph, URIs.Functions_defaultVertexMappingModifier);
192 Functions_enumerationValues = getResourceOrNull(graph, URIs.Functions_enumerationValues);
193 Functions_mappingModifier = getResourceOrNull(graph, URIs.Functions_mappingModifier);
194 HasEndVertex = getResourceOrNull(graph, URIs.HasEndVertex);
195 HasEndVertex_Inverse = getResourceOrNull(graph, URIs.HasEndVertex_Inverse);
196 HasInLayerTag = getResourceOrNull(graph, URIs.HasInLayerTag);
197 HasInLayerTag_Inverse = getResourceOrNull(graph, URIs.HasInLayerTag_Inverse);
198 HasMapping = getResourceOrNull(graph, URIs.HasMapping);
199 HasMapping_Inverse = getResourceOrNull(graph, URIs.HasMapping_Inverse);
200 HasSRID = getResourceOrNull(graph, URIs.HasSRID);
201 HasSRID_Inverse = getResourceOrNull(graph, URIs.HasSRID_Inverse);
202 HasSRTEXT = getResourceOrNull(graph, URIs.HasSRTEXT);
203 HasSRTEXT_Inverse = getResourceOrNull(graph, URIs.HasSRTEXT_Inverse);
204 HasSpatialRefSystem = getResourceOrNull(graph, URIs.HasSpatialRefSystem);
205 HasSpatialRefSystem_Inverse = getResourceOrNull(graph, URIs.HasSpatialRefSystem_Inverse);
206 HasStartVertex = getResourceOrNull(graph, URIs.HasStartVertex);
207 HasStartVertex_Inverse = getResourceOrNull(graph, URIs.HasStartVertex_Inverse);
208 Images = getResourceOrNull(graph, URIs.Images);
209 Images_ConfigurationFolder = getResourceOrNull(graph, URIs.Images_ConfigurationFolder);
210 InLayer = getResourceOrNull(graph, URIs.InLayer);
211 Layer = getResourceOrNull(graph, URIs.Layer);
212 Mapping = getResourceOrNull(graph, URIs.Mapping);
213 MappingParameterType = getResourceOrNull(graph, URIs.MappingParameterType);
214 Mapping_Base = getResourceOrNull(graph, URIs.Mapping_Base);
215 Mapping_ComponentType = getResourceOrNull(graph, URIs.Mapping_ComponentType);
216 Mapping_ComponentType_Inverse = getResourceOrNull(graph, URIs.Mapping_ComponentType_Inverse);
217 Mapping_EdgeMapping = getResourceOrNull(graph, URIs.Mapping_EdgeMapping);
218 Mapping_EdgeMapping_Bidirectional = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_Bidirectional);
219 Mapping_EdgeMapping_Bidirectional_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_Bidirectional_Inverse);
220 Mapping_EdgeMapping_DiameterAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_DiameterAttribute);
221 Mapping_EdgeMapping_DiameterAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_DiameterAttribute_Inverse);
222 Mapping_EdgeMapping_LengthAttribute = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_LengthAttribute);
223 Mapping_EdgeMapping_LengthAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_EdgeMapping_LengthAttribute_Inverse);
224 Mapping_InputTerminal = getResourceOrNull(graph, URIs.Mapping_InputTerminal);
225 Mapping_InputTerminal_Inverse = getResourceOrNull(graph, URIs.Mapping_InputTerminal_Inverse);
226 Mapping_OutputTerminal = getResourceOrNull(graph, URIs.Mapping_OutputTerminal);
227 Mapping_OutputTerminal_Inverse = getResourceOrNull(graph, URIs.Mapping_OutputTerminal_Inverse);
228 Mapping_Terminal = getResourceOrNull(graph, URIs.Mapping_Terminal);
229 Mapping_TerminalPair = getResourceOrNull(graph, URIs.Mapping_TerminalPair);
230 Mapping_Terminals = getResourceOrNull(graph, URIs.Mapping_Terminals);
231 Mapping_Terminals_Inverse = getResourceOrNull(graph, URIs.Mapping_Terminals_Inverse);
232 Mapping_VertexMapping = getResourceOrNull(graph, URIs.Mapping_VertexMapping);
233 Mapping_VertexMapping_ElevationAttribute = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ElevationAttribute);
234 Mapping_VertexMapping_ElevationAttribute_Inverse = getResourceOrNull(graph, URIs.Mapping_VertexMapping_ElevationAttribute_Inverse);
235 SpatialRefSystem = getResourceOrNull(graph, URIs.SpatialRefSystem);
236 Vertex = getResourceOrNull(graph, URIs.Vertex);
237 VertexDefaultMapping = getResourceOrNull(graph, URIs.VertexDefaultMapping);
238 VertexDefaultMapping_Inverse = getResourceOrNull(graph, URIs.VertexDefaultMapping_Inverse);
239 VertexMappingParameterType = getResourceOrNull(graph, URIs.VertexMappingParameterType);
242 public static DistrictNetworkResource getInstance(ReadGraph graph) {
243 Session session = graph.getSession();
244 DistrictNetworkResource ret = session.peekService(DistrictNetworkResource.class);
246 QueryControl qc = graph.getService(QueryControl.class);
247 ret = new DistrictNetworkResource(qc.getIndependentGraph(graph));
248 session.registerService(DistrictNetworkResource.class, ret);
253 public static DistrictNetworkResource getInstance(RequestProcessor session) throws DatabaseException {
254 DistrictNetworkResource ret = session.peekService(DistrictNetworkResource.class);
256 ret = session.syncRequest(new Read<DistrictNetworkResource>() {
257 public DistrictNetworkResource perform(ReadGraph graph) throws DatabaseException {
258 QueryControl qc = graph.getService(QueryControl.class);
259 return new DistrictNetworkResource(qc.getIndependentGraph(graph));
262 session.registerService(DistrictNetworkResource.class, ret);