@faubulous/mentor-rdf-serializers
    Preparing search index...

    Class QuadContextSerializer

    Serializes QuadContext | statement contexts to a complete document string, preserving source comments and emitting prefix/base declarations automatically.

    Index

    Constructors

    Methods

    • Merges externally created quads into an existing set of statement contexts. New quads receive empty comment arrays so they serialize cleanly between existing statements.

      Parameters

      • contexts: QuadContext[]

        Existing statement contexts (from the parser).

      • newQuads: Quad[]

        Additional quads to add.

      Returns QuadContext[]

      A new array containing both the original and new contexts.

    • Serializes statement contexts to a complete document string.

      The output includes:

      • BASE / @base declaration (when baseIri is set)
      • PREFIX / @prefix declarations (when prefixes is provided)
      • A blank line separating declarations from statements
      • Pretty-printed subject blocks with predicate-object grouping
      • Sorted and comment-decorated statements

      Parameters

      • contexts: QuadContext[]

        The (optionally pre-sorted / pre-merged) statement contexts.

      • Optionaloptions: QuadContextSerializerOptions

        Serialization options.

      Returns string

      The complete serialized document string.

    • Sorts statement contexts using the provided sorting option. Comments travel with their quads so that each comment block stays associated with the correct statement after reordering.

      Parameters

      • contexts: QuadContext[]

        The statement contexts to sort.

      • sort: SortingOption

        Sorting option (see SortOption).

      Returns QuadContext[]

      A new sorted array.