Query Language
The select where command uses a built-in expression parser to filter nodes by their attribute values. Expressions are written in a C-like syntax and evaluated against every node in the graph.
Operators
| Operator | Meaning | Example |
|---|---|---|
| == | Equal | name == "Alice" |
| != | Not equal | group != "admin" |
| < | Less than | score < 0.5 |
| <= | Less than or equal | age <= 30 |
| > | Greater than | weight > 10 |
| >= | Greater than or equal | rank >= 1 |
| && | Logical AND | a > 1 && b < 5 |
| || | Logical OR | x == 1 || y == 2 |
| ! | Logical NOT | !(active == 1) |
| ( ) | Grouping | (a > 1) && (b < 5) |
Operator Precedence
From highest to lowest precedence:
( )— Parenthesised groups!— Logical NOT (unary)== != < <= > >=— Comparisons&&— Logical AND||— Logical OR
Value Types
- Numbers — Integer or floating point:
42,3.14,.5,1e-3,2E+4 - Strings — Double-quoted:
"hello". Backslash escapes are supported. - Identifiers — Attribute names are case-insensitive:
nodeID,Score,Name
Attribute Type Matching
The right-hand value must match the attribute's declared type:
| Attribute Type | Expected Literal | Example |
|---|---|---|
| float | Numeric | score > 0.5 |
| int32 | Integer | rank >= 1 |
| uint32 | Integer | nodeID == 42 |
| string | Quoted string | name == "Bob" |
| shared_string | Quoted string | group != "admin" |
Examples
// Simple comparisons
select where (score > 0.8)
select where (name == "Bob")
// Compound expression with AND
select where (score >= 0.5 && group == "active")
// Nested logic with OR
select where ((age > 18 && age < 65) || role == "admin")
// Negation
select where !(status == "inactive")
// Using set operations with queries
select where (group == "engineering")
+select where (group == "design")
-select where (score < 0.3)
^select where (active == 1)
Script Files
Scripts are plain text files containing one command per line. They let you automate repetitive workflows such as loading data, applying selections, and styling the graph. Run a script with the execute command or via Script > Execute... in the menu bar.
Syntax Rules
- One command per line
- Everything after
//on a line is a comment and is ignored - Blank lines are skipped
- Execution stops on the first error, reporting the file path and line number
Example Script
// Load the dataset
load data/social_network.csv target=(user_a, user_b, username)
// Import additional attributes
import data/user_scores.csv target=(username, user) attributes=[(score, float, score), (group, string, group)]
// Select all nodes and style them
select all
set node size 15
set node colour 58a6ff
set edge width 1
set edge colour 30363d
// Map node size by score
map node size score 0 1 8 40
// Map colour from blue to red by score
map node colour score 0 1 3b82f6 ef4444
// Show labels
set label content username
set label size 10
set label colour e6edf3
// Create a subset of high-scoring nodes
select where (score > 0.8)
create subset top_scorers
Running Scripts
There are three ways to run a script:
- Type
execute path/to/script.txtin the console - Use Script > Execute... from the menu bar to pick a file
- Click a recently-run script in the Script menu
Recently executed scripts are remembered across sessions and appear in the Script menu for quick re-execution.