1 package org.simantics.simulation.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 HistoryResource {
13 public final Resource History;
14 public final Resource History_Item;
15 public final Resource History_Item_Bias;
16 public final Resource History_Item_Bias_Inverse;
17 public final Resource History_Item_CollectorState;
18 public final Resource History_Item_CollectorState_Inverse;
19 public final Resource History_Item_Deadband;
20 public final Resource History_Item_Deadband_Inverse;
21 public final Resource History_Item_Enabled;
22 public final Resource History_Item_Enabled_Inverse;
23 public final Resource History_Item_Format;
24 public final Resource History_Item_FormatId;
25 public final Resource History_Item_FormatId_Inverse;
26 public final Resource History_Item_Format_Inverse;
27 public final Resource History_Item_Gain;
28 public final Resource History_Item_Gain_Inverse;
29 public final Resource History_Item_GroupId;
30 public final Resource History_Item_GroupId_Inverse;
31 public final Resource History_Item_GroupItemId;
32 public final Resource History_Item_GroupItemId_Inverse;
33 public final Resource History_Item_Info;
34 public final Resource History_Item_Info_Inverse;
35 public final Resource History_Item_Interval;
36 public final Resource History_Item_Interval_Inverse;
37 public final Resource History_Item_Series;
38 public final Resource History_Item_Series_Inverse;
39 public final Resource History_Item_VariableId;
40 public final Resource History_Item_VariableId_Inverse;
41 public final Resource History_Item_size;
42 public final Resource History_Item_size_Inverse;
43 public final Resource History_archive;
44 public final Resource History_archive_Inverse;
45 public final Resource History_size;
46 public final Resource History_size_Inverse;
48 public static class URIs {
49 public static final String History = "http://www.simantics.org/Simulation-1.1/History/History";
50 public static final String History_Item = "http://www.simantics.org/Simulation-1.1/History/History/Item";
51 public static final String History_Item_Bias = "http://www.simantics.org/Simulation-1.1/History/History/Item/Bias";
52 public static final String History_Item_Bias_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Bias/Inverse";
53 public static final String History_Item_CollectorState = "http://www.simantics.org/Simulation-1.1/History/History/Item/CollectorState";
54 public static final String History_Item_CollectorState_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/CollectorState/Inverse";
55 public static final String History_Item_Deadband = "http://www.simantics.org/Simulation-1.1/History/History/Item/Deadband";
56 public static final String History_Item_Deadband_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Deadband/Inverse";
57 public static final String History_Item_Enabled = "http://www.simantics.org/Simulation-1.1/History/History/Item/Enabled";
58 public static final String History_Item_Enabled_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Enabled/Inverse";
59 public static final String History_Item_Format = "http://www.simantics.org/Simulation-1.1/History/History/Item/Format";
60 public static final String History_Item_FormatId = "http://www.simantics.org/Simulation-1.1/History/History/Item/FormatId";
61 public static final String History_Item_FormatId_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/FormatId/Inverse";
62 public static final String History_Item_Format_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Format/Inverse";
63 public static final String History_Item_Gain = "http://www.simantics.org/Simulation-1.1/History/History/Item/Gain";
64 public static final String History_Item_Gain_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Gain/Inverse";
65 public static final String History_Item_GroupId = "http://www.simantics.org/Simulation-1.1/History/History/Item/GroupId";
66 public static final String History_Item_GroupId_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/GroupId/Inverse";
67 public static final String History_Item_GroupItemId = "http://www.simantics.org/Simulation-1.1/History/History/Item/GroupItemId";
68 public static final String History_Item_GroupItemId_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/GroupItemId/Inverse";
69 public static final String History_Item_Info = "http://www.simantics.org/Simulation-1.1/History/History/Item/Info";
70 public static final String History_Item_Info_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Info/Inverse";
71 public static final String History_Item_Interval = "http://www.simantics.org/Simulation-1.1/History/History/Item/Interval";
72 public static final String History_Item_Interval_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Interval/Inverse";
73 public static final String History_Item_Series = "http://www.simantics.org/Simulation-1.1/History/History/Item/Series";
74 public static final String History_Item_Series_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/Series/Inverse";
75 public static final String History_Item_VariableId = "http://www.simantics.org/Simulation-1.1/History/History/Item/VariableId";
76 public static final String History_Item_VariableId_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/VariableId/Inverse";
77 public static final String History_Item_size = "http://www.simantics.org/Simulation-1.1/History/History/Item/size";
78 public static final String History_Item_size_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/Item/size/Inverse";
79 public static final String History_archive = "http://www.simantics.org/Simulation-1.1/History/History/archive";
80 public static final String History_archive_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/archive/Inverse";
81 public static final String History_size = "http://www.simantics.org/Simulation-1.1/History/History/size";
82 public static final String History_size_Inverse = "http://www.simantics.org/Simulation-1.1/History/History/size/Inverse";
85 public static Resource getResourceOrNull(ReadGraph graph, String uri) {
87 return graph.getResource(uri);
88 } catch(DatabaseException e) {
89 System.err.println(e.getMessage());
94 public HistoryResource(ReadGraph graph) {
95 History = getResourceOrNull(graph, URIs.History);
96 History_Item = getResourceOrNull(graph, URIs.History_Item);
97 History_Item_Bias = getResourceOrNull(graph, URIs.History_Item_Bias);
98 History_Item_Bias_Inverse = getResourceOrNull(graph, URIs.History_Item_Bias_Inverse);
99 History_Item_CollectorState = getResourceOrNull(graph, URIs.History_Item_CollectorState);
100 History_Item_CollectorState_Inverse = getResourceOrNull(graph, URIs.History_Item_CollectorState_Inverse);
101 History_Item_Deadband = getResourceOrNull(graph, URIs.History_Item_Deadband);
102 History_Item_Deadband_Inverse = getResourceOrNull(graph, URIs.History_Item_Deadband_Inverse);
103 History_Item_Enabled = getResourceOrNull(graph, URIs.History_Item_Enabled);
104 History_Item_Enabled_Inverse = getResourceOrNull(graph, URIs.History_Item_Enabled_Inverse);
105 History_Item_Format = getResourceOrNull(graph, URIs.History_Item_Format);
106 History_Item_FormatId = getResourceOrNull(graph, URIs.History_Item_FormatId);
107 History_Item_FormatId_Inverse = getResourceOrNull(graph, URIs.History_Item_FormatId_Inverse);
108 History_Item_Format_Inverse = getResourceOrNull(graph, URIs.History_Item_Format_Inverse);
109 History_Item_Gain = getResourceOrNull(graph, URIs.History_Item_Gain);
110 History_Item_Gain_Inverse = getResourceOrNull(graph, URIs.History_Item_Gain_Inverse);
111 History_Item_GroupId = getResourceOrNull(graph, URIs.History_Item_GroupId);
112 History_Item_GroupId_Inverse = getResourceOrNull(graph, URIs.History_Item_GroupId_Inverse);
113 History_Item_GroupItemId = getResourceOrNull(graph, URIs.History_Item_GroupItemId);
114 History_Item_GroupItemId_Inverse = getResourceOrNull(graph, URIs.History_Item_GroupItemId_Inverse);
115 History_Item_Info = getResourceOrNull(graph, URIs.History_Item_Info);
116 History_Item_Info_Inverse = getResourceOrNull(graph, URIs.History_Item_Info_Inverse);
117 History_Item_Interval = getResourceOrNull(graph, URIs.History_Item_Interval);
118 History_Item_Interval_Inverse = getResourceOrNull(graph, URIs.History_Item_Interval_Inverse);
119 History_Item_Series = getResourceOrNull(graph, URIs.History_Item_Series);
120 History_Item_Series_Inverse = getResourceOrNull(graph, URIs.History_Item_Series_Inverse);
121 History_Item_VariableId = getResourceOrNull(graph, URIs.History_Item_VariableId);
122 History_Item_VariableId_Inverse = getResourceOrNull(graph, URIs.History_Item_VariableId_Inverse);
123 History_Item_size = getResourceOrNull(graph, URIs.History_Item_size);
124 History_Item_size_Inverse = getResourceOrNull(graph, URIs.History_Item_size_Inverse);
125 History_archive = getResourceOrNull(graph, URIs.History_archive);
126 History_archive_Inverse = getResourceOrNull(graph, URIs.History_archive_Inverse);
127 History_size = getResourceOrNull(graph, URIs.History_size);
128 History_size_Inverse = getResourceOrNull(graph, URIs.History_size_Inverse);
131 public static HistoryResource getInstance(ReadGraph graph) {
132 Session session = graph.getSession();
133 HistoryResource ret = session.peekService(HistoryResource.class);
135 QueryControl qc = graph.getService(QueryControl.class);
136 ret = new HistoryResource(qc.getIndependentGraph(graph));
137 session.registerService(HistoryResource.class, ret);
142 public static HistoryResource getInstance(RequestProcessor session) throws DatabaseException {
143 HistoryResource ret = session.peekService(HistoryResource.class);
145 ret = session.syncRequest(new Read<HistoryResource>() {
146 public HistoryResource perform(ReadGraph graph) throws DatabaseException {
147 QueryControl qc = graph.getService(QueryControl.class);
148 return new HistoryResource(qc.getIndependentGraph(graph));
151 session.registerService(HistoryResource.class, ret);