---
title: `nexyron.semantic.registry_expand`
url: https://nexyron.tech/docs/cypher/procedures/semantic/nexyron-semantic-registry-expand
description: nexyron.semantic.registry expand expands one semantic search hit into registry anchors and sampled observed graph data.
---

# `nexyron.semantic.registry_expand`

## Generic Description

`nexyron.semantic.registry_expand` expands one semantic search hit into registry anchors and sampled observed graph data.

Simple example:

```cypher
CALL nexyron.semantic.search({query: 'churn risk', k: 10, ef: 200})
YIELD item_id, source, name, metadata_json, text, score
CALL nexyron.semantic.registry_expand({
  item_id: item_id,
  source: source,
  name: name,
  metadata_json: metadata_json,
  source_sample_limit: 5
})
YIELD anchors, traversal_rows
RETURN text AS interpreted_text,
       traversal_rows AS _observed_data,
       anchors AS sources,
       score
ORDER BY score DESC
LIMIT 10
```

Semantic search procedures expose vector and semantic retrieval surfaces through Cypher.

## Consumer-Level Explanation

Use this after `nexyron.semantic.search` when a hit is a abstraction, knowledge assertion, analysis-run artifact, or report and the caller needs the concrete registry identities plus backing graph samples.

The procedure is row-correlated, so it can run directly after `UNWIND hits AS hit` or after a semantic search `YIELD`. It does not require a separate HTTP route or frontend-side expansion.

## Conceptual Explanation

`nexyron.semantic.registry_expand` should be read as one named procedure contract in the broader Nexyron Cypher surface. The procedure call is not only a syntax hook: it defines what runtime state, projection, registry entry, or graph algorithm is being asked to operate, and it determines which output columns downstream `YIELD`, `WITH`, and `RETURN` stages can safely use.

## More Detailed Explanation

The procedure accepts a map with `item_id`, `source`, optional `name`, optional `metadata_json`, and optional `source_sample_limit`.

It returns:

-   `anchors`: typed source references such as `abstraction`, `abstraction_edge`, `knowledge_assertion`, `graph_node`, and `graph_edge`.
-   `traversal_rows`: sampled observed context, including abstraction source-query rows and one-hop business graph context when sampled rows expose node ids.

For abstraction hits, it resolves the abstraction definition, executes its `source_query` with a bounded limit, and adds adjacent abstraction or assertion edges. For abstraction-edge and knowledge-assertion hits, it resolves both endpoint abstractions and samples their backing data when available.

## Advanced Example

```cypher
CALL nexyron.semantic.search({query: 'trainer contact churn risk', k: 10, ef: 200})
YIELD result_kind, item_id, node_id, edge_id, source, name, score, text, metadata_json
WITH collect({
  item_id: item_id,
  source: source,
  name: name,
  score: score,
  text: text,
  metadata_json: metadata_json
}) AS hits
UNWIND hits AS hit
CALL nexyron.semantic.registry_expand({
  item_id: hit.item_id,
  source: hit.source,
  name: hit.name,
  metadata_json: hit.metadata_json,
  source_sample_limit: 5
})
YIELD anchors, traversal_rows
RETURN {
  interpreted_text: hit.text,
  _observed_data: traversal_rows,
  sources: anchors
} AS semantic_result
ORDER BY hit.score DESC
LIMIT 10
```

## Real Use Cases

-   turning abstraction and artifact semantic hits into inspectable JSON for assistant context
-   linking abstraction concepts back to concrete sampled business rows
-   exposing knowledge assertion endpoints without losing their registry identities
-   debugging whether an abstraction has a live `source_query` and useful observed data
-   compose the procedure output with `YIELD`, `WITH`, and `RETURN` rather than hiding follow-up logic outside Cypher

## Real Limitations And Tradeoffs

-   Sampling is intentionally bounded by `source_sample_limit`; it is context expansion, not a full materialization job.
-   Source queries must be valid read queries. Invalid saved abstraction contracts still fail loudly.
-   Abstraction or artifact hits without backing source queries can still return anchors, but their observed rows may be empty.
