spdx_python_model.bindings.v3_0_1.model

Generated stub for the generated Python bindings.

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

Check if an object is an instance of a type or one of types. Raise a TypeError if not.

class Property(abc.ABC, typing.Generic[~T_PropV]):
 62class Property(ABC, Generic[T_PropV]):
 63    """
 64    A generic SHACL object property. The different types will derive from this
 65    class
 66    """
 67
 68    VALID_TYPES: ClassVar[Union[Type[Any], Tuple[Type[Any], ...]]] = ()
 69
 70    __slots__ = ("pattern",)
 71
 72    def __init__(self, *, pattern: Optional[str] = None) -> None:
 73        self.pattern = pattern
 74
 75    def init(self) -> Optional[T_PropV]:
 76        return None
 77
 78    def validate(self, value: Any) -> None:
 79        check_type(value, self.VALID_TYPES)
 80        if self.pattern is not None and not re.search(
 81            self.pattern, self.to_string(value)
 82        ):
 83            raise ValueError(
 84                f"Value is not correctly formatted. Got '{self.to_string(value)}'"
 85            )
 86
 87    def set(self, value: Any) -> T_PropV:
 88        return cast(T_PropV, value)
 89
 90    def check_min_count(self, value: T_PropV, min_count: int) -> bool:
 91        return min_count == 1
 92
 93    def check_max_count(self, value: T_PropV, max_count: int) -> bool:
 94        return max_count == 1
 95
 96    def elide(self, value: T_PropV) -> bool:
 97        return value is None
 98
 99    def walk(
100        self,
101        value: T_PropV,
102        callback: Callable[[Any, List[str]], bool],
103        path: List[str],
104    ) -> None:
105        callback(value, path)
106
107    def iter_objects(
108        self, value: Optional[T_PropV], recursive: bool, visited: Set["SHACLObject"]
109    ) -> Iterable["SHACLObject"]:
110        return []
111
112    def link_prop(
113        self,
114        value: Optional[T_PropV],
115        objectset: "SHACLObjectSet",
116        missing: Optional[Set[str]],
117        visited: Set["SHACLObject"],
118    ) -> Optional[T_PropV]:
119        return value
120
121    def to_string(self, value: T_PropV) -> str:
122        return str(value)
123
124    @abstractmethod
125    def encode(self, encoder: "Encoder", value: T_PropV, state: "EncodeState") -> None:
126        raise NotImplementedError("Subclasses must implement encode method")
127
128    @abstractmethod
129    def decode(self, decoder: "Decoder", state: "DecodeState") -> Optional[T_PropV]:
130        raise NotImplementedError("Subclasses must implement decode method")

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = ()
pattern: str | None
def init(self) -> ~T_PropV | None:
75    def init(self) -> Optional[T_PropV]:
76        return None
def validate(self, value: Any) -> None:
78    def validate(self, value: Any) -> None:
79        check_type(value, self.VALID_TYPES)
80        if self.pattern is not None and not re.search(
81            self.pattern, self.to_string(value)
82        ):
83            raise ValueError(
84                f"Value is not correctly formatted. Got '{self.to_string(value)}'"
85            )
def set(self, value: Any) -> ~T_PropV:
87    def set(self, value: Any) -> T_PropV:
88        return cast(T_PropV, value)
def check_min_count(self, value: ~T_PropV, min_count: int) -> bool:
90    def check_min_count(self, value: T_PropV, min_count: int) -> bool:
91        return min_count == 1
def check_max_count(self, value: ~T_PropV, max_count: int) -> bool:
93    def check_max_count(self, value: T_PropV, max_count: int) -> bool:
94        return max_count == 1
def elide(self, value: ~T_PropV) -> bool:
96    def elide(self, value: T_PropV) -> bool:
97        return value is None
def walk( self, value: ~T_PropV, callback: Callable[[Any, List[str]], bool], path: List[str]) -> None:
 99    def walk(
100        self,
101        value: T_PropV,
102        callback: Callable[[Any, List[str]], bool],
103        path: List[str],
104    ) -> None:
105        callback(value, path)
def iter_objects( self, value: ~T_PropV | None, recursive: bool, visited: Set[SHACLObject]) -> Iterable[SHACLObject]:
107    def iter_objects(
108        self, value: Optional[T_PropV], recursive: bool, visited: Set["SHACLObject"]
109    ) -> Iterable["SHACLObject"]:
110        return []
def to_string(self, value: ~T_PropV) -> str:
121    def to_string(self, value: T_PropV) -> str:
122        return str(value)
@abstractmethod
def encode( self, encoder: Encoder, value: ~T_PropV, state: EncodeState) -> None:
124    @abstractmethod
125    def encode(self, encoder: "Encoder", value: T_PropV, state: "EncodeState") -> None:
126        raise NotImplementedError("Subclasses must implement encode method")
@abstractmethod
def decode( self, decoder: Decoder, state: DecodeState) -> ~T_PropV | None:
128    @abstractmethod
129    def decode(self, decoder: "Decoder", state: "DecodeState") -> Optional[T_PropV]:
130        raise NotImplementedError("Subclasses must implement decode method")
133class StringProp(Property[str]):
134    """
135    A scalar string property for an SHACL object
136    """
137
138    VALID_TYPES = str
139
140    def set(self, value: Any) -> str:
141        return str(value)
142
143    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
144        encoder.write_string(value)
145
146    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[str]:
147        return decoder.read_string()

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = <class 'str'>
def set(self, value: Any) -> str:
140    def set(self, value: Any) -> str:
141        return str(value)
def encode( self, encoder: Encoder, value: str, state: EncodeState) -> None:
143    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
144        encoder.write_string(value)
def decode( self, decoder: Decoder, state: DecodeState) -> str | None:
146    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[str]:
147        return decoder.read_string()
150class AnyURIProp(StringProp):
151    """A string property whose value is encoded as an IRI rather than a plain string."""
152
153    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
154        encoder.write_iri(value)
155
156    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[str]:
157        return decoder.read_iri()

Helper class that provides a standard way to create an ABC using inheritance.

def encode( self, encoder: Encoder, value: str, state: EncodeState) -> None:
153    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
154        encoder.write_iri(value)
def decode( self, decoder: Decoder, state: DecodeState) -> str | None:
156    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[str]:
157        return decoder.read_iri()
160class DateTimeProp(Property[datetime]):
161    """
162    A Date/Time Object with optional timezone
163    """
164
165    VALID_TYPES = datetime
166    UTC_FORMAT_STR = "%Y-%m-%dT%H:%M:%SZ"
167    REGEX = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})?$"
168
169    __slots__ = ()
170
171    def set(self, value: datetime) -> datetime:
172        return self._normalize(value)
173
174    def encode(self, encoder: Encoder, value: datetime, state: EncodeState) -> None:
175        encoder.write_datetime(self.to_string(value))
176
177    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[datetime]:
178        s = decoder.read_datetime()
179        if s is None:
180            return None
181        if isinstance(s, datetime):
182            return self._normalize(s)
183        v = self.from_string(s)
184        return self._normalize(v)
185
186    def _normalize(self, value: datetime) -> datetime:
187        if value.utcoffset() is None:
188            value = value.astimezone()
189
190        # Remove seconds from timezone offset
191        offset = value.utcoffset()
192        if offset is not None:
193            seconds = offset % timedelta(
194                minutes=-1 if offset.total_seconds() < 0 else 1
195            )
196            if seconds:
197                offset = offset - seconds
198                value = value.replace(tzinfo=timezone(offset))
199
200        # Convert 00:00 timezone offset to UTC
201        offset = value.utcoffset()
202        if offset is not None and offset.seconds == 0:
203            value = value.astimezone(timezone.utc)
204
205        value = value.replace(microsecond=0)
206        return value
207
208    def to_string(self, value: datetime) -> str:
209        value = self._normalize(value)
210        if value.tzinfo == timezone.utc:
211            return value.strftime(self.UTC_FORMAT_STR)
212        return value.isoformat()
213
214    def from_string(self, value: str) -> datetime:
215        if not re.match(self.REGEX, value):
216            raise ValueError(f"'{value}' is not a correctly formatted datetime")
217        if "Z" in value:
218            d = datetime(
219                *(time.strptime(value, self.UTC_FORMAT_STR)[0:6]),
220                tzinfo=timezone.utc,
221            )
222        else:
223            d = datetime.fromisoformat(value)
224
225        return self._normalize(d)

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = <class 'datetime.datetime'>
UTC_FORMAT_STR: ClassVar[str] = '%Y-%m-%dT%H:%M:%SZ'
REGEX: ClassVar[str] = '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[+-]\\d{2}:\\d{2})?$'
def set(self, value: datetime.datetime) -> datetime.datetime:
171    def set(self, value: datetime) -> datetime:
172        return self._normalize(value)
def encode( self, encoder: Encoder, value: datetime.datetime, state: EncodeState) -> None:
174    def encode(self, encoder: Encoder, value: datetime, state: EncodeState) -> None:
175        encoder.write_datetime(self.to_string(value))
def decode( self, decoder: Decoder, state: DecodeState) -> datetime.datetime | None:
177    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[datetime]:
178        s = decoder.read_datetime()
179        if s is None:
180            return None
181        if isinstance(s, datetime):
182            return self._normalize(s)
183        v = self.from_string(s)
184        return self._normalize(v)
def to_string(self, value: datetime.datetime) -> str:
208    def to_string(self, value: datetime) -> str:
209        value = self._normalize(value)
210        if value.tzinfo == timezone.utc:
211            return value.strftime(self.UTC_FORMAT_STR)
212        return value.isoformat()
def from_string(self, value: str) -> datetime.datetime:
214    def from_string(self, value: str) -> datetime:
215        if not re.match(self.REGEX, value):
216            raise ValueError(f"'{value}' is not a correctly formatted datetime")
217        if "Z" in value:
218            d = datetime(
219                *(time.strptime(value, self.UTC_FORMAT_STR)[0:6]),
220                tzinfo=timezone.utc,
221            )
222        else:
223            d = datetime.fromisoformat(value)
224
225        return self._normalize(d)
228class DateTimeStampProp(DateTimeProp):
229    """
230    A Date/Time Object with required timestamp
231    """
232
233    REGEX = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$"
234
235    __slots__ = ()

Helper class that provides a standard way to create an ABC using inheritance.

REGEX: ClassVar[str] = '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[+-]\\d{2}:\\d{2})$'
238class IntegerProp(Property[int]):
239    """A scalar integer property for a SHACL object."""
240
241    VALID_TYPES = int
242
243    __slots__ = ()
244
245    def set(self, value: Any) -> int:
246        return int(value)
247
248    def encode(self, encoder: Encoder, value: int, state: EncodeState) -> None:
249        encoder.write_integer(value)
250
251    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[int]:
252        return decoder.read_integer()

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = <class 'int'>
def set(self, value: Any) -> int:
245    def set(self, value: Any) -> int:
246        return int(value)
def encode( self, encoder: Encoder, value: int, state: EncodeState) -> None:
248    def encode(self, encoder: Encoder, value: int, state: EncodeState) -> None:
249        encoder.write_integer(value)
def decode( self, decoder: Decoder, state: DecodeState) -> int | None:
251    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[int]:
252        return decoder.read_integer()
class PositiveIntegerProp(spdx_python_model.bindings.v3_0_1.model.Property[int]):
255class PositiveIntegerProp(IntegerProp):
256    """An integer property that enforces a minimum value of 1."""
257
258    __slots__ = ()
259
260    def validate(self, value: Any) -> None:
261        super().validate(value)
262        if value < 1:
263            raise ValueError(f"Value must be >= 1. Got {value}")

Helper class that provides a standard way to create an ABC using inheritance.

def validate(self, value: Any) -> None:
260    def validate(self, value: Any) -> None:
261        super().validate(value)
262        if value < 1:
263            raise ValueError(f"Value must be >= 1. Got {value}")
class NonNegativeIntegerProp(spdx_python_model.bindings.v3_0_1.model.Property[int]):
266class NonNegativeIntegerProp(IntegerProp):
267    """An integer property that enforces a minimum value of 0."""
268
269    __slots__ = ()
270
271    def validate(self, value: Any) -> None:
272        super().validate(value)
273        if value < 0:
274            raise ValueError(f"Value must be >= 0. Got {value}")

Helper class that provides a standard way to create an ABC using inheritance.

def validate(self, value: Any) -> None:
271    def validate(self, value: Any) -> None:
272        super().validate(value)
273        if value < 0:
274            raise ValueError(f"Value must be >= 0. Got {value}")
277class BooleanProp(Property[bool]):
278    """A scalar boolean property for a SHACL object."""
279
280    VALID_TYPES = bool
281
282    __slots__ = ()
283
284    def set(self, value: Any) -> bool:
285        return bool(value)
286
287    def encode(self, encoder: Encoder, value: bool, state: EncodeState) -> None:
288        encoder.write_bool(value)
289
290    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[bool]:
291        return decoder.read_bool()

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = <class 'bool'>
def set(self, value: Any) -> bool:
284    def set(self, value: Any) -> bool:
285        return bool(value)
def encode( self, encoder: Encoder, value: bool, state: EncodeState) -> None:
287    def encode(self, encoder: Encoder, value: bool, state: EncodeState) -> None:
288        encoder.write_bool(value)
def decode( self, decoder: Decoder, state: DecodeState) -> bool | None:
290    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[bool]:
291        return decoder.read_bool()
294class FloatProp(Property[float]):
295    """A scalar floating-point property for a SHACL object."""
296
297    VALID_TYPES = (float, int)
298
299    __slots__ = ()
300
301    def set(self, value: Any) -> float:
302        return float(value)
303
304    def encode(
305        self, encoder: Encoder, value: Union[float, int], state: EncodeState
306    ) -> None:
307        encoder.write_float(value)
308
309    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[float]:
310        return decoder.read_float()

Helper class that provides a standard way to create an ABC using inheritance.

VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = (<class 'float'>, <class 'int'>)
def set(self, value: Any) -> float:
301    def set(self, value: Any) -> float:
302        return float(value)
def encode( self, encoder: Encoder, value: float | int, state: EncodeState) -> None:
304    def encode(
305        self, encoder: Encoder, value: Union[float, int], state: EncodeState
306    ) -> None:
307        encoder.write_float(value)
def decode( self, decoder: Decoder, state: DecodeState) -> float | None:
309    def decode(self, decoder: Decoder, state: DecodeState) -> Optional[float]:
310        return decoder.read_float()
313class IRIProp(Property[T_PropV]):
314    """A property that holds IRI values with an optional context for compaction and expansion."""
315
316    __slots__ = ("context",)
317
318    def __init__(
319        self,
320        context: Optional[Tuple[Tuple[str, str], ...]] = None,
321        *,
322        pattern: Optional[str] = None,
323    ) -> None:
324        if context is None:
325            context = ()
326        super().__init__(pattern=pattern)
327        self.context = context
328
329    def compact(self, value: str, dflt: Optional[str] = None) -> Optional[str]:
330        """Return the compact alias for the given IRI, or dflt if not found in context."""
331        for iri, compact in self.context:
332            if value == iri:
333                return compact
334        return dflt
335
336    def expand(self, value: str, dflt: Optional[str] = None) -> Optional[str]:
337        """Return the full IRI for the given compact alias, or dflt if not found in context."""
338        for iri, compact in self.context:
339            if value == compact:
340                return iri
341        return dflt
342
343    def iri_values(self) -> Iterator[str]:
344        """Iterate over all full IRI values defined in the context."""
345        return (iri for iri, _ in self.context)

Helper class that provides a standard way to create an ABC using inheritance.

context: Tuple[Tuple[str, str], ...]
def compact(self, value: str, dflt: str | None = None) -> str | None:
329    def compact(self, value: str, dflt: Optional[str] = None) -> Optional[str]:
330        """Return the compact alias for the given IRI, or dflt if not found in context."""
331        for iri, compact in self.context:
332            if value == iri:
333                return compact
334        return dflt

Return the compact alias for the given IRI, or dflt if not found in context.

def expand(self, value: str, dflt: str | None = None) -> str | None:
336    def expand(self, value: str, dflt: Optional[str] = None) -> Optional[str]:
337        """Return the full IRI for the given compact alias, or dflt if not found in context."""
338        for iri, compact in self.context:
339            if value == compact:
340                return iri
341        return dflt

Return the full IRI for the given compact alias, or dflt if not found in context.

def iri_values(self) -> Iterator[str]:
343    def iri_values(self) -> Iterator[str]:
344        """Iterate over all full IRI values defined in the context."""
345        return (iri for iri, _ in self.context)

Iterate over all full IRI values defined in the context.

348class ObjectProp(IRIProp[Union[str, "SHACLObject"]]):
349    """
350    A scalar SHACL object property of a SHACL object
351    """
352
353    __slots__ = ("cls", "required")
354
355    def __init__(
356        self,
357        cls: Type["SHACLObject"],
358        required: bool,
359        context: Optional[Tuple[Tuple[str, str], ...]] = None,
360    ):
361        super().__init__(context)
362        self.cls = cls
363        self.required = required
364
365    def validate(self, value: Any) -> None:
366        check_type(value, (self.cls, str))
367
368    def set(self, value: Any) -> Union[str, "SHACLObject"]:
369        if isinstance(value, SHACLObject):
370            return value
371        return str(value)
372
373    def walk(
374        self,
375        value: Optional[Union[str, "SHACLObject"]],
376        callback: Callable[[Any, List[str]], bool],
377        path: List[str],
378    ) -> None:
379        if value is None:
380            return
381
382        if not isinstance(value, str):
383            value.walk(callback, path)
384        else:
385            callback(value, path)
386
387    def iter_objects(
388        self,
389        value: Optional[Union[str, "SHACLObject"]],
390        recursive: bool,
391        visited: Set["SHACLObject"],
392    ) -> Iterable["SHACLObject"]:
393        if value is None or isinstance(value, str):
394            return
395
396        if value not in visited:
397            visited.add(value)
398            yield value
399
400            if recursive:
401                for c in value.iter_objects(recursive=True, visited=visited):
402                    yield c
403
404    def encode(
405        self, encoder: Encoder, value: Union[str, "SHACLObject"], state: EncodeState
406    ) -> None:
407        if value is None:
408            raise ValueError("Object cannot be None")
409
410        if isinstance(value, str):
411            encoder.write_iri(value, self.compact(value) or state.compact_iri(value))
412            return
413
414        return value.encode(encoder, state)
415
416    def decode(self, decoder: Decoder, state: DecodeState) -> Union[str, "SHACLObject"]:
417        if decoder.is_object():
418            return self.cls.decode(decoder, state)
419
420        iri = decoder.read_iri()
421        if iri is None:
422            raise TypeError("IRI cannot be None")
423
424        iri = self.expand(iri) or state.expand_iri(iri) or iri
425
426        if state.objectset is None:
427            return iri
428
429        obj = state.objectset.find_by_id(iri)
430        if obj is None:
431            return iri
432
433        self.validate(obj)
434        return obj
435
436    def link_prop(
437        self,
438        value: Optional[Union[str, "SHACLObject"]],
439        objectset: "SHACLObjectSet",
440        missing: Optional[Set[str]],
441        visited: Set["SHACLObject"],
442    ) -> Optional[Union[str, "SHACLObject"]]:
443        if value is None:
444            return value
445
446        if isinstance(value, str):
447            o = objectset.find_by_id(value)
448            if o is not None:
449                self.validate(o)
450                return o
451
452            if missing is not None:
453                missing.add(value)
454
455            return value
456
457        # De-duplicate IDs
458        if value._id:
459            # Since value must be a SHACLObject at this point,
460            # find_by_id will always return a SHACLObject because we pass value as default.
461            # So we can safely cast here to allow subsequent value.link_helper call to work.
462            value = cast("SHACLObject", objectset.find_by_id(value._id, value))
463            self.validate(value)
464
465        value.link_helper(objectset, missing, visited)
466        return value

Helper class that provides a standard way to create an ABC using inheritance.

ObjectProp( cls: Type[SHACLObject], required: bool, context: Tuple[Tuple[str, str], ...] | None = None)
355    def __init__(
356        self,
357        cls: Type["SHACLObject"],
358        required: bool,
359        context: Optional[Tuple[Tuple[str, str], ...]] = None,
360    ):
361        super().__init__(context)
362        self.cls = cls
363        self.required = required
cls: Type[SHACLObject]
required: bool
def validate(self, value: Any) -> None:
365    def validate(self, value: Any) -> None:
366        check_type(value, (self.cls, str))
def set( self, value: Any) -> str | SHACLObject:
368    def set(self, value: Any) -> Union[str, "SHACLObject"]:
369        if isinstance(value, SHACLObject):
370            return value
371        return str(value)
def walk( self, value: str | SHACLObject | None, callback: Callable[[Any, List[str]], bool], path: List[str]) -> None:
373    def walk(
374        self,
375        value: Optional[Union[str, "SHACLObject"]],
376        callback: Callable[[Any, List[str]], bool],
377        path: List[str],
378    ) -> None:
379        if value is None:
380            return
381
382        if not isinstance(value, str):
383            value.walk(callback, path)
384        else:
385            callback(value, path)
def iter_objects( self, value: str | SHACLObject | None, recursive: bool, visited: Set[SHACLObject]) -> Iterable[SHACLObject]:
387    def iter_objects(
388        self,
389        value: Optional[Union[str, "SHACLObject"]],
390        recursive: bool,
391        visited: Set["SHACLObject"],
392    ) -> Iterable["SHACLObject"]:
393        if value is None or isinstance(value, str):
394            return
395
396        if value not in visited:
397            visited.add(value)
398            yield value
399
400            if recursive:
401                for c in value.iter_objects(recursive=True, visited=visited):
402                    yield c
def encode( self, encoder: Encoder, value: str | SHACLObject, state: EncodeState) -> None:
404    def encode(
405        self, encoder: Encoder, value: Union[str, "SHACLObject"], state: EncodeState
406    ) -> None:
407        if value is None:
408            raise ValueError("Object cannot be None")
409
410        if isinstance(value, str):
411            encoder.write_iri(value, self.compact(value) or state.compact_iri(value))
412            return
413
414        return value.encode(encoder, state)
def decode( self, decoder: Decoder, state: DecodeState) -> str | SHACLObject:
416    def decode(self, decoder: Decoder, state: DecodeState) -> Union[str, "SHACLObject"]:
417        if decoder.is_object():
418            return self.cls.decode(decoder, state)
419
420        iri = decoder.read_iri()
421        if iri is None:
422            raise TypeError("IRI cannot be None")
423
424        iri = self.expand(iri) or state.expand_iri(iri) or iri
425
426        if state.objectset is None:
427            return iri
428
429        obj = state.objectset.find_by_id(iri)
430        if obj is None:
431            return iri
432
433        self.validate(obj)
434        return obj
class ListProxy(typing.Generic[~T_PropV]):
469class ListProxy(Generic[T_PropV]):
470    """A type-checked, property-aware list wrapper for multi-valued SHACL properties."""
471
472    __slots__ = ("_data", "_prop")
473
474    def __init__(
475        self, prop: Property[T_PropV], data: Optional[List[T_PropV]] = None
476    ) -> None:
477        if data is None:
478            self._data: List[T_PropV] = []
479        else:
480            self._data = data
481        self._prop: Property[T_PropV] = prop
482
483    def append(self, value: T_PropV) -> None:
484        self._prop.validate(value)
485        self._data.append(self._prop.set(value))
486
487    def insert(self, idx: int, value: T_PropV) -> None:
488        self._prop.validate(value)
489        self._data.insert(idx, self._prop.set(value))
490
491    def extend(self, items: Iterable[T_PropV]) -> None:
492        for i in items:
493            self.append(i)
494
495    def sort(self, *args: Any, **kwargs: Any) -> None:
496        self._data.sort(*args, **kwargs)
497
498    @overload
499    def __getitem__(self, key: int) -> T_PropV: ...
500
501    @overload
502    def __getitem__(self, key: slice) -> List[T_PropV]: ...
503
504    def __getitem__(self, key: Union[int, slice]) -> Union[T_PropV, List[T_PropV]]:
505        return self._data[key]
506
507    @overload
508    def __setitem__(self, key: int, value: T_PropV) -> None: ...
509
510    @overload
511    def __setitem__(self, key: slice, value: Iterable[T_PropV]) -> None: ...
512
513    def __setitem__(
514        self, key: Union[int, slice], value: Union[T_PropV, Iterable[T_PropV]]
515    ) -> None:
516        if isinstance(key, slice):
517            val_iter = cast(Iterable[T_PropV], value)
518            for v in val_iter:
519                self._prop.validate(v)
520            self._data[key] = [self._prop.set(v) for v in val_iter]
521        elif isinstance(key, int):
522            self._prop.validate(value)
523            self._data[key] = self._prop.set(value)
524        else:
525            raise TypeError(
526                f"ListProxy indices must be integers or slices. Got {type(key).__name__}"
527            )
528
529    def __delitem__(self, key: Union[int, slice]) -> None:
530        del self._data[key]
531
532    def __contains__(self, item: Any) -> bool:
533        return item in self._data
534
535    def __iter__(self) -> Iterator[T_PropV]:
536        return iter(self._data)
537
538    def __len__(self) -> int:
539        return len(self._data)
540
541    def __str__(self) -> str:
542        return str(self._data)
543
544    def __repr__(self) -> str:
545        return repr(self._data)
546
547    def __eq__(self, other: Any) -> bool:
548        if isinstance(other, ListProxy):
549            return self._data == other._data
550
551        return self._data == other

Abstract base class for generic types.

On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name::

class Mapping[KT, VT]:
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

On older versions of Python, however, generic classes have to explicitly inherit from Generic.

After a class has been declared to be generic, it can then be used as follows::

def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
ListProxy( prop: Property[~T_PropV], data: List[~T_PropV] | None = None)
474    def __init__(
475        self, prop: Property[T_PropV], data: Optional[List[T_PropV]] = None
476    ) -> None:
477        if data is None:
478            self._data: List[T_PropV] = []
479        else:
480            self._data = data
481        self._prop: Property[T_PropV] = prop
def append(self, value: ~T_PropV) -> None:
483    def append(self, value: T_PropV) -> None:
484        self._prop.validate(value)
485        self._data.append(self._prop.set(value))
def insert(self, idx: int, value: ~T_PropV) -> None:
487    def insert(self, idx: int, value: T_PropV) -> None:
488        self._prop.validate(value)
489        self._data.insert(idx, self._prop.set(value))
def extend(self, items: Iterable[~T_PropV]) -> None:
491    def extend(self, items: Iterable[T_PropV]) -> None:
492        for i in items:
493            self.append(i)
def sort(self, *args: Any, **kwargs: Any) -> None:
495    def sort(self, *args: Any, **kwargs: Any) -> None:
496        self._data.sort(*args, **kwargs)
554class ListProp(Property[ListProxy[T_PropV]]):
555    """
556    A list of SHACL properties
557    """
558
559    VALID_TYPES = (list, ListProxy)
560
561    __slots__ = ("prop",)
562
563    def __init__(self, prop: Property[T_PropV]) -> None:
564        super().__init__()
565        self.prop = prop
566
567    def init(self) -> ListProxy[T_PropV]:
568        return ListProxy(self.prop)
569
570    def validate(self, value: Any) -> None:
571        super().validate(value)
572
573        for i in value:
574            self.prop.validate(i)
575
576    def set(
577        self,
578        value: Union[ListProxy[T_PropV], Iterable[T_PropV]],
579    ) -> ListProxy[T_PropV]:
580        if isinstance(value, ListProxy):
581            return value
582
583        return ListProxy(self.prop, [self.prop.set(d) for d in value])
584
585    def check_min_count(self, value: ListProxy[T_PropV], min_count: int) -> bool:
586        check_type(value, ListProxy)
587        return len(value) >= min_count
588
589    def check_max_count(self, value: ListProxy[T_PropV], max_count: int) -> bool:
590        check_type(value, ListProxy)
591        return len(value) <= max_count
592
593    def elide(self, value: ListProxy[T_PropV]) -> bool:
594        check_type(value, ListProxy)
595        return len(value) == 0
596
597    def walk(
598        self,
599        value: ListProxy[T_PropV],
600        callback: Callable[[Any, List[str]], bool],
601        path: List[str],
602    ) -> None:
603        if value is None:
604            return
605        callback(value, path)
606        for idx, v in enumerate(value):
607            self.prop.walk(v, callback, path + [f"[{idx}]"])
608
609    def iter_objects(
610        self,
611        value: Optional[ListProxy[T_PropV]],
612        recursive: bool,
613        visited: Set["SHACLObject"],
614    ) -> Iterable[Any]:
615        if value is None:
616            return
617        for v in value:
618            for c in self.prop.iter_objects(v, recursive, visited):
619                yield c
620
621    def link_prop(
622        self,
623        value: Optional[ListProxy[T_PropV]],
624        objectset: "SHACLObjectSet",
625        missing: Optional[Set[str]],
626        visited: Set["SHACLObject"],
627    ) -> ListProxy[T_PropV]:
628        if value is None:
629            return ListProxy(self.prop)
630
631        data: List[T_PropV] = [
632            cast(T_PropV, self.prop.link_prop(v, objectset, missing, visited))
633            for v in value
634        ]
635
636        return ListProxy(self.prop, data=data)
637
638    def encode(
639        self, encoder: Encoder, value: ListProxy[T_PropV], state: EncodeState
640    ) -> None:
641        check_type(value, ListProxy)
642
643        with encoder.write_list() as list_s:
644            for v in value:
645                with list_s.write_list_item() as item_s:
646                    self.prop.encode(item_s, v, state)
647
648    def decode(self, decoder: Decoder, state: DecodeState) -> ListProxy[T_PropV]:
649        data: List[T_PropV] = []
650        for val_d in decoder.read_list():
651            v = self.prop.decode(val_d, state)
652            if v is not None:
653                self.prop.validate(v)
654                data.append(v)
655
656        return ListProxy(self.prop, data=data)

Helper class that provides a standard way to create an ABC using inheritance.

ListProp(prop: Property[~T_PropV])
563    def __init__(self, prop: Property[T_PropV]) -> None:
564        super().__init__()
565        self.prop = prop
VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = (<class 'list'>, <class 'ListProxy'>)
prop: Property[~T_PropV]
def init(self) -> ListProxy[~T_PropV]:
567    def init(self) -> ListProxy[T_PropV]:
568        return ListProxy(self.prop)
def validate(self, value: Any) -> None:
570    def validate(self, value: Any) -> None:
571        super().validate(value)
572
573        for i in value:
574            self.prop.validate(i)
def set( self, value: ListProxy[~T_PropV] | Iterable[~T_PropV]) -> ListProxy[~T_PropV]:
576    def set(
577        self,
578        value: Union[ListProxy[T_PropV], Iterable[T_PropV]],
579    ) -> ListProxy[T_PropV]:
580        if isinstance(value, ListProxy):
581            return value
582
583        return ListProxy(self.prop, [self.prop.set(d) for d in value])
def check_min_count( self, value: ListProxy[~T_PropV], min_count: int) -> bool:
585    def check_min_count(self, value: ListProxy[T_PropV], min_count: int) -> bool:
586        check_type(value, ListProxy)
587        return len(value) >= min_count
def check_max_count( self, value: ListProxy[~T_PropV], max_count: int) -> bool:
589    def check_max_count(self, value: ListProxy[T_PropV], max_count: int) -> bool:
590        check_type(value, ListProxy)
591        return len(value) <= max_count
def elide( self, value: ListProxy[~T_PropV]) -> bool:
593    def elide(self, value: ListProxy[T_PropV]) -> bool:
594        check_type(value, ListProxy)
595        return len(value) == 0
def walk( self, value: ListProxy[~T_PropV], callback: Callable[[Any, List[str]], bool], path: List[str]) -> None:
597    def walk(
598        self,
599        value: ListProxy[T_PropV],
600        callback: Callable[[Any, List[str]], bool],
601        path: List[str],
602    ) -> None:
603        if value is None:
604            return
605        callback(value, path)
606        for idx, v in enumerate(value):
607            self.prop.walk(v, callback, path + [f"[{idx}]"])
def iter_objects( self, value: ListProxy[~T_PropV] | None, recursive: bool, visited: Set[SHACLObject]) -> Iterable[Any]:
609    def iter_objects(
610        self,
611        value: Optional[ListProxy[T_PropV]],
612        recursive: bool,
613        visited: Set["SHACLObject"],
614    ) -> Iterable[Any]:
615        if value is None:
616            return
617        for v in value:
618            for c in self.prop.iter_objects(v, recursive, visited):
619                yield c
def encode( self, encoder: Encoder, value: ListProxy[~T_PropV], state: EncodeState) -> None:
638    def encode(
639        self, encoder: Encoder, value: ListProxy[T_PropV], state: EncodeState
640    ) -> None:
641        check_type(value, ListProxy)
642
643        with encoder.write_list() as list_s:
644            for v in value:
645                with list_s.write_list_item() as item_s:
646                    self.prop.encode(item_s, v, state)
def decode( self, decoder: Decoder, state: DecodeState) -> ListProxy[~T_PropV]:
648    def decode(self, decoder: Decoder, state: DecodeState) -> ListProxy[T_PropV]:
649        data: List[T_PropV] = []
650        for val_d in decoder.read_list():
651            v = self.prop.decode(val_d, state)
652            if v is not None:
653                self.prop.validate(v)
654                data.append(v)
655
656        return ListProxy(self.prop, data=data)
Inherited Members
Property
pattern
to_string
659class EnumProp(IRIProp[str]):
660    """An IRI property restricted to a fixed set of named individual values."""
661
662    VALID_TYPES = str
663
664    __slots__ = ()
665
666    def __init__(
667        self,
668        values: Optional[Tuple[Tuple[str, str], ...]] = None,
669        *,
670        pattern: Optional[str] = None,
671    ) -> None:
672        super().__init__(values, pattern=pattern)
673
674    def validate(self, value: Any) -> None:
675        super().validate(value)
676
677        if value not in self.iri_values():
678            raise ValueError(
679                f"'{value}' is not a valid value. Choose one of {' '.join(self.iri_values())}"
680            )
681
682    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
683        encoder.write_enum(value, self, self.compact(value))
684
685    def decode(self, decoder: Decoder, state: DecodeState) -> str:
686        v = decoder.read_enum(self)
687        if v is None:
688            raise TypeError("Enum IRI cannot be None")
689        return self.expand(v) or v

Helper class that provides a standard way to create an ABC using inheritance.

EnumProp( values: Tuple[Tuple[str, str], ...] | None = None, *, pattern: str | None = None)
666    def __init__(
667        self,
668        values: Optional[Tuple[Tuple[str, str], ...]] = None,
669        *,
670        pattern: Optional[str] = None,
671    ) -> None:
672        super().__init__(values, pattern=pattern)
VALID_TYPES: ClassVar[Type[Any] | Tuple[Type[Any], ...]] = <class 'str'>
def validate(self, value: Any) -> None:
674    def validate(self, value: Any) -> None:
675        super().validate(value)
676
677        if value not in self.iri_values():
678            raise ValueError(
679                f"'{value}' is not a valid value. Choose one of {' '.join(self.iri_values())}"
680            )
def encode( self, encoder: Encoder, value: str, state: EncodeState) -> None:
682    def encode(self, encoder: Encoder, value: str, state: EncodeState) -> None:
683        encoder.write_enum(value, self, self.compact(value))
def decode( self, decoder: Decoder, state: DecodeState) -> str:
685    def decode(self, decoder: Decoder, state: DecodeState) -> str:
686        v = decoder.read_enum(self)
687        if v is None:
688            raise TypeError("Enum IRI cannot be None")
689        return self.expand(v) or v
class NodeKind(enum.Enum):
692class NodeKind(Enum):
693    """The allowed identifier kind for a SHACL node (blank node, IRI, or either)."""
694
695    BlankNode = 1
696    IRI = 2
697    BlankNodeOrIRI = 3

The allowed identifier kind for a SHACL node (blank node, IRI, or either).

BlankNode = <NodeKind.BlankNode: 1>
IRI = <NodeKind.IRI: 2>
BlankNodeOrIRI = <NodeKind.BlankNodeOrIRI: 3>
def is_IRI(s: Any) -> bool:
700def is_IRI(s: Any) -> bool:
701    if not isinstance(s, str):
702        return False
703    if s.startswith("_:"):
704        return False
705    if ":" not in s:
706        return False
707    return True
def is_blank_node(s: Any) -> bool:
710def is_blank_node(s: Any) -> bool:
711    if not isinstance(s, str):
712        return False
713    if not s.startswith("_:"):
714        return False
715    return True
@dataclass(**_DC_KWARGS)
class ClassProp:
729@dataclass(**_DC_KWARGS)
730class ClassProp:
731    """Descriptor for a single property on a SHACLObject class, holding its IRI, Python name, and constraints."""
732
733    pyname: str
734    reg: Optional[Callable[..., Any]]
735    iri: str
736    min_count: Optional[int] = None
737    max_count: Optional[int] = None
738    compact: Optional[str] = None
739    deprecated: bool = False
740    # For efficiency reasons this should be of type Property (only) but
741    # initialized to None
742    prop: Property = None  # type: ignore

Descriptor for a single property on a SHACLObject class, holding its IRI, Python name, and constraints.

ClassProp( pyname: str, reg: Callable[..., Any] | None, iri: str, min_count: int | None = Ellipsis, max_count: int | None = Ellipsis, compact: str | None = Ellipsis, deprecated: bool = Ellipsis)
pyname: str
reg: Callable[..., Any] | None
iri: str
min_count: int | None
max_count: int | None
compact: str | None
deprecated: bool
prop: Property
class SHACLObjectMeta(builtins.type):
745class SHACLObjectMeta(type):
746    """Metaclass for SHACLObject that processes PROPERTIES, slots, and named individuals at class creation time."""
747
748    def __new__(cls, name, bases, attrs):
749        def check_base_prop(name: str) -> bool:
750            return any(hasattr(b, name) or name in b._EXTRA_SLOTS for b in bases)
751
752        is_base = name == "SHACLObject"
753
754        attrs.setdefault("IS_ABSTRACT", False)
755        attrs.setdefault("IS_DEPRECATED", False)
756        attrs.setdefault("NAMED_INDIVIDUALS", {})
757        attrs.setdefault("NODE_KIND", NodeKind.BlankNodeOrIRI)
758        attrs.setdefault("_EXTRA_SLOTS", set())
759        attrs["_EXTRA_SLOTS"] = set(attrs["_EXTRA_SLOTS"])
760
761        py_properties = {}
762        iri_properties = {}
763        compact_properties = {}
764        props: List[ClassProp] = attrs.get("PROPERTIES", [])
765        for p in props:
766            if not is_base:
767                for b in bases:
768                    if p.pyname in b._OBJ_PY_PROPS or p.pyname in b._EXTRA_SLOTS:
769                        raise KeyError(
770                            f"'{p.pyname}' is already defined for '{b.__name__}'"
771                        )
772                    if p.iri in b._OBJ_IRI_PROPS:
773                        raise KeyError(
774                            f"'{p.iri}' is already defined for '{b.__name__}'"
775                        )
776                    if p.compact and p.compact in b._OBJ_COMPACT_PROPS:
777                        raise KeyError(
778                            f"'{p.compact}' is already defined for '{b.__name__}'"
779                        )
780
781            if p.pyname in py_properties:
782                raise KeyError(f"'{p.pyname}' is already defined for '{name}'")
783
784            if p.iri in iri_properties:
785                raise KeyError(f"'{p.iri}' is already defined for '{name}'")
786
787            if p.compact and p.compact in compact_properties:
788                raise KeyError(f"'{p.compact}' is already defined for '{name}'")
789
790            while (
791                p.pyname in attrs
792                or p.pyname in attrs["_EXTRA_SLOTS"]
793                or check_base_prop(p.pyname)
794            ):
795                p.pyname = p.pyname + "_"
796
797            if not callable(p.reg):
798                raise ValueError(
799                    f"Registration of {name}.{p.pyname} must be a callable to allow deferred class typing. Try: `lambda: ...`"
800                )
801
802            py_properties[p.pyname] = p
803            iri_properties[p.iri] = p
804
805            if p.compact:
806                p.compact = p.compact
807                compact_properties[p.compact] = p
808
809        if _USE_SLOTS:
810            # Assign slots. Note that __slots__ automatically inherits from the
811            # parent, so there is no need to merge in from the parent
812            attrs["__slots__"] = tuple(
813                sorted(
814                    set(py_properties.keys())
815                    | attrs["_EXTRA_SLOTS"]
816                    | set(attrs.get("__slots__", ()))
817                )
818            )
819
820        # Merge in the parent slots so that __setattr__ works properly
821        for b in bases:
822            attrs["_EXTRA_SLOTS"] |= b._EXTRA_SLOTS
823
824        if "PROPERTIES" in attrs:
825            del attrs["PROPERTIES"]
826
827        attrs["_OBJ_PY_PROPS"] = py_properties
828        attrs["_OBJ_IRI_PROPS"] = iri_properties
829        attrs["_OBJ_COMPACT_PROPS"] = compact_properties
830        if not is_base:
831            for b in bases:
832                for k, v in b._OBJ_PY_PROPS.items():
833                    attrs["_OBJ_PY_PROPS"][k] = v
834
835                for k, v in b._OBJ_IRI_PROPS.items():
836                    attrs["_OBJ_IRI_PROPS"][k] = v
837
838                for k, v in b._OBJ_COMPACT_PROPS.items():
839                    attrs["_OBJ_COMPACT_PROPS"][k] = v
840
841        attrs["_IRI"] = {p.pyname: p.iri for p in attrs["_OBJ_PY_PROPS"].values()}
842
843        auto_ni = True
844        if "AUTO_NAMED_INDIVIDUALS" in attrs:
845            auto_ni = attrs["AUTO_NAMED_INDIVIDUALS"]
846            del attrs["AUTO_NAMED_INDIVIDUALS"]
847
848        for k, v in attrs["NAMED_INDIVIDUALS"].items():
849            if auto_ni:
850                if (
851                    k in attrs
852                    or k in attrs["_EXTRA_SLOTS"]
853                    or check_base_prop(k)
854                    or k in py_properties
855                ):
856                    raise KeyError(
857                        f"Named Individual with name '{k}' conflicts with existing property"
858                    )
859                attrs[k] = v
860
861            NAMED_INDIVIDUALS.add(v)
862
863        attrs["_NEEDS_REG"] = True
864
865        attrs["_TYPE"] = attrs.pop("TYPE", None)
866
867        attrs["_COMPACT_TYPE"] = attrs.pop("COMPACT_TYPE", None)
868
869        return super().__new__(cls, name, bases, attrs)
870
871    @staticmethod
872    def _add_class(key: str, c: Type[SHACLObject]) -> None:
873        if key in SHACLObject.CLASSES:
874            raise KeyError(
875                f"{key} already registered to {SHACLObject.CLASSES[key].__name__}"
876            )
877        SHACLObject.CLASSES[key] = c

Metaclass for SHACLObject that processes PROPERTIES, slots, and named individuals at class creation time.

register_lock = <unlocked _thread.lock object>
NAMED_INDIVIDUALS: Set[str] = {'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/copiedTo', 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/high', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vcs', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/purchaseOrder', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDataFile', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseHistory', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAddedFile', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/dependsOn', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/configures', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/serializedInArtifact', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timestamp', 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low', 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/megajoule', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/binaryArtifact', 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/act', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/packageUrl', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/exportControlAssessment', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/support', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/exploitCreatedBy', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/packagedBy', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive', 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasInput', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalDependency', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/limitedSupport', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasExample', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/availableFrom', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/issueTracker', 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/clear', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altDownloadLocation', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalComponent', 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/componentNotPresent', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/text', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedBy', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildSystem', 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/low', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/reportedBy', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/query', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/socialMedia', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/build', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/sourceArtifact', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/complete', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasStaticLink', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/staticAnalysisReport', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/publishedBy', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildMeta', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cve', 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/file', 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/medium', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/privacyAssessment', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasPrerequisite', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTestCase', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/certificationReport', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/foundBy', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/runtimeAnalysisReport', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noSupport', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeclaredLicense', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/audio', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/clickthrough', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/categorical', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOutput', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/incomplete', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/riskAssessment', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/design', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/test', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/affects', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/descendantOf', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDistributionArtifact', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/chat', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDependencyManifest', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/noAssertion', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/coordinatedBy', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasProvidedDependency', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/other', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/syntactic', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver', 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/other', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe22', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityThreatModel', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/email', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/runtime', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssociatedVulnerability', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/underInvestigationFor', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timeseries', 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/bower', 'https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedIn', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/structured', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasRequirement', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/ai', 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/green', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasConcludedLicense', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/registration', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mailingList', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/graph', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasSpecification', 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/swhid', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/generates', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/source', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data', 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/other', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/securityOther', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/dynamicAnalysisReport', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/support', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/doesNotAffect', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256', 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes', 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/gitoid', 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/directory', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/funding', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/analyzed', 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/metrics', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/other', 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/amber', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/runtime', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseNotes', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/nuget', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/video', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPenTestReport', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/componentAnalysisReport', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe23', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/ancestorOf', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/development', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/deployed', 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/red', 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/other', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/gitoid', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/delegatedTo', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/trainedOn', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/scrapingScript', 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/documentation', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/qualityAssessmentReport', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssessmentFor', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/directDownload', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/testedOn', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/design', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/other', 'https://spdx.org/rdf/3.0.1/terms/Core/NoneElement', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/amendedBy', 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/trackStar', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDocumentation', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdvisory', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/describes', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/usesTool', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/expandsTo', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swhid', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/license', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/noAssertion', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/endOfSupport', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/cwe', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/other', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core', 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/kilowattHour', 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/other', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeletedFile', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasEvidence', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasVariant', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/invokedBy', 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noAssertion', 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotPresent', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasMetadata', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/patchedBy', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/urlScheme', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/secureSoftwareAttestation', 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/attend', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTest', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/modifiedBy', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mavenCentral', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/build', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/sensor', 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/kev', 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/eolNotice', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swid', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityOther', 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/contains', 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/deployed', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/numeric', 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512', 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/image', 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/productMetadata', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityDisclosureReport', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPolicy', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altWebPage', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityFix', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/npm', 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/build', 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasHost', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test', 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/development', 'https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/republishedBy', 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/track', 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement', 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/serious', 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDynamicLink', 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary', 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath', 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/review', 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdversaryModel'}
@functools.total_ordering
class SHACLObject:
 885@functools.total_ordering
 886class SHACLObject(metaclass=SHACLObjectMeta):
 887    """Base class for all SHACL-defined objects, providing property access, encoding, and decoding."""
 888
 889    CLASSES: ClassVar[Dict[str, Type[SHACLObject]]] = {}
 890
 891    # Class properties that can be set in derived classes:
 892
 893    # A dictionary of Named Individuals. The key is the python name of the
 894    # individual and the value is the IRI of the individual (not inherited)
 895    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
 896
 897    # If True, class member variables will be automatically created for the class
 898    # from the NAMED_INDIVIDUALS dictionary
 899    # NOTE: This variable is not present in the class
 900    AUTO_NAMED_INDIVIDUALS: ClassVar[bool] = True
 901
 902    # The type of ID the object is allowed to have (inherited from parent)
 903    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
 904
 905    # An alternate IRI for the ID property, besides "@id" (inherited from
 906    # parent)
 907    ID_ALIAS: ClassVar[Optional[str]] = None
 908
 909    # If True, this class is abstract and cannot be implemented (not inherited
 910    # from parent)
 911    IS_ABSTRACT: ClassVar[bool] = True
 912
 913    # If True, this class is deprecated and will raise a warning when created
 914    # (not inherited from parent)
 915    IS_DEPRECATED: ClassVar[bool] = False
 916
 917    # The fully qualified Type IRI for the object. Required
 918    # NOTE: This variable is not present in the class. Use get_type() instead
 919    TYPE: ClassVar[str] = ""
 920
 921    # The compacted Type IRI of the object. Must match how the TYPE property
 922    # would be compacted by the context. Not inherited from parent
 923    # NOTE: This variable is not present in the class. Use get_compact_type()
 924    # instead
 925    COMPACT_TYPE: ClassVar[Optional[str]] = None
 926
 927    # A list of properties for this object. Each entry must be a ClassProp
 928    # object. Properties are automatically inherited from parent classes and do
 929    # not need to be re-listed here.
 930    # NOTE: The variable is not present in the class
 931    PROPERTIES: ClassVar[List[ClassProp]] = [
 932        ClassProp("_id", lambda: StringProp(), "@id"),
 933    ]
 934
 935    # Internal variables
 936    _EXTRA_SLOTS: ClassVar[Union[Set[str], Tuple[str, ...]]] = (
 937        "_extensible",
 938        "_metadata",
 939        "_birth_index",
 940    )
 941    _OBJ_PY_PROPS: ClassVar[Dict[str, ClassProp]] = {}
 942    _OBJ_IRI_PROPS: ClassVar[Dict[str, ClassProp]] = {}
 943    _OBJ_COMPACT_PROPS: ClassVar[Dict[str, ClassProp]] = {}
 944    _NEEDS_REG: ClassVar[bool] = True
 945    _next_birth_index: ClassVar[int] = 0
 946    _TYPE: ClassVar[str]
 947    _COMPACT_TYPE: ClassVar[Optional[str]]
 948    _extensible: Dict[str, Any]
 949
 950    # Instance variables
 951    _id: Optional[str]
 952    _metadata: Dict[str, Any]
 953
 954    def __init_subclass__(cls, **kwargs):
 955        def add_class(key: str, c: Type[SHACLObject]) -> None:
 956            if key in SHACLObject.CLASSES:
 957                raise KeyError(
 958                    f"{key} already registered to {SHACLObject.CLASSES[key].__name__}"
 959                )
 960            SHACLObject.CLASSES[key] = c
 961
 962        super().__init_subclass__(**kwargs)
 963        if cls._TYPE:
 964            add_class(cls._TYPE, cls)
 965
 966        if cls._COMPACT_TYPE:
 967            add_class(cls._COMPACT_TYPE, cls)
 968
 969    def __init__(self, **kwargs: Any) -> None:
 970        if self._is_abstract():
 971            raise NotImplementedError(
 972                f"{self.__class__.__name__} is abstract and cannot be implemented"
 973            )
 974
 975        if self.__class__.IS_DEPRECATED:
 976            warnings.warn(
 977                f"{self.__class__.__name__} is deprecated", DeprecationWarning
 978            )
 979
 980        with register_lock:
 981            cls = self.__class__
 982            if cls._NEEDS_REG:
 983                for p in cls._OBJ_PY_PROPS.values():
 984                    # Note that since classes share their ClassProp objects
 985                    # with their parents, the property might have already been
 986                    # initialized.
 987                    if p.prop is None and p.reg is not None:
 988                        reg_callable = p.reg
 989                        try:
 990                            p.prop = reg_callable()
 991                            p.reg = None  # type: ignore[assignment]
 992                        except Exception as e:
 993                            raise ValueError(
 994                                f"Registration of {cls.__name__}.{p.pyname} failed: {e}"
 995                            ) from e
 996                cls._NEEDS_REG = False
 997
 998        self._metadata = {}
 999        self._birth_index = SHACLObject._next_birth_index
1000        SHACLObject._next_birth_index += 1
1001
1002        for p in self._OBJ_PY_PROPS.values():
1003            object.__setattr__(self, p.pyname, p.prop.init())
1004
1005        for k, v in kwargs.items():
1006            setattr(self, k, v)
1007
1008    def get_id(self) -> Optional[str]:
1009        """Return the IRI or blank node ID of this object, or None if not set."""
1010        return self._id
1011
1012    def set_id(self, value: Optional[str]) -> None:
1013        """Set the IRI or blank node ID of this object,
1014        or clear it if value is None."""
1015        if value is None:
1016            del self._id
1017        else:
1018            self._id = value
1019
1020    def get_type(self) -> str:
1021        """Return the fully qualified IRI type of this object."""
1022        return self._TYPE
1023
1024    def get_compact_type(self) -> Optional[str]:
1025        """Return the compacted type IRI of this object, or None if not defined."""
1026        return self._COMPACT_TYPE
1027
1028    def _is_abstract(self) -> bool:
1029        return self.__class__.IS_ABSTRACT
1030
1031    def __set(self, p: ClassProp, value: Any) -> None:
1032        if p.iri == "@id":
1033            if self.NODE_KIND == NodeKind.BlankNode:
1034                if not is_blank_node(value):
1035                    raise ValueError(
1036                        f"{self.__class__.__name__} ({id(self)}) can only have local reference. Property '{p.iri}' cannot be set to {value!r} and must start with '_:'"
1037                    )
1038            elif self.NODE_KIND == NodeKind.IRI:
1039                if not is_IRI(value):
1040                    raise ValueError(
1041                        f"{self.__class__.__name__} ({id(self)}) can only have an IRI value. Property '{p.iri}' cannot be set to {value!r}"
1042                    )
1043            else:
1044                if not is_blank_node(value) and not is_IRI(value):
1045                    raise ValueError(
1046                        f"{self.__class__.__name__} ({id(self)}) Has invalid Property '{p.iri}' {value!r}. Must be a blank node or IRI"
1047                    )
1048
1049        p.prop.validate(value)
1050        if p.deprecated:
1051            warnings.warn(
1052                f"{self.__class__.__name__}.{p.pyname} is deprecated",
1053                DeprecationWarning,
1054            )
1055        object.__setattr__(self, p.pyname, p.prop.set(value))
1056
1057    def __del(self, p: ClassProp) -> None:
1058        object.__setattr__(self, p.pyname, p.prop.init())
1059
1060    def __get_attr(self, name: str) -> ClassProp:
1061        if name == self.ID_ALIAS:
1062            name = "_id"
1063
1064        try:
1065            return self._OBJ_PY_PROPS[name]
1066        except KeyError:
1067            raise AttributeError(
1068                f"'{name}' is not a valid property of {self.__class__.__name__}"
1069            )
1070
1071    def __setattr__(self, name: str, value: Any) -> None:
1072        if name in self._EXTRA_SLOTS:
1073            object.__setattr__(self, name, value)
1074            return
1075
1076        self.__set(self.__get_attr(name), value)
1077
1078    def __getattr__(self, name: str) -> Any:
1079        if name == self.ID_ALIAS:
1080            return self._id
1081
1082        raise AttributeError(
1083            f"'{name}' is not a valid property of {self.__class__.__name__}"
1084        )
1085
1086    def __delattr__(self, name: str) -> None:
1087        if name in self._EXTRA_SLOTS:
1088            object.__delattr__(self, name)
1089            return
1090
1091        self.__del(self.__get_attr(name))
1092
1093    def __get_key(self, iri: str) -> ClassProp:
1094        return self._OBJ_IRI_PROPS[iri]
1095
1096    def __getitem__(self, iri: str) -> Any:
1097        return getattr(self, self.__get_key(iri).pyname)
1098
1099    def __setitem__(self, iri: str, value: Any) -> None:
1100        self.__set(self.__get_key(iri), value)
1101
1102    def __delitem__(self, iri: str) -> None:
1103        self.__del(self.__get_key(iri))
1104
1105    def __iter__(self) -> Iterator[str]:
1106        return iter(self._OBJ_IRI_PROPS.keys())
1107
1108    def walk(
1109        self,
1110        callback: Callable[[Any, List[str]], bool],
1111        path: Optional[List[str]] = None,
1112    ) -> None:
1113        """
1114        Walk object tree, invoking the callback for each item
1115
1116        Callback has the form:
1117
1118        def walk_callback(object: Any, path: List[str]) -> bool:
1119            ...
1120        """
1121        if path is None:
1122            path = ["."]
1123
1124        if callback(self, path):
1125            for p in self._OBJ_PY_PROPS.values():
1126                p.prop.walk(getattr(self, p.pyname), callback, path + [f".{p.iri}"])
1127
1128    def property_keys(self) -> Iterator[Tuple[Optional[str], str, Optional[str]]]:
1129        """Yield (python_name, iri, compact_iri) tuples for each property defined on this object."""
1130        for p in self._OBJ_PY_PROPS.values():
1131            if p.iri == "@id":
1132                compact = self.ID_ALIAS
1133            else:
1134                compact = p.compact
1135            yield p.pyname, p.iri, compact
1136
1137    def iter_objects(
1138        self, *, recursive: bool = False, visited: Optional[Set["SHACLObject"]] = None
1139    ) -> Iterable["SHACLObject"]:
1140        """
1141        Iterate over all objects that are a child of this one
1142        """
1143        if visited is None:
1144            visited = set()
1145
1146        for p in self._OBJ_PY_PROPS.values():
1147            for c in p.prop.iter_objects(
1148                getattr(self, p.pyname), recursive=recursive, visited=visited
1149            ):
1150                yield c
1151
1152    def encode(self, encoder: Encoder, state: EncodeState) -> None:
1153        """Encode this object to the given encoder, writing its type, ID, and properties."""
1154        idname = self.ID_ALIAS or "@id"
1155        if not self._id and self.NODE_KIND == NodeKind.IRI:
1156            raise ValueError(
1157                f"{self.__class__.__name__} ({id(self)}) must have a IRI for property '{idname}'"
1158            )
1159
1160        _id = state.get_object_id(self)
1161
1162        if state.is_written(self):
1163            encoder.write_iri(_id, state.compact_iri(_id))
1164            return
1165
1166        state.add_written(self)
1167
1168        with encoder.write_object(
1169            self.get_type(),
1170            self.get_compact_type() or state.compact_iri(self.get_type()),
1171            self.ID_ALIAS,
1172            _id,
1173            state.compact_iri(_id),
1174            bool(self._id) or state.is_refed(self),
1175        ) as obj_s:
1176            self._encode_properties(obj_s, state)
1177
1178    def _encode_properties(self, encoder: Encoder, state: EncodeState) -> None:
1179        for p in self._OBJ_PY_PROPS.values():
1180            value = getattr(self, p.pyname)
1181            if p.prop.elide(value):
1182                if p.min_count:
1183                    raise ValueError(
1184                        f"Property '{p.pyname}' in {self.__class__.__name__} ({id(self)}) is required (currently {value!r})"
1185                    )
1186                continue
1187
1188            if p.min_count is not None:
1189                if not p.prop.check_min_count(value, p.min_count):
1190                    raise ValueError(
1191                        f"Property '{p.pyname}' in {self.__class__.__name__} ({id(self)}) requires a minimum of {p.min_count} elements"
1192                    )
1193
1194            if p.max_count is not None:
1195                if not p.prop.check_max_count(value, p.max_count):
1196                    raise ValueError(
1197                        f"Property '{p.pyname}' in {self.__class__.__name__} ({id(self)}) requires a maximum of {p.max_count} elements"
1198                    )
1199
1200            if p.iri == "@id":
1201                continue
1202
1203            with encoder.write_property(
1204                p.iri, p.compact or state.compact_iri(p.iri)
1205            ) as prop_s:
1206                p.prop.encode(prop_s, value, state)
1207
1208    @classmethod
1209    def _make_object(cls: Type["SHACLObject"], typ: str) -> "SHACLObject":
1210        if typ not in cls.CLASSES:
1211            raise TypeError(f"Unknown type {typ}")
1212
1213        return cls.CLASSES[typ]()
1214
1215    @classmethod
1216    def decode(
1217        cls: Type[T_SHACLObject], decoder: Decoder, state: DecodeState
1218    ) -> "SHACLObject":
1219        typ, obj_d = decoder.read_object()
1220        if typ is None:
1221            raise TypeError("Unable to determine type for object")
1222        typ = state.objectset.expand_iri(typ) or typ
1223
1224        obj = cls._make_object(typ)
1225        _id = obj_d.read_object_id(obj.ID_ALIAS)
1226        if _id is not None:
1227            obj._id = state.expand_iri(_id) or _id
1228
1229        if obj.NODE_KIND == NodeKind.IRI and not obj._id:
1230            raise ValueError("Object is missing required IRI")
1231
1232        if obj._id:
1233            if obj._id in state.read_objs:
1234                return state.read_objs[obj._id]
1235            state.read_objs[obj._id] = obj
1236
1237        obj._decode_properties(obj_d, state)
1238
1239        if state.objectset is not None:
1240            state.objectset.add_index(obj)
1241
1242        return obj
1243
1244    def _decode_properties(self, decoder: Decoder, state: DecodeState) -> None:
1245        for key in decoder.object_keys():
1246            if not self._decode_prop(decoder, key, state):
1247                raise KeyError(f"Unknown property '{key}'")
1248
1249    def _decode_prop(self, decoder: Decoder, key: str, state: DecodeState) -> bool:
1250        if key in ("@id", self.ID_ALIAS):
1251            return True
1252
1253        expanded_key = state.expand_iri(key)
1254        if expanded_key and expanded_key in self._OBJ_IRI_PROPS:
1255            p = self._OBJ_IRI_PROPS[expanded_key]
1256        elif key in self._OBJ_IRI_PROPS:
1257            p = self._OBJ_IRI_PROPS[key]
1258        elif key in self._OBJ_COMPACT_PROPS:
1259            p = self._OBJ_COMPACT_PROPS[key]
1260        else:
1261            return False
1262
1263        with decoder.read_property(key) as prop_d:
1264            if prop_d is None:
1265                raise TypeError(f"Property decoder for key '{key}' cannot be None")
1266            v = p.prop.decode(prop_d, state)
1267            self.__set(p, v)
1268        return True
1269
1270    def link_helper(
1271        self,
1272        objectset: SHACLObjectSet,
1273        missing: Optional[Set[str]],
1274        visited: Set["SHACLObject"],
1275    ) -> None:
1276        """Resolve string IRI references in this object's properties to actual SHACLObject instances."""
1277        if self in visited:
1278            return
1279
1280        visited.add(self)
1281
1282        for p in self._OBJ_PY_PROPS.values():
1283            object.__setattr__(
1284                self,
1285                p.pyname,
1286                p.prop.link_prop(
1287                    getattr(self, p.pyname),
1288                    objectset,
1289                    missing,
1290                    visited,
1291                ),
1292            )
1293
1294    def __str__(self) -> str:
1295        parts = [
1296            f"{self.__class__.__name__}(",
1297        ]
1298        if self._id:
1299            parts.append(f"@id='{self._id}'")
1300        parts.append(")")
1301        return "".join(parts)
1302
1303    def __hash__(self) -> int:
1304        return super().__hash__()
1305
1306    def __eq__(self, other: object) -> bool:
1307        return super().__eq__(other)
1308
1309    @staticmethod
1310    def _sort_key(obj: Any) -> Tuple[str, str, str, int]:
1311        if isinstance(obj, str):
1312            return (obj, "", "", 0)
1313        return (
1314            obj._id or "",
1315            obj.get_type(),
1316            getattr(obj, "name", None) or "",
1317            obj._birth_index,
1318        )
1319
1320    def __lt__(self, other: Any) -> bool:
1321        return SHACLObject._sort_key(self) < SHACLObject._sort_key(other)

Base class for all SHACL-defined objects, providing property access, encoding, and decoding.

SHACLObject(**kwargs: Any)
 969    def __init__(self, **kwargs: Any) -> None:
 970        if self._is_abstract():
 971            raise NotImplementedError(
 972                f"{self.__class__.__name__} is abstract and cannot be implemented"
 973            )
 974
 975        if self.__class__.IS_DEPRECATED:
 976            warnings.warn(
 977                f"{self.__class__.__name__} is deprecated", DeprecationWarning
 978            )
 979
 980        with register_lock:
 981            cls = self.__class__
 982            if cls._NEEDS_REG:
 983                for p in cls._OBJ_PY_PROPS.values():
 984                    # Note that since classes share their ClassProp objects
 985                    # with their parents, the property might have already been
 986                    # initialized.
 987                    if p.prop is None and p.reg is not None:
 988                        reg_callable = p.reg
 989                        try:
 990                            p.prop = reg_callable()
 991                            p.reg = None  # type: ignore[assignment]
 992                        except Exception as e:
 993                            raise ValueError(
 994                                f"Registration of {cls.__name__}.{p.pyname} failed: {e}"
 995                            ) from e
 996                cls._NEEDS_REG = False
 997
 998        self._metadata = {}
 999        self._birth_index = SHACLObject._next_birth_index
1000        SHACLObject._next_birth_index += 1
1001
1002        for p in self._OBJ_PY_PROPS.values():
1003            object.__setattr__(self, p.pyname, p.prop.init())
1004
1005        for k, v in kwargs.items():
1006            setattr(self, k, v)
CLASSES: ClassVar[Dict[str, Type[SHACLObject]]] = {'https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumption': <class 'ai_EnergyConsumption'>, 'ai_EnergyConsumption': <class 'ai_EnergyConsumption'>, 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumptionDescription': <class 'ai_EnergyConsumptionDescription'>, 'ai_EnergyConsumptionDescription': <class 'ai_EnergyConsumptionDescription'>, 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType': <class 'ai_EnergyUnitType'>, 'ai_EnergyUnitType': <class 'ai_EnergyUnitType'>, 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType': <class 'ai_SafetyRiskAssessmentType'>, 'ai_SafetyRiskAssessmentType': <class 'ai_SafetyRiskAssessmentType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType': <class 'AnnotationType'>, 'AnnotationType': <class 'AnnotationType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/CreationInfo': <class 'CreationInfo'>, 'CreationInfo': <class 'CreationInfo'>, 'https://spdx.org/rdf/3.0.1/terms/Core/DictionaryEntry': <class 'DictionaryEntry'>, 'DictionaryEntry': <class 'DictionaryEntry'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Element': <class 'Element'>, 'Element': <class 'Element'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ElementCollection': <class 'ElementCollection'>, 'ElementCollection': <class 'ElementCollection'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifier': <class 'ExternalIdentifier'>, 'ExternalIdentifier': <class 'ExternalIdentifier'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType': <class 'ExternalIdentifierType'>, 'ExternalIdentifierType': <class 'ExternalIdentifierType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalMap': <class 'ExternalMap'>, 'ExternalMap': <class 'ExternalMap'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRef': <class 'ExternalRef'>, 'ExternalRef': <class 'ExternalRef'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType': <class 'ExternalRefType'>, 'ExternalRefType': <class 'ExternalRefType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm': <class 'HashAlgorithm'>, 'HashAlgorithm': <class 'HashAlgorithm'>, 'https://spdx.org/rdf/3.0.1/terms/Core/IndividualElement': <class 'IndividualElement'>, 'IndividualElement': <class 'IndividualElement'>, 'https://spdx.org/rdf/3.0.1/terms/Core/IntegrityMethod': <class 'IntegrityMethod'>, 'IntegrityMethod': <class 'IntegrityMethod'>, 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType': <class 'LifecycleScopeType'>, 'LifecycleScopeType': <class 'LifecycleScopeType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/NamespaceMap': <class 'NamespaceMap'>, 'NamespaceMap': <class 'NamespaceMap'>, 'https://spdx.org/rdf/3.0.1/terms/Core/PackageVerificationCode': <class 'PackageVerificationCode'>, 'PackageVerificationCode': <class 'PackageVerificationCode'>, 'https://spdx.org/rdf/3.0.1/terms/Core/PositiveIntegerRange': <class 'PositiveIntegerRange'>, 'PositiveIntegerRange': <class 'PositiveIntegerRange'>, 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType': <class 'PresenceType'>, 'PresenceType': <class 'PresenceType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType': <class 'ProfileIdentifierType'>, 'ProfileIdentifierType': <class 'ProfileIdentifierType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Relationship': <class 'Relationship'>, 'Relationship': <class 'Relationship'>, 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness': <class 'RelationshipCompleteness'>, 'RelationshipCompleteness': <class 'RelationshipCompleteness'>, 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType': <class 'RelationshipType'>, 'RelationshipType': <class 'RelationshipType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/SpdxDocument': <class 'SpdxDocument'>, 'SpdxDocument': <class 'SpdxDocument'>, 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType': <class 'SupportType'>, 'SupportType': <class 'SupportType'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Tool': <class 'Tool'>, 'Tool': <class 'Tool'>, 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType': <class 'dataset_ConfidentialityLevelType'>, 'dataset_ConfidentialityLevelType': <class 'dataset_ConfidentialityLevelType'>, 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType': <class 'dataset_DatasetAvailabilityType'>, 'dataset_DatasetAvailabilityType': <class 'dataset_DatasetAvailabilityType'>, 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType': <class 'dataset_DatasetType'>, 'dataset_DatasetType': <class 'dataset_DatasetType'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/LicenseAddition': <class 'expandedlicensing_LicenseAddition'>, 'expandedlicensing_LicenseAddition': <class 'expandedlicensing_LicenseAddition'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ListedLicenseException': <class 'expandedlicensing_ListedLicenseException'>, 'expandedlicensing_ListedLicenseException': <class 'expandedlicensing_ListedLicenseException'>, 'https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertyEntry': <class 'extension_CdxPropertyEntry'>, 'extension_CdxPropertyEntry': <class 'extension_CdxPropertyEntry'>, 'https://spdx.org/rdf/3.0.1/terms/Extension/Extension': <class 'extension_Extension'>, 'extension_Extension': <class 'extension_Extension'>, 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType': <class 'security_CvssSeverityType'>, 'security_CvssSeverityType': <class 'security_CvssSeverityType'>, 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType': <class 'security_ExploitCatalogType'>, 'security_ExploitCatalogType': <class 'security_ExploitCatalogType'>, 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType': <class 'security_SsvcDecisionType'>, 'security_SsvcDecisionType': <class 'security_SsvcDecisionType'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType': <class 'security_VexJustificationType'>, 'security_VexJustificationType': <class 'security_VexJustificationType'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VulnAssessmentRelationship': <class 'security_VulnAssessmentRelationship'>, 'security_VulnAssessmentRelationship': <class 'security_VulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/AnyLicenseInfo': <class 'simplelicensing_AnyLicenseInfo'>, 'simplelicensing_AnyLicenseInfo': <class 'simplelicensing_AnyLicenseInfo'>, 'https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/LicenseExpression': <class 'simplelicensing_LicenseExpression'>, 'simplelicensing_LicenseExpression': <class 'simplelicensing_LicenseExpression'>, 'https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/SimpleLicensingText': <class 'simplelicensing_SimpleLicensingText'>, 'simplelicensing_SimpleLicensingText': <class 'simplelicensing_SimpleLicensingText'>, 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifier': <class 'software_ContentIdentifier'>, 'software_ContentIdentifier': <class 'software_ContentIdentifier'>, 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType': <class 'software_ContentIdentifierType'>, 'software_ContentIdentifierType': <class 'software_ContentIdentifierType'>, 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType': <class 'software_FileKindType'>, 'software_FileKindType': <class 'software_FileKindType'>, 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType': <class 'software_SbomType'>, 'software_SbomType': <class 'software_SbomType'>, 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose': <class 'software_SoftwarePurpose'>, 'software_SoftwarePurpose': <class 'software_SoftwarePurpose'>, 'https://spdx.org/rdf/3.0.1/terms/Build/Build': <class 'build_Build'>, 'build_Build': <class 'build_Build'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Agent': <class 'Agent'>, 'Agent': <class 'Agent'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Annotation': <class 'Annotation'>, 'Annotation': <class 'Annotation'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Artifact': <class 'Artifact'>, 'Artifact': <class 'Artifact'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Bundle': <class 'Bundle'>, 'Bundle': <class 'Bundle'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Hash': <class 'Hash'>, 'Hash': <class 'Hash'>, 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopedRelationship': <class 'LifecycleScopedRelationship'>, 'LifecycleScopedRelationship': <class 'LifecycleScopedRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Organization': <class 'Organization'>, 'Organization': <class 'Organization'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Person': <class 'Person'>, 'Person': <class 'Person'>, 'https://spdx.org/rdf/3.0.1/terms/Core/SoftwareAgent': <class 'SoftwareAgent'>, 'SoftwareAgent': <class 'SoftwareAgent'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ConjunctiveLicenseSet': <class 'expandedlicensing_ConjunctiveLicenseSet'>, 'expandedlicensing_ConjunctiveLicenseSet': <class 'expandedlicensing_ConjunctiveLicenseSet'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/CustomLicenseAddition': <class 'expandedlicensing_CustomLicenseAddition'>, 'expandedlicensing_CustomLicenseAddition': <class 'expandedlicensing_CustomLicenseAddition'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/DisjunctiveLicenseSet': <class 'expandedlicensing_DisjunctiveLicenseSet'>, 'expandedlicensing_DisjunctiveLicenseSet': <class 'expandedlicensing_DisjunctiveLicenseSet'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ExtendableLicense': <class 'expandedlicensing_ExtendableLicense'>, 'expandedlicensing_ExtendableLicense': <class 'expandedlicensing_ExtendableLicense'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/IndividualLicensingInfo': <class 'expandedlicensing_IndividualLicensingInfo'>, 'expandedlicensing_IndividualLicensingInfo': <class 'expandedlicensing_IndividualLicensingInfo'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/License': <class 'expandedlicensing_License'>, 'expandedlicensing_License': <class 'expandedlicensing_License'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ListedLicense': <class 'expandedlicensing_ListedLicense'>, 'expandedlicensing_ListedLicense': <class 'expandedlicensing_ListedLicense'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/OrLaterOperator': <class 'expandedlicensing_OrLaterOperator'>, 'expandedlicensing_OrLaterOperator': <class 'expandedlicensing_OrLaterOperator'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/WithAdditionOperator': <class 'expandedlicensing_WithAdditionOperator'>, 'expandedlicensing_WithAdditionOperator': <class 'expandedlicensing_WithAdditionOperator'>, 'https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertiesExtension': <class 'extension_CdxPropertiesExtension'>, 'extension_CdxPropertiesExtension': <class 'extension_CdxPropertiesExtension'>, 'https://spdx.org/rdf/3.0.1/terms/Security/CvssV2VulnAssessmentRelationship': <class 'security_CvssV2VulnAssessmentRelationship'>, 'security_CvssV2VulnAssessmentRelationship': <class 'security_CvssV2VulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/CvssV3VulnAssessmentRelationship': <class 'security_CvssV3VulnAssessmentRelationship'>, 'security_CvssV3VulnAssessmentRelationship': <class 'security_CvssV3VulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/CvssV4VulnAssessmentRelationship': <class 'security_CvssV4VulnAssessmentRelationship'>, 'security_CvssV4VulnAssessmentRelationship': <class 'security_CvssV4VulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/EpssVulnAssessmentRelationship': <class 'security_EpssVulnAssessmentRelationship'>, 'security_EpssVulnAssessmentRelationship': <class 'security_EpssVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogVulnAssessmentRelationship': <class 'security_ExploitCatalogVulnAssessmentRelationship'>, 'security_ExploitCatalogVulnAssessmentRelationship': <class 'security_ExploitCatalogVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcVulnAssessmentRelationship': <class 'security_SsvcVulnAssessmentRelationship'>, 'security_SsvcVulnAssessmentRelationship': <class 'security_SsvcVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexVulnAssessmentRelationship': <class 'security_VexVulnAssessmentRelationship'>, 'security_VexVulnAssessmentRelationship': <class 'security_VexVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/Vulnerability': <class 'security_Vulnerability'>, 'security_Vulnerability': <class 'security_Vulnerability'>, 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwareArtifact': <class 'software_SoftwareArtifact'>, 'software_SoftwareArtifact': <class 'software_SoftwareArtifact'>, 'https://spdx.org/rdf/3.0.1/terms/Core/Bom': <class 'Bom'>, 'Bom': <class 'Bom'>, 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/CustomLicense': <class 'expandedlicensing_CustomLicense'>, 'expandedlicensing_CustomLicense': <class 'expandedlicensing_CustomLicense'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexAffectedVulnAssessmentRelationship': <class 'security_VexAffectedVulnAssessmentRelationship'>, 'security_VexAffectedVulnAssessmentRelationship': <class 'security_VexAffectedVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexFixedVulnAssessmentRelationship': <class 'security_VexFixedVulnAssessmentRelationship'>, 'security_VexFixedVulnAssessmentRelationship': <class 'security_VexFixedVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexNotAffectedVulnAssessmentRelationship': <class 'security_VexNotAffectedVulnAssessmentRelationship'>, 'security_VexNotAffectedVulnAssessmentRelationship': <class 'security_VexNotAffectedVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Security/VexUnderInvestigationVulnAssessmentRelationship': <class 'security_VexUnderInvestigationVulnAssessmentRelationship'>, 'security_VexUnderInvestigationVulnAssessmentRelationship': <class 'security_VexUnderInvestigationVulnAssessmentRelationship'>, 'https://spdx.org/rdf/3.0.1/terms/Software/File': <class 'software_File'>, 'software_File': <class 'software_File'>, 'https://spdx.org/rdf/3.0.1/terms/Software/Package': <class 'software_Package'>, 'software_Package': <class 'software_Package'>, 'https://spdx.org/rdf/3.0.1/terms/Software/Sbom': <class 'software_Sbom'>, 'software_Sbom': <class 'software_Sbom'>, 'https://spdx.org/rdf/3.0.1/terms/Software/Snippet': <class 'software_Snippet'>, 'software_Snippet': <class 'software_Snippet'>, 'https://spdx.org/rdf/3.0.1/terms/AI/AIPackage': <class 'ai_AIPackage'>, 'ai_AIPackage': <class 'ai_AIPackage'>, 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetPackage': <class 'dataset_DatasetPackage'>, 'dataset_DatasetPackage': <class 'dataset_DatasetPackage'>}
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
AUTO_NAMED_INDIVIDUALS: ClassVar[bool]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
ID_ALIAS: ClassVar[str | None] = None
IS_ABSTRACT: ClassVar[bool] = True
IS_DEPRECATED: ClassVar[bool] = False
TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
PROPERTIES: ClassVar[List[ClassProp]]
def get_id(self) -> str | None:
1008    def get_id(self) -> Optional[str]:
1009        """Return the IRI or blank node ID of this object, or None if not set."""
1010        return self._id

Return the IRI or blank node ID of this object, or None if not set.

def set_id(self, value: str | None) -> None:
1012    def set_id(self, value: Optional[str]) -> None:
1013        """Set the IRI or blank node ID of this object,
1014        or clear it if value is None."""
1015        if value is None:
1016            del self._id
1017        else:
1018            self._id = value

Set the IRI or blank node ID of this object, or clear it if value is None.

def get_type(self) -> str:
1020    def get_type(self) -> str:
1021        """Return the fully qualified IRI type of this object."""
1022        return self._TYPE

Return the fully qualified IRI type of this object.

def get_compact_type(self) -> str | None:
1024    def get_compact_type(self) -> Optional[str]:
1025        """Return the compacted type IRI of this object, or None if not defined."""
1026        return self._COMPACT_TYPE

Return the compacted type IRI of this object, or None if not defined.

def walk( self, callback: Callable[[Any, List[str]], bool], path: List[str] | None = None) -> None:
1108    def walk(
1109        self,
1110        callback: Callable[[Any, List[str]], bool],
1111        path: Optional[List[str]] = None,
1112    ) -> None:
1113        """
1114        Walk object tree, invoking the callback for each item
1115
1116        Callback has the form:
1117
1118        def walk_callback(object: Any, path: List[str]) -> bool:
1119            ...
1120        """
1121        if path is None:
1122            path = ["."]
1123
1124        if callback(self, path):
1125            for p in self._OBJ_PY_PROPS.values():
1126                p.prop.walk(getattr(self, p.pyname), callback, path + [f".{p.iri}"])

Walk object tree, invoking the callback for each item

Callback has the form:

def walk_callback(object: Any, path: List[str]) -> bool: ...

def property_keys(self) -> Iterator[Tuple[str | None, str, str | None]]:
1128    def property_keys(self) -> Iterator[Tuple[Optional[str], str, Optional[str]]]:
1129        """Yield (python_name, iri, compact_iri) tuples for each property defined on this object."""
1130        for p in self._OBJ_PY_PROPS.values():
1131            if p.iri == "@id":
1132                compact = self.ID_ALIAS
1133            else:
1134                compact = p.compact
1135            yield p.pyname, p.iri, compact

Yield (python_name, iri, compact_iri) tuples for each property defined on this object.

def iter_objects( self, *, recursive: bool = False, visited: Set[SHACLObject] | None = None) -> Iterable[SHACLObject]:
1137    def iter_objects(
1138        self, *, recursive: bool = False, visited: Optional[Set["SHACLObject"]] = None
1139    ) -> Iterable["SHACLObject"]:
1140        """
1141        Iterate over all objects that are a child of this one
1142        """
1143        if visited is None:
1144            visited = set()
1145
1146        for p in self._OBJ_PY_PROPS.values():
1147            for c in p.prop.iter_objects(
1148                getattr(self, p.pyname), recursive=recursive, visited=visited
1149            ):
1150                yield c

Iterate over all objects that are a child of this one

def encode( self, encoder: Encoder, state: EncodeState) -> None:
1152    def encode(self, encoder: Encoder, state: EncodeState) -> None:
1153        """Encode this object to the given encoder, writing its type, ID, and properties."""
1154        idname = self.ID_ALIAS or "@id"
1155        if not self._id and self.NODE_KIND == NodeKind.IRI:
1156            raise ValueError(
1157                f"{self.__class__.__name__} ({id(self)}) must have a IRI for property '{idname}'"
1158            )
1159
1160        _id = state.get_object_id(self)
1161
1162        if state.is_written(self):
1163            encoder.write_iri(_id, state.compact_iri(_id))
1164            return
1165
1166        state.add_written(self)
1167
1168        with encoder.write_object(
1169            self.get_type(),
1170            self.get_compact_type() or state.compact_iri(self.get_type()),
1171            self.ID_ALIAS,
1172            _id,
1173            state.compact_iri(_id),
1174            bool(self._id) or state.is_refed(self),
1175        ) as obj_s:
1176            self._encode_properties(obj_s, state)

Encode this object to the given encoder, writing its type, ID, and properties.

@classmethod
def decode( cls: Type[~T_SHACLObject], decoder: Decoder, state: DecodeState) -> SHACLObject:
1215    @classmethod
1216    def decode(
1217        cls: Type[T_SHACLObject], decoder: Decoder, state: DecodeState
1218    ) -> "SHACLObject":
1219        typ, obj_d = decoder.read_object()
1220        if typ is None:
1221            raise TypeError("Unable to determine type for object")
1222        typ = state.objectset.expand_iri(typ) or typ
1223
1224        obj = cls._make_object(typ)
1225        _id = obj_d.read_object_id(obj.ID_ALIAS)
1226        if _id is not None:
1227            obj._id = state.expand_iri(_id) or _id
1228
1229        if obj.NODE_KIND == NodeKind.IRI and not obj._id:
1230            raise ValueError("Object is missing required IRI")
1231
1232        if obj._id:
1233            if obj._id in state.read_objs:
1234                return state.read_objs[obj._id]
1235            state.read_objs[obj._id] = obj
1236
1237        obj._decode_properties(obj_d, state)
1238
1239        if state.objectset is not None:
1240            state.objectset.add_index(obj)
1241
1242        return obj
class SHACLExtensibleObject(SHACLObject):
1324class SHACLExtensibleObject(SHACLObject):
1325    """A SHACLObject that accepts and round-trips arbitrary IRI-keyed extension properties."""
1326
1327    CLOSED = False
1328
1329    def __init__(self, typ: Optional[str] = None, **kwargs: Any) -> None:
1330        self._extensible = {
1331            "type": typ if typ else self._TYPE,
1332            "compact_type": None if typ else self._COMPACT_TYPE,
1333            "data": {},
1334        }
1335
1336        super().__init__(**kwargs)
1337
1338    def get_type(self) -> str:
1339        """Return the type IRI stored in the extensible data, which may differ from the class TYPE."""
1340        return self._extensible["type"]
1341
1342    def get_compact_type(self) -> Optional[str]:
1343        """Return the compacted type IRI from the extensible data, or None if not set."""
1344        return self._extensible["compact_type"]
1345
1346    def _is_abstract(self) -> bool:
1347        # Unknown classes are assumed to not be abstract so that they can be
1348        # deserialized
1349        typ = self.get_type()
1350        if typ in SHACLObject.CLASSES:
1351            return SHACLObject.CLASSES[typ].IS_ABSTRACT
1352
1353        return False
1354
1355    @property
1356    def _ext_data(self) -> Dict[str, Any]:
1357        return self._extensible["data"]
1358
1359    @classmethod
1360    def _make_object(cls: Type["SHACLExtensibleObject"], typ: str) -> "SHACLObject":
1361        # Check for a known type, and if so, deserialize as that instead
1362        if typ in cls.CLASSES:
1363            return cls.CLASSES[typ]()
1364
1365        obj = cls(typ)
1366        return obj
1367
1368    def _decode_properties(self, decoder: Decoder, state: DecodeState) -> None:
1369        def decode_value(d: Decoder) -> Any:
1370            if not d.is_list():
1371                return d.read_value()
1372
1373            return [decode_value(val_d) for val_d in d.read_list()]
1374
1375        if self.CLOSED:
1376            super()._decode_properties(decoder, state)
1377            return
1378
1379        for key in decoder.object_keys():
1380            if self._decode_prop(decoder, key, state):
1381                continue
1382
1383            if key is None:
1384                raise KeyError("Property key cannot be None")
1385
1386            expanded_key = state.expand_iri(key) or key
1387
1388            if not is_IRI(expanded_key):
1389                raise KeyError(
1390                    f"Extensible object properties must be IRIs. Got '{key}' (expanded to '{expanded_key}')"
1391                )
1392
1393            with decoder.read_property(key) as prop_d:
1394                assert prop_d is not None
1395                self._ext_data[expanded_key] = decode_value(prop_d)
1396
1397    def _encode_properties(self, encoder: Encoder, state: EncodeState) -> None:
1398        super()._encode_properties(encoder, state)
1399        if self.CLOSED:
1400            return
1401
1402        for iri, value in self._ext_data.items():
1403            if iri in self._OBJ_IRI_PROPS:
1404                continue
1405
1406            with encoder.write_property(iri, state.compact_iri(iri)) as prop_s:
1407                if isinstance(value, list):
1408                    v = value
1409                else:
1410                    v = [value]
1411                with prop_s.write_list() as list_s:
1412                    for i in v:
1413                        with list_s.write_list_item() as item_s:
1414                            if isinstance(i, bool):
1415                                item_s.write_bool(i)
1416                            elif isinstance(i, str):
1417                                item_s.write_string(i)
1418                            elif isinstance(i, int):
1419                                item_s.write_integer(i)
1420                            elif isinstance(i, float):
1421                                item_s.write_float(i)
1422                            else:
1423                                raise TypeError(
1424                                    f"Unsupported serialized type {type(i)} with value {i!r}"
1425                                )
1426
1427    def __getitem__(self, iri: str) -> Any:
1428        try:
1429            return super().__getitem__(iri)
1430        except KeyError:
1431            if self.CLOSED:
1432                raise
1433
1434        if not is_IRI(iri):
1435            raise KeyError(f"Key '{iri}' must be an IRI")
1436        return self._ext_data[iri]
1437
1438    def __setitem__(self, iri: str, value: Any) -> None:
1439        try:
1440            super().__setitem__(iri, value)
1441            return
1442        except KeyError:
1443            if self.CLOSED:
1444                raise
1445
1446        if not is_IRI(iri):
1447            raise KeyError(f"Key '{iri}' must be an IRI")
1448        self._ext_data[iri] = value
1449
1450    def __delitem__(self, iri: str) -> None:
1451        try:
1452            super().__delitem__(iri)
1453            return
1454        except KeyError:
1455            if self.CLOSED:
1456                raise
1457
1458        if not is_IRI(iri):
1459            raise KeyError(f"Key '{iri}' must be an IRI")
1460        del self._ext_data[iri]
1461
1462    def property_keys(self) -> Iterator[Tuple[Optional[str], str, Optional[str]]]:
1463        iris: Set[str] = set()
1464        for pyname, iri, compact in super().property_keys():
1465            iris.add(iri)
1466            yield pyname, iri, compact
1467
1468        if self.CLOSED:
1469            return
1470
1471        for iri in self._ext_data.keys():
1472            if iri not in iris:
1473                yield None, iri, None

A SHACLObject that accepts and round-trips arbitrary IRI-keyed extension properties.

SHACLExtensibleObject(typ: str | None = None, **kwargs: Any)
1329    def __init__(self, typ: Optional[str] = None, **kwargs: Any) -> None:
1330        self._extensible = {
1331            "type": typ if typ else self._TYPE,
1332            "compact_type": None if typ else self._COMPACT_TYPE,
1333            "data": {},
1334        }
1335
1336        super().__init__(**kwargs)
CLOSED: ClassVar[bool] = False
def get_type(self) -> str:
1338    def get_type(self) -> str:
1339        """Return the type IRI stored in the extensible data, which may differ from the class TYPE."""
1340        return self._extensible["type"]

Return the type IRI stored in the extensible data, which may differ from the class TYPE.

def get_compact_type(self) -> str | None:
1342    def get_compact_type(self) -> Optional[str]:
1343        """Return the compacted type IRI from the extensible data, or None if not set."""
1344        return self._extensible["compact_type"]

Return the compacted type IRI from the extensible data, or None if not set.

def property_keys(self) -> Iterator[Tuple[str | None, str, str | None]]:
1462    def property_keys(self) -> Iterator[Tuple[Optional[str], str, Optional[str]]]:
1463        iris: Set[str] = set()
1464        for pyname, iri, compact in super().property_keys():
1465            iris.add(iri)
1466            yield pyname, iri, compact
1467
1468        if self.CLOSED:
1469            return
1470
1471        for iri in self._ext_data.keys():
1472            if iri not in iris:
1473                yield None, iri, None

Yield (python_name, iri, compact_iri) tuples for each property defined on this object.

NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
class SHACLObjectSet:
1476class SHACLObjectSet(object):
1477    """A collection of SHACLObject instances with indexing, linking, serialization, and query support."""
1478
1479    def __init__(
1480        self, objects: Optional[Iterable[SHACLObject]] = None, *, link: bool = False
1481    ) -> None:
1482        if objects is None:
1483            objects = []
1484        self.objects: Set[SHACLObject] = set(objects)
1485        self.missing_ids: Set[str] = set()
1486        self.obj_by_id: Dict[str, SHACLObject] = {}
1487        self.obj_by_type: Dict[str, Set[Tuple[bool, SHACLObject]]] = {}
1488        self.create_index()
1489        self.context: Dict[str, str] = {}
1490        if link:
1491            self._link()
1492
1493    def create_index(self) -> None:
1494        """
1495        (re)Create object index
1496
1497        Creates or recreates the indices for the object set to enable fast
1498        lookup. All objects and their children are walked and indexed
1499        """
1500        self.obj_by_id = {}
1501        self.obj_by_type = {}
1502        for o in self.foreach():
1503            self.add_index(o)
1504
1505    def add_index(self, obj: SHACLObject) -> None:
1506        """
1507        Add object to index
1508
1509        Adds the object to all appropriate indices
1510        """
1511
1512        def reg_type(
1513            typ: str,
1514            compact: Optional[str],
1515            o: SHACLObject,
1516            exact: bool,
1517        ) -> None:
1518            self.obj_by_type.setdefault(typ, set()).add((exact, o))
1519            if compact:
1520                self.obj_by_type.setdefault(compact, set()).add((exact, o))
1521
1522        if not isinstance(obj, SHACLObject):
1523            raise TypeError("Object is not of type SHACLObject")
1524
1525        for typ in SHACLObject.CLASSES.values():
1526            if isinstance(obj, typ):
1527                reg_type(typ._TYPE, typ._COMPACT_TYPE, obj, obj.__class__ is typ)
1528
1529        # This covers custom extensions
1530        reg_type(obj.get_type(), obj.get_compact_type(), obj, True)
1531
1532        if not obj._id:
1533            return
1534
1535        self.missing_ids.discard(obj._id)
1536
1537        if obj._id in self.obj_by_id:
1538            return
1539
1540        self.obj_by_id[obj._id] = obj
1541
1542    def add(self, obj: T_SHACLObject) -> T_SHACLObject:
1543        """
1544        Add object to object set
1545
1546        Adds a SHACLObject to the object set and index it.
1547
1548        NOTE: Child objects of the attached object are not indexes
1549        """
1550        if not isinstance(obj, SHACLObject):
1551            raise TypeError("Object is not of type SHACLObject")
1552
1553        if obj not in self.objects:
1554            self.objects.add(obj)
1555            self.add_index(obj)
1556        return obj
1557
1558    def remove(self, obj: SHACLObject) -> None:
1559        """
1560        Remove object from object set
1561
1562        Remove a SHACLObject from the object set and rebuild index.
1563
1564        NOTE: If the object is still referenced by another object in
1565        the object set, it will remain indexed
1566        """
1567        if not isinstance(obj, SHACLObject):
1568            raise TypeError("Object is not of type SHACLObject")
1569
1570        if obj in self.objects:
1571            self.objects.remove(obj)
1572            self.create_index()
1573
1574    def update(self, *others: Iterable[SHACLObject]) -> None:
1575        """
1576        Update object set adding all objects in each other iterable
1577        """
1578        for o in others:
1579            for obj in o:
1580                self.add(obj)
1581
1582    def __contains__(self, item: SHACLObject) -> bool:
1583        """
1584        Returns True if the item is in the object set
1585        """
1586        return item in self.objects
1587
1588    def link(self) -> Set[str]:
1589        """
1590        Link object set
1591
1592        Links the object in the object set by replacing string object
1593        references with references to the objects themselves. e.g.
1594        a property that references object "https://foo/bar" by a string
1595        reference will be replaced with an actual reference to the object in
1596        the object set with the same ID if it exists in the object set
1597
1598        If multiple objects with the same ID are found, the duplicates are
1599        eliminated
1600        """
1601        self.create_index()
1602        return self._link()
1603
1604    def _link(self) -> Set[str]:
1605        self.missing_ids = set()
1606        visited: Set[SHACLObject] = set()
1607        new_objects: Set[SHACLObject] = set()
1608
1609        for o in self.objects:
1610            if o._id:
1611                o = cast(SHACLObject, self.find_by_id(o._id, o))
1612            o.link_helper(self, self.missing_ids, visited)
1613            new_objects.add(o)
1614
1615        self.objects = new_objects
1616
1617        # Remove blank nodes
1618        obj_by_id: Dict[str, SHACLObject] = {}
1619        for _id, obj in self.obj_by_id.items():
1620            if _id.startswith("_:"):
1621                del obj._id
1622            else:
1623                obj_by_id[_id] = obj
1624        self.obj_by_id = obj_by_id
1625
1626        # Named individuals aren't considered missing
1627        self.missing_ids -= NAMED_INDIVIDUALS
1628
1629        return self.missing_ids
1630
1631    def find_by_id(
1632        self, _id: str, default: Optional[SHACLObject] = None
1633    ) -> Optional[SHACLObject]:
1634        """
1635        Find object by ID
1636
1637        Returns objects that match the specified ID, or default if there is no
1638        object with the specified ID
1639        """
1640        if _id not in self.obj_by_id:
1641            return default
1642        return self.obj_by_id[_id]
1643
1644    def foreach(self) -> Iterable[SHACLObject]:
1645        """
1646        Iterate over every object in the object set, and all child objects
1647        """
1648        visited = set()
1649        for o in self.objects:
1650            if o not in visited:
1651                yield o
1652                visited.add(o)
1653
1654            for child in o.iter_objects(recursive=True, visited=visited):
1655                yield child
1656
1657    @overload
1658    def foreach_type(
1659        self, typ: str, *, match_subclass: bool = True
1660    ) -> Iterator[SHACLObject]: ...
1661
1662    @overload
1663    def foreach_type(
1664        self, typ: Type[T_SHACLObject], *, match_subclass: bool = True
1665    ) -> Iterator[T_SHACLObject]: ...
1666
1667    def foreach_type(
1668        self, typ: Union[str, Type[T_SHACLObject]], *, match_subclass: bool = True
1669    ) -> Iterable[SHACLObject]:
1670        """
1671        Iterate over each object of a specified type (or subclass there of)
1672
1673        If match_subclass is True, and class derived from typ will also match
1674        (similar to isinstance()). If False, only exact matches will be
1675        returned
1676        """
1677        if not isinstance(typ, str):
1678            if not isinstance(typ, type) or not issubclass(typ, SHACLObject):
1679                raise TypeError(f"Type must be derived from SHACLObject, got {typ}")
1680            # This intermediate step is necessary for pyrefly...
1681            typ_class: Type[SHACLObject] = typ
1682            typ = typ_class._TYPE
1683
1684        if typ not in self.obj_by_type:
1685            return
1686
1687        for exact, o in self.obj_by_type[typ]:
1688            if match_subclass or exact:
1689                yield cast(T_SHACLObject, o)
1690
1691    def merge(self, *objectsets: "SHACLObjectSet") -> "SHACLObjectSet":
1692        """
1693        Merge object sets
1694
1695        Returns a new object set that is the combination of this object set and
1696        all provided arguments
1697        """
1698        new_objects: Set[SHACLObject] = set()
1699        new_objects |= self.objects
1700        for d in objectsets:
1701            new_objects |= d.objects
1702
1703        return SHACLObjectSet(new_objects, link=True)
1704
1705    def inline_blank_nodes(self) -> None:
1706        """
1707        Removes (inlines) blank node objects from the root object set if they
1708        are referenced in only one other location besides the root.
1709
1710        Deserializers that do not preserve the tree-like structure of the
1711        objects (e.g. RDF) should call this to ensure that blank nodes are
1712        inline correctly
1713        """
1714        ref_counts: Dict[SHACLObject, int] = {}
1715
1716        def walk_callback(value: SHACLObject, path: List[str]) -> bool:
1717            if not isinstance(value, SHACLObject):
1718                return True
1719
1720            ref_counts.setdefault(value, 0)
1721            ref_counts[value] += 1
1722            if ref_counts[value] > 1:
1723                return False
1724
1725            return True
1726
1727        for o in self.objects:
1728            # Note that every object in the root object set gets at least one
1729            # reference
1730            o.walk(walk_callback)
1731
1732        new_objects: Set[SHACLObject] = set()
1733        for o in self.objects:
1734            if is_IRI(o._id):
1735                new_objects.add(o)
1736            # If the object is a blank node and is only referenced by this
1737            # root list and one other location, remove it from the root list
1738            #
1739            # A count of 1 means the object is only referenced by the root, and
1740            # therefore must be kept
1741            elif ref_counts[o] != 2:
1742                new_objects.add(o)
1743
1744        self.objects = new_objects
1745
1746    def encode(
1747        self,
1748        encoder: Encoder,
1749        state: EncodeState,
1750        force_list: bool = False,
1751        *,
1752        key: Optional[Callable[[SHACLObject], Any]] = None,
1753    ) -> None:
1754        """
1755        Serialize a list of objects to a serialization encoder
1756
1757        If force_list is true, a list will always be written using the encoder.
1758        """
1759        ref_counts: Dict[SHACLObject, int] = {}
1760
1761        def walk_callback(value: SHACLObject, path: List[str]) -> bool:
1762            if not isinstance(value, SHACLObject):
1763                return True
1764
1765            # Remove blank node ID for re-assignment
1766            if is_blank_node(value._id):
1767                del value._id
1768
1769            if value._id:
1770                state.add_refed(value)
1771
1772            # If the object is referenced more than once, add it to the set of
1773            # referenced objects
1774            ref_counts.setdefault(value, 0)
1775            ref_counts[value] += 1
1776            if ref_counts[value] > 1:
1777                state.add_refed(value)
1778                return False
1779
1780            return True
1781
1782        for o in self.objects:
1783            if o._id:
1784                state.add_refed(o)
1785            o.walk(walk_callback)
1786
1787        use_list = force_list or len(self.objects) > 1
1788
1789        if use_list:
1790            # If we are making a list add all the objects referred to by reference
1791            # to the list
1792            objects = list(self.objects | state.ref_objects)
1793        else:
1794            objects = list(self.objects)
1795
1796        objects.sort(key=key)
1797
1798        if use_list:
1799            # Ensure top level objects are only written in the top level graph
1800            # node, and referenced by ID everywhere else. This is done by setting
1801            # the flag that indicates this object has been written for all the top
1802            # level objects, then clearing it right before serializing the object.
1803            #
1804            # In this way, if an object is referenced before it is supposed to be
1805            # serialized into the @graph, it will serialize as a string instead of
1806            # the actual object
1807            for o in objects:
1808                state.written_objects.add(o)
1809
1810            with encoder.write_object_list() as list_s:
1811                for o in objects:
1812                    # Allow this specific object to be written now
1813                    state.written_objects.remove(o)
1814                    with list_s.write_list_item() as item_s:
1815                        o.encode(item_s, state)
1816
1817        elif objects:
1818            objects[0].encode(encoder, state)
1819
1820    def decode(self, decoder: Decoder, state: DecodeState) -> None:
1821        """Decode objects from the decoder and add them to this set, then link all references."""
1822        self.create_index()
1823        for obj_d in decoder.read_list():
1824            o = SHACLExtensibleObject.decode(obj_d, state)
1825            self.objects.add(o)
1826
1827        self._link()
1828
1829    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1830        """Expand a compact IRI to a full IRI using the object set's context, or return default."""
1831        for k, v in self.context.items():
1832            if iri == k:
1833                return self.expand_iri(v, v)
1834            if iri.startswith(k + ":"):
1835                new_iri = v + iri[len(k) + 1 :]
1836                return self.expand_iri(new_iri, new_iri)
1837        return default
1838
1839    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1840        """Compact a full IRI to a prefixed short form using the object set's context, or return default."""
1841        for k, v in self.context.items():
1842            if iri == v:
1843                return self.compact_iri(k, k)
1844            if iri.startswith(v):
1845                new_iri = k + ":" + iri[len(v) :]
1846                return self.compact_iri(new_iri, new_iri)
1847        return default

A collection of SHACLObject instances with indexing, linking, serialization, and query support.

SHACLObjectSet( objects: Iterable[SHACLObject] | None = None, *, link: bool = False)
1479    def __init__(
1480        self, objects: Optional[Iterable[SHACLObject]] = None, *, link: bool = False
1481    ) -> None:
1482        if objects is None:
1483            objects = []
1484        self.objects: Set[SHACLObject] = set(objects)
1485        self.missing_ids: Set[str] = set()
1486        self.obj_by_id: Dict[str, SHACLObject] = {}
1487        self.obj_by_type: Dict[str, Set[Tuple[bool, SHACLObject]]] = {}
1488        self.create_index()
1489        self.context: Dict[str, str] = {}
1490        if link:
1491            self._link()
objects: Set[SHACLObject]
missing_ids: Set[str]
obj_by_id: Dict[str, SHACLObject]
obj_by_type: Dict[str, Set[Tuple[bool, SHACLObject]]]
context: Dict[str, str]
def create_index(self) -> None:
1493    def create_index(self) -> None:
1494        """
1495        (re)Create object index
1496
1497        Creates or recreates the indices for the object set to enable fast
1498        lookup. All objects and their children are walked and indexed
1499        """
1500        self.obj_by_id = {}
1501        self.obj_by_type = {}
1502        for o in self.foreach():
1503            self.add_index(o)

(re)Create object index

Creates or recreates the indices for the object set to enable fast lookup. All objects and their children are walked and indexed

def add_index(self, obj: SHACLObject) -> None:
1505    def add_index(self, obj: SHACLObject) -> None:
1506        """
1507        Add object to index
1508
1509        Adds the object to all appropriate indices
1510        """
1511
1512        def reg_type(
1513            typ: str,
1514            compact: Optional[str],
1515            o: SHACLObject,
1516            exact: bool,
1517        ) -> None:
1518            self.obj_by_type.setdefault(typ, set()).add((exact, o))
1519            if compact:
1520                self.obj_by_type.setdefault(compact, set()).add((exact, o))
1521
1522        if not isinstance(obj, SHACLObject):
1523            raise TypeError("Object is not of type SHACLObject")
1524
1525        for typ in SHACLObject.CLASSES.values():
1526            if isinstance(obj, typ):
1527                reg_type(typ._TYPE, typ._COMPACT_TYPE, obj, obj.__class__ is typ)
1528
1529        # This covers custom extensions
1530        reg_type(obj.get_type(), obj.get_compact_type(), obj, True)
1531
1532        if not obj._id:
1533            return
1534
1535        self.missing_ids.discard(obj._id)
1536
1537        if obj._id in self.obj_by_id:
1538            return
1539
1540        self.obj_by_id[obj._id] = obj

Add object to index

Adds the object to all appropriate indices

def add(self, obj: ~T_SHACLObject) -> ~T_SHACLObject:
1542    def add(self, obj: T_SHACLObject) -> T_SHACLObject:
1543        """
1544        Add object to object set
1545
1546        Adds a SHACLObject to the object set and index it.
1547
1548        NOTE: Child objects of the attached object are not indexes
1549        """
1550        if not isinstance(obj, SHACLObject):
1551            raise TypeError("Object is not of type SHACLObject")
1552
1553        if obj not in self.objects:
1554            self.objects.add(obj)
1555            self.add_index(obj)
1556        return obj

Add object to object set

Adds a SHACLObject to the object set and index it.

NOTE: Child objects of the attached object are not indexes

def remove(self, obj: SHACLObject) -> None:
1558    def remove(self, obj: SHACLObject) -> None:
1559        """
1560        Remove object from object set
1561
1562        Remove a SHACLObject from the object set and rebuild index.
1563
1564        NOTE: If the object is still referenced by another object in
1565        the object set, it will remain indexed
1566        """
1567        if not isinstance(obj, SHACLObject):
1568            raise TypeError("Object is not of type SHACLObject")
1569
1570        if obj in self.objects:
1571            self.objects.remove(obj)
1572            self.create_index()

Remove object from object set

Remove a SHACLObject from the object set and rebuild index.

NOTE: If the object is still referenced by another object in the object set, it will remain indexed

def update( self, *others: Iterable[SHACLObject]) -> None:
1574    def update(self, *others: Iterable[SHACLObject]) -> None:
1575        """
1576        Update object set adding all objects in each other iterable
1577        """
1578        for o in others:
1579            for obj in o:
1580                self.add(obj)

Update object set adding all objects in each other iterable

def find_by_id( self, _id: str, default: SHACLObject | None = None) -> SHACLObject | None:
1631    def find_by_id(
1632        self, _id: str, default: Optional[SHACLObject] = None
1633    ) -> Optional[SHACLObject]:
1634        """
1635        Find object by ID
1636
1637        Returns objects that match the specified ID, or default if there is no
1638        object with the specified ID
1639        """
1640        if _id not in self.obj_by_id:
1641            return default
1642        return self.obj_by_id[_id]

Find object by ID

Returns objects that match the specified ID, or default if there is no object with the specified ID

def foreach(self) -> Iterable[SHACLObject]:
1644    def foreach(self) -> Iterable[SHACLObject]:
1645        """
1646        Iterate over every object in the object set, and all child objects
1647        """
1648        visited = set()
1649        for o in self.objects:
1650            if o not in visited:
1651                yield o
1652                visited.add(o)
1653
1654            for child in o.iter_objects(recursive=True, visited=visited):
1655                yield child

Iterate over every object in the object set, and all child objects

def foreach_type(*args, **kwds):
1667    def foreach_type(
1668        self, typ: Union[str, Type[T_SHACLObject]], *, match_subclass: bool = True
1669    ) -> Iterable[SHACLObject]:
1670        """
1671        Iterate over each object of a specified type (or subclass there of)
1672
1673        If match_subclass is True, and class derived from typ will also match
1674        (similar to isinstance()). If False, only exact matches will be
1675        returned
1676        """
1677        if not isinstance(typ, str):
1678            if not isinstance(typ, type) or not issubclass(typ, SHACLObject):
1679                raise TypeError(f"Type must be derived from SHACLObject, got {typ}")
1680            # This intermediate step is necessary for pyrefly...
1681            typ_class: Type[SHACLObject] = typ
1682            typ = typ_class._TYPE
1683
1684        if typ not in self.obj_by_type:
1685            return
1686
1687        for exact, o in self.obj_by_type[typ]:
1688            if match_subclass or exact:
1689                yield cast(T_SHACLObject, o)

Iterate over each object of a specified type (or subclass there of)

If match_subclass is True, and class derived from typ will also match (similar to isinstance()). If False, only exact matches will be returned

def merge( self, *objectsets: SHACLObjectSet) -> SHACLObjectSet:
1691    def merge(self, *objectsets: "SHACLObjectSet") -> "SHACLObjectSet":
1692        """
1693        Merge object sets
1694
1695        Returns a new object set that is the combination of this object set and
1696        all provided arguments
1697        """
1698        new_objects: Set[SHACLObject] = set()
1699        new_objects |= self.objects
1700        for d in objectsets:
1701            new_objects |= d.objects
1702
1703        return SHACLObjectSet(new_objects, link=True)

Merge object sets

Returns a new object set that is the combination of this object set and all provided arguments

def inline_blank_nodes(self) -> None:
1705    def inline_blank_nodes(self) -> None:
1706        """
1707        Removes (inlines) blank node objects from the root object set if they
1708        are referenced in only one other location besides the root.
1709
1710        Deserializers that do not preserve the tree-like structure of the
1711        objects (e.g. RDF) should call this to ensure that blank nodes are
1712        inline correctly
1713        """
1714        ref_counts: Dict[SHACLObject, int] = {}
1715
1716        def walk_callback(value: SHACLObject, path: List[str]) -> bool:
1717            if not isinstance(value, SHACLObject):
1718                return True
1719
1720            ref_counts.setdefault(value, 0)
1721            ref_counts[value] += 1
1722            if ref_counts[value] > 1:
1723                return False
1724
1725            return True
1726
1727        for o in self.objects:
1728            # Note that every object in the root object set gets at least one
1729            # reference
1730            o.walk(walk_callback)
1731
1732        new_objects: Set[SHACLObject] = set()
1733        for o in self.objects:
1734            if is_IRI(o._id):
1735                new_objects.add(o)
1736            # If the object is a blank node and is only referenced by this
1737            # root list and one other location, remove it from the root list
1738            #
1739            # A count of 1 means the object is only referenced by the root, and
1740            # therefore must be kept
1741            elif ref_counts[o] != 2:
1742                new_objects.add(o)
1743
1744        self.objects = new_objects

Removes (inlines) blank node objects from the root object set if they are referenced in only one other location besides the root.

Deserializers that do not preserve the tree-like structure of the objects (e.g. RDF) should call this to ensure that blank nodes are inline correctly

def encode( self, encoder: Encoder, state: EncodeState, force_at_graph: bool = False) -> None:
1746    def encode(
1747        self,
1748        encoder: Encoder,
1749        state: EncodeState,
1750        force_list: bool = False,
1751        *,
1752        key: Optional[Callable[[SHACLObject], Any]] = None,
1753    ) -> None:
1754        """
1755        Serialize a list of objects to a serialization encoder
1756
1757        If force_list is true, a list will always be written using the encoder.
1758        """
1759        ref_counts: Dict[SHACLObject, int] = {}
1760
1761        def walk_callback(value: SHACLObject, path: List[str]) -> bool:
1762            if not isinstance(value, SHACLObject):
1763                return True
1764
1765            # Remove blank node ID for re-assignment
1766            if is_blank_node(value._id):
1767                del value._id
1768
1769            if value._id:
1770                state.add_refed(value)
1771
1772            # If the object is referenced more than once, add it to the set of
1773            # referenced objects
1774            ref_counts.setdefault(value, 0)
1775            ref_counts[value] += 1
1776            if ref_counts[value] > 1:
1777                state.add_refed(value)
1778                return False
1779
1780            return True
1781
1782        for o in self.objects:
1783            if o._id:
1784                state.add_refed(o)
1785            o.walk(walk_callback)
1786
1787        use_list = force_list or len(self.objects) > 1
1788
1789        if use_list:
1790            # If we are making a list add all the objects referred to by reference
1791            # to the list
1792            objects = list(self.objects | state.ref_objects)
1793        else:
1794            objects = list(self.objects)
1795
1796        objects.sort(key=key)
1797
1798        if use_list:
1799            # Ensure top level objects are only written in the top level graph
1800            # node, and referenced by ID everywhere else. This is done by setting
1801            # the flag that indicates this object has been written for all the top
1802            # level objects, then clearing it right before serializing the object.
1803            #
1804            # In this way, if an object is referenced before it is supposed to be
1805            # serialized into the @graph, it will serialize as a string instead of
1806            # the actual object
1807            for o in objects:
1808                state.written_objects.add(o)
1809
1810            with encoder.write_object_list() as list_s:
1811                for o in objects:
1812                    # Allow this specific object to be written now
1813                    state.written_objects.remove(o)
1814                    with list_s.write_list_item() as item_s:
1815                        o.encode(item_s, state)
1816
1817        elif objects:
1818            objects[0].encode(encoder, state)

Serialize a list of objects to a serialization encoder

If force_list is true, a list will always be written using the encoder.

def decode( self, decoder: Decoder, state: DecodeState | None = None) -> None:
1820    def decode(self, decoder: Decoder, state: DecodeState) -> None:
1821        """Decode objects from the decoder and add them to this set, then link all references."""
1822        self.create_index()
1823        for obj_d in decoder.read_list():
1824            o = SHACLExtensibleObject.decode(obj_d, state)
1825            self.objects.add(o)
1826
1827        self._link()

Decode objects from the decoder and add them to this set, then link all references.

def expand_iri(self, iri: str, default: str | None = None) -> str | None:
1829    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1830        """Expand a compact IRI to a full IRI using the object set's context, or return default."""
1831        for k, v in self.context.items():
1832            if iri == k:
1833                return self.expand_iri(v, v)
1834            if iri.startswith(k + ":"):
1835                new_iri = v + iri[len(k) + 1 :]
1836                return self.expand_iri(new_iri, new_iri)
1837        return default

Expand a compact IRI to a full IRI using the object set's context, or return default.

def compact_iri(self, iri: str, default: str | None = None) -> str | None:
1839    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1840        """Compact a full IRI to a prefixed short form using the object set's context, or return default."""
1841        for k, v in self.context.items():
1842            if iri == v:
1843                return self.compact_iri(k, k)
1844            if iri.startswith(v):
1845                new_iri = k + ":" + iri[len(v) :]
1846                return self.compact_iri(new_iri, new_iri)
1847        return default

Compact a full IRI to a prefixed short form using the object set's context, or return default.

class EncodeState:
1850class EncodeState(object):
1851    """Tracks per-serialization state: object IDs, reference counts, and write order."""
1852
1853    def __init__(self, objectset: SHACLObjectSet):
1854        self.ref_objects: Set[SHACLObject] = set()
1855        self.written_objects: Set[SHACLObject] = set()
1856        self.blank_objects: Dict[SHACLObject, str] = {}
1857        self.objectset = objectset
1858
1859    def get_object_id(self, o: SHACLObject) -> str:
1860        if o._id:
1861            return o._id
1862
1863        if o not in self.blank_objects:
1864            _id = f"_:{o.__class__.__name__}{len(self.blank_objects)}"
1865            self.blank_objects[o] = _id
1866
1867        return self.blank_objects[o]
1868
1869    def is_refed(self, o: SHACLObject) -> bool:
1870        return o in self.ref_objects
1871
1872    def add_refed(self, o: SHACLObject) -> None:
1873        self.ref_objects.add(o)
1874
1875    def is_written(self, o: SHACLObject) -> bool:
1876        return o in self.written_objects
1877
1878    def add_written(self, o: SHACLObject) -> None:
1879        self.written_objects.add(o)
1880
1881    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1882        if self.objectset:
1883            return self.objectset.expand_iri(iri, default)
1884        return default
1885
1886    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1887        if self.objectset:
1888            return self.objectset.compact_iri(iri, default)
1889        return default

Tracks per-serialization state: object IDs, reference counts, and write order.

ref_objects: Set[SHACLObject]
written_objects: Set[SHACLObject]
blank_objects: Dict[SHACLObject, str]
objectset
def get_object_id(self, o: SHACLObject) -> str:
1859    def get_object_id(self, o: SHACLObject) -> str:
1860        if o._id:
1861            return o._id
1862
1863        if o not in self.blank_objects:
1864            _id = f"_:{o.__class__.__name__}{len(self.blank_objects)}"
1865            self.blank_objects[o] = _id
1866
1867        return self.blank_objects[o]
def is_refed(self, o: SHACLObject) -> bool:
1869    def is_refed(self, o: SHACLObject) -> bool:
1870        return o in self.ref_objects
def add_refed(self, o: SHACLObject) -> None:
1872    def add_refed(self, o: SHACLObject) -> None:
1873        self.ref_objects.add(o)
def is_written(self, o: SHACLObject) -> bool:
1875    def is_written(self, o: SHACLObject) -> bool:
1876        return o in self.written_objects
def add_written(self, o: SHACLObject) -> None:
1878    def add_written(self, o: SHACLObject) -> None:
1879        self.written_objects.add(o)
def expand_iri(self, iri: str, default: str | None = None) -> str | None:
1881    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1882        if self.objectset:
1883            return self.objectset.expand_iri(iri, default)
1884        return default
def compact_iri(self, iri: str, default: str | None = None) -> str | None:
1886    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1887        if self.objectset:
1888            return self.objectset.compact_iri(iri, default)
1889        return default
class DecodeState:
1892class DecodeState(object):
1893    """Carries the target SHACLObjectSet and context during a deserialization pass."""
1894
1895    def __init__(self, objectset: SHACLObjectSet):
1896        self.objectset = objectset
1897        self.read_objs: Dict[str, SHACLObject] = {}
1898
1899    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1900        if self.objectset:
1901            return self.objectset.expand_iri(iri, default)
1902        return default
1903
1904    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1905        if self.objectset:
1906            return self.objectset.compact_iri(iri, default)
1907        return default

Carries the target SHACLObjectSet and context during a deserialization pass.

objectset
read_objs: Dict[str, SHACLObject]
def expand_iri(self, iri: str, default: str | None = None) -> str | None:
1899    def expand_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1900        if self.objectset:
1901            return self.objectset.expand_iri(iri, default)
1902        return default
def compact_iri(self, iri: str, default: str | None = None) -> str | None:
1904    def compact_iri(self, iri: str, default: Optional[str] = None) -> Optional[str]:
1905        if self.objectset:
1906            return self.objectset.compact_iri(iri, default)
1907        return default
class Decoder(abc.ABC):
1910class Decoder(ABC):
1911    """Abstract interface for reading typed values and objects from a serialized source."""
1912
1913    @abstractmethod
1914    def read_value(self) -> Any:
1915        """
1916        Consume next item
1917
1918        Consumes the next item of any type
1919        """
1920        raise NotImplementedError("Subclasses must implement read_value method")
1921
1922    @abstractmethod
1923    def read_string(self) -> Optional[str]:
1924        """
1925        Consume the next item as a string.
1926
1927        Returns the string value of the next item, or `None` if the next item
1928        is not a string
1929        """
1930        raise NotImplementedError("Subclasses must implement read_string method")
1931
1932    @abstractmethod
1933    def read_datetime(self) -> Optional[str]:
1934        """
1935        Consumes the next item as a date & time string
1936
1937        Returns the string value of the next item, if it is a ISO datetime, or
1938        `None` if the next item is not a ISO datetime string.
1939
1940        Note that validation of the string is done by the caller, so a minimal
1941        implementation can just check if the next item is a string without
1942        worrying about the format
1943        """
1944        raise NotImplementedError("Subclasses must implement read_datetime method")
1945
1946    @abstractmethod
1947    def read_integer(self) -> Optional[int]:
1948        """
1949        Consumes the next item as an integer
1950
1951        Returns the integer value of the next item, or `None` if the next item
1952        is not an integer
1953        """
1954        raise NotImplementedError("Subclasses must implement read_integer method")
1955
1956    @abstractmethod
1957    def read_iri(self) -> Optional[str]:
1958        """
1959        Consumes the next item as an IRI string
1960
1961        Returns the string value of the next item an IRI, or `None` if the next
1962        item is not an IRI.
1963
1964        The returned string should be either a fully-qualified IRI, or a blank
1965        node ID
1966        """
1967        raise NotImplementedError("Subclasses must implement read_iri method")
1968
1969    @abstractmethod
1970    def read_enum(self, e: EnumProp) -> Optional[str]:
1971        """
1972        Consumes the next item as an Enum value string
1973
1974        Returns the fully qualified IRI of the next enum item, or `None` if the
1975        next item is not an enum value.
1976
1977        The callee is responsible for validating that the returned IRI is
1978        actually a member of the specified Enum, so the `Decoder` does not need
1979        to check that, but can if it wishes
1980        """
1981        raise NotImplementedError("Subclasses must implement read_enum method")
1982
1983    @abstractmethod
1984    def read_bool(self) -> Optional[bool]:
1985        """
1986        Consume the next item as a boolean value
1987
1988        Returns the boolean value of the next item, or `None` if the next item
1989        is not a boolean
1990        """
1991        raise NotImplementedError("Subclasses must implement read_bool method")
1992
1993    @abstractmethod
1994    def read_float(self) -> Optional[float]:
1995        """
1996        Consume the next item as a float value
1997
1998        Returns the float value of the next item, or `None` if the next item is
1999        not a float
2000        """
2001        raise NotImplementedError("Subclasses must implement read_float method")
2002
2003    @abstractmethod
2004    def read_list(self) -> Iterator["Decoder"]:
2005        """
2006        Consume the next item as a list generator
2007
2008        This should generate a `Decoder` object for each item in the list. The
2009        generated `Decoder` can be used to read the corresponding item from the
2010        list
2011        """
2012        raise NotImplementedError("Subclasses must implement read_list method")
2013
2014    @abstractmethod
2015    def is_list(self) -> bool:
2016        """
2017        Checks if the next item is a list
2018
2019        Returns True if the next item is a list, or False if it is a scalar
2020        """
2021        raise NotImplementedError("Subclasses must implement is_list method")
2022
2023    @abstractmethod
2024    def read_object(self) -> Tuple[Any, "Decoder"]:
2025        """
2026        Consume next item as an object
2027
2028        A context manager that "enters" the next item as a object and yields a
2029        `Decoder` that can read properties from it. If the next item is not an
2030        object, yields `None`
2031
2032        Properties will be read out of the object using `read_property` and
2033        `read_object_id`
2034        """
2035        raise NotImplementedError("Subclasses must implement read_object method")
2036
2037    @abstractmethod
2038    @contextmanager
2039    def read_property(self, key: str) -> Iterator[Optional["Decoder"]]:
2040        """
2041        Read property from object
2042
2043        A context manager that yields a `Decoder` that can be used to read the
2044        value of the property with the given key in current object, or `None`
2045        if the property does not exist in the current object.
2046        """
2047        raise NotImplementedError("Subclasses must implement read_property method")
2048
2049    @abstractmethod
2050    def is_object(self) -> bool:
2051        """
2052        Checks if the item is an object
2053
2054        Returns True if the item is an object, or False if is not
2055        """
2056        raise NotImplementedError("Subclasses must implement is_object method")
2057
2058    @abstractmethod
2059    def object_keys(self) -> Iterator[str]:
2060        """
2061        Read property keys from an object
2062
2063        Iterates over all the serialized keys for the current object
2064        """
2065        raise NotImplementedError("Subclasses must implement object_keys method")
2066
2067    @abstractmethod
2068    def read_object_id(self, alias: Optional[str] = None) -> Optional[Any]:
2069        """
2070        Read current object ID property
2071
2072        Returns the ID of the current object if one is defined, or `None` if
2073        the current object has no ID.
2074
2075        The ID must be a fully qualified IRI or a blank node
2076
2077        If `alias` is provided, is is a hint as to another name by which the ID
2078        might be found, if the `Decoder` supports aliases for an ID
2079        """
2080        raise NotImplementedError("Subclasses must implement read_object_id method")

Helper class that provides a standard way to create an ABC using inheritance.

@abstractmethod
def read_value(self) -> Any:
1913    @abstractmethod
1914    def read_value(self) -> Any:
1915        """
1916        Consume next item
1917
1918        Consumes the next item of any type
1919        """
1920        raise NotImplementedError("Subclasses must implement read_value method")

Consume next item

Consumes the next item of any type

@abstractmethod
def read_string(self) -> str | None:
1922    @abstractmethod
1923    def read_string(self) -> Optional[str]:
1924        """
1925        Consume the next item as a string.
1926
1927        Returns the string value of the next item, or `None` if the next item
1928        is not a string
1929        """
1930        raise NotImplementedError("Subclasses must implement read_string method")

Consume the next item as a string.

Returns the string value of the next item, or None if the next item is not a string

@abstractmethod
def read_datetime(self) -> str | None:
1932    @abstractmethod
1933    def read_datetime(self) -> Optional[str]:
1934        """
1935        Consumes the next item as a date & time string
1936
1937        Returns the string value of the next item, if it is a ISO datetime, or
1938        `None` if the next item is not a ISO datetime string.
1939
1940        Note that validation of the string is done by the caller, so a minimal
1941        implementation can just check if the next item is a string without
1942        worrying about the format
1943        """
1944        raise NotImplementedError("Subclasses must implement read_datetime method")

Consumes the next item as a date & time string

Returns the string value of the next item, if it is a ISO datetime, or None if the next item is not a ISO datetime string.

Note that validation of the string is done by the caller, so a minimal implementation can just check if the next item is a string without worrying about the format

@abstractmethod
def read_integer(self) -> int | None:
1946    @abstractmethod
1947    def read_integer(self) -> Optional[int]:
1948        """
1949        Consumes the next item as an integer
1950
1951        Returns the integer value of the next item, or `None` if the next item
1952        is not an integer
1953        """
1954        raise NotImplementedError("Subclasses must implement read_integer method")

Consumes the next item as an integer

Returns the integer value of the next item, or None if the next item is not an integer

@abstractmethod
def read_iri(self) -> str | None:
1956    @abstractmethod
1957    def read_iri(self) -> Optional[str]:
1958        """
1959        Consumes the next item as an IRI string
1960
1961        Returns the string value of the next item an IRI, or `None` if the next
1962        item is not an IRI.
1963
1964        The returned string should be either a fully-qualified IRI, or a blank
1965        node ID
1966        """
1967        raise NotImplementedError("Subclasses must implement read_iri method")

Consumes the next item as an IRI string

Returns the string value of the next item an IRI, or None if the next item is not an IRI.

The returned string should be either a fully-qualified IRI, or a blank node ID

@abstractmethod
def read_enum(self, e: EnumProp) -> str | None:
1969    @abstractmethod
1970    def read_enum(self, e: EnumProp) -> Optional[str]:
1971        """
1972        Consumes the next item as an Enum value string
1973
1974        Returns the fully qualified IRI of the next enum item, or `None` if the
1975        next item is not an enum value.
1976
1977        The callee is responsible for validating that the returned IRI is
1978        actually a member of the specified Enum, so the `Decoder` does not need
1979        to check that, but can if it wishes
1980        """
1981        raise NotImplementedError("Subclasses must implement read_enum method")

Consumes the next item as an Enum value string

Returns the fully qualified IRI of the next enum item, or None if the next item is not an enum value.

The callee is responsible for validating that the returned IRI is actually a member of the specified Enum, so the Decoder does not need to check that, but can if it wishes

@abstractmethod
def read_bool(self) -> bool | None:
1983    @abstractmethod
1984    def read_bool(self) -> Optional[bool]:
1985        """
1986        Consume the next item as a boolean value
1987
1988        Returns the boolean value of the next item, or `None` if the next item
1989        is not a boolean
1990        """
1991        raise NotImplementedError("Subclasses must implement read_bool method")

Consume the next item as a boolean value

Returns the boolean value of the next item, or None if the next item is not a boolean

@abstractmethod
def read_float(self) -> float | None:
1993    @abstractmethod
1994    def read_float(self) -> Optional[float]:
1995        """
1996        Consume the next item as a float value
1997
1998        Returns the float value of the next item, or `None` if the next item is
1999        not a float
2000        """
2001        raise NotImplementedError("Subclasses must implement read_float method")

Consume the next item as a float value

Returns the float value of the next item, or None if the next item is not a float

@abstractmethod
def read_list(self) -> Iterator[Decoder]:
2003    @abstractmethod
2004    def read_list(self) -> Iterator["Decoder"]:
2005        """
2006        Consume the next item as a list generator
2007
2008        This should generate a `Decoder` object for each item in the list. The
2009        generated `Decoder` can be used to read the corresponding item from the
2010        list
2011        """
2012        raise NotImplementedError("Subclasses must implement read_list method")

Consume the next item as a list generator

This should generate a Decoder object for each item in the list. The generated Decoder can be used to read the corresponding item from the list

@abstractmethod
def is_list(self) -> bool:
2014    @abstractmethod
2015    def is_list(self) -> bool:
2016        """
2017        Checks if the next item is a list
2018
2019        Returns True if the next item is a list, or False if it is a scalar
2020        """
2021        raise NotImplementedError("Subclasses must implement is_list method")

Checks if the next item is a list

Returns True if the next item is a list, or False if it is a scalar

@abstractmethod
def read_object(self) -> Tuple[Any, Decoder]:
2023    @abstractmethod
2024    def read_object(self) -> Tuple[Any, "Decoder"]:
2025        """
2026        Consume next item as an object
2027
2028        A context manager that "enters" the next item as a object and yields a
2029        `Decoder` that can read properties from it. If the next item is not an
2030        object, yields `None`
2031
2032        Properties will be read out of the object using `read_property` and
2033        `read_object_id`
2034        """
2035        raise NotImplementedError("Subclasses must implement read_object method")

Consume next item as an object

A context manager that "enters" the next item as a object and yields a Decoder that can read properties from it. If the next item is not an object, yields None

Properties will be read out of the object using read_property and read_object_id

@abstractmethod
@contextmanager
def read_property( self, key: str) -> Iterator[Decoder | None]:
2037    @abstractmethod
2038    @contextmanager
2039    def read_property(self, key: str) -> Iterator[Optional["Decoder"]]:
2040        """
2041        Read property from object
2042
2043        A context manager that yields a `Decoder` that can be used to read the
2044        value of the property with the given key in current object, or `None`
2045        if the property does not exist in the current object.
2046        """
2047        raise NotImplementedError("Subclasses must implement read_property method")

Read property from object

A context manager that yields a Decoder that can be used to read the value of the property with the given key in current object, or None if the property does not exist in the current object.

@abstractmethod
def is_object(self) -> bool:
2049    @abstractmethod
2050    def is_object(self) -> bool:
2051        """
2052        Checks if the item is an object
2053
2054        Returns True if the item is an object, or False if is not
2055        """
2056        raise NotImplementedError("Subclasses must implement is_object method")

Checks if the item is an object

Returns True if the item is an object, or False if is not

@abstractmethod
def object_keys(self) -> Iterator[str]:
2058    @abstractmethod
2059    def object_keys(self) -> Iterator[str]:
2060        """
2061        Read property keys from an object
2062
2063        Iterates over all the serialized keys for the current object
2064        """
2065        raise NotImplementedError("Subclasses must implement object_keys method")

Read property keys from an object

Iterates over all the serialized keys for the current object

@abstractmethod
def read_object_id(self, alias: str | None = None) -> Any | None:
2067    @abstractmethod
2068    def read_object_id(self, alias: Optional[str] = None) -> Optional[Any]:
2069        """
2070        Read current object ID property
2071
2072        Returns the ID of the current object if one is defined, or `None` if
2073        the current object has no ID.
2074
2075        The ID must be a fully qualified IRI or a blank node
2076
2077        If `alias` is provided, is is a hint as to another name by which the ID
2078        might be found, if the `Decoder` supports aliases for an ID
2079        """
2080        raise NotImplementedError("Subclasses must implement read_object_id method")

Read current object ID property

Returns the ID of the current object if one is defined, or None if the current object has no ID.

The ID must be a fully qualified IRI or a blank node

If alias is provided, is is a hint as to another name by which the ID might be found, if the Decoder supports aliases for an ID

class JSONLDDecoder(Decoder):
2083class JSONLDDecoder(Decoder):
2084    """Decoder implementation that reads SHACL objects from a parsed JSON-LD data structure."""
2085
2086    def __init__(self, data: Any, root: bool = False) -> None:
2087        self.data = data
2088        self.root = root
2089
2090    def read_value(self) -> Optional[Any]:
2091        if isinstance(self.data, str):
2092            try:
2093                return float(self.data)
2094            except ValueError:
2095                pass
2096        return self.data
2097
2098    def read_string(self) -> Optional[str]:
2099        if isinstance(self.data, str):
2100            return self.data
2101        return None
2102
2103    def read_datetime(self) -> Optional[str]:
2104        return self.read_string()
2105
2106    def read_integer(self) -> Optional[int]:
2107        if isinstance(self.data, int):
2108            return self.data
2109        return None
2110
2111    def read_bool(self) -> Optional[bool]:
2112        if isinstance(self.data, bool):
2113            return self.data
2114        return None
2115
2116    def read_float(self) -> Optional[float]:
2117        if isinstance(self.data, (int, float, str)):
2118            return float(self.data)
2119        return None
2120
2121    def read_iri(self) -> Optional[str]:
2122        if isinstance(self.data, str):
2123            return self.data
2124        return None
2125
2126    def read_enum(self, e: EnumProp) -> Optional[str]:
2127        if isinstance(self.data, str):
2128            return self.data
2129        return None
2130
2131    def read_list(self) -> Iterator["JSONLDDecoder"]:
2132        if self.is_list():
2133            for v in self.data:
2134                yield self.__class__(v)
2135        else:
2136            yield self
2137
2138    def is_list(self) -> bool:
2139        return isinstance(self.data, (list, tuple, set))
2140
2141    def __get_value(self, *keys: Optional[str]) -> Optional[Any]:
2142        for k in keys:
2143            if k and k in self.data:
2144                return self.data[k]
2145        return None
2146
2147    @contextmanager
2148    def read_property(self, key: str) -> Iterator[Optional["JSONLDDecoder"]]:
2149        v = self.__get_value(key)
2150        if v is not None:
2151            yield self.__class__(v)
2152        else:
2153            yield None
2154
2155    def is_object(self) -> bool:
2156        return isinstance(self.data, dict)
2157
2158    def object_keys(self) -> Iterator[str]:
2159        for key in self.data.keys():
2160            if key in ("@type", "type"):
2161                continue
2162            if self.root and key == "@context":
2163                continue
2164            yield key
2165
2166    def read_object(self) -> Tuple[Any, "JSONLDDecoder"]:
2167        typ = self.__get_value("@type", "type")
2168        if typ is not None:
2169            return typ, self
2170
2171        return None, self
2172
2173    def read_object_id(self, alias: Optional[str] = None) -> Optional[Any]:
2174        return self.__get_value(alias, "@id")

Decoder implementation that reads SHACL objects from a parsed JSON-LD data structure.

JSONLDDecoder(data: Any, root: bool = False)
2086    def __init__(self, data: Any, root: bool = False) -> None:
2087        self.data = data
2088        self.root = root
data
root
def read_value(self) -> Any | None:
2090    def read_value(self) -> Optional[Any]:
2091        if isinstance(self.data, str):
2092            try:
2093                return float(self.data)
2094            except ValueError:
2095                pass
2096        return self.data

Consume next item

Consumes the next item of any type

def read_string(self) -> str | None:
2098    def read_string(self) -> Optional[str]:
2099        if isinstance(self.data, str):
2100            return self.data
2101        return None

Consume the next item as a string.

Returns the string value of the next item, or None if the next item is not a string

def read_datetime(self) -> str | None:
2103    def read_datetime(self) -> Optional[str]:
2104        return self.read_string()

Consumes the next item as a date & time string

Returns the string value of the next item, if it is a ISO datetime, or None if the next item is not a ISO datetime string.

Note that validation of the string is done by the caller, so a minimal implementation can just check if the next item is a string without worrying about the format

def read_integer(self) -> int | None:
2106    def read_integer(self) -> Optional[int]:
2107        if isinstance(self.data, int):
2108            return self.data
2109        return None

Consumes the next item as an integer

Returns the integer value of the next item, or None if the next item is not an integer

def read_bool(self) -> bool | None:
2111    def read_bool(self) -> Optional[bool]:
2112        if isinstance(self.data, bool):
2113            return self.data
2114        return None

Consume the next item as a boolean value

Returns the boolean value of the next item, or None if the next item is not a boolean

def read_float(self) -> float | None:
2116    def read_float(self) -> Optional[float]:
2117        if isinstance(self.data, (int, float, str)):
2118            return float(self.data)
2119        return None

Consume the next item as a float value

Returns the float value of the next item, or None if the next item is not a float

def read_iri(self) -> str | None:
2121    def read_iri(self) -> Optional[str]:
2122        if isinstance(self.data, str):
2123            return self.data
2124        return None

Consumes the next item as an IRI string

Returns the string value of the next item an IRI, or None if the next item is not an IRI.

The returned string should be either a fully-qualified IRI, or a blank node ID

def read_enum(self, e: EnumProp) -> str | None:
2126    def read_enum(self, e: EnumProp) -> Optional[str]:
2127        if isinstance(self.data, str):
2128            return self.data
2129        return None

Consumes the next item as an Enum value string

Returns the fully qualified IRI of the next enum item, or None if the next item is not an enum value.

The callee is responsible for validating that the returned IRI is actually a member of the specified Enum, so the Decoder does not need to check that, but can if it wishes

def read_list(self) -> Iterator[JSONLDDecoder]:
2131    def read_list(self) -> Iterator["JSONLDDecoder"]:
2132        if self.is_list():
2133            for v in self.data:
2134                yield self.__class__(v)
2135        else:
2136            yield self

Consume the next item as a list generator

This should generate a Decoder object for each item in the list. The generated Decoder can be used to read the corresponding item from the list

def is_list(self) -> bool:
2138    def is_list(self) -> bool:
2139        return isinstance(self.data, (list, tuple, set))

Checks if the next item is a list

Returns True if the next item is a list, or False if it is a scalar

@contextmanager
def read_property( self, key: str) -> Iterator[JSONLDDecoder | None]:
2147    @contextmanager
2148    def read_property(self, key: str) -> Iterator[Optional["JSONLDDecoder"]]:
2149        v = self.__get_value(key)
2150        if v is not None:
2151            yield self.__class__(v)
2152        else:
2153            yield None

Read property from object

A context manager that yields a Decoder that can be used to read the value of the property with the given key in current object, or None if the property does not exist in the current object.

def is_object(self) -> bool:
2155    def is_object(self) -> bool:
2156        return isinstance(self.data, dict)

Checks if the item is an object

Returns True if the item is an object, or False if is not

def object_keys(self) -> Iterator[str]:
2158    def object_keys(self) -> Iterator[str]:
2159        for key in self.data.keys():
2160            if key in ("@type", "type"):
2161                continue
2162            if self.root and key == "@context":
2163                continue
2164            yield key

Read property keys from an object

Iterates over all the serialized keys for the current object

def read_object( self) -> Tuple[Any, JSONLDDecoder]:
2166    def read_object(self) -> Tuple[Any, "JSONLDDecoder"]:
2167        typ = self.__get_value("@type", "type")
2168        if typ is not None:
2169            return typ, self
2170
2171        return None, self

Consume next item as an object

A context manager that "enters" the next item as a object and yields a Decoder that can read properties from it. If the next item is not an object, yields None

Properties will be read out of the object using read_property and read_object_id

def read_object_id(self, alias: str | None = None) -> Any | None:
2173    def read_object_id(self, alias: Optional[str] = None) -> Optional[Any]:
2174        return self.__get_value(alias, "@id")

Read current object ID property

Returns the ID of the current object if one is defined, or None if the current object has no ID.

The ID must be a fully qualified IRI or a blank node

If alias is provided, is is a hint as to another name by which the ID might be found, if the Decoder supports aliases for an ID

class JSONLDDeserializer:
2177class JSONLDDeserializer(object):
2178    """Deserializes SHACL objects from JSON-LD data or files into a SHACLObjectSet."""
2179
2180    def deserialize_data(self, data: Any, objectset: SHACLObjectSet) -> None:
2181        """Decode SHACL objects from a pre-parsed JSON-LD data structure into the given object set."""
2182        h = JSONLDDecoder(data, True)
2183
2184        with h.read_property("@context") as context_prop:
2185            if context_prop:
2186                decode_context(context_prop, objectset)
2187
2188        state = DecodeState(objectset)
2189        with h.read_property("@graph") as graph_prop:
2190            objectset.decode(graph_prop if graph_prop else h, state)
2191
2192    def read(self, f: BinaryIO, objectset: SHACLObjectSet) -> None:
2193        """Parse a JSON-LD file and deserialize its objects into the given object set."""
2194        data = json.load(f)
2195        self.deserialize_data(data, objectset)

Deserializes SHACL objects from JSON-LD data or files into a SHACLObjectSet.

def deserialize_data( self, data: Any, objectset: SHACLObjectSet) -> None:
2180    def deserialize_data(self, data: Any, objectset: SHACLObjectSet) -> None:
2181        """Decode SHACL objects from a pre-parsed JSON-LD data structure into the given object set."""
2182        h = JSONLDDecoder(data, True)
2183
2184        with h.read_property("@context") as context_prop:
2185            if context_prop:
2186                decode_context(context_prop, objectset)
2187
2188        state = DecodeState(objectset)
2189        with h.read_property("@graph") as graph_prop:
2190            objectset.decode(graph_prop if graph_prop else h, state)

Decode SHACL objects from a pre-parsed JSON-LD data structure into the given object set.

def read( self, f: <class 'BinaryIO'>, objectset: SHACLObjectSet) -> None:
2192    def read(self, f: BinaryIO, objectset: SHACLObjectSet) -> None:
2193        """Parse a JSON-LD file and deserialize its objects into the given object set."""
2194        data = json.load(f)
2195        self.deserialize_data(data, objectset)

Parse a JSON-LD file and deserialize its objects into the given object set.

class Encoder(abc.ABC):
2198class Encoder(ABC):
2199    """Abstract interface for writing typed values and objects to a serialized output."""
2200
2201    @abstractmethod
2202    def write_string(self, v: str) -> None:
2203        """
2204        Write a string value
2205
2206        Encodes the value as a string in the output
2207        """
2208        raise NotImplementedError("Subclasses must implement write_string method")
2209
2210    @abstractmethod
2211    def write_datetime(self, v: str) -> None:
2212        """
2213        Write a date & time string
2214
2215        Encodes the value as an ISO datetime string
2216
2217        Note: The provided string is already correctly encoded as an ISO datetime
2218        """
2219        raise NotImplementedError("Subclasses must implement write_datetime method")
2220
2221    @abstractmethod
2222    def write_integer(self, v: int) -> None:
2223        """
2224        Write an integer value
2225
2226        Encodes the value as an integer in the output
2227        """
2228        raise NotImplementedError("Subclasses must implement write_integer method")
2229
2230    @abstractmethod
2231    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2232        """
2233        Write IRI
2234
2235        Encodes the string as an IRI. Note that the string will be either a
2236        fully qualified IRI or a blank node ID. If `compact` is provided and
2237        the serialization supports compacted IRIs, it should be preferred to
2238        the full IRI
2239        """
2240        raise NotImplementedError("Subclasses must implement write_iri method")
2241
2242    @abstractmethod
2243    def write_enum(
2244        self, v: str, e: Property[Any], compact: Optional[str] = None
2245    ) -> None:
2246        """
2247        Write enum value IRI
2248
2249        Encodes the string enum value IRI. Note that the string will be a fully
2250        qualified IRI. If `compact` is provided and the serialization supports
2251        compacted IRIs, it should be preferred to the full IRI.
2252        """
2253        raise NotImplementedError("Subclasses must implement write_enum method")
2254
2255    @abstractmethod
2256    def write_bool(self, v: bool) -> None:
2257        """
2258        Write boolean
2259
2260        Encodes the value as a boolean in the output
2261        """
2262        raise NotImplementedError("Subclasses must implement write_bool method")
2263
2264    @abstractmethod
2265    def write_float(self, v: float) -> None:
2266        """
2267        Write float
2268
2269        Encodes the value as a floating point number in the output
2270        """
2271        raise NotImplementedError("Subclasses must implement write_float method")
2272
2273    @abstractmethod
2274    @contextmanager
2275    def write_object(
2276        self,
2277        typ: str,
2278        compact_type: Optional[str],
2279        id_alias: Optional[str],
2280        _id: str,
2281        compact_id: Optional[str],
2282        needs_id: bool,
2283    ) -> Iterator["Encoder"]:
2284        """
2285        Write object
2286
2287        A context manager that yields an `Encoder` that can be used to encode
2288        the given object properties.
2289
2290        The provided ID will always be a valid ID (even if o._id is `None`), in
2291        case the `Encoder` _must_ have an ID. `needs_id` is a hint to indicate
2292        to the `Encoder` if an ID must be written or not (if that is even an
2293        option). If it is `True`, the `Encoder` must encode an ID for the
2294        object. If `False`, the encoder is not required to encode an ID and may
2295        omit it.
2296
2297        The ID will be either a fully qualified IRI, or a blank node IRI.
2298
2299        Properties will be written the object using `write_property`
2300        """
2301        raise NotImplementedError("Subclasses must implement write_object method")
2302
2303    @abstractmethod
2304    @contextmanager
2305    def write_property(
2306        self, iri: str, compact: Optional[str] = None
2307    ) -> Iterator["Encoder"]:
2308        """
2309        Write object property
2310
2311        A context manager that yields an `Encoder` that can be used to encode
2312        the value for the property with the given IRI in the current object
2313
2314        Note that the IRI will be fully qualified. If `compact` is provided and
2315        the serialization supports compacted IRIs, it should be preferred to
2316        the full IRI.
2317        """
2318        raise NotImplementedError("Subclasses must implement write_property method")
2319
2320    @abstractmethod
2321    @contextmanager
2322    def write_list(self) -> Iterator["Encoder"]:
2323        """
2324        Write list
2325
2326        A context manager that yields an `Encoder` that can be used to encode a
2327        list.
2328
2329        Each item of the list will be added using `write_list_item`
2330        """
2331        raise NotImplementedError("Subclasses must implement write_list method")
2332
2333    @abstractmethod
2334    @contextmanager
2335    def write_list_item(self) -> Iterator["Encoder"]:
2336        """
2337        Write list item
2338
2339        A context manager that yields an `Encoder` that can be used to encode
2340        the value for a list item
2341        """
2342        raise NotImplementedError("Subclasses must implement write_list_item method")
2343
2344    @abstractmethod
2345    @contextmanager
2346    def write_object_list(self) -> Iterator["Encoder"]:
2347        """
2348        Write top level object list
2349
2350        A context manager that yields an `Encoder` that encodes the top level
2351        list of objects.
2352
2353        Each object in the list will be added using `write_list_item`
2354        """
2355        raise NotImplementedError("Subclasses must implement write_object_list method")
2356
2357    @abstractmethod
2358    @contextmanager
2359    def write_dict(self) -> Iterator["Encoder"]:
2360        """
2361        Write dict
2362
2363        A context manager that yields an `Encoder` that can be used to encode a
2364        dictionary.
2365        """
2366        raise NotImplementedError("Subclasses must implement write_dict method")

Helper class that provides a standard way to create an ABC using inheritance.

@abstractmethod
def write_string(self, v: str) -> None:
2201    @abstractmethod
2202    def write_string(self, v: str) -> None:
2203        """
2204        Write a string value
2205
2206        Encodes the value as a string in the output
2207        """
2208        raise NotImplementedError("Subclasses must implement write_string method")

Write a string value

Encodes the value as a string in the output

@abstractmethod
def write_datetime(self, v: str) -> None:
2210    @abstractmethod
2211    def write_datetime(self, v: str) -> None:
2212        """
2213        Write a date & time string
2214
2215        Encodes the value as an ISO datetime string
2216
2217        Note: The provided string is already correctly encoded as an ISO datetime
2218        """
2219        raise NotImplementedError("Subclasses must implement write_datetime method")

Write a date & time string

Encodes the value as an ISO datetime string

Note: The provided string is already correctly encoded as an ISO datetime

@abstractmethod
def write_integer(self, v: int) -> None:
2221    @abstractmethod
2222    def write_integer(self, v: int) -> None:
2223        """
2224        Write an integer value
2225
2226        Encodes the value as an integer in the output
2227        """
2228        raise NotImplementedError("Subclasses must implement write_integer method")

Write an integer value

Encodes the value as an integer in the output

@abstractmethod
def write_iri(self, v: str, compact: str | None = None) -> None:
2230    @abstractmethod
2231    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2232        """
2233        Write IRI
2234
2235        Encodes the string as an IRI. Note that the string will be either a
2236        fully qualified IRI or a blank node ID. If `compact` is provided and
2237        the serialization supports compacted IRIs, it should be preferred to
2238        the full IRI
2239        """
2240        raise NotImplementedError("Subclasses must implement write_iri method")

Write IRI

Encodes the string as an IRI. Note that the string will be either a fully qualified IRI or a blank node ID. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI

@abstractmethod
def write_enum( self, v: str, e: Property[typing.Any], compact: str | None = None) -> None:
2242    @abstractmethod
2243    def write_enum(
2244        self, v: str, e: Property[Any], compact: Optional[str] = None
2245    ) -> None:
2246        """
2247        Write enum value IRI
2248
2249        Encodes the string enum value IRI. Note that the string will be a fully
2250        qualified IRI. If `compact` is provided and the serialization supports
2251        compacted IRIs, it should be preferred to the full IRI.
2252        """
2253        raise NotImplementedError("Subclasses must implement write_enum method")

Write enum value IRI

Encodes the string enum value IRI. Note that the string will be a fully qualified IRI. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

@abstractmethod
def write_bool(self, v: bool) -> None:
2255    @abstractmethod
2256    def write_bool(self, v: bool) -> None:
2257        """
2258        Write boolean
2259
2260        Encodes the value as a boolean in the output
2261        """
2262        raise NotImplementedError("Subclasses must implement write_bool method")

Write boolean

Encodes the value as a boolean in the output

@abstractmethod
def write_float(self, v: float) -> None:
2264    @abstractmethod
2265    def write_float(self, v: float) -> None:
2266        """
2267        Write float
2268
2269        Encodes the value as a floating point number in the output
2270        """
2271        raise NotImplementedError("Subclasses must implement write_float method")

Write float

Encodes the value as a floating point number in the output

@abstractmethod
@contextmanager
def write_object( self, typ: str, compact_type: str | None, id_alias: str | None, _id: str, compact_id: str | None, needs_id: bool) -> Iterator[Encoder]:
2273    @abstractmethod
2274    @contextmanager
2275    def write_object(
2276        self,
2277        typ: str,
2278        compact_type: Optional[str],
2279        id_alias: Optional[str],
2280        _id: str,
2281        compact_id: Optional[str],
2282        needs_id: bool,
2283    ) -> Iterator["Encoder"]:
2284        """
2285        Write object
2286
2287        A context manager that yields an `Encoder` that can be used to encode
2288        the given object properties.
2289
2290        The provided ID will always be a valid ID (even if o._id is `None`), in
2291        case the `Encoder` _must_ have an ID. `needs_id` is a hint to indicate
2292        to the `Encoder` if an ID must be written or not (if that is even an
2293        option). If it is `True`, the `Encoder` must encode an ID for the
2294        object. If `False`, the encoder is not required to encode an ID and may
2295        omit it.
2296
2297        The ID will be either a fully qualified IRI, or a blank node IRI.
2298
2299        Properties will be written the object using `write_property`
2300        """
2301        raise NotImplementedError("Subclasses must implement write_object method")

Write object

A context manager that yields an Encoder that can be used to encode the given object properties.

The provided ID will always be a valid ID (even if o._id is None), in case the Encoder _must_ have an ID. needs_id is a hint to indicate to the Encoder if an ID must be written or not (if that is even an option). If it is True, the Encoder must encode an ID for the object. If False, the encoder is not required to encode an ID and may omit it.

The ID will be either a fully qualified IRI, or a blank node IRI.

Properties will be written the object using write_property

@abstractmethod
@contextmanager
def write_property( self, iri: str, compact: str | None = None) -> Iterator[Encoder]:
2303    @abstractmethod
2304    @contextmanager
2305    def write_property(
2306        self, iri: str, compact: Optional[str] = None
2307    ) -> Iterator["Encoder"]:
2308        """
2309        Write object property
2310
2311        A context manager that yields an `Encoder` that can be used to encode
2312        the value for the property with the given IRI in the current object
2313
2314        Note that the IRI will be fully qualified. If `compact` is provided and
2315        the serialization supports compacted IRIs, it should be preferred to
2316        the full IRI.
2317        """
2318        raise NotImplementedError("Subclasses must implement write_property method")

Write object property

A context manager that yields an Encoder that can be used to encode the value for the property with the given IRI in the current object

Note that the IRI will be fully qualified. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

@abstractmethod
@contextmanager
def write_list(self) -> Iterator[Encoder]:
2320    @abstractmethod
2321    @contextmanager
2322    def write_list(self) -> Iterator["Encoder"]:
2323        """
2324        Write list
2325
2326        A context manager that yields an `Encoder` that can be used to encode a
2327        list.
2328
2329        Each item of the list will be added using `write_list_item`
2330        """
2331        raise NotImplementedError("Subclasses must implement write_list method")

Write list

A context manager that yields an Encoder that can be used to encode a list.

Each item of the list will be added using write_list_item

@abstractmethod
@contextmanager
def write_list_item(self) -> Iterator[Encoder]:
2333    @abstractmethod
2334    @contextmanager
2335    def write_list_item(self) -> Iterator["Encoder"]:
2336        """
2337        Write list item
2338
2339        A context manager that yields an `Encoder` that can be used to encode
2340        the value for a list item
2341        """
2342        raise NotImplementedError("Subclasses must implement write_list_item method")

Write list item

A context manager that yields an Encoder that can be used to encode the value for a list item

@abstractmethod
@contextmanager
def write_object_list(self) -> Iterator[Encoder]:
2344    @abstractmethod
2345    @contextmanager
2346    def write_object_list(self) -> Iterator["Encoder"]:
2347        """
2348        Write top level object list
2349
2350        A context manager that yields an `Encoder` that encodes the top level
2351        list of objects.
2352
2353        Each object in the list will be added using `write_list_item`
2354        """
2355        raise NotImplementedError("Subclasses must implement write_object_list method")

Write top level object list

A context manager that yields an Encoder that encodes the top level list of objects.

Each object in the list will be added using write_list_item

@abstractmethod
@contextmanager
def write_dict(self) -> Iterator[Encoder]:
2357    @abstractmethod
2358    @contextmanager
2359    def write_dict(self) -> Iterator["Encoder"]:
2360        """
2361        Write dict
2362
2363        A context manager that yields an `Encoder` that can be used to encode a
2364        dictionary.
2365        """
2366        raise NotImplementedError("Subclasses must implement write_dict method")

Write dict

A context manager that yields an Encoder that can be used to encode a dictionary.

class JSONLDEncoder(Encoder):
2369class JSONLDEncoder(Encoder):
2370    """Encoder that builds a JSON-LD Python data structure (dicts/lists) for later JSON serialization."""
2371
2372    def __init__(self, data: Optional[Any] = None) -> None:
2373        self.data: Any = data
2374
2375    def write_string(self, v: str) -> None:
2376        self.data = v
2377
2378    def write_datetime(self, v: str) -> None:
2379        self.data = v
2380
2381    def write_integer(self, v: int) -> None:
2382        self.data = v
2383
2384    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2385        self.write_string(compact or v)
2386
2387    def write_enum(self, v: str, e: Any, compact: Optional[str] = None) -> None:
2388        self.write_string(compact or v)
2389
2390    def write_bool(self, v: bool) -> None:
2391        self.data = v
2392
2393    def write_float(self, v: float) -> None:
2394        self.data = str(v)
2395
2396    @contextmanager
2397    def write_property(
2398        self, iri: str, compact: Optional[str] = None
2399    ) -> Iterator["JSONLDEncoder"]:
2400        s = self.__class__(None)
2401        yield s
2402        if s.data is not None:
2403            # within write_object() context, self.data is expected to be a dict
2404            if not isinstance(self.data, dict):
2405                raise TypeError(
2406                    "Encoder.write_property used outside of write_object context; encoder.data is not a dict"
2407                )
2408            self.data[compact or iri] = s.data
2409
2410    @contextmanager
2411    def write_dict(self) -> Iterator["JSONLDEncoder"]:
2412        if not self.data:
2413            self.data = {}
2414        yield self
2415
2416    @contextmanager
2417    def write_object(
2418        self,
2419        typ: str,
2420        compact_type: Optional[str],
2421        id_alias: Optional[str],
2422        _id: str,
2423        compact_id: Optional[str],
2424        needs_id: bool,
2425    ) -> Iterator["JSONLDEncoder"]:
2426        with self.write_dict() as obj_dict:
2427            obj_dict.data["type"] = compact_type or typ
2428            if needs_id:
2429                obj_dict.data[id_alias or "@id"] = compact_id or _id
2430            yield obj_dict
2431
2432    @contextmanager
2433    def write_list(self) -> Iterator["JSONLDEncoder"]:
2434        self.data = []
2435        yield self
2436        if not self.data:
2437            self.data = None
2438
2439    @contextmanager
2440    def write_list_item(self) -> Iterator["JSONLDEncoder"]:
2441        s = self.__class__(None)
2442        yield s
2443        if s.data is not None:
2444            if not isinstance(self.data, list):
2445                raise TypeError(
2446                    "Encoder.write_list_item used outside of write_list context; encoder.data is not a list"
2447                )
2448            self.data.append(s.data)
2449
2450    @contextmanager
2451    def write_object_list(self) -> Iterator["JSONLDEncoder"]:
2452        with self.write_property("@graph") as graph_prop:
2453            with graph_prop.write_list() as graph_list:
2454                yield graph_list

Encoder that builds a JSON-LD Python data structure (dicts/lists) for later JSON serialization.

JSONLDEncoder(data: Any | None = None)
2372    def __init__(self, data: Optional[Any] = None) -> None:
2373        self.data: Any = data
data: Any
def write_string(self, v: str) -> None:
2375    def write_string(self, v: str) -> None:
2376        self.data = v

Write a string value

Encodes the value as a string in the output

def write_datetime(self, v: str) -> None:
2378    def write_datetime(self, v: str) -> None:
2379        self.data = v

Write a date & time string

Encodes the value as an ISO datetime string

Note: The provided string is already correctly encoded as an ISO datetime

def write_integer(self, v: int) -> None:
2381    def write_integer(self, v: int) -> None:
2382        self.data = v

Write an integer value

Encodes the value as an integer in the output

def write_iri(self, v: str, compact: str | None = None) -> None:
2384    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2385        self.write_string(compact or v)

Write IRI

Encodes the string as an IRI. Note that the string will be either a fully qualified IRI or a blank node ID. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI

def write_enum(self, v: str, e: Any, compact: str | None = None) -> None:
2387    def write_enum(self, v: str, e: Any, compact: Optional[str] = None) -> None:
2388        self.write_string(compact or v)

Write enum value IRI

Encodes the string enum value IRI. Note that the string will be a fully qualified IRI. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

def write_bool(self, v: bool) -> None:
2390    def write_bool(self, v: bool) -> None:
2391        self.data = v

Write boolean

Encodes the value as a boolean in the output

def write_float(self, v: float) -> None:
2393    def write_float(self, v: float) -> None:
2394        self.data = str(v)

Write float

Encodes the value as a floating point number in the output

@contextmanager
def write_property( self, iri: str, compact: str | None = None) -> Iterator[JSONLDEncoder]:
2396    @contextmanager
2397    def write_property(
2398        self, iri: str, compact: Optional[str] = None
2399    ) -> Iterator["JSONLDEncoder"]:
2400        s = self.__class__(None)
2401        yield s
2402        if s.data is not None:
2403            # within write_object() context, self.data is expected to be a dict
2404            if not isinstance(self.data, dict):
2405                raise TypeError(
2406                    "Encoder.write_property used outside of write_object context; encoder.data is not a dict"
2407                )
2408            self.data[compact or iri] = s.data

Write object property

A context manager that yields an Encoder that can be used to encode the value for the property with the given IRI in the current object

Note that the IRI will be fully qualified. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

@contextmanager
def write_dict(self) -> Iterator[JSONLDEncoder]:
2410    @contextmanager
2411    def write_dict(self) -> Iterator["JSONLDEncoder"]:
2412        if not self.data:
2413            self.data = {}
2414        yield self

Write dict

A context manager that yields an Encoder that can be used to encode a dictionary.

@contextmanager
def write_object( self, typ: str, compact_type: str | None, id_alias: str | None, _id: str, compact_id: str | None, needs_id: bool) -> Iterator[JSONLDEncoder]:
2416    @contextmanager
2417    def write_object(
2418        self,
2419        typ: str,
2420        compact_type: Optional[str],
2421        id_alias: Optional[str],
2422        _id: str,
2423        compact_id: Optional[str],
2424        needs_id: bool,
2425    ) -> Iterator["JSONLDEncoder"]:
2426        with self.write_dict() as obj_dict:
2427            obj_dict.data["type"] = compact_type or typ
2428            if needs_id:
2429                obj_dict.data[id_alias or "@id"] = compact_id or _id
2430            yield obj_dict

Write object

A context manager that yields an Encoder that can be used to encode the given object properties.

The provided ID will always be a valid ID (even if o._id is None), in case the Encoder _must_ have an ID. needs_id is a hint to indicate to the Encoder if an ID must be written or not (if that is even an option). If it is True, the Encoder must encode an ID for the object. If False, the encoder is not required to encode an ID and may omit it.

The ID will be either a fully qualified IRI, or a blank node IRI.

Properties will be written the object using write_property

@contextmanager
def write_list(self) -> Iterator[JSONLDEncoder]:
2432    @contextmanager
2433    def write_list(self) -> Iterator["JSONLDEncoder"]:
2434        self.data = []
2435        yield self
2436        if not self.data:
2437            self.data = None

Write list

A context manager that yields an Encoder that can be used to encode a list.

Each item of the list will be added using write_list_item

@contextmanager
def write_list_item(self) -> Iterator[JSONLDEncoder]:
2439    @contextmanager
2440    def write_list_item(self) -> Iterator["JSONLDEncoder"]:
2441        s = self.__class__(None)
2442        yield s
2443        if s.data is not None:
2444            if not isinstance(self.data, list):
2445                raise TypeError(
2446                    "Encoder.write_list_item used outside of write_list context; encoder.data is not a list"
2447                )
2448            self.data.append(s.data)

Write list item

A context manager that yields an Encoder that can be used to encode the value for a list item

@contextmanager
def write_object_list(self) -> Iterator[JSONLDEncoder]:
2450    @contextmanager
2451    def write_object_list(self) -> Iterator["JSONLDEncoder"]:
2452        with self.write_property("@graph") as graph_prop:
2453            with graph_prop.write_list() as graph_list:
2454                yield graph_list

Write top level object list

A context manager that yields an Encoder that encodes the top level list of objects.

Each object in the list will be added using write_list_item

class JSONLDSerializer:
2457class JSONLDSerializer(object):
2458    """Serializes a SHACLObjectSet to a JSON-LD file or in-memory data structure."""
2459
2460    def __init__(self, **args: Any) -> None:
2461        self.args = args
2462
2463    def serialize_data(
2464        self,
2465        objectset: SHACLObjectSet,
2466        force_at_graph: bool = False,
2467    ) -> Any:
2468        """Encode the object set to a JSON-LD Python data structure and return it."""
2469        h = JSONLDEncoder()
2470        state = EncodeState(objectset)
2471        with h.write_dict() as doc_s:
2472            encode_context(doc_s, objectset)
2473            objectset.encode(doc_s, state, force_at_graph)
2474        return h.data
2475
2476    def write(
2477        self,
2478        objectset: SHACLObjectSet,
2479        f: BinaryIO,
2480        force_at_graph: bool = False,
2481        **kwargs: Any,
2482    ) -> str:
2483        """
2484        Write a SHACLObjectSet to a JSON LD file
2485
2486        If force_at_graph is True, a @graph node will always be written
2487
2488        Note that f should be a file-like object that supports the `write`
2489        method, and that opens in binary mode (e.g. `open("file.json", "wb")`).
2490        """
2491        data = self.serialize_data(objectset, force_at_graph)
2492
2493        args = {**self.args, **kwargs}
2494
2495        sha1 = hashlib.sha1()
2496        for chunk in json.JSONEncoder(**args).iterencode(data):
2497            chunk_bytes = chunk.encode("utf-8")
2498            f.write(chunk_bytes)
2499            sha1.update(chunk_bytes)
2500
2501        return sha1.hexdigest()

Serializes a SHACLObjectSet to a JSON-LD file or in-memory data structure.

JSONLDSerializer(**kwargs: Any)
2460    def __init__(self, **args: Any) -> None:
2461        self.args = args
args
def serialize_data( self, objectset: SHACLObjectSet, force_at_graph: bool = False) -> Any:
2463    def serialize_data(
2464        self,
2465        objectset: SHACLObjectSet,
2466        force_at_graph: bool = False,
2467    ) -> Any:
2468        """Encode the object set to a JSON-LD Python data structure and return it."""
2469        h = JSONLDEncoder()
2470        state = EncodeState(objectset)
2471        with h.write_dict() as doc_s:
2472            encode_context(doc_s, objectset)
2473            objectset.encode(doc_s, state, force_at_graph)
2474        return h.data

Encode the object set to a JSON-LD Python data structure and return it.

def write( self, objectset: SHACLObjectSet, f: <class 'BinaryIO'>, force_at_graph: bool = False, **kwargs: Any) -> str:
2476    def write(
2477        self,
2478        objectset: SHACLObjectSet,
2479        f: BinaryIO,
2480        force_at_graph: bool = False,
2481        **kwargs: Any,
2482    ) -> str:
2483        """
2484        Write a SHACLObjectSet to a JSON LD file
2485
2486        If force_at_graph is True, a @graph node will always be written
2487
2488        Note that f should be a file-like object that supports the `write`
2489        method, and that opens in binary mode (e.g. `open("file.json", "wb")`).
2490        """
2491        data = self.serialize_data(objectset, force_at_graph)
2492
2493        args = {**self.args, **kwargs}
2494
2495        sha1 = hashlib.sha1()
2496        for chunk in json.JSONEncoder(**args).iterencode(data):
2497            chunk_bytes = chunk.encode("utf-8")
2498            f.write(chunk_bytes)
2499            sha1.update(chunk_bytes)
2500
2501        return sha1.hexdigest()

Write a SHACLObjectSet to a JSON LD file

If force_at_graph is True, a @graph node will always be written

Note that f should be a file-like object that supports the write method, and that opens in binary mode (e.g. open("file.json", "wb")).

class JSONLDInlineEncoder(Encoder):
2504class JSONLDInlineEncoder(Encoder):
2505    """Encoder that writes JSON-LD output directly to a binary file stream, computing a SHA-1 hash."""
2506
2507    def __init__(self, f: BinaryIO, sha1: Any, in_dict: bool = False) -> None:
2508        self.f: BinaryIO = f
2509        self.comma: bool = False
2510        self.sha1: Any = sha1
2511        self.in_dict: bool = in_dict
2512
2513    def write(self, s: str) -> None:
2514        """Write a raw string to the output stream and update the SHA-1 hash."""
2515        b = s.encode("utf-8")
2516        self.f.write(b)
2517        self.sha1.update(b)
2518
2519    def _write_comma(self) -> None:
2520        if self.comma:
2521            self.write(",")
2522            self.comma = False
2523
2524    def write_string(self, v: str) -> None:
2525        self.write(json.dumps(v))
2526
2527    def write_datetime(self, v: str) -> None:
2528        self.write_string(v)
2529
2530    def write_integer(self, v: int) -> None:
2531        self.write(f"{v}")
2532
2533    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2534        self.write_string(compact or v)
2535
2536    def write_enum(self, v: str, e: Any, compact: Optional[str] = None) -> None:
2537        self.write_iri(v, compact)
2538
2539    def write_bool(self, v: bool) -> None:
2540        if v:
2541            self.write("true")
2542        else:
2543            self.write("false")
2544
2545    def write_float(self, v: float) -> None:
2546        self.write(json.dumps(str(v)))
2547
2548    @contextmanager
2549    def write_property(
2550        self, iri: str, compact: Optional[str] = None
2551    ) -> Iterator["JSONLDInlineEncoder"]:
2552        self._write_comma()
2553        self.write_string(compact or iri)
2554        self.write(":")
2555        yield self.__class__(self.f, self.sha1)
2556        self.comma = True
2557
2558    @contextmanager
2559    def write_dict(self) -> Iterator["JSONLDInlineEncoder"]:
2560        self._write_comma()
2561        if self.in_dict:
2562            yield self
2563            return
2564
2565        self.write("{")
2566        yield self.__class__(self.f, self.sha1, True)
2567        self.write("}")
2568        self.comma = True
2569
2570    @contextmanager
2571    def write_object(
2572        self,
2573        typ: str,
2574        compact_type: Optional[str],
2575        id_alias: Optional[str],
2576        _id: str,
2577        compact_id: Optional[str],
2578        needs_id: bool,
2579    ) -> Iterator["JSONLDInlineEncoder"]:
2580        with self.write_dict() as obj_dict:
2581            with obj_dict.write_property(
2582                "type"
2583            ) as type_prop:
2584                type_prop.write_string(compact_type or typ)
2585
2586            if needs_id:
2587                with obj_dict.write_property(id_alias or "@id") as id_prop:
2588                    id_prop.write_string(compact_id or _id)
2589
2590            yield obj_dict
2591
2592    @contextmanager
2593    def write_list(self) -> Iterator["JSONLDInlineEncoder"]:
2594        self._write_comma()
2595        self.write("[")
2596        yield self.__class__(self.f, self.sha1)
2597        self.write("]")
2598        self.comma = True
2599
2600    @contextmanager
2601    def write_list_item(self) -> Iterator["JSONLDInlineEncoder"]:
2602        self._write_comma()
2603        yield self.__class__(self.f, self.sha1)
2604        self.comma = True
2605
2606    @contextmanager
2607    def write_object_list(self) -> Iterator["JSONLDInlineEncoder"]:
2608        with self.write_property("@graph") as graph_prop:
2609            with graph_prop.write_list() as graph_list:
2610                yield graph_list

Encoder that writes JSON-LD output directly to a binary file stream, computing a SHA-1 hash.

JSONLDInlineEncoder(f: <class 'BinaryIO'>, sha1: Any, in_dict: bool = False)
2507    def __init__(self, f: BinaryIO, sha1: Any, in_dict: bool = False) -> None:
2508        self.f: BinaryIO = f
2509        self.comma: bool = False
2510        self.sha1: Any = sha1
2511        self.in_dict: bool = in_dict
f: <class 'BinaryIO'>
comma: bool
sha1: Any
in_dict: bool
def write(self, s: str) -> None:
2513    def write(self, s: str) -> None:
2514        """Write a raw string to the output stream and update the SHA-1 hash."""
2515        b = s.encode("utf-8")
2516        self.f.write(b)
2517        self.sha1.update(b)

Write a raw string to the output stream and update the SHA-1 hash.

def write_string(self, v: str) -> None:
2524    def write_string(self, v: str) -> None:
2525        self.write(json.dumps(v))

Write a string value

Encodes the value as a string in the output

def write_datetime(self, v: str) -> None:
2527    def write_datetime(self, v: str) -> None:
2528        self.write_string(v)

Write a date & time string

Encodes the value as an ISO datetime string

Note: The provided string is already correctly encoded as an ISO datetime

def write_integer(self, v: int) -> None:
2530    def write_integer(self, v: int) -> None:
2531        self.write(f"{v}")

Write an integer value

Encodes the value as an integer in the output

def write_iri(self, v: str, compact: str | None = None) -> None:
2533    def write_iri(self, v: str, compact: Optional[str] = None) -> None:
2534        self.write_string(compact or v)

Write IRI

Encodes the string as an IRI. Note that the string will be either a fully qualified IRI or a blank node ID. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI

def write_enum(self, v: str, e: Any, compact: str | None = None) -> None:
2536    def write_enum(self, v: str, e: Any, compact: Optional[str] = None) -> None:
2537        self.write_iri(v, compact)

Write enum value IRI

Encodes the string enum value IRI. Note that the string will be a fully qualified IRI. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

def write_bool(self, v: bool) -> None:
2539    def write_bool(self, v: bool) -> None:
2540        if v:
2541            self.write("true")
2542        else:
2543            self.write("false")

Write boolean

Encodes the value as a boolean in the output

def write_float(self, v: float) -> None:
2545    def write_float(self, v: float) -> None:
2546        self.write(json.dumps(str(v)))

Write float

Encodes the value as a floating point number in the output

@contextmanager
def write_property( self, iri: str, compact: str | None = None) -> Iterator[JSONLDInlineEncoder]:
2548    @contextmanager
2549    def write_property(
2550        self, iri: str, compact: Optional[str] = None
2551    ) -> Iterator["JSONLDInlineEncoder"]:
2552        self._write_comma()
2553        self.write_string(compact or iri)
2554        self.write(":")
2555        yield self.__class__(self.f, self.sha1)
2556        self.comma = True

Write object property

A context manager that yields an Encoder that can be used to encode the value for the property with the given IRI in the current object

Note that the IRI will be fully qualified. If compact is provided and the serialization supports compacted IRIs, it should be preferred to the full IRI.

@contextmanager
def write_dict( self) -> Iterator[JSONLDInlineEncoder]:
2558    @contextmanager
2559    def write_dict(self) -> Iterator["JSONLDInlineEncoder"]:
2560        self._write_comma()
2561        if self.in_dict:
2562            yield self
2563            return
2564
2565        self.write("{")
2566        yield self.__class__(self.f, self.sha1, True)
2567        self.write("}")
2568        self.comma = True

Write dict

A context manager that yields an Encoder that can be used to encode a dictionary.

@contextmanager
def write_object( self, typ: str, compact_type: str | None, id_alias: str | None, _id: str, compact_id: str | None, needs_id: bool) -> Iterator[JSONLDInlineEncoder]:
2570    @contextmanager
2571    def write_object(
2572        self,
2573        typ: str,
2574        compact_type: Optional[str],
2575        id_alias: Optional[str],
2576        _id: str,
2577        compact_id: Optional[str],
2578        needs_id: bool,
2579    ) -> Iterator["JSONLDInlineEncoder"]:
2580        with self.write_dict() as obj_dict:
2581            with obj_dict.write_property(
2582                "type"
2583            ) as type_prop:
2584                type_prop.write_string(compact_type or typ)
2585
2586            if needs_id:
2587                with obj_dict.write_property(id_alias or "@id") as id_prop:
2588                    id_prop.write_string(compact_id or _id)
2589
2590            yield obj_dict

Write object

A context manager that yields an Encoder that can be used to encode the given object properties.

The provided ID will always be a valid ID (even if o._id is None), in case the Encoder _must_ have an ID. needs_id is a hint to indicate to the Encoder if an ID must be written or not (if that is even an option). If it is True, the Encoder must encode an ID for the object. If False, the encoder is not required to encode an ID and may omit it.

The ID will be either a fully qualified IRI, or a blank node IRI.

Properties will be written the object using write_property

@contextmanager
def write_list( self) -> Iterator[JSONLDInlineEncoder]:
2592    @contextmanager
2593    def write_list(self) -> Iterator["JSONLDInlineEncoder"]:
2594        self._write_comma()
2595        self.write("[")
2596        yield self.__class__(self.f, self.sha1)
2597        self.write("]")
2598        self.comma = True

Write list

A context manager that yields an Encoder that can be used to encode a list.

Each item of the list will be added using write_list_item

@contextmanager
def write_list_item( self) -> Iterator[JSONLDInlineEncoder]:
2600    @contextmanager
2601    def write_list_item(self) -> Iterator["JSONLDInlineEncoder"]:
2602        self._write_comma()
2603        yield self.__class__(self.f, self.sha1)
2604        self.comma = True

Write list item

A context manager that yields an Encoder that can be used to encode the value for a list item

@contextmanager
def write_object_list( self) -> Iterator[JSONLDInlineEncoder]:
2606    @contextmanager
2607    def write_object_list(self) -> Iterator["JSONLDInlineEncoder"]:
2608        with self.write_property("@graph") as graph_prop:
2609            with graph_prop.write_list() as graph_list:
2610                yield graph_list

Write top level object list

A context manager that yields an Encoder that encodes the top level list of objects.

Each object in the list will be added using write_list_item

class JSONLDInlineSerializer:
2613class JSONLDInlineSerializer(object):
2614    """Serializes a SHACLObjectSet directly to a binary stream, returning a SHA-1 digest."""
2615
2616    def write(
2617        self,
2618        objectset: SHACLObjectSet,
2619        f: BinaryIO,
2620        force_at_graph: bool = False,
2621    ) -> str:
2622        """
2623        Write a SHACLObjectSet to a JSON LD file
2624
2625        Note: force_at_graph is included for compatibility, but ignored. This
2626        serializer always writes out a graph
2627        """
2628        sha1 = hashlib.sha1()
2629        h = JSONLDInlineEncoder(f, sha1)
2630        state = EncodeState(objectset)
2631        with h.write_dict() as doc_s:
2632            encode_context(doc_s, objectset)
2633            objectset.encode(doc_s, state, True)
2634
2635        return sha1.hexdigest()

Serializes a SHACLObjectSet directly to a binary stream, returning a SHA-1 digest.

def write( self, objectset: SHACLObjectSet, f: <class 'BinaryIO'>, force_at_graph: bool = False) -> str:
2616    def write(
2617        self,
2618        objectset: SHACLObjectSet,
2619        f: BinaryIO,
2620        force_at_graph: bool = False,
2621    ) -> str:
2622        """
2623        Write a SHACLObjectSet to a JSON LD file
2624
2625        Note: force_at_graph is included for compatibility, but ignored. This
2626        serializer always writes out a graph
2627        """
2628        sha1 = hashlib.sha1()
2629        h = JSONLDInlineEncoder(f, sha1)
2630        state = EncodeState(objectset)
2631        with h.write_dict() as doc_s:
2632            encode_context(doc_s, objectset)
2633            objectset.encode(doc_s, state, True)
2634
2635        return sha1.hexdigest()

Write a SHACLObjectSet to a JSON LD file

Note: force_at_graph is included for compatibility, but ignored. This serializer always writes out a graph

def encode_context( encoder: Any, objectset: SHACLObjectSet) -> None:
2638def encode_context(encoder: Encoder, objectset: SHACLObjectSet) -> None:
2639    context: List[Union[str, Dict[str, str]]] = list(CONTEXT_URLS)
2640    if objectset.context:
2641        context.append(objectset.context)
2642
2643    if not context:
2644        return
2645
2646    def write_context(e: Encoder, ctx: Union[str, Dict[str, str]]) -> None:
2647        if isinstance(ctx, str):
2648            e.write_string(ctx)
2649        else:
2650            with e.write_dict() as dict_s:
2651                for k, v in ctx.items():
2652                    with dict_s.write_property(k) as ctx_prop:
2653                        ctx_prop.write_string(v)
2654
2655    with encoder.write_property("@context") as context_prop:
2656        if len(context) == 1:
2657            write_context(context_prop, context[0])
2658        else:
2659            with context_prop.write_list() as context_list:
2660                for ctx in context:
2661                    with context_list.write_list_item() as context_list_item:
2662                        write_context(context_list_item, ctx)
def decode_context( decoder: Any, objectset: SHACLObjectSet) -> None:
2665def decode_context(decoder: Decoder, objectset: SHACLObjectSet) -> None:
2666    def _decode_ctx(d: Decoder) -> None:
2667        if not d.is_object():
2668            return
2669
2670        for k in d.object_keys():
2671            with d.read_property(k) as prop_d:
2672                if prop_d:
2673                    if s := prop_d.read_string():
2674                        objectset.context[k] = s
2675
2676    if decoder.is_list():
2677        for ctx_d in decoder.read_list():
2678            _decode_ctx(ctx_d)
2679    else:
2680        _decode_ctx(decoder)
CONTEXT_URLS: List[str] = ['https://spdx.org/rdf/3.0.1/spdx-context.jsonld']
class ai_EnergyConsumption(SHACLObject):
2958class ai_EnergyConsumption(SHACLObject):
2959    """
2960    A class for describing the energy consumption incurred by an AI model in
2961    different stages of its lifecycle.
2962    """
2963
2964    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumption"
2965    COMPACT_TYPE: ClassVar[Optional[str]] = "ai_EnergyConsumption"
2966    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
2967    PROPERTIES: ClassVar[List[ClassProp]] = [
2968        # Specifies the amount of energy consumed when finetuning the AI model that is
2969        # being used in the AI system.
2970        ClassProp(
2971            "ai_finetuningEnergyConsumption",
2972            lambda:
2973            ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2974            iri="https://spdx.org/rdf/3.0.1/terms/AI/finetuningEnergyConsumption",
2975            compact="ai_finetuningEnergyConsumption",
2976            deprecated=False,
2977        ),
2978        # Specifies the amount of energy consumed during inference time by an AI model
2979        # that is being used in the AI system.
2980        ClassProp(
2981            "ai_inferenceEnergyConsumption",
2982            lambda:
2983            ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2984            iri="https://spdx.org/rdf/3.0.1/terms/AI/inferenceEnergyConsumption",
2985            compact="ai_inferenceEnergyConsumption",
2986            deprecated=False,
2987        ),
2988        # Specifies the amount of energy consumed when training the AI model that is
2989        # being used in the AI system.
2990        ClassProp(
2991            "ai_trainingEnergyConsumption",
2992            lambda:
2993            ListProp(ObjectProp(ai_EnergyConsumptionDescription, False)),
2994            iri="https://spdx.org/rdf/3.0.1/terms/AI/trainingEnergyConsumption",
2995            compact="ai_trainingEnergyConsumption",
2996            deprecated=False,
2997        ),
2998    ]

A class for describing the energy consumption incurred by an AI model in different stages of its lifecycle.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
ai_finetuningEnergyConsumption: ListProxy[str | ai_EnergyConsumptionDescription]
ai_inferenceEnergyConsumption: ListProxy[str | ai_EnergyConsumptionDescription]
ai_trainingEnergyConsumption: ListProxy[str | ai_EnergyConsumptionDescription]
class ai_EnergyConsumptionDescription(SHACLObject):
3001class ai_EnergyConsumptionDescription(SHACLObject):
3002    """
3003    The class that helps note down the quantity of energy consumption and the unit
3004    used for measurement.
3005    """
3006
3007    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/AI/EnergyConsumptionDescription"
3008    COMPACT_TYPE: ClassVar[Optional[str]] = "ai_EnergyConsumptionDescription"
3009    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3010    PROPERTIES: ClassVar[List[ClassProp]] = [
3011        # Represents the energy quantity.
3012        ClassProp(
3013            "ai_energyQuantity",
3014            lambda:
3015            FloatProp(),
3016            iri="https://spdx.org/rdf/3.0.1/terms/AI/energyQuantity",
3017            min_count=1,
3018            compact="ai_energyQuantity",
3019            deprecated=False,
3020        ),
3021        # Specifies the unit in which energy is measured.
3022        ClassProp(
3023            "ai_energyUnit",
3024            lambda:
3025            EnumProp((
3026                    ("https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/kilowattHour", "kilowattHour"),
3027                    ("https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/megajoule", "megajoule"),
3028                    ("https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/other", "other"),
3029                )),
3030            iri="https://spdx.org/rdf/3.0.1/terms/AI/energyUnit",
3031            min_count=1,
3032            compact="ai_energyUnit",
3033            deprecated=False,
3034        ),
3035    ]

The class that helps note down the quantity of energy consumption and the unit used for measurement.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
ai_energyQuantity: float | None
ai_energyUnit: str | None
class ai_EnergyUnitType(SHACLObject):
3038class ai_EnergyUnitType(SHACLObject):
3039    """
3040    Specifies the unit of energy consumption.
3041    """
3042
3043    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType"
3044    COMPACT_TYPE: ClassVar[Optional[str]] = "ai_EnergyUnitType"
3045    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3046    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3047        # Kilowatt-hour.
3048        "kilowattHour": "https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/kilowattHour",
3049        # Megajoule.
3050        "megajoule": "https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/megajoule",
3051        # Any other units of energy measurement.
3052        "other": "https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/other",
3053    }

Specifies the unit of energy consumption.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'kilowattHour': 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/kilowattHour', 'megajoule': 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/megajoule', 'other': 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/other'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
kilowattHour: str = 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/kilowattHour'
megajoule: str = 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/megajoule'
other: str = 'https://spdx.org/rdf/3.0.1/terms/AI/EnergyUnitType/other'
class ai_SafetyRiskAssessmentType(SHACLObject):
3056class ai_SafetyRiskAssessmentType(SHACLObject):
3057    """
3058    Specifies the safety risk level.
3059    """
3060
3061    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType"
3062    COMPACT_TYPE: ClassVar[Optional[str]] = "ai_SafetyRiskAssessmentType"
3063    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3064    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3065        # The second-highest level of risk posed by an AI system.
3066        "high": "https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/high",
3067        # Low/no risk is posed by an AI system.
3068        "low": "https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/low",
3069        # The third-highest level of risk posed by an AI system.
3070        "medium": "https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/medium",
3071        # The highest level of risk posed by an AI system.
3072        "serious": "https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/serious",
3073    }

Specifies the safety risk level.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'high': 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/high', 'low': 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/low', 'medium': 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/medium', 'serious': 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/serious'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
high: str = 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/high'
low: str = 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/low'
medium: str = 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/medium'
serious: str = 'https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/serious'
class AnnotationType(SHACLObject):
3076class AnnotationType(SHACLObject):
3077    """
3078    Specifies the type of an annotation.
3079    """
3080
3081    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType"
3082    COMPACT_TYPE: ClassVar[Optional[str]] = "AnnotationType"
3083    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3084    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3085        # 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).
3086        "other": "https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/other",
3087        # Used when someone reviews the Element.
3088        "review": "https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/review",
3089    }

Specifies the type of an annotation.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'other': 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/other', 'review': 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/review'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/other'
review: str = 'https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/review'
class CreationInfo(SHACLObject):
3092class CreationInfo(SHACLObject):
3093    """
3094    Provides information about the creation of the Element.
3095    """
3096
3097    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/CreationInfo"
3098    COMPACT_TYPE: ClassVar[Optional[str]] = "CreationInfo"
3099    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3100    PROPERTIES: ClassVar[List[ClassProp]] = [
3101        # Provide consumers with comments by the creator of the Element about the
3102        # Element.
3103        ClassProp(
3104            "comment",
3105            lambda:
3106            StringProp(),
3107            iri="https://spdx.org/rdf/3.0.1/terms/Core/comment",
3108            compact="comment",
3109            deprecated=False,
3110        ),
3111        # Identifies when the Element was originally created.
3112        ClassProp(
3113            "created",
3114            lambda:
3115            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
3116            iri="https://spdx.org/rdf/3.0.1/terms/Core/created",
3117            min_count=1,
3118            compact="created",
3119            deprecated=False,
3120        ),
3121        # Identifies who or what created the Element.
3122        ClassProp(
3123            "createdBy",
3124            lambda:
3125            ListProp(ObjectProp(Agent, False, context=(
3126                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
3127                ),)),
3128            iri="https://spdx.org/rdf/3.0.1/terms/Core/createdBy",
3129            min_count=1,
3130            compact="createdBy",
3131            deprecated=False,
3132        ),
3133        # Identifies the tooling that was used during the creation of the Element.
3134        ClassProp(
3135            "createdUsing",
3136            lambda:
3137            ListProp(ObjectProp(Tool, False)),
3138            iri="https://spdx.org/rdf/3.0.1/terms/Core/createdUsing",
3139            compact="createdUsing",
3140            deprecated=False,
3141        ),
3142        # Provides a reference number that can be used to understand how to parse and
3143        # interpret an Element.
3144        ClassProp(
3145            "specVersion",
3146            lambda:
3147            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-]+)*))?$"),
3148            iri="https://spdx.org/rdf/3.0.1/terms/Core/specVersion",
3149            min_count=1,
3150            compact="specVersion",
3151            deprecated=False,
3152        ),
3153    ]

Provides information about the creation of the Element.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
comment: str | None
created: datetime.datetime | None
createdBy: ListProxy[str | Agent]
createdUsing: ListProxy[str | Tool]
specVersion: str | None
class DictionaryEntry(SHACLObject):
3156class DictionaryEntry(SHACLObject):
3157    """
3158    A key with an associated value.
3159    """
3160
3161    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/DictionaryEntry"
3162    COMPACT_TYPE: ClassVar[Optional[str]] = "DictionaryEntry"
3163    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3164    PROPERTIES: ClassVar[List[ClassProp]] = [
3165        # A key used in a generic key-value pair.
3166        ClassProp(
3167            "key",
3168            lambda:
3169            StringProp(),
3170            iri="https://spdx.org/rdf/3.0.1/terms/Core/key",
3171            min_count=1,
3172            compact="key",
3173            deprecated=False,
3174        ),
3175        # A value used in a generic key-value pair.
3176        ClassProp(
3177            "value",
3178            lambda:
3179            StringProp(),
3180            iri="https://spdx.org/rdf/3.0.1/terms/Core/value",
3181            compact="value",
3182            deprecated=False,
3183        ),
3184    ]

A key with an associated value.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
key: str | None
value: str | None
class Element(SHACLObject):
3187class Element(SHACLObject):
3188    """
3189    Base domain class from which all other SPDX-3.0 domain classes derive.
3190    """
3191
3192    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Element"
3193    COMPACT_TYPE: ClassVar[Optional[str]] = "Element"
3194    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
3195    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
3196    IS_ABSTRACT: ClassVar[bool] = True
3197    PROPERTIES: ClassVar[List[ClassProp]] = [
3198        # Provide consumers with comments by the creator of the Element about the
3199        # Element.
3200        ClassProp(
3201            "comment",
3202            lambda:
3203            StringProp(),
3204            iri="https://spdx.org/rdf/3.0.1/terms/Core/comment",
3205            compact="comment",
3206            deprecated=False,
3207        ),
3208        # Provides information about the creation of the Element.
3209        ClassProp(
3210            "creationInfo",
3211            lambda:
3212            ObjectProp(CreationInfo, True),
3213            iri="https://spdx.org/rdf/3.0.1/terms/Core/creationInfo",
3214            min_count=1,
3215            compact="creationInfo",
3216            deprecated=False,
3217        ),
3218        # Provides a detailed description of the Element.
3219        ClassProp(
3220            "description",
3221            lambda:
3222            StringProp(),
3223            iri="https://spdx.org/rdf/3.0.1/terms/Core/description",
3224            compact="description",
3225            deprecated=False,
3226        ),
3227        # Specifies an Extension characterization of some aspect of an Element.
3228        ClassProp(
3229            "extension",
3230            lambda:
3231            ListProp(ObjectProp(extension_Extension, False)),
3232            iri="https://spdx.org/rdf/3.0.1/terms/Core/extension",
3233            compact="extension",
3234            deprecated=False,
3235        ),
3236        # Provides a reference to a resource outside the scope of SPDX-3.0 content
3237        # that uniquely identifies an Element.
3238        ClassProp(
3239            "externalIdentifier",
3240            lambda:
3241            ListProp(ObjectProp(ExternalIdentifier, False)),
3242            iri="https://spdx.org/rdf/3.0.1/terms/Core/externalIdentifier",
3243            compact="externalIdentifier",
3244            deprecated=False,
3245        ),
3246        # Points to a resource outside the scope of the SPDX-3.0 content
3247        # that provides additional characteristics of an Element.
3248        ClassProp(
3249            "externalRef",
3250            lambda:
3251            ListProp(ObjectProp(ExternalRef, False)),
3252            iri="https://spdx.org/rdf/3.0.1/terms/Core/externalRef",
3253            compact="externalRef",
3254            deprecated=False,
3255        ),
3256        # Identifies the name of an Element as designated by the creator.
3257        ClassProp(
3258            "name",
3259            lambda:
3260            StringProp(),
3261            iri="https://spdx.org/rdf/3.0.1/terms/Core/name",
3262            compact="name",
3263            deprecated=False,
3264        ),
3265        # A short description of an Element.
3266        ClassProp(
3267            "summary",
3268            lambda:
3269            StringProp(),
3270            iri="https://spdx.org/rdf/3.0.1/terms/Core/summary",
3271            compact="summary",
3272            deprecated=False,
3273        ),
3274        # Provides an IntegrityMethod with which the integrity of an Element can be
3275        # asserted.
3276        ClassProp(
3277            "verifiedUsing",
3278            lambda:
3279            ListProp(ObjectProp(IntegrityMethod, False)),
3280            iri="https://spdx.org/rdf/3.0.1/terms/Core/verifiedUsing",
3281            compact="verifiedUsing",
3282            deprecated=False,
3283        ),
3284    ]

Base domain class from which all other SPDX-3.0 domain classes derive.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
comment: str | None
creationInfo: str | CreationInfo | None
description: str | None
extension: ListProxy[str | extension_Extension]
externalIdentifier: ListProxy[str | ExternalIdentifier]
externalRef: ListProxy[str | ExternalRef]
name: str | None
summary: str | None
verifiedUsing: ListProxy[str | IntegrityMethod]
class ElementCollection(Element):
3287class ElementCollection(Element):
3288    """
3289    A collection of Elements, not necessarily with unifying context.
3290    """
3291
3292    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ElementCollection"
3293    COMPACT_TYPE: ClassVar[Optional[str]] = "ElementCollection"
3294    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
3295    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
3296    IS_ABSTRACT: ClassVar[bool] = True
3297    PROPERTIES: ClassVar[List[ClassProp]] = [
3298        # Refers to one or more Elements that are part of an ElementCollection.
3299        ClassProp(
3300            "element",
3301            lambda:
3302            ListProp(ObjectProp(Element, False, context=(
3303                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"),
3304                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"),
3305                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
3306                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
3307                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
3308                ),)),
3309            iri="https://spdx.org/rdf/3.0.1/terms/Core/element",
3310            compact="element",
3311            deprecated=False,
3312        ),
3313        # Describes one a profile which the creator of this ElementCollection intends to
3314        # conform to.
3315        ClassProp(
3316            "profileConformance",
3317            lambda:
3318            ListProp(EnumProp((
3319                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/ai", "ai"),
3320                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/build", "build"),
3321                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core", "core"),
3322                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset", "dataset"),
3323                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing", "expandedLicensing"),
3324                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension", "extension"),
3325                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite", "lite"),
3326                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security", "security"),
3327                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing", "simpleLicensing"),
3328                    ("https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software", "software"),
3329                ))),
3330            iri="https://spdx.org/rdf/3.0.1/terms/Core/profileConformance",
3331            compact="profileConformance",
3332            deprecated=False,
3333        ),
3334        # This property is used to denote the root Element(s) of a tree of elements contained in a BOM.
3335        ClassProp(
3336            "rootElement",
3337            lambda:
3338            ListProp(ObjectProp(Element, False, context=(
3339                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"),
3340                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"),
3341                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
3342                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
3343                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
3344                ),)),
3345            iri="https://spdx.org/rdf/3.0.1/terms/Core/rootElement",
3346            compact="rootElement",
3347            deprecated=False,
3348        ),
3349    ]

A collection of Elements, not necessarily with unifying context.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
element: ListProxy[str | Element]
profileConformance: ListProxy[str]
rootElement: ListProxy[str | Element]
class ExternalIdentifier(SHACLObject):
3352class ExternalIdentifier(SHACLObject):
3353    """
3354    A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an Element.
3355    """
3356
3357    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifier"
3358    COMPACT_TYPE: ClassVar[Optional[str]] = "ExternalIdentifier"
3359    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3360    PROPERTIES: ClassVar[List[ClassProp]] = [
3361        # Provide consumers with comments by the creator of the Element about the
3362        # Element.
3363        ClassProp(
3364            "comment",
3365            lambda:
3366            StringProp(),
3367            iri="https://spdx.org/rdf/3.0.1/terms/Core/comment",
3368            compact="comment",
3369            deprecated=False,
3370        ),
3371        # Specifies the type of the external identifier.
3372        ClassProp(
3373            "externalIdentifierType",
3374            lambda:
3375            EnumProp((
3376                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe22", "cpe22"),
3377                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe23", "cpe23"),
3378                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cve", "cve"),
3379                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/email", "email"),
3380                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/gitoid", "gitoid"),
3381                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/other", "other"),
3382                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/packageUrl", "packageUrl"),
3383                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/securityOther", "securityOther"),
3384                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swhid", "swhid"),
3385                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swid", "swid"),
3386                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/urlScheme", "urlScheme"),
3387                )),
3388            iri="https://spdx.org/rdf/3.0.1/terms/Core/externalIdentifierType",
3389            min_count=1,
3390            compact="externalIdentifierType",
3391            deprecated=False,
3392        ),
3393        # Uniquely identifies an external element.
3394        ClassProp(
3395            "identifier",
3396            lambda:
3397            StringProp(),
3398            iri="https://spdx.org/rdf/3.0.1/terms/Core/identifier",
3399            min_count=1,
3400            compact="identifier",
3401            deprecated=False,
3402        ),
3403        # Provides the location for more information regarding an external identifier.
3404        ClassProp(
3405            "identifierLocator",
3406            lambda:
3407            ListProp(AnyURIProp()),
3408            iri="https://spdx.org/rdf/3.0.1/terms/Core/identifierLocator",
3409            compact="identifierLocator",
3410            deprecated=False,
3411        ),
3412        # An entity that is authorized to issue identification credentials.
3413        ClassProp(
3414            "issuingAuthority",
3415            lambda:
3416            StringProp(),
3417            iri="https://spdx.org/rdf/3.0.1/terms/Core/issuingAuthority",
3418            compact="issuingAuthority",
3419            deprecated=False,
3420        ),
3421    ]

A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an Element.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
comment: str | None
externalIdentifierType: str | None
identifier: str | None
identifierLocator: ListProxy[str]
issuingAuthority: str | None
class ExternalIdentifierType(SHACLObject):
3424class ExternalIdentifierType(SHACLObject):
3425    """
3426    Specifies the type of an external identifier.
3427    """
3428
3429    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType"
3430    COMPACT_TYPE: ClassVar[Optional[str]] = "ExternalIdentifierType"
3431    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3432    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3433        # [Common Platform Enumeration Specification 2.2](https://cpe.mitre.org/files/cpe-specification_2.2.pdf)
3434        "cpe22": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe22",
3435        # [Common Platform Enumeration: Naming Specification Version 2.3](https://csrc.nist.gov/publications/detail/nistir/7695/final)
3436        "cpe23": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe23",
3437        # Common Vulnerabilities and Exposures identifiers, an identifier for a specific software flaw defined within the official CVE Dictionary and that conforms to the [CVE specification](https://csrc.nist.gov/glossary/term/cve_id).
3438        "cve": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cve",
3439        # Email address, as defined in [RFC 3696](https://datatracker.ietf.org/doc/rfc3986/) Section 3.
3440        "email": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/email",
3441        # [Gitoid](https://www.iana.org/assignments/uri-schemes/prov/gitoid), stands for [Git Object ID](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects). A gitoid of type blob is a unique hash of a binary artifact. A gitoid may represent either an [Artifact Identifier](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-identifier-types) for the software artifact or an [Input Manifest Identifier](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#input-manifest-identifier) for the software artifact's associated [Artifact Input Manifest](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-input-manifest); this ambiguity exists because the Artifact Input Manifest is itself an artifact, and the gitoid of that artifact is its valid identifier. 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 Artifact Input Manifest (Input Manifest Identifier) should be recorded in the SPDX 3.0 Element's externalIdentifier property. See [OmniBOR Specification](https://github.com/omnibor/spec/), a minimalistic specification for describing software [Artifact Dependency Graphs](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-dependency-graph-adg).
3442        "gitoid": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/gitoid",
3443        # Used when the type does not match any of the other options.
3444        "other": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/other",
3445        # Package URL, as defined in the corresponding [Annex](../../../annexes/pkg-url-specification.md) of this specification.
3446        "packageUrl": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/packageUrl",
3447        # Used when there is a security related identifier of unspecified type.
3448        "securityOther": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/securityOther",
3449        # SoftWare Hash IDentifier, a persistent intrinsic identifier for digital artifacts, such as files, trees (also known as directories or folders), commits, and other objects typically found in version control systems. The format of the identifiers is defined in the [SWHID specification](https://www.swhid.org/specification/v1.1/4.Syntax) (ISO/IEC DIS 18670). They typically look like `swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2`.
3450        "swhid": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swhid",
3451        # Concise Software Identification (CoSWID) tag, as defined in [RFC 9393](https://datatracker.ietf.org/doc/rfc9393/) Section 2.3.
3452        "swid": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swid",
3453        # [Uniform Resource Identifier (URI) Schemes](https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml). The scheme used in order to locate a resource.
3454        "urlScheme": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/urlScheme",
3455    }

Specifies the type of an external identifier.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'cpe22': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe22', 'cpe23': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe23', 'cve': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cve', 'email': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/email', 'gitoid': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/gitoid', 'other': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/other', 'packageUrl': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/packageUrl', 'securityOther': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/securityOther', 'swhid': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swhid', 'swid': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swid', 'urlScheme': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/urlScheme'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
cpe22: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe22'
cpe23: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cpe23'
cve: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/cve'
email: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/email'
gitoid: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/gitoid'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/other'
packageUrl: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/packageUrl'
securityOther: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/securityOther'
swhid: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swhid'
swid: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/swid'
urlScheme: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalIdentifierType/urlScheme'
class ExternalMap(SHACLObject):
3458class ExternalMap(SHACLObject):
3459    """
3460    A map of Element identifiers that are used within an SpdxDocument but defined
3461    external to that SpdxDocument.
3462    """
3463
3464    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ExternalMap"
3465    COMPACT_TYPE: ClassVar[Optional[str]] = "ExternalMap"
3466    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3467    PROPERTIES: ClassVar[List[ClassProp]] = [
3468        # Artifact representing a serialization instance of SPDX data containing the
3469        # definition of a particular Element.
3470        ClassProp(
3471            "definingArtifact",
3472            lambda:
3473            ObjectProp(Artifact, False),
3474            iri="https://spdx.org/rdf/3.0.1/terms/Core/definingArtifact",
3475            compact="definingArtifact",
3476            deprecated=False,
3477        ),
3478        # Identifies an external Element used within an SpdxDocument but defined
3479        # external to that SpdxDocument.
3480        ClassProp(
3481            "externalSpdxId",
3482            lambda:
3483            AnyURIProp(),
3484            iri="https://spdx.org/rdf/3.0.1/terms/Core/externalSpdxId",
3485            min_count=1,
3486            compact="externalSpdxId",
3487            deprecated=False,
3488        ),
3489        # Provides an indication of where to retrieve an external Element.
3490        ClassProp(
3491            "locationHint",
3492            lambda:
3493            AnyURIProp(),
3494            iri="https://spdx.org/rdf/3.0.1/terms/Core/locationHint",
3495            compact="locationHint",
3496            deprecated=False,
3497        ),
3498        # Provides an IntegrityMethod with which the integrity of an Element can be
3499        # asserted.
3500        ClassProp(
3501            "verifiedUsing",
3502            lambda:
3503            ListProp(ObjectProp(IntegrityMethod, False)),
3504            iri="https://spdx.org/rdf/3.0.1/terms/Core/verifiedUsing",
3505            compact="verifiedUsing",
3506            deprecated=False,
3507        ),
3508    ]

A map of Element identifiers that are used within an SpdxDocument but defined external to that SpdxDocument.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
definingArtifact: str | Artifact | None
externalSpdxId: str | None
locationHint: str | None
verifiedUsing: ListProxy[str | IntegrityMethod]
class ExternalRef(SHACLObject):
3511class ExternalRef(SHACLObject):
3512    """
3513    A reference to a resource outside the scope of SPDX-3.0 content related to an Element.
3514    """
3515
3516    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRef"
3517    COMPACT_TYPE: ClassVar[Optional[str]] = "ExternalRef"
3518    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3519    PROPERTIES: ClassVar[List[ClassProp]] = [
3520        # Provide consumers with comments by the creator of the Element about the
3521        # Element.
3522        ClassProp(
3523            "comment",
3524            lambda:
3525            StringProp(),
3526            iri="https://spdx.org/rdf/3.0.1/terms/Core/comment",
3527            compact="comment",
3528            deprecated=False,
3529        ),
3530        # Provides information about the content type of an Element or a Property.
3531        ClassProp(
3532            "contentType",
3533            lambda:
3534            StringProp(pattern=r"^[^\/]+\/[^\/]+$"),
3535            iri="https://spdx.org/rdf/3.0.1/terms/Core/contentType",
3536            compact="contentType",
3537            deprecated=False,
3538        ),
3539        # Specifies the type of the external reference.
3540        ClassProp(
3541            "externalRefType",
3542            lambda:
3543            EnumProp((
3544                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altDownloadLocation", "altDownloadLocation"),
3545                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altWebPage", "altWebPage"),
3546                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/binaryArtifact", "binaryArtifact"),
3547                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/bower", "bower"),
3548                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildMeta", "buildMeta"),
3549                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildSystem", "buildSystem"),
3550                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/certificationReport", "certificationReport"),
3551                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/chat", "chat"),
3552                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/componentAnalysisReport", "componentAnalysisReport"),
3553                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/cwe", "cwe"),
3554                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/documentation", "documentation"),
3555                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/dynamicAnalysisReport", "dynamicAnalysisReport"),
3556                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/eolNotice", "eolNotice"),
3557                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/exportControlAssessment", "exportControlAssessment"),
3558                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/funding", "funding"),
3559                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/issueTracker", "issueTracker"),
3560                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/license", "license"),
3561                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mailingList", "mailingList"),
3562                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mavenCentral", "mavenCentral"),
3563                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/metrics", "metrics"),
3564                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/npm", "npm"),
3565                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/nuget", "nuget"),
3566                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/other", "other"),
3567                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/privacyAssessment", "privacyAssessment"),
3568                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/productMetadata", "productMetadata"),
3569                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/purchaseOrder", "purchaseOrder"),
3570                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/qualityAssessmentReport", "qualityAssessmentReport"),
3571                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseHistory", "releaseHistory"),
3572                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseNotes", "releaseNotes"),
3573                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/riskAssessment", "riskAssessment"),
3574                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/runtimeAnalysisReport", "runtimeAnalysisReport"),
3575                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/secureSoftwareAttestation", "secureSoftwareAttestation"),
3576                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdversaryModel", "securityAdversaryModel"),
3577                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdvisory", "securityAdvisory"),
3578                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityFix", "securityFix"),
3579                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityOther", "securityOther"),
3580                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPenTestReport", "securityPenTestReport"),
3581                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPolicy", "securityPolicy"),
3582                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityThreatModel", "securityThreatModel"),
3583                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/socialMedia", "socialMedia"),
3584                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/sourceArtifact", "sourceArtifact"),
3585                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/staticAnalysisReport", "staticAnalysisReport"),
3586                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/support", "support"),
3587                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vcs", "vcs"),
3588                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityDisclosureReport", "vulnerabilityDisclosureReport"),
3589                    ("https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment", "vulnerabilityExploitabilityAssessment"),
3590                )),
3591            iri="https://spdx.org/rdf/3.0.1/terms/Core/externalRefType",
3592            compact="externalRefType",
3593            deprecated=False,
3594        ),
3595        # Provides the location of an external reference.
3596        ClassProp(
3597            "locator",
3598            lambda:
3599            ListProp(StringProp()),
3600            iri="https://spdx.org/rdf/3.0.1/terms/Core/locator",
3601            compact="locator",
3602            deprecated=False,
3603        ),
3604    ]

A reference to a resource outside the scope of SPDX-3.0 content related to an Element.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
comment: str | None
contentType: str | None
externalRefType: str | None
locator: ListProxy[str]
class ExternalRefType(SHACLObject):
3607class ExternalRefType(SHACLObject):
3608    """
3609    Specifies the type of an external reference.
3610    """
3611
3612    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType"
3613    COMPACT_TYPE: ClassVar[Optional[str]] = "ExternalRefType"
3614    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3615    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3616        # A reference to an alternative download location.
3617        "altDownloadLocation": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altDownloadLocation",
3618        # A reference to an alternative web page.
3619        "altWebPage": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altWebPage",
3620        # A reference to binary artifacts related to a package.
3621        "binaryArtifact": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/binaryArtifact",
3622        # A reference to a Bower package. The package locator format, looks like `package#version`, is defined in the "install" section of [Bower API documentation](https://bower.io/docs/api/#install).
3623        "bower": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/bower",
3624        # A reference build metadata related to a published package.
3625        "buildMeta": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildMeta",
3626        # A reference build system used to create or publish the package.
3627        "buildSystem": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildSystem",
3628        # A reference to a certification report for a package from an accredited/independent body.
3629        "certificationReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/certificationReport",
3630        # A reference to the instant messaging system used by the maintainer for a package.
3631        "chat": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/chat",
3632        # A reference to a Software Composition Analysis (SCA) report.
3633        "componentAnalysisReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/componentAnalysisReport",
3634        # [Common Weakness Enumeration](https://csrc.nist.gov/glossary/term/common_weakness_enumeration). A reference to a source of software flaw defined within the official [CWE List](https://cwe.mitre.org/data/) that conforms to the [CWE specification](https://cwe.mitre.org/).
3635        "cwe": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/cwe",
3636        # A reference to the documentation for a package.
3637        "documentation": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/documentation",
3638        # A reference to a dynamic analysis report for a package.
3639        "dynamicAnalysisReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/dynamicAnalysisReport",
3640        # A reference to the End Of Sale (EOS) and/or End Of Life (EOL) information related to a package.
3641        "eolNotice": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/eolNotice",
3642        # A reference to a export control assessment for a package.
3643        "exportControlAssessment": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/exportControlAssessment",
3644        # A reference to funding information related to a package.
3645        "funding": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/funding",
3646        # A reference to the issue tracker for a package.
3647        "issueTracker": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/issueTracker",
3648        # A reference to additional license information related to an artifact.
3649        "license": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/license",
3650        # A reference to the mailing list used by the maintainer for a package.
3651        "mailingList": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mailingList",
3652        # A reference to a Maven repository artifact. The artifact locator format is defined in the [Maven documentation](https://maven.apache.org/guides/mini/guide-naming-conventions.html) and looks like `groupId:artifactId[:version]`.
3653        "mavenCentral": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mavenCentral",
3654        # A reference to metrics related to package such as OpenSSF scorecards.
3655        "metrics": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/metrics",
3656        # A reference to an npm package. The package locator format is defined in the [npm documentation](https://docs.npmjs.com/cli/v10/configuring-npm/package-json) and looks like `package@version`.
3657        "npm": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/npm",
3658        # A reference to a NuGet package. The package locator format is defined in the [NuGet documentation](https://docs.nuget.org) and looks like `package/version`.
3659        "nuget": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/nuget",
3660        # Used when the type does not match any of the other options.
3661        "other": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/other",
3662        # A reference to a privacy assessment for a package.
3663        "privacyAssessment": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/privacyAssessment",
3664        # A reference to additional product metadata such as reference within organization's product catalog.
3665        "productMetadata": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/productMetadata",
3666        # A reference to a purchase order for a package.
3667        "purchaseOrder": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/purchaseOrder",
3668        # A reference to a quality assessment for a package.
3669        "qualityAssessmentReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/qualityAssessmentReport",
3670        # A reference to a published list of releases for a package.
3671        "releaseHistory": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseHistory",
3672        # A reference to the release notes for a package.
3673        "releaseNotes": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseNotes",
3674        # A reference to a risk assessment for a package.
3675        "riskAssessment": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/riskAssessment",
3676        # A reference to a runtime analysis report for a package.
3677        "runtimeAnalysisReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/runtimeAnalysisReport",
3678        # 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).
3679        "secureSoftwareAttestation": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/secureSoftwareAttestation",
3680        # A reference to the security adversary model for a package.
3681        "securityAdversaryModel": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdversaryModel",
3682        # A reference to a published security advisory (where advisory as defined per [ISO 29147:2018](https://www.iso.org/standard/72311.html)) that may affect one or more elements, e.g., vendor advisories or specific NVD entries.
3683        "securityAdvisory": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdvisory",
3684        # A reference to the patch or source code that fixes a vulnerability.
3685        "securityFix": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityFix",
3686        # A reference to related security information of unspecified type.
3687        "securityOther": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityOther",
3688        # A reference to a [penetration test](https://en.wikipedia.org/wiki/Penetration_test) report for a package.
3689        "securityPenTestReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPenTestReport",
3690        # A reference to instructions for reporting newly discovered security vulnerabilities for a package.
3691        "securityPolicy": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPolicy",
3692        # A reference the [security threat model](https://en.wikipedia.org/wiki/Threat_model) for a package.
3693        "securityThreatModel": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityThreatModel",
3694        # A reference to a social media channel for a package.
3695        "socialMedia": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/socialMedia",
3696        # A reference to an artifact containing the sources for a package.
3697        "sourceArtifact": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/sourceArtifact",
3698        # A reference to a static analysis report for a package.
3699        "staticAnalysisReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/staticAnalysisReport",
3700        # A reference to the software support channel or other support information for a package.
3701        "support": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/support",
3702        # A reference to a version control system related to a software artifact.
3703        "vcs": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vcs",
3704        # 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 Cybersecurity Supply Chain Risk Management Practices for Systems and Organizations](https://csrc.nist.gov/pubs/sp/800/161/r1/final).
3705        "vulnerabilityDisclosureReport": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityDisclosureReport",
3706        # 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).
3707        "vulnerabilityExploitabilityAssessment": "https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment",
3708    }

Specifies the type of an external reference.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'altDownloadLocation': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altDownloadLocation', 'altWebPage': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altWebPage', 'binaryArtifact': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/binaryArtifact', 'bower': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/bower', 'buildMeta': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildMeta', 'buildSystem': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildSystem', 'certificationReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/certificationReport', 'chat': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/chat', 'componentAnalysisReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/componentAnalysisReport', 'cwe': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/cwe', 'documentation': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/documentation', 'dynamicAnalysisReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/dynamicAnalysisReport', 'eolNotice': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/eolNotice', 'exportControlAssessment': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/exportControlAssessment', 'funding': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/funding', 'issueTracker': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/issueTracker', 'license': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/license', 'mailingList': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mailingList', 'mavenCentral': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mavenCentral', 'metrics': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/metrics', 'npm': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/npm', 'nuget': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/nuget', 'other': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/other', 'privacyAssessment': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/privacyAssessment', 'productMetadata': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/productMetadata', 'purchaseOrder': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/purchaseOrder', 'qualityAssessmentReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/qualityAssessmentReport', 'releaseHistory': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseHistory', 'releaseNotes': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseNotes', 'riskAssessment': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/riskAssessment', 'runtimeAnalysisReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/runtimeAnalysisReport', 'secureSoftwareAttestation': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/secureSoftwareAttestation', 'securityAdversaryModel': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdversaryModel', 'securityAdvisory': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdvisory', 'securityFix': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityFix', 'securityOther': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityOther', 'securityPenTestReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPenTestReport', 'securityPolicy': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPolicy', 'securityThreatModel': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityThreatModel', 'socialMedia': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/socialMedia', 'sourceArtifact': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/sourceArtifact', 'staticAnalysisReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/staticAnalysisReport', 'support': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/support', 'vcs': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vcs', 'vulnerabilityDisclosureReport': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityDisclosureReport', 'vulnerabilityExploitabilityAssessment': 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
altDownloadLocation: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altDownloadLocation'
altWebPage: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/altWebPage'
binaryArtifact: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/binaryArtifact'
bower: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/bower'
buildMeta: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildMeta'
buildSystem: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/buildSystem'
certificationReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/certificationReport'
chat: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/chat'
componentAnalysisReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/componentAnalysisReport'
cwe: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/cwe'
documentation: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/documentation'
dynamicAnalysisReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/dynamicAnalysisReport'
eolNotice: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/eolNotice'
exportControlAssessment: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/exportControlAssessment'
funding: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/funding'
issueTracker: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/issueTracker'
license: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/license'
mailingList: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mailingList'
mavenCentral: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/mavenCentral'
metrics: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/metrics'
npm: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/npm'
nuget: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/nuget'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/other'
privacyAssessment: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/privacyAssessment'
productMetadata: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/productMetadata'
purchaseOrder: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/purchaseOrder'
qualityAssessmentReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/qualityAssessmentReport'
releaseHistory: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseHistory'
releaseNotes: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/releaseNotes'
riskAssessment: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/riskAssessment'
runtimeAnalysisReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/runtimeAnalysisReport'
secureSoftwareAttestation: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/secureSoftwareAttestation'
securityAdversaryModel: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdversaryModel'
securityAdvisory: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityAdvisory'
securityFix: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityFix'
securityOther: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityOther'
securityPenTestReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPenTestReport'
securityPolicy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityPolicy'
securityThreatModel: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/securityThreatModel'
socialMedia: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/socialMedia'
sourceArtifact: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/sourceArtifact'
staticAnalysisReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/staticAnalysisReport'
support: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/support'
vcs: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vcs'
vulnerabilityDisclosureReport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityDisclosureReport'
vulnerabilityExploitabilityAssessment: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ExternalRefType/vulnerabilityExploitabilityAssessment'
class HashAlgorithm(SHACLObject):
3711class HashAlgorithm(SHACLObject):
3712    """
3713    A mathematical algorithm that maps data of arbitrary size to a bit string.
3714    """
3715
3716    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm"
3717    COMPACT_TYPE: ClassVar[Optional[str]] = "HashAlgorithm"
3718    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3719    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3720        # Adler-32 checksum is part of the widely used zlib compression library as defined in [RFC 1950](https://datatracker.ietf.org/doc/rfc1950/) Section 2.3.
3721        "adler32": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32",
3722        # BLAKE2b algorithm with a digest size of 256, as defined in [RFC 7693](https://datatracker.ietf.org/doc/rfc7693/) Section 4.
3723        "blake2b256": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256",
3724        # BLAKE2b algorithm with a digest size of 384, as defined in [RFC 7693](https://datatracker.ietf.org/doc/rfc7693/) Section 4.
3725        "blake2b384": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384",
3726        # BLAKE2b algorithm with a digest size of 512, as defined in [RFC 7693](https://datatracker.ietf.org/doc/rfc7693/) Section 4.
3727        "blake2b512": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512",
3728        # [BLAKE3](https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf)
3729        "blake3": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3",
3730        # [Dilithium](https://pq-crystals.org/dilithium/)
3731        "crystalsDilithium": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium",
3732        # [Kyber](https://pq-crystals.org/kyber/)
3733        "crystalsKyber": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber",
3734        # [FALCON](https://falcon-sign.info/falcon.pdf)
3735        "falcon": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon",
3736        # MD2 message-digest algorithm, as defined in [RFC 1319](https://datatracker.ietf.org/doc/rfc1319/).
3737        "md2": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2",
3738        # MD4 message-digest algorithm, as defined in [RFC 1186](https://datatracker.ietf.org/doc/rfc1186/).
3739        "md4": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4",
3740        # MD5 message-digest algorithm, as defined in [RFC 1321](https://datatracker.ietf.org/doc/rfc1321/).
3741        "md5": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5",
3742        # [MD6 hash function](https://people.csail.mit.edu/rivest/pubs/RABCx08.pdf)
3743        "md6": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6",
3744        # any hashing algorithm that does not exist in this list of entries
3745        "other": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other",
3746        # SHA-1, a secure hashing algorithm, as defined in [RFC 3174](https://datatracker.ietf.org/doc/rfc3174/).
3747        "sha1": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1",
3748        # SHA-2 with a digest length of 224, as defined in [RFC 3874](https://datatracker.ietf.org/doc/rfc3874/).
3749        "sha224": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224",
3750        # SHA-2 with a digest length of 256, as defined in [RFC 6234](https://datatracker.ietf.org/doc/rfc6234/).
3751        "sha256": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256",
3752        # SHA-2 with a digest length of 384, as defined in [RFC 6234](https://datatracker.ietf.org/doc/rfc6234/).
3753        "sha384": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384",
3754        # SHA-3 with a digest length of 224, as defined in [FIPS 202](https://csrc.nist.gov/pubs/fips/202/final).
3755        "sha3_224": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224",
3756        # SHA-3 with a digest length of 256, as defined in [FIPS 202](https://csrc.nist.gov/pubs/fips/202/final).
3757        "sha3_256": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256",
3758        # SHA-3 with a digest length of 384, as defined in [FIPS 202](https://csrc.nist.gov/pubs/fips/202/final).
3759        "sha3_384": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384",
3760        # SHA-3 with a digest length of 512, as defined in [FIPS 202](https://csrc.nist.gov/pubs/fips/202/final).
3761        "sha3_512": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512",
3762        # SHA-2 with a digest length of 512, as defined in [RFC 6234](https://datatracker.ietf.org/doc/rfc6234/).
3763        "sha512": "https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512",
3764    }

A mathematical algorithm that maps data of arbitrary size to a bit string.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'adler32': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32', 'blake2b256': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256', 'blake2b384': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384', 'blake2b512': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512', 'blake3': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3', 'crystalsDilithium': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium', 'crystalsKyber': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber', 'falcon': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon', 'md2': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2', 'md4': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4', 'md5': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5', 'md6': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6', 'other': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other', 'sha1': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1', 'sha224': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224', 'sha256': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256', 'sha384': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384', 'sha3_224': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224', 'sha3_256': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256', 'sha3_384': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384', 'sha3_512': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512', 'sha512': 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
adler32: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32'
blake2b256: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256'
blake2b384: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384'
blake2b512: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512'
blake3: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3'
crystalsDilithium: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium'
crystalsKyber: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber'
falcon: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon'
md2: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2'
md4: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4'
md5: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5'
md6: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other'
sha1: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1'
sha224: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224'
sha256: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256'
sha384: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384'
sha3_224: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224'
sha3_256: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256'
sha3_384: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384'
sha3_512: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512'
sha512: str = 'https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512'
class IndividualElement(Element):
3767class IndividualElement(Element):
3768    """
3769    A concrete subclass of Element used by Individuals in the
3770    Core profile.
3771    """
3772
3773    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/IndividualElement"
3774    COMPACT_TYPE: ClassVar[Optional[str]] = "IndividualElement"
3775    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
3776    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
3777    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3778        # An Individual Value for Element representing a set of Elements of unknown
3779        # identify or cardinality (number).
3780        "NoAssertionElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement",
3781        # An Individual Value for Element representing a set of Elements with
3782        # cardinality (number/count) of zero.
3783        "NoneElement": "https://spdx.org/rdf/3.0.1/terms/Core/NoneElement",
3784    }

A concrete subclass of Element used by Individuals in the Core profile.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'NoAssertionElement': 'https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement', 'NoneElement': 'https://spdx.org/rdf/3.0.1/terms/Core/NoneElement'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
NoAssertionElement: str = 'https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement'
NoneElement: str = 'https://spdx.org/rdf/3.0.1/terms/Core/NoneElement'
class IntegrityMethod(SHACLObject):
3787class IntegrityMethod(SHACLObject):
3788    """
3789    Provides an independently reproducible mechanism that permits verification of a specific Element.
3790    """
3791
3792    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/IntegrityMethod"
3793    COMPACT_TYPE: ClassVar[Optional[str]] = "IntegrityMethod"
3794    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3795    IS_ABSTRACT: ClassVar[bool] = True
3796    PROPERTIES: ClassVar[List[ClassProp]] = [
3797        # Provide consumers with comments by the creator of the Element about the
3798        # Element.
3799        ClassProp(
3800            "comment",
3801            lambda:
3802            StringProp(),
3803            iri="https://spdx.org/rdf/3.0.1/terms/Core/comment",
3804            compact="comment",
3805            deprecated=False,
3806        ),
3807    ]

Provides an independently reproducible mechanism that permits verification of a specific Element.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
comment: str | None
class LifecycleScopeType(SHACLObject):
3810class LifecycleScopeType(SHACLObject):
3811    """
3812    Provide an enumerated set of lifecycle phases that can provide context to relationships.
3813    """
3814
3815    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType"
3816    COMPACT_TYPE: ClassVar[Optional[str]] = "LifecycleScopeType"
3817    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3818    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3819        # A relationship has specific context implications during an element's build phase, during development.
3820        "build": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/build",
3821        # A relationship has specific context implications during an element's design.
3822        "design": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/design",
3823        # A relationship has specific context implications during development phase of an element.
3824        "development": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/development",
3825        # A relationship has other specific context information necessary to capture that the above set of enumerations does not handle.
3826        "other": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/other",
3827        # A relationship has specific context implications during the execution phase of an element.
3828        "runtime": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/runtime",
3829        # A relationship has specific context implications during an element's testing phase, during development.
3830        "test": "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/test",
3831    }

Provide an enumerated set of lifecycle phases that can provide context to relationships.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'build': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/build', 'design': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/design', 'development': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/development', 'other': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/other', 'runtime': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/runtime', 'test': 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/test'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
build: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/build'
design: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/design'
development: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/development'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/other'
runtime: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/runtime'
test: str = 'https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/test'
class NamespaceMap(SHACLObject):
3834class NamespaceMap(SHACLObject):
3835    """
3836    A mapping between prefixes and namespace partial URIs.
3837    """
3838
3839    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/NamespaceMap"
3840    COMPACT_TYPE: ClassVar[Optional[str]] = "NamespaceMap"
3841    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3842    PROPERTIES: ClassVar[List[ClassProp]] = [
3843        # Provides an unambiguous mechanism for conveying a URI fragment portion of an
3844        # Element ID.
3845        ClassProp(
3846            "namespace",
3847            lambda:
3848            AnyURIProp(),
3849            iri="https://spdx.org/rdf/3.0.1/terms/Core/namespace",
3850            min_count=1,
3851            compact="namespace",
3852            deprecated=False,
3853        ),
3854        # A substitute for a URI.
3855        ClassProp(
3856            "prefix",
3857            lambda:
3858            StringProp(),
3859            iri="https://spdx.org/rdf/3.0.1/terms/Core/prefix",
3860            min_count=1,
3861            compact="prefix",
3862            deprecated=False,
3863        ),
3864    ]

A mapping between prefixes and namespace partial URIs.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
namespace: str | None
prefix: str | None
class PackageVerificationCode(IntegrityMethod):
3867class PackageVerificationCode(IntegrityMethod):
3868    """
3869    An SPDX version 2.X compatible verification method for software packages.
3870    """
3871
3872    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/PackageVerificationCode"
3873    COMPACT_TYPE: ClassVar[Optional[str]] = "PackageVerificationCode"
3874    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3875    PROPERTIES: ClassVar[List[ClassProp]] = [
3876        # Specifies the algorithm used for calculating the hash value.
3877        ClassProp(
3878            "algorithm",
3879            lambda:
3880            EnumProp((
3881                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32", "adler32"),
3882                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256", "blake2b256"),
3883                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384", "blake2b384"),
3884                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512", "blake2b512"),
3885                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3", "blake3"),
3886                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium", "crystalsDilithium"),
3887                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber", "crystalsKyber"),
3888                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon", "falcon"),
3889                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2", "md2"),
3890                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4", "md4"),
3891                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5", "md5"),
3892                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6", "md6"),
3893                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other", "other"),
3894                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1", "sha1"),
3895                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224", "sha224"),
3896                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256", "sha256"),
3897                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384", "sha384"),
3898                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224", "sha3_224"),
3899                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256", "sha3_256"),
3900                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384", "sha3_384"),
3901                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512", "sha3_512"),
3902                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512", "sha512"),
3903                )),
3904            iri="https://spdx.org/rdf/3.0.1/terms/Core/algorithm",
3905            min_count=1,
3906            compact="algorithm",
3907            deprecated=False,
3908        ),
3909        # The result of applying a hash algorithm to an Element.
3910        ClassProp(
3911            "hashValue",
3912            lambda:
3913            StringProp(),
3914            iri="https://spdx.org/rdf/3.0.1/terms/Core/hashValue",
3915            min_count=1,
3916            compact="hashValue",
3917            deprecated=False,
3918        ),
3919        # The relative file name of a file to be excluded from the
3920        # `PackageVerificationCode`.
3921        ClassProp(
3922            "packageVerificationCodeExcludedFile",
3923            lambda:
3924            ListProp(StringProp()),
3925            iri="https://spdx.org/rdf/3.0.1/terms/Core/packageVerificationCodeExcludedFile",
3926            compact="packageVerificationCodeExcludedFile",
3927            deprecated=False,
3928        ),
3929    ]

An SPDX version 2.X compatible verification method for software packages.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
algorithm: str | None
hashValue: str | None
packageVerificationCodeExcludedFile: ListProxy[str]
class PositiveIntegerRange(SHACLObject):
3932class PositiveIntegerRange(SHACLObject):
3933    """
3934    A tuple of two positive integers that define a range.
3935    """
3936
3937    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/PositiveIntegerRange"
3938    COMPACT_TYPE: ClassVar[Optional[str]] = "PositiveIntegerRange"
3939    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3940    PROPERTIES: ClassVar[List[ClassProp]] = [
3941        # Defines the beginning of a range.
3942        ClassProp(
3943            "beginIntegerRange",
3944            lambda:
3945            PositiveIntegerProp(),
3946            iri="https://spdx.org/rdf/3.0.1/terms/Core/beginIntegerRange",
3947            min_count=1,
3948            compact="beginIntegerRange",
3949            deprecated=False,
3950        ),
3951        # Defines the end of a range.
3952        ClassProp(
3953            "endIntegerRange",
3954            lambda:
3955            PositiveIntegerProp(),
3956            iri="https://spdx.org/rdf/3.0.1/terms/Core/endIntegerRange",
3957            min_count=1,
3958            compact="endIntegerRange",
3959            deprecated=False,
3960        ),
3961    ]

A tuple of two positive integers that define a range.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
beginIntegerRange: int | None
endIntegerRange: int | None
class PresenceType(SHACLObject):
3964class PresenceType(SHACLObject):
3965    """
3966    Categories of presence or absence.
3967    """
3968
3969    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/PresenceType"
3970    COMPACT_TYPE: ClassVar[Optional[str]] = "PresenceType"
3971    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3972    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3973        # Indicates absence of the field.
3974        "no": "https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no",
3975        # Makes no assertion about the field.
3976        "noAssertion": "https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion",
3977        # Indicates presence of the field.
3978        "yes": "https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes",
3979    }

Categories of presence or absence.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'no': 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no', 'noAssertion': 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion', 'yes': 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
no: str = 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no'
noAssertion: str = 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion'
yes: str = 'https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes'
class ProfileIdentifierType(SHACLObject):
3982class ProfileIdentifierType(SHACLObject):
3983    """
3984    Enumeration of the valid profiles.
3985    """
3986
3987    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType"
3988    COMPACT_TYPE: ClassVar[Optional[str]] = "ProfileIdentifierType"
3989    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
3990    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
3991        # the element follows the AI profile specification
3992        "ai": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/ai",
3993        # the element follows the Build profile specification
3994        "build": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/build",
3995        # the element follows the Core profile specification
3996        "core": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core",
3997        # the element follows the Dataset profile specification
3998        "dataset": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset",
3999        # the element follows the ExpandedLicensing profile specification
4000        "expandedLicensing": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing",
4001        # the element follows the Extension profile specification
4002        "extension": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension",
4003        # the element follows the Lite profile specification
4004        "lite": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite",
4005        # the element follows the Security profile specification
4006        "security": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security",
4007        # the element follows the SimpleLicensing profile specification
4008        "simpleLicensing": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing",
4009        # the element follows the Software profile specification
4010        "software": "https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software",
4011    }

Enumeration of the valid profiles.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'ai': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/ai', 'build': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/build', 'core': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core', 'dataset': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset', 'expandedLicensing': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing', 'extension': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension', 'lite': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite', 'security': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security', 'simpleLicensing': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing', 'software': 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
ai: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/ai'
build: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/build'
core: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/core'
dataset: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/dataset'
expandedLicensing: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/expandedLicensing'
extension: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/extension'
lite: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/lite'
security: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/security'
simpleLicensing: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/simpleLicensing'
software: str = 'https://spdx.org/rdf/3.0.1/terms/Core/ProfileIdentifierType/software'
class Relationship(Element):
4014class Relationship(Element):
4015    """
4016    Describes a relationship between one or more elements.
4017    """
4018
4019    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Relationship"
4020    COMPACT_TYPE: ClassVar[Optional[str]] = "Relationship"
4021    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4022    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4023    PROPERTIES: ClassVar[List[ClassProp]] = [
4024        # Provides information about the completeness of relationships.
4025        ClassProp(
4026            "completeness",
4027            lambda:
4028            EnumProp((
4029                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/complete", "complete"),
4030                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/incomplete", "incomplete"),
4031                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/noAssertion", "noAssertion"),
4032                )),
4033            iri="https://spdx.org/rdf/3.0.1/terms/Core/completeness",
4034            compact="completeness",
4035            deprecated=False,
4036        ),
4037        # Specifies the time from which an element is no longer applicable / valid.
4038        ClassProp(
4039            "endTime",
4040            lambda:
4041            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
4042            iri="https://spdx.org/rdf/3.0.1/terms/Core/endTime",
4043            compact="endTime",
4044            deprecated=False,
4045        ),
4046        # References the Element on the left-hand side of a relationship.
4047        ClassProp(
4048            "from_",
4049            lambda:
4050            ObjectProp(Element, True, context=(
4051                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"),
4052                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"),
4053                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
4054                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
4055                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
4056                ),),
4057            iri="https://spdx.org/rdf/3.0.1/terms/Core/from",
4058            min_count=1,
4059            compact="from",
4060            deprecated=False,
4061        ),
4062        # Information about the relationship between two Elements.
4063        ClassProp(
4064            "relationshipType",
4065            lambda:
4066            EnumProp((
4067                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/affects", "affects"),
4068                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/amendedBy", "amendedBy"),
4069                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/ancestorOf", "ancestorOf"),
4070                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/availableFrom", "availableFrom"),
4071                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/configures", "configures"),
4072                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/contains", "contains"),
4073                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/coordinatedBy", "coordinatedBy"),
4074                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/copiedTo", "copiedTo"),
4075                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/delegatedTo", "delegatedTo"),
4076                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/dependsOn", "dependsOn"),
4077                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/descendantOf", "descendantOf"),
4078                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/describes", "describes"),
4079                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/doesNotAffect", "doesNotAffect"),
4080                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/expandsTo", "expandsTo"),
4081                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/exploitCreatedBy", "exploitCreatedBy"),
4082                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedBy", "fixedBy"),
4083                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedIn", "fixedIn"),
4084                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/foundBy", "foundBy"),
4085                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/generates", "generates"),
4086                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAddedFile", "hasAddedFile"),
4087                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssessmentFor", "hasAssessmentFor"),
4088                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssociatedVulnerability", "hasAssociatedVulnerability"),
4089                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasConcludedLicense", "hasConcludedLicense"),
4090                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDataFile", "hasDataFile"),
4091                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeclaredLicense", "hasDeclaredLicense"),
4092                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeletedFile", "hasDeletedFile"),
4093                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDependencyManifest", "hasDependencyManifest"),
4094                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDistributionArtifact", "hasDistributionArtifact"),
4095                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDocumentation", "hasDocumentation"),
4096                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDynamicLink", "hasDynamicLink"),
4097                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasEvidence", "hasEvidence"),
4098                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasExample", "hasExample"),
4099                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasHost", "hasHost"),
4100                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasInput", "hasInput"),
4101                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasMetadata", "hasMetadata"),
4102                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalComponent", "hasOptionalComponent"),
4103                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalDependency", "hasOptionalDependency"),
4104                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOutput", "hasOutput"),
4105                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasPrerequisite", "hasPrerequisite"),
4106                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasProvidedDependency", "hasProvidedDependency"),
4107                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasRequirement", "hasRequirement"),
4108                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasSpecification", "hasSpecification"),
4109                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasStaticLink", "hasStaticLink"),
4110                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTest", "hasTest"),
4111                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTestCase", "hasTestCase"),
4112                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasVariant", "hasVariant"),
4113                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/invokedBy", "invokedBy"),
4114                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/modifiedBy", "modifiedBy"),
4115                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/other", "other"),
4116                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/packagedBy", "packagedBy"),
4117                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/patchedBy", "patchedBy"),
4118                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/publishedBy", "publishedBy"),
4119                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/reportedBy", "reportedBy"),
4120                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/republishedBy", "republishedBy"),
4121                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/serializedInArtifact", "serializedInArtifact"),
4122                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/testedOn", "testedOn"),
4123                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/trainedOn", "trainedOn"),
4124                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/underInvestigationFor", "underInvestigationFor"),
4125                    ("https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/usesTool", "usesTool"),
4126                )),
4127            iri="https://spdx.org/rdf/3.0.1/terms/Core/relationshipType",
4128            min_count=1,
4129            compact="relationshipType",
4130            deprecated=False,
4131        ),
4132        # Specifies the time from which an element is applicable / valid.
4133        ClassProp(
4134            "startTime",
4135            lambda:
4136            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
4137            iri="https://spdx.org/rdf/3.0.1/terms/Core/startTime",
4138            compact="startTime",
4139            deprecated=False,
4140        ),
4141        # References an Element on the right-hand side of a relationship.
4142        ClassProp(
4143            "to",
4144            lambda:
4145            ListProp(ObjectProp(Element, False, context=(
4146                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"),
4147                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"),
4148                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
4149                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
4150                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
4151                ),)),
4152            iri="https://spdx.org/rdf/3.0.1/terms/Core/to",
4153            min_count=1,
4154            compact="to",
4155            deprecated=False,
4156        ),
4157    ]

Describes a relationship between one or more elements.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
completeness: str | None
endTime: datetime.datetime | None
from_: str | Element | None
relationshipType: str | None
startTime: datetime.datetime | None
to: ListProxy[str | Element]
class RelationshipCompleteness(SHACLObject):
4160class RelationshipCompleteness(SHACLObject):
4161    """
4162    Indicates whether a relationship is known to be complete, incomplete, or if no assertion is made with respect to relationship completeness.
4163    """
4164
4165    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness"
4166    COMPACT_TYPE: ClassVar[Optional[str]] = "RelationshipCompleteness"
4167    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4168    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4169        # The relationship is known to be exhaustive.
4170        "complete": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/complete",
4171        # The relationship is known not to be exhaustive.
4172        "incomplete": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/incomplete",
4173        # No assertion can be made about the completeness of the relationship.
4174        "noAssertion": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/noAssertion",
4175    }

Indicates whether a relationship is known to be complete, incomplete, or if no assertion is made with respect to relationship completeness.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'complete': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/complete', 'incomplete': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/incomplete', 'noAssertion': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/noAssertion'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
complete: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/complete'
incomplete: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/incomplete'
noAssertion: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipCompleteness/noAssertion'
class RelationshipType(SHACLObject):
4178class RelationshipType(SHACLObject):
4179    """
4180    Information about the relationship between two Elements.
4181    """
4182
4183    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType"
4184    COMPACT_TYPE: ClassVar[Optional[str]] = "RelationshipType"
4185    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4186    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4187        # The `from` Vulnerability affects each `to` Element. The use of the `affects` type is constrained to `VexAffectedVulnAssessmentRelationship` classed relationships.
4188        "affects": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/affects",
4189        # The `from` Element is amended by each `to` Element.
4190        "amendedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/amendedBy",
4191        # The `from` Element is an ancestor of each `to` Element.
4192        "ancestorOf": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/ancestorOf",
4193        # The `from` Element is available from the additional supplier described by each `to` Element.
4194        "availableFrom": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/availableFrom",
4195        # The `from` Element is a configuration applied to each `to` Element, during a LifecycleScopeType period.
4196        "configures": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/configures",
4197        # The `from` Element contains each `to` Element.
4198        "contains": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/contains",
4199        # The `from` Vulnerability is coordinatedBy the `to` Agent(s) (vendor, researcher, or consumer agent).
4200        "coordinatedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/coordinatedBy",
4201        # The `from` Element has been copied to each `to` Element.
4202        "copiedTo": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/copiedTo",
4203        # 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`).
4204        "delegatedTo": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/delegatedTo",
4205        # The `from` Element depends on each `to` Element, during a LifecycleScopeType period.
4206        "dependsOn": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/dependsOn",
4207        # The `from` Element is a descendant of each `to` Element.
4208        "descendantOf": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/descendantOf",
4209        # 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.
4210        "describes": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/describes",
4211        # The `from` Vulnerability has no impact on each `to` Element. The use of the `doesNotAffect` is constrained to `VexNotAffectedVulnAssessmentRelationship` classed relationships.
4212        "doesNotAffect": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/doesNotAffect",
4213        # The `from` archive expands out as an artifact described by each `to` Element.
4214        "expandsTo": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/expandsTo",
4215        # The `from` Vulnerability has had an exploit created against it by each `to` Agent.
4216        "exploitCreatedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/exploitCreatedBy",
4217        # Designates a `from` Vulnerability has been fixed by the `to` Agent(s).
4218        "fixedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedBy",
4219        # A `from` Vulnerability has been fixed in each `to` Element. The use of the `fixedIn` type is constrained to `VexFixedVulnAssessmentRelationship` classed relationships.
4220        "fixedIn": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedIn",
4221        # Designates a `from` Vulnerability was originally discovered by the `to` Agent(s).
4222        "foundBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/foundBy",
4223        # The `from` Element generates each `to` Element.
4224        "generates": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/generates",
4225        # Every `to` Element is a file added to the `from` Element (`from` hasAddedFile `to`).
4226        "hasAddedFile": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAddedFile",
4227        # Relates a `from` Vulnerability and each `to` Element with a security assessment. To be used with `VulnAssessmentRelationship` types.
4228        "hasAssessmentFor": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssessmentFor",
4229        # Used to associate a `from` Artifact with each `to` Vulnerability.
4230        "hasAssociatedVulnerability": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssociatedVulnerability",
4231        # The `from` SoftwareArtifact is concluded by the SPDX data creator to be governed by each `to` license.
4232        "hasConcludedLicense": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasConcludedLicense",
4233        # The `from` Element treats each `to` Element as a data file. A data file is an artifact that stores data required or optional for the `from` Element's functionality. A data file can be a database file, an index file, a log file, an AI model file, a calibration data file, a temporary file, a backup file, and more. For AI training dataset, test dataset, test artifact, configuration data, build input data, and build output data, please consider using the more specific relationship types: `trainedOn`, `testedOn`, `hasTest`, `configures`, `hasInput`, and `hasOutput`, respectively. This relationship does not imply dependency.
4234        "hasDataFile": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDataFile",
4235        # The `from` SoftwareArtifact was discovered to actually contain each `to` license, for example as detected by use of automated tooling.
4236        "hasDeclaredLicense": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeclaredLicense",
4237        # Every `to` Element is a file deleted from the `from` Element (`from` hasDeletedFile `to`).
4238        "hasDeletedFile": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeletedFile",
4239        # The `from` Element has manifest files that contain dependency information in each `to` Element.
4240        "hasDependencyManifest": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDependencyManifest",
4241        # The `from` Element is distributed as an artifact in each `to` Element (e.g. an RPM or archive file).
4242        "hasDistributionArtifact": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDistributionArtifact",
4243        # The `from` Element is documented by each `to` Element.
4244        "hasDocumentation": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDocumentation",
4245        # The `from` Element dynamically links in each `to` Element, during a LifecycleScopeType period.
4246        "hasDynamicLink": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDynamicLink",
4247        # Every `to` Element is considered as evidence for the `from` Element (`from` hasEvidence `to`).
4248        "hasEvidence": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasEvidence",
4249        # Every `to` Element is an example for the `from` Element (`from` hasExample `to`).
4250        "hasExample": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasExample",
4251        # The `from` Build was run on the `to` Element during a LifecycleScopeType period (e.g. the host that the build runs on).
4252        "hasHost": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasHost",
4253        # The `from` Build has each `to` Element as an input, during a LifecycleScopeType period.
4254        "hasInput": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasInput",
4255        # Every `to` Element is metadata about the `from` Element (`from` hasMetadata `to`).
4256        "hasMetadata": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasMetadata",
4257        # Every `to` Element is an optional component of the `from` Element (`from` hasOptionalComponent `to`).
4258        "hasOptionalComponent": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalComponent",
4259        # The `from` Element optionally depends on each `to` Element, during a LifecycleScopeType period.
4260        "hasOptionalDependency": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalDependency",
4261        # The `from` Build element generates each `to` Element as an output, during a LifecycleScopeType period.
4262        "hasOutput": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOutput",
4263        # The `from` Element has a prerequisite on each `to` Element, during a LifecycleScopeType period.
4264        "hasPrerequisite": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasPrerequisite",
4265        # The `from` Element has a dependency on each `to` Element, dependency is not in the distributed artifact, but assumed to be provided, during a LifecycleScopeType period.
4266        "hasProvidedDependency": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasProvidedDependency",
4267        # The `from` Element has a requirement on each `to` Element, during a LifecycleScopeType period.
4268        "hasRequirement": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasRequirement",
4269        # Every `to` Element is a specification for the `from` Element (`from` hasSpecification `to`), during a LifecycleScopeType period.
4270        "hasSpecification": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasSpecification",
4271        # The `from` Element statically links in each `to` Element, during a LifecycleScopeType period.
4272        "hasStaticLink": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasStaticLink",
4273        # Every `to` Element is a test artifact for the `from` Element (`from` hasTest `to`), during a LifecycleScopeType period.
4274        "hasTest": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTest",
4275        # Every `to` Element is a test case for the `from` Element (`from` hasTestCase `to`).
4276        "hasTestCase": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTestCase",
4277        # Every `to` Element is a variant the `from` Element (`from` hasVariant `to`).
4278        "hasVariant": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasVariant",
4279        # The `from` Element was invoked by the `to` Agent, during a LifecycleScopeType period (for example, a Build element that describes a build step).
4280        "invokedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/invokedBy",
4281        # The `from` Element is modified by each `to` Element.
4282        "modifiedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/modifiedBy",
4283        # Every `to` Element is related to the `from` Element where the relationship type is not described by any of the SPDX relationship types (this relationship is directionless).
4284        "other": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/other",
4285        # Every `to` Element is a packaged instance of the `from` Element (`from` packagedBy `to`).
4286        "packagedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/packagedBy",
4287        # Every `to` Element is a patch for the `from` Element (`from` patchedBy `to`).
4288        "patchedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/patchedBy",
4289        # Designates a `from` Vulnerability was made available for public use or reference by each `to` Agent.
4290        "publishedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/publishedBy",
4291        # Designates a `from` Vulnerability was first reported to a project, vendor, or tracking database for formal identification by each `to` Agent.
4292        "reportedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/reportedBy",
4293        # Designates a `from` Vulnerability's details were tracked, aggregated, and/or enriched to improve context (i.e. NVD) by each `to` Agent.
4294        "republishedBy": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/republishedBy",
4295        # The `from` SpdxDocument can be found in a serialized form in each `to` Artifact.
4296        "serializedInArtifact": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/serializedInArtifact",
4297        # The `from` Element has been tested on the `to` Element(s).
4298        "testedOn": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/testedOn",
4299        # The `from` Element has been trained on the `to` Element(s).
4300        "trainedOn": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/trainedOn",
4301        # The `from` Vulnerability impact is being investigated for each `to` Element. The use of the `underInvestigationFor` type is constrained to `VexUnderInvestigationVulnAssessmentRelationship` classed relationships.
4302        "underInvestigationFor": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/underInvestigationFor",
4303        # The `from` Element uses each `to` Element as a tool, during a LifecycleScopeType period.
4304        "usesTool": "https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/usesTool",
4305    }

Information about the relationship between two Elements.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'affects': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/affects', 'amendedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/amendedBy', 'ancestorOf': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/ancestorOf', 'availableFrom': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/availableFrom', 'configures': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/configures', 'contains': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/contains', 'coordinatedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/coordinatedBy', 'copiedTo': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/copiedTo', 'delegatedTo': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/delegatedTo', 'dependsOn': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/dependsOn', 'descendantOf': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/descendantOf', 'describes': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/describes', 'doesNotAffect': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/doesNotAffect', 'expandsTo': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/expandsTo', 'exploitCreatedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/exploitCreatedBy', 'fixedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedBy', 'fixedIn': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedIn', 'foundBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/foundBy', 'generates': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/generates', 'hasAddedFile': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAddedFile', 'hasAssessmentFor': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssessmentFor', 'hasAssociatedVulnerability': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssociatedVulnerability', 'hasConcludedLicense': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasConcludedLicense', 'hasDataFile': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDataFile', 'hasDeclaredLicense': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeclaredLicense', 'hasDeletedFile': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeletedFile', 'hasDependencyManifest': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDependencyManifest', 'hasDistributionArtifact': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDistributionArtifact', 'hasDocumentation': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDocumentation', 'hasDynamicLink': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDynamicLink', 'hasEvidence': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasEvidence', 'hasExample': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasExample', 'hasHost': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasHost', 'hasInput': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasInput', 'hasMetadata': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasMetadata', 'hasOptionalComponent': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalComponent', 'hasOptionalDependency': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalDependency', 'hasOutput': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOutput', 'hasPrerequisite': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasPrerequisite', 'hasProvidedDependency': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasProvidedDependency', 'hasRequirement': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasRequirement', 'hasSpecification': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasSpecification', 'hasStaticLink': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasStaticLink', 'hasTest': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTest', 'hasTestCase': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTestCase', 'hasVariant': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasVariant', 'invokedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/invokedBy', 'modifiedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/modifiedBy', 'other': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/other', 'packagedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/packagedBy', 'patchedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/patchedBy', 'publishedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/publishedBy', 'reportedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/reportedBy', 'republishedBy': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/republishedBy', 'serializedInArtifact': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/serializedInArtifact', 'testedOn': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/testedOn', 'trainedOn': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/trainedOn', 'underInvestigationFor': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/underInvestigationFor', 'usesTool': 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/usesTool'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
affects: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/affects'
amendedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/amendedBy'
ancestorOf: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/ancestorOf'
availableFrom: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/availableFrom'
configures: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/configures'
contains: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/contains'
coordinatedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/coordinatedBy'
copiedTo: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/copiedTo'
delegatedTo: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/delegatedTo'
dependsOn: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/dependsOn'
descendantOf: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/descendantOf'
describes: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/describes'
doesNotAffect: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/doesNotAffect'
expandsTo: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/expandsTo'
exploitCreatedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/exploitCreatedBy'
fixedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedBy'
fixedIn: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/fixedIn'
foundBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/foundBy'
generates: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/generates'
hasAddedFile: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAddedFile'
hasAssessmentFor: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssessmentFor'
hasAssociatedVulnerability: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasAssociatedVulnerability'
hasConcludedLicense: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasConcludedLicense'
hasDataFile: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDataFile'
hasDeclaredLicense: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeclaredLicense'
hasDeletedFile: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDeletedFile'
hasDependencyManifest: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDependencyManifest'
hasDistributionArtifact: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDistributionArtifact'
hasDocumentation: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasDocumentation'
hasEvidence: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasEvidence'
hasExample: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasExample'
hasHost: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasHost'
hasInput: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasInput'
hasMetadata: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasMetadata'
hasOptionalComponent: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalComponent'
hasOptionalDependency: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOptionalDependency'
hasOutput: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasOutput'
hasPrerequisite: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasPrerequisite'
hasProvidedDependency: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasProvidedDependency'
hasRequirement: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasRequirement'
hasSpecification: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasSpecification'
hasTest: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTest'
hasTestCase: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasTestCase'
hasVariant: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/hasVariant'
invokedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/invokedBy'
modifiedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/modifiedBy'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/other'
packagedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/packagedBy'
patchedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/patchedBy'
publishedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/publishedBy'
reportedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/reportedBy'
republishedBy: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/republishedBy'
serializedInArtifact: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/serializedInArtifact'
testedOn: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/testedOn'
trainedOn: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/trainedOn'
underInvestigationFor: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/underInvestigationFor'
usesTool: str = 'https://spdx.org/rdf/3.0.1/terms/Core/RelationshipType/usesTool'
class SpdxDocument(ElementCollection):
4308class SpdxDocument(ElementCollection):
4309    """
4310    A collection of SPDX Elements that could potentially be serialized.
4311    """
4312
4313    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/SpdxDocument"
4314    COMPACT_TYPE: ClassVar[Optional[str]] = "SpdxDocument"
4315    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4316    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4317    PROPERTIES: ClassVar[List[ClassProp]] = [
4318        # Provides the license under which the SPDX documentation of the Element can be
4319        # used.
4320        ClassProp(
4321            "dataLicense",
4322            lambda:
4323            ObjectProp(simplelicensing_AnyLicenseInfo, False, context=(
4324                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
4325                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
4326                ),),
4327            iri="https://spdx.org/rdf/3.0.1/terms/Core/dataLicense",
4328            compact="dataLicense",
4329            deprecated=False,
4330        ),
4331        # Provides an ExternalMap of Element identifiers.
4332        ClassProp(
4333            "import_",
4334            lambda:
4335            ListProp(ObjectProp(ExternalMap, False)),
4336            iri="https://spdx.org/rdf/3.0.1/terms/Core/import",
4337            compact="import",
4338            deprecated=False,
4339        ),
4340        # Provides a NamespaceMap of prefixes and associated namespace partial URIs applicable to an SpdxDocument and independent of any specific serialization format or instance.
4341        ClassProp(
4342            "namespaceMap",
4343            lambda:
4344            ListProp(ObjectProp(NamespaceMap, False)),
4345            iri="https://spdx.org/rdf/3.0.1/terms/Core/namespaceMap",
4346            compact="namespaceMap",
4347            deprecated=False,
4348        ),
4349    ]

A collection of SPDX Elements that could potentially be serialized.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
dataLicense: str | simplelicensing_AnyLicenseInfo | None
import_: ListProxy[str | ExternalMap]
namespaceMap: ListProxy[str | NamespaceMap]
class SupportType(SHACLObject):
4352class SupportType(SHACLObject):
4353    """
4354    Indicates the type of support that is associated with an artifact.
4355    """
4356
4357    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/SupportType"
4358    COMPACT_TYPE: ClassVar[Optional[str]] = "SupportType"
4359    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4360    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4361        # 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.
4362        "deployed": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/deployed",
4363        # the artifact is in active development and is not considered ready for formal support from the supplier.
4364        "development": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/development",
4365        # 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.
4366        "endOfSupport": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/endOfSupport",
4367        # 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.
4368        "limitedSupport": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/limitedSupport",
4369        # no assertion about the type of support is made.   This is considered the default if no other support type is used.
4370        "noAssertion": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noAssertion",
4371        # there is no support for the artifact from the supplier, consumer assumes any support obligations.
4372        "noSupport": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noSupport",
4373        # 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.
4374        "support": "https://spdx.org/rdf/3.0.1/terms/Core/SupportType/support",
4375    }

Indicates the type of support that is associated with an artifact.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'deployed': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/deployed', 'development': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/development', 'endOfSupport': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/endOfSupport', 'limitedSupport': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/limitedSupport', 'noAssertion': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noAssertion', 'noSupport': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noSupport', 'support': 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/support'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
deployed: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/deployed'
development: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/development'
endOfSupport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/endOfSupport'
limitedSupport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/limitedSupport'
noAssertion: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noAssertion'
noSupport: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noSupport'
support: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SupportType/support'
class Tool(Element):
4378class Tool(Element):
4379    """
4380    An element of hardware and/or software utilized to carry out a particular function.
4381    """
4382
4383    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Tool"
4384    COMPACT_TYPE: ClassVar[Optional[str]] = "Tool"
4385    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4386    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

An element of hardware and/or software utilized to carry out a particular function.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class dataset_ConfidentialityLevelType(SHACLObject):
4389class dataset_ConfidentialityLevelType(SHACLObject):
4390    """
4391    Categories of confidentiality level.
4392    """
4393
4394    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType"
4395    COMPACT_TYPE: ClassVar[Optional[str]] = "dataset_ConfidentialityLevelType"
4396    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4397    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4398        # Data points in the dataset can be shared only with specific organizations and their clients on a need to know basis.
4399        "amber": "https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/amber",
4400        # Dataset may be distributed freely, without restriction.
4401        "clear": "https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/clear",
4402        # Dataset can be shared within a community of peers and partners.
4403        "green": "https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/green",
4404        # Data points in the dataset are highly confidential and can only be shared with named recipients.
4405        "red": "https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/red",
4406    }

Categories of confidentiality level.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'amber': 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/amber', 'clear': 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/clear', 'green': 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/green', 'red': 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/red'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
amber: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/amber'
clear: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/clear'
green: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/green'
red: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/red'
class dataset_DatasetAvailabilityType(SHACLObject):
4409class dataset_DatasetAvailabilityType(SHACLObject):
4410    """
4411    Availability of dataset.
4412    """
4413
4414    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType"
4415    COMPACT_TYPE: ClassVar[Optional[str]] = "dataset_DatasetAvailabilityType"
4416    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4417    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4418        # the dataset is not publicly available and can only be accessed after affirmatively accepting terms on a clickthrough webpage.
4419        "clickthrough": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/clickthrough",
4420        # the dataset is publicly available and can be downloaded directly.
4421        "directDownload": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/directDownload",
4422        # the dataset is publicly available, but not all at once, and can only be accessed through queries which return parts of the dataset.
4423        "query": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/query",
4424        # the dataset is not publicly available and an email registration is required before accessing the dataset, although without an affirmative acceptance of terms.
4425        "registration": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/registration",
4426        # the dataset provider is not making available the underlying data and the dataset must be reassembled, typically using the provided script for scraping the data.
4427        "scrapingScript": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/scrapingScript",
4428    }

Availability of dataset.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'clickthrough': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/clickthrough', 'directDownload': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/directDownload', 'query': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/query', 'registration': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/registration', 'scrapingScript': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/scrapingScript'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
clickthrough: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/clickthrough'
directDownload: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/directDownload'
query: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/query'
registration: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/registration'
scrapingScript: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/scrapingScript'
class dataset_DatasetType(SHACLObject):
4431class dataset_DatasetType(SHACLObject):
4432    """
4433    Enumeration of dataset types.
4434    """
4435
4436    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType"
4437    COMPACT_TYPE: ClassVar[Optional[str]] = "dataset_DatasetType"
4438    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4439    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4440        # data is audio based, such as a collection of music from the 80s.
4441        "audio": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/audio",
4442        # data that is classified into a discrete number of categories, such as the eye color of a population of people.
4443        "categorical": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/categorical",
4444        # data is in the form of a graph where entries are somehow related to each other through edges, such a social network of friends.
4445        "graph": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/graph",
4446        # data is a collection of images such as pictures of animals.
4447        "image": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/image",
4448        # data type is not known.
4449        "noAssertion": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/noAssertion",
4450        # data consists only of numeric entries.
4451        "numeric": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/numeric",
4452        # data is of a type not included in this list.
4453        "other": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/other",
4454        # data is recorded from a physical sensor, such as a thermometer reading or biometric device.
4455        "sensor": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/sensor",
4456        # data is stored in tabular format or retrieved from a relational database.
4457        "structured": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/structured",
4458        # data describes the syntax or semantics of a language or text, such as a parse tree used for natural language processing.
4459        "syntactic": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/syntactic",
4460        # data consists of unstructured text, such as a book, Wikipedia article (without images), or transcript.
4461        "text": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/text",
4462        # data is recorded in an ordered sequence of timestamped entries, such as the price of a stock over the course of a day.
4463        "timeseries": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timeseries",
4464        # data is recorded with a timestamp for each entry, but not necessarily ordered or at specific intervals, such as when a taxi ride starts and ends.
4465        "timestamp": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timestamp",
4466        # data is video based, such as a collection of movie clips featuring Tom Hanks.
4467        "video": "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/video",
4468    }

Enumeration of dataset types.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'audio': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/audio', 'categorical': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/categorical', 'graph': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/graph', 'image': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/image', 'noAssertion': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/noAssertion', 'numeric': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/numeric', 'other': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/other', 'sensor': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/sensor', 'structured': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/structured', 'syntactic': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/syntactic', 'text': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/text', 'timeseries': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timeseries', 'timestamp': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timestamp', 'video': 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/video'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
audio: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/audio'
categorical: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/categorical'
graph: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/graph'
image: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/image'
noAssertion: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/noAssertion'
numeric: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/numeric'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/other'
sensor: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/sensor'
structured: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/structured'
syntactic: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/syntactic'
text: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/text'
timeseries: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timeseries'
timestamp: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timestamp'
video: str = 'https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/video'
class expandedlicensing_LicenseAddition(Element):
4471class expandedlicensing_LicenseAddition(Element):
4472    """
4473    Abstract class for additional text intended to be added to a License, but
4474    which is not itself a standalone License.
4475    """
4476
4477    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/LicenseAddition"
4478    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_LicenseAddition"
4479    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4480    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4481    IS_ABSTRACT: ClassVar[bool] = True
4482    PROPERTIES: ClassVar[List[ClassProp]] = [
4483        # Identifies the full text of a LicenseAddition.
4484        ClassProp(
4485            "expandedlicensing_additionText",
4486            lambda:
4487            StringProp(),
4488            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/additionText",
4489            min_count=1,
4490            compact="expandedlicensing_additionText",
4491            deprecated=False,
4492        ),
4493        # Specifies whether an additional text identifier has been marked as deprecated.
4494        ClassProp(
4495            "expandedlicensing_isDeprecatedAdditionId",
4496            lambda:
4497            BooleanProp(),
4498            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/isDeprecatedAdditionId",
4499            compact="expandedlicensing_isDeprecatedAdditionId",
4500            deprecated=False,
4501        ),
4502        # Identifies all the text and metadata associated with a license in the license
4503        # XML format.
4504        ClassProp(
4505            "expandedlicensing_licenseXml",
4506            lambda:
4507            StringProp(),
4508            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/licenseXml",
4509            compact="expandedlicensing_licenseXml",
4510            deprecated=False,
4511        ),
4512        # Specifies the licenseId that is preferred to be used in place of a deprecated
4513        # License or LicenseAddition.
4514        ClassProp(
4515            "expandedlicensing_obsoletedBy",
4516            lambda:
4517            StringProp(),
4518            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/obsoletedBy",
4519            compact="expandedlicensing_obsoletedBy",
4520            deprecated=False,
4521        ),
4522        # Contains a URL where the License or LicenseAddition can be found in use.
4523        ClassProp(
4524            "expandedlicensing_seeAlso",
4525            lambda:
4526            ListProp(AnyURIProp()),
4527            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/seeAlso",
4528            compact="expandedlicensing_seeAlso",
4529            deprecated=False,
4530        ),
4531        # Identifies the full text of a LicenseAddition, in SPDX templating format.
4532        ClassProp(
4533            "expandedlicensing_standardAdditionTemplate",
4534            lambda:
4535            StringProp(),
4536            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/standardAdditionTemplate",
4537            compact="expandedlicensing_standardAdditionTemplate",
4538            deprecated=False,
4539        ),
4540    ]

Abstract class for additional text intended to be added to a License, but which is not itself a standalone License.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_additionText: str | None
expandedlicensing_isDeprecatedAdditionId: bool | None
expandedlicensing_licenseXml: str | None
expandedlicensing_obsoletedBy: str | None
expandedlicensing_seeAlso: ListProxy[str]
expandedlicensing_standardAdditionTemplate: str | None
class expandedlicensing_ListedLicenseException(expandedlicensing_LicenseAddition):
4543class expandedlicensing_ListedLicenseException(expandedlicensing_LicenseAddition):
4544    """
4545    A license exception that is listed on the SPDX Exceptions list.
4546    """
4547
4548    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ListedLicenseException"
4549    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_ListedLicenseException"
4550    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4551    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4552    PROPERTIES: ClassVar[List[ClassProp]] = [
4553        # Specifies the SPDX License List version in which this license or exception
4554        # identifier was deprecated.
4555        ClassProp(
4556            "expandedlicensing_deprecatedVersion",
4557            lambda:
4558            StringProp(),
4559            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/deprecatedVersion",
4560            compact="expandedlicensing_deprecatedVersion",
4561            deprecated=False,
4562        ),
4563        # Specifies the SPDX License List version in which this ListedLicense or
4564        # ListedLicenseException identifier was first added.
4565        ClassProp(
4566            "expandedlicensing_listVersionAdded",
4567            lambda:
4568            StringProp(),
4569            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/listVersionAdded",
4570            compact="expandedlicensing_listVersionAdded",
4571            deprecated=False,
4572        ),
4573    ]

A license exception that is listed on the SPDX Exceptions list.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_deprecatedVersion: str | None
expandedlicensing_listVersionAdded: str | None
class extension_CdxPropertyEntry(SHACLObject):
4576class extension_CdxPropertyEntry(SHACLObject):
4577    """
4578    A property name with an associated value.
4579    """
4580
4581    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertyEntry"
4582    COMPACT_TYPE: ClassVar[Optional[str]] = "extension_CdxPropertyEntry"
4583    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4584    PROPERTIES: ClassVar[List[ClassProp]] = [
4585        # A name used in a CdxPropertyEntry name-value pair.
4586        ClassProp(
4587            "extension_cdxPropName",
4588            lambda:
4589            StringProp(),
4590            iri="https://spdx.org/rdf/3.0.1/terms/Extension/cdxPropName",
4591            min_count=1,
4592            compact="extension_cdxPropName",
4593            deprecated=False,
4594        ),
4595        # A value used in a CdxPropertyEntry name-value pair.
4596        ClassProp(
4597            "extension_cdxPropValue",
4598            lambda:
4599            StringProp(),
4600            iri="https://spdx.org/rdf/3.0.1/terms/Extension/cdxPropValue",
4601            compact="extension_cdxPropValue",
4602            deprecated=False,
4603        ),
4604    ]

A property name with an associated value.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
extension_cdxPropName: str | None
extension_cdxPropValue: str | None
class extension_Extension(SHACLExtensibleObject):
4607class extension_Extension(SHACLExtensibleObject):
4608    """
4609    A characterization of some aspect of an Element that is associated with the Element in a generalized fashion.
4610    """
4611
4612    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Extension/Extension"
4613    COMPACT_TYPE: ClassVar[Optional[str]] = "extension_Extension"
4614    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4615    IS_ABSTRACT: ClassVar[bool] = True

A characterization of some aspect of an Element that is associated with the Element in a generalized fashion.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
IS_ABSTRACT: ClassVar[bool] = True
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class security_CvssSeverityType(SHACLObject):
4618class security_CvssSeverityType(SHACLObject):
4619    """
4620    Specifies the CVSS base, temporal, threat, or environmental severity type.
4621    """
4622
4623    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType"
4624    COMPACT_TYPE: ClassVar[Optional[str]] = "security_CvssSeverityType"
4625    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4626    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4627        # When a CVSS score is between 9.0 - 10.0
4628        "critical": "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical",
4629        # When a CVSS score is between 7.0 - 8.9
4630        "high": "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high",
4631        # When a CVSS score is between 0.1 - 3.9
4632        "low": "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low",
4633        # When a CVSS score is between 4.0 - 6.9
4634        "medium": "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium",
4635        # When a CVSS score is 0.0
4636        "none": "https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none",
4637    }

Specifies the CVSS base, temporal, threat, or environmental severity type.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'critical': 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical', 'high': 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high', 'low': 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low', 'medium': 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium', 'none': 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
critical: str = 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical'
high: str = 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high'
low: str = 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low'
medium: str = 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium'
none: str = 'https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none'
class security_ExploitCatalogType(SHACLObject):
4640class security_ExploitCatalogType(SHACLObject):
4641    """
4642    Specifies the exploit catalog type.
4643    """
4644
4645    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType"
4646    COMPACT_TYPE: ClassVar[Optional[str]] = "security_ExploitCatalogType"
4647    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4648    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4649        # CISA's Known Exploited Vulnerability (KEV) Catalog
4650        "kev": "https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/kev",
4651        # Other exploit catalogs
4652        "other": "https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/other",
4653    }

Specifies the exploit catalog type.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'kev': 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/kev', 'other': 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/other'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
kev: str = 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/kev'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/other'
class security_SsvcDecisionType(SHACLObject):
4656class security_SsvcDecisionType(SHACLObject):
4657    """
4658    Specifies the SSVC decision type.
4659    """
4660
4661    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType"
4662    COMPACT_TYPE: ClassVar[Optional[str]] = "security_SsvcDecisionType"
4663    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4664    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4665        # 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.
4666        "act": "https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/act",
4667        # 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.
4668        "attend": "https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/attend",
4669        # 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.
4670        "track": "https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/track",
4671        # ("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.
4672        "trackStar": "https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/trackStar",
4673    }

Specifies the SSVC decision type.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'act': 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/act', 'attend': 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/attend', 'track': 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/track', 'trackStar': 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/trackStar'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
act: str = 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/act'
attend: str = 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/attend'
track: str = 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/track'
trackStar: str = 'https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/trackStar'
class security_VexJustificationType(SHACLObject):
4676class security_VexJustificationType(SHACLObject):
4677    """
4678    Specifies the VEX justification type.
4679    """
4680
4681    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType"
4682    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexJustificationType"
4683    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4684    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4685        # The software is not affected because the vulnerable component is not in the product.
4686        "componentNotPresent": "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/componentNotPresent",
4687        # Built-in inline controls or mitigations prevent an adversary from leveraging the vulnerability.
4688        "inlineMitigationsAlreadyExist": "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist",
4689        # 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.
4690        "vulnerableCodeCannotBeControlledByAdversary": "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary",
4691        # The affected code is not reachable through the execution of the code, including non-anticipated states of the product.
4692        "vulnerableCodeNotInExecutePath": "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath",
4693        # The product is not affected because the code underlying the vulnerability is not present in the product.
4694        "vulnerableCodeNotPresent": "https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotPresent",
4695    }

Specifies the VEX justification type.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'componentNotPresent': 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/componentNotPresent', 'inlineMitigationsAlreadyExist': 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist', 'vulnerableCodeCannotBeControlledByAdversary': 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary', 'vulnerableCodeNotInExecutePath': 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath', 'vulnerableCodeNotPresent': 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotPresent'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
componentNotPresent: str = 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/componentNotPresent'
inlineMitigationsAlreadyExist: str = 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist'
vulnerableCodeCannotBeControlledByAdversary: str = 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary'
vulnerableCodeNotInExecutePath: str = 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath'
vulnerableCodeNotPresent: str = 'https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotPresent'
class security_VulnAssessmentRelationship(Relationship):
4698class security_VulnAssessmentRelationship(Relationship):
4699    """
4700    Abstract ancestor class for all vulnerability assessments
4701    """
4702
4703    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VulnAssessmentRelationship"
4704    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VulnAssessmentRelationship"
4705    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4706    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4707    IS_ABSTRACT: ClassVar[bool] = True
4708    PROPERTIES: ClassVar[List[ClassProp]] = [
4709        # Identifies who or what supplied the artifact or VulnAssessmentRelationship
4710        # referenced by the Element.
4711        ClassProp(
4712            "suppliedBy",
4713            lambda:
4714            ObjectProp(Agent, False, context=(
4715                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
4716                ),),
4717            iri="https://spdx.org/rdf/3.0.1/terms/Core/suppliedBy",
4718            compact="suppliedBy",
4719            deprecated=False,
4720        ),
4721        # Specifies an Element contained in a piece of software where a vulnerability was
4722        # found.
4723        ClassProp(
4724            "security_assessedElement",
4725            lambda:
4726            ObjectProp(software_SoftwareArtifact, False),
4727            iri="https://spdx.org/rdf/3.0.1/terms/Security/assessedElement",
4728            compact="security_assessedElement",
4729            deprecated=False,
4730        ),
4731        # Specifies a time when a vulnerability assessment was modified
4732        ClassProp(
4733            "security_modifiedTime",
4734            lambda:
4735            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
4736            iri="https://spdx.org/rdf/3.0.1/terms/Security/modifiedTime",
4737            compact="security_modifiedTime",
4738            deprecated=False,
4739        ),
4740        # Specifies the time when a vulnerability was published.
4741        ClassProp(
4742            "security_publishedTime",
4743            lambda:
4744            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
4745            iri="https://spdx.org/rdf/3.0.1/terms/Security/publishedTime",
4746            compact="security_publishedTime",
4747            deprecated=False,
4748        ),
4749        # Specified the time and date when a vulnerability was withdrawn.
4750        ClassProp(
4751            "security_withdrawnTime",
4752            lambda:
4753            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
4754            iri="https://spdx.org/rdf/3.0.1/terms/Security/withdrawnTime",
4755            compact="security_withdrawnTime",
4756            deprecated=False,
4757        ),
4758    ]

Abstract ancestor class for all vulnerability assessments

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_assessedElement: str | software_SoftwareArtifact | None
security_modifiedTime: datetime.datetime | None
security_publishedTime: datetime.datetime | None
security_withdrawnTime: datetime.datetime | None
suppliedBy: str | Agent | None
class simplelicensing_AnyLicenseInfo(Element):
4761class simplelicensing_AnyLicenseInfo(Element):
4762    """
4763    Abstract class representing a license combination consisting of one or more licenses.
4764    """
4765
4766    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/AnyLicenseInfo"
4767    COMPACT_TYPE: ClassVar[Optional[str]] = "simplelicensing_AnyLicenseInfo"
4768    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4769    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4770    IS_ABSTRACT: ClassVar[bool] = True

Abstract class representing a license combination consisting of one or more licenses.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class simplelicensing_LicenseExpression(simplelicensing_AnyLicenseInfo):
4773class simplelicensing_LicenseExpression(simplelicensing_AnyLicenseInfo):
4774    """
4775    An SPDX Element containing an SPDX license expression string.
4776    """
4777
4778    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/LicenseExpression"
4779    COMPACT_TYPE: ClassVar[Optional[str]] = "simplelicensing_LicenseExpression"
4780    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4781    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4782    PROPERTIES: ClassVar[List[ClassProp]] = [
4783        # Maps a LicenseRef or AdditionRef string for a Custom License or a Custom
4784        # License Addition to its URI ID.
4785        ClassProp(
4786            "simplelicensing_customIdToUri",
4787            lambda:
4788            ListProp(ObjectProp(DictionaryEntry, False)),
4789            iri="https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/customIdToUri",
4790            compact="simplelicensing_customIdToUri",
4791            deprecated=False,
4792        ),
4793        # A string in the license expression format.
4794        ClassProp(
4795            "simplelicensing_licenseExpression",
4796            lambda:
4797            StringProp(),
4798            iri="https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/licenseExpression",
4799            min_count=1,
4800            compact="simplelicensing_licenseExpression",
4801            deprecated=False,
4802        ),
4803        # The version of the SPDX License List used in the license expression.
4804        ClassProp(
4805            "simplelicensing_licenseListVersion",
4806            lambda:
4807            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-]+)*))?$"),
4808            iri="https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/licenseListVersion",
4809            compact="simplelicensing_licenseListVersion",
4810            deprecated=False,
4811        ),
4812    ]

An SPDX Element containing an SPDX license expression string.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
simplelicensing_customIdToUri: ListProxy[str | DictionaryEntry]
simplelicensing_licenseExpression: str | None
simplelicensing_licenseListVersion: str | None
class simplelicensing_SimpleLicensingText(Element):
4815class simplelicensing_SimpleLicensingText(Element):
4816    """
4817    A license or addition that is not listed on the SPDX License List.
4818    """
4819
4820    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/SimpleLicensingText"
4821    COMPACT_TYPE: ClassVar[Optional[str]] = "simplelicensing_SimpleLicensingText"
4822    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
4823    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
4824    PROPERTIES: ClassVar[List[ClassProp]] = [
4825        # Identifies the full text of a License or Addition.
4826        ClassProp(
4827            "simplelicensing_licenseText",
4828            lambda:
4829            StringProp(),
4830            iri="https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/licenseText",
4831            min_count=1,
4832            compact="simplelicensing_licenseText",
4833            deprecated=False,
4834        ),
4835    ]

A license or addition that is not listed on the SPDX License List.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
simplelicensing_licenseText: str | None
class software_ContentIdentifier(IntegrityMethod):
4838class software_ContentIdentifier(IntegrityMethod):
4839    """
4840    A canonical, unique, immutable identifier
4841    """
4842
4843    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifier"
4844    COMPACT_TYPE: ClassVar[Optional[str]] = "software_ContentIdentifier"
4845    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4846    PROPERTIES: ClassVar[List[ClassProp]] = [
4847        # Specifies the type of the content identifier.
4848        ClassProp(
4849            "software_contentIdentifierType",
4850            lambda:
4851            EnumProp((
4852                    ("https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/gitoid", "gitoid"),
4853                    ("https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/swhid", "swhid"),
4854                )),
4855            iri="https://spdx.org/rdf/3.0.1/terms/Software/contentIdentifierType",
4856            min_count=1,
4857            compact="software_contentIdentifierType",
4858            deprecated=False,
4859        ),
4860        # Specifies the value of the content identifier.
4861        ClassProp(
4862            "software_contentIdentifierValue",
4863            lambda:
4864            AnyURIProp(),
4865            iri="https://spdx.org/rdf/3.0.1/terms/Software/contentIdentifierValue",
4866            min_count=1,
4867            compact="software_contentIdentifierValue",
4868            deprecated=False,
4869        ),
4870    ]

A canonical, unique, immutable identifier

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
software_contentIdentifierType: str | None
software_contentIdentifierValue: str | None
class software_ContentIdentifierType(SHACLObject):
4873class software_ContentIdentifierType(SHACLObject):
4874    """
4875    Specifies the type of a content identifier.
4876    """
4877
4878    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType"
4879    COMPACT_TYPE: ClassVar[Optional[str]] = "software_ContentIdentifierType"
4880    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4881    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4882        # [Gitoid](https://www.iana.org/assignments/uri-schemes/prov/gitoid), stands for [Git Object ID](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects). A gitoid of type blob is a unique hash of a binary artifact. A gitoid may represent either an [Artifact Identifier](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-identifier-types) for the software artifact or an [Input Manifest Identifier](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#input-manifest-identifier) for the software artifact's associated [Artifact Input Manifest](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-input-manifest); this ambiguity exists because the Artifact Input Manifest is itself an artifact, and the gitoid of that artifact is its valid identifier. 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 Artifact Input Manifest (Input Manifest Identifier) should be recorded in the SPDX 3.0 Element's externalIdentifier property. See [OmniBOR Specification](https://github.com/omnibor/spec/), a minimalistic specification for describing software [Artifact Dependency Graphs](https://github.com/omnibor/spec/blob/eb1ee5c961c16215eb8709b2975d193a2007a35d/spec/SPEC.md#artifact-dependency-graph-adg).
4883        "gitoid": "https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/gitoid",
4884        # SoftWare Hash IDentifier, a persistent intrinsic identifier for digital artifacts, such as files, trees (also known as directories or folders), commits, and other objects typically found in version control systems. The format of the identifiers is defined in the [SWHID specification](https://www.swhid.org/specification/v1.1/4.Syntax) (ISO/IEC DIS 18670). They typically look like `swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2`.
4885        "swhid": "https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/swhid",
4886    }

Specifies the type of a content identifier.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'gitoid': 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/gitoid', 'swhid': 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/swhid'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
gitoid: str = 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/gitoid'
swhid: str = 'https://spdx.org/rdf/3.0.1/terms/Software/ContentIdentifierType/swhid'
class software_FileKindType(SHACLObject):
4889class software_FileKindType(SHACLObject):
4890    """
4891    Enumeration of the different kinds of SPDX file.
4892    """
4893
4894    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/FileKindType"
4895    COMPACT_TYPE: ClassVar[Optional[str]] = "software_FileKindType"
4896    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4897    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4898        # The file represents a directory and all content stored in that directory.
4899        "directory": "https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/directory",
4900        # The file represents a single file (default).
4901        "file": "https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/file",
4902    }

Enumeration of the different kinds of SPDX file.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'directory': 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/directory', 'file': 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/file'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
directory: str = 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/directory'
file: str = 'https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/file'
class software_SbomType(SHACLObject):
4905class software_SbomType(SHACLObject):
4906    """
4907    Provides a set of values to be used to describe the common types of SBOMs that
4908    tools may create.
4909    """
4910
4911    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/SbomType"
4912    COMPACT_TYPE: ClassVar[Optional[str]] = "software_SbomType"
4913    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4914    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4915        # 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.
4916        "analyzed": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/analyzed",
4917        # 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.
4918        "build": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/build",
4919        # 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.
4920        "deployed": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/deployed",
4921        # SBOM of intended, planned software project or product with included components (some of which may not yet exist) for a new software artifact.
4922        "design": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/design",
4923        # 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.
4924        "runtime": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/runtime",
4925        # SBOM created directly from the development environment, source files, and included dependencies used to build an product artifact.
4926        "source": "https://spdx.org/rdf/3.0.1/terms/Software/SbomType/source",
4927    }

Provides a set of values to be used to describe the common types of SBOMs that tools may create.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'analyzed': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/analyzed', 'build': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/build', 'deployed': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/deployed', 'design': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/design', 'runtime': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/runtime', 'source': 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/source'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
analyzed: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/analyzed'
build: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/build'
deployed: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/deployed'
design: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/design'
runtime: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/runtime'
source: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SbomType/source'
class software_SoftwarePurpose(SHACLObject):
4930class software_SoftwarePurpose(SHACLObject):
4931    """
4932    Provides information about the primary purpose of an Element.
4933    """
4934
4935    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose"
4936    COMPACT_TYPE: ClassVar[Optional[str]] = "software_SoftwarePurpose"
4937    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
4938    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
4939        # The Element is a software application.
4940        "application": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application",
4941        # The Element is an archived collection of one or more files (.tar, .zip, etc.).
4942        "archive": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive",
4943        # The Element is a bill of materials.
4944        "bom": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom",
4945        # The Element is configuration data.
4946        "configuration": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration",
4947        # The Element is a container image which can be used by a container runtime application.
4948        "container": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container",
4949        # The Element is data.
4950        "data": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data",
4951        # The Element refers to a chipset, processor, or electronic board.
4952        "device": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device",
4953        # The Element represents software that controls hardware devices.
4954        "deviceDriver": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver",
4955        # 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.
4956        "diskImage": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage",
4957        # The Element is documentation.
4958        "documentation": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation",
4959        # The Element is the evidence that a specification or requirement has been fulfilled.
4960        "evidence": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence",
4961        # The Element is an Artifact that can be run on a computer.
4962        "executable": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable",
4963        # The Element is a single file which can be independently distributed (configuration file, statically linked binary, Kubernetes deployment, etc.).
4964        "file": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file",
4965        # The Element is a file system image that can be written to a disk (or virtual) partition.
4966        "filesystemImage": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage",
4967        # The Element provides low level control over a device's hardware.
4968        "firmware": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware",
4969        # The Element is a software framework.
4970        "framework": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework",
4971        # The Element is used to install software on disk.
4972        "install": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install",
4973        # The Element is a software library.
4974        "library": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library",
4975        # The Element is a software manifest.
4976        "manifest": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest",
4977        # The Element is a machine learning or artificial intelligence model.
4978        "model": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model",
4979        # The Element is a module of a piece of software.
4980        "module": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module",
4981        # The Element is an operating system.
4982        "operatingSystem": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem",
4983        # The Element doesn't fit into any of the other categories.
4984        "other": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other",
4985        # The Element contains a set of changes to update, fix, or improve another Element.
4986        "patch": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch",
4987        # The Element represents a runtime environment.
4988        "platform": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform",
4989        # The Element provides a requirement needed as input for another Element.
4990        "requirement": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement",
4991        # The Element is a single or a collection of source files.
4992        "source": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source",
4993        # The Element is a plan, guideline or strategy how to create, perform or analyze an application.
4994        "specification": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification",
4995        # The Element is a test used to verify functionality on an software element.
4996        "test": "https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test",
4997    }

Provides information about the primary purpose of an Element.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'application': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application', 'archive': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive', 'bom': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom', 'configuration': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration', 'container': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container', 'data': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data', 'device': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device', 'deviceDriver': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver', 'diskImage': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage', 'documentation': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation', 'evidence': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence', 'executable': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable', 'file': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file', 'filesystemImage': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage', 'firmware': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware', 'framework': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework', 'install': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install', 'library': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library', 'manifest': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest', 'model': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model', 'module': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module', 'operatingSystem': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem', 'other': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other', 'patch': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch', 'platform': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform', 'requirement': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement', 'source': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source', 'specification': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification', 'test': 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
application: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application'
archive: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive'
bom: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom'
configuration: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration'
container: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container'
data: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data'
device: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device'
deviceDriver: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver'
diskImage: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage'
documentation: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation'
evidence: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence'
executable: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable'
file: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file'
filesystemImage: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage'
firmware: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware'
framework: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework'
install: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install'
library: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library'
manifest: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest'
model: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model'
module: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module'
operatingSystem: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem'
other: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other'
patch: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch'
platform: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform'
requirement: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement'
source: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source'
specification: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification'
test: str = 'https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test'
class build_Build(Element):
5000class build_Build(Element):
5001    """
5002    Class that describes a build instance of software/artifacts.
5003    """
5004
5005    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Build/Build"
5006    COMPACT_TYPE: ClassVar[Optional[str]] = "build_Build"
5007    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5008    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5009    PROPERTIES: ClassVar[List[ClassProp]] = [
5010        # Property that describes the time at which a build stops.
5011        ClassProp(
5012            "build_buildEndTime",
5013            lambda:
5014            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
5015            iri="https://spdx.org/rdf/3.0.1/terms/Build/buildEndTime",
5016            compact="build_buildEndTime",
5017            deprecated=False,
5018        ),
5019        # A buildId is a locally unique identifier used by a builder to identify a unique
5020        # instance of a build produced by it.
5021        ClassProp(
5022            "build_buildId",
5023            lambda:
5024            StringProp(),
5025            iri="https://spdx.org/rdf/3.0.1/terms/Build/buildId",
5026            compact="build_buildId",
5027            deprecated=False,
5028        ),
5029        # Property describing the start time of a build.
5030        ClassProp(
5031            "build_buildStartTime",
5032            lambda:
5033            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
5034            iri="https://spdx.org/rdf/3.0.1/terms/Build/buildStartTime",
5035            compact="build_buildStartTime",
5036            deprecated=False,
5037        ),
5038        # A buildType is a hint that is used to indicate the toolchain, platform, or
5039        # infrastructure that the build was invoked on.
5040        ClassProp(
5041            "build_buildType",
5042            lambda:
5043            AnyURIProp(),
5044            iri="https://spdx.org/rdf/3.0.1/terms/Build/buildType",
5045            min_count=1,
5046            compact="build_buildType",
5047            deprecated=False,
5048        ),
5049        # Property that describes the digest of the build configuration file used to
5050        # invoke a build.
5051        ClassProp(
5052            "build_configSourceDigest",
5053            lambda:
5054            ListProp(ObjectProp(Hash, False)),
5055            iri="https://spdx.org/rdf/3.0.1/terms/Build/configSourceDigest",
5056            compact="build_configSourceDigest",
5057            deprecated=False,
5058        ),
5059        # Property describes the invocation entrypoint of a build.
5060        ClassProp(
5061            "build_configSourceEntrypoint",
5062            lambda:
5063            ListProp(StringProp()),
5064            iri="https://spdx.org/rdf/3.0.1/terms/Build/configSourceEntrypoint",
5065            compact="build_configSourceEntrypoint",
5066            deprecated=False,
5067        ),
5068        # Property that describes the URI of the build configuration source file.
5069        ClassProp(
5070            "build_configSourceUri",
5071            lambda:
5072            ListProp(AnyURIProp()),
5073            iri="https://spdx.org/rdf/3.0.1/terms/Build/configSourceUri",
5074            compact="build_configSourceUri",
5075            deprecated=False,
5076        ),
5077        # Property describing the session in which a build is invoked.
5078        ClassProp(
5079            "build_environment",
5080            lambda:
5081            ListProp(ObjectProp(DictionaryEntry, False)),
5082            iri="https://spdx.org/rdf/3.0.1/terms/Build/environment",
5083            compact="build_environment",
5084            deprecated=False,
5085        ),
5086        # Property describing a parameter used in an instance of a build.
5087        ClassProp(
5088            "build_parameter",
5089            lambda:
5090            ListProp(ObjectProp(DictionaryEntry, False)),
5091            iri="https://spdx.org/rdf/3.0.1/terms/Build/parameter",
5092            compact="build_parameter",
5093            deprecated=False,
5094        ),
5095    ]

Class that describes a build instance of software/artifacts.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
build_buildEndTime: datetime.datetime | None
build_buildId: str | None
build_buildStartTime: datetime.datetime | None
build_buildType: str | None
build_configSourceDigest: ListProxy[str | Hash]
build_configSourceEntrypoint: ListProxy[str]
build_configSourceUri: ListProxy[str]
build_environment: ListProxy[str | DictionaryEntry]
build_parameter: ListProxy[str | DictionaryEntry]
class Agent(Element):
5098class Agent(Element):
5099    """
5100    Agent represents anything with the potential to act on a system.
5101    """
5102
5103    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Agent"
5104    COMPACT_TYPE: ClassVar[Optional[str]] = "Agent"
5105    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5106    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

Agent represents anything with the potential to act on a system.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class Annotation(Element):
5109class Annotation(Element):
5110    """
5111    An assertion made in relation to one or more elements.
5112    """
5113
5114    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Annotation"
5115    COMPACT_TYPE: ClassVar[Optional[str]] = "Annotation"
5116    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5117    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5118    PROPERTIES: ClassVar[List[ClassProp]] = [
5119        # Describes the type of annotation.
5120        ClassProp(
5121            "annotationType",
5122            lambda:
5123            EnumProp((
5124                    ("https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/other", "other"),
5125                    ("https://spdx.org/rdf/3.0.1/terms/Core/AnnotationType/review", "review"),
5126                )),
5127            iri="https://spdx.org/rdf/3.0.1/terms/Core/annotationType",
5128            min_count=1,
5129            compact="annotationType",
5130            deprecated=False,
5131        ),
5132        # Provides information about the content type of an Element or a Property.
5133        ClassProp(
5134            "contentType",
5135            lambda:
5136            StringProp(pattern=r"^[^\/]+\/[^\/]+$"),
5137            iri="https://spdx.org/rdf/3.0.1/terms/Core/contentType",
5138            compact="contentType",
5139            deprecated=False,
5140        ),
5141        # Commentary on an assertion that an annotator has made.
5142        ClassProp(
5143            "statement",
5144            lambda:
5145            StringProp(),
5146            iri="https://spdx.org/rdf/3.0.1/terms/Core/statement",
5147            compact="statement",
5148            deprecated=False,
5149        ),
5150        # An Element an annotator has made an assertion about.
5151        ClassProp(
5152            "subject",
5153            lambda:
5154            ObjectProp(Element, True, context=(
5155                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoAssertionElement", "NoAssertionElement"),
5156                    ("https://spdx.org/rdf/3.0.1/terms/Core/NoneElement", "NoneElement"),
5157                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
5158                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
5159                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
5160                ),),
5161            iri="https://spdx.org/rdf/3.0.1/terms/Core/subject",
5162            min_count=1,
5163            compact="subject",
5164            deprecated=False,
5165        ),
5166    ]

An assertion made in relation to one or more elements.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
annotationType: str | None
contentType: str | None
statement: str | None
subject: str | Element | None
class Artifact(Element):
5169class Artifact(Element):
5170    """
5171    A distinct article or unit within the digital domain.
5172    """
5173
5174    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Artifact"
5175    COMPACT_TYPE: ClassVar[Optional[str]] = "Artifact"
5176    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5177    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5178    IS_ABSTRACT: ClassVar[bool] = True
5179    PROPERTIES: ClassVar[List[ClassProp]] = [
5180        # Specifies the time an artifact was built.
5181        ClassProp(
5182            "builtTime",
5183            lambda:
5184            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
5185            iri="https://spdx.org/rdf/3.0.1/terms/Core/builtTime",
5186            compact="builtTime",
5187            deprecated=False,
5188        ),
5189        # Identifies from where or whom the Element originally came.
5190        ClassProp(
5191            "originatedBy",
5192            lambda:
5193            ListProp(ObjectProp(Agent, False, context=(
5194                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
5195                ),)),
5196            iri="https://spdx.org/rdf/3.0.1/terms/Core/originatedBy",
5197            compact="originatedBy",
5198            deprecated=False,
5199        ),
5200        # Specifies the time an artifact was released.
5201        ClassProp(
5202            "releaseTime",
5203            lambda:
5204            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
5205            iri="https://spdx.org/rdf/3.0.1/terms/Core/releaseTime",
5206            compact="releaseTime",
5207            deprecated=False,
5208        ),
5209        # The name of a relevant standard that may apply to an artifact.
5210        ClassProp(
5211            "standardName",
5212            lambda:
5213            ListProp(StringProp()),
5214            iri="https://spdx.org/rdf/3.0.1/terms/Core/standardName",
5215            compact="standardName",
5216            deprecated=False,
5217        ),
5218        # Identifies who or what supplied the artifact or VulnAssessmentRelationship
5219        # referenced by the Element.
5220        ClassProp(
5221            "suppliedBy",
5222            lambda:
5223            ObjectProp(Agent, False, context=(
5224                    ("https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization", "SpdxOrganization"),
5225                ),),
5226            iri="https://spdx.org/rdf/3.0.1/terms/Core/suppliedBy",
5227            compact="suppliedBy",
5228            deprecated=False,
5229        ),
5230        # Specifies the level of support associated with an artifact.
5231        ClassProp(
5232            "supportLevel",
5233            lambda:
5234            ListProp(EnumProp((
5235                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/deployed", "deployed"),
5236                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/development", "development"),
5237                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/endOfSupport", "endOfSupport"),
5238                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/limitedSupport", "limitedSupport"),
5239                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noAssertion", "noAssertion"),
5240                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/noSupport", "noSupport"),
5241                    ("https://spdx.org/rdf/3.0.1/terms/Core/SupportType/support", "support"),
5242                ))),
5243            iri="https://spdx.org/rdf/3.0.1/terms/Core/supportLevel",
5244            compact="supportLevel",
5245            deprecated=False,
5246        ),
5247        # Specifies until when the artifact can be used before its usage needs to be
5248        # reassessed.
5249        ClassProp(
5250            "validUntilTime",
5251            lambda:
5252            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
5253            iri="https://spdx.org/rdf/3.0.1/terms/Core/validUntilTime",
5254            compact="validUntilTime",
5255            deprecated=False,
5256        ),
5257    ]

A distinct article or unit within the digital domain.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
builtTime: datetime.datetime | None
originatedBy: ListProxy[str | Agent]
releaseTime: datetime.datetime | None
standardName: ListProxy[str]
suppliedBy: str | Agent | None
supportLevel: ListProxy[str]
validUntilTime: datetime.datetime | None
class Bundle(ElementCollection):
5260class Bundle(ElementCollection):
5261    """
5262    A collection of Elements that have a shared context.
5263    """
5264
5265    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Bundle"
5266    COMPACT_TYPE: ClassVar[Optional[str]] = "Bundle"
5267    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5268    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5269    PROPERTIES: ClassVar[List[ClassProp]] = [
5270        # Gives information about the circumstances or unifying properties
5271        # that Elements of the bundle have been assembled under.
5272        ClassProp(
5273            "context",
5274            lambda:
5275            StringProp(),
5276            iri="https://spdx.org/rdf/3.0.1/terms/Core/context",
5277            compact="context",
5278            deprecated=False,
5279        ),
5280    ]

A collection of Elements that have a shared context.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
context: str | None
class Hash(IntegrityMethod):
5283class Hash(IntegrityMethod):
5284    """
5285    A mathematically calculated representation of a grouping of data.
5286    """
5287
5288    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Hash"
5289    COMPACT_TYPE: ClassVar[Optional[str]] = "Hash"
5290    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
5291    PROPERTIES: ClassVar[List[ClassProp]] = [
5292        # Specifies the algorithm used for calculating the hash value.
5293        ClassProp(
5294            "algorithm",
5295            lambda:
5296            EnumProp((
5297                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/adler32", "adler32"),
5298                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b256", "blake2b256"),
5299                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b384", "blake2b384"),
5300                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake2b512", "blake2b512"),
5301                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/blake3", "blake3"),
5302                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsDilithium", "crystalsDilithium"),
5303                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/crystalsKyber", "crystalsKyber"),
5304                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/falcon", "falcon"),
5305                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md2", "md2"),
5306                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md4", "md4"),
5307                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md5", "md5"),
5308                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/md6", "md6"),
5309                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/other", "other"),
5310                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha1", "sha1"),
5311                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha224", "sha224"),
5312                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha256", "sha256"),
5313                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha384", "sha384"),
5314                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_224", "sha3_224"),
5315                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_256", "sha3_256"),
5316                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_384", "sha3_384"),
5317                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha3_512", "sha3_512"),
5318                    ("https://spdx.org/rdf/3.0.1/terms/Core/HashAlgorithm/sha512", "sha512"),
5319                )),
5320            iri="https://spdx.org/rdf/3.0.1/terms/Core/algorithm",
5321            min_count=1,
5322            compact="algorithm",
5323            deprecated=False,
5324        ),
5325        # The result of applying a hash algorithm to an Element.
5326        ClassProp(
5327            "hashValue",
5328            lambda:
5329            StringProp(),
5330            iri="https://spdx.org/rdf/3.0.1/terms/Core/hashValue",
5331            min_count=1,
5332            compact="hashValue",
5333            deprecated=False,
5334        ),
5335    ]

A mathematically calculated representation of a grouping of data.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
algorithm: str | None
hashValue: str | None
class LifecycleScopedRelationship(Relationship):
5338class LifecycleScopedRelationship(Relationship):
5339    """
5340    Provide context for a relationship that occurs in the lifecycle.
5341    """
5342
5343    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopedRelationship"
5344    COMPACT_TYPE: ClassVar[Optional[str]] = "LifecycleScopedRelationship"
5345    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5346    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5347    PROPERTIES: ClassVar[List[ClassProp]] = [
5348        # Capture the scope of information about a specific relationship between elements.
5349        ClassProp(
5350            "scope",
5351            lambda:
5352            EnumProp((
5353                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/build", "build"),
5354                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/design", "design"),
5355                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/development", "development"),
5356                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/other", "other"),
5357                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/runtime", "runtime"),
5358                    ("https://spdx.org/rdf/3.0.1/terms/Core/LifecycleScopeType/test", "test"),
5359                )),
5360            iri="https://spdx.org/rdf/3.0.1/terms/Core/scope",
5361            compact="scope",
5362            deprecated=False,
5363        ),
5364    ]

Provide context for a relationship that occurs in the lifecycle.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
scope: str | None
class Organization(Agent):
5367class Organization(Agent):
5368    """
5369    A group of people who work together in an organized way for a shared purpose.
5370    """
5371
5372    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Organization"
5373    COMPACT_TYPE: ClassVar[Optional[str]] = "Organization"
5374    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5375    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5376    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
5377        # An Organization representing the SPDX Project.
5378        "SpdxOrganization": "https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization",
5379    }

A group of people who work together in an organized way for a shared purpose.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'SpdxOrganization': 'https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
SpdxOrganization: str = 'https://spdx.org/rdf/3.0.1/terms/Core/SpdxOrganization'
class Person(Agent):
5382class Person(Agent):
5383    """
5384    An individual human being.
5385    """
5386
5387    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Person"
5388    COMPACT_TYPE: ClassVar[Optional[str]] = "Person"
5389    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5390    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

An individual human being.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class SoftwareAgent(Agent):
5393class SoftwareAgent(Agent):
5394    """
5395    A software agent.
5396    """
5397
5398    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/SoftwareAgent"
5399    COMPACT_TYPE: ClassVar[Optional[str]] = "SoftwareAgent"
5400    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5401    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

A software agent.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class expandedlicensing_ConjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
5404class expandedlicensing_ConjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
5405    """
5406    Portion of an AnyLicenseInfo representing a set of licensing information
5407    where all elements apply.
5408    """
5409
5410    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ConjunctiveLicenseSet"
5411    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_ConjunctiveLicenseSet"
5412    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5413    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5414    PROPERTIES: ClassVar[List[ClassProp]] = [
5415        # A license expression participating in a license set.
5416        ClassProp(
5417            "expandedlicensing_member",
5418            lambda:
5419            ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=(
5420                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
5421                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
5422                ),)),
5423            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member",
5424            min_count=2,
5425            compact="expandedlicensing_member",
5426            deprecated=False,
5427        ),
5428    ]

Portion of an AnyLicenseInfo representing a set of licensing information where all elements apply.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_member: ListProxy[str | simplelicensing_AnyLicenseInfo]
class expandedlicensing_CustomLicenseAddition(expandedlicensing_LicenseAddition):
5431class expandedlicensing_CustomLicenseAddition(expandedlicensing_LicenseAddition):
5432    """
5433    A license addition that is not listed on the SPDX Exceptions List.
5434    """
5435
5436    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/CustomLicenseAddition"
5437    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_CustomLicenseAddition"
5438    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5439    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

A license addition that is not listed on the SPDX Exceptions List.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class expandedlicensing_DisjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
5442class expandedlicensing_DisjunctiveLicenseSet(simplelicensing_AnyLicenseInfo):
5443    """
5444    Portion of an AnyLicenseInfo representing a set of licensing information where
5445    only one of the elements applies.
5446    """
5447
5448    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/DisjunctiveLicenseSet"
5449    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_DisjunctiveLicenseSet"
5450    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5451    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5452    PROPERTIES: ClassVar[List[ClassProp]] = [
5453        # A license expression participating in a license set.
5454        ClassProp(
5455            "expandedlicensing_member",
5456            lambda:
5457            ListProp(ObjectProp(simplelicensing_AnyLicenseInfo, False, context=(
5458                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense", "expandedlicensing_NoAssertionLicense"),
5459                    ("https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense", "expandedlicensing_NoneLicense"),
5460                ),)),
5461            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/member",
5462            min_count=2,
5463            compact="expandedlicensing_member",
5464            deprecated=False,
5465        ),
5466    ]

Portion of an AnyLicenseInfo representing a set of licensing information where only one of the elements applies.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_member: ListProxy[str | simplelicensing_AnyLicenseInfo]
class expandedlicensing_ExtendableLicense(simplelicensing_AnyLicenseInfo):
5469class expandedlicensing_ExtendableLicense(simplelicensing_AnyLicenseInfo):
5470    """
5471    Abstract class representing a License or an OrLaterOperator.
5472    """
5473
5474    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ExtendableLicense"
5475    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_ExtendableLicense"
5476    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5477    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5478    IS_ABSTRACT: ClassVar[bool] = True

Abstract class representing a License or an OrLaterOperator.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class expandedlicensing_IndividualLicensingInfo(simplelicensing_AnyLicenseInfo):
5481class expandedlicensing_IndividualLicensingInfo(simplelicensing_AnyLicenseInfo):
5482    """
5483    A concrete subclass of AnyLicenseInfo used by Individuals in the
5484    ExpandedLicensing profile.
5485    """
5486
5487    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/IndividualLicensingInfo"
5488    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_IndividualLicensingInfo"
5489    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5490    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5491    NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {
5492        # An Individual Value for License when no assertion can be made about its actual
5493        # value.
5494        "NoAssertionLicense": "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense",
5495        # An Individual Value for License where the SPDX data creator determines that no
5496        # license is present.
5497        "NoneLicense": "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense",
5498    }

A concrete subclass of AnyLicenseInfo used by Individuals in the ExpandedLicensing profile.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {'NoAssertionLicense': 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense', 'NoneLicense': 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense'}
IS_ABSTRACT: ClassVar[bool] = False
IS_DEPRECATED: ClassVar[bool] = False
NoAssertionLicense: str = 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoAssertionLicense'
NoneLicense: str = 'https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/NoneLicense'
class expandedlicensing_License(expandedlicensing_ExtendableLicense):
5501class expandedlicensing_License(expandedlicensing_ExtendableLicense):
5502    """
5503    Abstract class for the portion of an AnyLicenseInfo representing a license.
5504    """
5505
5506    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/License"
5507    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_License"
5508    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5509    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5510    IS_ABSTRACT: ClassVar[bool] = True
5511    PROPERTIES: ClassVar[List[ClassProp]] = [
5512        # Specifies whether a license or additional text identifier has been marked as
5513        # deprecated.
5514        ClassProp(
5515            "expandedlicensing_isDeprecatedLicenseId",
5516            lambda:
5517            BooleanProp(),
5518            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/isDeprecatedLicenseId",
5519            compact="expandedlicensing_isDeprecatedLicenseId",
5520            deprecated=False,
5521        ),
5522        # Specifies whether the License is listed as free by the
5523        # Free Software Foundation (FSF).
5524        ClassProp(
5525            "expandedlicensing_isFsfLibre",
5526            lambda:
5527            BooleanProp(),
5528            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/isFsfLibre",
5529            compact="expandedlicensing_isFsfLibre",
5530            deprecated=False,
5531        ),
5532        # Specifies whether the License is listed as approved by the
5533        # Open Source Initiative (OSI).
5534        ClassProp(
5535            "expandedlicensing_isOsiApproved",
5536            lambda:
5537            BooleanProp(),
5538            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/isOsiApproved",
5539            compact="expandedlicensing_isOsiApproved",
5540            deprecated=False,
5541        ),
5542        # Identifies all the text and metadata associated with a license in the license
5543        # XML format.
5544        ClassProp(
5545            "expandedlicensing_licenseXml",
5546            lambda:
5547            StringProp(),
5548            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/licenseXml",
5549            compact="expandedlicensing_licenseXml",
5550            deprecated=False,
5551        ),
5552        # Specifies the licenseId that is preferred to be used in place of a deprecated
5553        # License or LicenseAddition.
5554        ClassProp(
5555            "expandedlicensing_obsoletedBy",
5556            lambda:
5557            StringProp(),
5558            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/obsoletedBy",
5559            compact="expandedlicensing_obsoletedBy",
5560            deprecated=False,
5561        ),
5562        # Contains a URL where the License or LicenseAddition can be found in use.
5563        ClassProp(
5564            "expandedlicensing_seeAlso",
5565            lambda:
5566            ListProp(AnyURIProp()),
5567            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/seeAlso",
5568            compact="expandedlicensing_seeAlso",
5569            deprecated=False,
5570        ),
5571        # Provides a License author's preferred text to indicate that a file is covered
5572        # by the License.
5573        ClassProp(
5574            "expandedlicensing_standardLicenseHeader",
5575            lambda:
5576            StringProp(),
5577            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/standardLicenseHeader",
5578            compact="expandedlicensing_standardLicenseHeader",
5579            deprecated=False,
5580        ),
5581        # Identifies the full text of a License, in SPDX templating format.
5582        ClassProp(
5583            "expandedlicensing_standardLicenseTemplate",
5584            lambda:
5585            StringProp(),
5586            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/standardLicenseTemplate",
5587            compact="expandedlicensing_standardLicenseTemplate",
5588            deprecated=False,
5589        ),
5590        # Identifies the full text of a License or Addition.
5591        ClassProp(
5592            "simplelicensing_licenseText",
5593            lambda:
5594            StringProp(),
5595            iri="https://spdx.org/rdf/3.0.1/terms/SimpleLicensing/licenseText",
5596            min_count=1,
5597            compact="simplelicensing_licenseText",
5598            deprecated=False,
5599        ),
5600    ]

Abstract class for the portion of an AnyLicenseInfo representing a license.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_isDeprecatedLicenseId: bool | None
expandedlicensing_isFsfLibre: bool | None
expandedlicensing_isOsiApproved: bool | None
expandedlicensing_licenseXml: str | None
expandedlicensing_obsoletedBy: str | None
expandedlicensing_seeAlso: ListProxy[str]
expandedlicensing_standardLicenseHeader: str | None
expandedlicensing_standardLicenseTemplate: str | None
simplelicensing_licenseText: str | None
class expandedlicensing_ListedLicense(expandedlicensing_License):
5603class expandedlicensing_ListedLicense(expandedlicensing_License):
5604    """
5605    A license that is listed on the SPDX License List.
5606    """
5607
5608    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/ListedLicense"
5609    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_ListedLicense"
5610    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5611    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5612    PROPERTIES: ClassVar[List[ClassProp]] = [
5613        # Specifies the SPDX License List version in which this license or exception
5614        # identifier was deprecated.
5615        ClassProp(
5616            "expandedlicensing_deprecatedVersion",
5617            lambda:
5618            StringProp(),
5619            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/deprecatedVersion",
5620            compact="expandedlicensing_deprecatedVersion",
5621            deprecated=False,
5622        ),
5623        # Specifies the SPDX License List version in which this ListedLicense or
5624        # ListedLicenseException identifier was first added.
5625        ClassProp(
5626            "expandedlicensing_listVersionAdded",
5627            lambda:
5628            StringProp(),
5629            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/listVersionAdded",
5630            compact="expandedlicensing_listVersionAdded",
5631            deprecated=False,
5632        ),
5633    ]

A license that is listed on the SPDX License List.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_deprecatedVersion: str | None
expandedlicensing_listVersionAdded: str | None
class expandedlicensing_OrLaterOperator(expandedlicensing_ExtendableLicense):
5636class expandedlicensing_OrLaterOperator(expandedlicensing_ExtendableLicense):
5637    """
5638    Portion of an AnyLicenseInfo representing this version, or any later version,
5639    of the indicated License.
5640    """
5641
5642    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/OrLaterOperator"
5643    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_OrLaterOperator"
5644    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5645    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5646    PROPERTIES: ClassVar[List[ClassProp]] = [
5647        # A License participating in an 'or later' model.
5648        ClassProp(
5649            "expandedlicensing_subjectLicense",
5650            lambda:
5651            ObjectProp(expandedlicensing_License, True),
5652            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/subjectLicense",
5653            min_count=1,
5654            compact="expandedlicensing_subjectLicense",
5655            deprecated=False,
5656        ),
5657    ]

Portion of an AnyLicenseInfo representing this version, or any later version, of the indicated License.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_subjectLicense: str | expandedlicensing_License | None
class expandedlicensing_WithAdditionOperator(simplelicensing_AnyLicenseInfo):
5660class expandedlicensing_WithAdditionOperator(simplelicensing_AnyLicenseInfo):
5661    """
5662    Portion of an AnyLicenseInfo representing a License which has additional
5663    text applied to it.
5664    """
5665
5666    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/WithAdditionOperator"
5667    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_WithAdditionOperator"
5668    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5669    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5670    PROPERTIES: ClassVar[List[ClassProp]] = [
5671        # A LicenseAddition participating in a 'with addition' model.
5672        ClassProp(
5673            "expandedlicensing_subjectAddition",
5674            lambda:
5675            ObjectProp(expandedlicensing_LicenseAddition, True),
5676            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/subjectAddition",
5677            min_count=1,
5678            compact="expandedlicensing_subjectAddition",
5679            deprecated=False,
5680        ),
5681        # A License participating in a 'with addition' model.
5682        ClassProp(
5683            "expandedlicensing_subjectExtendableLicense",
5684            lambda:
5685            ObjectProp(expandedlicensing_ExtendableLicense, True),
5686            iri="https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/subjectExtendableLicense",
5687            min_count=1,
5688            compact="expandedlicensing_subjectExtendableLicense",
5689            deprecated=False,
5690        ),
5691    ]

Portion of an AnyLicenseInfo representing a License which has additional text applied to it.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
expandedlicensing_subjectAddition: str | expandedlicensing_LicenseAddition | None
expandedlicensing_subjectExtendableLicense: str | expandedlicensing_ExtendableLicense | None
class extension_CdxPropertiesExtension(extension_Extension):
5694class extension_CdxPropertiesExtension(extension_Extension):
5695    """
5696    A type of extension consisting of a list of name value pairs.
5697    """
5698
5699    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Extension/CdxPropertiesExtension"
5700    COMPACT_TYPE: ClassVar[Optional[str]] = "extension_CdxPropertiesExtension"
5701    NODE_KIND: ClassVar[NodeKind] = NodeKind.BlankNodeOrIRI
5702    PROPERTIES: ClassVar[List[ClassProp]] = [
5703        # Provides a map of a property names to a values.
5704        ClassProp(
5705            "extension_cdxProperty",
5706            lambda:
5707            ListProp(ObjectProp(extension_CdxPropertyEntry, False)),
5708            iri="https://spdx.org/rdf/3.0.1/terms/Extension/cdxProperty",
5709            min_count=1,
5710            compact="extension_cdxProperty",
5711            deprecated=False,
5712        ),
5713    ]

A type of extension consisting of a list of name value pairs.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.BlankNodeOrIRI: 3>
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
extension_cdxProperty: ListProxy[str | extension_CdxPropertyEntry]
class security_CvssV2VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5716class security_CvssV2VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5717    """
5718    Provides a CVSS version 2.0 assessment for a vulnerability.
5719    """
5720
5721    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/CvssV2VulnAssessmentRelationship"
5722    COMPACT_TYPE: ClassVar[Optional[str]] = "security_CvssV2VulnAssessmentRelationship"
5723    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5724    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5725    PROPERTIES: ClassVar[List[ClassProp]] = [
5726        # Provides a numerical (0-10) representation of the severity of a vulnerability.
5727        ClassProp(
5728            "security_score",
5729            lambda:
5730            FloatProp(),
5731            iri="https://spdx.org/rdf/3.0.1/terms/Security/score",
5732            min_count=1,
5733            compact="security_score",
5734            deprecated=False,
5735        ),
5736        # Specifies the CVSS vector string for a vulnerability.
5737        ClassProp(
5738            "security_vectorString",
5739            lambda:
5740            StringProp(),
5741            iri="https://spdx.org/rdf/3.0.1/terms/Security/vectorString",
5742            min_count=1,
5743            compact="security_vectorString",
5744            deprecated=False,
5745        ),
5746    ]

Provides a CVSS version 2.0 assessment for a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_score: float | None
security_vectorString: str | None
class security_CvssV3VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5749class security_CvssV3VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5750    """
5751    Provides a CVSS version 3 assessment for a vulnerability.
5752    """
5753
5754    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/CvssV3VulnAssessmentRelationship"
5755    COMPACT_TYPE: ClassVar[Optional[str]] = "security_CvssV3VulnAssessmentRelationship"
5756    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5757    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5758    PROPERTIES: ClassVar[List[ClassProp]] = [
5759        # Provides a numerical (0-10) representation of the severity of a vulnerability.
5760        ClassProp(
5761            "security_score",
5762            lambda:
5763            FloatProp(),
5764            iri="https://spdx.org/rdf/3.0.1/terms/Security/score",
5765            min_count=1,
5766            compact="security_score",
5767            deprecated=False,
5768        ),
5769        # Specifies the CVSS qualitative severity rating of a vulnerability in relation to a piece of software.
5770        ClassProp(
5771            "security_severity",
5772            lambda:
5773            EnumProp((
5774                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical", "critical"),
5775                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high", "high"),
5776                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low", "low"),
5777                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium", "medium"),
5778                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none", "none"),
5779                )),
5780            iri="https://spdx.org/rdf/3.0.1/terms/Security/severity",
5781            min_count=1,
5782            compact="security_severity",
5783            deprecated=False,
5784        ),
5785        # Specifies the CVSS vector string for a vulnerability.
5786        ClassProp(
5787            "security_vectorString",
5788            lambda:
5789            StringProp(),
5790            iri="https://spdx.org/rdf/3.0.1/terms/Security/vectorString",
5791            min_count=1,
5792            compact="security_vectorString",
5793            deprecated=False,
5794        ),
5795    ]

Provides a CVSS version 3 assessment for a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_score: float | None
security_severity: str | None
security_vectorString: str | None
class security_CvssV4VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5798class security_CvssV4VulnAssessmentRelationship(security_VulnAssessmentRelationship):
5799    """
5800    Provides a CVSS version 4 assessment for a vulnerability.
5801    """
5802
5803    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/CvssV4VulnAssessmentRelationship"
5804    COMPACT_TYPE: ClassVar[Optional[str]] = "security_CvssV4VulnAssessmentRelationship"
5805    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5806    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5807    PROPERTIES: ClassVar[List[ClassProp]] = [
5808        # Provides a numerical (0-10) representation of the severity of a vulnerability.
5809        ClassProp(
5810            "security_score",
5811            lambda:
5812            FloatProp(),
5813            iri="https://spdx.org/rdf/3.0.1/terms/Security/score",
5814            min_count=1,
5815            compact="security_score",
5816            deprecated=False,
5817        ),
5818        # Specifies the CVSS qualitative severity rating of a vulnerability in relation to a piece of software.
5819        ClassProp(
5820            "security_severity",
5821            lambda:
5822            EnumProp((
5823                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/critical", "critical"),
5824                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/high", "high"),
5825                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/low", "low"),
5826                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/medium", "medium"),
5827                    ("https://spdx.org/rdf/3.0.1/terms/Security/CvssSeverityType/none", "none"),
5828                )),
5829            iri="https://spdx.org/rdf/3.0.1/terms/Security/severity",
5830            min_count=1,
5831            compact="security_severity",
5832            deprecated=False,
5833        ),
5834        # Specifies the CVSS vector string for a vulnerability.
5835        ClassProp(
5836            "security_vectorString",
5837            lambda:
5838            StringProp(),
5839            iri="https://spdx.org/rdf/3.0.1/terms/Security/vectorString",
5840            min_count=1,
5841            compact="security_vectorString",
5842            deprecated=False,
5843        ),
5844    ]

Provides a CVSS version 4 assessment for a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_score: float | None
security_severity: str | None
security_vectorString: str | None
class security_EpssVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5847class security_EpssVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5848    """
5849    Provides an EPSS assessment for a vulnerability.
5850    """
5851
5852    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/EpssVulnAssessmentRelationship"
5853    COMPACT_TYPE: ClassVar[Optional[str]] = "security_EpssVulnAssessmentRelationship"
5854    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5855    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5856    PROPERTIES: ClassVar[List[ClassProp]] = [
5857        # The percentile of the current probability score.
5858        ClassProp(
5859            "security_percentile",
5860            lambda:
5861            FloatProp(),
5862            iri="https://spdx.org/rdf/3.0.1/terms/Security/percentile",
5863            min_count=1,
5864            compact="security_percentile",
5865            deprecated=False,
5866        ),
5867        # A probability score between 0 and 1 of a vulnerability being exploited.
5868        ClassProp(
5869            "security_probability",
5870            lambda:
5871            FloatProp(),
5872            iri="https://spdx.org/rdf/3.0.1/terms/Security/probability",
5873            min_count=1,
5874            compact="security_probability",
5875            deprecated=False,
5876        ),
5877    ]

Provides an EPSS assessment for a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_percentile: float | None
security_probability: float | None
class security_ExploitCatalogVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5880class security_ExploitCatalogVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5881    """
5882    Provides an exploit assessment of a vulnerability.
5883    """
5884
5885    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogVulnAssessmentRelationship"
5886    COMPACT_TYPE: ClassVar[Optional[str]] = "security_ExploitCatalogVulnAssessmentRelationship"
5887    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5888    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5889    PROPERTIES: ClassVar[List[ClassProp]] = [
5890        # Specifies the exploit catalog type.
5891        ClassProp(
5892            "security_catalogType",
5893            lambda:
5894            EnumProp((
5895                    ("https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/kev", "kev"),
5896                    ("https://spdx.org/rdf/3.0.1/terms/Security/ExploitCatalogType/other", "other"),
5897                )),
5898            iri="https://spdx.org/rdf/3.0.1/terms/Security/catalogType",
5899            min_count=1,
5900            compact="security_catalogType",
5901            deprecated=False,
5902        ),
5903        # Describe that a CVE is known to have an exploit because it's been listed in an exploit catalog.
5904        ClassProp(
5905            "security_exploited",
5906            lambda:
5907            BooleanProp(),
5908            iri="https://spdx.org/rdf/3.0.1/terms/Security/exploited",
5909            min_count=1,
5910            compact="security_exploited",
5911            deprecated=False,
5912        ),
5913        # Provides the location of an exploit catalog.
5914        ClassProp(
5915            "security_locator",
5916            lambda:
5917            AnyURIProp(),
5918            iri="https://spdx.org/rdf/3.0.1/terms/Security/locator",
5919            min_count=1,
5920            compact="security_locator",
5921            deprecated=False,
5922        ),
5923    ]

Provides an exploit assessment of a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_catalogType: str | None
security_exploited: bool | None
security_locator: str | None
class security_SsvcVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5926class security_SsvcVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5927    """
5928    Provides an SSVC assessment for a vulnerability.
5929    """
5930
5931    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/SsvcVulnAssessmentRelationship"
5932    COMPACT_TYPE: ClassVar[Optional[str]] = "security_SsvcVulnAssessmentRelationship"
5933    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5934    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5935    PROPERTIES: ClassVar[List[ClassProp]] = [
5936        # Provide the enumeration of possible decisions in the
5937        # [Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree](https://www.cisa.gov/stakeholder-specific-vulnerability-categorization-ssvc).
5938        ClassProp(
5939            "security_decisionType",
5940            lambda:
5941            EnumProp((
5942                    ("https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/act", "act"),
5943                    ("https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/attend", "attend"),
5944                    ("https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/track", "track"),
5945                    ("https://spdx.org/rdf/3.0.1/terms/Security/SsvcDecisionType/trackStar", "trackStar"),
5946                )),
5947            iri="https://spdx.org/rdf/3.0.1/terms/Security/decisionType",
5948            min_count=1,
5949            compact="security_decisionType",
5950            deprecated=False,
5951        ),
5952    ]

Provides an SSVC assessment for a vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_decisionType: str | None
class security_VexVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5955class security_VexVulnAssessmentRelationship(security_VulnAssessmentRelationship):
5956    """
5957    Abstract ancestor class for all VEX relationships
5958    """
5959
5960    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexVulnAssessmentRelationship"
5961    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexVulnAssessmentRelationship"
5962    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5963    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5964    IS_ABSTRACT: ClassVar[bool] = True
5965    PROPERTIES: ClassVar[List[ClassProp]] = [
5966        # Conveys information about how VEX status was determined.
5967        ClassProp(
5968            "security_statusNotes",
5969            lambda:
5970            StringProp(),
5971            iri="https://spdx.org/rdf/3.0.1/terms/Security/statusNotes",
5972            compact="security_statusNotes",
5973            deprecated=False,
5974        ),
5975        # Specifies the version of a VEX statement.
5976        ClassProp(
5977            "security_vexVersion",
5978            lambda:
5979            StringProp(),
5980            iri="https://spdx.org/rdf/3.0.1/terms/Security/vexVersion",
5981            compact="security_vexVersion",
5982            deprecated=False,
5983        ),
5984    ]

Abstract ancestor class for all VEX relationships

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_statusNotes: str | None
security_vexVersion: str | None
class security_Vulnerability(Artifact):
5987class security_Vulnerability(Artifact):
5988    """
5989    Specifies a vulnerability and its associated information.
5990    """
5991
5992    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/Vulnerability"
5993    COMPACT_TYPE: ClassVar[Optional[str]] = "security_Vulnerability"
5994    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
5995    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
5996    PROPERTIES: ClassVar[List[ClassProp]] = [
5997        # Specifies a time when a vulnerability assessment was modified
5998        ClassProp(
5999            "security_modifiedTime",
6000            lambda:
6001            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
6002            iri="https://spdx.org/rdf/3.0.1/terms/Security/modifiedTime",
6003            compact="security_modifiedTime",
6004            deprecated=False,
6005        ),
6006        # Specifies the time when a vulnerability was published.
6007        ClassProp(
6008            "security_publishedTime",
6009            lambda:
6010            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
6011            iri="https://spdx.org/rdf/3.0.1/terms/Security/publishedTime",
6012            compact="security_publishedTime",
6013            deprecated=False,
6014        ),
6015        # Specified the time and date when a vulnerability was withdrawn.
6016        ClassProp(
6017            "security_withdrawnTime",
6018            lambda:
6019            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
6020            iri="https://spdx.org/rdf/3.0.1/terms/Security/withdrawnTime",
6021            compact="security_withdrawnTime",
6022            deprecated=False,
6023        ),
6024    ]

Specifies a vulnerability and its associated information.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_modifiedTime: datetime.datetime | None
security_publishedTime: datetime.datetime | None
security_withdrawnTime: datetime.datetime | None
class software_SoftwareArtifact(Artifact):
6027class software_SoftwareArtifact(Artifact):
6028    """
6029    A distinct article or unit related to Software.
6030    """
6031
6032    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/SoftwareArtifact"
6033    COMPACT_TYPE: ClassVar[Optional[str]] = "software_SoftwareArtifact"
6034    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6035    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6036    IS_ABSTRACT: ClassVar[bool] = True
6037    PROPERTIES: ClassVar[List[ClassProp]] = [
6038        # Provides additional purpose information of the software artifact.
6039        ClassProp(
6040            "software_additionalPurpose",
6041            lambda:
6042            ListProp(EnumProp((
6043                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application", "application"),
6044                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive", "archive"),
6045                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom", "bom"),
6046                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration", "configuration"),
6047                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container", "container"),
6048                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data", "data"),
6049                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device", "device"),
6050                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver", "deviceDriver"),
6051                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage", "diskImage"),
6052                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation", "documentation"),
6053                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence", "evidence"),
6054                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable", "executable"),
6055                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file", "file"),
6056                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage", "filesystemImage"),
6057                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware", "firmware"),
6058                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework", "framework"),
6059                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install", "install"),
6060                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library", "library"),
6061                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest", "manifest"),
6062                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model", "model"),
6063                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module", "module"),
6064                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem", "operatingSystem"),
6065                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other", "other"),
6066                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch", "patch"),
6067                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform", "platform"),
6068                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement", "requirement"),
6069                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source", "source"),
6070                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification", "specification"),
6071                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test", "test"),
6072                ))),
6073            iri="https://spdx.org/rdf/3.0.1/terms/Software/additionalPurpose",
6074            compact="software_additionalPurpose",
6075            deprecated=False,
6076        ),
6077        # Provides a place for the SPDX data creator to record acknowledgement text for
6078        # a software Package, File or Snippet.
6079        ClassProp(
6080            "software_attributionText",
6081            lambda:
6082            ListProp(StringProp()),
6083            iri="https://spdx.org/rdf/3.0.1/terms/Software/attributionText",
6084            compact="software_attributionText",
6085            deprecated=False,
6086        ),
6087        # A canonical, unique, immutable identifier of the artifact content, that may be
6088        # used for verifying its identity and/or integrity.
6089        ClassProp(
6090            "software_contentIdentifier",
6091            lambda:
6092            ListProp(ObjectProp(software_ContentIdentifier, False)),
6093            iri="https://spdx.org/rdf/3.0.1/terms/Software/contentIdentifier",
6094            compact="software_contentIdentifier",
6095            deprecated=False,
6096        ),
6097        # Identifies the text of one or more copyright notices for a software Package,
6098        # File or Snippet, if any.
6099        ClassProp(
6100            "software_copyrightText",
6101            lambda:
6102            StringProp(),
6103            iri="https://spdx.org/rdf/3.0.1/terms/Software/copyrightText",
6104            compact="software_copyrightText",
6105            deprecated=False,
6106        ),
6107        # Provides information about the primary purpose of the software artifact.
6108        ClassProp(
6109            "software_primaryPurpose",
6110            lambda:
6111            EnumProp((
6112                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/application", "application"),
6113                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/archive", "archive"),
6114                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/bom", "bom"),
6115                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/configuration", "configuration"),
6116                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/container", "container"),
6117                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/data", "data"),
6118                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/device", "device"),
6119                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/deviceDriver", "deviceDriver"),
6120                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/diskImage", "diskImage"),
6121                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/documentation", "documentation"),
6122                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/evidence", "evidence"),
6123                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/executable", "executable"),
6124                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/file", "file"),
6125                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/filesystemImage", "filesystemImage"),
6126                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/firmware", "firmware"),
6127                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/framework", "framework"),
6128                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/install", "install"),
6129                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/library", "library"),
6130                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/manifest", "manifest"),
6131                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/model", "model"),
6132                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/module", "module"),
6133                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/operatingSystem", "operatingSystem"),
6134                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/other", "other"),
6135                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/patch", "patch"),
6136                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/platform", "platform"),
6137                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/requirement", "requirement"),
6138                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/source", "source"),
6139                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/specification", "specification"),
6140                    ("https://spdx.org/rdf/3.0.1/terms/Software/SoftwarePurpose/test", "test"),
6141                )),
6142            iri="https://spdx.org/rdf/3.0.1/terms/Software/primaryPurpose",
6143            compact="software_primaryPurpose",
6144            deprecated=False,
6145        ),
6146    ]

A distinct article or unit related to Software.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = True
PROPERTIES: ClassVar[List[ClassProp]]
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
software_additionalPurpose: ListProxy[str]
software_attributionText: ListProxy[str]
software_contentIdentifier: ListProxy[str | software_ContentIdentifier]
software_copyrightText: str | None
software_primaryPurpose: str | None
class Bom(Bundle):
6149class Bom(Bundle):
6150    """
6151    A container for a grouping of SPDX-3.0 content characterizing details
6152    (provenence, composition, licensing, etc.) about a product.
6153    """
6154
6155    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Core/Bom"
6156    COMPACT_TYPE: ClassVar[Optional[str]] = "Bom"
6157    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6158    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

A container for a grouping of SPDX-3.0 content characterizing details (provenence, composition, licensing, etc.) about a product.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class expandedlicensing_CustomLicense(expandedlicensing_License):
6161class expandedlicensing_CustomLicense(expandedlicensing_License):
6162    """
6163    A license that is not listed on the SPDX License List.
6164    """
6165
6166    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/ExpandedLicensing/CustomLicense"
6167    COMPACT_TYPE: ClassVar[Optional[str]] = "expandedlicensing_CustomLicense"
6168    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6169    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

A license that is not listed on the SPDX License List.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class security_VexAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6172class security_VexAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6173    """
6174    Connects a vulnerability and an element designating the element as a product
6175    affected by the vulnerability.
6176    """
6177
6178    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexAffectedVulnAssessmentRelationship"
6179    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexAffectedVulnAssessmentRelationship"
6180    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6181    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6182    PROPERTIES: ClassVar[List[ClassProp]] = [
6183        # Provides advise on how to mitigate or remediate a vulnerability when a VEX product
6184        # is affected by it.
6185        ClassProp(
6186            "security_actionStatement",
6187            lambda:
6188            StringProp(),
6189            iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatement",
6190            min_count=1,
6191            compact="security_actionStatement",
6192            deprecated=False,
6193        ),
6194        # Records the time when a recommended action was communicated in a VEX statement
6195        # to mitigate a vulnerability.
6196        ClassProp(
6197            "security_actionStatementTime",
6198            lambda:
6199            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
6200            iri="https://spdx.org/rdf/3.0.1/terms/Security/actionStatementTime",
6201            compact="security_actionStatementTime",
6202            deprecated=False,
6203        ),
6204    ]

Connects a vulnerability and an element designating the element as a product affected by the vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_actionStatement: str | None
security_actionStatementTime: datetime.datetime | None
class security_VexFixedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6207class security_VexFixedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6208    """
6209    Links a vulnerability and elements representing products (in the VEX sense) where
6210    a fix has been applied and are no longer affected.
6211    """
6212
6213    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexFixedVulnAssessmentRelationship"
6214    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexFixedVulnAssessmentRelationship"
6215    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6216    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

Links a vulnerability and elements representing products (in the VEX sense) where a fix has been applied and are no longer affected.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class security_VexNotAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6219class security_VexNotAffectedVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6220    """
6221    Links a vulnerability and one or more elements designating the latter as products
6222    not affected by the vulnerability.
6223    """
6224
6225    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexNotAffectedVulnAssessmentRelationship"
6226    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexNotAffectedVulnAssessmentRelationship"
6227    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6228    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6229    PROPERTIES: ClassVar[List[ClassProp]] = [
6230        # Explains why a VEX product is not affected by a vulnerability. It is an
6231        # alternative in VexNotAffectedVulnAssessmentRelationship to the machine-readable
6232        # justification label.
6233        ClassProp(
6234            "security_impactStatement",
6235            lambda:
6236            StringProp(),
6237            iri="https://spdx.org/rdf/3.0.1/terms/Security/impactStatement",
6238            compact="security_impactStatement",
6239            deprecated=False,
6240        ),
6241        # Timestamp of impact statement.
6242        ClassProp(
6243            "security_impactStatementTime",
6244            lambda:
6245            DateTimeStampProp(pattern=r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\dZ$"),
6246            iri="https://spdx.org/rdf/3.0.1/terms/Security/impactStatementTime",
6247            compact="security_impactStatementTime",
6248            deprecated=False,
6249        ),
6250        # Impact justification label to be used when linking a vulnerability to an element
6251        # representing a VEX product with a VexNotAffectedVulnAssessmentRelationship
6252        # relationship.
6253        ClassProp(
6254            "security_justificationType",
6255            lambda:
6256            EnumProp((
6257                    ("https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/componentNotPresent", "componentNotPresent"),
6258                    ("https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/inlineMitigationsAlreadyExist", "inlineMitigationsAlreadyExist"),
6259                    ("https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeCannotBeControlledByAdversary", "vulnerableCodeCannotBeControlledByAdversary"),
6260                    ("https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotInExecutePath", "vulnerableCodeNotInExecutePath"),
6261                    ("https://spdx.org/rdf/3.0.1/terms/Security/VexJustificationType/vulnerableCodeNotPresent", "vulnerableCodeNotPresent"),
6262                )),
6263            iri="https://spdx.org/rdf/3.0.1/terms/Security/justificationType",
6264            compact="security_justificationType",
6265            deprecated=False,
6266        ),
6267    ]

Links a vulnerability and one or more elements designating the latter as products not affected by the vulnerability.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
security_impactStatement: str | None
security_impactStatementTime: datetime.datetime | None
security_justificationType: str | None
class security_VexUnderInvestigationVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6270class security_VexUnderInvestigationVulnAssessmentRelationship(security_VexVulnAssessmentRelationship):
6271    """
6272    Designates elements as products where the impact of a vulnerability is being
6273    investigated.
6274    """
6275
6276    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Security/VexUnderInvestigationVulnAssessmentRelationship"
6277    COMPACT_TYPE: ClassVar[Optional[str]] = "security_VexUnderInvestigationVulnAssessmentRelationship"
6278    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6279    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"

Designates elements as products where the impact of a vulnerability is being investigated.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
class software_File(software_SoftwareArtifact):
6282class software_File(software_SoftwareArtifact):
6283    """
6284    Refers to any object that stores content on a computer.
6285    """
6286
6287    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/File"
6288    COMPACT_TYPE: ClassVar[Optional[str]] = "software_File"
6289    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6290    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6291    PROPERTIES: ClassVar[List[ClassProp]] = [
6292        # Provides information about the content type of an Element or a Property.
6293        ClassProp(
6294            "contentType",
6295            lambda:
6296            StringProp(pattern=r"^[^\/]+\/[^\/]+$"),
6297            iri="https://spdx.org/rdf/3.0.1/terms/Core/contentType",
6298            compact="contentType",
6299            deprecated=False,
6300        ),
6301        # Describes if a given file is a directory or non-directory kind of file.
6302        ClassProp(
6303            "software_fileKind",
6304            lambda:
6305            EnumProp((
6306                    ("https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/directory", "directory"),
6307                    ("https://spdx.org/rdf/3.0.1/terms/Software/FileKindType/file", "file"),
6308                )),
6309            iri="https://spdx.org/rdf/3.0.1/terms/Software/fileKind",
6310            compact="software_fileKind",
6311            deprecated=False,
6312        ),
6313    ]

Refers to any object that stores content on a computer.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
contentType: str | None
software_fileKind: str | None
class software_Package(software_SoftwareArtifact):
6316class software_Package(software_SoftwareArtifact):
6317    """
6318    Refers to any unit of content that can be associated with a distribution of
6319    software.
6320    """
6321
6322    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/Package"
6323    COMPACT_TYPE: ClassVar[Optional[str]] = "software_Package"
6324    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6325    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6326    PROPERTIES: ClassVar[List[ClassProp]] = [
6327        # Identifies the download Uniform Resource Identifier for the package at the time
6328        # that the document was created.
6329        ClassProp(
6330            "software_downloadLocation",
6331            lambda:
6332            AnyURIProp(),
6333            iri="https://spdx.org/rdf/3.0.1/terms/Software/downloadLocation",
6334            compact="software_downloadLocation",
6335            deprecated=False,
6336        ),
6337        # A place for the SPDX document creator to record a website that serves as the
6338        # package's home page.
6339        ClassProp(
6340            "software_homePage",
6341            lambda:
6342            AnyURIProp(),
6343            iri="https://spdx.org/rdf/3.0.1/terms/Software/homePage",
6344            compact="software_homePage",
6345            deprecated=False,
6346        ),
6347        # Provides a place for the SPDX data creator to record the package URL string
6348        # (in accordance with the Package URL specification) for a software Package.
6349        ClassProp(
6350            "software_packageUrl",
6351            lambda:
6352            AnyURIProp(),
6353            iri="https://spdx.org/rdf/3.0.1/terms/Software/packageUrl",
6354            compact="software_packageUrl",
6355            deprecated=False,
6356        ),
6357        # Identify the version of a package.
6358        ClassProp(
6359            "software_packageVersion",
6360            lambda:
6361            StringProp(),
6362            iri="https://spdx.org/rdf/3.0.1/terms/Software/packageVersion",
6363            compact="software_packageVersion",
6364            deprecated=False,
6365        ),
6366        # Records any relevant background information or additional comments
6367        # about the origin of the package.
6368        ClassProp(
6369            "software_sourceInfo",
6370            lambda:
6371            StringProp(),
6372            iri="https://spdx.org/rdf/3.0.1/terms/Software/sourceInfo",
6373            compact="software_sourceInfo",
6374            deprecated=False,
6375        ),
6376    ]

Refers to any unit of content that can be associated with a distribution of software.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
software_downloadLocation: str | None
software_homePage: str | None
software_packageUrl: str | None
software_packageVersion: str | None
software_sourceInfo: str | None
class software_Sbom(Bom):
6379class software_Sbom(Bom):
6380    """
6381    A collection of SPDX Elements describing a single package.
6382    """
6383
6384    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/Sbom"
6385    COMPACT_TYPE: ClassVar[Optional[str]] = "software_Sbom"
6386    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6387    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6388    PROPERTIES: ClassVar[List[ClassProp]] = [
6389        # Provides information about the type of an SBOM.
6390        ClassProp(
6391            "software_sbomType",
6392            lambda:
6393            ListProp(EnumProp((
6394                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/analyzed", "analyzed"),
6395                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/build", "build"),
6396                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/deployed", "deployed"),
6397                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/design", "design"),
6398                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/runtime", "runtime"),
6399                    ("https://spdx.org/rdf/3.0.1/terms/Software/SbomType/source", "source"),
6400                ))),
6401            iri="https://spdx.org/rdf/3.0.1/terms/Software/sbomType",
6402            compact="software_sbomType",
6403            deprecated=False,
6404        ),
6405    ]

A collection of SPDX Elements describing a single package.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
software_sbomType: ListProxy[str]
class software_Snippet(software_SoftwareArtifact):
6408class software_Snippet(software_SoftwareArtifact):
6409    """
6410    Describes a certain part of a file.
6411    """
6412
6413    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Software/Snippet"
6414    COMPACT_TYPE: ClassVar[Optional[str]] = "software_Snippet"
6415    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6416    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6417    PROPERTIES: ClassVar[List[ClassProp]] = [
6418        # Defines the byte range in the original host file that the snippet information
6419        # applies to.
6420        ClassProp(
6421            "software_byteRange",
6422            lambda:
6423            ObjectProp(PositiveIntegerRange, False),
6424            iri="https://spdx.org/rdf/3.0.1/terms/Software/byteRange",
6425            compact="software_byteRange",
6426            deprecated=False,
6427        ),
6428        # Defines the line range in the original host file that the snippet information
6429        # applies to.
6430        ClassProp(
6431            "software_lineRange",
6432            lambda:
6433            ObjectProp(PositiveIntegerRange, False),
6434            iri="https://spdx.org/rdf/3.0.1/terms/Software/lineRange",
6435            compact="software_lineRange",
6436            deprecated=False,
6437        ),
6438        # Defines the original host file that the snippet information applies to.
6439        ClassProp(
6440            "software_snippetFromFile",
6441            lambda:
6442            ObjectProp(software_File, True),
6443            iri="https://spdx.org/rdf/3.0.1/terms/Software/snippetFromFile",
6444            min_count=1,
6445            compact="software_snippetFromFile",
6446            deprecated=False,
6447        ),
6448    ]

Describes a certain part of a file.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
software_byteRange: str | PositiveIntegerRange | None
software_lineRange: str | PositiveIntegerRange | None
software_snippetFromFile: str | software_File | None
class ai_AIPackage(software_Package):
6451class ai_AIPackage(software_Package):
6452    """
6453    Specifies an AI package and its associated information.
6454    """
6455
6456    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/AI/AIPackage"
6457    COMPACT_TYPE: ClassVar[Optional[str]] = "ai_AIPackage"
6458    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6459    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6460    PROPERTIES: ClassVar[List[ClassProp]] = [
6461        # Indicates whether the system can perform a decision or action without human
6462        # involvement or guidance.
6463        ClassProp(
6464            "ai_autonomyType",
6465            lambda:
6466            EnumProp((
6467                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no", "no"),
6468                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion", "noAssertion"),
6469                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes", "yes"),
6470                )),
6471            iri="https://spdx.org/rdf/3.0.1/terms/AI/autonomyType",
6472            compact="ai_autonomyType",
6473            deprecated=False,
6474        ),
6475        # Captures the domain in which the AI package can be used.
6476        ClassProp(
6477            "ai_domain",
6478            lambda:
6479            ListProp(StringProp()),
6480            iri="https://spdx.org/rdf/3.0.1/terms/AI/domain",
6481            compact="ai_domain",
6482            deprecated=False,
6483        ),
6484        # Indicates the amount of energy consumption incurred by an AI model.
6485        ClassProp(
6486            "ai_energyConsumption",
6487            lambda:
6488            ObjectProp(ai_EnergyConsumption, False),
6489            iri="https://spdx.org/rdf/3.0.1/terms/AI/energyConsumption",
6490            compact="ai_energyConsumption",
6491            deprecated=False,
6492        ),
6493        # Records a hyperparameter used to build the AI model contained in the AI
6494        # package.
6495        ClassProp(
6496            "ai_hyperparameter",
6497            lambda:
6498            ListProp(ObjectProp(DictionaryEntry, False)),
6499            iri="https://spdx.org/rdf/3.0.1/terms/AI/hyperparameter",
6500            compact="ai_hyperparameter",
6501            deprecated=False,
6502        ),
6503        # Provides relevant information about the AI software, not including the model
6504        # description.
6505        ClassProp(
6506            "ai_informationAboutApplication",
6507            lambda:
6508            StringProp(),
6509            iri="https://spdx.org/rdf/3.0.1/terms/AI/informationAboutApplication",
6510            compact="ai_informationAboutApplication",
6511            deprecated=False,
6512        ),
6513        # Describes relevant information about different steps of the training process.
6514        ClassProp(
6515            "ai_informationAboutTraining",
6516            lambda:
6517            StringProp(),
6518            iri="https://spdx.org/rdf/3.0.1/terms/AI/informationAboutTraining",
6519            compact="ai_informationAboutTraining",
6520            deprecated=False,
6521        ),
6522        # Captures a limitation of the AI software.
6523        ClassProp(
6524            "ai_limitation",
6525            lambda:
6526            StringProp(),
6527            iri="https://spdx.org/rdf/3.0.1/terms/AI/limitation",
6528            compact="ai_limitation",
6529            deprecated=False,
6530        ),
6531        # Records the measurement of prediction quality of the AI model.
6532        ClassProp(
6533            "ai_metric",
6534            lambda:
6535            ListProp(ObjectProp(DictionaryEntry, False)),
6536            iri="https://spdx.org/rdf/3.0.1/terms/AI/metric",
6537            compact="ai_metric",
6538            deprecated=False,
6539        ),
6540        # Captures the threshold that was used for computation of a metric described in
6541        # the metric field.
6542        ClassProp(
6543            "ai_metricDecisionThreshold",
6544            lambda:
6545            ListProp(ObjectProp(DictionaryEntry, False)),
6546            iri="https://spdx.org/rdf/3.0.1/terms/AI/metricDecisionThreshold",
6547            compact="ai_metricDecisionThreshold",
6548            deprecated=False,
6549        ),
6550        # Describes all the preprocessing steps applied to the training data before the
6551        # model training.
6552        ClassProp(
6553            "ai_modelDataPreprocessing",
6554            lambda:
6555            ListProp(StringProp()),
6556            iri="https://spdx.org/rdf/3.0.1/terms/AI/modelDataPreprocessing",
6557            compact="ai_modelDataPreprocessing",
6558            deprecated=False,
6559        ),
6560        # Describes methods that can be used to explain the results from the AI model.
6561        ClassProp(
6562            "ai_modelExplainability",
6563            lambda:
6564            ListProp(StringProp()),
6565            iri="https://spdx.org/rdf/3.0.1/terms/AI/modelExplainability",
6566            compact="ai_modelExplainability",
6567            deprecated=False,
6568        ),
6569        # Records the results of general safety risk assessment of the AI system.
6570        ClassProp(
6571            "ai_safetyRiskAssessment",
6572            lambda:
6573            EnumProp((
6574                    ("https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/high", "high"),
6575                    ("https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/low", "low"),
6576                    ("https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/medium", "medium"),
6577                    ("https://spdx.org/rdf/3.0.1/terms/AI/SafetyRiskAssessmentType/serious", "serious"),
6578                )),
6579            iri="https://spdx.org/rdf/3.0.1/terms/AI/safetyRiskAssessment",
6580            compact="ai_safetyRiskAssessment",
6581            deprecated=False,
6582        ),
6583        # Captures a standard that is being complied with.
6584        ClassProp(
6585            "ai_standardCompliance",
6586            lambda:
6587            ListProp(StringProp()),
6588            iri="https://spdx.org/rdf/3.0.1/terms/AI/standardCompliance",
6589            compact="ai_standardCompliance",
6590            deprecated=False,
6591        ),
6592        # Records the type of the model used in the AI software.
6593        ClassProp(
6594            "ai_typeOfModel",
6595            lambda:
6596            ListProp(StringProp()),
6597            iri="https://spdx.org/rdf/3.0.1/terms/AI/typeOfModel",
6598            compact="ai_typeOfModel",
6599            deprecated=False,
6600        ),
6601        # Records if sensitive personal information is used during model training or
6602        # could be used during the inference.
6603        ClassProp(
6604            "ai_useSensitivePersonalInformation",
6605            lambda:
6606            EnumProp((
6607                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no", "no"),
6608                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion", "noAssertion"),
6609                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes", "yes"),
6610                )),
6611            iri="https://spdx.org/rdf/3.0.1/terms/AI/useSensitivePersonalInformation",
6612            compact="ai_useSensitivePersonalInformation",
6613            deprecated=False,
6614        ),
6615    ]

Specifies an AI package and its associated information.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
ai_autonomyType: str | None
ai_domain: ListProxy[str]
ai_energyConsumption: str | ai_EnergyConsumption | None
ai_hyperparameter: ListProxy[str | DictionaryEntry]
ai_informationAboutApplication: str | None
ai_informationAboutTraining: str | None
ai_limitation: str | None
ai_metric: ListProxy[str | DictionaryEntry]
ai_metricDecisionThreshold: ListProxy[str | DictionaryEntry]
ai_modelDataPreprocessing: ListProxy[str]
ai_modelExplainability: ListProxy[str]
ai_safetyRiskAssessment: str | None
ai_standardCompliance: ListProxy[str]
ai_typeOfModel: ListProxy[str]
ai_useSensitivePersonalInformation: str | None
class dataset_DatasetPackage(software_Package):
6618class dataset_DatasetPackage(software_Package):
6619    """
6620    Specifies a data package and its associated information.
6621    """
6622
6623    TYPE: ClassVar[str] = "https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetPackage"
6624    COMPACT_TYPE: ClassVar[Optional[str]] = "dataset_DatasetPackage"
6625    NODE_KIND: ClassVar[NodeKind] = NodeKind.IRI
6626    ID_ALIAS: ClassVar[Optional[str]] = "spdxId"
6627    PROPERTIES: ClassVar[List[ClassProp]] = [
6628        # Describes the anonymization methods used.
6629        ClassProp(
6630            "dataset_anonymizationMethodUsed",
6631            lambda:
6632            ListProp(StringProp()),
6633            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/anonymizationMethodUsed",
6634            compact="dataset_anonymizationMethodUsed",
6635            deprecated=False,
6636        ),
6637        # Describes the confidentiality level of the data points contained in the dataset.
6638        ClassProp(
6639            "dataset_confidentialityLevel",
6640            lambda:
6641            EnumProp((
6642                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/amber", "amber"),
6643                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/clear", "clear"),
6644                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/green", "green"),
6645                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/ConfidentialityLevelType/red", "red"),
6646                )),
6647            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/confidentialityLevel",
6648            compact="dataset_confidentialityLevel",
6649            deprecated=False,
6650        ),
6651        # Describes how the dataset was collected.
6652        ClassProp(
6653            "dataset_dataCollectionProcess",
6654            lambda:
6655            StringProp(),
6656            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/dataCollectionProcess",
6657            compact="dataset_dataCollectionProcess",
6658            deprecated=False,
6659        ),
6660        # Describes the preprocessing steps that were applied to the raw data to create the given dataset.
6661        ClassProp(
6662            "dataset_dataPreprocessing",
6663            lambda:
6664            ListProp(StringProp()),
6665            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/dataPreprocessing",
6666            compact="dataset_dataPreprocessing",
6667            deprecated=False,
6668        ),
6669        # The field describes the availability of a dataset.
6670        ClassProp(
6671            "dataset_datasetAvailability",
6672            lambda:
6673            EnumProp((
6674                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/clickthrough", "clickthrough"),
6675                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/directDownload", "directDownload"),
6676                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/query", "query"),
6677                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/registration", "registration"),
6678                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetAvailabilityType/scrapingScript", "scrapingScript"),
6679                )),
6680            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/datasetAvailability",
6681            compact="dataset_datasetAvailability",
6682            deprecated=False,
6683        ),
6684        # Describes potentially noisy elements of the dataset.
6685        ClassProp(
6686            "dataset_datasetNoise",
6687            lambda:
6688            StringProp(),
6689            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/datasetNoise",
6690            compact="dataset_datasetNoise",
6691            deprecated=False,
6692        ),
6693        # Captures the size of the dataset.
6694        ClassProp(
6695            "dataset_datasetSize",
6696            lambda:
6697            NonNegativeIntegerProp(),
6698            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/datasetSize",
6699            compact="dataset_datasetSize",
6700            deprecated=False,
6701        ),
6702        # Describes the type of the given dataset.
6703        ClassProp(
6704            "dataset_datasetType",
6705            lambda:
6706            ListProp(EnumProp((
6707                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/audio", "audio"),
6708                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/categorical", "categorical"),
6709                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/graph", "graph"),
6710                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/image", "image"),
6711                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/noAssertion", "noAssertion"),
6712                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/numeric", "numeric"),
6713                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/other", "other"),
6714                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/sensor", "sensor"),
6715                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/structured", "structured"),
6716                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/syntactic", "syntactic"),
6717                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/text", "text"),
6718                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timeseries", "timeseries"),
6719                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/timestamp", "timestamp"),
6720                    ("https://spdx.org/rdf/3.0.1/terms/Dataset/DatasetType/video", "video"),
6721                ))),
6722            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/datasetType",
6723            min_count=1,
6724            compact="dataset_datasetType",
6725            deprecated=False,
6726        ),
6727        # Describes a mechanism to update the dataset.
6728        ClassProp(
6729            "dataset_datasetUpdateMechanism",
6730            lambda:
6731            StringProp(),
6732            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/datasetUpdateMechanism",
6733            compact="dataset_datasetUpdateMechanism",
6734            deprecated=False,
6735        ),
6736        # Describes if any sensitive personal information is present in the dataset.
6737        ClassProp(
6738            "dataset_hasSensitivePersonalInformation",
6739            lambda:
6740            EnumProp((
6741                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/no", "no"),
6742                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/noAssertion", "noAssertion"),
6743                    ("https://spdx.org/rdf/3.0.1/terms/Core/PresenceType/yes", "yes"),
6744                )),
6745            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/hasSensitivePersonalInformation",
6746            compact="dataset_hasSensitivePersonalInformation",
6747            deprecated=False,
6748        ),
6749        # Describes what the given dataset should be used for.
6750        ClassProp(
6751            "dataset_intendedUse",
6752            lambda:
6753            StringProp(),
6754            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/intendedUse",
6755            compact="dataset_intendedUse",
6756            deprecated=False,
6757        ),
6758        # Records the biases that the dataset is known to encompass.
6759        ClassProp(
6760            "dataset_knownBias",
6761            lambda:
6762            ListProp(StringProp()),
6763            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/knownBias",
6764            compact="dataset_knownBias",
6765            deprecated=False,
6766        ),
6767        # Describes a sensor used for collecting the data.
6768        ClassProp(
6769            "dataset_sensor",
6770            lambda:
6771            ListProp(ObjectProp(DictionaryEntry, False)),
6772            iri="https://spdx.org/rdf/3.0.1/terms/Dataset/sensor",
6773            compact="dataset_sensor",
6774            deprecated=False,
6775        ),
6776    ]

Specifies a data package and its associated information.

TYPE: ClassVar[str]
COMPACT_TYPE: ClassVar[str | None]
NODE_KIND: ClassVar[NodeKind] = <NodeKind.IRI: 2>
ID_ALIAS: ClassVar[str | None] = 'spdxId'
PROPERTIES: ClassVar[List[ClassProp]]
IS_ABSTRACT: ClassVar[bool] = False
NAMED_INDIVIDUALS: ClassVar[Dict[str, str]] = {}
IS_DEPRECATED: ClassVar[bool] = False
dataset_anonymizationMethodUsed: ListProxy[str]
dataset_confidentialityLevel: str | None
dataset_dataCollectionProcess: str | None
dataset_dataPreprocessing: ListProxy[str]
dataset_datasetAvailability: str | None
dataset_datasetNoise: str | None
dataset_datasetSize: int | None
dataset_datasetType: ListProxy[str]
dataset_datasetUpdateMechanism: str | None
dataset_hasSensitivePersonalInformation: str | None
dataset_intendedUse: str | None
dataset_knownBias: ListProxy[str]
dataset_sensor: ListProxy[str | DictionaryEntry]