Graph Schema and Cypher
nbx query gives you read-only access to the local code graph. Run nbx schema first: the installed binary is the authority for its exact labels, properties, and Cypher support.
nbx schemaNode labels
Section titled “Node labels”| Label | Identity | Represents |
|---|---|---|
CODE_SYMBOL | symbol_uid | A resolved function, method, class, type, variable, or other code definition. |
FILE | file_uid | A source file in the analyzed repository. |
COMMUNITY | community_uid | A functional cluster of tightly coupled symbols. |
WORKFLOW | workflow_uid | An ordered execution path from an entry point through resolved calls. |
DOCUMENT | document_uid | A documentation chunk linked to repository symbols when present. |
All node types include repository_id and producer_slot so results remain attributable inside multi-repository boxes.
Typed relationships
Section titled “Typed relationships”Code structure
Section titled “Code structure”| Relationship | From → to | Meaning |
|---|---|---|
CALLS | symbol → symbol | One symbol calls another. |
IMPORTS | symbol → symbol | A resolved import relationship. |
EXTENDS | symbol → symbol | Type or class inheritance. |
IMPLEMENTS | symbol → symbol | Interface or trait implementation. |
USES | symbol → symbol | A resolved symbol use outside the more specific edge types. |
CONTAINS | symbol → symbol | A symbol lexically contains another symbol. |
MODULE_INIT | symbol → symbol | A module initialization relationship. |
INVOKES_MACRO | symbol → symbol | A resolved macro invocation. |
External boundaries
Section titled “External boundaries”| Relationship | From → to |
|---|---|
EXTERNAL_CALLS | symbol → external symbol |
EXTERNAL_EXTENDS | symbol → external symbol |
EXTERNAL_IMPLEMENTS | symbol → external symbol |
EXTERNAL_IMPORTS | file → external symbol |
Derived structure
Section titled “Derived structure”| Relationship | From → to | Meaning |
|---|---|---|
MEMBER_OF | symbol → community | Functional community membership. |
WORKFLOW_CALL | workflow → symbol | An ordered call included in a workflow. |
WORKFLOW_OUTCOME | workflow → symbol | An outcome reached by a workflow. |
WORKFLOW_TRAVERSES | workflow → community | A community crossed by a workflow. |
CHILD_OF | community → community | Community hierarchy. |
COMMUNITY_CROSSING | community → community | A resolved connection between functional boundaries. |
Change and file relationships
Section titled “Change and file relationships”| Relationship | From → to | Meaning |
|---|---|---|
CO_CHANGED | symbol → symbol | Symbols changed together in repository history. |
FILE_CO_CHANGED | file → file | Files changed together in repository history. |
FILE_DEPENDS_ON | file → file | A resolved file dependency. |
Common properties
Section titled “Common properties”CODE_SYMBOL:name,kind,language,file_path, source ranges,signature,docstring,scope,content, and content or structural hashes.COMMUNITY:label,summary,size,hierarchy_level, and canonical parent identifiers.WORKFLOW:label,description, entry-point fields,max_depth, callsite counts, and resolution counts.FILE:path,language,content_hash, andline_count.DOCUMENT:path,chunk_index,title,heading_trail,referenced_symbol_uids, andsource_type.- Relationship records:
source_uid,target_uid,relationship, source location,centrality_score, andstep_index.
Use nbx schema when you need the complete property list for your installed version.
Query examples
Section titled “Query examples”Find every caller of a symbol
Section titled “Find every caller of a symbol”nbx query 'MATCH (caller:CODE_SYMBOL)-[r:CALLS]->(target:CODE_SYMBOL)WHERE target.name = "refreshToken"RETURN caller.name AS caller, type(r) AS relationshipLIMIT 50'Find a symbol’s functional community
Section titled “Find a symbol’s functional community”nbx query 'MATCH (symbol:CODE_SYMBOL)-[:MEMBER_OF]->(community:COMMUNITY)WHERE symbol.name = "refreshToken"RETURN symbol.name, community.label, community.sizeLIMIT 20'Read an ordered workflow
Section titled “Read an ordered workflow”nbx query 'MATCH (workflow:WORKFLOW)-[step:WORKFLOW_CALL]->(symbol:CODE_SYMBOL)WHERE workflow.label CONTAINS "Token"RETURN workflow.label, step.step_index, symbol.name, symbol.file_pathORDER BY step.step_indexLIMIT 50'Supported Cypher
Section titled “Supported Cypher”nbx query supports the subset needed for bounded graph reads:
- Clauses:
MATCH,WHERE,WITH,UNWIND,RETURN,ORDER BY,SKIP,LIMIT, andDISTINCT. - Comparison and logic:
=,<>,<,>,<=,>=,AND,OR,NOT,IN,CONTAINS,STARTS WITH,ENDS WITH,LIKE,ILIKE,IS NULL, andIS NOT NULL. - Scalar functions:
toLower,toUpper, andtype. - Aggregates:
count,sum,avg,min,max, andcollect.
Not currently supported: OPTIONAL MATCH, CASE, regex matching with =~, XOR, all() / any() / none() predicates, path variables, and path functions.
Keep queries bounded
Section titled “Keep queries bounded”Add LIMIT while exploring, bind relationship variables when returning type(r) or edge properties, and qualify labels and property names exactly as nbx schema reports them.