Skip to main content
Module

x/ldkit/mod.ts>Lens#findByIris

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

Find entities that match the given IRIs.

Examples

Example 1

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

// 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);

// Get specific persons identified by IRIs
const matches = await Persons.findByIris([
  "http://dbpedia.org/resource/Ada_Lovelace",
  "http://dbpedia.org/resource/Alan_Turing"
]);
console.log(matches[0].name); // string "Ada Lovelace"
console.log(matches[1].name); // string "Alan Turing"

Parameters

iris: IRI[]

IRIs of the entities to find

Returns

Promise<Unite<SchemaInterface<T>>[]>

Array of found entities, empty array if there are no matches