Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connectors/clients/elixir/lib/verisim_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule VeriSimClient do

Holds connection configuration (base URL, authentication, timeout) and
provides low-level HTTP helpers that the domain modules (`Octad`, `Search`,
`Drift`, `Provenance`, `Vql`, `Federation`) delegate to.
`Drift`, `Provenance`, `Vcl`, `Federation`) delegate to.

## Quick Start

Expand Down
6 changes: 3 additions & 3 deletions connectors/clients/elixir/lib/verisim_client/types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ defmodule VeriSimClient.Types do
}

# ---------------------------------------------------------------------------
# VqlResponse
# VclResponse
# ---------------------------------------------------------------------------

@typedoc """
Response from a VQL query execution or explain request.
Response from a VCL query execution or explain request.
"""
@type vql_response :: %{
@type vcl_response :: %{
required(:success) => boolean(),
required(:statement_type) => String.t(),
required(:row_count) => non_neg_integer(),
Expand Down
28 changes: 14 additions & 14 deletions connectors/clients/elixir/lib/verisim_client/vcl.ex
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>

defmodule VeriSimClient.Vql do
defmodule VeriSimClient.Vcl do
@moduledoc """
VeriSim Query Language (VQL) execution for VeriSimDB.
VeriSim Query Language (VCL) execution for VeriSimDB.

VQL is VeriSimDB's native query language, supporting SQL-like syntax extended
VCL is VeriSimDB's native query language, supporting SQL-like syntax extended
with multi-modal operations (vector similarity, graph traversal, spatial
predicates, drift thresholds, etc.). This module provides methods to execute
VQL statements and retrieve explain / query plans.
VCL statements and retrieve explain / query plans.

## Examples

{:ok, client} = VeriSimClient.new("http://localhost:8080")

{:ok, result} = VeriSimClient.Vql.execute(client, "SELECT * FROM octads WHERE drift > 0.5")
{:ok, result} = VeriSimClient.Vcl.execute(client, "SELECT * FROM octads WHERE drift > 0.5")
IO.puts("Rows returned: \#{result["row_count"]}")

{:ok, plan} = VeriSimClient.Vql.explain(client, "SELECT * FROM octads WHERE drift > 0.5")
{:ok, plan} = VeriSimClient.Vcl.explain(client, "SELECT * FROM octads WHERE drift > 0.5")
"""

alias VeriSimClient.Types

@doc """
Execute a VQL statement against the VeriSimDB instance.
Execute a VCL statement against the VeriSimDB instance.

Supports SELECT, INSERT, UPDATE, DELETE, and VeriSimDB-specific statements
like `DRIFT CHECK`, `NORMALIZE`, and `FEDERATE`.

## Parameters

* `client` — A `VeriSimClient.t()` connection.
* `query` — The VQL statement string.
* `query` — The VCL statement string.
"""
@spec execute(VeriSimClient.t(), String.t()) ::
{:ok, Types.vql_response()} | {:error, term()}
{:ok, Types.vcl_response()} | {:error, term()}
def execute(%VeriSimClient{} = client, query) when is_binary(query) do
body = %{query: query}
VeriSimClient.do_post(client, "/api/v1/vql/execute", body)
VeriSimClient.do_post(client, "/api/v1/vcl/execute", body)
end

@doc """
Request an explain / query plan for a VQL statement without executing it.
Request an explain / query plan for a VCL statement without executing it.

Useful for understanding which modalities, indices, and federation peers
would be involved in a query.

## Parameters

* `client` — A `VeriSimClient.t()` connection.
* `query` — The VQL statement string to explain.
* `query` — The VCL statement string to explain.
"""
@spec explain(VeriSimClient.t(), String.t()) ::
{:ok, Types.vql_response()} | {:error, term()}
{:ok, Types.vcl_response()} | {:error, term()}
def explain(%VeriSimClient{} = client, query) when is_binary(query) do
body = %{query: query}
VeriSimClient.do_post(client, "/api/v1/vql/explain", body)
VeriSimClient.do_post(client, "/api/v1/vcl/explain", body)
end
end
2 changes: 1 addition & 1 deletion connectors/clients/elixir/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule VeriSimClient.MixProject do
Mix project configuration for the VeriSimDB Elixir client SDK.

Provides octad entity management, multi-modal search (text, vector, spatial),
drift detection, provenance chain operations, VQL query execution, and
drift detection, provenance chain operations, VCL query execution, and
federation across distributed VeriSimDB instances.
"""

Expand Down
10 changes: 5 additions & 5 deletions connectors/clients/julia/src/VeriSimDBClient.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# VeriSimDB Julia Client — Main module.
#
# This is the top-level module for the VeriSimDB Julia client SDK. It aggregates
# all submodules (types, error, client, octad, search, drift, provenance, vql,
# all submodules (types, error, client, octad, search, drift, provenance, vcl,
# federation) and re-exports the public API.
#
# Usage:
Expand All @@ -30,7 +30,7 @@ include("octad.jl")
include("search.jl")
include("drift.jl")
include("provenance.jl")
include("vql.jl")
include("vcl.jl")
include("federation.jl")

# --- Public exports ---
Expand All @@ -44,7 +44,7 @@ export GraphData, GraphEdge, VectorData, TensorData, DocumentContent, SpatialDat
export DriftScore, DriftLevel, DriftStatusReport
export ProvenanceEvent, ProvenanceChain, ProvenanceEventInput
export PaginatedResponse, SearchResult
export VqlResult, VqlExplanation
export VclResult, VclExplanation
export FederationPeer

# Octad CRUD
Expand All @@ -60,8 +60,8 @@ export get_drift_score, drift_status, normalize_drift
# Provenance
export get_provenance_chain, record_provenance, verify_provenance

# VQL
export execute_vql, explain_vql
# VCL
export execute_vcl, explain_vcl

# Federation
export register_peer, list_peers, federated_query
Expand Down
8 changes: 4 additions & 4 deletions connectors/clients/julia/src/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ struct ProvenanceInvalidError <: VeriSimError
message::String
end

"""VQL syntax error."""
struct VqlParseError <: VeriSimError
"""VCL syntax error."""
struct VclParseError <: VeriSimError
query::String
message::String
end

"""VQL runtime error."""
struct VqlExecutionError <: VeriSimError
"""VCL runtime error."""
struct VclExecutionError <: VeriSimError
query::String
message::String
end
Expand Down
6 changes: 3 additions & 3 deletions connectors/clients/julia/src/federation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ JSON3.StructTypes.StructType(::Type{PeerRegistration}) = JSON3.StructTypes.Struc
"""
FederatedQueryRequest

Wraps a VQL query intended for federated execution across cluster peers.
Wraps a VCL query intended for federated execution across cluster peers.
"""
struct FederatedQueryRequest
query::String
Expand Down Expand Up @@ -53,7 +53,7 @@ Result from a single peer in a federated query.
struct PeerQueryResult
peer_id::String
peer_name::String
result::VqlResult
result::VclResult
elapsed_ms::Float64
error::Union{String,Nothing}
end
Expand Down Expand Up @@ -109,7 +109,7 @@ end
"""
federated_query(client, input) -> FederatedQueryResult

Execute a VQL query across one or more federation peers.
Execute a VCL query across one or more federation peers.

If `peer_ids` is empty, the query is broadcast to all active peers. Results
are aggregated with per-peer timing and error information.
Expand Down
18 changes: 9 additions & 9 deletions connectors/clients/julia/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,36 +372,36 @@ end
JSON3.StructTypes.StructType(::Type{SearchResult}) = JSON3.StructTypes.Struct()

# ---------------------------------------------------------------------------
# VQL types
# VCL types
# ---------------------------------------------------------------------------

"""
VqlResult
VclResult

Result of a VQL query execution, containing columnar data and timing.
Result of a VCL query execution, containing columnar data and timing.
"""
struct VqlResult
struct VclResult
columns::Vector{String}
rows::Vector{Vector{String}}
count::Int
elapsed_ms::Float64
end

JSON3.StructTypes.StructType(::Type{VqlResult}) = JSON3.StructTypes.Struct()
JSON3.StructTypes.StructType(::Type{VclResult}) = JSON3.StructTypes.Struct()

"""
VqlExplanation
VclExplanation

Query execution plan for a VQL statement, showing cost estimates and warnings.
Query execution plan for a VCL statement, showing cost estimates and warnings.
"""
struct VqlExplanation
struct VclExplanation
query::String
plan::String
cost::Float64
warnings::Vector{String}
end

JSON3.StructTypes.StructType(::Type{VqlExplanation}) = JSON3.StructTypes.Struct()
JSON3.StructTypes.StructType(::Type{VclExplanation}) = JSON3.StructTypes.Struct()

# ---------------------------------------------------------------------------
# Federation types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
#
# VeriSimDB Julia Client — VQL (VeriSimDB Query Language) operations.
# VeriSimDB Julia Client — VCL (VeriSimDB Query Language) operations.
#
# VQL is VeriSimDB's native query language for multi-modal queries that span
# VCL is VeriSimDB's native query language for multi-modal queries that span
# graph traversals, vector similarity, spatial filters, and temporal constraints
# in a single statement. This file provides execution and explain functions.

"""
execute_vql(client, query; params=Dict()) -> VqlResult
execute_vcl(client, query; params=Dict()) -> VclResult

Execute a VQL query and return the result set.
Execute a VCL query and return the result set.

VQL queries can combine modalities — for example:
VCL queries can combine modalities — for example:
```
FIND octads WHERE vector_similar(\$embedding, 0.8)
AND spatial_within(51.5, -0.1, 10km)
Expand All @@ -21,46 +21,46 @@ FIND octads WHERE vector_similar(\$embedding, 0.8)

# Arguments
- `client::Client` — The authenticated client.
- `query::String` — The VQL query string.
- `query::String` — The VCL query string.

# Keyword Arguments
- `params::Dict{String,String}` — Named parameters for parameterised queries.

# Returns
A `VqlResult` containing columns, rows, count, and execution time.
A `VclResult` containing columns, rows, count, and execution time.
"""
function execute_vql(
function execute_vcl(
client::Client,
query::String;
params::Dict{String,String}=Dict{String,String}()
)::VqlResult
)::VclResult
body = Dict("query" => query, "params" => params)
resp = do_post(client, "/api/v1/vql/execute", body)
return parse_response(VqlResult, resp)
resp = do_post(client, "/api/v1/vcl/execute", body)
return parse_response(VclResult, resp)
end

"""
explain_vql(client, query; params=Dict()) -> VqlExplanation
explain_vcl(client, query; params=Dict()) -> VclExplanation

Return the query execution plan for a VQL statement without running it.
Return the query execution plan for a VCL statement without running it.
Useful for debugging and optimising queries.

# Arguments
- `client::Client` — The authenticated client.
- `query::String` — The VQL query string.
- `query::String` — The VCL query string.

# Keyword Arguments
- `params::Dict{String,String}` — Named parameters.

# Returns
A `VqlExplanation` containing the plan, estimated cost, and warnings.
A `VclExplanation` containing the plan, estimated cost, and warnings.
"""
function explain_vql(
function explain_vcl(
client::Client,
query::String;
params::Dict{String,String}=Dict{String,String}()
)::VqlExplanation
)::VclExplanation
body = Dict("query" => query, "params" => params)
resp = do_post(client, "/api/v1/vql/explain", body)
return parse_response(VqlExplanation, resp)
resp = do_post(client, "/api/v1/vcl/explain", body)
return parse_response(VclExplanation, resp)
end
6 changes: 3 additions & 3 deletions connectors/clients/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! A Rust client library for interacting with VeriSimDB — a multi-modal database
//! supporting octad entity management, drift detection, provenance tracking,
//! VQL query execution, and federation across distributed instances.
//! VCL query execution, and federation across distributed instances.
//!
//! ## Quick Start
//!
Expand All @@ -30,7 +30,7 @@
//! - [`search`] — Text, vector, graph-relational, and spatial search operations.
//! - [`drift`] — Drift score retrieval and normalization triggers.
//! - [`provenance`] — Immutable provenance chain management.
//! - [`vql`] — VeriSim Query Language execution and explain plans.
//! - [`vcl`] — VeriSim Query Language execution and explain plans.
//! - [`federation`] — Peer registration and federated cross-instance queries.
//! - [`error`] — Error types and the crate-level `Result` alias.

Expand All @@ -41,6 +41,6 @@ pub mod octad;
pub mod search;
pub mod drift;
pub mod provenance;
pub mod vql;
pub mod vcl;
pub mod federation;
pub mod error;
Loading
Loading