1 package org.simantics.annotation.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 AnnotationResource {
13 public final Resource Actions;
14 public final Resource Actions_AnnotationDropAction;
15 public final Resource Actions_NewAnnotation;
16 public final Resource Actions_NewAnnotationInstance;
17 public final Resource Actions_NewAnnotationType;
18 public final Resource Actions_NoActionCategory;
19 public final Resource Annotation;
20 public final Resource AnnotationAC;
21 public final Resource AnnotationBC;
22 public final Resource AnnotationBC_AnnotationTypeLabelRule;
23 public final Resource AnnotationBC_AnnotationTypeModifierRule;
24 public final Resource AnnotationType;
25 @Deprecated public final Resource AnnotationTypeLibrary;
26 @Deprecated public final Resource AnnotationTypeLibraryUI;
27 @Deprecated public final Resource AnnotationTypeUI;
28 public final Resource AnnotationType_systemAnnotation;
29 public final Resource AnnotationType_systemAnnotation_Inverse;
30 @Deprecated public final Resource AnnotationUI;
31 public final Resource Annotation_HasEntry;
32 public final Resource Annotation_HasEntry_Inverse;
33 @Deprecated public final Resource BrowseNode;
34 public final Resource DefaultAnnotationSource;
35 public final Resource Functions;
36 public final Resource Functions_availableAnnotations;
37 public final Resource Functions_availableSources;
38 public final Resource Functions_descriptionText;
39 public final Resource Functions_domainChildren;
40 public final Resource Functions_explorerInput;
41 public final Resource Functions_explorerInput2;
42 public final Resource Functions_newAnnotationModifier;
43 public final Resource Functions_removeAnnotationModifier;
44 public final Resource Functions_saveAnnotationModifier;
45 public final Resource Functions_selectedAnnotation;
46 public final Resource Functions_selectedAnnotationModifier;
47 public final Resource Functions_selectedSource;
48 public final Resource Functions_selectedSourceModifier;
49 public final Resource HasAnnotationPropertySubrelation;
50 @Deprecated public final Resource HasAnnotationTypeRoot;
51 public final Resource HasAnnotationTypeRoot_Inverse;
52 public final Resource HasAnnotationTypeSupertype;
53 public final Resource HasDefaultAnnotationName;
54 public final Resource HasDefaultAnnotationType;
55 public final Resource Images;
56 public final Resource Images_Annotation;
57 public final Resource Images_AnnotationType;
58 public final Resource Images_General;
59 public final Resource SelectionTab;
60 public final Resource SelectionTab2;
61 public final Resource SelectionTab2_Properties;
62 public final Resource SelectionTabContribution;
63 public final Resource SelectionTabContribution2;
64 public final Resource SelectionTab_Add;
65 public final Resource SelectionTab_BC;
66 public final Resource SelectionTab_Combo1;
67 public final Resource SelectionTab_Combo2;
68 public final Resource SelectionTab_Description;
69 public final Resource SelectionTab_Properties;
70 public final Resource SelectionTab_Remove;
71 public final Resource SelectionTab_Save;
73 public static class URIs {
74 public static final String Actions = "http://www.simantics.org/Annotation-1.0/Actions";
75 public static final String Actions_AnnotationDropAction = "http://www.simantics.org/Annotation-1.0/Actions/AnnotationDropAction";
76 public static final String Actions_NewAnnotation = "http://www.simantics.org/Annotation-1.0/Actions/NewAnnotation";
77 public static final String Actions_NewAnnotationInstance = "http://www.simantics.org/Annotation-1.0/Actions/NewAnnotationInstance";
78 public static final String Actions_NewAnnotationType = "http://www.simantics.org/Annotation-1.0/Actions/NewAnnotationType";
79 public static final String Actions_NoActionCategory = "http://www.simantics.org/Annotation-1.0/Actions/NoActionCategory";
80 public static final String Annotation = "http://www.simantics.org/Annotation-1.0/Annotation";
81 public static final String AnnotationAC = "http://www.simantics.org/Annotation-1.0/AnnotationAC";
82 public static final String AnnotationBC = "http://www.simantics.org/Annotation-1.0/AnnotationBC";
83 public static final String AnnotationBC_AnnotationTypeLabelRule = "http://www.simantics.org/Annotation-1.0/AnnotationBC/AnnotationTypeLabelRule";
84 public static final String AnnotationBC_AnnotationTypeModifierRule = "http://www.simantics.org/Annotation-1.0/AnnotationBC/AnnotationTypeModifierRule";
85 public static final String AnnotationType = "http://www.simantics.org/Annotation-1.0/AnnotationType";
86 @Deprecated public static final String AnnotationTypeLibrary = "http://www.simantics.org/Annotation-1.0/AnnotationTypeLibrary";
87 @Deprecated public static final String AnnotationTypeLibraryUI = "http://www.simantics.org/Annotation-1.0/AnnotationTypeLibraryUI";
88 @Deprecated public static final String AnnotationTypeUI = "http://www.simantics.org/Annotation-1.0/AnnotationTypeUI";
89 public static final String AnnotationType_systemAnnotation = "http://www.simantics.org/Annotation-1.0/AnnotationType/systemAnnotation";
90 public static final String AnnotationType_systemAnnotation_Inverse = "http://www.simantics.org/Annotation-1.0/AnnotationType/systemAnnotation/Inverse";
91 @Deprecated public static final String AnnotationUI = "http://www.simantics.org/Annotation-1.0/AnnotationUI";
92 public static final String Annotation_HasEntry = "http://www.simantics.org/Annotation-1.0/Annotation/HasEntry";
93 public static final String Annotation_HasEntry_Inverse = "http://www.simantics.org/Annotation-1.0/Annotation/HasEntry/Inverse";
94 @Deprecated public static final String BrowseNode = "http://www.simantics.org/Annotation-1.0/BrowseNode";
95 public static final String DefaultAnnotationSource = "http://www.simantics.org/Annotation-1.0/DefaultAnnotationSource";
96 public static final String Functions = "http://www.simantics.org/Annotation-1.0/Functions";
97 public static final String Functions_availableAnnotations = "http://www.simantics.org/Annotation-1.0/Functions/availableAnnotations";
98 public static final String Functions_availableSources = "http://www.simantics.org/Annotation-1.0/Functions/availableSources";
99 public static final String Functions_descriptionText = "http://www.simantics.org/Annotation-1.0/Functions/descriptionText";
100 public static final String Functions_domainChildren = "http://www.simantics.org/Annotation-1.0/Functions/domainChildren";
101 public static final String Functions_explorerInput = "http://www.simantics.org/Annotation-1.0/Functions/explorerInput";
102 public static final String Functions_explorerInput2 = "http://www.simantics.org/Annotation-1.0/Functions/explorerInput2";
103 public static final String Functions_newAnnotationModifier = "http://www.simantics.org/Annotation-1.0/Functions/newAnnotationModifier";
104 public static final String Functions_removeAnnotationModifier = "http://www.simantics.org/Annotation-1.0/Functions/removeAnnotationModifier";
105 public static final String Functions_saveAnnotationModifier = "http://www.simantics.org/Annotation-1.0/Functions/saveAnnotationModifier";
106 public static final String Functions_selectedAnnotation = "http://www.simantics.org/Annotation-1.0/Functions/selectedAnnotation";
107 public static final String Functions_selectedAnnotationModifier = "http://www.simantics.org/Annotation-1.0/Functions/selectedAnnotationModifier";
108 public static final String Functions_selectedSource = "http://www.simantics.org/Annotation-1.0/Functions/selectedSource";
109 public static final String Functions_selectedSourceModifier = "http://www.simantics.org/Annotation-1.0/Functions/selectedSourceModifier";
110 public static final String HasAnnotationPropertySubrelation = "http://www.simantics.org/Annotation-1.0/HasAnnotationPropertySubrelation";
111 @Deprecated public static final String HasAnnotationTypeRoot = "http://www.simantics.org/Annotation-1.0/HasAnnotationTypeRoot";
112 public static final String HasAnnotationTypeRoot_Inverse = "http://www.simantics.org/Annotation-1.0/HasAnnotationTypeRoot/Inverse";
113 public static final String HasAnnotationTypeSupertype = "http://www.simantics.org/Annotation-1.0/HasAnnotationTypeSupertype";
114 public static final String HasDefaultAnnotationName = "http://www.simantics.org/Annotation-1.0/HasDefaultAnnotationName";
115 public static final String HasDefaultAnnotationType = "http://www.simantics.org/Annotation-1.0/HasDefaultAnnotationType";
116 public static final String Images = "http://www.simantics.org/Annotation-1.0/Images";
117 public static final String Images_Annotation = "http://www.simantics.org/Annotation-1.0/Images/Annotation";
118 public static final String Images_AnnotationType = "http://www.simantics.org/Annotation-1.0/Images/AnnotationType";
119 public static final String Images_General = "http://www.simantics.org/Annotation-1.0/Images/General";
120 public static final String SelectionTab = "http://www.simantics.org/Annotation-1.0/SelectionTab";
121 public static final String SelectionTab2 = "http://www.simantics.org/Annotation-1.0/SelectionTab2";
122 public static final String SelectionTab2_Properties = "http://www.simantics.org/Annotation-1.0/SelectionTab2/Properties";
123 public static final String SelectionTabContribution = "http://www.simantics.org/Annotation-1.0/SelectionTabContribution";
124 public static final String SelectionTabContribution2 = "http://www.simantics.org/Annotation-1.0/SelectionTabContribution2";
125 public static final String SelectionTab_Add = "http://www.simantics.org/Annotation-1.0/SelectionTab/Add";
126 public static final String SelectionTab_BC = "http://www.simantics.org/Annotation-1.0/SelectionTab/BC";
127 public static final String SelectionTab_Combo1 = "http://www.simantics.org/Annotation-1.0/SelectionTab/Combo1";
128 public static final String SelectionTab_Combo2 = "http://www.simantics.org/Annotation-1.0/SelectionTab/Combo2";
129 public static final String SelectionTab_Description = "http://www.simantics.org/Annotation-1.0/SelectionTab/Description";
130 public static final String SelectionTab_Properties = "http://www.simantics.org/Annotation-1.0/SelectionTab/Properties";
131 public static final String SelectionTab_Remove = "http://www.simantics.org/Annotation-1.0/SelectionTab/Remove";
132 public static final String SelectionTab_Save = "http://www.simantics.org/Annotation-1.0/SelectionTab/Save";
135 public static Resource getResourceOrNull(ReadGraph graph, String uri) {
137 return graph.getResource(uri);
138 } catch(DatabaseException e) {
139 System.err.println(e.getMessage());
144 public AnnotationResource(ReadGraph graph) {
145 Actions = getResourceOrNull(graph, URIs.Actions);
146 Actions_AnnotationDropAction = getResourceOrNull(graph, URIs.Actions_AnnotationDropAction);
147 Actions_NewAnnotation = getResourceOrNull(graph, URIs.Actions_NewAnnotation);
148 Actions_NewAnnotationInstance = getResourceOrNull(graph, URIs.Actions_NewAnnotationInstance);
149 Actions_NewAnnotationType = getResourceOrNull(graph, URIs.Actions_NewAnnotationType);
150 Actions_NoActionCategory = getResourceOrNull(graph, URIs.Actions_NoActionCategory);
151 Annotation = getResourceOrNull(graph, URIs.Annotation);
152 AnnotationAC = getResourceOrNull(graph, URIs.AnnotationAC);
153 AnnotationBC = getResourceOrNull(graph, URIs.AnnotationBC);
154 AnnotationBC_AnnotationTypeLabelRule = getResourceOrNull(graph, URIs.AnnotationBC_AnnotationTypeLabelRule);
155 AnnotationBC_AnnotationTypeModifierRule = getResourceOrNull(graph, URIs.AnnotationBC_AnnotationTypeModifierRule);
156 AnnotationType = getResourceOrNull(graph, URIs.AnnotationType);
157 AnnotationTypeLibrary = getResourceOrNull(graph, URIs.AnnotationTypeLibrary);
158 AnnotationTypeLibraryUI = getResourceOrNull(graph, URIs.AnnotationTypeLibraryUI);
159 AnnotationTypeUI = getResourceOrNull(graph, URIs.AnnotationTypeUI);
160 AnnotationType_systemAnnotation = getResourceOrNull(graph, URIs.AnnotationType_systemAnnotation);
161 AnnotationType_systemAnnotation_Inverse = getResourceOrNull(graph, URIs.AnnotationType_systemAnnotation_Inverse);
162 AnnotationUI = getResourceOrNull(graph, URIs.AnnotationUI);
163 Annotation_HasEntry = getResourceOrNull(graph, URIs.Annotation_HasEntry);
164 Annotation_HasEntry_Inverse = getResourceOrNull(graph, URIs.Annotation_HasEntry_Inverse);
165 BrowseNode = getResourceOrNull(graph, URIs.BrowseNode);
166 DefaultAnnotationSource = getResourceOrNull(graph, URIs.DefaultAnnotationSource);
167 Functions = getResourceOrNull(graph, URIs.Functions);
168 Functions_availableAnnotations = getResourceOrNull(graph, URIs.Functions_availableAnnotations);
169 Functions_availableSources = getResourceOrNull(graph, URIs.Functions_availableSources);
170 Functions_descriptionText = getResourceOrNull(graph, URIs.Functions_descriptionText);
171 Functions_domainChildren = getResourceOrNull(graph, URIs.Functions_domainChildren);
172 Functions_explorerInput = getResourceOrNull(graph, URIs.Functions_explorerInput);
173 Functions_explorerInput2 = getResourceOrNull(graph, URIs.Functions_explorerInput2);
174 Functions_newAnnotationModifier = getResourceOrNull(graph, URIs.Functions_newAnnotationModifier);
175 Functions_removeAnnotationModifier = getResourceOrNull(graph, URIs.Functions_removeAnnotationModifier);
176 Functions_saveAnnotationModifier = getResourceOrNull(graph, URIs.Functions_saveAnnotationModifier);
177 Functions_selectedAnnotation = getResourceOrNull(graph, URIs.Functions_selectedAnnotation);
178 Functions_selectedAnnotationModifier = getResourceOrNull(graph, URIs.Functions_selectedAnnotationModifier);
179 Functions_selectedSource = getResourceOrNull(graph, URIs.Functions_selectedSource);
180 Functions_selectedSourceModifier = getResourceOrNull(graph, URIs.Functions_selectedSourceModifier);
181 HasAnnotationPropertySubrelation = getResourceOrNull(graph, URIs.HasAnnotationPropertySubrelation);
182 HasAnnotationTypeRoot = getResourceOrNull(graph, URIs.HasAnnotationTypeRoot);
183 HasAnnotationTypeRoot_Inverse = getResourceOrNull(graph, URIs.HasAnnotationTypeRoot_Inverse);
184 HasAnnotationTypeSupertype = getResourceOrNull(graph, URIs.HasAnnotationTypeSupertype);
185 HasDefaultAnnotationName = getResourceOrNull(graph, URIs.HasDefaultAnnotationName);
186 HasDefaultAnnotationType = getResourceOrNull(graph, URIs.HasDefaultAnnotationType);
187 Images = getResourceOrNull(graph, URIs.Images);
188 Images_Annotation = getResourceOrNull(graph, URIs.Images_Annotation);
189 Images_AnnotationType = getResourceOrNull(graph, URIs.Images_AnnotationType);
190 Images_General = getResourceOrNull(graph, URIs.Images_General);
191 SelectionTab = getResourceOrNull(graph, URIs.SelectionTab);
192 SelectionTab2 = getResourceOrNull(graph, URIs.SelectionTab2);
193 SelectionTab2_Properties = getResourceOrNull(graph, URIs.SelectionTab2_Properties);
194 SelectionTabContribution = getResourceOrNull(graph, URIs.SelectionTabContribution);
195 SelectionTabContribution2 = getResourceOrNull(graph, URIs.SelectionTabContribution2);
196 SelectionTab_Add = getResourceOrNull(graph, URIs.SelectionTab_Add);
197 SelectionTab_BC = getResourceOrNull(graph, URIs.SelectionTab_BC);
198 SelectionTab_Combo1 = getResourceOrNull(graph, URIs.SelectionTab_Combo1);
199 SelectionTab_Combo2 = getResourceOrNull(graph, URIs.SelectionTab_Combo2);
200 SelectionTab_Description = getResourceOrNull(graph, URIs.SelectionTab_Description);
201 SelectionTab_Properties = getResourceOrNull(graph, URIs.SelectionTab_Properties);
202 SelectionTab_Remove = getResourceOrNull(graph, URIs.SelectionTab_Remove);
203 SelectionTab_Save = getResourceOrNull(graph, URIs.SelectionTab_Save);
206 public static AnnotationResource getInstance(ReadGraph graph) {
207 Session session = graph.getSession();
208 AnnotationResource ret = session.peekService(AnnotationResource.class);
210 QueryControl qc = graph.getService(QueryControl.class);
211 ret = new AnnotationResource(qc.getIndependentGraph(graph));
212 session.registerService(AnnotationResource.class, ret);
217 public static AnnotationResource getInstance(RequestProcessor session) throws DatabaseException {
218 AnnotationResource ret = session.peekService(AnnotationResource.class);
220 ret = session.syncRequest(new Read<AnnotationResource>() {
221 public AnnotationResource perform(ReadGraph graph) throws DatabaseException {
222 QueryControl qc = graph.getService(QueryControl.class);
223 return new AnnotationResource(qc.getIndependentGraph(graph));
226 session.registerService(AnnotationResource.class, ret);