summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/spdx30.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/spdx30.py')
-rw-r--r--meta/lib/oe/spdx30.py6020
1 files changed, 6020 insertions, 0 deletions
diff --git a/meta/lib/oe/spdx30.py b/meta/lib/oe/spdx30.py
new file mode 100644
index 0000000000..ae74ce36f4
--- /dev/null
+++ b/meta/lib/oe/spdx30.py
@@ -0,0 +1,6020 @@
1#! /usr/bin/env python3
2#
3# Generated Python bindings from a SHACL model
4#
5# This file was automatically generated by shacl2code. DO NOT MANUALLY MODIFY IT
6#
7# SPDX-License-Identifier: MIT
8
9import functools
10import hashlib
11import json
12import re
13import sys
14import threading
15import time
16from contextlib import contextmanager
17from datetime import datetime, timezone, timedelta
18from enum import Enum
19from abc import ABC, abstractmethod
20
21
22def check_type(obj, types):
23 if not isinstance(obj, types):
24 if isinstance(types, (list, tuple)):
25 raise TypeError(
26 f"Value must be one of type: {', '.join(t.__name__ for t in types)}. Got {type(obj)}"
27 )
28 raise TypeError(f"Value must be of type {types.__name__}. Got {type(obj)}")
29
30
31class Property(ABC):
32 """
33 A generic SHACL object property. The different types will derive from this
34 class
35 """
36
37 def __init__(self, *, pattern=None):
38 self.pattern = pattern
39
40 def init(self):
41 return None
42
43 def validate(self, value):
44 check_type(value, self.VALID_TYPES)
45 if self.pattern is not None and not re.search(
46 self.pattern, self.to_string(value)
47 ):
48 raise ValueError(
49 f"Value is not correctly formatted. Got '{self.to_string(value)}'"
50 )
51
52 def set(self, value):
53 return value
54
55 def check_min_count(self, value, min_count):
56 return min_count == 1
57
58 def check_max_count(self, value, max_count):
59 return max_count == 1
60
61 def elide(self, value):
62 return value is None
63
64 def walk(self, value, callback, path):
65 callback(value, path)
66
67 def iter_objects(self, value, recursive, visited):
68 return []
69
70 def link_prop(self, value, objectset, missing, visited):
71 return value
72
73 def to_string(self, value):
74 return str(value)
75
76 @abstractmethod
77 def encode(self, encoder, value, state):
78 pass
79
80 @abstractmethod
81 def decode(self, decoder, *, objectset=None):
82 pass
83
84
85class StringProp(Property):
86 """
87 A scalar string property for an SHACL object
88 """
89
90 VALID_TYPES = str
91
92 def set(self, value):
93 return str(value)
94
95 def encode(self, encoder, value, state):
96 encoder.write_string(value)
97
98 def decode(self, decoder, *, objectset=None):
99 return decoder.read_string()
100
101
102class AnyURIProp(StringProp):
103 def encode(self, encoder, value, state):
104 encoder.write_iri(value)
105
106 def decode(self, decoder, *, objectset=None):
107 return decoder.read_iri()
108
109
110class DateTimeProp(Property):
111 """
112 A Date/Time Object with optional timezone
113 """
114
115 VALID_TYPES = datetime
116 UTC_FORMAT_STR = "%Y-%m-%dT%H:%M:%SZ"
117 REGEX = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})?$"
118
119 def set(self, value):
120 return self._normalize(value)
121
122 def encode(self, encoder, value, state):
123 encoder.write_datetime(self.to_string(value))
124
125 def decode(self, decoder, *, objectset=None):
126 s = decoder.read_datetime()
127 if s is None:
128 return None
129 v = self.from_string(s)
130 return self._normalize(v)
131
132 def _normalize(self, value):
133 if value.utcoffset() is None:
134 value = value.astimezone()
135 offset = value.utcoffset()
136 if offset % timedelta(minutes=1):
137 offset = offset - (offset % timedelta(minutes=1))
138 value = value.replace(tzinfo=timezone(offset))
139 value = value.replace(microsecond=0)
140 return value
141
142 def to_string(self, value):
143 value = self._normalize(value)
144 if value.tzinfo == timezone.utc:
145 return value.strftime(self.UTC_FORMAT_STR)
146 return value.isoformat()
147
148 def from_string(self, value):
149 if not re.match(self.REGEX, value):
150 raise ValueError(f"'{value}' is not a correctly formatted datetime")
151 if "Z" in value:
152 d = datetime(
153 *(time.strptime(value, self.UTC_FORMAT_STR)[0:6]),
154 tzinfo=timezone.utc,
155 )
156 else:
157 d = datetime.fromisoformat(value)
158
159 return self._normalize(d)
160
161
162class DateTimeStampProp(DateTimeProp):
163 """
164 A Date/Time Object with required timestamp
165 """
166
167 REGEX = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$"
168
169
170class IntegerProp(Property):
171 VALID_TYPES = int
172
173 def set(self, value):
174 return int(value)
175
176 def encode(self, encoder, value, state):
177 encoder.write_integer(value)
178
179 def decode(self, decoder, *, objectset=None):
180 return decoder.read_integer()
181
182
183class PositiveIntegerProp(IntegerProp):
184 def validate(self, value):
185 super().validate(value)
186 if value < 1:
187 raise ValueError(f"Value must be >=1. Got {value}")
188
189
190class NonNegativeIntegerProp(IntegerProp):
191 def validate(self, value):
192 super().validate(value)
193 if value < 0:
194 raise ValueError(f"Value must be >= 0. Got {value}")
195
196
197class BooleanProp(Property):
198 VALID_TYPES = bool
199
200 def set(self, value):
201 return bool(value)
202
203 def encode(self, encoder, value, state):
204 encoder.write_bool(value)
205
206 def decode(self, decoder, *, objectset=None):
207 return decoder.read_bool()
208
209
210class FloatProp(Property):
211 VALID_TYPES = (float, int)
212
213 def set(self, value):
214 return float(value)
215
216 def encode(self, encoder, value, state):
217 encoder.write_float(value)
218
219 def decode(self, decoder, *, objectset=None):
220 return decoder.read_float()
221
222
223class ObjectProp(Property):
224 """
225 A scalar SHACL object property of a SHACL object
226 """
227
228 def __init__(self, cls, required):
229 super().__init__()
230 self.cls = cls
231 self.required = required
232
233 def init(self):
234 if self.required and not self.cls.IS_ABSTRACT:
235 return self.cls()
236 return None
237
238 def validate(self, value):
239 check_type(value, (self.cls, str))
240
241 def walk(self, value, callback, path):
242 if value is None:
243 return
244
245 if not isinstance(value, str):
246 value.walk(callback, path)
247 else:
248 callback(value, path)
249
250 def iter_objects(self, value, recursive, visited):
251 if value is None or isinstance(value, str):
252 return
253
254 if value not in visited:
255 visited.add(value)
256 yield value
257
258 if recursive:
259 for c in value.iter_objects(recursive=True, visited=visited):
260 yield c
261
262 def encode(self, encoder, value, state):
263 if value is None:
264 raise ValueError("Object cannot be None")
265
266 if isinstance(value, str):
267 value = _NI_ENCODE_CONTEXT.get(value, value)
268 encoder.write_iri(value)
269 return
270
271 return value.encode(encoder, state)
272
273 def decode(self, decoder, *, objectset=None):
274 iri = decoder.read_iri()
275 if iri is None:
276 return self.cls.decode(decoder, objectset=objectset)
277
278 iri = _NI_DECODE_CONTEXT.get(iri, iri)
279
280 if objectset is None:
281 return iri
282
283 obj = objectset.find_by_id(iri)
284 if obj is None:
285 return iri
286
287 self.validate(obj)
288 return obj
289
290 def link_prop(self, value, objectset, missing, visited):
291 if value is None:
292 return value
293
294 if isinstance(value, str):
295 o = objectset.find_by_id(value)
296 if o is not None:
297 self.validate(o)
298 return o
299
300 if missing is not None:
301 missing.add(value)
302
303 return value
304
305 # De-duplicate IDs
306 if value._id:
307 value = objectset.find_by_id(value._id, value)
308 self.validate(value)
309
310 value.link_helper(objectset, missing, visited)
311 return value
312
313
314class ListProxy(object):
315 def __init__(self, prop, data=None):
316 if data is None:
317 self.__data = []
318 else:
319 self.__data = data
320 self.__prop = prop
321
322 def append(self, value):
323 self.__prop.validate(value)
324 self.__data.append(self.__prop.set(value))
325
326 def insert(self, idx, value):
327 self.__prop.validate(value)
328 self.__data.insert(idx, self.__prop.set(value))
329
330 def extend(self, items):
331 for i in items:
332 self.append(i)
333
334 def sort(self, *args, **kwargs):
335 self.__data.sort(*args, **kwargs)
336
337 def __getitem__(self, key):
338 return self.__data[key]
339
340 def __setitem__(self, key, value):
341 if isinstance(key, slice):
342 for v in value:
343 self.__prop.validate(v)
344 self.__data[key] = [self.__prop.set(v) for v in value]
345 else:
346 self.__prop.validate(value)
347 self.__data[key] = self.__prop.set(value)
348
349 def __delitem__(self, key):
350 del self.__data[key]
351
352 def __contains__(self, item):
353 return item in self.__data
354
355 def __iter__(self):
356 return iter(self.__data)
357
358 def __len__(self):
359 return len(self.__data)
360
361 def __str__(self):
362 return str(self.__data)
363
364 def __repr__(self):
365 return repr(self.__data)
366
367 def __eq__(self, other):
368 if isinstance(other, ListProxy):
369 return self.__data == other.__data
370
371 return self.__data == other
372
373
374class ListProp(Property):
375 """
376 A list of SHACL properties
377 """
378
379 VALID_TYPES = (list, ListProxy)
380
381 def __init__(self, prop):
382 super().__init__()
383 self.prop = prop
384
385 def init(self):
386 return ListProxy(self.prop)
387
388 def validate(self, value):
389 super().validate(value)
390
391 for i in value:
392 self.prop.validate(i)
393
394 def set(self, value):
395 if isinstance(value, ListProxy):
396 return value
397
398 return ListProxy(self.prop, [self.prop.set(d) for d in value])
399
400 def check_min_count(self, value, min_count):
401 check_type(value, ListProxy)
402 return len(value) >= min_count
403
404 def check_max_count(self, value, max_count):
405 check_type(value, ListProxy)
406 return len(value) <= max_count
407
408 def elide(self, value):
409 check_type(value, ListProxy)
410 return len(value) == 0
411
412 def walk(self, value, callback, path):
413 callback(value, path)
414 for idx, v in enumerate(value):
415 self.prop.walk(v, callback, path + [f"[{idx}]"])
416
417 def iter_objects(self, value, recursive, visited):
418 for v in value:
419 for c in self.prop.iter_objects(v, recursive, visited):
420 yield c
421
422 def link_prop(self, value, objectset, missing, visited):
423 if isinstance(value, ListProxy):
424 data = [self.prop.link_prop(v, objectset, missing, visited) for v in value]
425 else:
426 data = [self.prop.link_prop(v, objectset, missing, visited) for v in value]
427
428 return ListProxy(self.prop, data=data)
429
430 def encode(self, encoder, value, state):
431 check_type(value, ListProxy)
432
433 with encoder.write_list() as list_s:
434 for v in value:
435 with list_s.write_list_item() as item_s:
436 self.prop.encode(item_s, v, state)
437
438 def decode(self, decoder, *, objectset=None):
439 data = []
440 for val_d in decoder.read_list():
441 v = self.prop.decode(val_d, objectset=objectset)
442 self.prop.validate(v)
443 data.append(v)
444
445 return ListProxy(self.prop, data=data)
446
447
448class EnumProp(Property):
449 VALID_TYPES = str
450
451 def __init__(self, values, *, pattern=None):
452 super().__init__(pattern=pattern)
453 self.values = values
454
455 def validate(self, value):
456 super().validate(value)
457
458 valid_values = (iri for iri, _ in self.values)
459 if value not in valid_values:
460 raise ValueError(
461 f"'{value}' is not a valid value. Choose one of {' '.join(valid_values)}"
462 )
463
464 def encode(self, encoder, value, state):
465 for iri, compact in self.values:
466 if iri == value:
467 encoder.write_enum(value, self, compact)
468 return
469
470 encoder.write_enum(value, self)
471
472 def decode(self, decoder, *, objectset=None):
473 v = decoder.read_enum(self)
474 for iri, compact in self.values:
475 if v == compact:
476 return iri
477 return v
478
479
480class NodeKind(Enum):
481 BlankNode = 1
482 IRI = 2
483 BlankNodeOrIRI = 3
484
485
486def is_IRI(s):
487 if not isinstance(s, str):
488 return False
489 if s.startswith("_:"):
490 return False
491 if ":" not in s:
492 return False
493 return True
494
495
496def is_blank_node(s):
497 if not isinstance(s, str):
498 return False
499 if not s.startswith("_:"):
500 return False
501 return True
502
503
504def register(type_iri, *, compact_type=None, abstract=False):
505 def add_class(key, c):
506 assert (
507 key not in SHACLObject.CLASSES
508 ), f"{key} already registered to {SHACLObject.CLASSES[key].__name__}"
509 SHACLObject.CLASSES[key] = c
510
511 def decorator(c):
512 global NAMED_INDIVIDUALS
513
514 assert issubclass(
515 c, SHACLObject
516 ), f"{c.__name__} is not derived from SHACLObject"
517
518 c._OBJ_TYPE = type_iri
519 c.IS_ABSTRACT = abstract
520 add_class(type_iri, c)
521
522 c._OBJ_COMPACT_TYPE = compact_type
523 if compact_type:
524 add_class(compact_type, c)
525
526 NAMED_INDIVIDUALS |= set(c.NAMED_INDIVIDUALS.values())
527
528 # Registration is deferred until the first instance of class is created
529 # so that it has access to any other defined class
530 c._NEEDS_REG = True
531 return c
532
533 return decorator
534
535
536register_lock = threading.Lock()
537NAMED_INDIVIDUALS = set()
538
539
540@functools.total_ordering
541class SHACLObject(object):
542 CLASSES = {}
543 NODE_KIND = NodeKind.BlankNodeOrIRI
544 ID_ALIAS = None
545 IS_ABSTRACT = True
546
547 def __init__(self, **kwargs):
548 if self._is_abstract():
549 raise NotImplementedError(
550 f"{self.__class__.__name__} is abstract and cannot be implemented"
551 )
552
553 with register_lock:
554 cls = self.__class__
555 if cls._NEEDS_REG:
556 cls._OBJ_PROPERTIES = {}
557 cls._OBJ_IRIS = {}
558 cls._register_props()
559 cls._NEEDS_REG = False
560
561 self.__dict__["_obj_data"] = {}
562 self.__dict__["_obj_metadata"] = {}
563
564 for iri, prop, _, _, _, _ in self.__iter_props():
565 self.__dict__["_obj_data"][iri] = prop.init()
566
567 for k, v in kwargs.items():
568 setattr(self, k, v)
569
570 def _is_abstract(self):
571 return self.__class__.IS_ABSTRACT
572
573 @classmethod
574 def _register_props(cls):
575 cls._add_property("_id", StringProp(), iri="@id")
576
577 @classmethod
578 def _add_property(
579 cls,
580 pyname,
581 prop,
582 iri,
583 min_count=None,
584 max_count=None,
585 compact=None,
586 ):
587 if pyname in cls._OBJ_IRIS:
588 raise KeyError(f"'{pyname}' is already defined for '{cls.__name__}'")
589 if iri in cls._OBJ_PROPERTIES:
590 raise KeyError(f"'{iri}' is already defined for '{cls.__name__}'")
591
592 while hasattr(cls, pyname):
593 pyname = pyname + "_"
594
595 pyname = sys.intern(pyname)
596 iri = sys.intern(iri)
597
598 cls._OBJ_IRIS[pyname] = iri
599 cls._OBJ_PROPERTIES[iri] = (prop, min_count, max_count, pyname, compact)
600
601 def __setattr__(self, name, value):
602 if name == self.ID_ALIAS:
603 self["@id"] = value
604 return
605
606 try:
607 iri = self._OBJ_IRIS[name]
608 self[iri] = value
609 except KeyError:
610 raise AttributeError(
611 f"'{name}' is not a valid property of {self.__class__.__name__}"
612 )
613
614 def __getattr__(self, name):
615 if name in self._OBJ_IRIS:
616 return self.__dict__["_obj_data"][self._OBJ_IRIS[name]]
617
618 if name == self.ID_ALIAS:
619 return self.__dict__["_obj_data"]["@id"]
620
621 if name == "_metadata":
622 return self.__dict__["_obj_metadata"]
623
624 if name == "_IRI":
625 return self._OBJ_IRIS
626
627 if name == "TYPE":
628 return self.__class__._OBJ_TYPE
629
630 if name == "COMPACT_TYPE":
631 return self.__class__._OBJ_COMPACT_TYPE
632
633 raise AttributeError(
634 f"'{name}' is not a valid property of {self.__class__.__name__}"
635 )
636
637 def __delattr__(self, name):
638 if name == self.ID_ALIAS:
639 del self["@id"]
640 return
641
642 try:
643 iri = self._OBJ_IRIS[name]
644 del self[iri]
645 except KeyError:
646 raise AttributeError(
647 f"'{name}' is not a valid property of {self.__class__.__name__}"
648 )
649
650 def __get_prop(self, iri):
651 if iri not in self._OBJ_PROPERTIES:
652 raise KeyError(
653 f"'{iri}' is not a valid property of {self.__class__.__name__}"
654 )
655
656 return self._OBJ_PROPERTIES[iri]
657
658 def __iter_props(self):
659 for iri, v in self._OBJ_PROPERTIES.items():
660 yield iri, *v
661
662 def __getitem__(self, iri):
663 return self.__dict__["_obj_data"][iri]
664
665 def __setitem__(self, iri, value):
666 if iri == "@id":
667 if self.NODE_KIND == NodeKind.BlankNode:
668 if not is_blank_node(value):
669 raise ValueError(
670 f"{self.__class__.__name__} ({id(self)}) can only have local reference. Property '{iri}' cannot be set to '{value}' and must start with '_:'"
671 )
672 elif self.NODE_KIND == NodeKind.IRI:
673 if not is_IRI(value):
674 raise ValueError(
675 f"{self.__class__.__name__} ({id(self)}) can only have an IRI value. Property '{iri}' cannot be set to '{value}'"
676 )
677 else:
678 if not is_blank_node(value) and not is_IRI(value):
679 raise ValueError(
680 f"{self.__class__.__name__} ({id(self)}) Has invalid Property '{iri}' '{value}'. Must be a blank node or IRI"
681 )
682
683 prop, _, _, _, _ = self.__get_prop(iri)
684 prop.validate(value)
685 self.__dict__["_obj_data"][iri] = prop.set(value)
686
687 def __delitem__(self, iri):
688 prop, _, _, _, _ = self.__get_prop(iri)
689 self.__dict__["_obj_data"][iri] = prop.init()
690
691 def __iter__(self):
692 return self._OBJ_PROPERTIES.keys()
693
694 def walk(self, callback, path=None):
695 """
696 Walk object tree, invoking the callback for each item
697
698 Callback has the form:
699
700 def callback(object, path):
701 """
702 if path is None:
703 path = ["."]
704
705 if callback(self, path):
706 for iri, prop, _, _, _, _ in self.__iter_props():
707 prop.walk(self.__dict__["_obj_data"][iri], callback, path + [f".{iri}"])
708
709 def property_keys(self):
710 for iri, _, _, _, pyname, compact in self.__iter_props():
711 if iri == "@id":
712 compact = self.ID_ALIAS
713 yield pyname, iri, compact
714
715 def iter_objects(self, *, recursive=False, visited=None):
716 """
717 Iterate of all objects that are a child of this one
718 """
719 if visited is None:
720 visited = set()
721
722 for iri, prop, _, _, _, _ in self.__iter_props():
723 for c in prop.iter_objects(
724 self.__dict__["_obj_data"][iri], recursive=recursive, visited=visited
725 ):
726 yield c
727
728 def encode(self, encoder, state):
729 idname = self.ID_ALIAS or self._OBJ_IRIS["_id"]
730 if not self._id and self.NODE_KIND == NodeKind.IRI:
731 raise ValueError(
732 f"{self.__class__.__name__} ({id(self)}) must have a IRI for property '{idname}'"
733 )
734
735 if state.is_written(self):
736 encoder.write_iri(state.get_object_id(self))
737 return
738
739 state.add_written(self)
740
741 with encoder.write_object(
742 self,
743 state.get_object_id(self),
744 bool(self._id) or state.is_refed(self),
745 ) as obj_s:
746 self._encode_properties(obj_s, state)
747
748 def _encode_properties(self, encoder, state):
749 for iri, prop, min_count, max_count, pyname, compact in self.__iter_props():
750 value = self.__dict__["_obj_data"][iri]
751 if prop.elide(value):
752 if min_count:
753 raise ValueError(
754 f"Property '{pyname}' in {self.__class__.__name__} ({id(self)}) is required (currently {value!r})"
755 )
756 continue
757
758 if min_count is not None:
759 if not prop.check_min_count(value, min_count):
760 raise ValueError(
761 f"Property '{pyname}' in {self.__class__.__name__} ({id(self)}) requires a minimum of {min_count} elements"
762 )
763
764 if max_count is not None:
765 if not prop.check_max_count(value, max_count):
766 raise ValueError(
767 f"Property '{pyname}' in {self.__class__.__name__} ({id(self)}) requires a maximum of {max_count} elements"
768 )
769
770 if iri == self._OBJ_IRIS["_id"]:
771 continue
772
773 with encoder.write_property(iri, compact) as prop_s:
774 prop.encode(prop_s, value, state)
775
776 @classmethod
777 def _make_object(cls, typ):
778 if typ not in cls.CLASSES:
779 raise TypeError(f"Unknown type {typ}")
780
781 return cls.CLASSES[typ]()
782
783 @classmethod
784 def decode(cls, decoder, *, objectset=None):
785 typ, obj_d = decoder.read_object()
786 if typ is None:
787 raise TypeError("Unable to determine type for object")
788
789 obj = cls._make_object(typ)
790 for key in (obj.ID_ALIAS, obj._OBJ_IRIS["_id"]):
791 with obj_d.read_property(key) as prop_d:
792 if prop_d is None:
793 continue
794
795 _id = prop_d.read_iri()
796 if _id is None:
797 raise TypeError(f"Object key '{key}' is the wrong type")
798
799 obj._id = _id
800 break
801
802 if obj.NODE_KIND == NodeKind.IRI and not obj._id:
803 raise ValueError("Object is missing required IRI")
804
805 if objectset is not None:
806 if obj._id:
807 v = objectset.find_by_id(_id)
808 if v is not None:
809 return v
810
811 obj._decode_properties(obj_d, objectset=objectset)
812
813 if objectset is not None:
814 objectset.add_index(obj)
815 return obj
816
817 def _decode_properties(self, decoder, objectset=None):
818 for key in decoder.object_keys():
819 if not self._decode_prop(decoder, key, objectset=objectset):
820 raise KeyError(f"Unknown property '{key}'")
821
822 def _decode_prop(self, decoder, key, objectset=None):
823 if key in (self._OBJ_IRIS["_id"], self.ID_ALIAS):
824 return True
825
826 for iri, prop, _, _, _, compact in self.__iter_props():
827 if compact == key:
828 read_key = compact
829 elif iri == key:
830 read_key = iri
831 else:
832 continue
833
834 with decoder.read_property(read_key) as prop_d:
835 v = prop.decode(prop_d, objectset=objectset)
836 prop.validate(v)
837 self.__dict__["_obj_data"][iri] = v
838 return True
839
840 return False
841
842 def link_helper(self, objectset, missing, visited):
843 if self in visited:
844 return
845
846 visited.add(self)
847
848 for iri, prop, _, _, _, _ in self.__iter_props():
849 self.__dict__["_obj_data"][iri] = prop.link_prop(
850 self.__dict__["_obj_data"][iri],
851 objectset,
852 missing,
853 visited,
854 )
855
856 def __str__(self):
857 parts = [
858 f"{self.__class__.__name__}(",
859 ]
860 if self._id:
861 parts.append(f"@id='{self._id}'")
862 parts.append(")")
863 return "".join(parts)
864
865 def __hash__(self):
866 return super().__hash__()
867
868 def __eq__(self, other):
869 return super().__eq__(other)
870
871 def __lt__(self, other):
872 def sort_key(obj):
873 if isinstance(obj, str):
874 return (obj, "", "", "")
875 return (
876 obj._id or "",
877 obj.TYPE,
878 getattr(obj, "name", None) or "",
879 id(obj),
880 )
881
882 return sort_key(self) < sort_key(other)
883
884
885class SHACLExtensibleObject(object):
886 CLOSED = False
887
888 def __init__(self, typ=None, **kwargs):
889 if typ:
890 self.__dict__["_obj_TYPE"] = (typ, None)
891 else:
892 self.__dict__["_obj_TYPE"] = (self._OBJ_TYPE, self._OBJ_COMPACT_TYPE)
893 super().__init__(**kwargs)
894
895 def _is_abstract(self):
896 # Unknown classes are assumed to not be abstract so that they can be
897 # deserialized
898 typ = self.__dict__["_obj_TYPE"][0]
899 if typ in self.__class__.CLASSES:
900 return self.__class__.CLASSES[typ].IS_ABSTRACT
901
902 return False
903
904 @classmethod
905 def _make_object(cls, typ):
906 # Check for a known type, and if so, deserialize as that instead
907 if typ in cls.CLASSES:
908 return cls.CLASSES[typ]()
909
910 obj = cls(typ)
911 return obj
912
913 def _decode_properties(self, decoder, objectset=None):
914 if self.CLOSED:
915 super()._decode_properties(decoder, objectset=objectset)
916 return
917
918 for key in decoder.object_keys():
919 if self._decode_prop(decoder, key, objectset=objectset):
920 continue
921
922 if not is_IRI(key):
923 raise KeyError(
924 f"Extensible object properties must be IRIs. Got '{key}'"
925 )
926
927 with decoder.read_property(key) as prop_d:
928 self.__dict__["_obj_data"][key] = prop_d.read_value()
929
930 def _encode_properties(self, encoder, state):
931 def encode_value(encoder, v):
932 if isinstance(v, bool):
933 encoder.write_bool(v)
934 elif isinstance(v, str):
935 encoder.write_string(v)
936 elif isinstance(v, int):
937 encoder.write_integer(v)
938 elif isinstance(v, float):
939 encoder.write_float(v)
940 else:
941 raise TypeError(
942 f"Unsupported serialized type {type(v)} with value '{v}'"
943 )
944
945 super()._encode_properties(encoder, state)
946 if self.CLOSED:
947 return
948
949 for iri, value in self.__dict__["_obj_data"].items():
950 if iri in self._OBJ_PROPERTIES:
951 continue
952
953 with encoder.write_property(iri) as prop_s:
954 encode_value(prop_s, value)
955
956 def __setitem__(self, iri, value):
957 try:
958 super().__setitem__(iri, value)
959 except KeyError:
960 if self.CLOSED:
961 raise
962
963 if not is_IRI(iri):
964 raise KeyError(f"Key '{iri}' must be an IRI")
965 self.__dict__["_obj_data"][iri] = value
966
967 def __delitem__(self, iri):
968 try:
969 super().__delitem__(iri)
970 except KeyError:
971 if self.CLOSED:
972 raise
973
974 if not is_IRI(iri):
975 raise KeyError(f"Key '{iri}' must be an IRI")
976 del self.__dict__["_obj_data"][iri]
977
978 def __getattr__(self, name):
979 if name == "TYPE":
980 return self.__dict__["_obj_TYPE"][0]
981 if name == "COMPACT_TYPE":
982 return self.__dict__["_obj_TYPE"][1]
983 return super().__getattr__(name)
984
985 def property_keys(self):
986 iris = set()
987 for pyname, iri, compact in super().property_keys():
988 iris.add(iri)
989 yield pyname, iri, compact
990
991 if self.CLOSED:
992 return
993
994 for iri in self.__dict__["_obj_data"].keys():
995 if iri not in iris:
996 yield None, iri, None
997
998
999class SHACLObjectSet(object):
1000 def __init__(self, objects=[], *, link=False):
1001 self.objects = set()
1002 self.missing_ids = set()
1003 for o in objects:
1004 self.objects.add(o)
1005 self.create_index()
1006 if link:
1007 self._link()
1008
1009 def create_index(self):
1010 """
1011 (re)Create object index
1012
1013 Creates or recreates the indices for the object set to enable fast
1014 lookup. All objects and their children are walked and indexed
1015 """
1016 self.obj_by_id = {}
1017 self.obj_by_type = {}
1018 for o in self.foreach():
1019 self.add_index(o)
1020
1021 def add_index(self, obj):
1022 """
1023 Add object to index
1024
1025 Adds the object to all appropriate indices
1026 """
1027
1028 def reg_type(typ, compact, o, exact):
1029 self.obj_by_type.setdefault(typ, set()).add((exact, o))
1030 if compact:
1031 self.obj_by_type.setdefault(compact, set()).add((exact, o))
1032
1033 if not isinstance(obj, SHACLObject):
1034 raise TypeError("Object is not of type SHACLObject")
1035
1036 for typ in SHACLObject.CLASSES.values():
1037 if isinstance(obj, typ):
1038 reg_type(
1039 typ._OBJ_TYPE, typ._OBJ_COMPACT_TYPE, obj, obj.__class__ is typ
1040 )
1041
1042 # This covers custom extensions
1043 reg_type(obj.TYPE, obj.COMPACT_TYPE, obj, True)
1044
1045 if not obj._id:
1046 return
1047
1048 self.missing_ids.discard(obj._id)
1049
1050 if obj._id in self.obj_by_id:
1051 return
1052
1053 self.obj_by_id[obj._id] = obj
1054
1055 def add(self, obj):
1056 """
1057 Add object to object set
1058
1059 Adds a SHACLObject to the object set and index it.
1060
1061 NOTE: Child objects of the attached object are not indexes
1062 """
1063 if not isinstance(obj, SHACLObject):
1064 raise TypeError("Object is not of type SHACLObject")
1065
1066 if obj not in self.objects:
1067 self.objects.add(obj)
1068 self.add_index(obj)
1069 return obj
1070
1071 def update(self, *others):
1072 """
1073 Update object set adding all objects in each other iterable
1074 """
1075 for o in others:
1076 for obj in o:
1077 self.add(obj)
1078
1079 def __contains__(self, item):
1080 """
1081 Returns True if the item is in the object set
1082 """
1083 return item in self.objects
1084
1085 def link(self):
1086 """
1087 Link object set
1088
1089 Links the object in the object set by replacing string object
1090 references with references to the objects themselves. e.g.
1091 a property that references object "https://foo/bar" by a string
1092 reference will be replaced with an actual reference to the object in
1093 the object set with the same ID if it exists in the object set
1094
1095 If multiple objects with the same ID are found, the duplicates are
1096 eliminated
1097 """
1098 self.create_index()
1099 return self._link()
1100
1101 def _link(self):
1102 global NAMED_INDIVIDUALS
1103
1104 self.missing_ids = set()
1105 visited = set()
1106
1107 new_objects = set()
1108
1109 for o in self.objects:
1110 if o._id:
1111 o = self.find_by_id(o._id, o)
1112 o.link_helper(self, self.missing_ids, visited)
1113 new_objects.add(o)
1114
1115 self.objects = new_objects
1116
1117 # Remove blank nodes
1118 obj_by_id = {}
1119 for _id, obj in self.obj_by_id.items():
1120 if _id.startswith("_:"):
1121 del obj._id
1122 else:
1123 obj_by_id[_id] = obj
1124 self.obj_by_id = obj_by_id
1125
1126 # Named individuals aren't considered missing
1127 self.missing_ids -= NAMED_INDIVIDUALS
1128
1129 return self.missing_ids
1130
1131 def find_by_id(self, _id, default=None):
1132 """
1133 Find object by ID
1134
1135 Returns objects that match the specified ID, or default if there is no
1136 object with the specified ID
1137 """
1138 if _id not in self.obj_by_id:
1139 return default
1140 return self.obj_by_id[_id]
1141
1142 def foreach(self):
1143 """
1144 Iterate over every object in the object set, and all child objects
1145 """
1146 visited = set()
1147 for o in self.objects:
1148 if o not in visited:
1149 yield o
1150 visited.add(o)
1151
1152 for child in o.iter_objects(recursive=True, visited=visited):
1153 yield child
1154
1155 def foreach_type(self, typ, *, match_subclass=True):
1156 """
1157 Iterate over each object of a specified type (or subclass there of)
1158
1159 If match_subclass is True, and class derived from typ will also match
1160 (similar to isinstance()). If False, only exact matches will be
1161 returned
1162 """
1163 if not isinstance(typ, str):
1164 if not issubclass(typ, SHACLObject):
1165 raise TypeError(f"Type must be derived from SHACLObject, got {typ}")
1166 typ = typ._OBJ_TYPE
1167
1168 if typ not in self.obj_by_type:
1169 return
1170
1171 for exact, o in self.obj_by_type[typ]:
1172 if match_subclass or exact:
1173 yield o
1174
1175 def merge(self, *objectsets):
1176 """
1177 Merge object sets
1178
1179 Returns a new object set that is the combination of this object set and
1180 all provided arguments
1181 """
1182 new_objects = set()
1183 new_objects |= self.objects
1184 for d in objectsets:
1185 new_objects |= d.objects
1186
1187 return SHACLObjectSet(new_objects, link=True)
1188
1189 def encode(self, encoder, force_list=False):
1190 """
1191 Serialize a list of objects to a serialization encoder
1192
1193 If force_list is true, a list will always be written using the encoder.
1194 """
1195 ref_counts = {}
1196 state = EncodeState()
1197
1198 def walk_callback(value, path):
1199 nonlocal state
1200 nonlocal ref_counts
1201
1202 if not isinstance(value, SHACLObject):
1203 return True
1204
1205 # Remove blank node ID for re-assignment
1206 if value._id and value._id.startswith("_:"):
1207 del value._id
1208
1209 if value._id:
1210 state.add_refed(value)
1211
1212 # If the object is referenced more than once, add it to the set of
1213 # referenced objects
1214 ref_counts.setdefault(value, 0)
1215 ref_counts[value] += 1
1216 if ref_counts[value] > 1:
1217 state.add_refed(value)
1218 return False
1219
1220 return True
1221
1222 for o in self.objects:
1223 if o._id:
1224 state.add_refed(o)
1225 o.walk(walk_callback)
1226
1227 use_list = force_list or len(self.objects) > 1
1228
1229 if use_list:
1230 # If we are making a list add all the objects referred to by reference
1231 # to the list
1232 objects = list(self.objects | state.ref_objects)
1233 else:
1234 objects = list(self.objects)
1235
1236 objects.sort()
1237
1238 if use_list:
1239 # Ensure top level objects are only written in the top level graph
1240 # node, and referenced by ID everywhere else. This is done by setting
1241 # the flag that indicates this object has been written for all the top
1242 # level objects, then clearing it right before serializing the object.
1243 #
1244 # In this way, if an object is referenced before it is supposed to be
1245 # serialized into the @graph, it will serialize as a string instead of
1246 # the actual object
1247 for o in objects:
1248 state.written_objects.add(o)
1249
1250 with encoder.write_list() as list_s:
1251 for o in objects:
1252 # Allow this specific object to be written now
1253 state.written_objects.remove(o)
1254 with list_s.write_list_item() as item_s:
1255 o.encode(item_s, state)
1256
1257 else:
1258 objects[0].encode(encoder, state)
1259
1260 def decode(self, decoder):
1261 self.create_index()
1262
1263 for obj_d in decoder.read_list():
1264 o = SHACLObject.decode(obj_d, objectset=self)
1265 self.objects.add(o)
1266
1267 self._link()
1268
1269
1270class EncodeState(object):
1271 def __init__(self):
1272 self.ref_objects = set()
1273 self.written_objects = set()
1274 self.blank_objects = {}
1275
1276 def get_object_id(self, o):
1277 if o._id:
1278 return o._id
1279
1280 if o not in self.blank_objects:
1281 _id = f"_:{o.__class__.__name__}{len(self.blank_objects)}"
1282 self.blank_objects[o] = _id
1283
1284 return self.blank_objects[o]
1285
1286 def is_refed(self, o):
1287 return o in self.ref_objects
1288
1289 def add_refed(self, o):
1290 self.ref_objects.add(o)
1291
1292 def is_written(self, o):
1293 return o in self.written_objects
1294
1295 def add_written(self, o):
1296 self.written_objects.add(o)
1297
1298
1299class Decoder(ABC):
1300 @abstractmethod
1301 def read_value(self):
1302 """
1303 Consume next item
1304
1305 Consumes the next item of any type
1306 """
1307 pass
1308
1309 @abstractmethod
1310 def read_string(self):
1311 """
1312 Consume the next item as a string.
1313
1314 Returns the string value of the next item, or `None` if the next item
1315 is not a string
1316 """
1317 pass
1318
1319 @abstractmethod
1320 def read_datetime(self):
1321 """
1322 Consumes the next item as a date & time string
1323
1324 Returns the string value of the next item, if it is a ISO datetime, or
1325 `None` if the next item is not a ISO datetime string.
1326
1327 Note that validation of the string is done by the caller, so a minimal
1328 implementation can just check if the next item is a string without
1329 worrying about the format
1330 """
1331 pass
1332
1333 @abstractmethod
1334 def read_integer(self):
1335 """
1336 Consumes the next item as an integer
1337
1338 Returns the integer value of the next item, or `None` if the next item
1339 is not an integer
1340 """
1341 pass
1342
1343 @abstractmethod
1344 def read_iri(self):
1345 """
1346 Consumes the next item as an IRI string
1347
1348 Returns the string value of the next item an IRI, or `None` if the next
1349 item is not an IRI.
1350
1351 The returned string should be either a fully-qualified IRI, or a blank
1352 node ID
1353 """
1354 pass
1355
1356 @abstractmethod
1357 def read_enum(self, e):
1358 """
1359 Consumes the next item as an Enum value string
1360
1361 Returns the fully qualified IRI of the next enum item, or `None` if the
1362 next item is not an enum value.
1363
1364 The callee is responsible for validating that the returned IRI is
1365 actually a member of the specified Enum, so the `Decoder` does not need
1366 to check that, but can if it wishes
1367 """
1368 pass
1369
1370 @abstractmethod
1371 def read_bool(self):
1372 """
1373 Consume the next item as a boolean value
1374
1375 Returns the boolean value of the next item, or `None` if the next item
1376 is not a boolean
1377 """
1378 pass
1379
1380 @abstractmethod
1381 def read_float(self):
1382 """
1383 Consume the next item as a float value
1384
1385 Returns the float value of the next item, or `None` if the next item is
1386 not a float
1387 """
1388 pass
1389
1390 @abstractmethod
1391 def read_list(self):
1392 """
1393 Consume the next item as a list generator
1394
1395 This should generate a `Decoder` object for each item in the list. The
1396 generated `Decoder` can be used to read the corresponding item from the
1397 list
1398 """
1399 pass
1400
1401 @abstractmethod
1402 def read_object(self):
1403 """
1404 Consume next item as an object
1405
1406 A context manager that "enters" the next item as a object and yields a
1407 `Decoder` that can read properties from it. If the next item is not an
1408 object, yields `None`
1409
1410 Properties will be read out of the object using `read_property` and
1411 `read_object_id`
1412 """
1413 pass
1414
1415 @abstractmethod
1416 @contextmanager
1417 def read_property(self, key):
1418 """
1419 Read property from object
1420
1421 A context manager that yields a `Decoder` that can be used to read the
1422 value of the property with the given key in current object, or `None`
1423 if the property does not exist in the current object.
1424 """
1425 pass
1426
1427 @abstractmethod
1428 def object_keys(self):
1429 """
1430 Read property keys from an object
1431
1432 Iterates over all the serialized keys for the current object
1433 """
1434 pass
1435
1436 @abstractmethod
1437 def read_object_id(self, alias=None):
1438 """
1439 Read current object ID property
1440
1441 Returns the ID of the current object if one is defined, or `None` if
1442 the current object has no ID.
1443
1444 The ID must be a fully qualified IRI or a blank node
1445
1446 If `alias` is provided, is is a hint as to another name by which the ID
1447 might be found, if the `Decoder` supports aliases for an ID
1448 """
1449 pass
1450
1451
1452class JSONLDDecoder(Decoder):
1453 def __init__(self, data, root=False):
1454 self.data = data
1455 self.root = root
1456
1457 def read_value(self):
1458 if isinstance(self.data, str):
1459 try:
1460 return float(self.data)
1461 except ValueError:
1462 pass
1463 return self.data
1464
1465 def read_string(self):
1466 if isinstance(self.data, str):
1467 return self.data
1468 return None
1469
1470 def read_datetime(self):
1471 return self.read_string()
1472
1473 def read_integer(self):
1474 if isinstance(self.data, int):
1475 return self.data
1476 return None
1477
1478 def read_bool(self):
1479 if isinstance(self.data, bool):
1480 return self.data
1481 return None
1482
1483 def read_float(self):
1484 if isinstance(self.data, (int, float, str)):
1485 return float(self.data)
1486 return None
1487
1488 def read_iri(self):
1489 if isinstance(self.data, str):
1490 return self.data
1491 return None
1492
1493 def read_enum(self, e):
1494 if isinstance(self.data, str):
1495 return self.data
1496 return None
1497
1498 def read_list(self):
1499 if isinstance(self.data, (list, tuple, set)):
1500 for v in self.data:
1501 yield self.__class__(v)
1502 else:
1503 yield self
1504
1505 def __get_value(self, *keys):
1506 for k in keys:
1507 if k and k in self.data:
1508 return self.data[k]
1509 return None
1510
1511 @contextmanager
1512 def read_property(self, key):
1513 v = self.__get_value(key)
1514 if v is not None:
1515 yield self.__class__(v)
1516 else:
1517 yield None
1518
1519 def object_keys(self):
1520 for key in self.data.keys():
1521 if key in ("@type", "type"):
1522 continue
1523 if self.root and key == "@context":
1524 continue
1525 yield key
1526
1527 def read_object(self):
1528 typ = self.__get_value("@type", "type")
1529 if typ is not None:
1530 return typ, self
1531
1532 return None, self
1533
1534 def read_object_id(self, alias=None):
1535 return self.__get_value(alias, "@id")
1536
1537
1538class JSONLDDeserializer(object):
1539 def deserialize_data(self, data, objectset: SHACLObjectSet):
1540 if "@graph" in data:
1541 h = JSONLDDecoder(data["@graph"], True)
1542 else:
1543 h = JSONLDDecoder(data, True)
1544
1545 objectset.decode(h)
1546
1547 def read(self, f, objectset: SHACLObjectSet):
1548 data = json.load(f)
1549 self.deserialize_data(data, objectset)
1550
1551
1552class Encoder(ABC):
1553 @abstractmethod
1554 def write_string(self, v):
1555 """
1556 Write a string value
1557
1558 Encodes the value as a string in the output
1559 """
1560 pass
1561
1562 @abstractmethod
1563 def write_datetime(self, v):
1564 """
1565 Write a date & time string
1566
1567 Encodes the value as an ISO datetime string
1568
1569 Note: The provided string is already correctly encoded as an ISO datetime
1570 """
1571 pass
1572
1573 @abstractmethod
1574 def write_integer(self, v):
1575 """
1576 Write an integer value
1577
1578 Encodes the value as an integer in the output
1579 """
1580 pass
1581
1582 @abstractmethod
1583 def write_iri(self, v, compact=None):
1584 """
1585 Write IRI
1586
1587 Encodes the string as an IRI. Note that the string will be either a
1588 fully qualified IRI or a blank node ID. If `compact` is provided and
1589 the serialization supports compacted IRIs, it should be preferred to
1590 the full IRI
1591 """
1592 pass
1593
1594 @abstractmethod
1595 def write_enum(self, v, e, compact=None):
1596 """
1597 Write enum value IRI
1598
1599 Encodes the string enum value IRI. Note that the string will be a fully
1600 qualified IRI. If `compact` is provided and the serialization supports
1601 compacted IRIs, it should be preferred to the full IRI.
1602 """
1603 pass
1604
1605 @abstractmethod
1606 def write_bool(self, v):
1607 """
1608 Write boolean
1609
1610 Encodes the value as a boolean in the output
1611 """
1612 pass
1613
1614 @abstractmethod
1615 def write_float(self, v):
1616 """
1617 Write float
1618
1619 Encodes the value as a floating point number in the output
1620 """
1621 pass
1622
1623 @abstractmethod
1624 @contextmanager
1625 def write_object(self, o, _id, needs_id):
1626 """
1627 Write object
1628
1629 A context manager that yields an `Encoder` that can be used to encode
1630 the given object properties.
1631
1632 The provided ID will always be a valid ID (even if o._id is `None`), in
1633 case the `Encoder` _must_ have an ID. `needs_id` is a hint to indicate
1634 to the `Encoder` if an ID must be written or not (if that is even an
1635 option). If it is `True`, the `Encoder` must encode an ID for the
1636 object. If `False`, the encoder is not required to encode an ID and may
1637 omit it.
1638
1639 The ID will be either a fully qualified IRI, or a blank node IRI.
1640
1641 Properties will be written the object using `write_property`
1642 """
1643 pass
1644
1645 @abstractmethod
1646 @contextmanager
1647 def write_property(self, iri, compact=None):
1648 """
1649 Write object property
1650
1651 A context manager that yields an `Encoder` that can be used to encode
1652 the value for the property with the given IRI in the current object
1653
1654 Note that the IRI will be fully qualified. If `compact` is provided and
1655 the serialization supports compacted IRIs, it should be preferred to
1656 the full IRI.
1657 """
1658 pass
1659
1660 @abstractmethod
1661 @contextmanager
1662 def write_list(self):
1663 """
1664 Write list
1665
1666 A context manager that yields an `Encoder` that can be used to encode a
1667 list.
1668
1669 Each item of the list will be added using `write_list_item`
1670 """
1671 pass
1672
1673 @abstractmethod
1674 @contextmanager
1675 def write_list_item(self):
1676 """
1677 Write list item
1678
1679 A context manager that yields an `Encoder` that can be used to encode
1680 the value for a list item
1681 """
1682 pass
1683
1684
1685class JSONLDEncoder(Encoder):
1686 def __init__(self, data=None):
1687 self.data = data
1688
1689 def write_string(self, v):
1690 self.data = v
1691
1692 def write_datetime(self, v):
1693 self.data = v
1694
1695 def write_integer(self, v):
1696 self.data = v
1697
1698 def write_iri(self, v, compact=None):
1699 self.write_string(compact or v)
1700
1701 def write_enum(self, v, e, compact=None):
1702 self.write_string(compact or v)
1703
1704 def write_bool(self, v):
1705 self.data = v
1706
1707 def write_float(self, v):
1708 self.data = str(v)
1709
1710 @contextmanager
1711 def write_property(self, iri, compact=None):
1712 s = self.__class__(None)
1713 yield s
1714 if s.data is not None:
1715 self.data[compact or iri] = s.data
1716
1717 @contextmanager
1718 def write_object(self, o, _id, needs_id):
1719 self.data = {
1720 "type": o.COMPACT_TYPE or o.TYPE,
1721 }
1722 if needs_id:
1723 self.data[o.ID_ALIAS or "@id"] = _id
1724 yield self
1725
1726 @contextmanager
1727 def write_list(self):
1728 self.data = []
1729 yield self
1730 if not self.data:
1731 self.data = None
1732
1733 @contextmanager
1734 def write_list_item(self):
1735 s = self.__class__(None)
1736 yield s
1737 if s.data is not None:
1738 self.data.append(s.data)
1739
1740
1741class JSONLDSerializer(object):
1742 def __init__(self, **args):
1743 self.args = args
1744
1745 def serialize_data(
1746 self,
1747 objectset: SHACLObjectSet,
1748 force_at_graph=False,
1749 ):
1750 h = JSONLDEncoder()
1751 objectset.encode(h, force_at_graph)
1752 data = {}
1753 if len(CONTEXT_URLS) == 1:
1754 data["@context"] = CONTEXT_URLS[0]
1755 elif CONTEXT_URLS:
1756 data["@context"] = CONTEXT_URLS
1757
1758 if isinstance(h.data, list):
1759 data["@graph"] = h.data
1760 else:
1761 for k, v in h.data.items():
1762 data[k] = v
1763
1764 return data
1765
1766 def write(
1767 self,
1768 objectset: SHACLObjectSet,
1769 f,
1770 force_at_graph=False,
1771 **kwargs,
1772 ):
1773 """
1774 Write a SHACLObjectSet to a JSON LD file
1775
1776 If force_at_graph is True, a @graph node will always be written
1777 """
1778 data = self.serialize_data(objectset, force_at_graph)
1779
1780 args = {**self.args, **kwargs}
1781
1782 sha1 = hashlib.sha1()
1783 for chunk in json.JSONEncoder(**args).iterencode(data):
1784 chunk = chunk.encode("utf-8")
1785 f.write(chunk)
1786 sha1.update(chunk)
1787
1788 return sha1.hexdigest()
1789
1790
1791class JSONLDInlineEncoder(Encoder):
1792 def __init__(self, f, sha1):
1793 self.f = f
1794 self.comma = False
1795 self.sha1 = sha1
1796
1797 def write(self, s):
1798 s = s.encode("utf-8")
1799 self.f.write(s)
1800 self.sha1.update(s)
1801
1802 def _write_comma(self):
1803 if self.comma:
1804 self.write(",")
1805 self.comma = False
1806
1807 def write_string(self, v):
1808 self.write(json.dumps(v))
1809
1810 def write_datetime(self, v):
1811 self.write_string(v)
1812
1813 def write_integer(self, v):
1814 self.write(f"{v}")
1815
1816 def write_iri(self, v, compact=None):
1817 self.write_string(compact or v)
1818
1819 def write_enum(self, v, e, compact=None):
1820 self.write_iri(v, compact)
1821
1822 def write_bool(self, v):
1823 if v:
1824 self.write("true")
1825 else:
1826 self.write("false")
1827
1828 def write_float(self, v):
1829 self.write(json.dumps(str(v)))
1830
1831 @contextmanager
1832 def write_property(self, iri, compact=None):
1833 self._write_comma()
1834 self.write_string(compact or iri)
1835 self.write(":")
1836 yield self
1837 self.comma = True
1838
1839 @contextmanager
1840 def write_object(self, o, _id, needs_id):
1841 self._write_comma()
1842
1843 self.write("{")
1844 self.write_string("type")
1845 self.write(":")
1846 self.write_string(o.COMPACT_TYPE or o.TYPE)
1847 self.comma = True
1848
1849 if needs_id:
1850 self._write_comma()
1851 self.write_string(o.ID_ALIAS or "@id")
1852 self.write(":")
1853 self.write_string(_id)
1854 self.comma = True
1855
1856 self.comma = True
1857 yield self
1858
1859 self.write("}")
1860 self.comma = True
1861
1862 @contextmanager
1863 def write_list(self):
1864 self._write_comma()
1865 self.write("[")
1866 yield self.__class__(self.f, self.sha1)
1867 self.write("]")
1868 self.comma = True
1869
1870 @contextmanager
1871 def write_list_item(self):
1872 self._write_comma()
1873 yield self.__class__(self.f, self.sha1)
1874 self.comma = True
1875
1876
1877class JSONLDInlineSerializer(object):
1878 def write(
1879 self,
1880 objectset: SHACLObjectSet,
1881 f,
1882 force_at_graph=False,
1883 ):
1884 """
1885 Write a SHACLObjectSet to a JSON LD file
1886
1887 Note: force_at_graph is included for compatibility, but ignored. This
1888 serializer always writes out a graph
1889 """
1890 sha1 = hashlib.sha1()
1891 h = JSONLDInlineEncoder(f, sha1)
1892 h.write('{"@context":')
1893 if len(CONTEXT_URLS) == 1:
1894 h.write(f'"{CONTEXT_URLS[0]}"')
1895 elif CONTEXT_URLS:
1896 h.write('["')
1897 h.write('","'.join(CONTEXT_URLS))
1898 h.write('"]')
1899 h.write(",")
1900
1901 h.write('"@graph":')
1902
1903 objectset.encode(h, True)
1904 h.write("}")
1905 return sha1.hexdigest()
1906
1907
1908def print_tree(objects, all_fields=False):
1909 """
1910 Print object tree
1911 """
1912 seen = set()
1913
1914 def callback(value, path):
1915 nonlocal seen
1916
1917 s = (" " * (len(path) - 1)) + f"{path[-1]}"
1918 if isinstance(value, SHACLObject):
1919 s += f" {value} ({id(value)})"
1920 is_empty = False
1921 elif isinstance(value, ListProxy):
1922 is_empty = len(value) == 0
1923 if is_empty:
1924 s += " []"
1925 else:
1926 s += f" {value!r}"
1927 is_empty = value is None
1928
1929 if all_fields or not is_empty:
1930 print(s)
1931
1932 if isinstance(value, SHACLObject):
1933 if value in seen:
1934 return False
1935 seen.add(value)
1936 return True
1937
1938 return True
1939
1940 for o in objects:
1941 o.walk(callback)
1942
1943
1944# fmt: off
1945"""Format Guard"""
1946
1947
1948CONTEXT_URLS = [
1949 "https://spdx.org/rdf/3.0.0/spdx-context.jsonld",
1950]
1951
1952_NI_ENCODE_CONTEXT = {
1953 "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/kilowattHour": "ai_EnergyUnitType:kilowattHour",
1954 "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/megajoule": "ai_EnergyUnitType:megajoule",
1955 "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/other": "ai_EnergyUnitType:other",
1956 "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/high": "ai_SafetyRiskAssessmentType:high",
1957 "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/low": "ai_SafetyRiskAssessmentType:low",
1958 "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/medium": "ai_SafetyRiskAssessmentType:medium",
1959 "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/serious": "ai_SafetyRiskAssessmentType:serious",
1960 "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/other": "AnnotationType:other",
1961 "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/review": "AnnotationType:review",
1962 "https://spdx.org/rdf/3.0.0/terms/Core/NoAssertionElement": "spdx:Core/NoAssertionElement",
1963 "https://spdx.org/rdf/3.0.0/terms/Core/NoneElement": "spdx:Core/NoneElement",
1964 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe22": "ExternalIdentifierType:cpe22",
1965 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe23": "ExternalIdentifierType:cpe23",
1966 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cve": "ExternalIdentifierType:cve",
1967 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/email": "ExternalIdentifierType:email",
1968 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/gitoid": "ExternalIdentifierType:gitoid",
1969 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/other": "ExternalIdentifierType:other",
1970 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/packageUrl": "ExternalIdentifierType:packageUrl",
1971 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/securityOther": "ExternalIdentifierType:securityOther",
1972 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swhid": "ExternalIdentifierType:swhid",
1973 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swid": "ExternalIdentifierType:swid",
1974 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/urlScheme": "ExternalIdentifierType:urlScheme",
1975 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altDownloadLocation": "ExternalRefType:altDownloadLocation",
1976 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altWebPage": "ExternalRefType:altWebPage",
1977 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/binaryArtifact": "ExternalRefType:binaryArtifact",
1978 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/bower": "ExternalRefType:bower",
1979 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildMeta": "ExternalRefType:buildMeta",
1980 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildSystem": "ExternalRefType:buildSystem",
1981 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/certificationReport": "ExternalRefType:certificationReport",
1982 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/chat": "ExternalRefType:chat",
1983 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/componentAnalysisReport": "ExternalRefType:componentAnalysisReport",
1984 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/cwe": "ExternalRefType:cwe",
1985 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/documentation": "ExternalRefType:documentation",
1986 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/dynamicAnalysisReport": "ExternalRefType:dynamicAnalysisReport",
1987 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/eolNotice": "ExternalRefType:eolNotice",
1988 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/exportControlAssessment": "ExternalRefType:exportControlAssessment",
1989 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/funding": "ExternalRefType:funding",
1990 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/issueTracker": "ExternalRefType:issueTracker",
1991 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/license": "ExternalRefType:license",
1992 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mailingList": "ExternalRefType:mailingList",
1993 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mavenCentral": "ExternalRefType:mavenCentral",
1994 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/metrics": "ExternalRefType:metrics",
1995 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/npm": "ExternalRefType:npm",
1996 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/nuget": "ExternalRefType:nuget",
1997 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/other": "ExternalRefType:other",
1998 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/privacyAssessment": "ExternalRefType:privacyAssessment",
1999 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/productMetadata": "ExternalRefType:productMetadata",
2000 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/purchaseOrder": "ExternalRefType:purchaseOrder",
2001 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/qualityAssessmentReport": "ExternalRefType:qualityAssessmentReport",
2002 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseHistory": "ExternalRefType:releaseHistory",
2003 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseNotes": "ExternalRefType:releaseNotes",
2004 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/riskAssessment": "ExternalRefType:riskAssessment",
2005 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/runtimeAnalysisReport": "ExternalRefType:runtimeAnalysisReport",
2006 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/secureSoftwareAttestation": "ExternalRefType:secureSoftwareAttestation",
2007 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdversaryModel": "ExternalRefType:securityAdversaryModel",
2008 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdvisory": "ExternalRefType:securityAdvisory",
2009 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityFix": "ExternalRefType:securityFix",
2010 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityOther": "ExternalRefType:securityOther",
2011 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPenTestReport": "ExternalRefType:securityPenTestReport",
2012 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPolicy": "ExternalRefType:securityPolicy",
2013 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityThreatModel": "ExternalRefType:securityThreatModel",
2014 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/socialMedia": "ExternalRefType:socialMedia",
2015 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/sourceArtifact": "ExternalRefType:sourceArtifact",
2016 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/staticAnalysisReport": "ExternalRefType:staticAnalysisReport",
2017 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/support": "ExternalRefType:support",
2018 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vcs": "ExternalRefType:vcs",
2019 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityDisclosureReport": "ExternalRefType:vulnerabilityDisclosureReport",
2020 "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment": "ExternalRefType:vulnerabilityExploitabilityAssessment",
2021 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256": "HashAlgorithm:blake2b256",
2022 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384": "HashAlgorithm:blake2b384",
2023 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512": "HashAlgorithm:blake2b512",
2024 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3": "HashAlgorithm:blake3",
2025 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium": "HashAlgorithm:crystalsDilithium",
2026 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber": "HashAlgorithm:crystalsKyber",
2027 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon": "HashAlgorithm:falcon",
2028 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2": "HashAlgorithm:md2",
2029 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4": "HashAlgorithm:md4",
2030 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5": "HashAlgorithm:md5",
2031 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6": "HashAlgorithm:md6",
2032 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other": "HashAlgorithm:other",
2033 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1": "HashAlgorithm:sha1",
2034 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224": "HashAlgorithm:sha224",
2035 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256": "HashAlgorithm:sha256",
2036 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384": "HashAlgorithm:sha384",
2037 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224": "HashAlgorithm:sha3_224",
2038 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256": "HashAlgorithm:sha3_256",
2039 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384": "HashAlgorithm:sha3_384",
2040 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512": "HashAlgorithm:sha3_512",
2041 "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512": "HashAlgorithm:sha512",
2042 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/build": "LifecycleScopeType:build",
2043 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/design": "LifecycleScopeType:design",
2044 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/development": "LifecycleScopeType:development",
2045 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/other": "LifecycleScopeType:other",
2046 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/runtime": "LifecycleScopeType:runtime",
2047 "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/test": "LifecycleScopeType:test",
2048 "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no": "PresenceType:no",
2049 "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion": "PresenceType:noAssertion",
2050 "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes": "PresenceType:yes",
2051 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/ai": "ProfileIdentifierType:ai",
2052 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/build": "ProfileIdentifierType:build",
2053 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/core": "ProfileIdentifierType:core",
2054 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/dataset": "ProfileIdentifierType:dataset",
2055 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/expandedLicensing": "ProfileIdentifierType:expandedLicensing",
2056 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/extension": "ProfileIdentifierType:extension",
2057 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/lite": "ProfileIdentifierType:lite",
2058 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/security": "ProfileIdentifierType:security",
2059 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/simpleLicensing": "ProfileIdentifierType:simpleLicensing",
2060 "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/software": "ProfileIdentifierType:software",
2061 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/complete": "RelationshipCompleteness:complete",
2062 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/incomplete": "RelationshipCompleteness:incomplete",
2063 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/noAssertion": "RelationshipCompleteness:noAssertion",
2064 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/affects": "RelationshipType:affects",
2065 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/amendedBy": "RelationshipType:amendedBy",
2066 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/ancestorOf": "RelationshipType:ancestorOf",
2067 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/availableFrom": "RelationshipType:availableFrom",
2068 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/configures": "RelationshipType:configures",
2069 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/contains": "RelationshipType:contains",
2070 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/coordinatedBy": "RelationshipType:coordinatedBy",
2071 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/copiedTo": "RelationshipType:copiedTo",
2072 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/delegatedTo": "RelationshipType:delegatedTo",
2073 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/dependsOn": "RelationshipType:dependsOn",
2074 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/descendantOf": "RelationshipType:descendantOf",
2075 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/describes": "RelationshipType:describes",
2076 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/doesNotAffect": "RelationshipType:doesNotAffect",
2077 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/expandsTo": "RelationshipType:expandsTo",
2078 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/exploitCreatedBy": "RelationshipType:exploitCreatedBy",
2079 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedBy": "RelationshipType:fixedBy",
2080 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedIn": "RelationshipType:fixedIn",
2081 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/foundBy": "RelationshipType:foundBy",
2082 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/generates": "RelationshipType:generates",
2083 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAddedFile": "RelationshipType:hasAddedFile",
2084 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssessmentFor": "RelationshipType:hasAssessmentFor",
2085 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssociatedVulnerability": "RelationshipType:hasAssociatedVulnerability",
2086 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasConcludedLicense": "RelationshipType:hasConcludedLicense",
2087 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDataFile": "RelationshipType:hasDataFile",
2088 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeclaredLicense": "RelationshipType:hasDeclaredLicense",
2089 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeletedFile": "RelationshipType:hasDeletedFile",
2090 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDependencyManifest": "RelationshipType:hasDependencyManifest",
2091 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDistributionArtifact": "RelationshipType:hasDistributionArtifact",
2092 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDocumentation": "RelationshipType:hasDocumentation",
2093 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDynamicLink": "RelationshipType:hasDynamicLink",
2094 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasEvidence": "RelationshipType:hasEvidence",
2095 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasExample": "RelationshipType:hasExample",
2096 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasHost": "RelationshipType:hasHost",
2097 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasInputs": "RelationshipType:hasInputs",
2098 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasMetadata": "RelationshipType:hasMetadata",
2099 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalComponent": "RelationshipType:hasOptionalComponent",
2100 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalDependency": "RelationshipType:hasOptionalDependency",
2101 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOutputs": "RelationshipType:hasOutputs",
2102 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasPrerequsite": "RelationshipType:hasPrerequsite",
2103 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasProvidedDependency": "RelationshipType:hasProvidedDependency",
2104 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasRequirement": "RelationshipType:hasRequirement",
2105 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasSpecification": "RelationshipType:hasSpecification",
2106 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasStaticLink": "RelationshipType:hasStaticLink",
2107 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTest": "RelationshipType:hasTest",
2108 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTestCase": "RelationshipType:hasTestCase",
2109 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasVariant": "RelationshipType:hasVariant",
2110 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/invokedBy": "RelationshipType:invokedBy",
2111 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/modifiedBy": "RelationshipType:modifiedBy",
2112 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/other": "RelationshipType:other",
2113 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/packagedBy": "RelationshipType:packagedBy",
2114 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/patchedBy": "RelationshipType:patchedBy",
2115 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/publishedBy": "RelationshipType:publishedBy",
2116 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/reportedBy": "RelationshipType:reportedBy",
2117 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/republishedBy": "RelationshipType:republishedBy",
2118 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/serializedInArtifact": "RelationshipType:serializedInArtifact",
2119 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/testedOn": "RelationshipType:testedOn",
2120 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/trainedOn": "RelationshipType:trainedOn",
2121 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/underInvestigationFor": "RelationshipType:underInvestigationFor",
2122 "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/usesTool": "RelationshipType:usesTool",
2123 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/deployed": "SupportType:deployed",
2124 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/development": "SupportType:development",
2125 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/endOfSupport": "SupportType:endOfSupport",
2126 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/limitedSupport": "SupportType:limitedSupport",
2127 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noAssertion": "SupportType:noAssertion",
2128 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noSupport": "SupportType:noSupport",
2129 "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/support": "SupportType:support",
2130 "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/amber": "dataset_ConfidentialityLevelType:amber",
2131 "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/clear": "dataset_ConfidentialityLevelType:clear",
2132 "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/green": "dataset_ConfidentialityLevelType:green",
2133 "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/red": "dataset_ConfidentialityLevelType:red",
2134 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/clickthrough": "dataset_DatasetAvailabilityType:clickthrough",
2135 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/directDownload": "dataset_DatasetAvailabilityType:directDownload",
2136 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/query": "dataset_DatasetAvailabilityType:query",
2137 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/registration": "dataset_DatasetAvailabilityType:registration",
2138 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/scrapingScript": "dataset_DatasetAvailabilityType:scrapingScript",
2139 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/audio": "dataset_DatasetType:audio",
2140 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/categorical": "dataset_DatasetType:categorical",
2141 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/graph": "dataset_DatasetType:graph",
2142 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/image": "dataset_DatasetType:image",
2143 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/noAssertion": "dataset_DatasetType:noAssertion",
2144 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/numeric": "dataset_DatasetType:numeric",
2145 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/other": "dataset_DatasetType:other",
2146 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/sensor": "dataset_DatasetType:sensor",
2147 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/structured": "dataset_DatasetType:structured",
2148 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/syntactic": "dataset_DatasetType:syntactic",
2149 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/text": "dataset_DatasetType:text",
2150 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timeseries": "dataset_DatasetType:timeseries",
2151 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timestamp": "dataset_DatasetType:timestamp",
2152 "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/video": "dataset_DatasetType:video",
2153 "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical": "security_CvssSeverityType:critical",
2154 "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high": "security_CvssSeverityType:high",
2155 "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low": "security_CvssSeverityType:low",
2156 "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium": "security_CvssSeverityType:medium",
2157 "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none": "security_CvssSeverityType:none",
2158 "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/kev": "security_ExploitCatalogType:kev",
2159 "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/other": "security_ExploitCatalogType:other",
2160 "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/act": "security_SsvcDecisionType:act",
2161 "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/attend": "security_SsvcDecisionType:attend",
2162 "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/track": "security_SsvcDecisionType:track",
2163 "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/trackStar": "security_SsvcDecisionType:trackStar",
2164 "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/componentNotPresent": "security_VexJustificationType:componentNotPresent",
2165 "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist": "security_VexJustificationType:inlineMitigationsAlreadyExist",
2166 "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary": "security_VexJustificationType:vulnerableCodeCannotBeControlledByAdversary",
2167 "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath": "security_VexJustificationType:vulnerableCodeNotInExecutePath",
2168 "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotPresent": "security_VexJustificationType:vulnerableCodeNotPresent",
2169 "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/gitoid": "software_ContentIdentifierType:gitoid",
2170 "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/swhid": "software_ContentIdentifierType:swhid",
2171 "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/directory": "software_FileKindType:directory",
2172 "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/file": "software_FileKindType:file",
2173 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/analyzed": "software_SbomType:analyzed",
2174 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/build": "software_SbomType:build",
2175 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/deployed": "software_SbomType:deployed",
2176 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/design": "software_SbomType:design",
2177 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/runtime": "software_SbomType:runtime",
2178 "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/source": "software_SbomType:source",
2179 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application": "software_SoftwarePurpose:application",
2180 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive": "software_SoftwarePurpose:archive",
2181 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom": "software_SoftwarePurpose:bom",
2182 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration": "software_SoftwarePurpose:configuration",
2183 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container": "software_SoftwarePurpose:container",
2184 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data": "software_SoftwarePurpose:data",
2185 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device": "software_SoftwarePurpose:device",
2186 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver": "software_SoftwarePurpose:deviceDriver",
2187 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage": "software_SoftwarePurpose:diskImage",
2188 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation": "software_SoftwarePurpose:documentation",
2189 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence": "software_SoftwarePurpose:evidence",
2190 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable": "software_SoftwarePurpose:executable",
2191 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file": "software_SoftwarePurpose:file",
2192 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage": "software_SoftwarePurpose:filesystemImage",
2193 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware": "software_SoftwarePurpose:firmware",
2194 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework": "software_SoftwarePurpose:framework",
2195 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install": "software_SoftwarePurpose:install",
2196 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library": "software_SoftwarePurpose:library",
2197 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest": "software_SoftwarePurpose:manifest",
2198 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model": "software_SoftwarePurpose:model",
2199 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module": "software_SoftwarePurpose:module",
2200 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem": "software_SoftwarePurpose:operatingSystem",
2201 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other": "software_SoftwarePurpose:other",
2202 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch": "software_SoftwarePurpose:patch",
2203 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform": "software_SoftwarePurpose:platform",
2204 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement": "software_SoftwarePurpose:requirement",
2205 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source": "software_SoftwarePurpose:source",
2206 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification": "software_SoftwarePurpose:specification",
2207 "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test": "software_SoftwarePurpose:test",
2208 "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoAssertionLicense": "spdx:ExpandedLicensing/NoAssertionLicense",
2209 "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoneLicense": "spdx:ExpandedLicensing/NoneLicense",
2210}
2211
2212_NI_DECODE_CONTEXT = {
2213 "ai_EnergyUnitType:kilowattHour": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/kilowattHour",
2214 "ai_EnergyUnitType:megajoule": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/megajoule",
2215 "ai_EnergyUnitType:other": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/other",
2216 "ai_SafetyRiskAssessmentType:high": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/high",
2217 "ai_SafetyRiskAssessmentType:low": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/low",
2218 "ai_SafetyRiskAssessmentType:medium": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/medium",
2219 "ai_SafetyRiskAssessmentType:serious": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/serious",
2220 "AnnotationType:other": "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/other",
2221 "AnnotationType:review": "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/review",
2222 "spdx:Core/NoAssertionElement": "https://spdx.org/rdf/3.0.0/terms/Core/NoAssertionElement",
2223 "spdx:Core/NoneElement": "https://spdx.org/rdf/3.0.0/terms/Core/NoneElement",
2224 "ExternalIdentifierType:cpe22": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe22",
2225 "ExternalIdentifierType:cpe23": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe23",
2226 "ExternalIdentifierType:cve": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cve",
2227 "ExternalIdentifierType:email": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/email",
2228 "ExternalIdentifierType:gitoid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/gitoid",
2229 "ExternalIdentifierType:other": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/other",
2230 "ExternalIdentifierType:packageUrl": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/packageUrl",
2231 "ExternalIdentifierType:securityOther": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/securityOther",
2232 "ExternalIdentifierType:swhid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swhid",
2233 "ExternalIdentifierType:swid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swid",
2234 "ExternalIdentifierType:urlScheme": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/urlScheme",
2235 "ExternalRefType:altDownloadLocation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altDownloadLocation",
2236 "ExternalRefType:altWebPage": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altWebPage",
2237 "ExternalRefType:binaryArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/binaryArtifact",
2238 "ExternalRefType:bower": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/bower",
2239 "ExternalRefType:buildMeta": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildMeta",
2240 "ExternalRefType:buildSystem": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildSystem",
2241 "ExternalRefType:certificationReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/certificationReport",
2242 "ExternalRefType:chat": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/chat",
2243 "ExternalRefType:componentAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/componentAnalysisReport",
2244 "ExternalRefType:cwe": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/cwe",
2245 "ExternalRefType:documentation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/documentation",
2246 "ExternalRefType:dynamicAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/dynamicAnalysisReport",
2247 "ExternalRefType:eolNotice": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/eolNotice",
2248 "ExternalRefType:exportControlAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/exportControlAssessment",
2249 "ExternalRefType:funding": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/funding",
2250 "ExternalRefType:issueTracker": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/issueTracker",
2251 "ExternalRefType:license": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/license",
2252 "ExternalRefType:mailingList": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mailingList",
2253 "ExternalRefType:mavenCentral": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mavenCentral",
2254 "ExternalRefType:metrics": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/metrics",
2255 "ExternalRefType:npm": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/npm",
2256 "ExternalRefType:nuget": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/nuget",
2257 "ExternalRefType:other": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/other",
2258 "ExternalRefType:privacyAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/privacyAssessment",
2259 "ExternalRefType:productMetadata": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/productMetadata",
2260 "ExternalRefType:purchaseOrder": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/purchaseOrder",
2261 "ExternalRefType:qualityAssessmentReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/qualityAssessmentReport",
2262 "ExternalRefType:releaseHistory": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseHistory",
2263 "ExternalRefType:releaseNotes": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseNotes",
2264 "ExternalRefType:riskAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/riskAssessment",
2265 "ExternalRefType:runtimeAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/runtimeAnalysisReport",
2266 "ExternalRefType:secureSoftwareAttestation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/secureSoftwareAttestation",
2267 "ExternalRefType:securityAdversaryModel": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdversaryModel",
2268 "ExternalRefType:securityAdvisory": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdvisory",
2269 "ExternalRefType:securityFix": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityFix",
2270 "ExternalRefType:securityOther": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityOther",
2271 "ExternalRefType:securityPenTestReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPenTestReport",
2272 "ExternalRefType:securityPolicy": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPolicy",
2273 "ExternalRefType:securityThreatModel": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityThreatModel",
2274 "ExternalRefType:socialMedia": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/socialMedia",
2275 "ExternalRefType:sourceArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/sourceArtifact",
2276 "ExternalRefType:staticAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/staticAnalysisReport",
2277 "ExternalRefType:support": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/support",
2278 "ExternalRefType:vcs": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vcs",
2279 "ExternalRefType:vulnerabilityDisclosureReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityDisclosureReport",
2280 "ExternalRefType:vulnerabilityExploitabilityAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment",
2281 "HashAlgorithm:blake2b256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256",
2282 "HashAlgorithm:blake2b384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384",
2283 "HashAlgorithm:blake2b512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512",
2284 "HashAlgorithm:blake3": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3",
2285 "HashAlgorithm:crystalsDilithium": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium",
2286 "HashAlgorithm:crystalsKyber": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber",
2287 "HashAlgorithm:falcon": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon",
2288 "HashAlgorithm:md2": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2",
2289 "HashAlgorithm:md4": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4",
2290 "HashAlgorithm:md5": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5",
2291 "HashAlgorithm:md6": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6",
2292 "HashAlgorithm:other": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other",
2293 "HashAlgorithm:sha1": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1",
2294 "HashAlgorithm:sha224": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224",
2295 "HashAlgorithm:sha256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256",
2296 "HashAlgorithm:sha384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384",
2297 "HashAlgorithm:sha3_224": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224",
2298 "HashAlgorithm:sha3_256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256",
2299 "HashAlgorithm:sha3_384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384",
2300 "HashAlgorithm:sha3_512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512",
2301 "HashAlgorithm:sha512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512",
2302 "LifecycleScopeType:build": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/build",
2303 "LifecycleScopeType:design": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/design",
2304 "LifecycleScopeType:development": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/development",
2305 "LifecycleScopeType:other": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/other",
2306 "LifecycleScopeType:runtime": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/runtime",
2307 "LifecycleScopeType:test": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/test",
2308 "PresenceType:no": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no",
2309 "PresenceType:noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion",
2310 "PresenceType:yes": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes",
2311 "ProfileIdentifierType:ai": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/ai",
2312 "ProfileIdentifierType:build": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/build",
2313 "ProfileIdentifierType:core": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/core",
2314 "ProfileIdentifierType:dataset": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/dataset",
2315 "ProfileIdentifierType:expandedLicensing": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/expandedLicensing",
2316 "ProfileIdentifierType:extension": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/extension",
2317 "ProfileIdentifierType:lite": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/lite",
2318 "ProfileIdentifierType:security": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/security",
2319 "ProfileIdentifierType:simpleLicensing": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/simpleLicensing",
2320 "ProfileIdentifierType:software": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/software",
2321 "RelationshipCompleteness:complete": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/complete",
2322 "RelationshipCompleteness:incomplete": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/incomplete",
2323 "RelationshipCompleteness:noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/noAssertion",
2324 "RelationshipType:affects": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/affects",
2325 "RelationshipType:amendedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/amendedBy",
2326 "RelationshipType:ancestorOf": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/ancestorOf",
2327 "RelationshipType:availableFrom": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/availableFrom",
2328 "RelationshipType:configures": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/configures",
2329 "RelationshipType:contains": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/contains",
2330 "RelationshipType:coordinatedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/coordinatedBy",
2331 "RelationshipType:copiedTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/copiedTo",
2332 "RelationshipType:delegatedTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/delegatedTo",
2333 "RelationshipType:dependsOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/dependsOn",
2334 "RelationshipType:descendantOf": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/descendantOf",
2335 "RelationshipType:describes": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/describes",
2336 "RelationshipType:doesNotAffect": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/doesNotAffect",
2337 "RelationshipType:expandsTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/expandsTo",
2338 "RelationshipType:exploitCreatedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/exploitCreatedBy",
2339 "RelationshipType:fixedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedBy",
2340 "RelationshipType:fixedIn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedIn",
2341 "RelationshipType:foundBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/foundBy",
2342 "RelationshipType:generates": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/generates",
2343 "RelationshipType:hasAddedFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAddedFile",
2344 "RelationshipType:hasAssessmentFor": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssessmentFor",
2345 "RelationshipType:hasAssociatedVulnerability": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssociatedVulnerability",
2346 "RelationshipType:hasConcludedLicense": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasConcludedLicense",
2347 "RelationshipType:hasDataFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDataFile",
2348 "RelationshipType:hasDeclaredLicense": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeclaredLicense",
2349 "RelationshipType:hasDeletedFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeletedFile",
2350 "RelationshipType:hasDependencyManifest": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDependencyManifest",
2351 "RelationshipType:hasDistributionArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDistributionArtifact",
2352 "RelationshipType:hasDocumentation": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDocumentation",
2353 "RelationshipType:hasDynamicLink": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDynamicLink",
2354 "RelationshipType:hasEvidence": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasEvidence",
2355 "RelationshipType:hasExample": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasExample",
2356 "RelationshipType:hasHost": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasHost",
2357 "RelationshipType:hasInputs": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasInputs",
2358 "RelationshipType:hasMetadata": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasMetadata",
2359 "RelationshipType:hasOptionalComponent": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalComponent",
2360 "RelationshipType:hasOptionalDependency": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalDependency",
2361 "RelationshipType:hasOutputs": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOutputs",
2362 "RelationshipType:hasPrerequsite": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasPrerequsite",
2363 "RelationshipType:hasProvidedDependency": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasProvidedDependency",
2364 "RelationshipType:hasRequirement": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasRequirement",
2365 "RelationshipType:hasSpecification": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasSpecification",
2366 "RelationshipType:hasStaticLink": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasStaticLink",
2367 "RelationshipType:hasTest": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTest",
2368 "RelationshipType:hasTestCase": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTestCase",
2369 "RelationshipType:hasVariant": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasVariant",
2370 "RelationshipType:invokedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/invokedBy",
2371 "RelationshipType:modifiedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/modifiedBy",
2372 "RelationshipType:other": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/other",
2373 "RelationshipType:packagedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/packagedBy",
2374 "RelationshipType:patchedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/patchedBy",
2375 "RelationshipType:publishedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/publishedBy",
2376 "RelationshipType:reportedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/reportedBy",
2377 "RelationshipType:republishedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/republishedBy",
2378 "RelationshipType:serializedInArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/serializedInArtifact",
2379 "RelationshipType:testedOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/testedOn",
2380 "RelationshipType:trainedOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/trainedOn",
2381 "RelationshipType:underInvestigationFor": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/underInvestigationFor",
2382 "RelationshipType:usesTool": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/usesTool",
2383 "SupportType:deployed": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/deployed",
2384 "SupportType:development": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/development",
2385 "SupportType:endOfSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/endOfSupport",
2386 "SupportType:limitedSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/limitedSupport",
2387 "SupportType:noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noAssertion",
2388 "SupportType:noSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noSupport",
2389 "SupportType:support": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/support",
2390 "dataset_ConfidentialityLevelType:amber": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/amber",
2391 "dataset_ConfidentialityLevelType:clear": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/clear",
2392 "dataset_ConfidentialityLevelType:green": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/green",
2393 "dataset_ConfidentialityLevelType:red": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/red",
2394 "dataset_DatasetAvailabilityType:clickthrough": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/clickthrough",
2395 "dataset_DatasetAvailabilityType:directDownload": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/directDownload",
2396 "dataset_DatasetAvailabilityType:query": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/query",
2397 "dataset_DatasetAvailabilityType:registration": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/registration",
2398 "dataset_DatasetAvailabilityType:scrapingScript": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/scrapingScript",
2399 "dataset_DatasetType:audio": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/audio",
2400 "dataset_DatasetType:categorical": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/categorical",
2401 "dataset_DatasetType:graph": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/graph",
2402 "dataset_DatasetType:image": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/image",
2403 "dataset_DatasetType:noAssertion": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/noAssertion",
2404 "dataset_DatasetType:numeric": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/numeric",
2405 "dataset_DatasetType:other": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/other",
2406 "dataset_DatasetType:sensor": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/sensor",
2407 "dataset_DatasetType:structured": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/structured",
2408 "dataset_DatasetType:syntactic": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/syntactic",
2409 "dataset_DatasetType:text": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/text",
2410 "dataset_DatasetType:timeseries": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timeseries",
2411 "dataset_DatasetType:timestamp": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timestamp",
2412 "dataset_DatasetType:video": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/video",
2413 "security_CvssSeverityType:critical": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical",
2414 "security_CvssSeverityType:high": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high",
2415 "security_CvssSeverityType:low": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low",
2416 "security_CvssSeverityType:medium": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium",
2417 "security_CvssSeverityType:none": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none",
2418 "security_ExploitCatalogType:kev": "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/kev",
2419 "security_ExploitCatalogType:other": "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/other",
2420 "security_SsvcDecisionType:act": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/act",
2421 "security_SsvcDecisionType:attend": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/attend",
2422 "security_SsvcDecisionType:track": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/track",
2423 "security_SsvcDecisionType:trackStar": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/trackStar",
2424 "security_VexJustificationType:componentNotPresent": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/componentNotPresent",
2425 "security_VexJustificationType:inlineMitigationsAlreadyExist": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist",
2426 "security_VexJustificationType:vulnerableCodeCannotBeControlledByAdversary": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary",
2427 "security_VexJustificationType:vulnerableCodeNotInExecutePath": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath",
2428 "security_VexJustificationType:vulnerableCodeNotPresent": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotPresent",
2429 "software_ContentIdentifierType:gitoid": "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/gitoid",
2430 "software_ContentIdentifierType:swhid": "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/swhid",
2431 "software_FileKindType:directory": "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/directory",
2432 "software_FileKindType:file": "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/file",
2433 "software_SbomType:analyzed": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/analyzed",
2434 "software_SbomType:build": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/build",
2435 "software_SbomType:deployed": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/deployed",
2436 "software_SbomType:design": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/design",
2437 "software_SbomType:runtime": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/runtime",
2438 "software_SbomType:source": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/source",
2439 "software_SoftwarePurpose:application": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application",
2440 "software_SoftwarePurpose:archive": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive",
2441 "software_SoftwarePurpose:bom": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom",
2442 "software_SoftwarePurpose:configuration": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration",
2443 "software_SoftwarePurpose:container": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container",
2444 "software_SoftwarePurpose:data": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data",
2445 "software_SoftwarePurpose:device": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device",
2446 "software_SoftwarePurpose:deviceDriver": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver",
2447 "software_SoftwarePurpose:diskImage": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage",
2448 "software_SoftwarePurpose:documentation": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation",
2449 "software_SoftwarePurpose:evidence": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence",
2450 "software_SoftwarePurpose:executable": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable",
2451 "software_SoftwarePurpose:file": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file",
2452 "software_SoftwarePurpose:filesystemImage": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage",
2453 "software_SoftwarePurpose:firmware": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware",
2454 "software_SoftwarePurpose:framework": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework",
2455 "software_SoftwarePurpose:install": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install",
2456 "software_SoftwarePurpose:library": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library",
2457 "software_SoftwarePurpose:manifest": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest",
2458 "software_SoftwarePurpose:model": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model",
2459 "software_SoftwarePurpose:module": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module",
2460 "software_SoftwarePurpose:operatingSystem": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem",
2461 "software_SoftwarePurpose:other": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other",
2462 "software_SoftwarePurpose:patch": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch",
2463 "software_SoftwarePurpose:platform": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform",
2464 "software_SoftwarePurpose:requirement": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement",
2465 "software_SoftwarePurpose:source": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source",
2466 "software_SoftwarePurpose:specification": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification",
2467 "software_SoftwarePurpose:test": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test",
2468 "spdx:ExpandedLicensing/NoAssertionLicense": "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoAssertionLicense",
2469 "spdx:ExpandedLicensing/NoneLicense": "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoneLicense",
2470}
2471
2472
2473# CLASSES
2474# The class that contains properties to describe energy consumption incurred
2475# by an AI model in different stages of its lifecycle.
2476@register("https://spdx.org/rdf/3.0.0/terms/AI/EnergyConsumption", compact_type="ai_EnergyConsumption", abstract=False)
2477class ai_EnergyConsumption(SHACLObject):
2478 NODE_KIND = NodeKind.BlankNodeOrIRI
2479 NAMED_INDIVIDUALS = {
2480 }
2481
2482 @classmethod
2483 def _register_props(cls):
2484 super()._register_props()
2485 # Specifies the amount of energy consumed when finetuning the AI model that is
2486 # being used in the AI system.
2487 cls._add_property(
2488 "ai_finetuningEnergyConsumption",
2489 ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2490 iri="https://spdx.org/rdf/3.0.0/terms/AI/finetuningEnergyConsumption",
2491 compact="ai_finetuningEnergyConsumption",
2492 )
2493 # Specifies the amount of energy consumed during inference time by an AI model
2494 # that is being used in the AI system.
2495 cls._add_property(
2496 "ai_inferenceEnergyConsumption",
2497 ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2498 iri="https://spdx.org/rdf/3.0.0/terms/AI/inferenceEnergyConsumption",
2499 compact="ai_inferenceEnergyConsumption",
2500 )
2501 # Specifies the amount of energy consumed when training the AI model that is
2502 # being used in the AI system.
2503 cls._add_property(
2504 "ai_trainingEnergyConsumption",
2505 ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2506 iri="https://spdx.org/rdf/3.0.0/terms/AI/trainingEnergyConsumption",
2507 compact="ai_trainingEnergyConsumption",
2508 )
2509
2510
2511# The class that helps note down the quantity of energy consumption and the unit
2512# used for measurement.
2513@register("https://spdx.org/rdf/3.0.0/terms/AI/EnergyConsumptionDescription", compact_type="ai_EnergyConsumptionDescription", abstract=False)
2514class ai_EnergyConsumptionDescription(SHACLObject):
2515 NODE_KIND = NodeKind.BlankNodeOrIRI
2516 NAMED_INDIVIDUALS = {
2517 }
2518
2519 @classmethod
2520 def _register_props(cls):
2521 super()._register_props()
2522 # Represents the energy quantity.
2523 cls._add_property(
2524 "ai_energyQuantity",
2525 FloatProp(),
2526 iri="https://spdx.org/rdf/3.0.0/terms/AI/energyQuantity",
2527 min_count=1,
2528 compact="ai_energyQuantity",
2529 )
2530 # Specifies the unit in which energy is measured.
2531 cls._add_property(
2532 "ai_energyUnit",
2533 EnumProp([
2534 ("https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/kilowattHour", "kilowattHour"),
2535 ("https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/megajoule", "megajoule"),
2536 ("https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/other", "other"),
2537 ]),
2538 iri="https://spdx.org/rdf/3.0.0/terms/AI/energyUnit",
2539 min_count=1,
2540 compact="ai_energyUnit",
2541 )
2542
2543
2544# Specifies the unit of energy consumption.
2545@register("https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType", compact_type="ai_EnergyUnitType", abstract=False)
2546class ai_EnergyUnitType(SHACLObject):
2547 NODE_KIND = NodeKind.BlankNodeOrIRI
2548 NAMED_INDIVIDUALS = {
2549 "kilowattHour": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/kilowattHour",
2550 "megajoule": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/megajoule",
2551 "other": "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/other",
2552 }
2553 # Kilowatt-hour.
2554 kilowattHour = "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/kilowattHour"
2555 # Megajoule.
2556 megajoule = "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/megajoule"
2557 # Any other units of energy measurement.
2558 other = "https://spdx.org/rdf/3.0.0/terms/AI/EnergyUnitType/other"
2559
2560
2561# Specifies the safety risk level.
2562@register("https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType", compact_type="ai_SafetyRiskAssessmentType", abstract=False)
2563class ai_SafetyRiskAssessmentType(SHACLObject):
2564 NODE_KIND = NodeKind.BlankNodeOrIRI
2565 NAMED_INDIVIDUALS = {
2566 "high": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/high",
2567 "low": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/low",
2568 "medium": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/medium",
2569 "serious": "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/serious",
2570 }
2571 # The second-highest level of risk posed by an AI system.
2572 high = "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/high"
2573 # Low/no risk is posed by an AI system.
2574 low = "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/low"
2575 # The third-highest level of risk posed by an AI system.
2576 medium = "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/medium"
2577 # The highest level of risk posed by an AI system.
2578 serious = "https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/serious"
2579
2580
2581# Specifies the type of an annotation.
2582@register("https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType", compact_type="AnnotationType", abstract=False)
2583class AnnotationType(SHACLObject):
2584 NODE_KIND = NodeKind.BlankNodeOrIRI
2585 NAMED_INDIVIDUALS = {
2586 "other": "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/other",
2587 "review": "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/review",
2588 }
2589 # Used to store extra information about an Element which is not part of a Review (e.g. extra information provided during the creation of the Element).
2590 other = "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/other"
2591 # Used when someone reviews the Element.
2592 review = "https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/review"
2593
2594
2595# Provides information about the creation of the Element.
2596@register("https://spdx.org/rdf/3.0.0/terms/Core/CreationInfo", compact_type="CreationInfo", abstract=False)
2597class CreationInfo(SHACLObject):
2598 NODE_KIND = NodeKind.BlankNodeOrIRI
2599 NAMED_INDIVIDUALS = {
2600 }
2601
2602 @classmethod
2603 def _register_props(cls):
2604 super()._register_props()
2605 # Provide consumers with comments by the creator of the Element about the
2606 # Element.
2607 cls._add_property(
2608 "comment",
2609 StringProp(),
2610 iri="https://spdx.org/rdf/3.0.0/terms/Core/comment",
2611 compact="comment",
2612 )
2613 # Identifies when the Element was originally created.
2614 cls._add_property(
2615 "created",
2616 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
2617 iri="https://spdx.org/rdf/3.0.0/terms/Core/created",
2618 min_count=1,
2619 compact="created",
2620 )
2621 # Identifies who or what created the Element.
2622 cls._add_property(
2623 "createdBy",
2624 ListProp(ObjectProp(Agent, False)),
2625 iri="https://spdx.org/rdf/3.0.0/terms/Core/createdBy",
2626 min_count=1,
2627 compact="createdBy",
2628 )
2629 # Identifies the tooling that was used during the creation of the Element.
2630 cls._add_property(
2631 "createdUsing",
2632 ListProp(ObjectProp(Tool, False)),
2633 iri="https://spdx.org/rdf/3.0.0/terms/Core/createdUsing",
2634 compact="createdUsing",
2635 )
2636 # Provides a reference number that can be used to understand how to parse and interpret an Element.
2637 cls._add_property(
2638 "specVersion",
2639 StringProp(pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$",),
2640 iri="https://spdx.org/rdf/3.0.0/terms/Core/specVersion",
2641 min_count=1,
2642 compact="specVersion",
2643 )
2644
2645
2646# A key with an associated value.
2647@register("https://spdx.org/rdf/3.0.0/terms/Core/DictionaryEntry", compact_type="DictionaryEntry", abstract=False)
2648class DictionaryEntry(SHACLObject):
2649 NODE_KIND = NodeKind.BlankNodeOrIRI
2650 NAMED_INDIVIDUALS = {
2651 }
2652
2653 @classmethod
2654 def _register_props(cls):
2655 super()._register_props()
2656 # A key used in a generic key-value pair.
2657 cls._add_property(
2658 "key",
2659 StringProp(),
2660 iri="https://spdx.org/rdf/3.0.0/terms/Core/key",
2661 min_count=1,
2662 compact="key",
2663 )
2664 # A value used in a generic key-value pair.
2665 cls._add_property(
2666 "value",
2667 StringProp(),
2668 iri="https://spdx.org/rdf/3.0.0/terms/Core/value",
2669 compact="value",
2670 )
2671
2672
2673# Base domain class from which all other SPDX-3.0 domain classes derive.
2674@register("https://spdx.org/rdf/3.0.0/terms/Core/Element", compact_type="Element", abstract=True)
2675class Element(SHACLObject):
2676 NODE_KIND = NodeKind.BlankNodeOrIRI
2677 ID_ALIAS = "spdxId"
2678 NAMED_INDIVIDUALS = {
2679 "NoAssertionElement": "https://spdx.org/rdf/3.0.0/terms/Core/NoAssertionElement",
2680 "NoneElement": "https://spdx.org/rdf/3.0.0/terms/Core/NoneElement",
2681 }
2682 # An Individual Value for Element representing a set of Elements of unknown
2683 # identify or cardinality (number).
2684 NoAssertionElement = "https://spdx.org/rdf/3.0.0/terms/Core/NoAssertionElement"
2685 # An Individual Value for Element representing a set of Elements with
2686 # cardinality (number/count) of zero.
2687 NoneElement = "https://spdx.org/rdf/3.0.0/terms/Core/NoneElement"
2688
2689 @classmethod
2690 def _register_props(cls):
2691 super()._register_props()
2692 # Provide consumers with comments by the creator of the Element about the
2693 # Element.
2694 cls._add_property(
2695 "comment",
2696 StringProp(),
2697 iri="https://spdx.org/rdf/3.0.0/terms/Core/comment",
2698 compact="comment",
2699 )
2700 # Provides information about the creation of the Element.
2701 cls._add_property(
2702 "creationInfo",
2703 ObjectProp(CreationInfo, True),
2704 iri="https://spdx.org/rdf/3.0.0/terms/Core/creationInfo",
2705 min_count=1,
2706 compact="creationInfo",
2707 )
2708 # Provides a detailed description of the Element.
2709 cls._add_property(
2710 "description",
2711 StringProp(),
2712 iri="https://spdx.org/rdf/3.0.0/terms/Core/description",
2713 compact="description",
2714 )
2715 # Specifies an Extension characterization of some aspect of an Element.
2716 cls._add_property(
2717 "extension",
2718 ListProp(ObjectProp(extension_Extension, False)),
2719 iri="https://spdx.org/rdf/3.0.0/terms/Core/extension",
2720 compact="extension",
2721 )
2722 # Provides a reference to a resource outside the scope of SPDX-3.0 content
2723 # that uniquely identifies an Element.
2724 cls._add_property(
2725 "externalIdentifier",
2726 ListProp(ObjectProp(ExternalIdentifier, False)),
2727 iri="https://spdx.org/rdf/3.0.0/terms/Core/externalIdentifier",
2728 compact="externalIdentifier",
2729 )
2730 # Points to a resource outside the scope of the SPDX-3.0 content
2731 # that provides additional characteristics of an Element.
2732 cls._add_property(
2733 "externalRef",
2734 ListProp(ObjectProp(ExternalRef, False)),
2735 iri="https://spdx.org/rdf/3.0.0/terms/Core/externalRef",
2736 compact="externalRef",
2737 )
2738 # Identifies the name of an Element as designated by the creator.
2739 cls._add_property(
2740 "name",
2741 StringProp(),
2742 iri="https://spdx.org/rdf/3.0.0/terms/Core/name",
2743 compact="name",
2744 )
2745 # A short description of an Element.
2746 cls._add_property(
2747 "summary",
2748 StringProp(),
2749 iri="https://spdx.org/rdf/3.0.0/terms/Core/summary",
2750 compact="summary",
2751 )
2752 # Provides an IntegrityMethod with which the integrity of an Element can be
2753 # asserted.
2754 cls._add_property(
2755 "verifiedUsing",
2756 ListProp(ObjectProp(IntegrityMethod, False)),
2757 iri="https://spdx.org/rdf/3.0.0/terms/Core/verifiedUsing",
2758 compact="verifiedUsing",
2759 )
2760
2761
2762# A collection of Elements, not necessarily with unifying context.
2763@register("https://spdx.org/rdf/3.0.0/terms/Core/ElementCollection", compact_type="ElementCollection", abstract=True)
2764class ElementCollection(Element):
2765 NODE_KIND = NodeKind.BlankNodeOrIRI
2766 ID_ALIAS = "spdxId"
2767 NAMED_INDIVIDUALS = {
2768 }
2769
2770 @classmethod
2771 def _register_props(cls):
2772 super()._register_props()
2773 # Refers to one or more Elements that are part of an ElementCollection.
2774 cls._add_property(
2775 "element",
2776 ListProp(ObjectProp(Element, False)),
2777 iri="https://spdx.org/rdf/3.0.0/terms/Core/element",
2778 compact="element",
2779 )
2780 # Describes one a profile which the creator of this ElementCollection intends to
2781 # conform to.
2782 cls._add_property(
2783 "profileConformance",
2784 ListProp(EnumProp([
2785 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/ai", "ai"),
2786 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/build", "build"),
2787 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/core", "core"),
2788 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/dataset", "dataset"),
2789 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/expandedLicensing", "expandedLicensing"),
2790 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/extension", "extension"),
2791 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/lite", "lite"),
2792 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/security", "security"),
2793 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/simpleLicensing", "simpleLicensing"),
2794 ("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/software", "software"),
2795 ])),
2796 iri="https://spdx.org/rdf/3.0.0/terms/Core/profileConformance",
2797 compact="profileConformance",
2798 )
2799 # This property is used to denote the root Element(s) of a tree of elements contained in a BOM.
2800 cls._add_property(
2801 "rootElement",
2802 ListProp(ObjectProp(Element, False)),
2803 iri="https://spdx.org/rdf/3.0.0/terms/Core/rootElement",
2804 compact="rootElement",
2805 )
2806
2807
2808# A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an Element.
2809@register("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifier", compact_type="ExternalIdentifier", abstract=False)
2810class ExternalIdentifier(SHACLObject):
2811 NODE_KIND = NodeKind.BlankNodeOrIRI
2812 NAMED_INDIVIDUALS = {
2813 }
2814
2815 @classmethod
2816 def _register_props(cls):
2817 super()._register_props()
2818 # Provide consumers with comments by the creator of the Element about the
2819 # Element.
2820 cls._add_property(
2821 "comment",
2822 StringProp(),
2823 iri="https://spdx.org/rdf/3.0.0/terms/Core/comment",
2824 compact="comment",
2825 )
2826 # Specifies the type of the external identifier.
2827 cls._add_property(
2828 "externalIdentifierType",
2829 EnumProp([
2830 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe22", "cpe22"),
2831 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe23", "cpe23"),
2832 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cve", "cve"),
2833 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/email", "email"),
2834 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/gitoid", "gitoid"),
2835 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/other", "other"),
2836 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/packageUrl", "packageUrl"),
2837 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/securityOther", "securityOther"),
2838 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swhid", "swhid"),
2839 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swid", "swid"),
2840 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/urlScheme", "urlScheme"),
2841 ]),
2842 iri="https://spdx.org/rdf/3.0.0/terms/Core/externalIdentifierType",
2843 min_count=1,
2844 compact="externalIdentifierType",
2845 )
2846 # Uniquely identifies an external element.
2847 cls._add_property(
2848 "identifier",
2849 StringProp(),
2850 iri="https://spdx.org/rdf/3.0.0/terms/Core/identifier",
2851 min_count=1,
2852 compact="identifier",
2853 )
2854 # Provides the location for more information regarding an external identifier.
2855 cls._add_property(
2856 "identifierLocator",
2857 ListProp(AnyURIProp()),
2858 iri="https://spdx.org/rdf/3.0.0/terms/Core/identifierLocator",
2859 compact="identifierLocator",
2860 )
2861 # An entity that is authorized to issue identification credentials.
2862 cls._add_property(
2863 "issuingAuthority",
2864 StringProp(),
2865 iri="https://spdx.org/rdf/3.0.0/terms/Core/issuingAuthority",
2866 compact="issuingAuthority",
2867 )
2868
2869
2870# Specifies the type of an external identifier.
2871@register("https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType", compact_type="ExternalIdentifierType", abstract=False)
2872class ExternalIdentifierType(SHACLObject):
2873 NODE_KIND = NodeKind.BlankNodeOrIRI
2874 NAMED_INDIVIDUALS = {
2875 "cpe22": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe22",
2876 "cpe23": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe23",
2877 "cve": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cve",
2878 "email": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/email",
2879 "gitoid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/gitoid",
2880 "other": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/other",
2881 "packageUrl": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/packageUrl",
2882 "securityOther": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/securityOther",
2883 "swhid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swhid",
2884 "swid": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swid",
2885 "urlScheme": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/urlScheme",
2886 }
2887 # https://cpe.mitre.org/files/cpe-specification_2.2.pdf
2888 cpe22 = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe22"
2889 # https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf
2890 cpe23 = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cpe23"
2891 # An identifier for a specific software flaw defined within the official CVE Dictionary and that conforms to the CVE specification as defined by https://csrc.nist.gov/glossary/term/cve_id.
2892 cve = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/cve"
2893 # https://datatracker.ietf.org/doc/html/rfc3696#section-3
2894 email = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/email"
2895 # https://www.iana.org/assignments/uri-schemes/prov/gitoid Gitoid stands for [Git Object ID](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects) and a gitoid of type blob is a unique hash of a binary artifact. A gitoid may represent the software [Artifact ID](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#artifact-id) or the [OmniBOR Identifier](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#omnibor-identifier) for the software artifact's associated [OmniBOR Document](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#omnibor-document); this ambiguity exists because the OmniBOR Document is itself an artifact, and the gitoid of that artifact is its valid identifier. Omnibor is a minimalistic schema to describe software [Artifact Dependency Graphs](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#artifact-dependency-graph-adg). Gitoids calculated on software artifacts (Snippet, File, or Package Elements) should be recorded in the SPDX 3.0 SoftwareArtifact's ContentIdentifier property. Gitoids calculated on the OmniBOR Document (OmniBOR Identifiers) should be recorded in the SPDX 3.0 Element's ExternalIdentifier property.
2896 gitoid = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/gitoid"
2897 # Used when the type doesn't match any of the other options.
2898 other = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/other"
2899 # https://github.com/package-url/purl-spec
2900 packageUrl = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/packageUrl"
2901 # Used when there is a security related identifier of unspecified type.
2902 securityOther = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/securityOther"
2903 # SoftWare Hash IDentifier, persistent intrinsic identifiers for digital artifacts, such as files, trees (also known as directories or folders), commits, and other objects typically found in version control systems. The syntax of the identifiers is defined in the [SWHID specification](https://www.swhid.org/specification/v1.1/4.Syntax) and they typically look like `swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2`.
2904 swhid = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swhid"
2905 # https://www.ietf.org/archive/id/draft-ietf-sacm-coswid-21.html#section-2.3
2906 swid = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/swid"
2907 # the scheme used in order to locate a resource https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
2908 urlScheme = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalIdentifierType/urlScheme"
2909
2910
2911# A map of Element identifiers that are used within a Document but defined external to that Document.
2912@register("https://spdx.org/rdf/3.0.0/terms/Core/ExternalMap", compact_type="ExternalMap", abstract=False)
2913class ExternalMap(SHACLObject):
2914 NODE_KIND = NodeKind.BlankNodeOrIRI
2915 NAMED_INDIVIDUALS = {
2916 }
2917
2918 @classmethod
2919 def _register_props(cls):
2920 super()._register_props()
2921 # Artifact representing a serialization instance of SPDX data containing the
2922 # definition of a particular Element.
2923 cls._add_property(
2924 "definingArtifact",
2925 ObjectProp(Artifact, False),
2926 iri="https://spdx.org/rdf/3.0.0/terms/Core/definingArtifact",
2927 compact="definingArtifact",
2928 )
2929 # Identifies an external Element used within a Document but defined external to
2930 # that Document.
2931 cls._add_property(
2932 "externalSpdxId",
2933 AnyURIProp(),
2934 iri="https://spdx.org/rdf/3.0.0/terms/Core/externalSpdxId",
2935 min_count=1,
2936 compact="externalSpdxId",
2937 )
2938 # Provides an indication of where to retrieve an external Element.
2939 cls._add_property(
2940 "locationHint",
2941 AnyURIProp(),
2942 iri="https://spdx.org/rdf/3.0.0/terms/Core/locationHint",
2943 compact="locationHint",
2944 )
2945 # Provides an IntegrityMethod with which the integrity of an Element can be
2946 # asserted.
2947 cls._add_property(
2948 "verifiedUsing",
2949 ListProp(ObjectProp(IntegrityMethod, False)),
2950 iri="https://spdx.org/rdf/3.0.0/terms/Core/verifiedUsing",
2951 compact="verifiedUsing",
2952 )
2953
2954
2955# A reference to a resource outside the scope of SPDX-3.0 content related to an Element.
2956@register("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRef", compact_type="ExternalRef", abstract=False)
2957class ExternalRef(SHACLObject):
2958 NODE_KIND = NodeKind.BlankNodeOrIRI
2959 NAMED_INDIVIDUALS = {
2960 }
2961
2962 @classmethod
2963 def _register_props(cls):
2964 super()._register_props()
2965 # Provide consumers with comments by the creator of the Element about the
2966 # Element.
2967 cls._add_property(
2968 "comment",
2969 StringProp(),
2970 iri="https://spdx.org/rdf/3.0.0/terms/Core/comment",
2971 compact="comment",
2972 )
2973 # Specifies the media type of an Element or Property.
2974 cls._add_property(
2975 "contentType",
2976 StringProp(pattern=r"^[^\/]+\/[^\/]+$",),
2977 iri="https://spdx.org/rdf/3.0.0/terms/Core/contentType",
2978 compact="contentType",
2979 )
2980 # Specifies the type of the external reference.
2981 cls._add_property(
2982 "externalRefType",
2983 EnumProp([
2984 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altDownloadLocation", "altDownloadLocation"),
2985 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altWebPage", "altWebPage"),
2986 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/binaryArtifact", "binaryArtifact"),
2987 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/bower", "bower"),
2988 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildMeta", "buildMeta"),
2989 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildSystem", "buildSystem"),
2990 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/certificationReport", "certificationReport"),
2991 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/chat", "chat"),
2992 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/componentAnalysisReport", "componentAnalysisReport"),
2993 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/cwe", "cwe"),
2994 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/documentation", "documentation"),
2995 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/dynamicAnalysisReport", "dynamicAnalysisReport"),
2996 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/eolNotice", "eolNotice"),
2997 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/exportControlAssessment", "exportControlAssessment"),
2998 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/funding", "funding"),
2999 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/issueTracker", "issueTracker"),
3000 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/license", "license"),
3001 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mailingList", "mailingList"),
3002 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mavenCentral", "mavenCentral"),
3003 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/metrics", "metrics"),
3004 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/npm", "npm"),
3005 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/nuget", "nuget"),
3006 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/other", "other"),
3007 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/privacyAssessment", "privacyAssessment"),
3008 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/productMetadata", "productMetadata"),
3009 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/purchaseOrder", "purchaseOrder"),
3010 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/qualityAssessmentReport", "qualityAssessmentReport"),
3011 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseHistory", "releaseHistory"),
3012 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseNotes", "releaseNotes"),
3013 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/riskAssessment", "riskAssessment"),
3014 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/runtimeAnalysisReport", "runtimeAnalysisReport"),
3015 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/secureSoftwareAttestation", "secureSoftwareAttestation"),
3016 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdversaryModel", "securityAdversaryModel"),
3017 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdvisory", "securityAdvisory"),
3018 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityFix", "securityFix"),
3019 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityOther", "securityOther"),
3020 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPenTestReport", "securityPenTestReport"),
3021 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPolicy", "securityPolicy"),
3022 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityThreatModel", "securityThreatModel"),
3023 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/socialMedia", "socialMedia"),
3024 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/sourceArtifact", "sourceArtifact"),
3025 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/staticAnalysisReport", "staticAnalysisReport"),
3026 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/support", "support"),
3027 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vcs", "vcs"),
3028 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityDisclosureReport", "vulnerabilityDisclosureReport"),
3029 ("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment", "vulnerabilityExploitabilityAssessment"),
3030 ]),
3031 iri="https://spdx.org/rdf/3.0.0/terms/Core/externalRefType",
3032 compact="externalRefType",
3033 )
3034 # Provides the location of an external reference.
3035 cls._add_property(
3036 "locator",
3037 ListProp(StringProp()),
3038 iri="https://spdx.org/rdf/3.0.0/terms/Core/locator",
3039 compact="locator",
3040 )
3041
3042
3043# Specifies the type of an external reference.
3044@register("https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType", compact_type="ExternalRefType", abstract=False)
3045class ExternalRefType(SHACLObject):
3046 NODE_KIND = NodeKind.BlankNodeOrIRI
3047 NAMED_INDIVIDUALS = {
3048 "altDownloadLocation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altDownloadLocation",
3049 "altWebPage": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altWebPage",
3050 "binaryArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/binaryArtifact",
3051 "bower": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/bower",
3052 "buildMeta": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildMeta",
3053 "buildSystem": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildSystem",
3054 "certificationReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/certificationReport",
3055 "chat": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/chat",
3056 "componentAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/componentAnalysisReport",
3057 "cwe": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/cwe",
3058 "documentation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/documentation",
3059 "dynamicAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/dynamicAnalysisReport",
3060 "eolNotice": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/eolNotice",
3061 "exportControlAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/exportControlAssessment",
3062 "funding": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/funding",
3063 "issueTracker": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/issueTracker",
3064 "license": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/license",
3065 "mailingList": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mailingList",
3066 "mavenCentral": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mavenCentral",
3067 "metrics": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/metrics",
3068 "npm": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/npm",
3069 "nuget": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/nuget",
3070 "other": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/other",
3071 "privacyAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/privacyAssessment",
3072 "productMetadata": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/productMetadata",
3073 "purchaseOrder": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/purchaseOrder",
3074 "qualityAssessmentReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/qualityAssessmentReport",
3075 "releaseHistory": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseHistory",
3076 "releaseNotes": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseNotes",
3077 "riskAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/riskAssessment",
3078 "runtimeAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/runtimeAnalysisReport",
3079 "secureSoftwareAttestation": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/secureSoftwareAttestation",
3080 "securityAdversaryModel": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdversaryModel",
3081 "securityAdvisory": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdvisory",
3082 "securityFix": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityFix",
3083 "securityOther": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityOther",
3084 "securityPenTestReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPenTestReport",
3085 "securityPolicy": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPolicy",
3086 "securityThreatModel": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityThreatModel",
3087 "socialMedia": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/socialMedia",
3088 "sourceArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/sourceArtifact",
3089 "staticAnalysisReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/staticAnalysisReport",
3090 "support": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/support",
3091 "vcs": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vcs",
3092 "vulnerabilityDisclosureReport": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityDisclosureReport",
3093 "vulnerabilityExploitabilityAssessment": "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment",
3094 }
3095 # A reference to an alternative download location.
3096 altDownloadLocation = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altDownloadLocation"
3097 # A reference to an alternative web page.
3098 altWebPage = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/altWebPage"
3099 # A reference to binary artifacts related to a package.
3100 binaryArtifact = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/binaryArtifact"
3101 # A reference to a bower package.
3102 bower = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/bower"
3103 # A reference build metadata related to a published package.
3104 buildMeta = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildMeta"
3105 # A reference build system used to create or publish the package.
3106 buildSystem = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/buildSystem"
3107 # A reference to a certification report for a package from an accredited/independent body.
3108 certificationReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/certificationReport"
3109 # A reference to the instant messaging system used by the maintainer for a package.
3110 chat = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/chat"
3111 # A reference to a Software Composition Analysis (SCA) report.
3112 componentAnalysisReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/componentAnalysisReport"
3113 # A reference to a source of software flaw defined within the official CWE Dictionary that conforms to the CWE specification as defined by https://csrc.nist.gov/glossary/term/common_weakness_enumeration.
3114 cwe = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/cwe"
3115 # A reference to the documentation for a package.
3116 documentation = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/documentation"
3117 # A reference to a dynamic analysis report for a package.
3118 dynamicAnalysisReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/dynamicAnalysisReport"
3119 # A reference to the End Of Sale (EOS) and/or End Of Life (EOL) information related to a package.
3120 eolNotice = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/eolNotice"
3121 # A reference to a export control assessment for a package.
3122 exportControlAssessment = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/exportControlAssessment"
3123 # A reference to funding information related to a package.
3124 funding = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/funding"
3125 # A reference to the issue tracker for a package.
3126 issueTracker = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/issueTracker"
3127 # A reference to additional license information related to an artifact.
3128 license = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/license"
3129 # A reference to the mailing list used by the maintainer for a package.
3130 mailingList = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mailingList"
3131 # A reference to a maven repository artifact.
3132 mavenCentral = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/mavenCentral"
3133 # A reference to metrics related to package such as OpenSSF scorecards.
3134 metrics = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/metrics"
3135 # A reference to an npm package.
3136 npm = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/npm"
3137 # A reference to a nuget package.
3138 nuget = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/nuget"
3139 # Used when the type doesn't match any of the other options.
3140 other = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/other"
3141 # A reference to a privacy assessment for a package.
3142 privacyAssessment = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/privacyAssessment"
3143 # A reference to additional product metadata such as reference within organization's product catalog.
3144 productMetadata = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/productMetadata"
3145 # A reference to a purchase order for a package.
3146 purchaseOrder = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/purchaseOrder"
3147 # A reference to a quality assessment for a package.
3148 qualityAssessmentReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/qualityAssessmentReport"
3149 # A reference to a published list of releases for a package.
3150 releaseHistory = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseHistory"
3151 # A reference to the release notes for a package.
3152 releaseNotes = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/releaseNotes"
3153 # A reference to a risk assessment for a package.
3154 riskAssessment = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/riskAssessment"
3155 # A reference to a runtime analysis report for a package.
3156 runtimeAnalysisReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/runtimeAnalysisReport"
3157 # A reference to information assuring that the software is developed using security practices as defined by [NIST SP 800-218 Secure Software Development Framework (SSDF) Version 1.1](https://csrc.nist.gov/pubs/sp/800/218/final) or [CISA Secure Software Development Attestation Form](https://www.cisa.gov/resources-tools/resources/secure-software-development-attestation-form).
3158 secureSoftwareAttestation = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/secureSoftwareAttestation"
3159 # A reference to the security adversary model for a package.
3160 securityAdversaryModel = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdversaryModel"
3161 # A reference to a published security advisory (where advisory as defined per ISO 29147:2018) that may affect one or more elements, e.g., vendor advisories or specific NVD entries.
3162 securityAdvisory = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityAdvisory"
3163 # A reference to the patch or source code that fixes a vulnerability.
3164 securityFix = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityFix"
3165 # A reference to related security information of unspecified type.
3166 securityOther = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityOther"
3167 # A reference to a [penetration test](https://en.wikipedia.org/wiki/Penetration_test) report for a package.
3168 securityPenTestReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPenTestReport"
3169 # A reference to instructions for reporting newly discovered security vulnerabilities for a package.
3170 securityPolicy = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityPolicy"
3171 # A reference the [security threat model](https://en.wikipedia.org/wiki/Threat_model) for a package.
3172 securityThreatModel = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/securityThreatModel"
3173 # A reference to a social media channel for a package.
3174 socialMedia = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/socialMedia"
3175 # A reference to an artifact containing the sources for a package.
3176 sourceArtifact = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/sourceArtifact"
3177 # A reference to a static analysis report for a package.
3178 staticAnalysisReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/staticAnalysisReport"
3179 # A reference to the software support channel or other support information for a package.
3180 support = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/support"
3181 # A reference to a version control system related to a software artifact.
3182 vcs = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vcs"
3183 # A reference to a Vulnerability Disclosure Report (VDR) which provides the software supplier's analysis and findings describing the impact (or lack of impact) that reported vulnerabilities have on packages or products in the supplier's SBOM as defined in [NIST SP 800-161](https://csrc.nist.gov/pubs/sp/800/161/r1/final).
3184 vulnerabilityDisclosureReport = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityDisclosureReport"
3185 # A reference to a Vulnerability Exploitability eXchange (VEX) statement which provides information on whether a product is impacted by a specific vulnerability in an included package and, if affected, whether there are actions recommended to remediate. See also [NTIA VEX one-page summary](https://ntia.gov/files/ntia/publications/vex_one-page_summary.pdf).
3186 vulnerabilityExploitabilityAssessment = "https://spdx.org/rdf/3.0.0/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment"
3187
3188
3189# A mathematical algorithm that maps data of arbitrary size to a bit string.
3190@register("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm", compact_type="HashAlgorithm", abstract=False)
3191class HashAlgorithm(SHACLObject):
3192 NODE_KIND = NodeKind.BlankNodeOrIRI
3193 NAMED_INDIVIDUALS = {
3194 "blake2b256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256",
3195 "blake2b384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384",
3196 "blake2b512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512",
3197 "blake3": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3",
3198 "crystalsDilithium": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium",
3199 "crystalsKyber": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber",
3200 "falcon": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon",
3201 "md2": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2",
3202 "md4": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4",
3203 "md5": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5",
3204 "md6": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6",
3205 "other": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other",
3206 "sha1": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1",
3207 "sha224": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224",
3208 "sha256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256",
3209 "sha384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384",
3210 "sha3_224": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224",
3211 "sha3_256": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256",
3212 "sha3_384": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384",
3213 "sha3_512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512",
3214 "sha512": "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512",
3215 }
3216 # blake2b algorithm with a digest size of 256 https://datatracker.ietf.org/doc/html/rfc7693#section-4
3217 blake2b256 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256"
3218 # blake2b algorithm with a digest size of 384 https://datatracker.ietf.org/doc/html/rfc7693#section-4
3219 blake2b384 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384"
3220 # blake2b algorithm with a digest size of 512 https://datatracker.ietf.org/doc/html/rfc7693#section-4
3221 blake2b512 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512"
3222 # https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf
3223 blake3 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3"
3224 # https://pq-crystals.org/dilithium/index.shtml
3225 crystalsDilithium = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium"
3226 # https://pq-crystals.org/kyber/index.shtml
3227 crystalsKyber = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber"
3228 # https://falcon-sign.info/falcon.pdf
3229 falcon = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon"
3230 # https://datatracker.ietf.org/doc/rfc1319/
3231 md2 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2"
3232 # https://datatracker.ietf.org/doc/html/rfc1186
3233 md4 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4"
3234 # https://datatracker.ietf.org/doc/html/rfc1321
3235 md5 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5"
3236 # https://people.csail.mit.edu/rivest/pubs/RABCx08.pdf
3237 md6 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6"
3238 # any hashing algorithm that does not exist in this list of entries
3239 other = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other"
3240 # https://datatracker.ietf.org/doc/html/rfc3174
3241 sha1 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1"
3242 # secure hashing algorithm with a digest length of 224 https://datatracker.ietf.org/doc/html/draft-ietf-pkix-sha224-01
3243 sha224 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224"
3244 # secure hashing algorithm with a digest length of 256 https://www.rfc-editor.org/rfc/rfc4634
3245 sha256 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256"
3246 # secure hashing algorithm with a digest length of 384 https://www.rfc-editor.org/rfc/rfc4634
3247 sha384 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384"
3248 # sha3 with a digest length of 224 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
3249 sha3_224 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224"
3250 # sha3 with a digest length of 256 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
3251 sha3_256 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256"
3252 # sha3 with a digest length of 384 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
3253 sha3_384 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384"
3254 # sha3 with a digest length of 512 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
3255 sha3_512 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512"
3256 # secure hashing algorithm with a digest length of 512 https://www.rfc-editor.org/rfc/rfc4634
3257 sha512 = "https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512"
3258
3259
3260# Provides an independently reproducible mechanism that permits verification of a specific Element.
3261@register("https://spdx.org/rdf/3.0.0/terms/Core/IntegrityMethod", compact_type="IntegrityMethod", abstract=True)
3262class IntegrityMethod(SHACLObject):
3263 NODE_KIND = NodeKind.BlankNodeOrIRI
3264 NAMED_INDIVIDUALS = {
3265 }
3266
3267 @classmethod
3268 def _register_props(cls):
3269 super()._register_props()
3270 # Provide consumers with comments by the creator of the Element about the
3271 # Element.
3272 cls._add_property(
3273 "comment",
3274 StringProp(),
3275 iri="https://spdx.org/rdf/3.0.0/terms/Core/comment",
3276 compact="comment",
3277 )
3278
3279
3280# Provide an enumerated set of lifecycle phases that can provide context to relationships.
3281@register("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType", compact_type="LifecycleScopeType", abstract=False)
3282class LifecycleScopeType(SHACLObject):
3283 NODE_KIND = NodeKind.BlankNodeOrIRI
3284 NAMED_INDIVIDUALS = {
3285 "build": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/build",
3286 "design": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/design",
3287 "development": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/development",
3288 "other": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/other",
3289 "runtime": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/runtime",
3290 "test": "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/test",
3291 }
3292 # A relationship has specific context implications during an element's build phase, during development.
3293 build = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/build"
3294 # A relationship has specific context implications during an element's design.
3295 design = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/design"
3296 # A relationship has specific context implications during development phase of an element.
3297 development = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/development"
3298 # A relationship has other specific context information necessary to capture that the above set of enumerations does not handle.
3299 other = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/other"
3300 # A relationship has specific context implications during the execution phase of an element.
3301 runtime = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/runtime"
3302 # A relationship has specific context implications during an element's testing phase, during development.
3303 test = "https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/test"
3304
3305
3306# A mapping between prefixes and namespace partial URIs.
3307@register("https://spdx.org/rdf/3.0.0/terms/Core/NamespaceMap", compact_type="NamespaceMap", abstract=False)
3308class NamespaceMap(SHACLObject):
3309 NODE_KIND = NodeKind.BlankNodeOrIRI
3310 NAMED_INDIVIDUALS = {
3311 }
3312
3313 @classmethod
3314 def _register_props(cls):
3315 super()._register_props()
3316 # Provides an unambiguous mechanism for conveying a URI fragment portion of an
3317 # ElementID.
3318 cls._add_property(
3319 "namespace",
3320 AnyURIProp(),
3321 iri="https://spdx.org/rdf/3.0.0/terms/Core/namespace",
3322 min_count=1,
3323 compact="namespace",
3324 )
3325 # A substitute for a URI.
3326 cls._add_property(
3327 "prefix",
3328 StringProp(),
3329 iri="https://spdx.org/rdf/3.0.0/terms/Core/prefix",
3330 min_count=1,
3331 compact="prefix",
3332 )
3333
3334
3335# An SPDX version 2.X compatible verification method for software packages.
3336@register("https://spdx.org/rdf/3.0.0/terms/Core/PackageVerificationCode", compact_type="PackageVerificationCode", abstract=False)
3337class PackageVerificationCode(IntegrityMethod):
3338 NODE_KIND = NodeKind.BlankNodeOrIRI
3339 NAMED_INDIVIDUALS = {
3340 }
3341
3342 @classmethod
3343 def _register_props(cls):
3344 super()._register_props()
3345 # Specifies the algorithm used for calculating the hash value.
3346 cls._add_property(
3347 "algorithm",
3348 EnumProp([
3349 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256", "blake2b256"),
3350 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384", "blake2b384"),
3351 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512", "blake2b512"),
3352 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3", "blake3"),
3353 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium", "crystalsDilithium"),
3354 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber", "crystalsKyber"),
3355 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon", "falcon"),
3356 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2", "md2"),
3357 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4", "md4"),
3358 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5", "md5"),
3359 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6", "md6"),
3360 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other", "other"),
3361 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1", "sha1"),
3362 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224", "sha224"),
3363 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256", "sha256"),
3364 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384", "sha384"),
3365 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224", "sha3_224"),
3366 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256", "sha3_256"),
3367 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384", "sha3_384"),
3368 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512", "sha3_512"),
3369 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512", "sha512"),
3370 ]),
3371 iri="https://spdx.org/rdf/3.0.0/terms/Core/algorithm",
3372 min_count=1,
3373 compact="algorithm",
3374 )
3375 # The result of applying a hash algorithm to an Element.
3376 cls._add_property(
3377 "hashValue",
3378 StringProp(),
3379 iri="https://spdx.org/rdf/3.0.0/terms/Core/hashValue",
3380 min_count=1,
3381 compact="hashValue",
3382 )
3383 # The relative file name of a file to be excluded from the
3384 # `PackageVerificationCode`.
3385 cls._add_property(
3386 "packageVerificationCodeExcludedFile",
3387 ListProp(StringProp()),
3388 iri="https://spdx.org/rdf/3.0.0/terms/Core/packageVerificationCodeExcludedFile",
3389 compact="packageVerificationCodeExcludedFile",
3390 )
3391
3392
3393# A tuple of two positive integers that define a range.
3394@register("https://spdx.org/rdf/3.0.0/terms/Core/PositiveIntegerRange", compact_type="PositiveIntegerRange", abstract=False)
3395class PositiveIntegerRange(SHACLObject):
3396 NODE_KIND = NodeKind.BlankNodeOrIRI
3397 NAMED_INDIVIDUALS = {
3398 }
3399
3400 @classmethod
3401 def _register_props(cls):
3402 super()._register_props()
3403 # Defines the beginning of a range.
3404 cls._add_property(
3405 "beginIntegerRange",
3406 PositiveIntegerProp(),
3407 iri="https://spdx.org/rdf/3.0.0/terms/Core/beginIntegerRange",
3408 min_count=1,
3409 compact="beginIntegerRange",
3410 )
3411 # Defines the end of a range.
3412 cls._add_property(
3413 "endIntegerRange",
3414 PositiveIntegerProp(),
3415 iri="https://spdx.org/rdf/3.0.0/terms/Core/endIntegerRange",
3416 min_count=1,
3417 compact="endIntegerRange",
3418 )
3419
3420
3421# Categories of presence or absence.
3422@register("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType", compact_type="PresenceType", abstract=False)
3423class PresenceType(SHACLObject):
3424 NODE_KIND = NodeKind.BlankNodeOrIRI
3425 NAMED_INDIVIDUALS = {
3426 "no": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no",
3427 "noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion",
3428 "yes": "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes",
3429 }
3430 # Indicates absence of the field.
3431 no = "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no"
3432 # Makes no assertion about the field.
3433 noAssertion = "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion"
3434 # Indicates presence of the field.
3435 yes = "https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes"
3436
3437
3438# Enumeration of the valid profiles.
3439@register("https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType", compact_type="ProfileIdentifierType", abstract=False)
3440class ProfileIdentifierType(SHACLObject):
3441 NODE_KIND = NodeKind.BlankNodeOrIRI
3442 NAMED_INDIVIDUALS = {
3443 "ai": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/ai",
3444 "build": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/build",
3445 "core": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/core",
3446 "dataset": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/dataset",
3447 "expandedLicensing": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/expandedLicensing",
3448 "extension": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/extension",
3449 "lite": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/lite",
3450 "security": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/security",
3451 "simpleLicensing": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/simpleLicensing",
3452 "software": "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/software",
3453 }
3454 # the element follows the AI profile specification
3455 ai = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/ai"
3456 # the element follows the Build profile specification
3457 build = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/build"
3458 # the element follows the Core profile specification
3459 core = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/core"
3460 # the element follows the Dataset profile specification
3461 dataset = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/dataset"
3462 # the element follows the expanded Licensing profile
3463 expandedLicensing = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/expandedLicensing"
3464 # the element follows the Extension profile specification
3465 extension = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/extension"
3466 # the element follows the Lite profile specification
3467 lite = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/lite"
3468 # the element follows the Security profile specification
3469 security = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/security"
3470 # the element follows the simple Licensing profile
3471 simpleLicensing = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/simpleLicensing"
3472 # the element follows the Software profile specification
3473 software = "https://spdx.org/rdf/3.0.0/terms/Core/ProfileIdentifierType/software"
3474
3475
3476# Describes a relationship between one or more elements.
3477@register("https://spdx.org/rdf/3.0.0/terms/Core/Relationship", compact_type="Relationship", abstract=False)
3478class Relationship(Element):
3479 NODE_KIND = NodeKind.BlankNodeOrIRI
3480 ID_ALIAS = "spdxId"
3481 NAMED_INDIVIDUALS = {
3482 }
3483
3484 @classmethod
3485 def _register_props(cls):
3486 super()._register_props()
3487 # Provides information about the completeness of relationships.
3488 cls._add_property(
3489 "completeness",
3490 EnumProp([
3491 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/complete", "complete"),
3492 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/incomplete", "incomplete"),
3493 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/noAssertion", "noAssertion"),
3494 ]),
3495 iri="https://spdx.org/rdf/3.0.0/terms/Core/completeness",
3496 compact="completeness",
3497 )
3498 # Specifies the time from which an element is no longer applicable / valid.
3499 cls._add_property(
3500 "endTime",
3501 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
3502 iri="https://spdx.org/rdf/3.0.0/terms/Core/endTime",
3503 compact="endTime",
3504 )
3505 # References the Element on the left-hand side of a relationship.
3506 cls._add_property(
3507 "from_",
3508 ObjectProp(Element, True),
3509 iri="https://spdx.org/rdf/3.0.0/terms/Core/from",
3510 min_count=1,
3511 compact="from",
3512 )
3513 # Information about the relationship between two Elements.
3514 cls._add_property(
3515 "relationshipType",
3516 EnumProp([
3517 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/affects", "affects"),
3518 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/amendedBy", "amendedBy"),
3519 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/ancestorOf", "ancestorOf"),
3520 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/availableFrom", "availableFrom"),
3521 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/configures", "configures"),
3522 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/contains", "contains"),
3523 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/coordinatedBy", "coordinatedBy"),
3524 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/copiedTo", "copiedTo"),
3525 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/delegatedTo", "delegatedTo"),
3526 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/dependsOn", "dependsOn"),
3527 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/descendantOf", "descendantOf"),
3528 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/describes", "describes"),
3529 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/doesNotAffect", "doesNotAffect"),
3530 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/expandsTo", "expandsTo"),
3531 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/exploitCreatedBy", "exploitCreatedBy"),
3532 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedBy", "fixedBy"),
3533 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedIn", "fixedIn"),
3534 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/foundBy", "foundBy"),
3535 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/generates", "generates"),
3536 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAddedFile", "hasAddedFile"),
3537 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssessmentFor", "hasAssessmentFor"),
3538 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssociatedVulnerability", "hasAssociatedVulnerability"),
3539 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasConcludedLicense", "hasConcludedLicense"),
3540 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDataFile", "hasDataFile"),
3541 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeclaredLicense", "hasDeclaredLicense"),
3542 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeletedFile", "hasDeletedFile"),
3543 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDependencyManifest", "hasDependencyManifest"),
3544 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDistributionArtifact", "hasDistributionArtifact"),
3545 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDocumentation", "hasDocumentation"),
3546 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDynamicLink", "hasDynamicLink"),
3547 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasEvidence", "hasEvidence"),
3548 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasExample", "hasExample"),
3549 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasHost", "hasHost"),
3550 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasInputs", "hasInputs"),
3551 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasMetadata", "hasMetadata"),
3552 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalComponent", "hasOptionalComponent"),
3553 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalDependency", "hasOptionalDependency"),
3554 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOutputs", "hasOutputs"),
3555 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasPrerequsite", "hasPrerequsite"),
3556 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasProvidedDependency", "hasProvidedDependency"),
3557 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasRequirement", "hasRequirement"),
3558 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasSpecification", "hasSpecification"),
3559 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasStaticLink", "hasStaticLink"),
3560 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTest", "hasTest"),
3561 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTestCase", "hasTestCase"),
3562 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasVariant", "hasVariant"),
3563 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/invokedBy", "invokedBy"),
3564 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/modifiedBy", "modifiedBy"),
3565 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/other", "other"),
3566 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/packagedBy", "packagedBy"),
3567 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/patchedBy", "patchedBy"),
3568 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/publishedBy", "publishedBy"),
3569 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/reportedBy", "reportedBy"),
3570 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/republishedBy", "republishedBy"),
3571 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/serializedInArtifact", "serializedInArtifact"),
3572 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/testedOn", "testedOn"),
3573 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/trainedOn", "trainedOn"),
3574 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/underInvestigationFor", "underInvestigationFor"),
3575 ("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/usesTool", "usesTool"),
3576 ]),
3577 iri="https://spdx.org/rdf/3.0.0/terms/Core/relationshipType",
3578 min_count=1,
3579 compact="relationshipType",
3580 )
3581 # Specifies the time from which an element is applicable / valid.
3582 cls._add_property(
3583 "startTime",
3584 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
3585 iri="https://spdx.org/rdf/3.0.0/terms/Core/startTime",
3586 compact="startTime",
3587 )
3588 # References an Element on the right-hand side of a relationship.
3589 cls._add_property(
3590 "to",
3591 ListProp(ObjectProp(Element, False)),
3592 iri="https://spdx.org/rdf/3.0.0/terms/Core/to",
3593 min_count=1,
3594 compact="to",
3595 )
3596
3597
3598# Indicates whether a relationship is known to be complete, incomplete, or if no assertion is made with respect to relationship completeness.
3599@register("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness", compact_type="RelationshipCompleteness", abstract=False)
3600class RelationshipCompleteness(SHACLObject):
3601 NODE_KIND = NodeKind.BlankNodeOrIRI
3602 NAMED_INDIVIDUALS = {
3603 "complete": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/complete",
3604 "incomplete": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/incomplete",
3605 "noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/noAssertion",
3606 }
3607 # The relationship is known to be exhaustive.
3608 complete = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/complete"
3609 # The relationship is known not to be exhaustive.
3610 incomplete = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/incomplete"
3611 # No assertion can be made about the completeness of the relationship.
3612 noAssertion = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipCompleteness/noAssertion"
3613
3614
3615# Information about the relationship between two Elements.
3616@register("https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType", compact_type="RelationshipType", abstract=False)
3617class RelationshipType(SHACLObject):
3618 NODE_KIND = NodeKind.BlankNodeOrIRI
3619 NAMED_INDIVIDUALS = {
3620 "affects": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/affects",
3621 "amendedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/amendedBy",
3622 "ancestorOf": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/ancestorOf",
3623 "availableFrom": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/availableFrom",
3624 "configures": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/configures",
3625 "contains": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/contains",
3626 "coordinatedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/coordinatedBy",
3627 "copiedTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/copiedTo",
3628 "delegatedTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/delegatedTo",
3629 "dependsOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/dependsOn",
3630 "descendantOf": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/descendantOf",
3631 "describes": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/describes",
3632 "doesNotAffect": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/doesNotAffect",
3633 "expandsTo": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/expandsTo",
3634 "exploitCreatedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/exploitCreatedBy",
3635 "fixedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedBy",
3636 "fixedIn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedIn",
3637 "foundBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/foundBy",
3638 "generates": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/generates",
3639 "hasAddedFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAddedFile",
3640 "hasAssessmentFor": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssessmentFor",
3641 "hasAssociatedVulnerability": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssociatedVulnerability",
3642 "hasConcludedLicense": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasConcludedLicense",
3643 "hasDataFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDataFile",
3644 "hasDeclaredLicense": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeclaredLicense",
3645 "hasDeletedFile": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeletedFile",
3646 "hasDependencyManifest": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDependencyManifest",
3647 "hasDistributionArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDistributionArtifact",
3648 "hasDocumentation": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDocumentation",
3649 "hasDynamicLink": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDynamicLink",
3650 "hasEvidence": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasEvidence",
3651 "hasExample": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasExample",
3652 "hasHost": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasHost",
3653 "hasInputs": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasInputs",
3654 "hasMetadata": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasMetadata",
3655 "hasOptionalComponent": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalComponent",
3656 "hasOptionalDependency": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalDependency",
3657 "hasOutputs": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOutputs",
3658 "hasPrerequsite": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasPrerequsite",
3659 "hasProvidedDependency": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasProvidedDependency",
3660 "hasRequirement": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasRequirement",
3661 "hasSpecification": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasSpecification",
3662 "hasStaticLink": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasStaticLink",
3663 "hasTest": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTest",
3664 "hasTestCase": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTestCase",
3665 "hasVariant": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasVariant",
3666 "invokedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/invokedBy",
3667 "modifiedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/modifiedBy",
3668 "other": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/other",
3669 "packagedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/packagedBy",
3670 "patchedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/patchedBy",
3671 "publishedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/publishedBy",
3672 "reportedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/reportedBy",
3673 "republishedBy": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/republishedBy",
3674 "serializedInArtifact": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/serializedInArtifact",
3675 "testedOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/testedOn",
3676 "trainedOn": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/trainedOn",
3677 "underInvestigationFor": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/underInvestigationFor",
3678 "usesTool": "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/usesTool",
3679 }
3680 # (Security/VEX) The `from` vulnerability affect each `to` Element
3681 affects = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/affects"
3682 # The `from` Element is amended by each `to` Element
3683 amendedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/amendedBy"
3684 # The `from` Element is an ancestor of each `to` Element
3685 ancestorOf = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/ancestorOf"
3686 # The `from` Element is available from the additional supplier described by each `to` Element
3687 availableFrom = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/availableFrom"
3688 # The `from` Element is a configuration applied to each `to` Element during a LifecycleScopeType period
3689 configures = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/configures"
3690 # The `from` Element contains each `to` Element
3691 contains = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/contains"
3692 # (Security) The `from` Vulnerability is coordinatedBy the `to` Agent(s) (vendor, researcher, or consumer agent)
3693 coordinatedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/coordinatedBy"
3694 # The `from` Element has been copied to each `to` Element
3695 copiedTo = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/copiedTo"
3696 # The `from` Agent is delegating an action to the Agent of the `to` Relationship (which must be of type invokedBy) during a LifecycleScopeType. (e.g. the `to` invokedBy Relationship is being done on behalf of `from`)
3697 delegatedTo = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/delegatedTo"
3698 # The `from` Element depends on each `to` Element during a LifecycleScopeType period.
3699 dependsOn = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/dependsOn"
3700 # The `from` Element is a descendant of each `to` Element
3701 descendantOf = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/descendantOf"
3702 # The `from` Element describes each `to` Element. To denote the root(s) of a tree of elements in a collection, the rootElement property should be used.
3703 describes = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/describes"
3704 # (Security/VEX) The `from` Vulnerability has no impact on each `to` Element
3705 doesNotAffect = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/doesNotAffect"
3706 # The `from` archive expands out as an artifact described by each `to` Element
3707 expandsTo = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/expandsTo"
3708 # (Security) The `from` Vulnerability has had an exploit created against it by each `to` Agent
3709 exploitCreatedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/exploitCreatedBy"
3710 # (Security) Designates a `from` Vulnerability has been fixed by the `to` Agent(s)
3711 fixedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedBy"
3712 # (Security/VEX) A `from` Vulnerability has been fixed in each of the `to` Element(s)
3713 fixedIn = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/fixedIn"
3714 # (Security) Designates a `from` Vulnerability was originally discovered by the `to` Agent(s)
3715 foundBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/foundBy"
3716 # The `from` Element generates each `to` Element
3717 generates = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/generates"
3718 # Every `to` Element is is a file added to the `from` Element (`from` hasAddedFile `to`)
3719 hasAddedFile = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAddedFile"
3720 # (Security) Relates a `from` Vulnerability and each `to` Element(s) with a security assessment. To be used with `VulnAssessmentRelationship` types
3721 hasAssessmentFor = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssessmentFor"
3722 # (Security) Used to associate a `from` Artifact with each `to` Vulnerability
3723 hasAssociatedVulnerability = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasAssociatedVulnerability"
3724 # The `from` Software Artifact is concluded by the SPDX data creator to be governed by each `to` license
3725 hasConcludedLicense = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasConcludedLicense"
3726 # The `from` Element treats each `to` Element as a data file
3727 hasDataFile = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDataFile"
3728 # The `from` Software Artifact was discovered to actually contain each `to` license, for example as detected by use of automated tooling.
3729 hasDeclaredLicense = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeclaredLicense"
3730 # Every `to` Element is a file deleted from the `from` Element (`from` hasDeletedFile `to`)
3731 hasDeletedFile = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDeletedFile"
3732 # The `from` Element has manifest files that contain dependency information in each `to` Element
3733 hasDependencyManifest = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDependencyManifest"
3734 # The `from` Element is distributed as an artifact in each Element `to`, (e.g. an RPM or archive file)
3735 hasDistributionArtifact = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDistributionArtifact"
3736 # The `from` Element is documented by each `to` Element
3737 hasDocumentation = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDocumentation"
3738 # The `from` Element dynamically links in each `to` Element, during a LifecycleScopeType period.
3739 hasDynamicLink = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasDynamicLink"
3740 # (Dataset) Every `to` Element is considered as evidence for the `from` Element (`from` hasEvidence `to`)
3741 hasEvidence = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasEvidence"
3742 # Every `to` Element is an example for the `from` Element (`from` hasExample `to`)
3743 hasExample = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasExample"
3744 # The `from` Build was run on the `to` Element during a LifecycleScopeType period (e.g. The host that the build runs on)
3745 hasHost = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasHost"
3746 # The `from` Build has each `to` Elements as an input during a LifecycleScopeType period.
3747 hasInputs = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasInputs"
3748 # Every `to` Element is metadata about the `from` Element (`from` hasMetadata `to`)
3749 hasMetadata = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasMetadata"
3750 # Every `to` Element is an optional component of the `from` Element (`from` hasOptionalComponent `to`)
3751 hasOptionalComponent = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalComponent"
3752 # The `from` Element optionally depends on each `to` Element during a LifecycleScopeType period
3753 hasOptionalDependency = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOptionalDependency"
3754 # The `from` Build element generates each `to` Element as an output during a LifecycleScopeType period.
3755 hasOutputs = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasOutputs"
3756 # The `from` Element has a prerequsite on each `to` Element, during a LifecycleScopeType period
3757 hasPrerequsite = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasPrerequsite"
3758 # The `from` Element has a dependency on each `to` Element, but dependency is not in the distributed artifact, but assumed to be provided, during a LifecycleScopeType period
3759 hasProvidedDependency = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasProvidedDependency"
3760 # The `from` Element has a requirement on each `to` Element, during a LifecycleScopeType period
3761 hasRequirement = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasRequirement"
3762 # Every `to` Element is a specification for the `from` Element (`from` hasSpecification `to`), during a LifecycleScopeType period
3763 hasSpecification = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasSpecification"
3764 # The `from` Element statically links in each `to` Element, during a LifecycleScopeType period
3765 hasStaticLink = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasStaticLink"
3766 # Every `to` Element is a test artifact for the `from` Element (`from` hasTest `to`), during a LifecycleScopeType period
3767 hasTest = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTest"
3768 # Every `to` Element is a test case for the `from` Element (`from` hasTestCase `to`)
3769 hasTestCase = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasTestCase"
3770 # Every `to` Element is a variant the `from` Element (`from` hasVariant `to`)
3771 hasVariant = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/hasVariant"
3772 # The `from` Element was invoked by the `to` Agent during a LifecycleScopeType period (for example, a Build element that describes a build step)
3773 invokedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/invokedBy"
3774 # The `from` Element is modified by each `to` Element
3775 modifiedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/modifiedBy"
3776 # Every `to` Element is related to the `from` Element where the relationship type is not described by any of the SPDX relationhip types (this relationship is directionless)
3777 other = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/other"
3778 # Every `to` Element is a packaged instance of the `from` Element (`from` packagedBy `to`)
3779 packagedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/packagedBy"
3780 # Every `to` Element is a patch for the `from` Element (`from` patchedBy `to`)
3781 patchedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/patchedBy"
3782 # (Security) Designates a `from` Vulnerability was made available for public use or reference by each `to` Agent
3783 publishedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/publishedBy"
3784 # (Security) Designates a `from` Vulnerability was first reported to a project, vendor, or tracking database for formal identification by each `to` Agent
3785 reportedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/reportedBy"
3786 # (Security) Designates a `from` Vulnerability's details were tracked, aggregated, and/or enriched to improve context (i.e. NVD) by a `to` Agent(s)
3787 republishedBy = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/republishedBy"
3788 # The `from` SPDXDocument can be found in a serialized form in each `to` Artifact
3789 serializedInArtifact = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/serializedInArtifact"
3790 # (AI, Dataset) The `from` Element has been tested on the `to` Element
3791 testedOn = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/testedOn"
3792 # (AI, Dataset) The `from` Element has been trained by the `to` Element(s)
3793 trainedOn = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/trainedOn"
3794 # (Security/VEX) The `from` Vulnerability impact is being investigated for each `to` Element
3795 underInvestigationFor = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/underInvestigationFor"
3796 # The `from` Element uses each `to` Element as a tool during a LifecycleScopeType period.
3797 usesTool = "https://spdx.org/rdf/3.0.0/terms/Core/RelationshipType/usesTool"
3798
3799
3800# A collection of SPDX Elements that could potentially be serialized.
3801@register("https://spdx.org/rdf/3.0.0/terms/Core/SpdxDocument", compact_type="SpdxDocument", abstract=False)
3802class SpdxDocument(ElementCollection):
3803 NODE_KIND = NodeKind.BlankNodeOrIRI
3804 ID_ALIAS = "spdxId"
3805 NAMED_INDIVIDUALS = {
3806 }
3807
3808 @classmethod
3809 def _register_props(cls):
3810 super()._register_props()
3811 # Provides the license under which the SPDX documentation of the Element can be
3812 # used.
3813 cls._add_property(
3814 "dataLicense",
3815 ObjectProp(simplelicensing_AnyLicenseInfo, False),
3816 iri="https://spdx.org/rdf/3.0.0/terms/Core/dataLicense",
3817 compact="dataLicense",
3818 )
3819 # Provides an ExternalMap of Element identifiers.
3820 cls._add_property(
3821 "imports",
3822 ListProp(ObjectProp(ExternalMap, False)),
3823 iri="https://spdx.org/rdf/3.0.0/terms/Core/imports",
3824 compact="imports",
3825 )
3826 # Provides a NamespaceMap of prefixes and associated namespace partial URIs applicable to an SpdxDocument and independent of any specific serialization format or instance.
3827 cls._add_property(
3828 "namespaceMap",
3829 ListProp(ObjectProp(NamespaceMap, False)),
3830 iri="https://spdx.org/rdf/3.0.0/terms/Core/namespaceMap",
3831 compact="namespaceMap",
3832 )
3833
3834
3835# Indicates the type of support that is associated with an artifact.
3836@register("https://spdx.org/rdf/3.0.0/terms/Core/SupportType", compact_type="SupportType", abstract=False)
3837class SupportType(SHACLObject):
3838 NODE_KIND = NodeKind.BlankNodeOrIRI
3839 NAMED_INDIVIDUALS = {
3840 "deployed": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/deployed",
3841 "development": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/development",
3842 "endOfSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/endOfSupport",
3843 "limitedSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/limitedSupport",
3844 "noAssertion": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noAssertion",
3845 "noSupport": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noSupport",
3846 "support": "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/support",
3847 }
3848 # in addition to being supported by the supplier, the software is known to have been deployed and is in use. For a software as a service provider, this implies the software is now available as a service.
3849 deployed = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/deployed"
3850 # the artifact is in active development and is not considered ready for formal support from the supplier.
3851 development = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/development"
3852 # there is a defined end of support for the artifact from the supplier. This may also be referred to as end of life. There is a validUntilDate that can be used to signal when support ends for the artifact.
3853 endOfSupport = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/endOfSupport"
3854 # the artifact has been released, and there is limited support available from the supplier. There is a validUntilDate that can provide additional information about the duration of support.
3855 limitedSupport = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/limitedSupport"
3856 # no assertion about the type of support is made. This is considered the default if no other support type is used.
3857 noAssertion = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noAssertion"
3858 # there is no support for the artifact from the supplier, consumer assumes any support obligations.
3859 noSupport = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noSupport"
3860 # the artifact has been released, and is supported from the supplier. There is a validUntilDate that can provide additional information about the duration of support.
3861 support = "https://spdx.org/rdf/3.0.0/terms/Core/SupportType/support"
3862
3863
3864# An element of hardware and/or software utilized to carry out a particular function.
3865@register("https://spdx.org/rdf/3.0.0/terms/Core/Tool", compact_type="Tool", abstract=False)
3866class Tool(Element):
3867 NODE_KIND = NodeKind.BlankNodeOrIRI
3868 ID_ALIAS = "spdxId"
3869 NAMED_INDIVIDUALS = {
3870 }
3871
3872
3873# Categories of confidentiality level.
3874@register("https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType", compact_type="dataset_ConfidentialityLevelType", abstract=False)
3875class dataset_ConfidentialityLevelType(SHACLObject):
3876 NODE_KIND = NodeKind.BlankNodeOrIRI
3877 NAMED_INDIVIDUALS = {
3878 "amber": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/amber",
3879 "clear": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/clear",
3880 "green": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/green",
3881 "red": "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/red",
3882 }
3883 # Data points in the dataset can be shared only with specific
3884 amber = "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/amber"
3885 # Dataset may be distributed freely, without restriction.
3886 clear = "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/clear"
3887 # Dataset can be shared within a community of peers and partners.
3888 green = "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/green"
3889 # Data points in the dataset are highly confidential and can only be shared
3890 red = "https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/red"
3891
3892
3893# Availability of dataset.
3894@register("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType", compact_type="dataset_DatasetAvailabilityType", abstract=False)
3895class dataset_DatasetAvailabilityType(SHACLObject):
3896 NODE_KIND = NodeKind.BlankNodeOrIRI
3897 NAMED_INDIVIDUALS = {
3898 "clickthrough": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/clickthrough",
3899 "directDownload": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/directDownload",
3900 "query": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/query",
3901 "registration": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/registration",
3902 "scrapingScript": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/scrapingScript",
3903 }
3904 # the dataset is not publicly available and can only be accessed
3905 clickthrough = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/clickthrough"
3906 # the dataset is publicly available and can be downloaded
3907 directDownload = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/directDownload"
3908 # the dataset is publicly available, but not all at once, and can only
3909 query = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/query"
3910 # the dataset is not publicly available and an email registration
3911 registration = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/registration"
3912 # the dataset provider is not making available the underlying
3913 scrapingScript = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/scrapingScript"
3914
3915
3916# Enumeration of dataset types.
3917@register("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType", compact_type="dataset_DatasetType", abstract=False)
3918class dataset_DatasetType(SHACLObject):
3919 NODE_KIND = NodeKind.BlankNodeOrIRI
3920 NAMED_INDIVIDUALS = {
3921 "audio": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/audio",
3922 "categorical": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/categorical",
3923 "graph": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/graph",
3924 "image": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/image",
3925 "noAssertion": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/noAssertion",
3926 "numeric": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/numeric",
3927 "other": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/other",
3928 "sensor": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/sensor",
3929 "structured": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/structured",
3930 "syntactic": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/syntactic",
3931 "text": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/text",
3932 "timeseries": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timeseries",
3933 "timestamp": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timestamp",
3934 "video": "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/video",
3935 }
3936 # data is audio based, such as a collection of music from the 80s.
3937 audio = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/audio"
3938 # data that is classified into a discrete number of categories,
3939 categorical = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/categorical"
3940 # data is in the form of a graph where entries are somehow related to
3941 graph = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/graph"
3942 # data is a collection of images such as pictures of animals.
3943 image = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/image"
3944 # data type is not known.
3945 noAssertion = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/noAssertion"
3946 # data consists only of numeric entries.
3947 numeric = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/numeric"
3948 # data is of a type not included in this list.
3949 other = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/other"
3950 # data is recorded from a physical sensor, such as a thermometer
3951 sensor = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/sensor"
3952 # data is stored in tabular format or retrieved from a relational
3953 structured = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/structured"
3954 # data describes the syntax or semantics of a language or text, such
3955 syntactic = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/syntactic"
3956 # data consists of unstructured text, such as a book, Wikipedia article
3957 text = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/text"
3958 # data is recorded in an ordered sequence of timestamped entries,
3959 timeseries = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timeseries"
3960 # data is recorded with a timestamp for each entry, but not
3961 timestamp = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timestamp"
3962 # data is video based, such as a collection of movie clips featuring Tom
3963 video = "https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/video"
3964
3965
3966# Abstract class for additional text intended to be added to a License, but
3967# which is not itself a standalone License.
3968@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/LicenseAddition", compact_type="expandedlicensing_LicenseAddition", abstract=True)
3969class expandedlicensing_LicenseAddition(Element):
3970 NODE_KIND = NodeKind.BlankNodeOrIRI
3971 ID_ALIAS = "spdxId"
3972 NAMED_INDIVIDUALS = {
3973 }
3974
3975 @classmethod
3976 def _register_props(cls):
3977 super()._register_props()
3978 # Identifies the full text of a LicenseAddition.
3979 cls._add_property(
3980 "expandedlicensing_additionText",
3981 StringProp(),
3982 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/additionText",
3983 min_count=1,
3984 compact="expandedlicensing_additionText",
3985 )
3986 # Specifies whether an additional text identifier has been marked as deprecated.
3987 cls._add_property(
3988 "expandedlicensing_isDeprecatedAdditionId",
3989 BooleanProp(),
3990 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/isDeprecatedAdditionId",
3991 compact="expandedlicensing_isDeprecatedAdditionId",
3992 )
3993 # Identifies all the text and metadata associated with a license in the license
3994 # XML format.
3995 cls._add_property(
3996 "expandedlicensing_licenseXml",
3997 StringProp(),
3998 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/licenseXml",
3999 compact="expandedlicensing_licenseXml",
4000 )
4001 # Specifies the licenseId that is preferred to be used in place of a deprecated
4002 # License or LicenseAddition.
4003 cls._add_property(
4004 "expandedlicensing_obsoletedBy",
4005 StringProp(),
4006 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/obsoletedBy",
4007 compact="expandedlicensing_obsoletedBy",
4008 )
4009 # Contains a URL where the License or LicenseAddition can be found in use.
4010 cls._add_property(
4011 "expandedlicensing_seeAlso",
4012 ListProp(AnyURIProp()),
4013 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/seeAlso",
4014 compact="expandedlicensing_seeAlso",
4015 )
4016 # Identifies the full text of a LicenseAddition, in SPDX templating format.
4017 cls._add_property(
4018 "expandedlicensing_standardAdditionTemplate",
4019 StringProp(),
4020 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/standardAdditionTemplate",
4021 compact="expandedlicensing_standardAdditionTemplate",
4022 )
4023
4024
4025# A license exception that is listed on the SPDX Exceptions list.
4026@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/ListedLicenseException", compact_type="expandedlicensing_ListedLicenseException", abstract=False)
4027class expandedlicensing_ListedLicenseException(expandedlicensing_LicenseAddition):
4028 NODE_KIND = NodeKind.BlankNodeOrIRI
4029 ID_ALIAS = "spdxId"
4030 NAMED_INDIVIDUALS = {
4031 }
4032
4033 @classmethod
4034 def _register_props(cls):
4035 super()._register_props()
4036 # Specifies the SPDX License List version in which this license or exception
4037 # identifier was deprecated.
4038 cls._add_property(
4039 "expandedlicensing_deprecatedVersion",
4040 StringProp(),
4041 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/deprecatedVersion",
4042 compact="expandedlicensing_deprecatedVersion",
4043 )
4044 # Specifies the SPDX License List version in which this ListedLicense or
4045 # ListedLicenseException identifier was first added.
4046 cls._add_property(
4047 "expandedlicensing_listVersionAdded",
4048 StringProp(),
4049 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/listVersionAdded",
4050 compact="expandedlicensing_listVersionAdded",
4051 )
4052
4053
4054# A property name with an associated value.
4055@register("https://spdx.org/rdf/3.0.0/terms/Extension/CdxPropertyEntry", compact_type="extension_CdxPropertyEntry", abstract=False)
4056class extension_CdxPropertyEntry(SHACLObject):
4057 NODE_KIND = NodeKind.BlankNodeOrIRI
4058 NAMED_INDIVIDUALS = {
4059 }
4060
4061 @classmethod
4062 def _register_props(cls):
4063 super()._register_props()
4064 # A name used in a CdxExtension name-value pair.
4065 cls._add_property(
4066 "extension_cdxPropName",
4067 StringProp(),
4068 iri="https://spdx.org/rdf/3.0.0/terms/Extension/cdxPropName",
4069 min_count=1,
4070 compact="extension_cdxPropName",
4071 )
4072 # A value used in a CdxExtension name-value pair.
4073 cls._add_property(
4074 "extension_cdxPropValue",
4075 StringProp(),
4076 iri="https://spdx.org/rdf/3.0.0/terms/Extension/cdxPropValue",
4077 compact="extension_cdxPropValue",
4078 )
4079
4080
4081# A characterization of some aspect of an Element that is associated with the Element in a generalized fashion.
4082@register("https://spdx.org/rdf/3.0.0/terms/Extension/Extension", compact_type="extension_Extension", abstract=True)
4083class extension_Extension(SHACLExtensibleObject, SHACLObject):
4084 NODE_KIND = NodeKind.BlankNodeOrIRI
4085 NAMED_INDIVIDUALS = {
4086 }
4087
4088
4089# Specifies the CVSS base, temporal, threat, or environmental severity type.
4090@register("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType", compact_type="security_CvssSeverityType", abstract=False)
4091class security_CvssSeverityType(SHACLObject):
4092 NODE_KIND = NodeKind.BlankNodeOrIRI
4093 NAMED_INDIVIDUALS = {
4094 "critical": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical",
4095 "high": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high",
4096 "low": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low",
4097 "medium": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium",
4098 "none": "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none",
4099 }
4100 # When a CVSS score is between 9.0 - 10.0
4101 critical = "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical"
4102 # When a CVSS score is between 7.0 - 8.9
4103 high = "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high"
4104 # When a CVSS score is between 0 - 3.9
4105 low = "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low"
4106 # When a CVSS score is between 4 - 6.9
4107 medium = "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium"
4108 # When a CVSS score is 0
4109 none = "https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none"
4110
4111
4112# Specifies the exploit catalog type.
4113@register("https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType", compact_type="security_ExploitCatalogType", abstract=False)
4114class security_ExploitCatalogType(SHACLObject):
4115 NODE_KIND = NodeKind.BlankNodeOrIRI
4116 NAMED_INDIVIDUALS = {
4117 "kev": "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/kev",
4118 "other": "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/other",
4119 }
4120 # CISA's Known Exploited Vulnerability (KEV) Catalog
4121 kev = "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/kev"
4122 # Other exploit catalogs
4123 other = "https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/other"
4124
4125
4126# Specifies the SSVC decision type.
4127@register("https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType", compact_type="security_SsvcDecisionType", abstract=False)
4128class security_SsvcDecisionType(SHACLObject):
4129 NODE_KIND = NodeKind.BlankNodeOrIRI
4130 NAMED_INDIVIDUALS = {
4131 "act": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/act",
4132 "attend": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/attend",
4133 "track": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/track",
4134 "trackStar": "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/trackStar",
4135 }
4136 # The vulnerability requires attention from the organization's internal, supervisory-level and leadership-level individuals. Necessary actions include requesting assistance or information about the vulnerability, as well as publishing a notification either internally and/or externally. Typically, internal groups would meet to determine the overall response and then execute agreed upon actions. CISA recommends remediating Act vulnerabilities as soon as possible.
4137 act = "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/act"
4138 # The vulnerability requires attention from the organization's internal, supervisory-level individuals. Necessary actions include requesting assistance or information about the vulnerability, and may involve publishing a notification either internally and/or externally. CISA recommends remediating Attend vulnerabilities sooner than standard update timelines.
4139 attend = "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/attend"
4140 # The vulnerability does not require action at this time. The organization would continue to track the vulnerability and reassess it if new information becomes available. CISA recommends remediating Track vulnerabilities within standard update timelines.
4141 track = "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/track"
4142 # ("Track*" in the SSVC spec) The vulnerability contains specific characteristics that may require closer monitoring for changes. CISA recommends remediating Track* vulnerabilities within standard update timelines.
4143 trackStar = "https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/trackStar"
4144
4145
4146# Specifies the VEX justification type.
4147@register("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType", compact_type="security_VexJustificationType", abstract=False)
4148class security_VexJustificationType(SHACLObject):
4149 NODE_KIND = NodeKind.BlankNodeOrIRI
4150 NAMED_INDIVIDUALS = {
4151 "componentNotPresent": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/componentNotPresent",
4152 "inlineMitigationsAlreadyExist": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist",
4153 "vulnerableCodeCannotBeControlledByAdversary": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary",
4154 "vulnerableCodeNotInExecutePath": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath",
4155 "vulnerableCodeNotPresent": "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotPresent",
4156 }
4157 # The software is not affected because the vulnerable component is not in the product.
4158 componentNotPresent = "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/componentNotPresent"
4159 # Built-in inline controls or mitigations prevent an adversary from leveraging the vulnerability.
4160 inlineMitigationsAlreadyExist = "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist"
4161 # The vulnerable component is present, and the component contains the vulnerable code. However, vulnerable code is used in such a way that an attacker cannot mount any anticipated attack.
4162 vulnerableCodeCannotBeControlledByAdversary = "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary"
4163 # The affected code is not reachable through the execution of the code, including non-anticipated states of the product.
4164 vulnerableCodeNotInExecutePath = "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath"
4165 # The product is not affected because the code underlying the vulnerability is not present in the product.
4166 vulnerableCodeNotPresent = "https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotPresent"
4167
4168
4169# Abstract ancestor class for all vulnerability assessments
4170@register("https://spdx.org/rdf/3.0.0/terms/Security/VulnAssessmentRelationship", compact_type="security_VulnAssessmentRelationship", abstract=True)
4171class security_VulnAssessmentRelationship(Relationship):
4172 NODE_KIND = NodeKind.BlankNodeOrIRI
4173 ID_ALIAS = "spdxId"
4174 NAMED_INDIVIDUALS = {
4175 }
4176
4177 @classmethod
4178 def _register_props(cls):
4179 super()._register_props()
4180 # Identifies who or what supplied the artifact or VulnAssessmentRelationship
4181 # referenced by the Element.
4182 cls._add_property(
4183 "suppliedBy",
4184 ObjectProp(Agent, False),
4185 iri="https://spdx.org/rdf/3.0.0/terms/Core/suppliedBy",
4186 compact="suppliedBy",
4187 )
4188 # Specifies an Element contained in a piece of software where a vulnerability was
4189 # found.
4190 cls._add_property(
4191 "security_assessedElement",
4192 ObjectProp(Element, False),
4193 iri="https://spdx.org/rdf/3.0.0/terms/Security/assessedElement",
4194 compact="security_assessedElement",
4195 )
4196 # Specifies a time when a vulnerability assessment was modified
4197 cls._add_property(
4198 "security_modifiedTime",
4199 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4200 iri="https://spdx.org/rdf/3.0.0/terms/Security/modifiedTime",
4201 compact="security_modifiedTime",
4202 )
4203 # Specifies the time when a vulnerability was published.
4204 cls._add_property(
4205 "security_publishedTime",
4206 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4207 iri="https://spdx.org/rdf/3.0.0/terms/Security/publishedTime",
4208 compact="security_publishedTime",
4209 )
4210 # Specified the time and date when a vulnerability was withdrawn.
4211 cls._add_property(
4212 "security_withdrawnTime",
4213 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4214 iri="https://spdx.org/rdf/3.0.0/terms/Security/withdrawnTime",
4215 compact="security_withdrawnTime",
4216 )
4217
4218
4219# Abstract class representing a license combination consisting of one or more
4220# licenses (optionally including additional text), which may be combined
4221# according to the SPDX license expression syntax.
4222@register("https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/AnyLicenseInfo", compact_type="simplelicensing_AnyLicenseInfo", abstract=True)
4223class simplelicensing_AnyLicenseInfo(Element):
4224 NODE_KIND = NodeKind.BlankNodeOrIRI
4225 ID_ALIAS = "spdxId"
4226 NAMED_INDIVIDUALS = {
4227 }
4228
4229
4230# An SPDX Element containing an SPDX license expression string.
4231@register("https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/LicenseExpression", compact_type="simplelicensing_LicenseExpression", abstract=False)
4232class simplelicensing_LicenseExpression(simplelicensing_AnyLicenseInfo):
4233 NODE_KIND = NodeKind.BlankNodeOrIRI
4234 ID_ALIAS = "spdxId"
4235 NAMED_INDIVIDUALS = {
4236 }
4237
4238 @classmethod
4239 def _register_props(cls):
4240 super()._register_props()
4241 # Maps a LicenseRef or AdditionRef string for a Custom License or a Custom
4242 # License Addition to its URI ID.
4243 cls._add_property(
4244 "simplelicensing_customIdToUri",
4245 ListProp(ObjectProp(DictionaryEntry, False)),
4246 iri="https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/customIdToUri",
4247 compact="simplelicensing_customIdToUri",
4248 )
4249 # A string in the license expression format.
4250 cls._add_property(
4251 "simplelicensing_licenseExpression",
4252 StringProp(),
4253 iri="https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/licenseExpression",
4254 min_count=1,
4255 compact="simplelicensing_licenseExpression",
4256 )
4257 # The version of the SPDX License List used in the license expression.
4258 cls._add_property(
4259 "simplelicensing_licenseListVersion",
4260 StringProp(pattern=r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$",),
4261 iri="https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/licenseListVersion",
4262 compact="simplelicensing_licenseListVersion",
4263 )
4264
4265
4266# A license or addition that is not listed on the SPDX License List.
4267@register("https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/SimpleLicensingText", compact_type="simplelicensing_SimpleLicensingText", abstract=False)
4268class simplelicensing_SimpleLicensingText(Element):
4269 NODE_KIND = NodeKind.BlankNodeOrIRI
4270 ID_ALIAS = "spdxId"
4271 NAMED_INDIVIDUALS = {
4272 }
4273
4274 @classmethod
4275 def _register_props(cls):
4276 super()._register_props()
4277 # Identifies the full text of a License or Addition.
4278 cls._add_property(
4279 "simplelicensing_licenseText",
4280 StringProp(),
4281 iri="https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/licenseText",
4282 min_count=1,
4283 compact="simplelicensing_licenseText",
4284 )
4285
4286
4287# A canonical, unique, immutable identifier
4288@register("https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifier", compact_type="software_ContentIdentifier", abstract=False)
4289class software_ContentIdentifier(IntegrityMethod):
4290 NODE_KIND = NodeKind.BlankNodeOrIRI
4291 NAMED_INDIVIDUALS = {
4292 }
4293
4294 @classmethod
4295 def _register_props(cls):
4296 super()._register_props()
4297 # Specifies the type of the content identifier.
4298 cls._add_property(
4299 "software_contentIdentifierType",
4300 EnumProp([
4301 ("https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/gitoid", "gitoid"),
4302 ("https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/swhid", "swhid"),
4303 ]),
4304 iri="https://spdx.org/rdf/3.0.0/terms/Software/contentIdentifierType",
4305 min_count=1,
4306 compact="software_contentIdentifierType",
4307 )
4308 # Specifies the value of the content identifier.
4309 cls._add_property(
4310 "software_contentIdentifierValue",
4311 AnyURIProp(),
4312 iri="https://spdx.org/rdf/3.0.0/terms/Software/contentIdentifierValue",
4313 min_count=1,
4314 compact="software_contentIdentifierValue",
4315 )
4316
4317
4318# Specifies the type of a content identifier.
4319@register("https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType", compact_type="software_ContentIdentifierType", abstract=False)
4320class software_ContentIdentifierType(SHACLObject):
4321 NODE_KIND = NodeKind.BlankNodeOrIRI
4322 NAMED_INDIVIDUALS = {
4323 "gitoid": "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/gitoid",
4324 "swhid": "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/swhid",
4325 }
4326 # Gitoid stands for [Git Object ID](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects) and a gitoid of type blob is a unique hash of a binary artifact. A gitoid may represent the software [Artifact ID](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#artifact-id) or the [OmniBOR Identifier](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#omnibor-identifier) for the software artifact's associated [OmniBOR Document](https://github.com/omnibor/spec/blob/main/spec/SPEC.md#omnibor-document).
4327 gitoid = "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/gitoid"
4328 # SoftWare Hash IDentifier, persistent intrinsic identifiers for digital artifacts. The syntax of the identifiers is defined in the [SWHID specification](https://www.swhid.org/specification/v1.1/4.Syntax) and in the case of filess they typically look like `swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2`.
4329 swhid = "https://spdx.org/rdf/3.0.0/terms/Software/ContentIdentifierType/swhid"
4330
4331
4332# Enumeration of the different kinds of SPDX file.
4333@register("https://spdx.org/rdf/3.0.0/terms/Software/FileKindType", compact_type="software_FileKindType", abstract=False)
4334class software_FileKindType(SHACLObject):
4335 NODE_KIND = NodeKind.BlankNodeOrIRI
4336 NAMED_INDIVIDUALS = {
4337 "directory": "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/directory",
4338 "file": "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/file",
4339 }
4340 # The file represents a directory and all content stored in that
4341 directory = "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/directory"
4342 # The file represents a single file (default).
4343 file = "https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/file"
4344
4345
4346# Provides a set of values to be used to describe the common types of SBOMs that
4347# tools may create.
4348@register("https://spdx.org/rdf/3.0.0/terms/Software/SbomType", compact_type="software_SbomType", abstract=False)
4349class software_SbomType(SHACLObject):
4350 NODE_KIND = NodeKind.BlankNodeOrIRI
4351 NAMED_INDIVIDUALS = {
4352 "analyzed": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/analyzed",
4353 "build": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/build",
4354 "deployed": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/deployed",
4355 "design": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/design",
4356 "runtime": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/runtime",
4357 "source": "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/source",
4358 }
4359 # SBOM generated through analysis of artifacts (e.g., executables, packages, containers, and virtual machine images) after its build. Such analysis generally requires a variety of heuristics. In some contexts, this may also be referred to as a "3rd party" SBOM.
4360 analyzed = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/analyzed"
4361 # SBOM generated as part of the process of building the software to create a releasable artifact (e.g., executable or package) from data such as source files, dependencies, built components, build process ephemeral data, and other SBOMs.
4362 build = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/build"
4363 # SBOM provides an inventory of software that is present on a system. This may be an assembly of other SBOMs that combines analysis of configuration options, and examination of execution behavior in a (potentially simulated) deployment environment.
4364 deployed = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/deployed"
4365 # SBOM of intended, planned software project or product with included components (some of which may not yet exist) for a new software artifact.
4366 design = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/design"
4367 # SBOM generated through instrumenting the system running the software, to capture only components present in the system, as well as external call-outs or dynamically loaded components. In some contexts, this may also be referred to as an "Instrumented" or "Dynamic" SBOM.
4368 runtime = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/runtime"
4369 # SBOM created directly from the development environment, source files, and included dependencies used to build an product artifact.
4370 source = "https://spdx.org/rdf/3.0.0/terms/Software/SbomType/source"
4371
4372
4373# Provides information about the primary purpose of an Element.
4374@register("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose", compact_type="software_SoftwarePurpose", abstract=False)
4375class software_SoftwarePurpose(SHACLObject):
4376 NODE_KIND = NodeKind.BlankNodeOrIRI
4377 NAMED_INDIVIDUALS = {
4378 "application": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application",
4379 "archive": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive",
4380 "bom": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom",
4381 "configuration": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration",
4382 "container": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container",
4383 "data": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data",
4384 "device": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device",
4385 "deviceDriver": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver",
4386 "diskImage": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage",
4387 "documentation": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation",
4388 "evidence": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence",
4389 "executable": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable",
4390 "file": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file",
4391 "filesystemImage": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage",
4392 "firmware": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware",
4393 "framework": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework",
4394 "install": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install",
4395 "library": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library",
4396 "manifest": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest",
4397 "model": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model",
4398 "module": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module",
4399 "operatingSystem": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem",
4400 "other": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other",
4401 "patch": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch",
4402 "platform": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform",
4403 "requirement": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement",
4404 "source": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source",
4405 "specification": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification",
4406 "test": "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test",
4407 }
4408 # the Element is a software application
4409 application = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application"
4410 # the Element is an archived collection of one or more files (.tar, .zip, etc)
4411 archive = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive"
4412 # Element is a bill of materials
4413 bom = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom"
4414 # Element is configuration data
4415 configuration = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration"
4416 # the Element is a container image which can be used by a container runtime application
4417 container = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container"
4418 # Element is data
4419 data = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data"
4420 # the Element refers to a chipset, processor, or electronic board
4421 device = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device"
4422 # Element represents software that controls hardware devices
4423 deviceDriver = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver"
4424 # the Element refers to a disk image that can be written to a disk, booted in a VM, etc. A disk image typically contains most or all of the components necessary to boot, such as bootloaders, kernels, firmware, userspace, etc.
4425 diskImage = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage"
4426 # Element is documentation
4427 documentation = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation"
4428 # the Element is the evidence that a specification or requirement has been fulfilled
4429 evidence = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence"
4430 # Element is an Artifact that can be run on a computer
4431 executable = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable"
4432 # the Element is a single file which can be independently distributed (configuration file, statically linked binary, Kubernetes deployment, etc)
4433 file = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file"
4434 # the Element is a file system image that can be written to a disk (or virtual) partition
4435 filesystemImage = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage"
4436 # the Element provides low level control over a device's hardware
4437 firmware = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware"
4438 # the Element is a software framework
4439 framework = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework"
4440 # the Element is used to install software on disk
4441 install = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install"
4442 # the Element is a software library
4443 library = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library"
4444 # the Element is a software manifest
4445 manifest = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest"
4446 # the Element is a machine learning or artificial intelligence model
4447 model = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model"
4448 # the Element is a module of a piece of software
4449 module = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module"
4450 # the Element is an operating system
4451 operatingSystem = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem"
4452 # the Element doesn't fit into any of the other categories
4453 other = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other"
4454 # Element contains a set of changes to update, fix, or improve another Element
4455 patch = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch"
4456 # Element represents a runtime environment
4457 platform = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform"
4458 # the Element provides a requirement needed as input for another Element
4459 requirement = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement"
4460 # the Element is a single or a collection of source files
4461 source = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source"
4462 # the Element is a plan, guideline or strategy how to create, perform or analyse an application
4463 specification = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification"
4464 # The Element is a test used to verify functionality on an software element
4465 test = "https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test"
4466
4467
4468# Class that describes a build instance of software/artifacts.
4469@register("https://spdx.org/rdf/3.0.0/terms/Build/Build", compact_type="build_Build", abstract=False)
4470class build_Build(Element):
4471 NODE_KIND = NodeKind.BlankNodeOrIRI
4472 ID_ALIAS = "spdxId"
4473 NAMED_INDIVIDUALS = {
4474 }
4475
4476 @classmethod
4477 def _register_props(cls):
4478 super()._register_props()
4479 # Property that describes the time at which a build stops.
4480 cls._add_property(
4481 "build_buildEndTime",
4482 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4483 iri="https://spdx.org/rdf/3.0.0/terms/Build/buildEndTime",
4484 compact="build_buildEndTime",
4485 )
4486 # A buildId is a locally unique identifier used by a builder to identify a unique
4487 # instance of a build produced by it.
4488 cls._add_property(
4489 "build_buildId",
4490 StringProp(),
4491 iri="https://spdx.org/rdf/3.0.0/terms/Build/buildId",
4492 compact="build_buildId",
4493 )
4494 # Property describing the start time of a build.
4495 cls._add_property(
4496 "build_buildStartTime",
4497 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4498 iri="https://spdx.org/rdf/3.0.0/terms/Build/buildStartTime",
4499 compact="build_buildStartTime",
4500 )
4501 # A buildType is a hint that is used to indicate the toolchain, platform, or
4502 # infrastructure that the build was invoked on.
4503 cls._add_property(
4504 "build_buildType",
4505 AnyURIProp(),
4506 iri="https://spdx.org/rdf/3.0.0/terms/Build/buildType",
4507 min_count=1,
4508 compact="build_buildType",
4509 )
4510 # Property that describes the digest of the build configuration file used to
4511 # invoke a build.
4512 cls._add_property(
4513 "build_configSourceDigest",
4514 ListProp(ObjectProp(Hash, False)),
4515 iri="https://spdx.org/rdf/3.0.0/terms/Build/configSourceDigest",
4516 compact="build_configSourceDigest",
4517 )
4518 # Property describes the invocation entrypoint of a build.
4519 cls._add_property(
4520 "build_configSourceEntrypoint",
4521 ListProp(StringProp()),
4522 iri="https://spdx.org/rdf/3.0.0/terms/Build/configSourceEntrypoint",
4523 compact="build_configSourceEntrypoint",
4524 )
4525 # Property that describes the URI of the build configuration source file.
4526 cls._add_property(
4527 "build_configSourceUri",
4528 ListProp(AnyURIProp()),
4529 iri="https://spdx.org/rdf/3.0.0/terms/Build/configSourceUri",
4530 compact="build_configSourceUri",
4531 )
4532 # Property describing the session in which a build is invoked.
4533 cls._add_property(
4534 "build_environment",
4535 ListProp(ObjectProp(DictionaryEntry, False)),
4536 iri="https://spdx.org/rdf/3.0.0/terms/Build/environment",
4537 compact="build_environment",
4538 )
4539 # Property describing the parameters used in an instance of a build.
4540 cls._add_property(
4541 "build_parameters",
4542 ListProp(ObjectProp(DictionaryEntry, False)),
4543 iri="https://spdx.org/rdf/3.0.0/terms/Build/parameters",
4544 compact="build_parameters",
4545 )
4546
4547
4548# Agent represents anything with the potential to act on a system.
4549@register("https://spdx.org/rdf/3.0.0/terms/Core/Agent", compact_type="Agent", abstract=False)
4550class Agent(Element):
4551 NODE_KIND = NodeKind.BlankNodeOrIRI
4552 ID_ALIAS = "spdxId"
4553 NAMED_INDIVIDUALS = {
4554 }
4555
4556
4557# An assertion made in relation to one or more elements.
4558@register("https://spdx.org/rdf/3.0.0/terms/Core/Annotation", compact_type="Annotation", abstract=False)
4559class Annotation(Element):
4560 NODE_KIND = NodeKind.BlankNodeOrIRI
4561 ID_ALIAS = "spdxId"
4562 NAMED_INDIVIDUALS = {
4563 }
4564
4565 @classmethod
4566 def _register_props(cls):
4567 super()._register_props()
4568 # Describes the type of annotation.
4569 cls._add_property(
4570 "annotationType",
4571 EnumProp([
4572 ("https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/other", "other"),
4573 ("https://spdx.org/rdf/3.0.0/terms/Core/AnnotationType/review", "review"),
4574 ]),
4575 iri="https://spdx.org/rdf/3.0.0/terms/Core/annotationType",
4576 min_count=1,
4577 compact="annotationType",
4578 )
4579 # Specifies the media type of an Element or Property.
4580 cls._add_property(
4581 "contentType",
4582 StringProp(pattern=r"^[^\/]+\/[^\/]+$",),
4583 iri="https://spdx.org/rdf/3.0.0/terms/Core/contentType",
4584 compact="contentType",
4585 )
4586 # Commentary on an assertion that an annotator has made.
4587 cls._add_property(
4588 "statement",
4589 StringProp(),
4590 iri="https://spdx.org/rdf/3.0.0/terms/Core/statement",
4591 compact="statement",
4592 )
4593 # An Element an annotator has made an assertion about.
4594 cls._add_property(
4595 "subject",
4596 ObjectProp(Element, True),
4597 iri="https://spdx.org/rdf/3.0.0/terms/Core/subject",
4598 min_count=1,
4599 compact="subject",
4600 )
4601
4602
4603# A distinct article or unit within the digital domain.
4604@register("https://spdx.org/rdf/3.0.0/terms/Core/Artifact", compact_type="Artifact", abstract=True)
4605class Artifact(Element):
4606 NODE_KIND = NodeKind.BlankNodeOrIRI
4607 ID_ALIAS = "spdxId"
4608 NAMED_INDIVIDUALS = {
4609 }
4610
4611 @classmethod
4612 def _register_props(cls):
4613 super()._register_props()
4614 # Specifies the time an artifact was built.
4615 cls._add_property(
4616 "builtTime",
4617 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4618 iri="https://spdx.org/rdf/3.0.0/terms/Core/builtTime",
4619 compact="builtTime",
4620 )
4621 # Identifies from where or whom the Element originally came.
4622 cls._add_property(
4623 "originatedBy",
4624 ListProp(ObjectProp(Agent, False)),
4625 iri="https://spdx.org/rdf/3.0.0/terms/Core/originatedBy",
4626 compact="originatedBy",
4627 )
4628 # Specifies the time an artifact was released.
4629 cls._add_property(
4630 "releaseTime",
4631 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4632 iri="https://spdx.org/rdf/3.0.0/terms/Core/releaseTime",
4633 compact="releaseTime",
4634 )
4635 # The name of a relevant standard that may apply to an artifact.
4636 cls._add_property(
4637 "standardName",
4638 ListProp(StringProp()),
4639 iri="https://spdx.org/rdf/3.0.0/terms/Core/standardName",
4640 compact="standardName",
4641 )
4642 # Identifies who or what supplied the artifact or VulnAssessmentRelationship
4643 # referenced by the Element.
4644 cls._add_property(
4645 "suppliedBy",
4646 ObjectProp(Agent, False),
4647 iri="https://spdx.org/rdf/3.0.0/terms/Core/suppliedBy",
4648 compact="suppliedBy",
4649 )
4650 # Specifies the level of support associated with an artifact.
4651 cls._add_property(
4652 "supportLevel",
4653 ListProp(EnumProp([
4654 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/deployed", "deployed"),
4655 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/development", "development"),
4656 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/endOfSupport", "endOfSupport"),
4657 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/limitedSupport", "limitedSupport"),
4658 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noAssertion", "noAssertion"),
4659 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/noSupport", "noSupport"),
4660 ("https://spdx.org/rdf/3.0.0/terms/Core/SupportType/support", "support"),
4661 ])),
4662 iri="https://spdx.org/rdf/3.0.0/terms/Core/supportLevel",
4663 compact="supportLevel",
4664 )
4665 # Specifies until when the artifact can be used before its usage needs to be
4666 # reassessed.
4667 cls._add_property(
4668 "validUntilTime",
4669 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
4670 iri="https://spdx.org/rdf/3.0.0/terms/Core/validUntilTime",
4671 compact="validUntilTime",
4672 )
4673
4674
4675# A collection of Elements that have a shared context.
4676@register("https://spdx.org/rdf/3.0.0/terms/Core/Bundle", compact_type="Bundle", abstract=False)
4677class Bundle(ElementCollection):
4678 NODE_KIND = NodeKind.BlankNodeOrIRI
4679 ID_ALIAS = "spdxId"
4680 NAMED_INDIVIDUALS = {
4681 }
4682
4683 @classmethod
4684 def _register_props(cls):
4685 super()._register_props()
4686 # Gives information about the circumstances or unifying properties
4687 # that Elements of the bundle have been assembled under.
4688 cls._add_property(
4689 "context",
4690 StringProp(),
4691 iri="https://spdx.org/rdf/3.0.0/terms/Core/context",
4692 compact="context",
4693 )
4694
4695
4696# A mathematically calculated representation of a grouping of data.
4697@register("https://spdx.org/rdf/3.0.0/terms/Core/Hash", compact_type="Hash", abstract=False)
4698class Hash(IntegrityMethod):
4699 NODE_KIND = NodeKind.BlankNodeOrIRI
4700 NAMED_INDIVIDUALS = {
4701 }
4702
4703 @classmethod
4704 def _register_props(cls):
4705 super()._register_props()
4706 # Specifies the algorithm used for calculating the hash value.
4707 cls._add_property(
4708 "algorithm",
4709 EnumProp([
4710 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b256", "blake2b256"),
4711 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b384", "blake2b384"),
4712 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake2b512", "blake2b512"),
4713 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/blake3", "blake3"),
4714 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsDilithium", "crystalsDilithium"),
4715 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/crystalsKyber", "crystalsKyber"),
4716 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/falcon", "falcon"),
4717 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md2", "md2"),
4718 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md4", "md4"),
4719 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md5", "md5"),
4720 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/md6", "md6"),
4721 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/other", "other"),
4722 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha1", "sha1"),
4723 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha224", "sha224"),
4724 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha256", "sha256"),
4725 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha384", "sha384"),
4726 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_224", "sha3_224"),
4727 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_256", "sha3_256"),
4728 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_384", "sha3_384"),
4729 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha3_512", "sha3_512"),
4730 ("https://spdx.org/rdf/3.0.0/terms/Core/HashAlgorithm/sha512", "sha512"),
4731 ]),
4732 iri="https://spdx.org/rdf/3.0.0/terms/Core/algorithm",
4733 min_count=1,
4734 compact="algorithm",
4735 )
4736 # The result of applying a hash algorithm to an Element.
4737 cls._add_property(
4738 "hashValue",
4739 StringProp(),
4740 iri="https://spdx.org/rdf/3.0.0/terms/Core/hashValue",
4741 min_count=1,
4742 compact="hashValue",
4743 )
4744
4745
4746# Provide context for a relationship that occurs in the lifecycle.
4747@register("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopedRelationship", compact_type="LifecycleScopedRelationship", abstract=False)
4748class LifecycleScopedRelationship(Relationship):
4749 NODE_KIND = NodeKind.BlankNodeOrIRI
4750 ID_ALIAS = "spdxId"
4751 NAMED_INDIVIDUALS = {
4752 }
4753
4754 @classmethod
4755 def _register_props(cls):
4756 super()._register_props()
4757 # Capture the scope of information about a specific relationship between elements.
4758 cls._add_property(
4759 "scope",
4760 EnumProp([
4761 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/build", "build"),
4762 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/design", "design"),
4763 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/development", "development"),
4764 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/other", "other"),
4765 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/runtime", "runtime"),
4766 ("https://spdx.org/rdf/3.0.0/terms/Core/LifecycleScopeType/test", "test"),
4767 ]),
4768 iri="https://spdx.org/rdf/3.0.0/terms/Core/scope",
4769 compact="scope",
4770 )
4771
4772
4773# A group of people who work together in an organized way for a shared purpose.
4774@register("https://spdx.org/rdf/3.0.0/terms/Core/Organization", compact_type="Organization", abstract=False)
4775class Organization(Agent):
4776 NODE_KIND = NodeKind.BlankNodeOrIRI
4777 ID_ALIAS = "spdxId"
4778 NAMED_INDIVIDUALS = {
4779 }
4780
4781
4782# An individual human being.
4783@register("https://spdx.org/rdf/3.0.0/terms/Core/Person", compact_type="Person", abstract=False)
4784class Person(Agent):
4785 NODE_KIND = NodeKind.BlankNodeOrIRI
4786 ID_ALIAS = "spdxId"
4787 NAMED_INDIVIDUALS = {
4788 }
4789
4790
4791# A software agent.
4792@register("https://spdx.org/rdf/3.0.0/terms/Core/SoftwareAgent", compact_type="SoftwareAgent", abstract=False)
4793class SoftwareAgent(Agent):
4794 NODE_KIND = NodeKind.BlankNodeOrIRI
4795 ID_ALIAS = "spdxId"
4796 NAMED_INDIVIDUALS = {
4797 }
4798
4799
4800# Portion of an AnyLicenseInfo representing a set of licensing information
4801# where all elements apply.
4802@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/ConjunctiveLicenseSet", compact_type="expandedlicensing_ConjunctiveLicenseSet", abstract=False)
4803class expandedlicensing_ConjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
4804 NODE_KIND = NodeKind.BlankNodeOrIRI
4805 ID_ALIAS = "spdxId"
4806 NAMED_INDIVIDUALS = {
4807 }
4808
4809 @classmethod
4810 def _register_props(cls):
4811 super()._register_props()
4812 # A license expression participating in a license set.
4813 cls._add_property(
4814 "expandedlicensing_member",
4815 ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False)),
4816 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/member",
4817 min_count=2,
4818 compact="expandedlicensing_member",
4819 )
4820
4821
4822# A license addition that is not listed on the SPDX Exceptions List.
4823@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/CustomLicenseAddition", compact_type="expandedlicensing_CustomLicenseAddition", abstract=False)
4824class expandedlicensing_CustomLicenseAddition(expandedlicensing_LicenseAddition):
4825 NODE_KIND = NodeKind.BlankNodeOrIRI
4826 ID_ALIAS = "spdxId"
4827 NAMED_INDIVIDUALS = {
4828 }
4829
4830
4831# Portion of an AnyLicenseInfo representing a set of licensing information where
4832# only one of the elements applies.
4833@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/DisjunctiveLicenseSet", compact_type="expandedlicensing_DisjunctiveLicenseSet", abstract=False)
4834class expandedlicensing_DisjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
4835 NODE_KIND = NodeKind.BlankNodeOrIRI
4836 ID_ALIAS = "spdxId"
4837 NAMED_INDIVIDUALS = {
4838 }
4839
4840 @classmethod
4841 def _register_props(cls):
4842 super()._register_props()
4843 # A license expression participating in a license set.
4844 cls._add_property(
4845 "expandedlicensing_member",
4846 ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False)),
4847 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/member",
4848 min_count=2,
4849 compact="expandedlicensing_member",
4850 )
4851
4852
4853# Abstract class representing a License or an OrLaterOperator.
4854@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/ExtendableLicense", compact_type="expandedlicensing_ExtendableLicense", abstract=True)
4855class expandedlicensing_ExtendableLicense(simplelicensing_AnyLicenseInfo):
4856 NODE_KIND = NodeKind.BlankNodeOrIRI
4857 ID_ALIAS = "spdxId"
4858 NAMED_INDIVIDUALS = {
4859 }
4860
4861
4862# A concrete subclass of AnyLicenseInfo used by Individuals in the
4863# ExpandedLicensing profile.
4864@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/IndividualLicensingInfo", compact_type="expandedlicensing_IndividualLicensingInfo", abstract=False)
4865class expandedlicensing_IndividualLicensingInfo(simplelicensing_AnyLicenseInfo):
4866 NODE_KIND = NodeKind.BlankNodeOrIRI
4867 ID_ALIAS = "spdxId"
4868 NAMED_INDIVIDUALS = {
4869 "NoAssertionLicense": "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoAssertionLicense",
4870 "NoneLicense": "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoneLicense",
4871 }
4872 # An Individual Value for License when no assertion can be made about its actual
4873 # value.
4874 NoAssertionLicense = "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoAssertionLicense"
4875 # An Individual Value for License where the SPDX data creator determines that no
4876 # license is present.
4877 NoneLicense = "https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/NoneLicense"
4878
4879
4880# Abstract class for the portion of an AnyLicenseInfo representing a license.
4881@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/License", compact_type="expandedlicensing_License", abstract=True)
4882class expandedlicensing_License(expandedlicensing_ExtendableLicense):
4883 NODE_KIND = NodeKind.BlankNodeOrIRI
4884 ID_ALIAS = "spdxId"
4885 NAMED_INDIVIDUALS = {
4886 }
4887
4888 @classmethod
4889 def _register_props(cls):
4890 super()._register_props()
4891 # Specifies whether a license or additional text identifier has been marked as
4892 # deprecated.
4893 cls._add_property(
4894 "expandedlicensing_isDeprecatedLicenseId",
4895 BooleanProp(),
4896 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/isDeprecatedLicenseId",
4897 compact="expandedlicensing_isDeprecatedLicenseId",
4898 )
4899 # Specifies whether the License is listed as free by the
4900 # [Free Software Foundation (FSF)](https://fsf.org).
4901 cls._add_property(
4902 "expandedlicensing_isFsfLibre",
4903 BooleanProp(),
4904 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/isFsfLibre",
4905 compact="expandedlicensing_isFsfLibre",
4906 )
4907 # Specifies whether the License is listed as approved by the
4908 # [Open Source Initiative (OSI)](https://opensource.org).
4909 cls._add_property(
4910 "expandedlicensing_isOsiApproved",
4911 BooleanProp(),
4912 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/isOsiApproved",
4913 compact="expandedlicensing_isOsiApproved",
4914 )
4915 # Identifies all the text and metadata associated with a license in the license
4916 # XML format.
4917 cls._add_property(
4918 "expandedlicensing_licenseXml",
4919 StringProp(),
4920 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/licenseXml",
4921 compact="expandedlicensing_licenseXml",
4922 )
4923 # Specifies the licenseId that is preferred to be used in place of a deprecated
4924 # License or LicenseAddition.
4925 cls._add_property(
4926 "expandedlicensing_obsoletedBy",
4927 StringProp(),
4928 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/obsoletedBy",
4929 compact="expandedlicensing_obsoletedBy",
4930 )
4931 # Contains a URL where the License or LicenseAddition can be found in use.
4932 cls._add_property(
4933 "expandedlicensing_seeAlso",
4934 ListProp(AnyURIProp()),
4935 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/seeAlso",
4936 compact="expandedlicensing_seeAlso",
4937 )
4938 # Provides a License author's preferred text to indicate that a file is covered
4939 # by the License.
4940 cls._add_property(
4941 "expandedlicensing_standardLicenseHeader",
4942 StringProp(),
4943 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/standardLicenseHeader",
4944 compact="expandedlicensing_standardLicenseHeader",
4945 )
4946 # Identifies the full text of a License, in SPDX templating format.
4947 cls._add_property(
4948 "expandedlicensing_standardLicenseTemplate",
4949 StringProp(),
4950 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/standardLicenseTemplate",
4951 compact="expandedlicensing_standardLicenseTemplate",
4952 )
4953 # Identifies the full text of a License or Addition.
4954 cls._add_property(
4955 "simplelicensing_licenseText",
4956 StringProp(),
4957 iri="https://spdx.org/rdf/3.0.0/terms/SimpleLicensing/licenseText",
4958 min_count=1,
4959 compact="simplelicensing_licenseText",
4960 )
4961
4962
4963# A license that is listed on the SPDX License List.
4964@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/ListedLicense", compact_type="expandedlicensing_ListedLicense", abstract=False)
4965class expandedlicensing_ListedLicense(expandedlicensing_License):
4966 NODE_KIND = NodeKind.BlankNodeOrIRI
4967 ID_ALIAS = "spdxId"
4968 NAMED_INDIVIDUALS = {
4969 }
4970
4971 @classmethod
4972 def _register_props(cls):
4973 super()._register_props()
4974 # Specifies the SPDX License List version in which this license or exception
4975 # identifier was deprecated.
4976 cls._add_property(
4977 "expandedlicensing_deprecatedVersion",
4978 StringProp(),
4979 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/deprecatedVersion",
4980 compact="expandedlicensing_deprecatedVersion",
4981 )
4982 # Specifies the SPDX License List version in which this ListedLicense or
4983 # ListedLicenseException identifier was first added.
4984 cls._add_property(
4985 "expandedlicensing_listVersionAdded",
4986 StringProp(),
4987 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/listVersionAdded",
4988 compact="expandedlicensing_listVersionAdded",
4989 )
4990
4991
4992# Portion of an AnyLicenseInfo representing this version, or any later version,
4993# of the indicated License.
4994@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/OrLaterOperator", compact_type="expandedlicensing_OrLaterOperator", abstract=False)
4995class expandedlicensing_OrLaterOperator(expandedlicensing_ExtendableLicense):
4996 NODE_KIND = NodeKind.BlankNodeOrIRI
4997 ID_ALIAS = "spdxId"
4998 NAMED_INDIVIDUALS = {
4999 }
5000
5001 @classmethod
5002 def _register_props(cls):
5003 super()._register_props()
5004 # A License participating in an 'or later' model.
5005 cls._add_property(
5006 "expandedlicensing_subjectLicense",
5007 ObjectProp(expandedlicensing_License, True),
5008 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/subjectLicense",
5009 min_count=1,
5010 compact="expandedlicensing_subjectLicense",
5011 )
5012
5013
5014# Portion of an AnyLicenseInfo representing a License which has additional
5015# text applied to it.
5016@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/WithAdditionOperator", compact_type="expandedlicensing_WithAdditionOperator", abstract=False)
5017class expandedlicensing_WithAdditionOperator(simplelicensing_AnyLicenseInfo):
5018 NODE_KIND = NodeKind.BlankNodeOrIRI
5019 ID_ALIAS = "spdxId"
5020 NAMED_INDIVIDUALS = {
5021 }
5022
5023 @classmethod
5024 def _register_props(cls):
5025 super()._register_props()
5026 # A LicenseAddition participating in a 'with addition' model.
5027 cls._add_property(
5028 "expandedlicensing_subjectAddition",
5029 ObjectProp(expandedlicensing_LicenseAddition, True),
5030 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/subjectAddition",
5031 min_count=1,
5032 compact="expandedlicensing_subjectAddition",
5033 )
5034 # A License participating in a 'with addition' model.
5035 cls._add_property(
5036 "expandedlicensing_subjectExtendableLicense",
5037 ObjectProp(expandedlicensing_ExtendableLicense, True),
5038 iri="https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/subjectExtendableLicense",
5039 min_count=1,
5040 compact="expandedlicensing_subjectExtendableLicense",
5041 )
5042
5043
5044# A type of extension consisting of a list of name value pairs.
5045@register("https://spdx.org/rdf/3.0.0/terms/Extension/CdxPropertiesExtension", compact_type="extension_CdxPropertiesExtension", abstract=False)
5046class extension_CdxPropertiesExtension(extension_Extension):
5047 NODE_KIND = NodeKind.BlankNodeOrIRI
5048 NAMED_INDIVIDUALS = {
5049 }
5050
5051 @classmethod
5052 def _register_props(cls):
5053 super()._register_props()
5054 # Provides a map of a property names to a values.
5055 cls._add_property(
5056 "extension_cdxProperty",
5057 ListProp(ObjectProp(extension_CdxPropertyEntry, False)),
5058 iri="https://spdx.org/rdf/3.0.0/terms/Extension/cdxProperty",
5059 min_count=1,
5060 compact="extension_cdxProperty",
5061 )
5062
5063
5064# Provides a CVSS version 2.0 assessment for a vulnerability.
5065@register("https://spdx.org/rdf/3.0.0/terms/Security/CvssV2VulnAssessmentRelationship", compact_type="security_CvssV2VulnAssessmentRelationship", abstract=False)
5066class security_CvssV2VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5067 NODE_KIND = NodeKind.BlankNodeOrIRI
5068 ID_ALIAS = "spdxId"
5069 NAMED_INDIVIDUALS = {
5070 }
5071
5072 @classmethod
5073 def _register_props(cls):
5074 super()._register_props()
5075 # Provides a numerical (0-10) representation of the severity of a vulnerability.
5076 cls._add_property(
5077 "security_score",
5078 FloatProp(),
5079 iri="https://spdx.org/rdf/3.0.0/terms/Security/score",
5080 min_count=1,
5081 compact="security_score",
5082 )
5083 # Specifies the CVSS vector string for a vulnerability.
5084 cls._add_property(
5085 "security_vectorString",
5086 StringProp(),
5087 iri="https://spdx.org/rdf/3.0.0/terms/Security/vectorString",
5088 min_count=1,
5089 compact="security_vectorString",
5090 )
5091
5092
5093# Provides a CVSS version 3 assessment for a vulnerability.
5094@register("https://spdx.org/rdf/3.0.0/terms/Security/CvssV3VulnAssessmentRelationship", compact_type="security_CvssV3VulnAssessmentRelationship", abstract=False)
5095class security_CvssV3VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5096 NODE_KIND = NodeKind.BlankNodeOrIRI
5097 ID_ALIAS = "spdxId"
5098 NAMED_INDIVIDUALS = {
5099 }
5100
5101 @classmethod
5102 def _register_props(cls):
5103 super()._register_props()
5104 # Provides a numerical (0-10) representation of the severity of a vulnerability.
5105 cls._add_property(
5106 "security_score",
5107 FloatProp(),
5108 iri="https://spdx.org/rdf/3.0.0/terms/Security/score",
5109 min_count=1,
5110 compact="security_score",
5111 )
5112 # Specifies the CVSS qualitative severity rating of a vulnerability in relation to a piece of software.
5113 cls._add_property(
5114 "security_severity",
5115 EnumProp([
5116 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical", "critical"),
5117 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high", "high"),
5118 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low", "low"),
5119 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium", "medium"),
5120 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none", "none"),
5121 ]),
5122 iri="https://spdx.org/rdf/3.0.0/terms/Security/severity",
5123 min_count=1,
5124 compact="security_severity",
5125 )
5126 # Specifies the CVSS vector string for a vulnerability.
5127 cls._add_property(
5128 "security_vectorString",
5129 StringProp(),
5130 iri="https://spdx.org/rdf/3.0.0/terms/Security/vectorString",
5131 min_count=1,
5132 compact="security_vectorString",
5133 )
5134
5135
5136# Provides a CVSS version 4 assessment for a vulnerability.
5137@register("https://spdx.org/rdf/3.0.0/terms/Security/CvssV4VulnAssessmentRelationship", compact_type="security_CvssV4VulnAssessmentRelationship", abstract=False)
5138class security_CvssV4VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5139 NODE_KIND = NodeKind.BlankNodeOrIRI
5140 ID_ALIAS = "spdxId"
5141 NAMED_INDIVIDUALS = {
5142 }
5143
5144 @classmethod
5145 def _register_props(cls):
5146 super()._register_props()
5147 # Provides a numerical (0-10) representation of the severity of a vulnerability.
5148 cls._add_property(
5149 "security_score",
5150 FloatProp(),
5151 iri="https://spdx.org/rdf/3.0.0/terms/Security/score",
5152 min_count=1,
5153 compact="security_score",
5154 )
5155 # Specifies the CVSS qualitative severity rating of a vulnerability in relation to a piece of software.
5156 cls._add_property(
5157 "security_severity",
5158 EnumProp([
5159 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/critical", "critical"),
5160 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/high", "high"),
5161 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/low", "low"),
5162 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/medium", "medium"),
5163 ("https://spdx.org/rdf/3.0.0/terms/Security/CvssSeverityType/none", "none"),
5164 ]),
5165 iri="https://spdx.org/rdf/3.0.0/terms/Security/severity",
5166 min_count=1,
5167 compact="security_severity",
5168 )
5169 # Specifies the CVSS vector string for a vulnerability.
5170 cls._add_property(
5171 "security_vectorString",
5172 StringProp(),
5173 iri="https://spdx.org/rdf/3.0.0/terms/Security/vectorString",
5174 min_count=1,
5175 compact="security_vectorString",
5176 )
5177
5178
5179# Provides an EPSS assessment for a vulnerability.
5180@register("https://spdx.org/rdf/3.0.0/terms/Security/EpssVulnAssessmentRelationship", compact_type="security_EpssVulnAssessmentRelationship", abstract=False)
5181class security_EpssVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5182 NODE_KIND = NodeKind.BlankNodeOrIRI
5183 ID_ALIAS = "spdxId"
5184 NAMED_INDIVIDUALS = {
5185 }
5186
5187 @classmethod
5188 def _register_props(cls):
5189 super()._register_props()
5190 # The percentile of the current probability score.
5191 cls._add_property(
5192 "security_percentile",
5193 FloatProp(),
5194 iri="https://spdx.org/rdf/3.0.0/terms/Security/percentile",
5195 min_count=1,
5196 compact="security_percentile",
5197 )
5198 # A probability score between 0 and 1 of a vulnerability being exploited.
5199 cls._add_property(
5200 "security_probability",
5201 FloatProp(),
5202 iri="https://spdx.org/rdf/3.0.0/terms/Security/probability",
5203 min_count=1,
5204 compact="security_probability",
5205 )
5206 # Specifies the time when a vulnerability was published.
5207 cls._add_property(
5208 "security_publishedTime",
5209 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
5210 iri="https://spdx.org/rdf/3.0.0/terms/Security/publishedTime",
5211 min_count=1,
5212 compact="security_publishedTime",
5213 )
5214
5215
5216# Provides an exploit assessment of a vulnerability.
5217@register("https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogVulnAssessmentRelationship", compact_type="security_ExploitCatalogVulnAssessmentRelationship", abstract=False)
5218class security_ExploitCatalogVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5219 NODE_KIND = NodeKind.BlankNodeOrIRI
5220 ID_ALIAS = "spdxId"
5221 NAMED_INDIVIDUALS = {
5222 }
5223
5224 @classmethod
5225 def _register_props(cls):
5226 super()._register_props()
5227 # Specifies the exploit catalog type.
5228 cls._add_property(
5229 "security_catalogType",
5230 EnumProp([
5231 ("https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/kev", "kev"),
5232 ("https://spdx.org/rdf/3.0.0/terms/Security/ExploitCatalogType/other", "other"),
5233 ]),
5234 iri="https://spdx.org/rdf/3.0.0/terms/Security/catalogType",
5235 min_count=1,
5236 compact="security_catalogType",
5237 )
5238 # Describe that a CVE is known to have an exploit because it's been listed in an exploit catalog.
5239 cls._add_property(
5240 "security_exploited",
5241 BooleanProp(),
5242 iri="https://spdx.org/rdf/3.0.0/terms/Security/exploited",
5243 min_count=1,
5244 compact="security_exploited",
5245 )
5246 # Provides the location of an exploit catalog.
5247 cls._add_property(
5248 "security_locator",
5249 AnyURIProp(),
5250 iri="https://spdx.org/rdf/3.0.0/terms/Security/locator",
5251 min_count=1,
5252 compact="security_locator",
5253 )
5254
5255
5256# Provides an SSVC assessment for a vulnerability.
5257@register("https://spdx.org/rdf/3.0.0/terms/Security/SsvcVulnAssessmentRelationship", compact_type="security_SsvcVulnAssessmentRelationship", abstract=False)
5258class security_SsvcVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5259 NODE_KIND = NodeKind.BlankNodeOrIRI
5260 ID_ALIAS = "spdxId"
5261 NAMED_INDIVIDUALS = {
5262 }
5263
5264 @classmethod
5265 def _register_props(cls):
5266 super()._register_props()
5267 # Provide the enumeration of possible decisions in the Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree [https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf](https://www.cisa.gov/sites/default/files/publications/cisa-ssvc-guide%20508c.pdf)
5268 cls._add_property(
5269 "security_decisionType",
5270 EnumProp([
5271 ("https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/act", "act"),
5272 ("https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/attend", "attend"),
5273 ("https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/track", "track"),
5274 ("https://spdx.org/rdf/3.0.0/terms/Security/SsvcDecisionType/trackStar", "trackStar"),
5275 ]),
5276 iri="https://spdx.org/rdf/3.0.0/terms/Security/decisionType",
5277 min_count=1,
5278 compact="security_decisionType",
5279 )
5280
5281
5282# Asbtract ancestor class for all VEX relationships
5283@register("https://spdx.org/rdf/3.0.0/terms/Security/VexVulnAssessmentRelationship", compact_type="security_VexVulnAssessmentRelationship", abstract=True)
5284class security_VexVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5285 NODE_KIND = NodeKind.BlankNodeOrIRI
5286 ID_ALIAS = "spdxId"
5287 NAMED_INDIVIDUALS = {
5288 }
5289
5290 @classmethod
5291 def _register_props(cls):
5292 super()._register_props()
5293 # Conveys information about how VEX status was determined.
5294 cls._add_property(
5295 "security_statusNotes",
5296 StringProp(),
5297 iri="https://spdx.org/rdf/3.0.0/terms/Security/statusNotes",
5298 compact="security_statusNotes",
5299 )
5300 # Specifies the version of a VEX statement.
5301 cls._add_property(
5302 "security_vexVersion",
5303 StringProp(),
5304 iri="https://spdx.org/rdf/3.0.0/terms/Security/vexVersion",
5305 compact="security_vexVersion",
5306 )
5307
5308
5309# Specifies a vulnerability and its associated information.
5310@register("https://spdx.org/rdf/3.0.0/terms/Security/Vulnerability", compact_type="security_Vulnerability", abstract=False)
5311class security_Vulnerability(Artifact):
5312 NODE_KIND = NodeKind.BlankNodeOrIRI
5313 ID_ALIAS = "spdxId"
5314 NAMED_INDIVIDUALS = {
5315 }
5316
5317 @classmethod
5318 def _register_props(cls):
5319 super()._register_props()
5320 # Specifies a time when a vulnerability assessment was modified
5321 cls._add_property(
5322 "security_modifiedTime",
5323 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
5324 iri="https://spdx.org/rdf/3.0.0/terms/Security/modifiedTime",
5325 compact="security_modifiedTime",
5326 )
5327 # Specifies the time when a vulnerability was published.
5328 cls._add_property(
5329 "security_publishedTime",
5330 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
5331 iri="https://spdx.org/rdf/3.0.0/terms/Security/publishedTime",
5332 compact="security_publishedTime",
5333 )
5334 # Specified the time and date when a vulnerability was withdrawn.
5335 cls._add_property(
5336 "security_withdrawnTime",
5337 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
5338 iri="https://spdx.org/rdf/3.0.0/terms/Security/withdrawnTime",
5339 compact="security_withdrawnTime",
5340 )
5341
5342
5343# A distinct article or unit related to Software.
5344@register("https://spdx.org/rdf/3.0.0/terms/Software/SoftwareArtifact", compact_type="software_SoftwareArtifact", abstract=True)
5345class software_SoftwareArtifact(Artifact):
5346 NODE_KIND = NodeKind.BlankNodeOrIRI
5347 ID_ALIAS = "spdxId"
5348 NAMED_INDIVIDUALS = {
5349 }
5350
5351 @classmethod
5352 def _register_props(cls):
5353 super()._register_props()
5354 # Provides additional purpose information of the software artifact.
5355 cls._add_property(
5356 "software_additionalPurpose",
5357 ListProp(EnumProp([
5358 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application", "application"),
5359 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive", "archive"),
5360 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom", "bom"),
5361 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration", "configuration"),
5362 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container", "container"),
5363 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data", "data"),
5364 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device", "device"),
5365 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver", "deviceDriver"),
5366 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage", "diskImage"),
5367 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation", "documentation"),
5368 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence", "evidence"),
5369 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable", "executable"),
5370 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file", "file"),
5371 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage", "filesystemImage"),
5372 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware", "firmware"),
5373 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework", "framework"),
5374 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install", "install"),
5375 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library", "library"),
5376 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest", "manifest"),
5377 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model", "model"),
5378 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module", "module"),
5379 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem", "operatingSystem"),
5380 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other", "other"),
5381 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch", "patch"),
5382 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform", "platform"),
5383 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement", "requirement"),
5384 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source", "source"),
5385 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification", "specification"),
5386 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test", "test"),
5387 ])),
5388 iri="https://spdx.org/rdf/3.0.0/terms/Software/additionalPurpose",
5389 compact="software_additionalPurpose",
5390 )
5391 # Provides a place for the SPDX data creator to record acknowledgement text for
5392 # a software Package, File or Snippet.
5393 cls._add_property(
5394 "software_attributionText",
5395 ListProp(StringProp()),
5396 iri="https://spdx.org/rdf/3.0.0/terms/Software/attributionText",
5397 compact="software_attributionText",
5398 )
5399 # A canonical, unique, immutable identifier of the artifact content, that may be
5400 # used for verifying its identity and/or integrity.
5401 cls._add_property(
5402 "software_contentIdentifier",
5403 ListProp(ObjectProp(software_ContentIdentifier, False)),
5404 iri="https://spdx.org/rdf/3.0.0/terms/Software/contentIdentifier",
5405 compact="software_contentIdentifier",
5406 )
5407 # Identifies the text of one or more copyright notices for a software Package,
5408 # File or Snippet, if any.
5409 cls._add_property(
5410 "software_copyrightText",
5411 StringProp(),
5412 iri="https://spdx.org/rdf/3.0.0/terms/Software/copyrightText",
5413 compact="software_copyrightText",
5414 )
5415 # Provides information about the primary purpose of the software artifact.
5416 cls._add_property(
5417 "software_primaryPurpose",
5418 EnumProp([
5419 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/application", "application"),
5420 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/archive", "archive"),
5421 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/bom", "bom"),
5422 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/configuration", "configuration"),
5423 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/container", "container"),
5424 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/data", "data"),
5425 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/device", "device"),
5426 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/deviceDriver", "deviceDriver"),
5427 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/diskImage", "diskImage"),
5428 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/documentation", "documentation"),
5429 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/evidence", "evidence"),
5430 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/executable", "executable"),
5431 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/file", "file"),
5432 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/filesystemImage", "filesystemImage"),
5433 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/firmware", "firmware"),
5434 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/framework", "framework"),
5435 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/install", "install"),
5436 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/library", "library"),
5437 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/manifest", "manifest"),
5438 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/model", "model"),
5439 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/module", "module"),
5440 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/operatingSystem", "operatingSystem"),
5441 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/other", "other"),
5442 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/patch", "patch"),
5443 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/platform", "platform"),
5444 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/requirement", "requirement"),
5445 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/source", "source"),
5446 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/specification", "specification"),
5447 ("https://spdx.org/rdf/3.0.0/terms/Software/SoftwarePurpose/test", "test"),
5448 ]),
5449 iri="https://spdx.org/rdf/3.0.0/terms/Software/primaryPurpose",
5450 compact="software_primaryPurpose",
5451 )
5452
5453
5454# A container for a grouping of SPDX-3.0 content characterizing details
5455# (provenence, composition, licensing, etc.) about a product.
5456@register("https://spdx.org/rdf/3.0.0/terms/Core/Bom", compact_type="Bom", abstract=False)
5457class Bom(Bundle):
5458 NODE_KIND = NodeKind.BlankNodeOrIRI
5459 ID_ALIAS = "spdxId"
5460 NAMED_INDIVIDUALS = {
5461 }
5462
5463
5464# A license that is not listed on the SPDX License List.
5465@register("https://spdx.org/rdf/3.0.0/terms/ExpandedLicensing/CustomLicense", compact_type="expandedlicensing_CustomLicense", abstract=False)
5466class expandedlicensing_CustomLicense(expandedlicensing_License):
5467 NODE_KIND = NodeKind.BlankNodeOrIRI
5468 ID_ALIAS = "spdxId"
5469 NAMED_INDIVIDUALS = {
5470 }
5471
5472
5473# Connects a vulnerability and an element designating the element as a product
5474# affected by the vulnerability.
5475@register("https://spdx.org/rdf/3.0.0/terms/Security/VexAffectedVulnAssessmentRelationship", compact_type="security_VexAffectedVulnAssessmentRelationship", abstract=False)
5476class security_VexAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
5477 NODE_KIND = NodeKind.BlankNodeOrIRI
5478 ID_ALIAS = "spdxId"
5479 NAMED_INDIVIDUALS = {
5480 }
5481
5482 @classmethod
5483 def _register_props(cls):
5484 super()._register_props()
5485 # Provides advise on how to mitigate or remediate a vulnerability when a VEX product
5486 # is affected by it.
5487 cls._add_property(
5488 "security_actionStatement",
5489 StringProp(),
5490 iri="https://spdx.org/rdf/3.0.0/terms/Security/actionStatement",
5491 compact="security_actionStatement",
5492 )
5493 # Records the time when a recommended action was communicated in a VEX statement
5494 # to mitigate a vulnerability.
5495 cls._add_property(
5496 "security_actionStatementTime",
5497 ListProp(DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",)),
5498 iri="https://spdx.org/rdf/3.0.0/terms/Security/actionStatementTime",
5499 compact="security_actionStatementTime",
5500 )
5501
5502
5503# Links a vulnerability and elements representing products (in the VEX sense) where
5504# a fix has been applied and are no longer affected.
5505@register("https://spdx.org/rdf/3.0.0/terms/Security/VexFixedVulnAssessmentRelationship", compact_type="security_VexFixedVulnAssessmentRelationship", abstract=False)
5506class security_VexFixedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
5507 NODE_KIND = NodeKind.BlankNodeOrIRI
5508 ID_ALIAS = "spdxId"
5509 NAMED_INDIVIDUALS = {
5510 }
5511
5512
5513# Links a vulnerability and one or more elements designating the latter as products
5514# not affected by the vulnerability.
5515@register("https://spdx.org/rdf/3.0.0/terms/Security/VexNotAffectedVulnAssessmentRelationship", compact_type="security_VexNotAffectedVulnAssessmentRelationship", abstract=False)
5516class security_VexNotAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
5517 NODE_KIND = NodeKind.BlankNodeOrIRI
5518 ID_ALIAS = "spdxId"
5519 NAMED_INDIVIDUALS = {
5520 }
5521
5522 @classmethod
5523 def _register_props(cls):
5524 super()._register_props()
5525 # Explains why a VEX product is not affected by a vulnerability. It is an
5526 # alternative in VexNotAffectedVulnAssessmentRelationship to the machine-readable
5527 # justification label.
5528 cls._add_property(
5529 "security_impactStatement",
5530 StringProp(),
5531 iri="https://spdx.org/rdf/3.0.0/terms/Security/impactStatement",
5532 compact="security_impactStatement",
5533 )
5534 # Timestamp of impact statement.
5535 cls._add_property(
5536 "security_impactStatementTime",
5537 DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$",),
5538 iri="https://spdx.org/rdf/3.0.0/terms/Security/impactStatementTime",
5539 compact="security_impactStatementTime",
5540 )
5541 # Impact justification label to be used when linking a vulnerability to an element
5542 # representing a VEX product with a VexNotAffectedVulnAssessmentRelationship
5543 # relationship.
5544 cls._add_property(
5545 "security_justificationType",
5546 EnumProp([
5547 ("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/componentNotPresent", "componentNotPresent"),
5548 ("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist", "inlineMitigationsAlreadyExist"),
5549 ("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary", "vulnerableCodeCannotBeControlledByAdversary"),
5550 ("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath", "vulnerableCodeNotInExecutePath"),
5551 ("https://spdx.org/rdf/3.0.0/terms/Security/VexJustificationType/vulnerableCodeNotPresent", "vulnerableCodeNotPresent"),
5552 ]),
5553 iri="https://spdx.org/rdf/3.0.0/terms/Security/justificationType",
5554 compact="security_justificationType",
5555 )
5556
5557
5558# Designates elements as products where the impact of a vulnerability is being
5559# investigated.
5560@register("https://spdx.org/rdf/3.0.0/terms/Security/VexUnderInvestigationVulnAssessmentRelationship", compact_type="security_VexUnderInvestigationVulnAssessmentRelationship", abstract=False)
5561class security_VexUnderInvestigationVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
5562 NODE_KIND = NodeKind.BlankNodeOrIRI
5563 ID_ALIAS = "spdxId"
5564 NAMED_INDIVIDUALS = {
5565 }
5566
5567
5568# Refers to any object that stores content on a computer.
5569@register("https://spdx.org/rdf/3.0.0/terms/Software/File", compact_type="software_File", abstract=False)
5570class software_File(software_SoftwareArtifact):
5571 NODE_KIND = NodeKind.BlankNodeOrIRI
5572 ID_ALIAS = "spdxId"
5573 NAMED_INDIVIDUALS = {
5574 }
5575
5576 @classmethod
5577 def _register_props(cls):
5578 super()._register_props()
5579 # Provides information about the content type of an Element.
5580 cls._add_property(
5581 "software_contentType",
5582 StringProp(pattern=r"^[^\/]+\/[^\/]+$",),
5583 iri="https://spdx.org/rdf/3.0.0/terms/Software/contentType",
5584 compact="software_contentType",
5585 )
5586 # Describes if a given file is a directory or non-directory kind of file.
5587 cls._add_property(
5588 "software_fileKind",
5589 EnumProp([
5590 ("https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/directory", "directory"),
5591 ("https://spdx.org/rdf/3.0.0/terms/Software/FileKindType/file", "file"),
5592 ]),
5593 iri="https://spdx.org/rdf/3.0.0/terms/Software/fileKind",
5594 compact="software_fileKind",
5595 )
5596
5597
5598# Refers to any unit of content that can be associated with a distribution of
5599# software.
5600@register("https://spdx.org/rdf/3.0.0/terms/Software/Package", compact_type="software_Package", abstract=False)
5601class software_Package(software_SoftwareArtifact):
5602 NODE_KIND = NodeKind.BlankNodeOrIRI
5603 ID_ALIAS = "spdxId"
5604 NAMED_INDIVIDUALS = {
5605 }
5606
5607 @classmethod
5608 def _register_props(cls):
5609 super()._register_props()
5610 # Identifies the download Uniform Resource Identifier for the package at the time
5611 # that the document was created.
5612 cls._add_property(
5613 "software_downloadLocation",
5614 AnyURIProp(),
5615 iri="https://spdx.org/rdf/3.0.0/terms/Software/downloadLocation",
5616 compact="software_downloadLocation",
5617 )
5618 # A place for the SPDX document creator to record a website that serves as the
5619 # package's home page.
5620 cls._add_property(
5621 "software_homePage",
5622 AnyURIProp(),
5623 iri="https://spdx.org/rdf/3.0.0/terms/Software/homePage",
5624 compact="software_homePage",
5625 )
5626 # Provides a place for the SPDX data creator to record the package URL string
5627 # (in accordance with the
5628 # [package URL spec](https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst))
5629 # for a software Package.
5630 cls._add_property(
5631 "software_packageUrl",
5632 AnyURIProp(),
5633 iri="https://spdx.org/rdf/3.0.0/terms/Software/packageUrl",
5634 compact="software_packageUrl",
5635 )
5636 # Identify the version of a package.
5637 cls._add_property(
5638 "software_packageVersion",
5639 StringProp(),
5640 iri="https://spdx.org/rdf/3.0.0/terms/Software/packageVersion",
5641 compact="software_packageVersion",
5642 )
5643 # Records any relevant background information or additional comments
5644 # about the origin of the package.
5645 cls._add_property(
5646 "software_sourceInfo",
5647 StringProp(),
5648 iri="https://spdx.org/rdf/3.0.0/terms/Software/sourceInfo",
5649 compact="software_sourceInfo",
5650 )
5651
5652
5653# A collection of SPDX Elements describing a single package.
5654@register("https://spdx.org/rdf/3.0.0/terms/Software/Sbom", compact_type="software_Sbom", abstract=False)
5655class software_Sbom(Bom):
5656 NODE_KIND = NodeKind.BlankNodeOrIRI
5657 ID_ALIAS = "spdxId"
5658 NAMED_INDIVIDUALS = {
5659 }
5660
5661 @classmethod
5662 def _register_props(cls):
5663 super()._register_props()
5664 # Provides information about the type of an SBOM.
5665 cls._add_property(
5666 "software_sbomType",
5667 ListProp(EnumProp([
5668 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/analyzed", "analyzed"),
5669 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/build", "build"),
5670 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/deployed", "deployed"),
5671 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/design", "design"),
5672 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/runtime", "runtime"),
5673 ("https://spdx.org/rdf/3.0.0/terms/Software/SbomType/source", "source"),
5674 ])),
5675 iri="https://spdx.org/rdf/3.0.0/terms/Software/sbomType",
5676 compact="software_sbomType",
5677 )
5678
5679
5680# Describes a certain part of a file.
5681@register("https://spdx.org/rdf/3.0.0/terms/Software/Snippet", compact_type="software_Snippet", abstract=False)
5682class software_Snippet(software_SoftwareArtifact):
5683 NODE_KIND = NodeKind.BlankNodeOrIRI
5684 ID_ALIAS = "spdxId"
5685 NAMED_INDIVIDUALS = {
5686 }
5687
5688 @classmethod
5689 def _register_props(cls):
5690 super()._register_props()
5691 # Defines the byte range in the original host file that the snippet information
5692 # applies to.
5693 cls._add_property(
5694 "software_byteRange",
5695 ObjectProp(PositiveIntegerRange, False),
5696 iri="https://spdx.org/rdf/3.0.0/terms/Software/byteRange",
5697 compact="software_byteRange",
5698 )
5699 # Defines the line range in the original host file that the snippet information
5700 # applies to.
5701 cls._add_property(
5702 "software_lineRange",
5703 ObjectProp(PositiveIntegerRange, False),
5704 iri="https://spdx.org/rdf/3.0.0/terms/Software/lineRange",
5705 compact="software_lineRange",
5706 )
5707 # Defines the original host file that the snippet information applies to.
5708 cls._add_property(
5709 "software_snippetFromFile",
5710 ObjectProp(software_File, True),
5711 iri="https://spdx.org/rdf/3.0.0/terms/Software/snippetFromFile",
5712 min_count=1,
5713 compact="software_snippetFromFile",
5714 )
5715
5716
5717# Specifies an AI package and its associated information.
5718@register("https://spdx.org/rdf/3.0.0/terms/AI/AIPackage", compact_type="ai_AIPackage", abstract=False)
5719class ai_AIPackage(software_Package):
5720 NODE_KIND = NodeKind.BlankNodeOrIRI
5721 ID_ALIAS = "spdxId"
5722 NAMED_INDIVIDUALS = {
5723 }
5724
5725 @classmethod
5726 def _register_props(cls):
5727 super()._register_props()
5728 # States if a human is involved in the decisions of the AI software.
5729 cls._add_property(
5730 "ai_autonomyType",
5731 EnumProp([
5732 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no", "no"),
5733 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion", "noAssertion"),
5734 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes", "yes"),
5735 ]),
5736 iri="https://spdx.org/rdf/3.0.0/terms/AI/autonomyType",
5737 compact="ai_autonomyType",
5738 )
5739 # Captures the domain in which the AI package can be used.
5740 cls._add_property(
5741 "ai_domain",
5742 ListProp(StringProp()),
5743 iri="https://spdx.org/rdf/3.0.0/terms/AI/domain",
5744 compact="ai_domain",
5745 )
5746 # Indicates the amount of energy consumed to train the AI model.
5747 cls._add_property(
5748 "ai_energyConsumption",
5749 ObjectProp(ai_EnergyConsumption, False),
5750 iri="https://spdx.org/rdf/3.0.0/terms/AI/energyConsumption",
5751 compact="ai_energyConsumption",
5752 )
5753 # Records a hyperparameter used to build the AI model contained in the AI
5754 # package.
5755 cls._add_property(
5756 "ai_hyperparameter",
5757 ListProp(ObjectProp(DictionaryEntry, False)),
5758 iri="https://spdx.org/rdf/3.0.0/terms/AI/hyperparameter",
5759 compact="ai_hyperparameter",
5760 )
5761 # Provides relevant information about the AI software, not including the model
5762 # description.
5763 cls._add_property(
5764 "ai_informationAboutApplication",
5765 StringProp(),
5766 iri="https://spdx.org/rdf/3.0.0/terms/AI/informationAboutApplication",
5767 compact="ai_informationAboutApplication",
5768 )
5769 # Describes relevant information about different steps of the training process.
5770 cls._add_property(
5771 "ai_informationAboutTraining",
5772 StringProp(),
5773 iri="https://spdx.org/rdf/3.0.0/terms/AI/informationAboutTraining",
5774 compact="ai_informationAboutTraining",
5775 )
5776 # Captures a limitation of the AI software.
5777 cls._add_property(
5778 "ai_limitation",
5779 StringProp(),
5780 iri="https://spdx.org/rdf/3.0.0/terms/AI/limitation",
5781 compact="ai_limitation",
5782 )
5783 # Records the measurement of prediction quality of the AI model.
5784 cls._add_property(
5785 "ai_metric",
5786 ListProp(ObjectProp(DictionaryEntry, False)),
5787 iri="https://spdx.org/rdf/3.0.0/terms/AI/metric",
5788 compact="ai_metric",
5789 )
5790 # Captures the threshold that was used for computation of a metric described in
5791 # the metric field.
5792 cls._add_property(
5793 "ai_metricDecisionThreshold",
5794 ListProp(ObjectProp(DictionaryEntry, False)),
5795 iri="https://spdx.org/rdf/3.0.0/terms/AI/metricDecisionThreshold",
5796 compact="ai_metricDecisionThreshold",
5797 )
5798 # Describes all the preprocessing steps applied to the training data before the
5799 # model training.
5800 cls._add_property(
5801 "ai_modelDataPreprocessing",
5802 ListProp(StringProp()),
5803 iri="https://spdx.org/rdf/3.0.0/terms/AI/modelDataPreprocessing",
5804 compact="ai_modelDataPreprocessing",
5805 )
5806 # Describes methods that can be used to explain the model.
5807 cls._add_property(
5808 "ai_modelExplainability",
5809 ListProp(StringProp()),
5810 iri="https://spdx.org/rdf/3.0.0/terms/AI/modelExplainability",
5811 compact="ai_modelExplainability",
5812 )
5813 # Records the results of general safety risk assessment of the AI system.
5814 cls._add_property(
5815 "ai_safetyRiskAssessment",
5816 EnumProp([
5817 ("https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/high", "high"),
5818 ("https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/low", "low"),
5819 ("https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/medium", "medium"),
5820 ("https://spdx.org/rdf/3.0.0/terms/AI/SafetyRiskAssessmentType/serious", "serious"),
5821 ]),
5822 iri="https://spdx.org/rdf/3.0.0/terms/AI/safetyRiskAssessment",
5823 compact="ai_safetyRiskAssessment",
5824 )
5825 # Captures a standard that is being complied with.
5826 cls._add_property(
5827 "ai_standardCompliance",
5828 ListProp(StringProp()),
5829 iri="https://spdx.org/rdf/3.0.0/terms/AI/standardCompliance",
5830 compact="ai_standardCompliance",
5831 )
5832 # Records the type of the model used in the AI software.
5833 cls._add_property(
5834 "ai_typeOfModel",
5835 ListProp(StringProp()),
5836 iri="https://spdx.org/rdf/3.0.0/terms/AI/typeOfModel",
5837 compact="ai_typeOfModel",
5838 )
5839 # Records if sensitive personal information is used during model training or
5840 # could be used during the inference.
5841 cls._add_property(
5842 "ai_useSensitivePersonalInformation",
5843 EnumProp([
5844 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no", "no"),
5845 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion", "noAssertion"),
5846 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes", "yes"),
5847 ]),
5848 iri="https://spdx.org/rdf/3.0.0/terms/AI/useSensitivePersonalInformation",
5849 compact="ai_useSensitivePersonalInformation",
5850 )
5851
5852
5853# Specifies a data package and its associated information.
5854@register("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetPackage", compact_type="dataset_DatasetPackage", abstract=False)
5855class dataset_DatasetPackage(software_Package):
5856 NODE_KIND = NodeKind.BlankNodeOrIRI
5857 ID_ALIAS = "spdxId"
5858 NAMED_INDIVIDUALS = {
5859 }
5860
5861 @classmethod
5862 def _register_props(cls):
5863 super()._register_props()
5864 # Describes the anonymization methods used.
5865 cls._add_property(
5866 "dataset_anonymizationMethodUsed",
5867 ListProp(StringProp()),
5868 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/anonymizationMethodUsed",
5869 compact="dataset_anonymizationMethodUsed",
5870 )
5871 # Describes the confidentiality level of the data points contained in the dataset.
5872 cls._add_property(
5873 "dataset_confidentialityLevel",
5874 EnumProp([
5875 ("https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/amber", "amber"),
5876 ("https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/clear", "clear"),
5877 ("https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/green", "green"),
5878 ("https://spdx.org/rdf/3.0.0/terms/Dataset/ConfidentialityLevelType/red", "red"),
5879 ]),
5880 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/confidentialityLevel",
5881 compact="dataset_confidentialityLevel",
5882 )
5883 # Describes how the dataset was collected.
5884 cls._add_property(
5885 "dataset_dataCollectionProcess",
5886 StringProp(),
5887 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/dataCollectionProcess",
5888 compact="dataset_dataCollectionProcess",
5889 )
5890 # Describes the preprocessing steps that were applied to the raw data to create the given dataset.
5891 cls._add_property(
5892 "dataset_dataPreprocessing",
5893 ListProp(StringProp()),
5894 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/dataPreprocessing",
5895 compact="dataset_dataPreprocessing",
5896 )
5897 # The field describes the availability of a dataset.
5898 cls._add_property(
5899 "dataset_datasetAvailability",
5900 EnumProp([
5901 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/clickthrough", "clickthrough"),
5902 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/directDownload", "directDownload"),
5903 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/query", "query"),
5904 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/registration", "registration"),
5905 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetAvailabilityType/scrapingScript", "scrapingScript"),
5906 ]),
5907 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/datasetAvailability",
5908 compact="dataset_datasetAvailability",
5909 )
5910 # Describes potentially noisy elements of the dataset.
5911 cls._add_property(
5912 "dataset_datasetNoise",
5913 StringProp(),
5914 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/datasetNoise",
5915 compact="dataset_datasetNoise",
5916 )
5917 # Captures the size of the dataset.
5918 cls._add_property(
5919 "dataset_datasetSize",
5920 NonNegativeIntegerProp(),
5921 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/datasetSize",
5922 compact="dataset_datasetSize",
5923 )
5924 # Describes the type of the given dataset.
5925 cls._add_property(
5926 "dataset_datasetType",
5927 ListProp(EnumProp([
5928 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/audio", "audio"),
5929 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/categorical", "categorical"),
5930 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/graph", "graph"),
5931 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/image", "image"),
5932 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/noAssertion", "noAssertion"),
5933 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/numeric", "numeric"),
5934 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/other", "other"),
5935 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/sensor", "sensor"),
5936 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/structured", "structured"),
5937 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/syntactic", "syntactic"),
5938 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/text", "text"),
5939 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timeseries", "timeseries"),
5940 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/timestamp", "timestamp"),
5941 ("https://spdx.org/rdf/3.0.0/terms/Dataset/DatasetType/video", "video"),
5942 ])),
5943 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/datasetType",
5944 min_count=1,
5945 compact="dataset_datasetType",
5946 )
5947 # Describes a mechanism to update the dataset.
5948 cls._add_property(
5949 "dataset_datasetUpdateMechanism",
5950 StringProp(),
5951 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/datasetUpdateMechanism",
5952 compact="dataset_datasetUpdateMechanism",
5953 )
5954 # Describes if any sensitive personal information is present in the dataset.
5955 cls._add_property(
5956 "dataset_hasSensitivePersonalInformation",
5957 EnumProp([
5958 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/no", "no"),
5959 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/noAssertion", "noAssertion"),
5960 ("https://spdx.org/rdf/3.0.0/terms/Core/PresenceType/yes", "yes"),
5961 ]),
5962 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/hasSensitivePersonalInformation",
5963 compact="dataset_hasSensitivePersonalInformation",
5964 )
5965 # Describes what the given dataset should be used for.
5966 cls._add_property(
5967 "dataset_intendedUse",
5968 StringProp(),
5969 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/intendedUse",
5970 compact="dataset_intendedUse",
5971 )
5972 # Records the biases that the dataset is known to encompass.
5973 cls._add_property(
5974 "dataset_knownBias",
5975 ListProp(StringProp()),
5976 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/knownBias",
5977 compact="dataset_knownBias",
5978 )
5979 # Describes a sensor used for collecting the data.
5980 cls._add_property(
5981 "dataset_sensor",
5982 ListProp(ObjectProp(DictionaryEntry, False)),
5983 iri="https://spdx.org/rdf/3.0.0/terms/Dataset/sensor",
5984 compact="dataset_sensor",
5985 )
5986
5987
5988"""Format Guard"""
5989# fmt: on
5990
5991
5992def main():
5993 import argparse
5994 from pathlib import Path
5995
5996 parser = argparse.ArgumentParser(description="Python SHACL model test")
5997 parser.add_argument("infile", type=Path, help="Input file")
5998 parser.add_argument("--print", action="store_true", help="Print object tree")
5999 parser.add_argument("--outfile", type=Path, help="Output file")
6000
6001 args = parser.parse_args()
6002
6003 objectset = SHACLObjectSet()
6004 with args.infile.open("r") as f:
6005 d = JSONLDDeserializer()
6006 d.read(f, objectset)
6007
6008 if args.print:
6009 print_tree(objectset.objects)
6010
6011 if args.outfile:
6012 with args.outfile.open("wb") as f:
6013 s = JSONLDSerializer()
6014 s.write(objectset, f)
6015
6016 return 0
6017
6018
6019if __name__ == "__main__":
6020 sys.exit(main())