Skip to content

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.

Terminal window
nbx schema
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.

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.
Relationship From → to
EXTERNAL_CALLS symbol → external symbol
EXTERNAL_EXTENDS symbol → external symbol
EXTERNAL_IMPLEMENTS symbol → external symbol
EXTERNAL_IMPORTS file → external symbol
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.
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.
  • 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, and line_count.
  • DOCUMENT: path, chunk_index, title, heading_trail, referenced_symbol_uids, and source_type.
  • Relationship records: source_uid, target_uid, relationship, source location, centrality_score, and step_index.

Use nbx schema when you need the complete property list for your installed version.

Terminal window
nbx query '
MATCH (caller:CODE_SYMBOL)-[r:CALLS]->(target:CODE_SYMBOL)
WHERE target.name = "refreshToken"
RETURN caller.name AS caller, type(r) AS relationship
LIMIT 50
'
Terminal window
nbx query '
MATCH (symbol:CODE_SYMBOL)-[:MEMBER_OF]->(community:COMMUNITY)
WHERE symbol.name = "refreshToken"
RETURN symbol.name, community.label, community.size
LIMIT 20
'
Terminal window
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_path
ORDER BY step.step_index
LIMIT 50
'

nbx query supports the subset needed for bounded graph reads:

  • Clauses: MATCH, WHERE, WITH, UNWIND, RETURN, ORDER BY, SKIP, LIMIT, and DISTINCT.
  • Comparison and logic: =, <>, <, >, <=, >=, AND, OR, NOT, IN, CONTAINS, STARTS WITH, ENDS WITH, LIKE, ILIKE, IS NULL, and IS NOT NULL.
  • Scalar functions: toLower, toUpper, and type.
  • Aggregates: count, sum, avg, min, max, and collect.

Not currently supported: OPTIONAL MATCH, CASE, regex matching with =~, XOR, all() / any() / none() predicates, path variables, and path functions.

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.