LDkit

method Lens.prototype.find
import { Lens } from "https://deno.land/x/ldkit/mod.ts";

Find entities that match the given search criteria.

The search criteria is a JSON object that may contain properties from the data schema. In addition you can specify how many results to return and how many to skip for pagination purposes.

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

// Find 100 persons with name that starts with "Ada"
const persons = await Persons.find({
  where: {
    name: { $strStarts: "Ada" },
  },
  take: 100,
});

Parameters

optional
options: { where?: SchemaSearchInterface<T> | string | RDF.Quad[]; take?: number; skip?: number; } = [UNSUPPORTED]

Search criteria and pagination options

Returns

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

entities that match the given search criteria