-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
475 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "roc-validator" | ||
version = "0.4.3" | ||
version = "0.4.4" | ||
description = "A Python package to validate RO-Crates" | ||
authors = [ | ||
"Marco Enrico Piras <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...valid/0_file_descriptor_format/invalid_jsonld_format/not_flattened/ro-crate-metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"@context": "https://w3id.org/ro/crate/1.1/context", | ||
"@graph": [ | ||
{ | ||
"@type": "CreativeWork", | ||
"@id": "ro-crate-metadata.json", | ||
"conformsTo": { | ||
"@id": "https://w3id.org/ro/crate/1.1" | ||
}, | ||
"about": { | ||
"@type": "Dataset", | ||
"@id": "./", | ||
"hasPart": [ | ||
{ | ||
"@type": "File", | ||
"@id": "test.csv", | ||
"encodingFormat": "text/csv", | ||
"name": "This is a test file", | ||
"description": "This is a test dataset" | ||
} | ||
], | ||
"name": "This is a test dataset", | ||
"description": "This is a test dataset", | ||
"license": { | ||
"@id": "https://creativecommons.org/licenses/by/4.0/" | ||
}, | ||
"datePublished": "2024-11-05" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@prefix dct: <http://purl.org/dc/terms/> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix ro: <./> . | ||
@prefix schema_org: <http://schema.org/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix validator: <https://github.com/crs4/rocrate-validator/> . | ||
@prefix xml1: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
ro:A | ||
a sh:NodeShape, validator:HiddenShape ; | ||
sh:name "A" ; | ||
sh:description "This is the requirement A" ; | ||
sh:targetNode ro:ro-crate-metadata.json ; | ||
sh:property [ | ||
a sh:PropertyShape ; | ||
sh:name "A_0" ; | ||
sh:description "Check A_0: no sh:severity declared" ; | ||
sh:path rdf:type ; | ||
sh:minCount 1 ; | ||
] ; | ||
sh:property [ | ||
a sh:PropertyShape ; | ||
sh:name "A_1" ; | ||
sh:description "Check A_1: sh:severity set to sh:Violation" ; | ||
sh:path rdf:type ; | ||
sh:minCount 1 ; | ||
sh:severity sh:Violation ; | ||
] ; | ||
sh:property [ | ||
a sh:PropertyShape ; | ||
sh:name "A_2" ; | ||
sh:description "Check A_2: sh:severity set to sh:Warning" ; | ||
sh:path rdf:type ; | ||
sh:minCount 1 ; | ||
sh:severity sh:Warning ; | ||
] ; | ||
sh:property [ | ||
a sh:PropertyShape ; | ||
sh:name "A_3" ; | ||
sh:description "Check A_3: sh:severity set to sh:Info" ; | ||
sh:path rdf:type ; | ||
sh:minCount 1 ; | ||
sh:severity sh:Info ; | ||
] . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) 2024 CRS4 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import rocrate_validator.log as logging | ||
from rocrate_validator.models import Severity, ValidationContext | ||
from rocrate_validator.requirements.python import (PyFunctionCheck, check, | ||
requirement) | ||
|
||
# set up logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@requirement(name="B", hidden=True) | ||
class BH(PyFunctionCheck): | ||
""" | ||
Test requirement outside requirement level folder | ||
""" | ||
|
||
@check(name="B_0") | ||
def check_b0(self, context: ValidationContext) -> bool: | ||
"""Check B_0: no requirement level""" | ||
return True | ||
|
||
@check(name="B_1", severity=Severity.REQUIRED) | ||
def check_b1(self, context: ValidationContext) -> bool: | ||
"""Check B_1: REQUIRED requirement level""" | ||
return True | ||
|
||
@check(name="B_2", severity=Severity.RECOMMENDED) | ||
def check_b2(self, context: ValidationContext) -> bool: | ||
"""Check B_2: RECOMMENDED requirement level""" | ||
return True | ||
|
||
@check(name="B_3", severity=Severity.OPTIONAL) | ||
def check_b3(self, context: ValidationContext) -> bool: | ||
"""Check B_3: OPTIONAL requirement level""" | ||
return True |
Oops, something went wrong.