Skip to content

Exceptions

knowledgecomplex.exceptions — Public exception types.

These are the only knowledgecomplex types that cross the API boundary on failure.

ValidationError

Bases: Exception

Raised when a SHACL validation check fails on write.

Attributes:

Name Type Description
report str

Human-readable SHACL validation report text.

Source code in knowledgecomplex/exceptions.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class ValidationError(Exception):
    """
    Raised when a SHACL validation check fails on write.

    Attributes
    ----------
    report : str
        Human-readable SHACL validation report text.
    """

    def __init__(self, message: str, report: str) -> None:
        super().__init__(message)
        self.report = report

    def __str__(self) -> str:
        return f"{super().__str__()}\n\nSHACL Report:\n{self.report}"

UnknownQueryError

Bases: Exception

Raised when KnowledgeComplex.query() is called with an unregistered template name.

Source code in knowledgecomplex/exceptions.py
26
27
28
29
30
class UnknownQueryError(Exception):
    """
    Raised when KnowledgeComplex.query() is called with an unregistered template name.
    """
    pass

SchemaError

Bases: Exception

Raised when a SchemaBuilder method is called with invalid arguments, e.g. referencing an undefined type.

Source code in knowledgecomplex/exceptions.py
33
34
35
36
37
38
class SchemaError(Exception):
    """
    Raised when a SchemaBuilder method is called with invalid arguments,
    e.g. referencing an undefined type.
    """
    pass