LDkit
    Preparing search index...

    Function createNamespace

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

      Type Parameters

      Parameters

      • namespaceSpec: N

        Specification of the namespace

      Returns NamespaceInterface<N>

      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