We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From DictionaryEntry:
To implement a dictionary, this class is to be used in a collection with unique keys.
Suggested SHACL shapes:
@prefix sh: <http://www.w3.org/ns/shacl#> . @prefix spdxbuild: <https://spdx.org/rdf/3.0.1/terms/Build/> . spdxbuild:Build sh:sparql [ sh:select """ SELECT ?this ?property ?key (CONCAT('Duplicate key "', ?key, '" found in property "', STR(?property), '"') AS ?value) WHERE { ?this ?property ?entry . ?entry a spdxcore:DictionaryEntry ; spdxcore:key ?key . FILTER ( EXISTS { ?this ?property ?other . ?other a spdxcore:DictionaryEntry ; spdxcore:key ?key . FILTER(?other != ?entry) } ) } GROUP BY ?this ?property ?key """ ; sh:message "{?value}" ; ] .
Test data:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix spdxcore: <https://spdx.org/rdf/3.0.1/terms/Core/> . @prefix spdxbuild: <https://spdx.org/rdf/3.0.1/terms/Build/> . @prefix ex: <http://example.org/ns#> . ex:MyAgent a spdxcore:Agent ; spdxcore:creationInfo _:MyCreationInfo . _:MyCreationInfo a spdxcore:CreationInfo ; spdxcore:createdBy ex:MyAgent ; spdxcore:created "2024-09-04T20:25:34Z"^^xsd:dateTimeStamp ; spdxcore:specVersion "3.0.1" . _:Entry1 a spdxcore:DictionaryEntry ; spdxcore:key "key1" ; spdxcore:value "value" ; spdxcore:creationInfo _:MyCreationInfo . _:Entry2 a spdxcore:DictionaryEntry ; spdxcore:key "key2" ; spdxcore:value "value" ; spdxcore:creationInfo _:MyCreationInfo . _:Entry3 a spdxcore:DictionaryEntry ; spdxcore:key "key1" ; spdxcore:value "value" ; spdxcore:creationInfo _:MyCreationInfo . ex:ValidBuildWithUniqueKeys a spdxbuild:Build ; spdxbuild:buildType "http://fake-build-type"^^xsd:anyURI ; spdxcore:creationInfo _:MyCreationInfo ; spdxbuild:environment _:Entry1 ; # key1 spdxbuild:environment _:Entry2 ; # key2 spdxbuild:parameter _:Entry1 ; # key1 spdxbuild:parameter _:Entry2 . # key2 ex:InvalidBuildWithDuplicateParameterKeys a spdxbuild:Build ; spdxbuild:buildType "http://fake-build-type"^^xsd:anyURI ; spdxcore:creationInfo _:MyCreationInfo ; spdxbuild:environment _:Entry1 ; # key1 spdxbuild:environment _:Entry2 ; # key2 spdxbuild:parameter _:Entry1 ; # key1 spdxbuild:parameter _:Entry3 . # key1 ex:InvalidBuildWithDuplicateEnvironmentKeys a spdxbuild:Build ; spdxbuild:buildType "http://fake-build-type"^^xsd:anyURI ; spdxcore:creationInfo _:MyCreationInfo ; spdxbuild:environment _:Entry1 ; # key1 spdxbuild:environment _:Entry3 ; # key1 spdxbuild:parameter _:Entry1 ; # key1 spdxbuild:parameter _:Entry2 . # key2
Test script: https://raw.githubusercontent.com/condots/dots/refs/heads/main/scripts/shacl/test.py
Test results:
---------------------------------------------------------------------------------------------------- Violation message: Duplicate key "key1" found in property "https://spdx.org/rdf/3.0.1/terms/Build/parameter" Violation constraint: SPARQLConstraintComponent Violation value: Duplicate key "key1" found in property "https://spdx.org/rdf/3.0.1/terms/Build/parameter" Property path: None Focus node: http://example.org/ns#InvalidBuildWithDuplicateParameterKeys ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- Violation message: Duplicate key "key1" found in property "https://spdx.org/rdf/3.0.1/terms/Build/environment" Violation constraint: SPARQLConstraintComponent Violation value: Duplicate key "key1" found in property "https://spdx.org/rdf/3.0.1/terms/Build/environment" Property path: None Focus node: http://example.org/ns#InvalidBuildWithDuplicateEnvironmentKeys ----------------------------------------------------------------------------------------------------
The text was updated successfully, but these errors were encountered:
No branches or pull requests
From DictionaryEntry:
Suggested SHACL shapes:
Test data:
Test script:
https://raw.githubusercontent.com/condots/dots/refs/heads/main/scripts/shacl/test.py
Test results:
The text was updated successfully, but these errors were encountered: