import { WITH } from "https://deno.land/x/ldkit/sparql.ts";
SPARQL WITH query fluent interface
Examples
Example 1
Example 1
import { DELETE } from "ldkit/sparql";
import { foaf } from "ldkit/namespaces";
import { DataFactory } from "ldkit/rdf";
const df = new DataFactory();
const firstName = df.namedNode(foaf.firstName);
const graph = df.namedNode("http://example.org/graph");
const query = WITH(graph).DELETE`?person ${firstName} "Jean"`
.INSERT`?person ${firstName} "Paul"`
.WHERE`?person ${firstName} "Jean"`
.build();
console.log(query);
// WITH <http://example.org/graph>
// DELETE { ?person <http://xmlns.com/foaf/0.1/firstName> "Jean" }
// INSERT { ?person <http://xmlns.com/foaf/0.1/firstName> "Paul" }
// WHERE { ?person <http://xmlns.com/foaf/0.1/firstName> "Jean" }
type
(stringOrNamedNode: string | RDF.NamedNode<string>) => unknown