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

ExecuteCypher

Combines graph patterns with CALL vector.knn, CALL kv.get, SEARCH, and RANK.

Vector-only search

VectorSearch, VectorSearchPacked, VectorSearchBatchPacked

Avoids query planning overhead and returns ANN results directly.

KV lookup or batch hydration

GetKeyValue, BulkGetKeyValue

Direct payload access.

RDF/SPARQL graph pattern

ExecuteSPARQL

Useful for SPARQL-shaped graph scans.

Known triple pattern

GraphScan

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, and RETURN.

  • WITH, UNWIND, aggregation, DISTINCT, and branch unions.

  • Null-aware expressions, comprehensions and bounded read-only subqueries.

  • ORDER BY, SKIP, and LIMIT.

  • CALL …​ YIELD procedures.

  • 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 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.

Planned Concept Syntax

The following concept syntax appears in examples and roadmap docs but is not current parser syntax:

EMBED("vintage leather jacket") AS q
FULLTEXT MATCH "leather"

Use client-side embeddings, pre-fused vector indexes, or explicit CALL vector.knn today.

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.

Graph Scan

Use GraphScan when you already know the triple pattern.

subject:   "?person" or "uid:123"
predicate: "?p" or "knows"
object:    "?friend" or "uid:456"

Use packed responses when the caller only needs IDs and scores.

VectorSearchPacked(index_name, query_vector, k, ef_search)
  -> entity_ids[]
  -> scores[]

Use batch packed search to send multiple query vectors in one RPC.