Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
karelklima committed Jan 11, 2024
1 parent a3d488f commit c2df5f7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/v2/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
},
},
});
```

0 comments on commit c2df5f7

Please sign in to comment.