Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ldkit/namespaces.ts>createNamespace

LDkit - Linked Data query toolkit for TypeScript developers
Latest
function createNamespace
import { createNamespace } from "https://deno.land/x/ldkit@2.0.0/namespaces.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