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