diff --git a/spec_parser/model.py b/spec_parser/model.py index 9194d3d..dac5dd3 100644 --- a/spec_parser/model.py +++ b/spec_parser/model.py @@ -154,6 +154,7 @@ class Class: "Instantiability", "name", "SubclassOf", + "NodeKind", ) VALID_PROP_METADATA = ( "maxCount", diff --git a/spec_parser/rdf.py b/spec_parser/rdf.py index 15fe4fe..4f52b6f 100644 --- a/spec_parser/rdf.py +++ b/spec_parser/rdf.py @@ -68,6 +68,11 @@ def gen_rdf_ontology(model): pns = "" if parent.startswith("/") else f"/{c.ns.name}/" p = model.classes[pns+parent] g.add((node, RDFS.subClassOf, URIRef(p.iri))) + + node_kind = c.metadata.get("NodeKind") + if node_kind: + g.add((node, SH.nodeKind, getattr(SH, node_kind))) + for p in c.properties: fqprop = c.properties[p]["fqname"] if fqprop == "/Core/spdxId":