1
2
3
4
5
6 package org.dbe.studio.tools.ontologyviewer.metamodels.odm;
7
8 import java.util.Hashtable;
9 import java.util.Vector;
10
11 /***
12 * Properties let us assert general facts about the members of classes and
13 * specific facts about individuals. From a mathematical point of view a
14 * property is a binary relation. Two types of properties are distinguished:
15 * - Object properties link individuals to individuals. They are relations
16 * between instances of two classes
17 * - Datatype properties link individuals to data values. They are relations
18 * between instances of classes and RDF literals and XML Schema datatypes
19 *
20 * ObjectProperty concept corresponds to the relationship (among entities)
21 * in the Databases field while Datatype properties correspond to entity's
22 * attributes.
23 */
24 public abstract class OdmProperty {
25
26 String name;
27 String id;
28 Vector annotationProps;
29
30
31
32
33
34
35
36
37
38
39
40
41 Vector domain;
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 Vector range;
57
58
59
60
61
62
63
64
65
66
67
68
69 Vector subPropertyOf;
70 Hashtable superPropertyOf;
71
72
73
74
75
76
77
78
79
80 Vector equivalentProperties;
81
82
83
84
85
86
87
88
89 boolean isFunctional;
90
91
92
93
94 OdmOntology ontology;
95
96 public OdmProperty() {
97
98 }
99
100 public OdmProperty(OdmOntology ontology, String name, String id) {
101
102
103 this.ontology = ontology;
104
105
106 this.name = name;
107 this.id = id;
108
109 if (this instanceof OdmObjectProperty) {
110 this.ontology.addObjectProperty((OdmObjectProperty)this);
111 }
112 }
113
114 public void addDomain(OdmOntologyClass oc) {
115 if (domain == null) {
116 domain = new Vector();
117 }
118 domain.add(oc);
119 }
120
121 public void removeDomain(OdmOntologyClass oc) {
122 if (domain != null) {
123 domain.remove(oc);
124 }
125 }
126
127 public void addSubproperty(OdmProperty p) {
128 if (subPropertyOf == null) {
129 subPropertyOf = new Vector();
130 }
131
132
133 if (this.getClass() == p.getClass()) {
134 subPropertyOf.add(p);
135 }
136 }
137
138 public void removeSubproperty(OdmProperty p) {
139 if (subPropertyOf != null) {
140 subPropertyOf.remove(p);
141 }
142 }
143
144 public void addSuperProperty(OdmProperty p) {
145 if (superPropertyOf == null) {
146 superPropertyOf = new Hashtable();
147 }
148 superPropertyOf.put(p.getId(), p);
149 }
150
151 public void removeSuperProperty(OdmProperty p) {
152 if (superPropertyOf != null) {
153 superPropertyOf.remove(p.getId());
154 }
155 }
156
157 public void addEquivalentProperty(OdmProperty p) {
158 if (equivalentProperties == null) {
159 equivalentProperties = new Vector();
160 }
161 if (this.getClass() == p.getClass()) {
162 equivalentProperties.add(p);
163 }
164 }
165
166 public void removeEquivalentProperty(OdmProperty p) {
167 if (equivalentProperties != null) {
168 equivalentProperties.remove(p);
169 }
170 }
171
172 public void addAnnotationProp(OdmAnnotationProperty ap) {
173 if ( annotationProps == null ) {
174 annotationProps = new Vector();
175 }
176 annotationProps.add(ap);
177
178 }
179
180 public void removeAnnotationProp(OdmAnnotationProperty ap) {
181 if (annotationProps != null) {
182 annotationProps.remove(ap);
183 }
184 }
185
186 public void setName(String name) {
187 this.name = name;
188 }
189
190 public void setId(String id) {
191 this.id = id;
192 }
193
194 public void setOntology(OdmOntology ont) {
195 ontology = ont;
196 }
197
198 public void setAnnotationProps(Vector a) {
199 annotationProps = a;
200 }
201
202 public void setIsFunctional( boolean iF) {
203 isFunctional = iF;
204 }
205
206 public String getName() {
207 return name;
208 }
209
210 public String getId() {
211 return id;
212 }
213
214 public OdmOntology getOntology() {
215 return ontology;
216 }
217
218 public Vector getAnnotationProps() {
219 return annotationProps;
220 }
221
222 public boolean getIsFunctional() {
223 return isFunctional;
224 }
225
226 public Vector getDomain() {
227 return domain;
228 }
229
230 public Vector getRange() {
231 return range;
232 }
233
234 public Vector getSubPropertyOf() {
235 return subPropertyOf;
236 }
237
238 public Hashtable getSuperPropertyOf() {
239 return superPropertyOf;
240 }
241
242 public Vector getEquivalentProperties() {
243 return equivalentProperties;
244 }
245 }