From c2df5f7b4576b50adf5111228e6da03eb3251c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kl=C3=ADma?= Date: Thu, 11 Jan 2024 23:15:19 +0100 Subject: [PATCH] Updated documentation --- docs/v2/filtering.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/v2/filtering.md b/docs/v2/filtering.md index 6e422e3..7f789ad 100644 --- a/docs/v2/filtering.md +++ b/docs/v2/filtering.md @@ -7,8 +7,8 @@ for controlled data retrieval. LDkit allows various search and filtering operations like `$equals`, `$not`, `$contains`, `$strStarts`, `$strEnds`, `$gt`, `$lt`, `$gte`, `$lte`, `$regex`, -`$langMatches`, `$in`, `$notIn`, and `$filter`. Each is illustrated below with -examples. +`$langMatches`, `$in`, `$notIn`, `$filter`, and `$id`. Each is illustrated below +with examples. ### Simple example @@ -100,3 +100,20 @@ await Persons.find({ }, }); ``` + +### Restricting the results to specific entities + +Sometimes it is useful to query for specific entities by their IRI, and also +restrict the results further by filtering out some properties. For example, +query for an entity, but match only its label with a specific language. + +```typescript +await Persons.find({ + where: { + $id: "https://example.org/Ada_Lovelace", // the only entity matched + name: { + $langMatches: "en", // FILTER LANGMATCHES(LANG(?value), "en") + }, + }, +}); +```