Querying
ShrikeDB exposes several query surfaces. Use Cypher for graph and multimodal composition, direct vector APIs for ANN search, direct KV APIs for payload access, and SPARQL for supported RDF-style graph pattern queries.
For the full current query guide, see Querying ShrikeDB. That section covers natural-language semantic plans, Cypher, SPARQL, GDS-style analytics, weighted path procedures, path aliases, and result inspection.
Query Surface Map
| Need | Best surface | Why |
|---|---|---|
Graph pattern or multimodal retrieval |
|
Combines graph patterns with |
Vector-only search |
|
Avoids query planning overhead and returns ANN results directly. |
KV lookup or batch hydration |
|
Direct payload access. |
RDF/SPARQL graph pattern |
|
Useful for SPARQL-shaped graph scans. |
Known triple pattern |
|
Direct graph scan by subject/predicate/object pattern. |
Cypher
Cypher is the primary public graph query entry point.
Implemented syntax includes practical coverage for:
-
MATCH,OPTIONAL MATCH,WHERE, andRETURN. -
WITH,UNWIND, aggregation,DISTINCT, and branch unions. -
Null-aware expressions, comprehensions and bounded read-only subqueries.
-
ORDER BY,SKIP, andLIMIT. -
CALL … YIELDprocedures. -
CALL vector.knn(…). -
CALL kv.get(…). -
SEARCH collection AS alias. -
RANK rerank_v3(…). -
Selected optimized count motifs.
-
Governed
CREATE,MERGE, node-property updates and node deletion. -
EXPLAIN,PROFILE, and a scoped schema catalog.
See Cypher And openCypher Compatibility for supported shapes and known differences from other Cypher engines.
Example:
CALL vector.knn("products_mm_vec", [0.031, -0.118, 0.442], 50, {ef: 256})
YIELD node AS product, score
MATCH (product:Product)-[:IN_CATEGORY]->(category:Category)
CALL kv.get("default", product) YIELD value AS product_json
RETURN product, category, score, product_json
LIMIT 12
PutKeyValue writes the payload to the default namespace under the product
UID. See Multimodal queries for the load and query sequence.
SEARCH
SEARCH is collection-oriented node search sugar.
It lowers to a label-constrained scan.
SEARCH products AS product
WHERE product.price >= 50 AND product.stock > 0
RETURN product
LIMIT 12
RANK
RANK rerank_v3 sorts the current row stream by a score binding and can cap candidates before projection or final LIMIT.
CALL vector.knn("products_mm_vec", [0.1, 0.2], 100) YIELD node, score
RANK rerank_v3(top_k = 50, score = score)
RETURN node, score
LIMIT 12
Supported options:
-
top_k: positive integer. -
score: variable or string literal naming the score binding.
MERGE And SET
With governed writes enabled and a write-authorized query surface, a supported node-upsert shape is:
MERGE (a:Account {id: 'acct_a', run_id: 'run_1'})
SET a.last_seen = 42, a.active = true
RETURN a
LIMIT 1
The general planner lowers node and directed single-hop merges, including supported ON CREATE SET and ON MATCH SET actions, to governed write operators.
The default database also retains a legacy MERGE … SET … RETURN fast path that does not consult the governed write-mode setting.
See Cypher Writes And Schema for enablement, deterministic-match requirements, creation limits and unsupported mutation forms.
SPARQL
Use ExecuteSPARQL for supported graph-pattern queries.
The distributed HA read path explicitly covers graph-scan-shaped SPARQL such as:
SELECT ?s ?o
WHERE {
?s <http://example.com/ns/edge> ?o .
}
See SPARQL for additional read-query forms and restrictions.