AxiomaticTriples.py

  1# -*- coding: utf-8 -*-
  2#
  3"""
  4Axiomatic triples to be (possibly) added to the final graph.
  5
  6**Requires**: `RDFLib`_, 4.0.0 and higher.
  7
  8.. _RDFLib: https://github.com/RDFLib/rdflib
  9
 10**License**: This software is available for use under the `W3C Software License`_.
 11
 12.. _W3C Software License: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
 13
 14**Organization**: `World Wide Web Consortium`_
 15
 16.. _World Wide Web Consortium: http://www.w3.org
 17
 18**Author**: `Ivan Herman`_
 19
 20.. _Ivan Herman: http://www.w3.org/People/Ivan/
 21
 22"""
 23
 24__author__ = "Ivan Herman"
 25__contact__ = "Ivan Herman, ivan@w3.org"
 26__license__ = "W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231"
 27
 28from owlrl.RDFS import Seq, Bag, Alt, Statement, Property, XMLLiteral, List
 29from owlrl.RDFS import RDFNS as ns_rdf
 30from owlrl.RDFS import (
 31    rdf_subject,
 32    rdf_predicate,
 33    rdf_object,
 34    rdf_type,
 35    value,
 36    first,
 37    rest,
 38    nil,
 39)
 40from owlrl.RDFS import (
 41    Resource,
 42    Class,
 43    subClassOf,
 44    subPropertyOf,
 45    comment,
 46    label,
 47    rdfs_domain,
 48    rdfs_range,
 49)
 50from owlrl.RDFS import (
 51    seeAlso,
 52    isDefinedBy,
 53    Literal,
 54    Container,
 55    ContainerMembershipProperty,
 56    member,
 57    Datatype,
 58)
 59
 60from rdflib.namespace import XSD as ns_xsd
 61from .OWL import *
 62
 63# Simple RDF axiomatic triples (typing of subject, predicate, first, rest, etc)
 64_Simple_RDF_axiomatic_triples = [
 65    (rdf_type, rdf_type, Property),
 66    (rdf_subject, rdf_type, Property),
 67    (rdf_predicate, rdf_type, Property),
 68    (rdf_object, rdf_type, Property),
 69    (first, rdf_type, Property),
 70    (rest, rdf_type, Property),
 71    (value, rdf_type, Property),
 72    (nil, rdf_type, List),
 73]
 74
 75# RDFS axiomatic triples (domain and range, as well as class setting for a number of RDFS symbols)
 76_RDFS_axiomatic_triples = [
 77    (rdf_type, rdfs_domain, Resource),
 78    (rdfs_domain, rdfs_domain, Property),
 79    (rdfs_range, rdfs_domain, Property),
 80    (subPropertyOf, rdfs_domain, Property),
 81    (subClassOf, rdfs_domain, Class),
 82    (rdf_subject, rdfs_domain, Statement),
 83    (rdf_predicate, rdfs_domain, Statement),
 84    (rdf_object, rdfs_domain, Statement),
 85    (member, rdfs_domain, Resource),
 86    (first, rdfs_domain, List),
 87    (rest, rdfs_domain, List),
 88    (seeAlso, rdfs_domain, Resource),
 89    (isDefinedBy, rdfs_domain, Resource),
 90    (comment, rdfs_domain, Resource),
 91    (label, rdfs_domain, Resource),
 92    (value, rdfs_domain, Resource),
 93    (Property, rdf_type, Class),
 94    (rdf_type, rdfs_range, Class),
 95    (rdfs_domain, rdfs_range, Class),
 96    (rdfs_range, rdfs_range, Class),
 97    (subPropertyOf, rdfs_range, Property),
 98    (subClassOf, rdfs_range, Class),
 99    (rdf_subject, rdfs_range, Resource),
100    (rdf_predicate, rdfs_range, Resource),
101    (rdf_object, rdfs_range, Resource),
102    (member, rdfs_range, Resource),
103    (first, rdfs_range, Resource),
104    (rest, rdfs_range, List),
105    (seeAlso, rdfs_range, Resource),
106    (isDefinedBy, rdfs_range, Resource),
107    (comment, rdfs_range, Literal),
108    (label, rdfs_range, Literal),
109    (value, rdfs_range, Resource),
110    (Alt, subClassOf, Container),
111    (Bag, subClassOf, Container),
112    (Seq, subClassOf, Container),
113    (ContainerMembershipProperty, subClassOf, Property),
114    (isDefinedBy, subPropertyOf, seeAlso),
115    (XMLLiteral, rdf_type, Datatype),
116    (XMLLiteral, subClassOf, Literal),
117    (Datatype, subClassOf, Class),
118    # rdfs valid triples; these would be inferred by the RDFS expansion, but it may make things
119    # a bit faster to add these upfront
120    (Resource, rdf_type, Class),
121    (Class, rdf_type, Class),
122    (Literal, rdf_type, Class),
123    (XMLLiteral, rdf_type, Class),
124    (Datatype, rdf_type, Class),
125    (Seq, rdf_type, Class),
126    (Bag, rdf_type, Class),
127    (Alt, rdf_type, Class),
128    (Container, rdf_type, Class),
129    (List, rdf_type, Class),
130    (ContainerMembershipProperty, rdf_type, Class),
131    (Property, rdf_type, Class),
132    (Statement, rdf_type, Class),
133    (rdfs_domain, rdf_type, Property),
134    (rdfs_range, rdf_type, Property),
135    (subPropertyOf, rdf_type, Property),
136    (subClassOf, rdf_type, Property),
137    (member, rdf_type, Property),
138    (seeAlso, rdf_type, Property),
139    (isDefinedBy, rdf_type, Property),
140    (comment, rdf_type, Property),
141    (label, rdf_type, Property),
142]
143
144# RDFS Axiomatic Triples all together
145RDFS_Axiomatic_Triples = _Simple_RDF_axiomatic_triples + _RDFS_axiomatic_triples
146
147# RDFS D-entailement triples, ie, possible subclassing of various datatypes
148RDFS_D_Axiomatic_Triples_subclasses = [
149    # See http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#built-in-datatypes
150    (ns_xsd["decimal"], subClassOf, Literal),
151    (ns_xsd["integer"], subClassOf, ns_xsd["decimal"]),
152    (ns_xsd["long"], subClassOf, ns_xsd["integer"]),
153    (ns_xsd["int"], subClassOf, ns_xsd["long"]),
154    (ns_xsd["short"], subClassOf, ns_xsd["int"]),
155    (ns_xsd["byte"], subClassOf, ns_xsd["short"]),
156    (ns_xsd["nonNegativeInteger"], subClassOf, ns_xsd["integer"]),
157    (ns_xsd["positiveInteger"], subClassOf, ns_xsd["nonNegativeInteger"]),
158    (ns_xsd["unsignedLong"], subClassOf, ns_xsd["nonNegativeInteger"]),
159    (ns_xsd["unsignedInt"], subClassOf, ns_xsd["unsignedLong"]),
160    (ns_xsd["unsignedShort"], subClassOf, ns_xsd["unsignedInt"]),
161    (ns_xsd["unsignedByte"], subClassOf, ns_xsd["unsignedShort"]),
162    (ns_xsd["nonPositiveInteger"], subClassOf, ns_xsd["integer"]),
163    (ns_xsd["negativeInteger"], subClassOf, ns_xsd["nonPositiveInteger"]),
164    (ns_xsd["normalizedString"], subClassOf, ns_xsd["string"]),
165    (ns_xsd["token"], subClassOf, ns_xsd["normalizedString"]),
166    (ns_xsd["language"], subClassOf, ns_xsd["token"]),
167    (ns_xsd["Name"], subClassOf, ns_xsd["token"]),
168    (ns_xsd["NMTOKEN"], subClassOf, ns_xsd["token"]),
169    (ns_xsd["NCName"], subClassOf, ns_xsd["Name"]),
170    (ns_xsd["dateTimeStamp"], subClassOf, ns_xsd["dateTime"]),
171]
172
173#
174RDFS_D_Axiomatic_Triples_types = [
175    (ns_xsd["integer"], rdf_type, Datatype),
176    (ns_xsd["decimal"], rdf_type, Datatype),
177    (ns_xsd["nonPositiveInteger"], rdf_type, Datatype),
178    (ns_xsd["nonPositiveInteger"], rdf_type, Datatype),
179    (ns_xsd["positiveInteger"], rdf_type, Datatype),
180    (ns_xsd["positiveInteger"], rdf_type, Datatype),
181    (ns_xsd["long"], rdf_type, Datatype),
182    (ns_xsd["int"], rdf_type, Datatype),
183    (ns_xsd["short"], rdf_type, Datatype),
184    (ns_xsd["byte"], rdf_type, Datatype),
185    (ns_xsd["unsignedLong"], rdf_type, Datatype),
186    (ns_xsd["unsignedInt"], rdf_type, Datatype),
187    (ns_xsd["unsignedShort"], rdf_type, Datatype),
188    (ns_xsd["unsignedByte"], rdf_type, Datatype),
189    (ns_xsd["float"], rdf_type, Datatype),
190    (ns_xsd["double"], rdf_type, Datatype),
191    (ns_xsd["string"], rdf_type, Datatype),
192    (ns_xsd["normalizedString"], rdf_type, Datatype),
193    (ns_xsd["token"], rdf_type, Datatype),
194    (ns_xsd["language"], rdf_type, Datatype),
195    (ns_xsd["Name"], rdf_type, Datatype),
196    (ns_xsd["NCName"], rdf_type, Datatype),
197    (ns_xsd["NMTOKEN"], rdf_type, Datatype),
198    (ns_xsd["boolean"], rdf_type, Datatype),
199    (ns_xsd["hexBinary"], rdf_type, Datatype),
200    (ns_xsd["base64Binary"], rdf_type, Datatype),
201    (ns_xsd["anyURI"], rdf_type, Datatype),
202    (ns_xsd["dateTimeStamp"], rdf_type, Datatype),
203    (ns_xsd["dateTime"], rdf_type, Datatype),
204    (Literal, rdf_type, Datatype),
205    (XMLLiteral, rdf_type, Datatype),
206]
207
208RDFS_D_Axiomatic_Triples = (
209    RDFS_D_Axiomatic_Triples_types + RDFS_D_Axiomatic_Triples_subclasses
210)
211
212# OWL Class axiomatic triples: definition of special classes
213_OWL_axiomatic_triples_Classes = [
214    (AllDifferent, rdf_type, Class),
215    (AllDifferent, subClassOf, Resource),
216    (AllDisjointClasses, rdf_type, Class),
217    (AllDisjointClasses, subClassOf, Resource),
218    (AllDisjointProperties, rdf_type, Class),
219    (AllDisjointProperties, subClassOf, Resource),
220    (Annotation, rdf_type, Class),
221    (Annotation, subClassOf, Resource),
222    (AnnotationProperty, rdf_type, Class),
223    (AnnotationProperty, subClassOf, Property),
224    (AsymmetricProperty, rdf_type, Class),
225    (AsymmetricProperty, subClassOf, Property),
226    (OWLClass, rdf_type, Class),
227    (OWLClass, equivalentClass, Class),
228    #    (DataRange, type, Class),
229    #    (DataRange, equivalentClass, Datatype),
230    (Datatype, rdf_type, Class),
231    (DatatypeProperty, rdf_type, Class),
232    (DatatypeProperty, subClassOf, Property),
233    (DeprecatedClass, rdf_type, Class),
234    (DeprecatedClass, subClassOf, Class),
235    (DeprecatedProperty, rdf_type, Class),
236    (DeprecatedProperty, subClassOf, Property),
237    (FunctionalProperty, rdf_type, Class),
238    (FunctionalProperty, subClassOf, Property),
239    (InverseFunctionalProperty, rdf_type, Class),
240    (InverseFunctionalProperty, subClassOf, Property),
241    (IrreflexiveProperty, rdf_type, Class),
242    (IrreflexiveProperty, subClassOf, Property),
243    (Literal, rdf_type, Datatype),
244    #    (NamedIndividual, type, Class),
245    #    (NamedIndividual, equivalentClass, Resource),
246    (NegativePropertyAssertion, rdf_type, Class),
247    (NegativePropertyAssertion, subClassOf, Resource),
248    (Nothing, rdf_type, Class),
249    (Nothing, subClassOf, Thing),
250    (ObjectProperty, rdf_type, Class),
251    (ObjectProperty, equivalentClass, Property),
252    (Ontology, rdf_type, Class),
253    (Ontology, subClassOf, Resource),
254    (OntologyProperty, rdf_type, Class),
255    (OntologyProperty, subClassOf, Property),
256    (Property, rdf_type, Class),
257    (ReflexiveProperty, rdf_type, Class),
258    (ReflexiveProperty, subClassOf, Property),
259    (Restriction, rdf_type, Class),
260    (Restriction, subClassOf, Class),
261    (SymmetricProperty, rdf_type, Class),
262    (SymmetricProperty, subClassOf, Property),
263    (Thing, rdf_type, Class),
264    (Thing, subClassOf, Resource),
265    (TransitiveProperty, rdf_type, Class),
266    (TransitiveProperty, subClassOf, Property),
267    # OWL valid triples; some of these would be inferred by the OWL RL expansion, but it may make things
268    # a bit faster to add these upfront
269    (AllDisjointProperties, rdf_type, OWLClass),
270    (AllDisjointClasses, rdf_type, OWLClass),
271    (AllDisjointProperties, rdf_type, OWLClass),
272    (Annotation, rdf_type, OWLClass),
273    (AsymmetricProperty, rdf_type, OWLClass),
274    (Axiom, rdf_type, OWLClass),
275    (DataRange, rdf_type, OWLClass),
276    (Datatype, rdf_type, OWLClass),
277    (DatatypeProperty, rdf_type, OWLClass),
278    (DeprecatedClass, rdf_type, OWLClass),
279    (DeprecatedClass, subClassOf, OWLClass),
280    (DeprecatedProperty, rdf_type, OWLClass),
281    (FunctionalProperty, rdf_type, OWLClass),
282    (InverseFunctionalProperty, rdf_type, OWLClass),
283    (IrreflexiveProperty, rdf_type, OWLClass),
284    (NamedIndividual, rdf_type, OWLClass),
285    (NegativePropertyAssertion, rdf_type, OWLClass),
286    (Nothing, rdf_type, OWLClass),
287    (ObjectProperty, rdf_type, OWLClass),
288    (Ontology, rdf_type, OWLClass),
289    (OntologyProperty, rdf_type, OWLClass),
290    (Property, rdf_type, OWLClass),
291    (ReflexiveProperty, rdf_type, OWLClass),
292    (Restriction, rdf_type, OWLClass),
293    (Restriction, subClassOf, OWLClass),
294    #    (SelfRestriction, type, OWLClass),
295    (SymmetricProperty, rdf_type, OWLClass),
296    (Thing, rdf_type, OWLClass),
297    (TransitiveProperty, rdf_type, OWLClass),
298]
299
300# OWL Property axiomatic triples: definition of domains and ranges
301_OWL_axiomatic_triples_Properties = [
302    (allValuesFrom, rdf_type, Property),
303    (allValuesFrom, rdfs_domain, Restriction),
304    (allValuesFrom, rdfs_range, Class),
305    (assertionProperty, rdf_type, Property),
306    (assertionProperty, rdfs_domain, NegativePropertyAssertion),
307    (assertionProperty, rdfs_range, Property),
308    (backwardCompatibleWith, rdf_type, OntologyProperty),
309    (backwardCompatibleWith, rdf_type, AnnotationProperty),
310    (backwardCompatibleWith, rdfs_domain, Ontology),
311    (backwardCompatibleWith, rdfs_range, Ontology),
312    #    (bottomDataProperty, type, DatatypeProperty),
313    #    (bottomObjectProperty, type, ObjectProperty),
314    #    (cardinality, type, Property),
315    #    (cardinality, domain, Restriction),
316    #    (cardinality, range, ns_xsd["nonNegativeInteger"]),
317    (comment, rdf_type, AnnotationProperty),
318    (comment, rdfs_domain, Resource),
319    (comment, rdfs_range, Literal),
320    (complementOf, rdf_type, Property),
321    (complementOf, rdfs_domain, Class),
322    (complementOf, rdfs_range, Class),
323    #    (datatypeComplementOf, type, Property),
324    #    (datatypeComplementOf, domain, Datatype),
325    #    (datatypeComplementOf, range, Datatype),
326    (deprecated, rdf_type, AnnotationProperty),
327    (deprecated, rdfs_domain, Resource),
328    (deprecated, rdfs_range, Resource),
329    (differentFrom, rdf_type, Property),
330    (differentFrom, rdfs_domain, Resource),
331    (differentFrom, rdfs_range, Resource),
332    #    (disjointUnionOf, type, Property),
333    #    (disjointUnionOf, domain, Class),
334    #    (disjointUnionOf, range, List),
335    (disjointWith, rdf_type, Property),
336    (disjointWith, rdfs_domain, Class),
337    (disjointWith, rdfs_range, Class),
338    (distinctMembers, rdf_type, Property),
339    (distinctMembers, rdfs_domain, AllDifferent),
340    (distinctMembers, rdfs_range, List),
341    (equivalentClass, rdf_type, Property),
342    (equivalentClass, rdfs_domain, Class),
343    (equivalentClass, rdfs_range, Class),
344    (equivalentProperty, rdf_type, Property),
345    (equivalentProperty, rdfs_domain, Property),
346    (equivalentProperty, rdfs_range, Property),
347    (hasKey, rdf_type, Property),
348    (hasKey, rdfs_domain, Class),
349    (hasKey, rdfs_range, List),
350    (hasValue, rdf_type, Property),
351    (hasValue, rdfs_domain, Restriction),
352    (hasValue, rdfs_range, Resource),
353    (imports, rdf_type, OntologyProperty),
354    (imports, rdfs_domain, Ontology),
355    (imports, rdfs_range, Ontology),
356    (incompatibleWith, rdf_type, OntologyProperty),
357    (incompatibleWith, rdf_type, AnnotationProperty),
358    (incompatibleWith, rdfs_domain, Ontology),
359    (incompatibleWith, rdfs_range, Ontology),
360    (intersectionOf, rdf_type, Property),
361    (intersectionOf, rdfs_domain, Class),
362    (intersectionOf, rdfs_range, List),
363    (inverseOf, rdf_type, Property),
364    (inverseOf, rdfs_domain, Property),
365    (inverseOf, rdfs_range, Property),
366    (isDefinedBy, rdf_type, AnnotationProperty),
367    (isDefinedBy, rdfs_domain, Resource),
368    (isDefinedBy, rdfs_range, Resource),
369    (label, rdf_type, AnnotationProperty),
370    (label, rdfs_domain, Resource),
371    (label, rdfs_range, Literal),
372    (maxCardinality, rdf_type, Property),
373    (maxCardinality, rdfs_domain, Restriction),
374    (maxCardinality, rdfs_range, ns_xsd["nonNegativeInteger"]),
375    (maxQualifiedCardinality, rdf_type, Property),
376    (maxQualifiedCardinality, rdfs_domain, Restriction),
377    (maxQualifiedCardinality, rdfs_range, ns_xsd["nonNegativeInteger"]),
378    (members, rdf_type, Property),
379    (members, rdfs_domain, Resource),
380    (members, rdfs_range, List),
381    #    (minCardinality, type, Property),
382    #    (minCardinality, domain, Restriction),
383    #    (minCardinality, range, ns_xsd["nonNegativeInteger"]),
384    #    (minQualifiedCardinality, type, Property),
385    #    (minQualifiedCardinality, domain, Restriction),
386    #    (minQualifiedCardinality, range, ns_xsd["nonNegativeInteger"]),
387    #    (annotatedTarget, type, Property),
388    #    (annotatedTarget, domain, Resource),
389    #    (annotatedTarget, range, Resource),
390    (onClass, rdf_type, Property),
391    (onClass, rdfs_domain, Restriction),
392    (onClass, rdfs_range, Class),
393    #    (onDataRange, type, Property),
394    #    (onDataRange, domain, Restriction),
395    #    (onDataRange, range, Datatype),
396    (onDatatype, rdf_type, Property),
397    (onDatatype, rdfs_domain, Datatype),
398    (onDatatype, rdfs_range, Datatype),
399    (oneOf, rdf_type, Property),
400    (oneOf, rdfs_domain, Class),
401    (oneOf, rdfs_range, List),
402    (onProperty, rdf_type, Property),
403    (onProperty, rdfs_domain, Restriction),
404    (onProperty, rdfs_range, Property),
405    #    (onProperties, type, Property),
406    #    (onProperties, domain, Restriction),
407    #    (onProperties, range, List),
408    #    (annotatedProperty, type, Property),
409    #    (annotatedProperty, domain, Resource),
410    #    (annotatedProperty, range, Property),
411    (priorVersion, rdf_type, OntologyProperty),
412    (priorVersion, rdf_type, AnnotationProperty),
413    (priorVersion, rdfs_domain, Ontology),
414    (priorVersion, rdfs_range, Ontology),
415    (propertyChainAxiom, rdf_type, Property),
416    (propertyChainAxiom, rdfs_domain, Property),
417    (propertyChainAxiom, rdfs_range, List),
418    #    (propertyDisjointWith, type, Property),
419    #    (propertyDisjointWith, domain, Property),
420    #    (propertyDisjointWith, range, Property),
421    #
422    #    (qualifiedCardinality, type, Property),
423    #    (qualifiedCardinality, domain, Restriction),
424    #    (qualifiedCardinality, range, ns_xsd["nonNegativeInteger"]),
425    (sameAs, rdf_type, Property),
426    (sameAs, rdfs_domain, Resource),
427    (sameAs, rdfs_range, Resource),
428    (seeAlso, rdf_type, AnnotationProperty),
429    (seeAlso, rdfs_domain, Resource),
430    (seeAlso, rdfs_range, Resource),
431    (someValuesFrom, rdf_type, Property),
432    (someValuesFrom, rdfs_domain, Restriction),
433    (someValuesFrom, rdfs_range, Class),
434    (sourceIndividual, rdf_type, Property),
435    (sourceIndividual, rdfs_domain, NegativePropertyAssertion),
436    (sourceIndividual, rdfs_range, Resource),
437    #
438    #    (annotatedSource, type, Property),
439    #    (annotatedSource, domain, Resource),
440    #    (annotatedSource, range, Resource),
441    #
442    (targetIndividual, rdf_type, Property),
443    (targetIndividual, rdfs_domain, NegativePropertyAssertion),
444    (targetIndividual, rdfs_range, Resource),
445    (targetValue, rdf_type, Property),
446    (targetValue, rdfs_domain, NegativePropertyAssertion),
447    (targetValue, rdfs_range, Literal),
448    #    (topDataProperty, type, DatatypeProperty),
449    #    (topDataProperty, domain, Resource),
450    #    (topDataProperty, range, Literal),
451    #
452    #    (topObjectProperty, type, ObjectProperty),
453    #    (topObjectProperty, domain, Resource),
454    #    (topObjectProperty, range, Resource),
455    (unionOf, rdf_type, Property),
456    (unionOf, rdfs_domain, Class),
457    (unionOf, rdfs_range, List),
458    (versionInfo, rdf_type, AnnotationProperty),
459    (versionInfo, rdfs_domain, Resource),
460    (versionInfo, rdfs_range, Resource),
461    (versionIRI, rdf_type, AnnotationProperty),
462    (versionIRI, rdfs_domain, Resource),
463    (versionIRI, rdfs_range, Resource),
464    (withRestrictions, rdf_type, Property),
465    (withRestrictions, rdfs_domain, Datatype),
466    (withRestrictions, rdfs_range, List),
467    # some OWL valid triples; these would be inferred by the OWL RL expansion, but it may make things
468    # a bit faster to add these upfront
469    (allValuesFrom, rdfs_range, OWLClass),
470    (complementOf, rdfs_domain, OWLClass),
471    (complementOf, rdfs_range, OWLClass),
472    #    (datatypeComplementOf, domain, DataRange),
473    #    (datatypeComplementOf, range, DataRange),
474    (disjointUnionOf, rdfs_domain, OWLClass),
475    (disjointWith, rdfs_domain, OWLClass),
476    (disjointWith, rdfs_range, OWLClass),
477    (equivalentClass, rdfs_domain, OWLClass),
478    (equivalentClass, rdfs_range, OWLClass),
479    (hasKey, rdfs_domain, OWLClass),
480    (intersectionOf, rdfs_domain, OWLClass),
481    (onClass, rdfs_range, OWLClass),
482    #    (onDataRange, range, DataRange),
483    (onDatatype, rdfs_domain, DataRange),
484    (onDatatype, rdfs_range, DataRange),
485    (oneOf, rdfs_domain, OWLClass),
486    (someValuesFrom, rdfs_range, OWLClass),
487    (unionOf, rdfs_range, OWLClass),
488    #    (withRestrictions, domain, DataRange)
489]
490
491# OWL RL axiomatic triples: combination of the RDFS triples plus the OWL specific ones
492OWLRL_Axiomatic_Triples = (
493    _OWL_axiomatic_triples_Classes + _OWL_axiomatic_triples_Properties
494)
495
496# Note that this is not used anywhere. But I encoded it once and I did not want to remove it...:-)
497_OWL_axiomatic_triples_Facets = [
498    # langPattern
499    (ns_xsd["length"], rdf_type, Property),
500    (ns_xsd["maxExclusive"], rdf_type, Property),
501    (ns_xsd["maxInclusive"], rdf_type, Property),
502    (ns_xsd["maxLength"], rdf_type, Property),
503    (ns_xsd["minExclusive"], rdf_type, Property),
504    (ns_xsd["minInclusive"], rdf_type, Property),
505    (ns_xsd["minLength"], rdf_type, Property),
506    (ns_xsd["pattern"], rdf_type, Property),
507    (ns_xsd["length"], rdfs_domain, Resource),
508    (ns_xsd["maxExclusive"], rdfs_domain, Resource),
509    (ns_xsd["maxInclusive"], rdfs_domain, Resource),
510    (ns_xsd["maxLength"], rdfs_domain, Resource),
511    (ns_xsd["minExclusive"], rdfs_domain, Resource),
512    (ns_xsd["minInclusive"], rdfs_domain, Resource),
513    (ns_xsd["minLength"], rdfs_domain, Resource),
514    (ns_xsd["pattern"], rdfs_domain, Resource),
515    (ns_xsd["length"], rdfs_domain, Resource),
516    (ns_xsd["maxExclusive"], rdfs_range, Literal),
517    (ns_xsd["maxInclusive"], rdfs_range, Literal),
518    (ns_xsd["maxLength"], rdfs_range, Literal),
519    (ns_xsd["minExclusive"], rdfs_range, Literal),
520    (ns_xsd["minInclusive"], rdfs_range, Literal),
521    (ns_xsd["minLength"], rdfs_range, Literal),
522    (ns_xsd["pattern"], rdfs_range, Literal),
523]
524
525# OWL D-entailment triples (additionally to the RDFS ones), ie, possible subclassing of various extra datatypes
526_OWL_D_Axiomatic_Triples_types = [(ns_rdf["PlainLiteral"], rdf_type, Datatype)]
527
528#
529OWL_D_Axiomatic_Triples_subclasses = [
530    (ns_xsd["string"], subClassOf, ns_rdf["PlainLiteral"]),
531    (ns_xsd["normalizedString"], subClassOf, ns_rdf["PlainLiteral"]),
532    (ns_xsd["token"], subClassOf, ns_rdf["PlainLiteral"]),
533    (ns_xsd["Name"], subClassOf, ns_rdf["PlainLiteral"]),
534    (ns_xsd["NCName"], subClassOf, ns_rdf["PlainLiteral"]),
535    (ns_xsd["NMTOKEN"], subClassOf, ns_rdf["PlainLiteral"]),
536]
537
538#
539OWLRL_Datatypes_Disjointness = [
540    (ns_xsd["anyURI"], disjointWith, ns_xsd["base64Binary"]),
541    (ns_xsd["anyURI"], disjointWith, ns_xsd["boolean"]),
542    (ns_xsd["anyURI"], disjointWith, ns_xsd["dateTime"]),
543    (ns_xsd["anyURI"], disjointWith, ns_xsd["decimal"]),
544    (ns_xsd["anyURI"], disjointWith, ns_xsd["double"]),
545    (ns_xsd["anyURI"], disjointWith, ns_xsd["float"]),
546    (ns_xsd["anyURI"], disjointWith, ns_xsd["hexBinary"]),
547    (ns_xsd["anyURI"], disjointWith, ns_xsd["string"]),
548    (ns_xsd["anyURI"], disjointWith, ns_rdf["PlainLiteral"]),
549    (ns_xsd["anyURI"], disjointWith, XMLLiteral),
550    (ns_xsd["base64Binary"], disjointWith, ns_xsd["boolean"]),
551    (ns_xsd["base64Binary"], disjointWith, ns_xsd["dateTime"]),
552    (ns_xsd["base64Binary"], disjointWith, ns_xsd["decimal"]),
553    (ns_xsd["base64Binary"], disjointWith, ns_xsd["double"]),
554    (ns_xsd["base64Binary"], disjointWith, ns_xsd["float"]),
555    (ns_xsd["base64Binary"], disjointWith, ns_xsd["hexBinary"]),
556    (ns_xsd["base64Binary"], disjointWith, ns_xsd["string"]),
557    (ns_xsd["base64Binary"], disjointWith, ns_rdf["PlainLiteral"]),
558    (ns_xsd["base64Binary"], disjointWith, XMLLiteral),
559    (ns_xsd["boolean"], disjointWith, ns_xsd["dateTime"]),
560    (ns_xsd["boolean"], disjointWith, ns_xsd["decimal"]),
561    (ns_xsd["boolean"], disjointWith, ns_xsd["double"]),
562    (ns_xsd["boolean"], disjointWith, ns_xsd["float"]),
563    (ns_xsd["boolean"], disjointWith, ns_xsd["hexBinary"]),
564    (ns_xsd["boolean"], disjointWith, ns_xsd["string"]),
565    (ns_xsd["boolean"], disjointWith, ns_rdf["PlainLiteral"]),
566    (ns_xsd["boolean"], disjointWith, XMLLiteral),
567    (ns_xsd["dateTime"], disjointWith, ns_xsd["decimal"]),
568    (ns_xsd["dateTime"], disjointWith, ns_xsd["double"]),
569    (ns_xsd["dateTime"], disjointWith, ns_xsd["float"]),
570    (ns_xsd["dateTime"], disjointWith, ns_xsd["hexBinary"]),
571    (ns_xsd["dateTime"], disjointWith, ns_xsd["string"]),
572    (ns_xsd["dateTime"], disjointWith, ns_rdf["PlainLiteral"]),
573    (ns_xsd["dateTime"], disjointWith, XMLLiteral),
574    (ns_xsd["decimal"], disjointWith, ns_xsd["double"]),
575    (ns_xsd["decimal"], disjointWith, ns_xsd["float"]),
576    (ns_xsd["decimal"], disjointWith, ns_xsd["hexBinary"]),
577    (ns_xsd["decimal"], disjointWith, ns_xsd["string"]),
578    (ns_xsd["decimal"], disjointWith, ns_rdf["PlainLiteral"]),
579    (ns_xsd["decimal"], disjointWith, XMLLiteral),
580    (ns_xsd["double"], disjointWith, ns_xsd["float"]),
581    (ns_xsd["double"], disjointWith, ns_xsd["hexBinary"]),
582    (ns_xsd["double"], disjointWith, ns_xsd["string"]),
583    (ns_xsd["double"], disjointWith, ns_rdf["PlainLiteral"]),
584    (ns_xsd["double"], disjointWith, XMLLiteral),
585    (ns_xsd["float"], disjointWith, ns_xsd["hexBinary"]),
586    (ns_xsd["float"], disjointWith, ns_xsd["string"]),
587    (ns_xsd["float"], disjointWith, ns_rdf["PlainLiteral"]),
588    (ns_xsd["float"], disjointWith, XMLLiteral),
589    (ns_xsd["hexBinary"], disjointWith, ns_xsd["string"]),
590    (ns_xsd["hexBinary"], disjointWith, ns_rdf["PlainLiteral"]),
591    (ns_xsd["hexBinary"], disjointWith, XMLLiteral),
592    (ns_xsd["string"], disjointWith, XMLLiteral),
593]
594
595# OWL RL D Axiomatic triples: combination of the RDFS ones, plus some extra statements on ranges and domains, plus
596# some OWL specific datatypes
597OWLRL_D_Axiomatic_Triples = (
598    RDFS_D_Axiomatic_Triples
599    + _OWL_D_Axiomatic_Triples_types
600    + OWL_D_Axiomatic_Triples_subclasses
601    + OWLRL_Datatypes_Disjointness
602)