1use crate::model::annotations::AnnotationBuilder;
6use crate::model::modules::Module;
7use crate::model::HasBody;
8use crate::stdlib::{rdf, rdfs, xsd};
9use url::Url;
10
11pub const MODULE_NAME: &str = "owl";
20pub const MODULE_URL: &str = "http://www.w3.org/2002/07/owl#";
21
22pub const ALL_DIFFERENT: &str = "AllDifferent";
23pub const ALL_DISJOINT_CLASSES: &str = "AllDisjointClasses";
24pub const ALL_DISJOINT_PROPERTIES: &str = "AllDisjointProperties";
25pub const ANNOTATION: &str = "Annotation";
26pub const ANNOTATION_PROPERTY: &str = "AnnotationProperty";
27pub const ASYMMETRIC_PROPERTY: &str = "AsymmetricProperty";
28pub const AXIOM: &str = "Axiom";
29pub const CLASS: &str = "Class";
30pub const DATA_RANGE: &str = "DataRange";
31pub const DATATYPE_PROPERTY: &str = "DatatypeProperty";
32pub const DEPRECATED_CLASS: &str = "DeprecatedClass";
33pub const DEPRECATED_PROPERTY: &str = "DeprecatedProperty";
34pub const FUNCTIONAL_PROPERTY: &str = "FunctionalProperty";
35pub const INVERSE_FUNCTIONAL_PROPERTY: &str = "InverseFunctionalProperty";
36pub const IRREFLEXIVE_PROPERTY: &str = "IrreflexiveProperty";
37pub const NAMED_INDIVIDUAL: &str = "NamedIndividual";
38pub const NEGATIVE_PROPERTY_ASSERTION: &str = "NegativePropertyAssertion";
39pub const NOTHING: &str = "Nothing";
40pub const OBJECT_PROPERTY: &str = "ObjectProperty";
41pub const ONTOLOGY: &str = "Ontology";
42pub const ONTOLOGY_PROPERTY: &str = "OntologyProperty";
43pub const REFLEXIVE_PROPERTY: &str = "ReflexiveProperty";
44pub const RESTRICTION: &str = "Restriction";
45pub const SYMMETRIC_PROPERTY: &str = "SymmetricProperty";
46pub const TRANSITIVE_PROPERTY: &str = "TransitiveProperty";
47pub const THING: &str = "Thing";
48
49pub const ALL_VALUES_FROM: &str = "allValuesFrom";
50pub const ANNOTATED_PROPERTY: &str = "annotatedProperty";
51pub const ANNOTATED_SOURCE: &str = "annotatedSource";
52pub const ANNOTATED_TARGET: &str = "annotatedTarget";
53pub const ASSERTION_PROPERTY: &str = "assertionProperty";
54pub const BACKWARD_COMPATIBLE_WITH: &str = "backwardCompatibleWith";
55pub const BOTTOM_DATA_PROPERTY: &str = "bottomDataProperty";
56pub const BOTTOM_OBJECT_PROPERTY: &str = "bottomObjectProperty";
57pub const CARDINALITY: &str = "cardinality";
58pub const COMPLEMENT_OF: &str = "complementOf";
59pub const DATATYPE_COMPLEMENT_OF: &str = "datatypeComplementOf";
60pub const DEPRECATED: &str = "deprecated";
61pub const DIFFERENT_FROM: &str = "differentFrom";
62pub const DISJOINT_UNION_OF: &str = "disjointUnionOf";
63pub const DISJOINT_WITH: &str = "disjointWith";
64pub const DISTINCT_MEMBERS: &str = "distinctMembers";
65pub const EQUIVALENT_CLASS: &str = "equivalentClass";
66pub const EQUIVALENT_PROPERTY: &str = "equivalentProperty";
67pub const HAS_KEY: &str = "hasKey";
68pub const HAS_SELF: &str = "hasSelf";
69pub const HAS_VALUE: &str = "hasValue";
70pub const IMPORTS: &str = "imports";
71pub const INCOMPATIBLE_WITH: &str = "incompatibleWith";
72pub const INTERSECTION_OF: &str = "intersectionOf";
73pub const INVERSE_OF: &str = "inverseOf";
74pub const MAX_CARDINALITY: &str = "maxCardinality";
75pub const MAX_QUALIFIED_CARDINALITY: &str = "maxQualifiedCardinality";
76pub const MEMBERS: &str = "members";
77pub const MIN_CARDINALITY: &str = "minCardinality";
78pub const MIN_QUALIFIED_CARDINALITY: &str = "minQualifiedCardinality";
79pub const ON_CLASS: &str = "onClass";
80pub const PROP_ON_DATA_RANGE_NAME: &str = "onDataRange";
81pub const ON_DATATYPE: &str = "onDatatype";
82pub const ONE_OF: &str = "oneOf";
83pub const ON_PROPERTIES: &str = "onProperties";
84pub const ON_PROPERTY: &str = "onProperty";
85pub const PRIOR_VERSION: &str = "priorVersion";
86pub const PROPERTY_CHAIN_AXIOM: &str = "propertyChainAxiom";
87pub const PROPERTY_DISJOINT_WITH: &str = "propertyDisjointWith";
88pub const QUALIFIED_CARDINALITY: &str = "qualifiedCardinality";
89pub const SAME_AS: &str = "sameAs";
90pub const SOME_VALUES_FROM: &str = "someValuesFrom";
91pub const SOURCE_INDIVIDUAL: &str = "sourceIndividual";
92pub const TARGET_INDIVIDUAL: &str = "targetIndividual";
93pub const TARGET_VALUE: &str = "targetValue";
94pub const TOP_DATA_PROPERTY: &str = "topDataProperty";
95pub const TOP_OBJECT_PROPERTY: &str = "topObjectProperty";
96pub const UNION_OF: &str = "unionOf";
97pub const VERSION_INFO: &str = "versionInfo";
98pub const VERSION_IRI: &str = "versionIRI";
99pub const WITH_RESTRICTIONS: &str = "withRestrictions";
100
101pub fn module() -> Module {
106 #[allow(non_snake_case)]
107 let MODULE_IRI: url::Url = url::Url::parse(MODULE_URL).unwrap();
108 let mut module = Module::empty(id!(MODULE_NAME)).with_base_uri(Url::parse(MODULE_URL).unwrap());
109
110 module.body_mut().add_to_imports(import!(
111 id!(rdf::MODULE_NAME),
112 id!(rdfs::MODULE_NAME),
113 id!(xsd::MODULE_NAME)
114 ));
115
116 module.body_mut().extend_definitions(vec![
117 rdf!(class ALL_DIFFERENT, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
119 .with_comment("The class of collections of pairwise different individuals.")
120 .into(),
121 rdf!(class ALL_DISJOINT_CLASSES, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
122 .with_comment("The class of collections of pairwise disjoint classes.")
123 .into(),
124 rdf!(class ALL_DISJOINT_PROPERTIES, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
125 .with_comment("The class of collections of pairwise disjoint properties.")
126 .into(),
127 rdf!(class ANNOTATION, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
128 .with_comment("The class of annotated annotations for which the RDF serialization consists of an annotated subject, predicate and object.")
129 .into(),
130 rdf!(class ANNOTATION_PROPERTY, MODULE_IRI; (rdf::MODULE_NAME, rdf::PROPERTY))
131 .with_comment("The class of annotation properties.")
132 .into(),
133 rdf!(class ASYMMETRIC_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
134 .with_comment("The class of asymmetric properties.")
135 .into(),
136 rdf!(class AXIOM, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
137 .with_comment("The class of annotated axioms for which the RDF serialization consists of an annotated subject, predicate and object.")
138 .into(),
139 rdf!(class CLASS, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::CLASS))
140 .with_comment("The class of OWL classes.")
141 .into(),
142 rdf!(class DATA_RANGE, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::DATATYPE))
143 .with_comment("The class of OWL data ranges, which are special kinds of datatypes. Note: The use of the IRI owl:DataRange has been deprecated as of OWL 2. The IRI rdfs:Datatype SHOULD be used instead.")
144 .into(),
145 rdf!(class DATATYPE_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
146 .with_comment("The class of data properties.")
147 .into(),
148 rdf!(class DEPRECATED_CLASS, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::CLASS))
149 .with_comment("The class of deprecated classes.")
150 .into(),
151 rdf!(class DEPRECATED_PROPERTY, MODULE_IRI; (rdf::MODULE_NAME, rdf::PROPERTY))
152 .with_comment("The class of deprecated properties.")
153 .into(),
154 rdf!(class FUNCTIONAL_PROPERTY, MODULE_IRI; (rdf::MODULE_NAME, rdf::PROPERTY))
155 .with_comment("The class of functional properties.")
156 .into(),
157 rdf!(class INVERSE_FUNCTIONAL_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
158 .with_comment("The class of inverse-functional properties.")
159 .into(),
160 rdf!(class IRREFLEXIVE_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
161 .with_comment("The class of irreflexive properties.")
162 .into(),
163 rdf!(class NAMED_INDIVIDUAL, MODULE_IRI; THING)
164 .with_comment("The class of named individuals.")
165 .into(),
166 rdf!(class NEGATIVE_PROPERTY_ASSERTION, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::RESOURCE))
167 .with_comment("The class of negative property assertions.")
168 .into(),
169 rdf!(class NOTHING, MODULE_IRI; THING)
170 .with_comment("This is the empty class.")
171 .into(),
172 rdf!(class OBJECT_PROPERTY, MODULE_IRI; (rdf::MODULE_NAME, rdf::PROPERTY))
173 .with_comment("The class of object properties.")
174 .into(),
175 rdf!(class ONTOLOGY, MODULE_IRI; (rdfs::MODULE_NAME, rdfs::CLASS))
176 .with_comment("The class of ontologies.")
177 .into(),
178 rdf!(class ONTOLOGY_PROPERTY, MODULE_IRI; (rdf::MODULE_NAME, rdf::PROPERTY))
179 .with_comment("The class of ontology properties.")
180 .into(),
181 rdf!(class REFLEXIVE_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
182 .with_comment("The class of reflexive properties.")
183 .into(),
184 rdf!(class SYMMETRIC_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
185 .with_comment("The class of symmetric properties.")
186 .into(),
187 rdf!(class TRANSITIVE_PROPERTY, MODULE_IRI; OBJECT_PROPERTY)
188 .with_comment("The class of transitive properties.")
189 .into(),
190 rdf!(class THING, MODULE_IRI; CLASS)
191 .with_comment("The class of OWL individuals.")
192 .into(),
193
194 rdf!(property ALL_VALUES_FROM, MODULE_IRI;
196 RESTRICTION => (rdfs::MODULE_NAME, rdfs::RESOURCE))
197 .with_comment("The property that determines the class that a universal property restriction refers to.")
198 .into(),
199 rdf!(property ANNOTATED_PROPERTY, MODULE_IRI;
200 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
201 (rdfs::MODULE_NAME, rdfs::RESOURCE))
202 .with_comment("The property that determines the predicate of an annotated axiom or annotated annotation.")
203 .into(),
204 rdf!(property ANNOTATED_SOURCE, MODULE_IRI;
205 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
206 (rdfs::MODULE_NAME, rdfs::RESOURCE))
207 .with_comment("The property that determines the subject of an annotated axiom or annotated annotation.")
208 .into(),
209 rdf!(property ANNOTATED_TARGET, MODULE_IRI;
210 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
211 (rdfs::MODULE_NAME, rdfs::RESOURCE))
212 .with_comment("The property that determines the object of an annotated axiom or annotated annotation.")
213 .into(),
214 rdf!(property ASSERTION_PROPERTY, MODULE_IRI;
215 NEGATIVE_PROPERTY_ASSERTION => (rdf::MODULE_NAME, rdf::PROPERTY))
216 .with_comment("The property that determines the predicate of a negative property assertion.")
217 .into(),
218 rdf!(property BACKWARD_COMPATIBLE_WITH, MODULE_IRI;
219 ONTOLOGY => ONTOLOGY)
220 .with_comment("The annotation property that indicates that a given ontology is backward compatible with another ontology.")
221 .into(),
222 rdf!(property BOTTOM_DATA_PROPERTY, MODULE_IRI;
223 THING => (rdfs::MODULE_NAME, rdfs::LITERAL))
224 .with_comment("The data property that does not relate any individual to any data value.")
225 .into(),
226 rdf!(property CARDINALITY, MODULE_IRI;
227 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
228 .with_comment("The property that determines the cardinality of an exact cardinality restriction.")
229 .into(),
230 rdf!(property COMPLEMENT_OF, MODULE_IRI;
231 CLASS => CLASS)
232 .with_comment("The property that determines that a given class is the complement of another class.")
233 .into(),
234 rdf!(property DATATYPE_COMPLEMENT_OF, MODULE_IRI;
235 (rdfs::MODULE_NAME, rdfs::DATATYPE) =>
236 (rdfs::MODULE_NAME, rdfs::DATATYPE))
237 .with_comment("The property that determines that a given data range is the complement of another data range with respect to the data domain.")
238 .into(),
239 rdf!(property DEPRECATED, MODULE_IRI;
240 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
241 (rdfs::MODULE_NAME, rdfs::RESOURCE))
242 .with_comment("The annotation property that indicates that a given entity has been deprecated.")
243 .into(),
244 rdf!(property DIFFERENT_FROM, MODULE_IRI; THING => THING)
245 .with_comment("The property that determines that two given individuals are different.")
246 .into(),
247 rdf!(property DISJOINT_UNION_OF, MODULE_IRI;
248 CLASS => (rdfs::MODULE_NAME, rdf::LIST))
249 .with_comment("The property that determines that a given class is equivalent to the disjoint union of a collection of other classes.")
250 .into(),
251 rdf!(property DISJOINT_WITH, MODULE_IRI;
252 CLASS => CLASS)
253 .with_comment("The property that determines that two given classes are disjoint.")
254 .into(),
255 rdf!(property DISTINCT_MEMBERS, MODULE_IRI;
256 ALL_DIFFERENT => (rdf::MODULE_NAME, rdf::LIST))
257 .with_comment("The property that determines the collection of pairwise different individuals in a owl:AllDifferent axiom.")
258 .into(),
259 rdf!(property EQUIVALENT_CLASS, MODULE_IRI;
260 CLASS => CLASS)
261 .with_comment("The property that determines that two given classes are equivalent, and that is used to specify datatype definitions.")
262 .into(),
263 rdf!(property EQUIVALENT_PROPERTY, MODULE_IRI;
264 CLASS => CLASS)
265 .with_comment("The property that determines that two given properties are equivalent.")
266 .into(),
267 rdf!(property HAS_KEY, MODULE_IRI;
268 CLASS => (rdf::MODULE_NAME, rdf::LIST))
269 .with_comment("The property that determines the collection of properties that jointly build a key.")
270 .into(),
271 rdf!(property HAS_SELF, MODULE_IRI;
272 RESTRICTION => (rdfs::MODULE_NAME, rdfs::RESOURCE))
273 .with_comment("The property that determines the property that a self restriction refers to.")
274 .into(),
275 rdf!(property HAS_VALUE, MODULE_IRI;
276 RESTRICTION => (rdfs::MODULE_NAME, rdfs::RESOURCE))
277 .with_comment("The property that determines the property that a has-value restriction refers to.")
278 .into(),
279 rdf!(property IMPORTS, MODULE_IRI;
280 ONTOLOGY => ONTOLOGY)
281 .with_comment("The property that is used for importing other ontologies into a given ontology.")
282 .into(),
283 rdf!(property INCOMPATIBLE_WITH, MODULE_IRI; ONTOLOGY => ONTOLOGY)
284 .with_comment("The annotation property that indicates that a given ontology is incompatible with another ontology.")
285 .into(),
286 rdf!(property INTERSECTION_OF, MODULE_IRI;
287 CLASS => (rdf::MODULE_NAME, rdf::LIST))
288 .with_comment("The property that determines the collection of classes or data ranges that build an intersection.")
289 .into(),
290 rdf!(property INVERSE_OF, MODULE_IRI; OBJECT_PROPERTY => OBJECT_PROPERTY)
291 .with_comment("The property that determines that two given properties are inverse.")
292 .into(),
293 rdf!(property MAX_CARDINALITY, MODULE_IRI;
294 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
295 .with_comment("The property that determines the cardinality of a maximum cardinality restriction.")
296 .into(),
297 rdf!(property MAX_QUALIFIED_CARDINALITY, MODULE_IRI;
298 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
299 .with_comment("The property that determines the cardinality of a maximum qualified cardinality restriction.")
300 .into(),
301 rdf!(property MEMBERS, MODULE_IRI;
302 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
303 (rdf::MODULE_NAME, rdf::LIST))
304 .with_comment("The property that determines the collection of members in either a owl:AllDifferent, owl:AllDisjointClasses or owl:AllDisjointProperties axiom.")
305 .into(),
306 rdf!(property MIN_CARDINALITY, MODULE_IRI;
307 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
308 .with_comment("The property that determines the cardinality of a minimum cardinality restriction.")
309 .into(),
310 rdf!(property MIN_QUALIFIED_CARDINALITY, MODULE_IRI;
311 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
312 .with_comment("The property that determines the cardinality of a minimum qualified cardinality restriction.")
313 .into(),
314 rdf!(property ON_CLASS, MODULE_IRI;
315 RESTRICTION => CLASS)
316 .with_comment("The property that determines the class that a qualified object cardinality restriction refers to.")
317 .into(),
318 rdf!(property PROP_ON_DATA_RANGE_NAME, MODULE_IRI;
319 RESTRICTION => (rdfs::MODULE_NAME, rdfs::DATATYPE))
320 .with_comment("The property that determines the data range that a qualified data cardinality restriction refers to.")
321 .into(),
322 rdf!(property ON_DATATYPE, MODULE_IRI;
323 (rdfs::MODULE_NAME, rdfs::DATATYPE) =>
324 (rdfs::MODULE_NAME, rdfs::DATATYPE))
325 .with_comment("The property that determines the datatype that a datatype restriction refers to.")
326 .into(),
327 rdf!(property ONE_OF, MODULE_IRI;
328 (rdfs::MODULE_NAME, rdfs::CLASS) =>
329 (rdf::MODULE_NAME, rdf::LIST))
330 .with_comment("The property that determines the collection of individuals or data values that build an enumeration.")
331 .into(),
332 rdf!(property ON_PROPERTIES, MODULE_IRI;
333 RESTRICTION => (rdf::MODULE_NAME, rdf::LIST))
334 .with_comment("The property that determines the n-tuple of properties that a property restriction on an n-ary data range refers to.")
335 .into(),
336 rdf!(property ON_PROPERTY, MODULE_IRI;
337 RESTRICTION => (rdf::MODULE_NAME, rdf::PROPERTY))
338 .with_comment("The property that determines the property that a property restriction refers to.")
339 .into(),
340 rdf!(property PRIOR_VERSION, MODULE_IRI;
341 ONTOLOGY => ONTOLOGY)
342 .with_comment("The annotation property that indicates the predecessor ontology of a given ontology.")
343 .into(),
344 rdf!(property PROPERTY_CHAIN_AXIOM, MODULE_IRI;
345 OBJECT_PROPERTY => (rdf::MODULE_NAME, rdf::LIST))
346 .with_comment("The property that determines the n-tuple of properties that build a sub property chain of a given property.")
347 .into(),
348 rdf!(property PROPERTY_DISJOINT_WITH, MODULE_IRI;
349 (rdf::MODULE_NAME, rdf::PROPERTY) =>
350 (rdf::MODULE_NAME, rdf::PROPERTY))
351 .with_comment("The property that determines that two given properties are disjoint.")
352 .into(),
353 rdf!(property QUALIFIED_CARDINALITY, MODULE_IRI;
354 RESTRICTION => (xsd::MODULE_NAME, xsd::NONNEGATIVE_INTEGER))
355 .with_comment("The property that determines the cardinality of an exact qualified cardinality restriction.")
356 .into(),
357 rdf!(property SAME_AS, MODULE_IRI;
358 THING => THING)
359 .with_comment("The property that determines that two given individuals are equal.")
360 .into(),
361 rdf!(property SOME_VALUES_FROM, MODULE_IRI;
362 RESTRICTION => (rdfs::MODULE_NAME, rdfs::CLASS))
363 .with_comment("The property that determines the class that an existential property restriction refers to.")
364 .into(),
365 rdf!(property SOURCE_INDIVIDUAL, MODULE_IRI;
366 NEGATIVE_PROPERTY_ASSERTION => THING)
367 .with_comment("The property that determines the subject of a negative property assertion.")
368 .into(),
369 rdf!(property TARGET_INDIVIDUAL, MODULE_IRI;
370 NEGATIVE_PROPERTY_ASSERTION => THING)
371 .with_comment("The property that determines the object of a negative property assertion.")
372 .into(),
373 rdf!(property TARGET_VALUE, MODULE_IRI;
374 NEGATIVE_PROPERTY_ASSERTION => (rdfs::MODULE_NAME, rdfs::LITERAL))
375 .with_comment("The property that determines the value of a negative data property assertion.")
376 .into(),
377 rdf!(property TOP_DATA_PROPERTY, MODULE_IRI;
378 THING => (rdfs::MODULE_NAME, rdfs::LITERAL))
379 .with_comment("The data property that relates every individual to every data value.")
380 .into(),
381 rdf!(property TOP_OBJECT_PROPERTY, MODULE_IRI;
382 THING => THING)
383 .with_comment("The object property that relates every two individuals.")
384 .into(),
385 rdf!(property UNION_OF, MODULE_IRI;
386 (rdfs::MODULE_NAME, rdfs::CLASS) =>
387 (rdf::MODULE_NAME, rdf::LIST))
388 .with_comment("The property that determines the collection of classes or data ranges that build a union.")
389 .into(),
390 rdf!(property VERSION_INFO, MODULE_IRI;
391 (rdfs::MODULE_NAME, rdfs::RESOURCE) =>
392 (rdfs::MODULE_NAME, rdfs::RESOURCE))
393 .with_comment("The annotation property that provides version information for an ontology or another OWL construct.")
394 .into(),
395 rdf!(property VERSION_IRI, MODULE_IRI;
396 ONTOLOGY => ONTOLOGY)
397 .with_comment("The object property that identifies the version IRI of an ontology.")
398 .into(),
399 rdf!(property WITH_RESTRICTIONS, MODULE_IRI;
400 (rdfs::MODULE_NAME, rdfs::DATATYPE) =>
401 (rdf::MODULE_NAME, rdf::LIST))
402 .with_comment("The property that determines the collection of facet-value pairs that define a datatype restriction.")
403 .into(),
404 ]).unwrap();
405
406 module
407}