@metreeca/trio - v0.1.1
    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.

      Every subject/object pair yields one direct triple, the object taken as an RDF Term. The predicate, and any object supplied as a bare IRI, are boxed through named.

      Parameters

      • subject: Some<Blank | Named>

        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.

      Each object is run through mapper: a Term result becomes a direct triple object, while a Graph result is embedded as a sub-resource and linked at its own root. That root is derived structurally rather than supplied: the single source-only subject the encoded graph hangs off, letting encoders self-root their output at a fresh blank node and freeing callers from threading anchors. An empty encoded graph contributes no triples.

      Important

      A Graph returned by mapper must hang off a single root: exactly one subject is source-only, never appearing in object position, and every triple is reachable from it. Reachability is all that is asked for, not a tree shape: branches merging back into a shared node link like any other. Inverse statements are welcome deeper inside the graph but must not point back at its root, which any incoming statement disqualifies, leaving the graph rooted elsewhere or not at all. The shapes leaving no such root throw rather than being silently mislinked:

      • cyclic — every subject appears in object position, leaving no source-only one (reported as a missing root);
      • multi-rooted — independent components each contribute a source-only subject (reported as disjoint);
      • detached — a single root is left, but cyclic components strand triples out of its reach (reported as disjoint).

      Type Parameters

      • V

        The domain value type accepted by mapper

      Parameters

      • subject: Some<Blank | Named>

        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