|
1 | 1 | // SPDX-License-Identifier: MPL-2.0 |
2 | 2 | // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
3 | 3 | // |
4 | | -// VeriSimDB ReScript Client — VQL (VeriSimDB Query Language) operations. |
| 4 | +// VeriSimDB ReScript Client — VCL (VeriSim Consonance Language) operations. |
5 | 5 | // |
6 | | -// VQL is VeriSimDB's native query language for multi-modal queries that span |
| 6 | +// VCL is VeriSimDB's native consonance language for multi-modal queries that span |
7 | 7 | // graph traversals, vector similarity, spatial filters, and temporal constraints |
8 | 8 | // in a single statement. This module provides execution and explain functions. |
9 | 9 |
|
10 | | -/** VQL request payload for executing or explaining a query. */ |
11 | | -type vqlRequest = { |
| 10 | +/** VCL request payload for executing or explaining a query. */ |
| 11 | +type vclRequest = { |
12 | 12 | query: string, |
13 | 13 | params: Dict.t<string>, |
14 | 14 | } |
15 | 15 |
|
16 | | -/** Execute a VQL query and return the result set. |
| 16 | +/** Execute a VCL query and return the result set. |
17 | 17 | * |
18 | 18 | * @param client The authenticated client. |
19 | | - * @param query The VQL query string. |
| 19 | + * @param query The VCL query string. |
20 | 20 | * @param params Optional named parameters for parameterised queries. |
21 | 21 | * @returns The query result with columns, rows, and timing, or an error. |
22 | 22 | */ |
23 | 23 | let execute = async ( |
24 | 24 | client: VeriSimClient.t, |
25 | 25 | query: string, |
26 | 26 | ~params: Dict.t<string>=Dict.make(), |
27 | | -): result<VeriSimTypes.vqlResult, VeriSimError.t> => { |
| 27 | +): result<VeriSimTypes.vclResult, VeriSimError.t> => { |
28 | 28 | try { |
29 | | - let req: vqlRequest = {query, params} |
| 29 | + let req: vclRequest = {query, params} |
30 | 30 | let body = req->Obj.magic->JSON.stringify->JSON.parseExn |
31 | | - let resp = await VeriSimClient.doPost(client, "/api/v1/vql/execute", body) |
| 31 | + let resp = await VeriSimClient.doPost(client, "/api/v1/vcl/execute", body) |
32 | 32 | if resp.ok { |
33 | 33 | let json = await VeriSimClient.jsonBody(resp) |
34 | 34 | Ok(json->Obj.magic) |
35 | 35 | } else { |
36 | 36 | Error(VeriSimError.fromStatus(resp.status)) |
37 | 37 | } |
38 | 38 | } catch { |
39 | | - | _ => Error(VeriSimError.ConnectionError("VQL execution failed")) |
| 39 | + | _ => Error(VeriSimError.ConnectionError("VCL execution failed")) |
40 | 40 | } |
41 | 41 | } |
42 | 42 |
|
43 | | -/** Explain a VQL query's execution plan without running it. |
| 43 | +/** Explain a VCL query's execution plan without running it. |
44 | 44 | * |
45 | 45 | * @param client The authenticated client. |
46 | | - * @param query The VQL query string. |
| 46 | + * @param query The VCL query string. |
47 | 47 | * @param params Optional named parameters. |
48 | 48 | * @returns The query plan, estimated cost, and any warnings, or an error. |
49 | 49 | */ |
50 | 50 | let explain = async ( |
51 | 51 | client: VeriSimClient.t, |
52 | 52 | query: string, |
53 | 53 | ~params: Dict.t<string>=Dict.make(), |
54 | | -): result<VeriSimTypes.vqlExplanation, VeriSimError.t> => { |
| 54 | +): result<VeriSimTypes.vclExplanation, VeriSimError.t> => { |
55 | 55 | try { |
56 | | - let req: vqlRequest = {query, params} |
| 56 | + let req: vclRequest = {query, params} |
57 | 57 | let body = req->Obj.magic->JSON.stringify->JSON.parseExn |
58 | | - let resp = await VeriSimClient.doPost(client, "/api/v1/vql/explain", body) |
| 58 | + let resp = await VeriSimClient.doPost(client, "/api/v1/vcl/explain", body) |
59 | 59 | if resp.ok { |
60 | 60 | let json = await VeriSimClient.jsonBody(resp) |
61 | 61 | Ok(json->Obj.magic) |
62 | 62 | } else { |
63 | 63 | Error(VeriSimError.fromStatus(resp.status)) |
64 | 64 | } |
65 | 65 | } catch { |
66 | | - | _ => Error(VeriSimError.ConnectionError("VQL explain failed")) |
| 66 | + | _ => Error(VeriSimError.ConnectionError("VCL explain failed")) |
67 | 67 | } |
68 | 68 | } |
0 commit comments