@triply/triplydb
    Preparing search index...

    Class Graph

    A named graph within a Dataset.

    Obtain one with Dataset.getGraph, or iterate them with Dataset.getGraphs. Graphs are never constructed directly.

    const dataset = await account.getDataset("my-dataset");
    const graph = await dataset.getGraph("https://example.org/my-graph");
    console.log((await graph.getInfo()).numberOfStatements);
    const store = await graph.toStore();
    
    Index
    • get graphName(): string

      This graph's IRI.

      Returns string

    • Deletes this graph and its statements from the dataset.

      Returns Promise<void>

      Destructive and not undoable. The dataset itself stays.

    • This graph's metadata: its IRI, statement count and size.

      Parameters

      • refresh: boolean = false

      Returns Promise<GraphInfo>

      Cached after the first call. Pass true to refetch after a change made elsewhere.

    • Changes this graph's IRI, keeping its statements.

      Parameters

      • newGraphName: string

        The new IRI.

      Returns Promise<Graph>

      This graph, updated.

      Renaming to the IRI it already has does nothing rather than failing.

    • Writes this graph's statements to a file.

      Parameters

      • destinationPath: string

        Where to write, extension included.

      • Optionalopts: { compressed?: boolean }

        compressed gzips the output.

      Returns Promise<void>

      The serialisation follows the extension of destinationPath, so name it .trig or .nt rather than expecting a format argument.

    • Loads this graph's statements into an in-memory store.

      Returns Promise<Store<Quad, Quad, Quad, Quad>>

      Everything is held in memory at once — use Graph.toStream for a large graph.

    • Streams this graph's statements, for a graph too large to hold in memory.

      Parameters

      • type: "compressed" | "rdf-js"

        "rdf-js" for parsed RDF/JS quads, "compressed" for the raw gzipped bytes.

      Returns Promise<Readable>