Requetes et ObjectSet
En bref
Le SDK et la CLI offrent un systeme de requetes unifie pour interroger vos entites. Filtrez, triez, paginez et recherchez — en TypeScript ou en ligne de commande.
Requete basique
CLI
npx ontologie query Contract --limit 10
npx ontologie query Contract --filter-json '{"status":{"eq":"active"}}'
SDK TypeScript
import { createClient } from '@ontologie/sdk-client';
const client = createClient({ /* config */ });
const contracts = await client.ontology.query('Contract', {
filter: { status: { eq: 'active' } },
limit: 10,
});
Operateurs de filtre
| Operateur | Description | Exemple |
|---|---|---|
eq | Egal | { status: { eq: 'active' } } |
neq | Different | { status: { neq: 'draft' } } |
in | Dans une liste | { status: { in: ['active', 'pending'] } } |
notIn | Pas dans une liste | { priority: { notIn: ['low'] } } |
gt | Superieur | { amount: { gt: 1000 } } |
gte | Superieur ou egal | { amount: { gte: 1000 } } |
lt | Inferieur | { amount: { lt: 5000 } } |
lte | Inferieur ou egal | { amount: { lte: 5000 } } |
contains | Contient (texte) | { name: { contains: 'acme' } } |
startsWith | Commence par | { name: { startsWith: 'Contract-' } } |
Operateurs logiques
Combinez les conditions avec and, or, not :
const results = await client.ontology.query('Contract', {
filter: {
or: [
{ status: { eq: 'active' }, amount: { gt: 10000 } },
{ priority: { eq: 'critical' } },
],
},
});
Dates
Utilisez le format ISO 8601 :
const recent = await client.ontology.query('Contract', {
filter: { signedAt: { gte: '2026-01-01T00:00:00Z' } },
});
Pagination
| Parametre | Description | Defaut | Maximum |
|---|---|---|---|
limit | Nombre de resultats | 50 | 10 000 |
offset | Decalage | 0 | 100 000 |
La reponse inclut les metadonnees de pagination :
{
"ok": true,
"data": [...],
"page": { "total": 342, "limit": 50, "offset": 0, "hasMore": true }
}
Tri
// SDK
const sorted = await client.ontology.query('Contract', {
orderBy: { field: 'amount', direction: 'desc' },
});
# CLI
npx ontologie query Contract --order-by amount:desc
Recherche
Recherche par mot-cle
const results = await client.ontology.search('Contract', {
keyword: 'renouvellement automatique',
});
Recherche semantique
const results = await client.ontology.search('Contract', {
semantic: 'contrats qui arrivent a echeance ce trimestre',
});
Operations sur le graphe
Quatre operations de graphe sont disponibles :
| Operation | Description | Limite |
|---|---|---|
neighbors | Entites voisines directes | 100 resultats max |
traverse | Parcours multi-niveaux | Profondeur 2 max (Preview) |
shortestPath | Plus court chemin entre deux entites | — |
constrainedSearch | Recherche avec contraintes de graphe | — |
// Voisins d'une entite
const neighbors = await client.graph.neighbors({
nodeId: 'uuid-du-contrat',
direction: 'both',
limit: 20,
});
// Parcours
const traversal = await client.graph.traverse({
startNodeId: 'uuid-du-contrat',
depth: 2,
direction: 'outgoing',
});
# CLI
npx ontologie graph neighbors --node-id uuid-du-contrat
npx ontologie graph traverse --start uuid-du-contrat --depth 2
Limites systeme
| Parametre | Limite |
|---|---|
| Resultats par requete | 10 000 |
| Offset maximum | 100 000 |
| Voisins retournes | 100 |
| Profondeur de traversee | 2 (Preview) |
| Requetes par heure (API key) | 1 000 |
| Burst par seconde | 10 |
Voir aussi
- Schema DSL — Definir vos entites
- Plans et Actions — Executer des mutations
- Erreurs — Codes d'erreur
- Reference API — Endpoints REST