// EXECUTION_PIPELINE
Implementation Pipeline
Our engine handles the complexity of data movement while you focus on high-level decision logic.
PHASE_1 // User Intent Recognition
Parses the user's natural language to identify requested entities, time bounds, and dimensional cuts.
PHASE_2 // Semantic Graph Traversal
The engine maps the identified intent to the explicit YAML definition, retrieving the required base tables and join paths.
PHASE_3 // AST Query Compilation
Arcli compiles the semantic logic into an Abstract Syntax Tree (AST), injecting predefined filters (e.g., `status = 'active'`) and resolving complex DAG dependencies.
PHASE_4 // Dialect-Specific SQL Execution
Translates the AST into highly optimized SQL specific to your storage layer and executes it without hallucination.
// STRATEGIC_SCENARIO
Deep Data Retrieval
How Arcli grounds AI in your exact schema to generate highly-optimized, dialect-specific execution logic.
Compiled Output: The Power of the Semantic DAG
When a user asks 'Show me Net Margin by Product Category', the Arcli engine references the Semantic DAG to generate this nested, deterministic query.
THE EXECUTIVE FILTER (ROI)
Guarantees 100% financial accuracy. The governance layer acts as the impenetrable calculator, ensuring enterprise-grade trust in AI outputs.
- Fully optimized for DuckDB SQL (Embedded Execution) constraints.
- Bypasses semantic layer hallucinations via strict schema grounding.
DuckDB SQL (Embedded Execution)_COMPILE
-- Arcli Semantic Compiler Output
-- Request Intent: "Net Margin by Product Category for Q3 2025"
-- Resolved Semantic Metrics: [gross_revenue, cogs, refund_amount, net_margin]
WITH base_sales AS (
-- Semantic Definition: Gross Revenue
-- Governance Rule: Exclude failed and disputed charges
SELECT
item_id,
SUM(amount_cents) / 100.0 AS gross_revenue
FROM tenant_99.raw_stripe_charges
WHERE created_at >= '2025-07-01' AND created_at < '2025-10-01'
AND status = 'succeeded'
AND disputed IS FALSE
GROUP BY 1
),
base_refunds AS (
-- Semantic Definition: Refund Amount
SELECT
item_id,
SUM(amount_cents) / 100.0 AS refund_amount
FROM tenant_99.raw_stripe_refunds
WHERE created_at >= '2025-07-01' AND created_at < '2025-10-01'
GROUP BY 1
),
base_costs AS (
-- Semantic Definition: COGS (Cost of Goods Sold)
SELECT
item_id,
category AS product_category,
(vendor_cost_usd + 0.30) AS cogs
FROM tenant_99.product_catalog
),
semantic_join AS (
-- Traversing the DAG to unify metrics
SELECT
c.product_category,
COALESCE(s.gross_revenue, 0) AS gross_revenue,
COALESCE(r.refund_amount, 0) AS refund_amount,
COALESCE(c.cogs, 0) AS total_cogs
FROM base_sales s
LEFT JOIN base_refunds r ON s.item_id = r.item_id
LEFT JOIN base_costs c ON s.item_id = c.item_id
)
-- Final Semantic Calculation: Net Margin
-- Governance Formula: (Gross - Refunds - COGS) / (Gross - Refunds)
SELECT
product_category,
SUM(gross_revenue) AS total_revenue,
SUM(refund_amount) AS total_refunds,
SUM(total_cogs) AS total_cogs,
CASE
WHEN SUM(gross_revenue - refund_amount) = 0 THEN 0
ELSE ROUND(
(SUM(gross_revenue - refund_amount - total_cogs) / SUM(gross_revenue - refund_amount)) * 100,
2)
END AS net_margin_percentage
FROM semantic_join
GROUP BY 1
ORDER BY net_margin_percentage DESC;