LDkit

method Lens.prototype.insertData
import { Lens } from "https://deno.land/x/ldkit/mod.ts";

Inserts raw RDF quads to the data store.

This method is useful when you need to insert data that is not covered by the data schema.

Examples

Example 1

import { createLens } from "ldkit";
import { schema } from "ldkit/namespaces";
import { DataFactory } from "ldkit/rdf";

// Create a schema
const PersonSchema = {
  "@type": schema.Person,
  name: schema.name,
} as const;

// Create a resource using the data schema above
const Persons = createLens(PersonSchema);

// Create a custom quad to insert
const df = new DataFactory();
const quad = df.quad(
  df.namedNode("http://example.org/Alan_Turing"),
  df.namedNode("http://schema.org/name"),
  df.literal("Alan Turing"),
);

// Insert the quad
await Persons.insertData(quad);

Parameters

...quads: RDF.Quad[]

Quads to insert to the data store

Returns

Promise<void>

Nothing