diff options
-rw-r--r-- | meta/lib/oe/sbom30.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/spdx30.py | 146 |
2 files changed, 85 insertions, 63 deletions
diff --git a/meta/lib/oe/sbom30.py b/meta/lib/oe/sbom30.py index 7993e1fbef..f7c4b323d5 100644 --- a/meta/lib/oe/sbom30.py +++ b/meta/lib/oe/sbom30.py | |||
@@ -495,7 +495,7 @@ class ObjectSet(oe.spdx30.SHACLObjectSet): | |||
495 | return [] | 495 | return [] |
496 | 496 | ||
497 | if not to: | 497 | if not to: |
498 | to = [oe.spdx30.Element.NoneElement] | 498 | to = [oe.spdx30.IndividualElement.NoneElement] |
499 | 499 | ||
500 | ret = [] | 500 | ret = [] |
501 | 501 | ||
diff --git a/meta/lib/oe/spdx30.py b/meta/lib/oe/spdx30.py index 5cd2eb45c3..cd97eebd18 100644 --- a/meta/lib/oe/spdx30.py +++ b/meta/lib/oe/spdx30.py | |||
@@ -133,8 +133,9 @@ class DateTimeProp(Property): | |||
133 | if value.utcoffset() is None: | 133 | if value.utcoffset() is None: |
134 | value = value.astimezone() | 134 | value = value.astimezone() |
135 | offset = value.utcoffset() | 135 | offset = value.utcoffset() |
136 | if offset % timedelta(minutes=1): | 136 | seconds = offset % timedelta(minutes=-1 if offset.total_seconds() < 0 else 1) |
137 | offset = offset - (offset % timedelta(minutes=1)) | 137 | if seconds: |
138 | offset = offset - seconds | ||
138 | value = value.replace(tzinfo=timezone(offset)) | 139 | value = value.replace(tzinfo=timezone(offset)) |
139 | value = value.replace(microsecond=0) | 140 | value = value.replace(microsecond=0) |
140 | return value | 141 | return value |
@@ -922,6 +923,12 @@ class SHACLExtensibleObject(object): | |||
922 | return obj | 923 | return obj |
923 | 924 | ||
924 | def _decode_properties(self, decoder, objectset=None): | 925 | def _decode_properties(self, decoder, objectset=None): |
926 | def decode_value(d): | ||
927 | if not d.is_list(): | ||
928 | return d.read_value() | ||
929 | |||
930 | return [decode_value(val_d) for val_d in d.read_list()] | ||
931 | |||
925 | if self.CLOSED: | 932 | if self.CLOSED: |
926 | super()._decode_properties(decoder, objectset=objectset) | 933 | super()._decode_properties(decoder, objectset=objectset) |
927 | return | 934 | return |
@@ -936,7 +943,7 @@ class SHACLExtensibleObject(object): | |||
936 | ) | 943 | ) |
937 | 944 | ||
938 | with decoder.read_property(key) as prop_d: | 945 | with decoder.read_property(key) as prop_d: |
939 | self.__dict__["_obj_data"][key] = prop_d.read_value() | 946 | self.__dict__["_obj_data"][key] = decode_value(prop_d) |
940 | 947 | ||
941 | def _encode_properties(self, encoder, state): | 948 | def _encode_properties(self, encoder, state): |
942 | def encode_value(encoder, v): | 949 | def encode_value(encoder, v): |
@@ -948,6 +955,11 @@ class SHACLExtensibleObject(object): | |||
948 | encoder.write_integer(v) | 955 | encoder.write_integer(v) |
949 | elif isinstance(v, float): | 956 | elif isinstance(v, float): |
950 | encoder.write_float(v) | 957 | encoder.write_float(v) |
958 | elif isinstance(v, list): | ||
959 | with encoder.write_list() as list_s: | ||
960 | for i in v: | ||
961 | with list_s.write_list_item() as item_s: | ||
962 | encode_value(item_s, i) | ||
951 | else: | 963 | else: |
952 | raise TypeError( | 964 | raise TypeError( |
953 | f"Unsupported serialized type {type(v)} with value '{v}'" | 965 | f"Unsupported serialized type {type(v)} with value '{v}'" |
@@ -1197,7 +1209,7 @@ class SHACLObjectSet(object): | |||
1197 | 1209 | ||
1198 | return SHACLObjectSet(new_objects, link=True) | 1210 | return SHACLObjectSet(new_objects, link=True) |
1199 | 1211 | ||
1200 | def encode(self, encoder, force_list=False): | 1212 | def encode(self, encoder, force_list=False, *, key=None): |
1201 | """ | 1213 | """ |
1202 | Serialize a list of objects to a serialization encoder | 1214 | Serialize a list of objects to a serialization encoder |
1203 | 1215 | ||
@@ -1244,7 +1256,7 @@ class SHACLObjectSet(object): | |||
1244 | else: | 1256 | else: |
1245 | objects = list(self.objects) | 1257 | objects = list(self.objects) |
1246 | 1258 | ||
1247 | objects.sort() | 1259 | objects.sort(key=key) |
1248 | 1260 | ||
1249 | if use_list: | 1261 | if use_list: |
1250 | # Ensure top level objects are only written in the top level graph | 1262 | # Ensure top level objects are only written in the top level graph |
@@ -1265,7 +1277,7 @@ class SHACLObjectSet(object): | |||
1265 | with list_s.write_list_item() as item_s: | 1277 | with list_s.write_list_item() as item_s: |
1266 | o.encode(item_s, state) | 1278 | o.encode(item_s, state) |
1267 | 1279 | ||
1268 | else: | 1280 | elif objects: |
1269 | objects[0].encode(encoder, state) | 1281 | objects[0].encode(encoder, state) |
1270 | 1282 | ||
1271 | def decode(self, decoder): | 1283 | def decode(self, decoder): |
@@ -1410,6 +1422,15 @@ class Decoder(ABC): | |||
1410 | pass | 1422 | pass |
1411 | 1423 | ||
1412 | @abstractmethod | 1424 | @abstractmethod |
1425 | def is_list(self): | ||
1426 | """ | ||
1427 | Checks if the next item is a list | ||
1428 | |||
1429 | Returns True if the next item is a list, or False if it is a scalar | ||
1430 | """ | ||
1431 | pass | ||
1432 | |||
1433 | @abstractmethod | ||
1413 | def read_object(self): | 1434 | def read_object(self): |
1414 | """ | 1435 | """ |
1415 | Consume next item as an object | 1436 | Consume next item as an object |
@@ -1507,12 +1528,15 @@ class JSONLDDecoder(Decoder): | |||
1507 | return None | 1528 | return None |
1508 | 1529 | ||
1509 | def read_list(self): | 1530 | def read_list(self): |
1510 | if isinstance(self.data, (list, tuple, set)): | 1531 | if self.is_list(): |
1511 | for v in self.data: | 1532 | for v in self.data: |
1512 | yield self.__class__(v) | 1533 | yield self.__class__(v) |
1513 | else: | 1534 | else: |
1514 | yield self | 1535 | yield self |
1515 | 1536 | ||
1537 | def is_list(self): | ||
1538 | return isinstance(self.data, (list, tuple, set)) | ||
1539 | |||
1516 | def __get_value(self, *keys): | 1540 | def __get_value(self, *keys): |
1517 | for k in keys: | 1541 | for k in keys: |
1518 | if k and k in self.data: | 1542 | if k and k in self.data: |
@@ -1962,18 +1986,11 @@ CONTEXT_URLS = [ | |||
1962 | 1986 | ||
1963 | 1987 | ||
1964 | # CLASSES | 1988 | # CLASSES |
1965 | @register("http://spdx.invalid./AbstractClass", abstract=False) | ||
1966 | class http_spdx_invalid_AbstractClass(SHACLObject): | ||
1967 | NODE_KIND = NodeKind.BlankNodeOrIRI | ||
1968 | NAMED_INDIVIDUALS = { | ||
1969 | } | ||
1970 | |||
1971 | |||
1972 | # A class for describing the energy consumption incurred by an AI model in | 1989 | # A class for describing the energy consumption incurred by an AI model in |
1973 | # different stages of its lifecycle. | 1990 | # different stages of its lifecycle. |
1974 | @register("https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumption", compact_type="ai_EnergyConsumption", abstract=False) | 1991 | @register("https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumption", compact_type="ai_EnergyConsumption", abstract=False) |
1975 | class ai_EnergyConsumption(SHACLObject): | 1992 | class ai_EnergyConsumption(SHACLObject): |
1976 | NODE_KIND = NodeKind.BlankNode | 1993 | NODE_KIND = NodeKind.BlankNodeOrIRI |
1977 | NAMED_INDIVIDUALS = { | 1994 | NAMED_INDIVIDUALS = { |
1978 | } | 1995 | } |
1979 | 1996 | ||
@@ -2010,7 +2027,7 @@ class ai_EnergyConsumption(SHACLObject): | |||
2010 | # used for measurement. | 2027 | # used for measurement. |
2011 | @register("https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumptionDescription", compact_type="ai_EnergyConsumptionDescription", abstract=False) | 2028 | @register("https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumptionDescription", compact_type="ai_EnergyConsumptionDescription", abstract=False) |
2012 | class ai_EnergyConsumptionDescription(SHACLObject): | 2029 | class ai_EnergyConsumptionDescription(SHACLObject): |
2013 | NODE_KIND = NodeKind.BlankNode | 2030 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2014 | NAMED_INDIVIDUALS = { | 2031 | NAMED_INDIVIDUALS = { |
2015 | } | 2032 | } |
2016 | 2033 | ||
@@ -2093,7 +2110,7 @@ class AnnotationType(SHACLObject): | |||
2093 | # Provides information about the creation of the Element. | 2110 | # Provides information about the creation of the Element. |
2094 | @register("https://spdx.org/rdf/3.0.1/terms/Core/CreationInfo", compact_type="CreationInfo", abstract=False) | 2111 | @register("https://spdx.org/rdf/3.0.1/terms/Core/CreationInfo", compact_type="CreationInfo", abstract=False) |
2095 | class CreationInfo(SHACLObject): | 2112 | class CreationInfo(SHACLObject): |
2096 | NODE_KIND = NodeKind.BlankNode | 2113 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2097 | NAMED_INDIVIDUALS = { | 2114 | NAMED_INDIVIDUALS = { |
2098 | } | 2115 | } |
2099 | 2116 | ||
@@ -2147,7 +2164,7 @@ class CreationInfo(SHACLObject): | |||
2147 | # A key with an associated value. | 2164 | # A key with an associated value. |
2148 | @register("https://spdx.org/rdf/3.0.1/terms/Core/DictionaryEntry", compact_type="DictionaryEntry", abstract=False) | 2165 | @register("https://spdx.org/rdf/3.0.1/terms/Core/DictionaryEntry", compact_type="DictionaryEntry", abstract=False) |
2149 | class DictionaryEntry(SHACLObject): | 2166 | class DictionaryEntry(SHACLObject): |
2150 | NODE_KIND = NodeKind.BlankNode | 2167 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2151 | NAMED_INDIVIDUALS = { | 2168 | NAMED_INDIVIDUALS = { |
2152 | } | 2169 | } |
2153 | 2170 | ||
@@ -2177,15 +2194,7 @@ class Element(SHACLObject): | |||
2177 | NODE_KIND = NodeKind.IRI | 2194 | NODE_KIND = NodeKind.IRI |
2178 | ID_ALIAS = "spdxId" | 2195 | ID_ALIAS = "spdxId" |
2179 | NAMED_INDIVIDUALS = { | 2196 | NAMED_INDIVIDUALS = { |
2180 | "NoAssertionElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", | ||
2181 | "NoneElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", | ||
2182 | } | 2197 | } |
2183 | # An Individual Value for Element representing a set of Elements of unknown | ||
2184 | # identify or cardinality (number). | ||
2185 | NoAssertionElement = "https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement" | ||
2186 | # An Individual Value for Element representing a set of Elements with | ||
2187 | # cardinality (number/count) of zero. | ||
2188 | NoneElement = "https://spdx.org/rdf/3.0.1/terms/Core/NoneElement" | ||
2189 | 2198 | ||
2190 | @classmethod | 2199 | @classmethod |
2191 | def _register_props(cls): | 2200 | def _register_props(cls): |
@@ -2276,10 +2285,10 @@ class ElementCollection(Element): | |||
2276 | "element", | 2285 | "element", |
2277 | ListProp(ObjectProp(Element, False, context=[ | 2286 | ListProp(ObjectProp(Element, False, context=[ |
2278 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | 2287 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), |
2288 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
2289 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
2279 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | 2290 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), |
2280 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | 2291 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), |
2281 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
2282 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
2283 | ],)), | 2292 | ],)), |
2284 | iri="https://spdx.org/rdf/3.0.1/terms/Core/element", | 2293 | iri="https://spdx.org/rdf/3.0.1/terms/Core/element", |
2285 | compact="element", | 2294 | compact="element", |
@@ -2308,10 +2317,10 @@ class ElementCollection(Element): | |||
2308 | "rootElement", | 2317 | "rootElement", |
2309 | ListProp(ObjectProp(Element, False, context=[ | 2318 | ListProp(ObjectProp(Element, False, context=[ |
2310 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | 2319 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), |
2320 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
2321 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
2311 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | 2322 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), |
2312 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | 2323 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), |
2313 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
2314 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
2315 | ],)), | 2324 | ],)), |
2316 | iri="https://spdx.org/rdf/3.0.1/terms/Core/rootElement", | 2325 | iri="https://spdx.org/rdf/3.0.1/terms/Core/rootElement", |
2317 | compact="rootElement", | 2326 | compact="rootElement", |
@@ -2321,7 +2330,7 @@ class ElementCollection(Element): | |||
2321 | # A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an Element. | 2330 | # A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an Element. |
2322 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifier", compact_type="ExternalIdentifier", abstract=False) | 2331 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifier", compact_type="ExternalIdentifier", abstract=False) |
2323 | class ExternalIdentifier(SHACLObject): | 2332 | class ExternalIdentifier(SHACLObject): |
2324 | NODE_KIND = NodeKind.BlankNode | 2333 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2325 | NAMED_INDIVIDUALS = { | 2334 | NAMED_INDIVIDUALS = { |
2326 | } | 2335 | } |
2327 | 2336 | ||
@@ -2425,7 +2434,7 @@ class ExternalIdentifierType(SHACLObject): | |||
2425 | # external to that SpdxDocument. | 2434 | # external to that SpdxDocument. |
2426 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalMap", compact_type="ExternalMap", abstract=False) | 2435 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalMap", compact_type="ExternalMap", abstract=False) |
2427 | class ExternalMap(SHACLObject): | 2436 | class ExternalMap(SHACLObject): |
2428 | NODE_KIND = NodeKind.BlankNode | 2437 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2429 | NAMED_INDIVIDUALS = { | 2438 | NAMED_INDIVIDUALS = { |
2430 | } | 2439 | } |
2431 | 2440 | ||
@@ -2469,7 +2478,7 @@ class ExternalMap(SHACLObject): | |||
2469 | # A reference to a resource outside the scope of SPDX-3.0 content related to an Element. | 2478 | # A reference to a resource outside the scope of SPDX-3.0 content related to an Element. |
2470 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRef", compact_type="ExternalRef", abstract=False) | 2479 | @register("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRef", compact_type="ExternalRef", abstract=False) |
2471 | class ExternalRef(SHACLObject): | 2480 | class ExternalRef(SHACLObject): |
2472 | NODE_KIND = NodeKind.BlankNode | 2481 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2473 | NAMED_INDIVIDUALS = { | 2482 | NAMED_INDIVIDUALS = { |
2474 | } | 2483 | } |
2475 | 2484 | ||
@@ -2774,10 +2783,28 @@ class HashAlgorithm(SHACLObject): | |||
2774 | sha512 = "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512" | 2783 | sha512 = "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512" |
2775 | 2784 | ||
2776 | 2785 | ||
2786 | # A concrete subclass of Element used by Individuals in the | ||
2787 | # Core profile. | ||
2788 | @register("https://spdx.org/rdf/3.0.1/terms/Core/IndividualElement", compact_type="IndividualElement", abstract=False) | ||
2789 | class IndividualElement(Element): | ||
2790 | NODE_KIND = NodeKind.IRI | ||
2791 | ID_ALIAS = "spdxId" | ||
2792 | NAMED_INDIVIDUALS = { | ||
2793 | "NoAssertionElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", | ||
2794 | "NoneElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", | ||
2795 | } | ||
2796 | # An Individual Value for Element representing a set of Elements of unknown | ||
2797 | # identify or cardinality (number). | ||
2798 | NoAssertionElement = "https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement" | ||
2799 | # An Individual Value for Element representing a set of Elements with | ||
2800 | # cardinality (number/count) of zero. | ||
2801 | NoneElement = "https://spdx.org/rdf/3.0.1/terms/Core/NoneElement" | ||
2802 | |||
2803 | |||
2777 | # Provides an independently reproducible mechanism that permits verification of a specific Element. | 2804 | # Provides an independently reproducible mechanism that permits verification of a specific Element. |
2778 | @register("https://spdx.org/rdf/3.0.1/terms/Core/IntegrityMethod", compact_type="IntegrityMethod", abstract=True) | 2805 | @register("https://spdx.org/rdf/3.0.1/terms/Core/IntegrityMethod", compact_type="IntegrityMethod", abstract=True) |
2779 | class IntegrityMethod(SHACLObject): | 2806 | class IntegrityMethod(SHACLObject): |
2780 | NODE_KIND = NodeKind.BlankNode | 2807 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2781 | NAMED_INDIVIDUALS = { | 2808 | NAMED_INDIVIDUALS = { |
2782 | } | 2809 | } |
2783 | 2810 | ||
@@ -2823,7 +2850,7 @@ class LifecycleScopeType(SHACLObject): | |||
2823 | # A mapping between prefixes and namespace partial URIs. | 2850 | # A mapping between prefixes and namespace partial URIs. |
2824 | @register("https://spdx.org/rdf/3.0.1/terms/Core/NamespaceMap", compact_type="NamespaceMap", abstract=False) | 2851 | @register("https://spdx.org/rdf/3.0.1/terms/Core/NamespaceMap", compact_type="NamespaceMap", abstract=False) |
2825 | class NamespaceMap(SHACLObject): | 2852 | class NamespaceMap(SHACLObject): |
2826 | NODE_KIND = NodeKind.BlankNode | 2853 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2827 | NAMED_INDIVIDUALS = { | 2854 | NAMED_INDIVIDUALS = { |
2828 | } | 2855 | } |
2829 | 2856 | ||
@@ -2852,7 +2879,7 @@ class NamespaceMap(SHACLObject): | |||
2852 | # An SPDX version 2.X compatible verification method for software packages. | 2879 | # An SPDX version 2.X compatible verification method for software packages. |
2853 | @register("https://spdx.org/rdf/3.0.1/terms/Core/PackageVerificationCode", compact_type="PackageVerificationCode", abstract=False) | 2880 | @register("https://spdx.org/rdf/3.0.1/terms/Core/PackageVerificationCode", compact_type="PackageVerificationCode", abstract=False) |
2854 | class PackageVerificationCode(IntegrityMethod): | 2881 | class PackageVerificationCode(IntegrityMethod): |
2855 | NODE_KIND = NodeKind.BlankNode | 2882 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2856 | NAMED_INDIVIDUALS = { | 2883 | NAMED_INDIVIDUALS = { |
2857 | } | 2884 | } |
2858 | 2885 | ||
@@ -2911,7 +2938,7 @@ class PackageVerificationCode(IntegrityMethod): | |||
2911 | # A tuple of two positive integers that define a range. | 2938 | # A tuple of two positive integers that define a range. |
2912 | @register("https://spdx.org/rdf/3.0.1/terms/Core/PositiveIntegerRange", compact_type="PositiveIntegerRange", abstract=False) | 2939 | @register("https://spdx.org/rdf/3.0.1/terms/Core/PositiveIntegerRange", compact_type="PositiveIntegerRange", abstract=False) |
2913 | class PositiveIntegerRange(SHACLObject): | 2940 | class PositiveIntegerRange(SHACLObject): |
2914 | NODE_KIND = NodeKind.BlankNode | 2941 | NODE_KIND = NodeKind.BlankNodeOrIRI |
2915 | NAMED_INDIVIDUALS = { | 2942 | NAMED_INDIVIDUALS = { |
2916 | } | 2943 | } |
2917 | 2944 | ||
@@ -2977,7 +3004,7 @@ class ProfileIdentifierType(SHACLObject): | |||
2977 | core = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core" | 3004 | core = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core" |
2978 | # the element follows the Dataset profile specification | 3005 | # the element follows the Dataset profile specification |
2979 | dataset = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset" | 3006 | dataset = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset" |
2980 | # the element follows the expanded Licensing profile specification | 3007 | # the element follows the ExpandedLicensing profile specification |
2981 | expandedLicensing = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing" | 3008 | expandedLicensing = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing" |
2982 | # the element follows the Extension profile specification | 3009 | # the element follows the Extension profile specification |
2983 | extension = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension" | 3010 | extension = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension" |
@@ -2985,7 +3012,7 @@ class ProfileIdentifierType(SHACLObject): | |||
2985 | lite = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite" | 3012 | lite = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite" |
2986 | # the element follows the Security profile specification | 3013 | # the element follows the Security profile specification |
2987 | security = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security" | 3014 | security = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security" |
2988 | # the element follows the simple Licensing profile specification | 3015 | # the element follows the SimpleLicensing profile specification |
2989 | simpleLicensing = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing" | 3016 | simpleLicensing = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing" |
2990 | # the element follows the Software profile specification | 3017 | # the element follows the Software profile specification |
2991 | software = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software" | 3018 | software = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software" |
@@ -3025,10 +3052,10 @@ class Relationship(Element): | |||
3025 | "from_", | 3052 | "from_", |
3026 | ObjectProp(Element, True, context=[ | 3053 | ObjectProp(Element, True, context=[ |
3027 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | 3054 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), |
3055 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
3056 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3028 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | 3057 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), |
3029 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | 3058 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), |
3030 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3031 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
3032 | ],), | 3059 | ],), |
3033 | iri="https://spdx.org/rdf/3.0.1/terms/Core/from", | 3060 | iri="https://spdx.org/rdf/3.0.1/terms/Core/from", |
3034 | min_count=1, | 3061 | min_count=1, |
@@ -3114,10 +3141,10 @@ class Relationship(Element): | |||
3114 | "to", | 3141 | "to", |
3115 | ListProp(ObjectProp(Element, False, context=[ | 3142 | ListProp(ObjectProp(Element, False, context=[ |
3116 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | 3143 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), |
3144 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
3145 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3117 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | 3146 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), |
3118 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | 3147 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), |
3119 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3120 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
3121 | ],)), | 3148 | ],)), |
3122 | iri="https://spdx.org/rdf/3.0.1/terms/Core/to", | 3149 | iri="https://spdx.org/rdf/3.0.1/terms/Core/to", |
3123 | min_count=1, | 3150 | min_count=1, |
@@ -3343,8 +3370,8 @@ class SpdxDocument(ElementCollection): | |||
3343 | cls._add_property( | 3370 | cls._add_property( |
3344 | "dataLicense", | 3371 | "dataLicense", |
3345 | ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ | 3372 | ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ |
3346 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3347 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | 3373 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), |
3374 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3348 | ],), | 3375 | ],), |
3349 | iri="https://spdx.org/rdf/3.0.1/terms/Core/dataLicense", | 3376 | iri="https://spdx.org/rdf/3.0.1/terms/Core/dataLicense", |
3350 | compact="dataLicense", | 3377 | compact="dataLicense", |
@@ -3587,7 +3614,7 @@ class expandedlicensing_ListedLicenseException(expandedlicensing_LicenseAddition | |||
3587 | # A property name with an associated value. | 3614 | # A property name with an associated value. |
3588 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertyEntry", compact_type="extension_CdxPropertyEntry", abstract=False) | 3615 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertyEntry", compact_type="extension_CdxPropertyEntry", abstract=False) |
3589 | class extension_CdxPropertyEntry(SHACLObject): | 3616 | class extension_CdxPropertyEntry(SHACLObject): |
3590 | NODE_KIND = NodeKind.BlankNode | 3617 | NODE_KIND = NodeKind.BlankNodeOrIRI |
3591 | NAMED_INDIVIDUALS = { | 3618 | NAMED_INDIVIDUALS = { |
3592 | } | 3619 | } |
3593 | 3620 | ||
@@ -3614,7 +3641,7 @@ class extension_CdxPropertyEntry(SHACLObject): | |||
3614 | # A characterization of some aspect of an Element that is associated with the Element in a generalized fashion. | 3641 | # A characterization of some aspect of an Element that is associated with the Element in a generalized fashion. |
3615 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/Extension", compact_type="extension_Extension", abstract=True) | 3642 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/Extension", compact_type="extension_Extension", abstract=True) |
3616 | class extension_Extension(SHACLExtensibleObject, SHACLObject): | 3643 | class extension_Extension(SHACLExtensibleObject, SHACLObject): |
3617 | NODE_KIND = NodeKind.BlankNode | 3644 | NODE_KIND = NodeKind.BlankNodeOrIRI |
3618 | NAMED_INDIVIDUALS = { | 3645 | NAMED_INDIVIDUALS = { |
3619 | } | 3646 | } |
3620 | 3647 | ||
@@ -3724,13 +3751,7 @@ class security_VulnAssessmentRelationship(Relationship): | |||
3724 | # found. | 3751 | # found. |
3725 | cls._add_property( | 3752 | cls._add_property( |
3726 | "security_assessedElement", | 3753 | "security_assessedElement", |
3727 | ObjectProp(Element, False, context=[ | 3754 | ObjectProp(software_SoftwareArtifact, False), |
3728 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | ||
3729 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | ||
3730 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | ||
3731 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
3732 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
3733 | ],), | ||
3734 | iri="https://spdx.org/rdf/3.0.1/terms/Security/assessedElement", | 3755 | iri="https://spdx.org/rdf/3.0.1/terms/Security/assessedElement", |
3735 | compact="security_assessedElement", | 3756 | compact="security_assessedElement", |
3736 | ) | 3757 | ) |
@@ -3826,7 +3847,7 @@ class simplelicensing_SimpleLicensingText(Element): | |||
3826 | # A canonical, unique, immutable identifier | 3847 | # A canonical, unique, immutable identifier |
3827 | @register("https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifier", compact_type="software_ContentIdentifier", abstract=False) | 3848 | @register("https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifier", compact_type="software_ContentIdentifier", abstract=False) |
3828 | class software_ContentIdentifier(IntegrityMethod): | 3849 | class software_ContentIdentifier(IntegrityMethod): |
3829 | NODE_KIND = NodeKind.BlankNode | 3850 | NODE_KIND = NodeKind.BlankNodeOrIRI |
3830 | NAMED_INDIVIDUALS = { | 3851 | NAMED_INDIVIDUALS = { |
3831 | } | 3852 | } |
3832 | 3853 | ||
@@ -4134,10 +4155,10 @@ class Annotation(Element): | |||
4134 | "subject", | 4155 | "subject", |
4135 | ObjectProp(Element, True, context=[ | 4156 | ObjectProp(Element, True, context=[ |
4136 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), | 4157 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"), |
4158 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
4159 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4137 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), | 4160 | ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"), |
4138 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), | 4161 | ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"), |
4139 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4140 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | ||
4141 | ],), | 4162 | ],), |
4142 | iri="https://spdx.org/rdf/3.0.1/terms/Core/subject", | 4163 | iri="https://spdx.org/rdf/3.0.1/terms/Core/subject", |
4143 | min_count=1, | 4164 | min_count=1, |
@@ -4245,7 +4266,7 @@ class Bundle(ElementCollection): | |||
4245 | # A mathematically calculated representation of a grouping of data. | 4266 | # A mathematically calculated representation of a grouping of data. |
4246 | @register("https://spdx.org/rdf/3.0.1/terms/Core/Hash", compact_type="Hash", abstract=False) | 4267 | @register("https://spdx.org/rdf/3.0.1/terms/Core/Hash", compact_type="Hash", abstract=False) |
4247 | class Hash(IntegrityMethod): | 4268 | class Hash(IntegrityMethod): |
4248 | NODE_KIND = NodeKind.BlankNode | 4269 | NODE_KIND = NodeKind.BlankNodeOrIRI |
4249 | NAMED_INDIVIDUALS = { | 4270 | NAMED_INDIVIDUALS = { |
4250 | } | 4271 | } |
4251 | 4272 | ||
@@ -4366,8 +4387,8 @@ class expandedlicensing_ConjunctiveLicenseSet(simplelicensing_AnyLicenseInfo): | |||
4366 | cls._add_property( | 4387 | cls._add_property( |
4367 | "expandedlicensing_member", | 4388 | "expandedlicensing_member", |
4368 | ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ | 4389 | ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ |
4369 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4370 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | 4390 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), |
4391 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4371 | ],)), | 4392 | ],)), |
4372 | iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member", | 4393 | iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member", |
4373 | min_count=2, | 4394 | min_count=2, |
@@ -4400,8 +4421,8 @@ class expandedlicensing_DisjunctiveLicenseSet(simplelicensing_AnyLicenseInfo): | |||
4400 | cls._add_property( | 4421 | cls._add_property( |
4401 | "expandedlicensing_member", | 4422 | "expandedlicensing_member", |
4402 | ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ | 4423 | ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=[ |
4403 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4404 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), | 4424 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"), |
4425 | ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"), | ||
4405 | ],)), | 4426 | ],)), |
4406 | iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member", | 4427 | iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member", |
4407 | min_count=2, | 4428 | min_count=2, |
@@ -4603,7 +4624,7 @@ class expandedlicensing_WithAdditionOperator(simplelicensing_AnyLicenseInfo): | |||
4603 | # A type of extension consisting of a list of name value pairs. | 4624 | # A type of extension consisting of a list of name value pairs. |
4604 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertiesExtension", compact_type="extension_CdxPropertiesExtension", abstract=False) | 4625 | @register("https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertiesExtension", compact_type="extension_CdxPropertiesExtension", abstract=False) |
4605 | class extension_CdxPropertiesExtension(extension_Extension): | 4626 | class extension_CdxPropertiesExtension(extension_Extension): |
4606 | NODE_KIND = NodeKind.BlankNode | 4627 | NODE_KIND = NodeKind.BlankNodeOrIRI |
4607 | NAMED_INDIVIDUALS = { | 4628 | NAMED_INDIVIDUALS = { |
4608 | } | 4629 | } |
4609 | 4630 | ||
@@ -4831,7 +4852,7 @@ class security_SsvcVulnAssessmentRelationship(security_VulnAssessmentRelationshi | |||
4831 | ) | 4852 | ) |
4832 | 4853 | ||
4833 | 4854 | ||
4834 | # Asbtract ancestor class for all VEX relationships | 4855 | # Abstract ancestor class for all VEX relationships |
4835 | @register("https://spdx.org/rdf/3.0.1/terms/Security/VexVulnAssessmentRelationship", compact_type="security_VexVulnAssessmentRelationship", abstract=True) | 4856 | @register("https://spdx.org/rdf/3.0.1/terms/Security/VexVulnAssessmentRelationship", compact_type="security_VexVulnAssessmentRelationship", abstract=True) |
4836 | class security_VexVulnAssessmentRelationship(security_VulnAssessmentRelationship): | 4857 | class security_VexVulnAssessmentRelationship(security_VulnAssessmentRelationship): |
4837 | NODE_KIND = NodeKind.IRI | 4858 | NODE_KIND = NodeKind.IRI |
@@ -5040,13 +5061,14 @@ class security_VexAffectedVulnAssessmentRelationship(security_VexVulnAssessmentR | |||
5040 | "security_actionStatement", | 5061 | "security_actionStatement", |
5041 | StringProp(), | 5062 | StringProp(), |
5042 | iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatement", | 5063 | iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatement", |
5064 | min_count=1, | ||
5043 | compact="security_actionStatement", | 5065 | compact="security_actionStatement", |
5044 | ) | 5066 | ) |
5045 | # Records the time when a recommended action was communicated in a VEX statement | 5067 | # Records the time when a recommended action was communicated in a VEX statement |
5046 | # to mitigate a vulnerability. | 5068 | # to mitigate a vulnerability. |
5047 | cls._add_property( | 5069 | cls._add_property( |
5048 | "security_actionStatementTime", | 5070 | "security_actionStatementTime", |
5049 | ListProp(DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",)), | 5071 | DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",), |
5050 | iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatementTime", | 5072 | iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatementTime", |
5051 | compact="security_actionStatementTime", | 5073 | compact="security_actionStatementTime", |
5052 | ) | 5074 | ) |