Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

packageVerificationCodeExcludedFile must be a relative path #980

Open
ilans opened this issue Mar 3, 2025 · 0 comments
Open

packageVerificationCodeExcludedFile must be a relative path #980

ilans opened this issue Mar 3, 2025 · 0 comments
Labels
Profile:Core Core Profile and related matters RDF/OWL/SHACL RDF graph, schema, ontology, constraint
Milestone

Comments

@ilans
Copy link
Collaborator

ilans commented Mar 3, 2025

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!
@ilans ilans added Profile:Core Core Profile and related matters RDF/OWL/SHACL RDF graph, schema, ontology, constraint labels Mar 3, 2025
@ilans ilans added this to the 3.1 milestone Mar 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Profile:Core Core Profile and related matters RDF/OWL/SHACL RDF graph, schema, ontology, constraint
Projects
None yet
Development

No branches or pull requests

1 participant