@grafctory/trio - v0.4.0
    Preparing search index...

    Function property

    Builds direct triples, or maps each object and embeds sub-graphs at their root.

    • Builds direct triples linking each subject to each object term.

      One triple is built for each subject/object pair.

      Parameters

      • subject: Some<Subject>

        The subject(s) the statements hang off

      • predicate: string

        The predicate IRI shared by every emitted statement

      • objects: Some<string | Term>

        The RDF term object(s), or the IRIs standing for named ones

      Returns Graph

      The graph of direct statements

      RangeError if predicate, or an object supplied as a bare IRI, is relative or otherwise malformed

    • Builds triples by mapping each object, embedding sub-graphs at their root.

      A term result becomes the triple object; a graph result is embedded and linked at its root, unless empty.

      Important

      A graph returned by mapper must hang off a single root: exactly one subject never appears in object position, and every triple is reachable from it. Graphs failing the check are rejected as:

      • cyclic — every subject appears in object position (reported as a missing root);
      • multi-rooted — several subjects never appear in object position (reported as disjoint);
      • detached — a single root is left, but cyclic components are out of its reach (reported as disjoint).

      Type Parameters

      • V

        The domain value type accepted by mapper

      Parameters

      • subject: Some<Subject>

        The subject(s) the statements hang off

      • predicate: string

        The predicate IRI shared by every emitted statement

      • objects: Some<V>

        The object value(s) passed to mapper

      • mapper: Mapper<V>

        Maps each object to a term or an embedded graph

      Returns Graph

      The graph of emitted statements, including any embedded sub-resources

      RangeError On an encoded graph not hanging off a single root subject, whether cyclic, multi-rooted or detached