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

    Function resource

    • Builds a resource graph anchored at a subject.

      An empty built graph is returned as is.

      Important

      Every triple of a non-empty built graph must be reachable from subject, walking statements in either direction through resources only: inverse statements are anchored like direct ones, while triples sharing just a literal value stay unconnected. A graph failing the check is rejected with one of two errors:

      • missing — no triple mentions subject, typically a builder ignoring it;
      • detached — some triples are out of reach of subject (reported as disjoint).

      Parameters

      • subject: string | Subject

        The subject the built properties hang off: a ready Subject, or the IRI of a named one

      • builder: (subject: Subject) => Graph

        Builds the resource graph anchored at subject

      Returns Graph

      The assembled resource graph

      RangeError if subject is a relative or otherwise malformed IRI, or if the built graph is non-empty and either leaves subject unmentioned or strands triples away from it