Skip to main content
Module

x/ldkit/mod.ts>createNamespace

LDkit - Linked Data query toolkit for TypeScript developers
Latest
function createNamespace
import { createNamespace } from "https://deno.land/x/ldkit@2.0.0/mod.ts";

Creates a strongly typed container for Linked Data vocabulary to provide type safe access to all vocabulary terms as well as IDE autocompletion.

Examples

Example 1

import { createNamespace } from "ldkit";

const onto = createNamespace(
  {
    iri: "http://www.example.com/ontology#",
    prefix: "onto:",
    terms: [
      "object",
      "predicate",
      "subject",
    ],
  } as const,
);

console.log(onto.subject); // prints http://www.example.com/ontology#subject
console.log(onto.unknown); // TypeScript error! This term does not exist

Parameters

namespaceSpec: N

Specification of the namespace