comparison env/lib/python3.7/site-packages/prov/constants.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 from __future__ import (absolute_import, division, print_function,
2 unicode_literals)
3
4 import six
5 from prov.identifier import Namespace
6
7 __author__ = 'Trung Dong Huynh'
8 __email__ = 'trungdong@donggiang.com'
9
10
11 XSD = Namespace('xsd', 'http://www.w3.org/2001/XMLSchema#')
12 PROV = Namespace('prov', 'http://www.w3.org/ns/prov#')
13 XSI = Namespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance')
14
15 # C1. Entities/Activities
16 PROV_ENTITY = PROV['Entity']
17 PROV_ACTIVITY = PROV['Activity']
18 PROV_GENERATION = PROV['Generation']
19 PROV_USAGE = PROV['Usage']
20 PROV_COMMUNICATION = PROV['Communication']
21 PROV_START = PROV['Start']
22 PROV_END = PROV['End']
23 PROV_INVALIDATION = PROV['Invalidation']
24
25 # C2. Derivations
26 PROV_DERIVATION = PROV['Derivation']
27
28 # C3. Agents/Responsibility
29 PROV_AGENT = PROV['Agent']
30 PROV_ATTRIBUTION = PROV['Attribution']
31 PROV_ASSOCIATION = PROV['Association']
32 PROV_DELEGATION = PROV['Delegation']
33 PROV_INFLUENCE = PROV['Influence']
34 # C4. Bundles
35 PROV_BUNDLE = PROV['Bundle']
36 # C5. Alternate
37 PROV_ALTERNATE = PROV['Alternate']
38 PROV_SPECIALIZATION = PROV['Specialization']
39 PROV_MENTION = PROV['Mention']
40 # C6. Collections
41 PROV_MEMBERSHIP = PROV['Membership']
42
43 PROV_N_MAP = {
44 PROV_ENTITY: u'entity',
45 PROV_ACTIVITY: u'activity',
46 PROV_GENERATION: u'wasGeneratedBy',
47 PROV_USAGE: u'used',
48 PROV_COMMUNICATION: u'wasInformedBy',
49 PROV_START: u'wasStartedBy',
50 PROV_END: u'wasEndedBy',
51 PROV_INVALIDATION: u'wasInvalidatedBy',
52 PROV_DERIVATION: u'wasDerivedFrom',
53 PROV_AGENT: u'agent',
54 PROV_ATTRIBUTION: u'wasAttributedTo',
55 PROV_ASSOCIATION: u'wasAssociatedWith',
56 PROV_DELEGATION: u'actedOnBehalfOf',
57 PROV_INFLUENCE: u'wasInfluencedBy',
58 PROV_ALTERNATE: u'alternateOf',
59 PROV_SPECIALIZATION: u'specializationOf',
60 PROV_MENTION: u'mentionOf',
61 PROV_MEMBERSHIP: u'hadMember',
62 PROV_BUNDLE: u'bundle',
63 }
64
65 # Records defined as subtypes in PROV-N but top level types in for example
66 # PROV XML also need a mapping.
67 ADDITIONAL_N_MAP = {
68 PROV['Revision']: u'wasRevisionOf',
69 PROV['Quotation']: u'wasQuotedFrom',
70 PROV['PrimarySource']: u'hadPrimarySource',
71 PROV['SoftwareAgent']: u'softwareAgent',
72 PROV['Person']: u'person',
73 PROV['Organization']: u'organization',
74 PROV['Plan']: u'plan',
75 PROV['Collection']: u'collection',
76 PROV['EmptyCollection']: u'emptyCollection',
77 }
78
79 # Maps qualified names from the PROV namespace to their base class. If it
80 # has no baseclass it maps to itsself. This is needed for example for PROV
81 # XML (de)serializer where extended types are used a lot.
82 PROV_BASE_CLS = {
83 PROV_ENTITY: PROV_ENTITY,
84 PROV_ACTIVITY: PROV_ACTIVITY,
85 PROV_GENERATION: PROV_GENERATION,
86 PROV_USAGE: PROV_USAGE,
87 PROV_COMMUNICATION: PROV_COMMUNICATION,
88 PROV_START: PROV_START,
89 PROV_END: PROV_END,
90 PROV_INVALIDATION: PROV_INVALIDATION,
91 PROV_DERIVATION: PROV_DERIVATION,
92 PROV['Revision']: PROV_DERIVATION,
93 PROV['Quotation']: PROV_DERIVATION,
94 PROV['PrimarySource']: PROV_DERIVATION,
95 PROV_AGENT: PROV_AGENT,
96 PROV['SoftwareAgent']: PROV_AGENT,
97 PROV['Person']: PROV_AGENT,
98 PROV['Organization']: PROV_AGENT,
99 PROV_ATTRIBUTION: PROV_ATTRIBUTION,
100 PROV_ASSOCIATION: PROV_ASSOCIATION,
101 PROV['Plan']: PROV_ENTITY,
102 PROV_DELEGATION: PROV_DELEGATION,
103 PROV_INFLUENCE: PROV_INFLUENCE,
104 PROV_ALTERNATE: PROV_ALTERNATE,
105 PROV_SPECIALIZATION: PROV_SPECIALIZATION,
106 PROV_MENTION: PROV_MENTION,
107 PROV['Collection']: PROV_ENTITY,
108 PROV['EmptyCollection']: PROV_ENTITY,
109 PROV_MEMBERSHIP: PROV_MEMBERSHIP,
110 PROV_BUNDLE: PROV_ENTITY
111 }
112
113 # Identifiers for PROV's attributes
114 PROV_ATTR_ENTITY = PROV['entity']
115 PROV_ATTR_ACTIVITY = PROV['activity']
116 PROV_ATTR_TRIGGER = PROV['trigger']
117 PROV_ATTR_INFORMED = PROV['informed']
118 PROV_ATTR_INFORMANT = PROV['informant']
119 PROV_ATTR_STARTER = PROV['starter']
120 PROV_ATTR_ENDER = PROV['ender']
121 PROV_ATTR_AGENT = PROV['agent']
122 PROV_ATTR_PLAN = PROV['plan']
123 PROV_ATTR_DELEGATE = PROV['delegate']
124 PROV_ATTR_RESPONSIBLE = PROV['responsible']
125 PROV_ATTR_GENERATED_ENTITY = PROV['generatedEntity']
126 PROV_ATTR_USED_ENTITY = PROV['usedEntity']
127 PROV_ATTR_GENERATION = PROV['generation']
128 PROV_ATTR_USAGE = PROV['usage']
129 PROV_ATTR_SPECIFIC_ENTITY = PROV['specificEntity']
130 PROV_ATTR_GENERAL_ENTITY = PROV['generalEntity']
131 PROV_ATTR_ALTERNATE1 = PROV['alternate1']
132 PROV_ATTR_ALTERNATE2 = PROV['alternate2']
133 PROV_ATTR_BUNDLE = PROV['bundle']
134 PROV_ATTR_INFLUENCEE = PROV['influencee']
135 PROV_ATTR_INFLUENCER = PROV['influencer']
136 PROV_ATTR_COLLECTION = PROV['collection']
137
138 # Literal properties
139 PROV_ATTR_TIME = PROV['time']
140 PROV_ATTR_STARTTIME = PROV['startTime']
141 PROV_ATTR_ENDTIME = PROV['endTime']
142
143
144 PROV_ATTRIBUTE_QNAMES = {
145 PROV_ATTR_ENTITY,
146 PROV_ATTR_ACTIVITY,
147 PROV_ATTR_TRIGGER,
148 PROV_ATTR_INFORMED,
149 PROV_ATTR_INFORMANT,
150 PROV_ATTR_STARTER,
151 PROV_ATTR_ENDER,
152 PROV_ATTR_AGENT,
153 PROV_ATTR_PLAN,
154 PROV_ATTR_DELEGATE,
155 PROV_ATTR_RESPONSIBLE,
156 PROV_ATTR_GENERATED_ENTITY,
157 PROV_ATTR_USED_ENTITY,
158 PROV_ATTR_GENERATION,
159 PROV_ATTR_USAGE,
160 PROV_ATTR_SPECIFIC_ENTITY,
161 PROV_ATTR_GENERAL_ENTITY,
162 PROV_ATTR_ALTERNATE1,
163 PROV_ATTR_ALTERNATE2,
164 PROV_ATTR_BUNDLE,
165 PROV_ATTR_INFLUENCEE,
166 PROV_ATTR_INFLUENCER,
167 PROV_ATTR_COLLECTION
168 }
169 PROV_ATTRIBUTE_LITERALS = {
170 PROV_ATTR_TIME, PROV_ATTR_STARTTIME, PROV_ATTR_ENDTIME
171 }
172
173 # Set of formal attributes of PROV records
174 PROV_ATTRIBUTES = PROV_ATTRIBUTE_QNAMES | PROV_ATTRIBUTE_LITERALS
175 PROV_RECORD_ATTRIBUTES = list((attr, six.text_type(attr)) for attr in
176 PROV_ATTRIBUTES)
177
178 PROV_RECORD_IDS_MAP = dict(
179 (PROV_N_MAP[rec_type_id], rec_type_id) for rec_type_id in PROV_N_MAP
180 )
181 PROV_ID_ATTRIBUTES_MAP = dict(
182 (prov_id, attribute) for (prov_id, attribute) in PROV_RECORD_ATTRIBUTES
183 )
184 PROV_ATTRIBUTES_ID_MAP = dict(
185 (attribute, prov_id) for (prov_id, attribute) in PROV_RECORD_ATTRIBUTES
186 )
187
188 # Extra definition for convenience
189 PROV_TYPE = PROV['type']
190 PROV_LABEL = PROV['label']
191 PROV_VALUE = PROV['value']
192 PROV_LOCATION = PROV['location']
193 PROV_ROLE = PROV['role']
194
195 PROV_QUALIFIEDNAME = PROV['QUALIFIED_NAME']
196
197 # XSD DATA TYPES
198 XSD_ANYURI = XSD['anyURI']
199 XSD_QNAME = XSD['QName']
200 XSD_DATETIME = XSD['dateTime']
201 XSD_TIME = XSD['time']
202 XSD_DATE = XSD['date']
203 XSD_STRING = XSD['string']
204 XSD_BOOLEAN = XSD['boolean']
205 # All XSD Integer types
206 XSD_INTEGER = XSD['integer']
207 XSD_LONG = XSD['long']
208 XSD_INT = XSD['int']
209 XSD_SHORT = XSD['short']
210 XSD_BYTE = XSD['byte']
211 XSD_NONNEGATIVEINTEGER = XSD['nonNegativeInteger']
212 XSD_UNSIGNEDLONG = XSD['unsignedLong']
213 XSD_UNSIGNEDINT = XSD['unsignedInt']
214 XSD_UNSIGNEDSHORT = XSD['unsignedShort']
215 XSD_UNSIGNEDBYTE = XSD['unsignedByte']
216 XSD_POSITIVEINTEGER = XSD['positiveInteger']
217 XSD_NONPOSITIVEINTEGER = XSD['nonPositiveInteger']
218 XSD_NEGATIVEINTEGER = XSD['negativeInteger']
219 # All XSD real number types
220 XSD_FLOAT = XSD['float']
221 XSD_DOUBLE = XSD['double']
222 XSD_DECIMAL = XSD['decimal']