g3-toolkit API Reference
    Preparing search index...

    Interface GraphAdapter

    Interface that all data source adapters implement.

    ARGUMENT SAFETY. nodeId, depth and edgeTypes typically come from host state (a node click, a search result, a server payload), so the remote adapters treat them as untrusted: values are bound through the protocol's own mechanism where one exists, and validated by ./query-safety where it does not. A value that cannot be placed safely raises AdapterArgumentError before any request is sent. query(q) is the exception and is NOT sanitized: its argument is query text by definition, so hosts must not build it from untrusted input.

    interface GraphAdapter {
        expandNeighborhood(
            nodeId: string,
            depth: number,
            edgeTypes?: string[],
        ): Promise<UGM>;
        getNodeProperties(nodeId: string): Promise<PropertyMap>;
        getSchema(): Promise<SchemaModel>;
        id: string;
        name: string;
        query(q: string): Promise<UGM>;
    }

    Implemented by

    Index

    Properties

    id: string

    Short identifier (e.g., "sparql", "cypher", "holonic").

    name: string

    Human-readable name (e.g., "SPARQL Endpoint").

    Methods

    • Expand the neighborhood of a node at the given depth. Returns a UGM containing the discovered subgraph.

      DEPTH IS HONORED OR REJECTED, never ignored. An implementation that cannot express the requested hop count throws AdapterArgumentError with argument: "depth" before issuing a request, so a host learns at the call site instead of receiving a shallower subgraph that looks complete. Of the shipped adapters, SparqlAdapter, CypherAdapter and GremlinAdapter honor any depth in [1, MAX_TRAVERSAL_DEPTH]; HolonicAdapter and RestAdapter honor 1 and reject the rest, each for a reason recorded on the method.

      Parameters

      • nodeId: string
      • depth: number
      • OptionaledgeTypes: string[]

        Optional filter to specific edge types.

      Returns Promise<UGM>

      AdapterArgumentError when depth is not a finite number, or when the implementation cannot honor the value.

    • Execute a query and return results as a new UGM. The query language depends on the adapter (SPARQL, Cypher, etc.).

      Parameters

      • q: string

      Returns Promise<UGM>