Skip to content

Commit d37f8ae

Browse files
fholgerarmintaenzertng
authored andcommitted
If in doubt, prefer core properties in jsonld context
Signed-off-by: Holger Frydrych <holger.frydrych@tngtech.com>
1 parent d6635fc commit d37f8ae

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/spdx_tools/spdx3/validation/json_ld/shacl_validation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
# SPDX-License-Identifier: Apache-2.0
44
from typing import Optional
55

6-
import owlrl
76
from pyshacl import validate
8-
from rdflib import Graph, RDF
7+
from rdflib import Graph
98

109

1110
def validate_against_shacl_from_file(

src/spdx_tools/spdx3/writer/json_ld/context.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
"@type": "xsd:anyURI"
275275
},
276276
"locator": {
277-
"@id": "security:locator",
277+
"@id": "core:locator",
278278
"@type": "xsd:anyURI"
279279
},
280280
"namespace": {
@@ -351,7 +351,7 @@
351351
"@type": "xsd:string"
352352
},
353353
"suppliedBy": {
354-
"@id": "security:suppliedBy",
354+
"@id": "core:suppliedBy",
355355
"@type": "@id"
356356
},
357357
"to": {

src/spdx_tools/spdx3/writer/json_ld/owl_to_context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ def convert_spdx_owl_to_jsonld_context(spdx_owl: str = "SPDX_OWL.json"):
6262
elif node_type in ["owl:DatatypeProperty", "owl:ObjectProperty"]:
6363
name = node["@id"].split(":")[-1]
6464
type_id = node["rdfs:range"]["@id"]
65+
66+
if name in context_dict and context_dict[name]["@id"].startswith('core'):
67+
# if in doubt, prioritize core properties
68+
continue
69+
6570
if name in PROPERTIES_WITH_ENUM_RANGE:
6671
if name == "profile":
6772
# FIXME: since the allowed values for the profile enum collide with

0 commit comments

Comments
 (0)