spdx-3-model
spdx-3-model copied to clipboard
packageVerificationCodeExcludedFile must be a relative path
From packageVerificationCodeExcludedFile:
Every filename is preceded with a ./
Suggested SHACL shapes:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spdxcore: <https://spdx.org/rdf/3.0.1/terms/Core/> .
spdxcore:PackageVerificationCodeExcludedFileShape
a sh:PropertyShape ;
sh:targetSubjectsOf spdxcore:packageVerificationCodeExcludedFile ;
sh:datatype xsd:string ;
sh:nodeKind sh:Literal ;
sh:path spdxcore:packageVerificationCodeExcludedFile ;
sh:pattern "^\\./" ;
sh:message "The filename must be a relative path preceded with a \"./\""@en .
Test data:
@prefix ex: <http://example.org/ns#> .
@prefix spdxcore: <https://spdx.org/rdf/3.0.1/terms/Core/> .
@prefix spdxhashalgo: <https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/> .
ex:ValidFilepath
a spdxcore:PackageVerificationCode ;
spdxcore:algorithm spdxhashalgo:md5 ;
spdxcore:hashValue "d41d8cd98f00b204e9800998ecf8427e" ;
spdxcore:packageVerificationCodeExcludedFile "./path/to/file" .
ex:InvalidFilepath
a spdxcore:PackageVerificationCode ;
spdxcore:algorithm spdxhashalgo:md5 ;
spdxcore:hashValue "d41d8cd98f00b204e9800998ecf8427e" ;
spdxcore:packageVerificationCodeExcludedFile "/path/to/file" .
Test script: https://raw.githubusercontent.com/condots/dots/refs/heads/main/scripts/shacl/test.py
Test results:
----------------------------------------------------------------------------------------------------
Severity: sh:Violation
Source Shape: spdxcore:PackageVerificationCodeExcludedFileShape
Focus Node: ex:InvalidFilepath
Value Node: /path/to/file
Result Path: spdxcore:packageVerificationCodeExcludedFile
Message: The packageVerificationCodeExcludedFile must be a relative path preceded with a "./"
----------------------------------------------------------------------------------------------------
Found 1 SHACL violations!