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