roc-validator 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roc_validator-0.2.0/LICENSE +201 -0
- roc_validator-0.2.0/PKG-INFO +152 -0
- roc_validator-0.2.0/README.md +127 -0
- roc_validator-0.2.0/pyproject.toml +63 -0
- roc_validator-0.2.0/rocrate_validator/__init__.py +20 -0
- roc_validator-0.2.0/rocrate_validator/cli/__init__.py +18 -0
- roc_validator-0.2.0/rocrate_validator/cli/commands/errors.py +58 -0
- roc_validator-0.2.0/rocrate_validator/cli/commands/profiles.py +316 -0
- roc_validator-0.2.0/rocrate_validator/cli/commands/validate.py +815 -0
- roc_validator-0.2.0/rocrate_validator/cli/main.py +102 -0
- roc_validator-0.2.0/rocrate_validator/cli/utils.py +77 -0
- roc_validator-0.2.0/rocrate_validator/colors.py +54 -0
- roc_validator-0.2.0/rocrate_validator/config.py +41 -0
- roc_validator-0.2.0/rocrate_validator/constants.py +84 -0
- roc_validator-0.2.0/rocrate_validator/errors.py +297 -0
- roc_validator-0.2.0/rocrate_validator/events.py +73 -0
- roc_validator-0.2.0/rocrate_validator/log.py +251 -0
- roc_validator-0.2.0/rocrate_validator/models.py +1615 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/may/0_software-application.ttl +45 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/may/1_create_action.ttl +93 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/may/3_container_image.ttl +41 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/must/1_create_action.ttl +40 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/must/2_root_data_entity_metadata.ttl +39 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/profile.ttl +81 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/should/0_software-application.ttl +111 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/should/1_create_action.ttl +175 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/should/2_collection.ttl +65 -0
- roc_validator-0.2.0/rocrate_validator/profiles/process-run-crate/should/3_container_image.ttl +54 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/may/4_data_entity_metadata.ttl +90 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/may/61_license_entity.ttl +45 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/0_file_descriptor_format.py +130 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/1_file-descriptor_metadata.ttl +101 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/2_root_data_entity_metadata.ttl +120 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/4_data_entity_metadata.ttl +225 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/5_web_data_entity_metadata.ttl +50 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/must/6_contextual_entity.ttl +82 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/ontology.ttl +67 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/prefixes.ttl +37 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/profile.ttl +74 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/2_root_data_entity_metadata.ttl +93 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/2_root_data_entity_relative_uri.py +42 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/4_data_entity_metadata.ttl +56 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/5_web_data_entity_metadata.py +73 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/5_web_data_entity_metadata.ttl +65 -0
- roc_validator-0.2.0/rocrate_validator/profiles/ro-crate/should/6_contextual_entity_metadata.ttl +75 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/may/0_main-workflow.ttl +70 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/may/1_main_workflow.py +65 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/may/2_wrroc_crate.ttl +49 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/must/0_main-workflow.ttl +82 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/must/0_main_workflow.py +45 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/must/1_wroc_root_data_entity.ttl +39 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/profile.ttl +81 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/should/1_wroc_crate.ttl +59 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-ro-crate/should/2_main-workflow.ttl +35 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/must/1_test_suite.ttl +56 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/must/2_root_data_entity_metadata.ttl +34 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/must/2_test_instance.ttl +59 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/must/3_test_definition.ttl +56 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/profile.ttl +80 -0
- roc_validator-0.2.0/rocrate_validator/profiles/workflow-testing-ro-crate/should/1_test_suite.ttl +38 -0
- roc_validator-0.2.0/rocrate_validator/requirements/python/__init__.py +178 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/__init__.py +21 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/checks.py +281 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/errors.py +38 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/models.py +433 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/requirements.py +99 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/utils.py +298 -0
- roc_validator-0.2.0/rocrate_validator/requirements/shacl/validator.py +485 -0
- roc_validator-0.2.0/rocrate_validator/rocrate.py +552 -0
- roc_validator-0.2.0/rocrate_validator/services.py +191 -0
- roc_validator-0.2.0/rocrate_validator/utils.py +504 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: roc-validator
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python package to validate RO-Crates
|
|
5
|
+
Author: Marco Enrico Piras
|
|
6
|
+
Author-email: kikkomep@crs4.it
|
|
7
|
+
Requires-Python: >=3.8.1,<4.0.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
14
|
+
Requires-Dist: colorlog (>=6.8,<7.0)
|
|
15
|
+
Requires-Dist: inquirerpy (>=0.3.4,<0.4.0)
|
|
16
|
+
Requires-Dist: pyshacl (>=0.26.0,<0.27.0)
|
|
17
|
+
Requires-Dist: rdflib (>=7.0.0,<8.0.0)
|
|
18
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
19
|
+
Requires-Dist: requests-cache (>=1.2.1,<2.0.0)
|
|
20
|
+
Requires-Dist: rich (>=13.8.0,<14.0.0)
|
|
21
|
+
Requires-Dist: rich-click (>=1.8.3,<2.0.0)
|
|
22
|
+
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# rocrate-validator
|
|
26
|
+
|
|
27
|
+
[](https://github.com/crs4/rocrate-validator/actions/workflows/testing.yaml) [](https://opensource.org/licenses/Apache-2.0)
|
|
28
|
+
|
|
29
|
+
<!-- [](https://repolab.crs4.it/lifemonitor/rocrate-validator/-/pipelines?page=1&scope=branches&ref=develop) -->
|
|
30
|
+
|
|
31
|
+
<!-- [](https://badge.fury.io/py/rocrate-validator) -->
|
|
32
|
+
|
|
33
|
+
<!-- [](https://codecov.io/gh/crs4/rocrate-validator) -->
|
|
34
|
+
|
|
35
|
+
A Python package to validate [RO-Crate](https://researchobject.github.io/ro-crate/) packages.
|
|
36
|
+
|
|
37
|
+
* Supports CLI-based validation as well as programmatic validation (so it can
|
|
38
|
+
easily be used by Python code).
|
|
39
|
+
* Implements an extensible validation framework to which new RO-Crate profiles
|
|
40
|
+
can be added. Validation is based on SHACL shapes and Python code.
|
|
41
|
+
* Currently, validations for the following profiles are implemented: RO-Crate
|
|
42
|
+
(base profile), [Workflow
|
|
43
|
+
RO-Crate](https://www.researchobject.org/ro-crate/specification/1.1/workflows.html),
|
|
44
|
+
[Process Run
|
|
45
|
+
Crate](https://www.researchobject.org/workflow-run-crate/profiles/0.1/process_run_crate.html).
|
|
46
|
+
More are being implemented.
|
|
47
|
+
|
|
48
|
+
**Note**: this software is still work in progress. Feel free to try it out,
|
|
49
|
+
report positive and negative feedback. Do send a note (e.g., by opening an
|
|
50
|
+
Issue) before starting to develop patches you would like to contribute. The
|
|
51
|
+
implementation of validation code for additional RO-Crate profiles would be
|
|
52
|
+
particularly welcome.
|
|
53
|
+
|
|
54
|
+
## Setup
|
|
55
|
+
|
|
56
|
+
Follow these steps to set up the project:
|
|
57
|
+
|
|
58
|
+
1. **Clone the repository**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/crs4/rocrate-validator.git
|
|
62
|
+
cd rocrate-validator
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. **Set up a Python virtual environment (optional)**
|
|
66
|
+
|
|
67
|
+
Set up a Python virtual environment using `venv`:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
python3 -m venv .venv
|
|
71
|
+
source .venv/bin/activate
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or using `virtualenv`:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
virtualenv .venv
|
|
78
|
+
source .venv/bin/activate
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This step, while optional, is recommended for isolating your project dependencies. If skipped, Poetry will automatically create a virtual environment for you.
|
|
82
|
+
|
|
83
|
+
3. **Install the project using Poetry**
|
|
84
|
+
|
|
85
|
+
Ensure you have Poetry installed. If not, follow the instructions [here](https://python-poetry.org/docs/#installation). Then, install the project:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
poetry install
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage
|
|
92
|
+
|
|
93
|
+
After installation, you can use the main command `rocrate-validator` to validate ROCrates.
|
|
94
|
+
|
|
95
|
+
### Using Poetry
|
|
96
|
+
|
|
97
|
+
Run the validator using the following command:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
poetry run rocrate-validator validate <path_to_rocrate>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Replace `<path_to_rocrate>` with the path to the RO-Crate you want to validate.
|
|
104
|
+
|
|
105
|
+
Type `poetry run rocrate-validator --help` for more information.
|
|
106
|
+
|
|
107
|
+
### Using the installed package on your virtual environment
|
|
108
|
+
|
|
109
|
+
Activate the virtual environment:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
source .venv/bin/activate
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then, run the validator using the following command:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
rocrate-validator validate <path_to_rocrate>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Replace `<path_to_rocrate>` with the path to the RO-Crate you want to validate.
|
|
122
|
+
|
|
123
|
+
Type `rocrate-validator --help` for more information.
|
|
124
|
+
|
|
125
|
+
## Running the tests
|
|
126
|
+
|
|
127
|
+
To run the tests, use the following command:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
poetry run pytest
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
<!-- ## Contributing
|
|
134
|
+
|
|
135
|
+
Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) for details. -->
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
This project is licensed under the terms of the Apache License 2.0. See the
|
|
140
|
+
[LICENSE](LICENSE) file for details.
|
|
141
|
+
|
|
142
|
+
## Acknowledgements
|
|
143
|
+
|
|
144
|
+
This work has been partially funded by the following sources:
|
|
145
|
+
|
|
146
|
+
* the [BY-COVID](https://by-covid.org/) project (HORIZON Europe grant agreement number 101046203);
|
|
147
|
+
* the [LIFEMap](https://www.thelifemap.it/) project, funded by the Italian Ministry of Health (Piano Operative Salute, Trajectory 3).
|
|
148
|
+
|
|
149
|
+
<img alt="Co-funded by the EU"
|
|
150
|
+
src="https://raw.githubusercontent.com/crs4/rocrate-validator/develop/docs/img/eu-logo/EN_Co-fundedbytheEU_RGB_POS.png"
|
|
151
|
+
width="250" align="right"/>
|
|
152
|
+
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# rocrate-validator
|
|
2
|
+
|
|
3
|
+
[](https://github.com/crs4/rocrate-validator/actions/workflows/testing.yaml) [](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
+
|
|
5
|
+
<!-- [](https://repolab.crs4.it/lifemonitor/rocrate-validator/-/pipelines?page=1&scope=branches&ref=develop) -->
|
|
6
|
+
|
|
7
|
+
<!-- [](https://badge.fury.io/py/rocrate-validator) -->
|
|
8
|
+
|
|
9
|
+
<!-- [](https://codecov.io/gh/crs4/rocrate-validator) -->
|
|
10
|
+
|
|
11
|
+
A Python package to validate [RO-Crate](https://researchobject.github.io/ro-crate/) packages.
|
|
12
|
+
|
|
13
|
+
* Supports CLI-based validation as well as programmatic validation (so it can
|
|
14
|
+
easily be used by Python code).
|
|
15
|
+
* Implements an extensible validation framework to which new RO-Crate profiles
|
|
16
|
+
can be added. Validation is based on SHACL shapes and Python code.
|
|
17
|
+
* Currently, validations for the following profiles are implemented: RO-Crate
|
|
18
|
+
(base profile), [Workflow
|
|
19
|
+
RO-Crate](https://www.researchobject.org/ro-crate/specification/1.1/workflows.html),
|
|
20
|
+
[Process Run
|
|
21
|
+
Crate](https://www.researchobject.org/workflow-run-crate/profiles/0.1/process_run_crate.html).
|
|
22
|
+
More are being implemented.
|
|
23
|
+
|
|
24
|
+
**Note**: this software is still work in progress. Feel free to try it out,
|
|
25
|
+
report positive and negative feedback. Do send a note (e.g., by opening an
|
|
26
|
+
Issue) before starting to develop patches you would like to contribute. The
|
|
27
|
+
implementation of validation code for additional RO-Crate profiles would be
|
|
28
|
+
particularly welcome.
|
|
29
|
+
|
|
30
|
+
## Setup
|
|
31
|
+
|
|
32
|
+
Follow these steps to set up the project:
|
|
33
|
+
|
|
34
|
+
1. **Clone the repository**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/crs4/rocrate-validator.git
|
|
38
|
+
cd rocrate-validator
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. **Set up a Python virtual environment (optional)**
|
|
42
|
+
|
|
43
|
+
Set up a Python virtual environment using `venv`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python3 -m venv .venv
|
|
47
|
+
source .venv/bin/activate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or using `virtualenv`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
virtualenv .venv
|
|
54
|
+
source .venv/bin/activate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This step, while optional, is recommended for isolating your project dependencies. If skipped, Poetry will automatically create a virtual environment for you.
|
|
58
|
+
|
|
59
|
+
3. **Install the project using Poetry**
|
|
60
|
+
|
|
61
|
+
Ensure you have Poetry installed. If not, follow the instructions [here](https://python-poetry.org/docs/#installation). Then, install the project:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
poetry install
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
After installation, you can use the main command `rocrate-validator` to validate ROCrates.
|
|
70
|
+
|
|
71
|
+
### Using Poetry
|
|
72
|
+
|
|
73
|
+
Run the validator using the following command:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
poetry run rocrate-validator validate <path_to_rocrate>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Replace `<path_to_rocrate>` with the path to the RO-Crate you want to validate.
|
|
80
|
+
|
|
81
|
+
Type `poetry run rocrate-validator --help` for more information.
|
|
82
|
+
|
|
83
|
+
### Using the installed package on your virtual environment
|
|
84
|
+
|
|
85
|
+
Activate the virtual environment:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
source .venv/bin/activate
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Then, run the validator using the following command:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rocrate-validator validate <path_to_rocrate>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Replace `<path_to_rocrate>` with the path to the RO-Crate you want to validate.
|
|
98
|
+
|
|
99
|
+
Type `rocrate-validator --help` for more information.
|
|
100
|
+
|
|
101
|
+
## Running the tests
|
|
102
|
+
|
|
103
|
+
To run the tests, use the following command:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
poetry run pytest
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<!-- ## Contributing
|
|
110
|
+
|
|
111
|
+
Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) for details. -->
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
This project is licensed under the terms of the Apache License 2.0. See the
|
|
116
|
+
[LICENSE](LICENSE) file for details.
|
|
117
|
+
|
|
118
|
+
## Acknowledgements
|
|
119
|
+
|
|
120
|
+
This work has been partially funded by the following sources:
|
|
121
|
+
|
|
122
|
+
* the [BY-COVID](https://by-covid.org/) project (HORIZON Europe grant agreement number 101046203);
|
|
123
|
+
* the [LIFEMap](https://www.thelifemap.it/) project, funded by the Italian Ministry of Health (Piano Operative Salute, Trajectory 3).
|
|
124
|
+
|
|
125
|
+
<img alt="Co-funded by the EU"
|
|
126
|
+
src="https://raw.githubusercontent.com/crs4/rocrate-validator/develop/docs/img/eu-logo/EN_Co-fundedbytheEU_RGB_POS.png"
|
|
127
|
+
width="250" align="right"/>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "roc-validator"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "A Python package to validate RO-Crates"
|
|
5
|
+
authors = [
|
|
6
|
+
"Marco Enrico Piras <kikkomep@crs4.it>",
|
|
7
|
+
"Luca Pireddu <luca.pireddu@crs4.it>",
|
|
8
|
+
"Simone Leo <simleo@crs4.it>",
|
|
9
|
+
]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
packages = [{ include = "rocrate_validator", from = "." }]
|
|
12
|
+
include = [
|
|
13
|
+
{ path = "pyproject.toml", format = [
|
|
14
|
+
"sdist",
|
|
15
|
+
"wheel",
|
|
16
|
+
] },
|
|
17
|
+
{ path = "README.md", format = [
|
|
18
|
+
"sdist",
|
|
19
|
+
"wheel",
|
|
20
|
+
] },
|
|
21
|
+
{ path = "LICENSE", format = [
|
|
22
|
+
"sdist",
|
|
23
|
+
"wheel",
|
|
24
|
+
] }
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.poetry.dependencies]
|
|
28
|
+
python = "^3.8.1"
|
|
29
|
+
rdflib = "^7.0.0"
|
|
30
|
+
pyshacl = "^0.26.0"
|
|
31
|
+
click = "^8.1.7"
|
|
32
|
+
rich = "^13.8.0"
|
|
33
|
+
toml = "^0.10.2"
|
|
34
|
+
rich-click = "^1.8.3"
|
|
35
|
+
colorlog = "^6.8"
|
|
36
|
+
requests = "^2.32.3"
|
|
37
|
+
requests-cache = "^1.2.1"
|
|
38
|
+
inquirerpy = "^0.3.4"
|
|
39
|
+
|
|
40
|
+
[tool.poetry.group.dev.dependencies]
|
|
41
|
+
pyproject-flake8 = "^6.1.0"
|
|
42
|
+
pylint = "^3.1.0"
|
|
43
|
+
ipykernel = "^6.29.3"
|
|
44
|
+
|
|
45
|
+
[tool.poetry.group.test.dependencies]
|
|
46
|
+
pytest-cov = "^5.0.0"
|
|
47
|
+
pytest-xdist = "^3.6.1"
|
|
48
|
+
|
|
49
|
+
[tool.flake8]
|
|
50
|
+
max-line-length = 120
|
|
51
|
+
|
|
52
|
+
[build-system]
|
|
53
|
+
requires = ["poetry-core"]
|
|
54
|
+
build-backend = "poetry.core.masonry.api"
|
|
55
|
+
|
|
56
|
+
[tool.poetry.scripts]
|
|
57
|
+
rocrate-validator = "rocrate_validator.cli:cli"
|
|
58
|
+
|
|
59
|
+
[tool.rocrate_validator]
|
|
60
|
+
skip_dirs = [".git", ".github", ".vscode"]
|
|
61
|
+
|
|
62
|
+
[tool.pytest.ini_options]
|
|
63
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright (c) 2024 CRS4
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
def get_version():
|
|
16
|
+
from rocrate_validator.utils import get_version
|
|
17
|
+
return get_version()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__version__ = get_version()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright (c) 2024 CRS4
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .commands import profiles, validate
|
|
16
|
+
from .main import cli
|
|
17
|
+
|
|
18
|
+
__all__ = ["cli", "profiles", "validate"]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Copyright (c) 2024 CRS4
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
import sys
|
|
16
|
+
import textwrap
|
|
17
|
+
|
|
18
|
+
from rich.console import Console
|
|
19
|
+
|
|
20
|
+
import rocrate_validator.log as logging
|
|
21
|
+
from rocrate_validator.errors import InvalidProfilePath, ProfileNotFound, ProfilesDirectoryNotFound
|
|
22
|
+
|
|
23
|
+
# Create a logger for this module
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def handle_error(e: Exception, console: Console) -> None:
|
|
28
|
+
error_message = ""
|
|
29
|
+
if isinstance(e, ProfilesDirectoryNotFound):
|
|
30
|
+
error_message = f"""
|
|
31
|
+
The profile folder could not be located at the specified path: [red]{e.profiles_path}[/red].
|
|
32
|
+
Please ensure that the path is correct and try again.
|
|
33
|
+
"""
|
|
34
|
+
elif isinstance(e, ProfileNotFound):
|
|
35
|
+
error_message = f"""The profile with the identifier "[red bold]{e.profile_name}[/red bold]" could not be found.
|
|
36
|
+
Please ensure that the profile exists and try again.
|
|
37
|
+
|
|
38
|
+
To see the available profiles, run:
|
|
39
|
+
[cyan bold]rocrate-validator profiles list[/cyan bold]
|
|
40
|
+
"""
|
|
41
|
+
elif isinstance(e, InvalidProfilePath):
|
|
42
|
+
error_message = f"""The profile path "[red bold]{e.profile_path}[/red bold]" is not valid.
|
|
43
|
+
Please ensure that the profile exists and try again.
|
|
44
|
+
|
|
45
|
+
To see the available profiles, run:
|
|
46
|
+
[cyan bold]rocrate-validator profiles list[/cyan bold]
|
|
47
|
+
"""
|
|
48
|
+
else:
|
|
49
|
+
error_message = f"\n\n[bold][[red]FAILED[/red]] Unexpected error: {e} !!![/bold]\n"
|
|
50
|
+
if logger.isEnabledFor(logging.DEBUG):
|
|
51
|
+
console.print_exception()
|
|
52
|
+
console.print(textwrap.indent("This error may be due to a bug.\n"
|
|
53
|
+
"Please report it to the issue tracker "
|
|
54
|
+
"along with the following stack trace:\n", ' ' * 9))
|
|
55
|
+
console.print_exception()
|
|
56
|
+
|
|
57
|
+
console.print(f"\n\n[bold][[red]ERROR[/red]] {error_message}[/bold]\n", style="white")
|
|
58
|
+
sys.exit(2)
|