forked from ES-DOC/esdoc-cim-v2-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiso_classes.py
More file actions
225 lines (198 loc) · 8.64 KB
/
iso_classes.py
File metadata and controls
225 lines (198 loc) · 8.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# -*- coding: utf-8 -*-
"""
.. module:: iso_classes.py
:synopsis: Set of CIM v2 ontology type definitions.
applying to the description of CMIP6 Data Reference Syntax quantities.
This package is based on DQ_Lineage (ISO19115-2) as documented at
http://wiki.esipfed.org/index.php/File:LI_Lineage-2.png.
It provides a complete and extended implementation of _one_ possible way
of implementing LI_Lineage (i.e. some optional associations are ommitted, and
some additional associations are included, and where necessary, some
associations are to CIM entities, rather than other ISO implementations
(e.g. to shared.citation, rather than CI_Citation, although the CIM
shared.citation is itself an extension of CI_Citation).
The key omission is the use of LE_Source, where instead process_step is
preferred, and process_step itself uses CIM data.dataset for source inputs.
"""
def lineage():
"""
Representation of the ISO19115 lineage provenance description.
Information about the events or source data used in constructing a dataset
"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': True,
'pstr': ('{}', ('statement',)),
'properties': [
('statement','str','0.1',
'General explanation of the level of knowledge or lack thereof about the lineage'),
('process_step','iso.process_step','0.N',
'How the resource was developed or set of events associated with production.'),
('source','linked_to(data.dataset)','0.N','Input(s) used in production of resource')
],
'constraints': []
}
def process_step():
"""
Representation of the ISO19115 LE_ProcessStep and parent LI_ProcessStep classes.
"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': False,
'pstr': ('{}', ('description',)),
'properties': [
('description','str','1.1',
'General description of the events in the development of the resource.'),
('rationale', 'str', '0.1',
'Purpose for performing the process on the resource'),
('execution_date_time', 'time.date_time', '0.1',
'The date and time when the process was completed.'),
('processor', 'shared.responsibility', '0.1',
"""Individual or organisation responsible for the process step.
Use roleCode='processor'. Contact information is not necessary.
"""
),
('reference', 'linked_to(shared.citation)', '0.N',
'Process step documentation'),
('source', 'linked_to(data.dataset)', '0.N',
'Information on the inputs used in the process step.'),
('processing_information', 'iso.processing', '0.N',
'Comprehensive information on the processing carried out'),
('report', 'iso.process_step_report', '0.N',
'Report generated by the process step'),
]
}
def processing():
"""
Representation of the ISO19115 LE_Processing class
Note that the algorithm definition has been adjusted to be more generic
and less "instrument obsessed" than ISO19115. Name is an extension, and
the identifier is simply a code string (id) ... but given there may be
no identifier space for this processing step, it is made optional, rather
than mandatory as in ISO. For export to ISO, the recommendation is to
use the identifier of the CIM document which uses this class.
"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': False,
'pstr': ('{}', ('name',)),
'properties': [
('name', 'str','1.1',
'Name of the processing action (ISO extension)'),
('identifier','str','0.1',
"Identifier (strictly, a code which can be used in an MD_Identifier"),
('softwareReference', 'linked_to(shared.citation)', '0.N',
"Reference to document describing processing software"),
('procedureDescription','str','0.1',
"additional details about the processing procedures"),
('documentation','linked_to(shared.citation)','0.1',
"reference to documentation describing the processing"),
('runTimeParameters','str','0.1',
"parameters to control the processing operations, entered at run time"),
('algorithm', 'iso.algorithm','0.N',
"details of the methodology carried out in this processing")
]
}
def process_step_report():
"""
Report of what happened during a processing step.
Representation of ISO LE_ProcessStepReport, modified to
use links or body text, rather than files.
"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': False,
'pstr': ('{}', ('name',)),
'properties': [
('name', 'str', '1.1',
'Name of the processing report'),
('description', 'str', '1.1',
'Summary textual description of what occurred during the process step'),
('link', 'shared.online_resource','0.1',
'Link to actual report documents, if any')
]
}
def algorithm():
""" Representation of the LE_Algorithm Class"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': False,
'pstr': ('{}', ('description',)),
'properties':[
('description','str','0.1',
'Textural description of algorithm'),
('citation', 'linked_to(shared.citation)', '0.1',
'Formal documentation for the algorithm used.')
]
}
def quality_report():
""" """
return {
'type': 'class',
'base': None,
'is_abstract': False,
'is_document': True,
'properties': [
('target','shared.online_resource','1.1','Document about to which this quality report applies'),
('issues','iso.quality_issue','0.N','Issues with this resource'),
('reports','iso.quality_evaluation_result','0.N','Reports against quality measures for this resource')
]
}
def quality_issue():
""" A description of some scientific quality issue known about a resource described
by this ontology. E.g. if a model is known to have a particular problem, or there
has been a problem found with a dataset. Expect that most such detail should be
managed in an external (and formal) issue tracker. """
return {
'type': 'class',
'base': None,
'is_abstract': False,
'properties': [
('summary','str','1.1','Brief (one-line) description of issue'),
('reporter','linked_to(shared.party)','0.1','Person or entity responsible for reporting/describing issue'),
('description','str','0.1','Description of issue'),
('tracked_issue','shared.online_resource','0.1','Issue as lodged in an external issue tracker'),
]
}
def quality_evaluation_result():
""" The output of some quality evaluation against a specific measure for evaluation quality.
This flattens several ISO classes, including DQ_Result, DQ_ConformanceResult, DQ_QuantativeResult,
DQ_Element.
"""
return {
'type': 'class',
'base': None,
'is_abstract': False,
'properties': [
('name', 'str', '1.1', 'Name of measure being evaluated'),
('evaluation_procedure', 'str', '0.1', 'Brief description of the evaluation method'),
('specification', 'linked_to(shared.citation)', '0.1', 'Formal specification of the evaluation method'),
('evaluator','linked_to(shared.party)','0.1','Person or entity reesponsible for evaluation'),
('date', 'time.date_time', '0.1', 'Date of quality evaluation'),
('summary_result', 'str', '0.1', 'Summary description of evaluation outcome'),
('passed', 'bool', '0.1', 'Success or failure of the evaluation, if boolean concept is appropriate'),
('results', 'iso.quality_evaluation_output', '0.N',
'Evaluation outputs, including log files, plots, or datasets'),
]
}
def quality_evaluation_output():
""" A specific evaluation output
"""
return {
'type': 'class',
'base': 'shared.online_resource',
'is_abstract': False,
'properties': [
('output_type','iso.dq_evaluation_result_type','1.1','Type of evaluation resource')
]
}