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