1
2
3
4 """
5 Lists of XSD datatypes and their mutual relationships
6
7 @requires: U{RDFLib<https://github.com/RDFLib/rdflib>}, 4.0.0 and higher
8 @license: This software is available for use under the U{W3C Software License<http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>}
9 @organization: U{World Wide Web Consortium<http://www.w3.org>}
10 @author: U{Ivan Herman<a href="http://www.w3.org/People/Ivan/">}
11
12 """
13
14 __author__ = 'Ivan Herman'
15 __contact__ = 'Ivan Herman, ivan@w3.org'
16 __license__ = u'W3C® SOFTWARE NOTICE AND LICENSE, http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231'
17
18
19 from .RDFS import RDFNS as ns_rdf
20 from .RDFS import Literal
21 from .RDFS import XMLLiteral
22 from .RDFS import HTMLLiteral
23 from .RDFS import LangString
24
25 import rdflib
26
27 from rdflib.namespace import XSD as ns_xsd
28
29
30 _Common_XSD_Datatypes = [
31 ns_xsd['integer'], ns_xsd['decimal'], ns_xsd['nonNegativeInteger'], ns_xsd['nonPositiveInteger'],
32 ns_xsd['negativeInteger'], ns_xsd['positiveInteger'], ns_xsd['long'], ns_xsd['int'], ns_xsd['short'],
33 ns_xsd['byte'], ns_xsd['unsignedLong'], ns_xsd['unsignedInt'], ns_xsd['unsignedShort'],
34 ns_xsd['unsignedByte'], ns_xsd['float'], ns_xsd['double'], ns_xsd['string'], ns_xsd['normalizedString'],
35 ns_xsd['token'], ns_xsd['language'], ns_xsd['Name'], ns_xsd['NCName'], ns_xsd['NMTOKEN'],
36 ns_xsd['boolean'], ns_xsd['hexBinary'], ns_xsd['base64Binary'], ns_xsd['anyURI'],
37 ns_xsd['dateTimeStamp'], ns_xsd['dateTime'], ns_xsd['time'], ns_xsd['date'],
38 Literal, XMLLiteral, HTMLLiteral, LangString
39 ]
40
41
42 RDFS_Datatypes = _Common_XSD_Datatypes + [ns_xsd['gYearMonth'], ns_xsd['gMonthDay'], ns_xsd['gYear'], ns_xsd['gDay'], ns_xsd['gMonth']]
43
44
45 OWL_RL_Datatypes = _Common_XSD_Datatypes + [ns_rdf['PlainLiteral']]
46
47
48 _Common_Datatype_Subsumptions = {
49 ns_xsd['dateTimeStamp'] : [ns_xsd['dateTime']],
50 ns_xsd['integer'] : [ns_xsd['decimal']],
51 ns_xsd['long'] : [ns_xsd['integer'], ns_xsd['decimal']],
52 ns_xsd['int'] : [ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']],
53 ns_xsd['short'] : [ns_xsd['int'], ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']],
54 ns_xsd['byte'] : [ns_xsd['short'], ns_xsd['int'], ns_xsd['long'], ns_xsd['integer'], ns_xsd['decimal']],
55
56 ns_xsd['nonNegativeInteger'] : [ns_xsd['integer'], ns_xsd['decimal']],
57 ns_xsd['positiveInteger'] : [ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']],
58 ns_xsd['unsignedLong'] : [ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']],
59 ns_xsd['unsignedInt'] : [ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']],
60 ns_xsd['unsignedShort'] : [ns_xsd['unsignedInt'], ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']],
61 ns_xsd['unsignedByte'] : [ns_xsd['unsignedShort'], ns_xsd['unsignedInt'], ns_xsd['unsignedLong'], ns_xsd['nonNegativeInteger'], ns_xsd['integer'], ns_xsd['decimal']],
62
63 ns_xsd['nonPositiveInteger'] : [ns_xsd['integer'], ns_xsd['decimal']],
64 ns_xsd['negativeInteger'] : [ns_xsd['nonPositiveInteger'], ns_xsd['integer'], ns_xsd['decimal']],
65
66 ns_xsd['normalizedString'] : [ns_xsd["string"] ],
67 ns_xsd['token'] : [ns_xsd['normalizedString'], ns_xsd["string"]],
68 ns_xsd['language'] : [ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]],
69 ns_xsd['Name'] : [ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]],
70 ns_xsd['NCName'] : [ns_xsd['Name'], ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]],
71 ns_xsd['NMTOKEN'] : [ns_xsd['Name'], ns_xsd['token'], ns_xsd['normalizedString'], ns_xsd["string"]],
72 }
73
74
75 RDFS_Datatype_Subsumptions = _Common_Datatype_Subsumptions
76
77
78 OWL_Datatype_Subsumptions = _Common_Datatype_Subsumptions
79