-
Notifications
You must be signed in to change notification settings - Fork 0
Query Language
A small text query language for selecting and isolating subgraphs — available in the app's query bar and as saved searches. It's a real parser (lib/graph/query-language/: tokenize → parse → evaluate over the graph + computed metrics), not substring matching.
incoming:>5 # high fan-in modules
kind:function | kind:method incoming:>0 # the public API surface
role:react-component # the React rendering tree
depends-on:"database" # anything reaching a "database" node
cycle:true # nodes participating in a cycle
A predicate is field:value (or field:OP value for numeric comparisons).
| Field | Matches |
|---|---|
kind |
Node kind — kind:class, kind:function, … (see The Graph Model) |
role |
Framework/paradigm role — role:react-component, role:angular-service, … |
language / lang
|
Source language — lang:rust
|
path |
File path glob — path:src/ui/**
|
package / pkg
|
Enclosing package |
environment / env
|
client / server
|
runtime |
Detected runtime tag |
category |
UI-vs-feature category |
dependency-type / dep
|
For externals — dependency / devDependency / peer / undeclared
|
incoming |
In-degree — numeric (incoming:>5) |
outgoing |
Out-degree — numeric |
calls |
Call-edge count — numeric |
cycle |
cycle:true — participates in a cycle |
depends-on: |
Reachability — selects everything that can reach the matched target(s) |
Anything that isn't a known field is treated as a text match against node labels, so UserService on its own works.
-
Numeric comparisons:
>,<,>=,<=,=— e.g.outgoing:>=10. -
Boolean:
and(also implicit — juxtaposition means and),or(or|),not(or-). -
Grouping: parentheses —
(kind:function | kind:method) incoming:>0. -
Path queries:
A -> B— selects paths from nodes matchingAto nodes matchingB.
query := orExpr ( "->" orExpr )?
orExpr := andExpr ( ("|" | "or") andExpr )*
andExpr := unary ( ["and"] unary )*
unary := ("-" | "not") unary | atom
atom := "(" orExpr ")" | predicate | text
Common questions ship as presets (presets.ts) you can pick and tweak:
| Preset | Query |
|---|---|
| Public API | (kind:function | kind:method | kind:class | kind:interface) incoming:>0 |
| High-impact modules | incoming:>5 |
| React rendering tree | role:react-component | kind:component |
| Database access | depends-on:"database" | depends-on:"db" |
| Circular dependencies | cycle:true |
Filters are coarse, checkbox-driven narrowing (by kind, language, folder…). The query language is for structured, composable selection — degree thresholds, reachability, paths, boolean logic — that filters can't express. The result is a subgraph you can then lay out, export, or save as a workspace.
PolyGraph — explore, audit, enforce, and compare software architecture across 26 languages, 100% locally. Repository · Releases · Issues · Licensed Apache-2.0 OR MIT
📖 Using PolyGraph
- Installation
- Getting Started
- The Graph Model
- Layouts & Navigation
- Impact Analysis & Insights
- Query Language
- CLI: Rules & Diff
- Exports, Workspaces & Editor
- Troubleshooting & FAQ
🔧 Internals & Contributing