@rdfjs/wrapper
    Preparing search index...

    Class LiteralDatatypeError

    Error thrown when the datatype of a literal term is unexpected.

    Code working with RDF might expect that a term (e.g. the object of a statement is a literal with a specific datatype (e.g. xsd:int). When unmet, code might be strict and throw an error representing the failed expectation.

    The underlying error's term is the literal whose datatype was unexpected.

    Consider the following mapping class, which expects a numeric literal:

    class Class extends TermWrapper {
    public get property(): number {
    return RequiredFrom.subjectPredicate(this, "p", LiteralAs.number)
    }
    }

    Given the following RDF, which does not meet the above expectation:

    <s> <p> "o" .
    

    invoking the mapping code in the following manner:

    new Class("s", dataset, factory).property
    

    will result in this error being throw.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    cause?: unknown
    datatypes: Iterable<string>

    The expected datatypes.

    message: string
    name: string
    stack?: string
    term: Term

    The term associated with this error.