From f96dbf4d147e597d840bf0af77414c77a64e943b Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Thu, 24 Jul 2025 12:31:17 +0100 Subject: [PATCH 1/5] Use MAJOR.MINOR version for RDF URLs Signed-off-by: Arthit Suriyawongkul --- bin/check-examples.sh | 7 ++++--- examples/jsonld/package_sbom.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/check-examples.sh b/bin/check-examples.sh index 5f74bdeef521..93d808e84637 100755 --- a/bin/check-examples.sh +++ b/bin/check-examples.sh @@ -9,9 +9,10 @@ set -e THIS_DIR="$(dirname "$0")" SPDX_VERSION="3.0.1" -SCHEMA_URL="https://spdx.org/schema/${SPDX_VERSION}/spdx-json-schema.json" -RDF_URL="https://spdx.org/rdf/${SPDX_VERSION}/spdx-model.ttl" -CONTEXT_URL="https://spdx.org/rdf/${SPDX_VERSION}/spdx-context.jsonld" +SPDX_VERSION_MAJOR_MINOR="$(echo "$SPDX_VERSION" | cut -d. -f1,2)" # "3.0" for 3.0.1; "3.0" for 3.0 +SCHEMA_URL="https://spdx.org/schema/${SPDX_VERSION_MAJOR_MINOR}/spdx-json-schema.json" +RDF_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-model.ttl" +CONTEXT_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-context.jsonld" check_schema() { check-jsonschema \ diff --git a/examples/jsonld/package_sbom.json b/examples/jsonld/package_sbom.json index 7af7e9a68ff8..44c1eecc65f4 100644 --- a/examples/jsonld/package_sbom.json +++ b/examples/jsonld/package_sbom.json @@ -1,5 +1,5 @@ { - "@context": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld", + "@context": "https://spdx.org/rdf/3.0/spdx-context.jsonld", "@graph": [ { "type": "CreationInfo", From ef48349e45538143e05d4df89491f8af723254e3 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Thu, 24 Jul 2025 12:34:21 +0100 Subject: [PATCH 2/5] Update comment Signed-off-by: Arthit Suriyawongkul --- bin/check-examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check-examples.sh b/bin/check-examples.sh index 93d808e84637..d65b810b2598 100755 --- a/bin/check-examples.sh +++ b/bin/check-examples.sh @@ -9,7 +9,7 @@ set -e THIS_DIR="$(dirname "$0")" SPDX_VERSION="3.0.1" -SPDX_VERSION_MAJOR_MINOR="$(echo "$SPDX_VERSION" | cut -d. -f1,2)" # "3.0" for 3.0.1; "3.0" for 3.0 +SPDX_VERSION_MAJOR_MINOR="$(echo "$SPDX_VERSION" | cut -d. -f1,2)" # 3.0.1 -> 3.0; 3.0 -> 3.0 SCHEMA_URL="https://spdx.org/schema/${SPDX_VERSION_MAJOR_MINOR}/spdx-json-schema.json" RDF_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-model.ttl" CONTEXT_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-context.jsonld" From 405d7b7bb325d5f22041cbd758bd9c6a06edcf2e Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Mon, 19 Jan 2026 21:02:48 +0000 Subject: [PATCH 3/5] Revise comments for SPDX versioning update Add something to trigger the CI. Signed-off-by: Arthit Suriyawongkul --- bin/check-examples.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/check-examples.sh b/bin/check-examples.sh index d65b810b2598..0d150fcc5423 100755 --- a/bin/check-examples.sh +++ b/bin/check-examples.sh @@ -4,6 +4,12 @@ # documentation # # SPDX-License-Identifier: MIT +# +# It was the case that we use MAJOR.MINOR.PATCH (3-part) version number +# (e.g., "3.0.1") in IRI of terms and RDF files. +# With ISO submission of SPDX 3.0 in December 2025, we decided to use MAJOR.MINOR +# (2-part) version number (e.g., "3.0") instead. +# This needs update in RDF files, tools, publication CI, and IRI redirections. set -e From 047d3add8167ec2f309439a07c3e553eca48c3c3 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Mon, 19 Jan 2026 21:17:19 +0000 Subject: [PATCH 4/5] Use spdx3-validate instead of pyshacl Also print all URLs to assist debugging Signed-off-by: Arthit Suriyawongkul --- bin/check-examples.sh | 64 +++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/bin/check-examples.sh b/bin/check-examples.sh index 0d150fcc5423..5e228f5e9c2e 100755 --- a/bin/check-examples.sh +++ b/bin/check-examples.sh @@ -4,6 +4,7 @@ # documentation # # SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: Copyright 2024-2026 The SPDX Contributors # # It was the case that we use MAJOR.MINOR.PATCH (3-part) version number # (e.g., "3.0.1") in IRI of terms and RDF files. @@ -13,44 +14,63 @@ set -e -THIS_DIR="$(dirname "$0")" SPDX_VERSION="3.0.1" + +THIS_DIR="$(dirname "$0")" +MD_DIR=docs/annexes +JSON_DIR=examples/jsonld + SPDX_VERSION_MAJOR_MINOR="$(echo "$SPDX_VERSION" | cut -d. -f1,2)" # 3.0.1 -> 3.0; 3.0 -> 3.0 SCHEMA_URL="https://spdx.org/schema/${SPDX_VERSION_MAJOR_MINOR}/spdx-json-schema.json" RDF_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-model.ttl" CONTEXT_URL="https://spdx.org/rdf/${SPDX_VERSION_MAJOR_MINOR}/spdx-context.jsonld" +# print validation setup +echo "Checking examples in" +echo "Snippets : $MD_DIR" +echo "Files : $JSON_DIR" +echo "SPDX version : $SPDX_VERSION" +echo "(major.minor) : $SPDX_VERSION_MAJOR_MINOR" +echo "Schema : $SCHEMA_URL" +echo "Schema resolved : $(curl -I "$SCHEMA_URL" 2>/dev/null | grep -i "location:" | awk '{print $2}')" +echo "RDF : $RDF_URL" +echo "RDF resolved : $(curl -I "$RDF_URL" 2>/dev/null | grep -i "location:" | awk '{print $2}')" +echo "Context : $CONTEXT_URL" +echo "Context resolved : $(curl -I "$CONTEXT_URL" 2>/dev/null | grep -i "location:" | awk '{print $2}')" +echo "$(check-jsonschema --version)" +echo "spdx3-validate version: $(spdx3-validate --version)" +echo "" + check_schema() { + echo "Checking schema (check-jsonschema): $1" check-jsonschema \ - -v \ + --verbose \ --schemafile $SCHEMA_URL \ "$1" } -check_model() { - pyshacl \ - -s $RDF_URL \ - -e $RDF_URL \ - "$1" +check_spdx() { + echo "SPDX 3 Validating (spdx3-validate): $1" + spdx3-validate --json $1 } # Check examples in JSON files in examples/jsonld/ -if [ "$(ls $THIS_DIR/../examples/jsonld/*.json 2>/dev/null)" ]; then - for f in $THIS_DIR/../examples/jsonld/*.json; do - echo "Checking $f" +if [ "$(ls $THIS_DIR/../$JSON_DIR/*.json 2>/dev/null)" ]; then + for f in $THIS_DIR/../$JSON_DIR/*.json; do check_schema $f - check_model $f + echo "" + check_spdx $f + echo "" done fi -TEMP=$(mktemp -d) - # Check examples in inline code snippets in Markdown files in docs/annexes/ -for f in $THIS_DIR/../docs/annexes/*.md; do +TEMP=$(mktemp -d) +for f in $THIS_DIR/../$MD_DIR/*.md; do if ! grep -q '^```json' $f; then continue fi - echo "Checking $f" + echo "Extract snippets from $f" DEST=$TEMP/$(basename $f) mkdir -p $DEST @@ -58,7 +78,8 @@ for f in $THIS_DIR/../docs/annexes/*.md; do cat $f | awk -v DEST="$DEST" 'BEGIN{flag=0} /^```json/, $0=="```" { if (/^---$/){flag++} else if ($0 !~ /^```.*/ ) print $0 > DEST "/doc-" flag ".spdx.json"}' # Combine all JSON code snippets into a single file, with SPDX context and creation info. - echo "[" > $DEST/combined.json + COMBINED_JSON = $DEST/__combined.jso + echo "[" > $COMBINED_JSON for doc in $DEST/*.spdx.json; do if ! grep -q '@context' $doc; then @@ -88,11 +109,12 @@ HEREDOC HEREDOC fi check_schema $doc - cat $doc >> $DEST/combined.json - echo "," >> $DEST/combined.json + echo "" + cat $doc >> $COMBINED_JSON + echo "," >> $COMBINED_JSON done - echo "{}]" >> $DEST/combined.json - - check_model $DEST/combined.json + echo "{}]" >> $COMBINED_JSON + check_spdx $COMBINED_JSON + echo "" done From aed04783cbf6445c7dbe6996d40512338c6170e4 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Thu, 9 Jul 2026 23:35:30 +0100 Subject: [PATCH 5/5] Drop minor.patch from term base IRI Signed-off-by: Arthit Suriyawongkul --- serialization/jsonld/annotations.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serialization/jsonld/annotations.ttl b/serialization/jsonld/annotations.ttl index 5e3297df3d3a..7692454e0716 100644 --- a/serialization/jsonld/annotations.ttl +++ b/serialization/jsonld/annotations.ttl @@ -1,4 +1,4 @@ -@base . +@base . @prefix sh-to-code: . ;