CLI Reference¶
Complete reference for the uni command-line interface. The CLI provides tools for data import, query execution, and server management.
Synopsis¶
Global Options¶
| Option | Description |
|---|---|
-h, --help |
Print help information |
-V, --version |
Print version information |
-v, --verbose |
Enable verbose logging (can be repeated: -vv, -vvv) |
--quiet |
Suppress non-essential output |
--log-format <FORMAT> |
Log format: text (default), json |
Environment Variables¶
| Variable | Description | Default |
|---|---|---|
RUST_LOG |
Log level filter (e.g., info, debug, uni=debug) |
warn |
UNI_STORAGE_PATH |
Default storage path | ./storage |
UNI_CONFIG |
Path to configuration file | ./uni.toml |
AWS_REGION |
AWS region for S3 storage | — |
AWS_ACCESS_KEY_ID |
AWS access key | — |
AWS_SECRET_ACCESS_KEY |
AWS secret key | — |
Commands¶
import — Import Data¶
Import vertices and edges from JSONL files into a new or existing database.
Synopsis¶
Arguments¶
| Argument | Description |
|---|---|
<NAME> |
Dataset name identifier (e.g., semantic-scholar, products) |
Options¶
| Option | Description | Required |
|---|---|---|
--papers <PATH> |
Path to vertices JSONL file | Yes |
--citations <PATH> |
Path to edges JSONL file | Yes |
--output <PATH> |
Output directory for storage | No (default: ./storage) |
--schema <PATH> |
Path to schema JSON file | No (auto-inferred) |
--batch-size <N> |
Records per batch during import | No (default: 10000) |
--skip-validation |
Skip schema validation (faster but risky) | No |
--force |
Overwrite existing storage | No |
Examples¶
Basic import:
uni import products \
--papers ./data/products.jsonl \
--citations ./data/purchases.jsonl \
--output ./product-graph
Import with custom schema:
uni import research \
--papers ./papers.jsonl \
--citations ./citations.jsonl \
--schema ./schema.json \
--output ./research-graph
Large dataset with tuned batch size:
uni import wikipedia \
--papers ./articles.jsonl \
--citations ./links.jsonl \
--batch-size 50000 \
--output s3://my-bucket/wiki-graph
Input File Format¶
Vertices JSONL:
{"id": "node_123", "label": "Product", "name": "Widget", "price": 29.99, "embedding": [0.1, 0.2, ...]}
id(required): Unique string identifierlabel(optional): Vertex label (default: inferred from import name)- Additional fields: Property key-value pairs
Edges JSONL:
src(required): Source vertex IDdst(required): Destination vertex IDtype(optional): Edge type (default:RELATES_TO)- Additional fields: Edge properties
query — Execute Queries¶
Run OpenCypher queries against a database.
Synopsis¶
Arguments¶
| Argument | Description |
|---|---|
<STATEMENT> |
Cypher query string |
Options¶
| Option | Description | Default |
|---|---|---|
--path <PATH> |
Storage directory path | ./storage |
Examples¶
Basic query with table output:
Output:
repl — Interactive Shell¶
Start the interactive UniDB shell for running Cypher queries.
Synopsis¶
Options¶
| Option | Description | Default |
|---|---|---|
--path <PATH> |
Storage directory path | ./storage |
Shell Commands¶
Within the REPL, you can use the following commands:
| Command | Description |
|---|---|
help |
Show available commands |
clear |
Clear the screen |
exit, quit |
Exit the REPL |
<cypher> |
Execute a Cypher query |
snapshot — Manage Snapshots¶
Create, list, and restore database snapshots for point-in-time recovery and history tracking.
Synopsis¶
Subcommands¶
list — List all available snapshots.
create — Create a new named snapshot.
restore — Restore the database to a specific snapshot ID.
start — Start Server¶
Start the Uni HTTP API server for remote access.
Synopsis¶
Options¶
| Option | Description | Default |
|---|---|---|
--port <PORT> |
HTTP port to listen on | 8080 |
--host <HOST> |
Host address to bind | 127.0.0.1 |
--path <PATH> |
Storage directory path | ./storage |
--workers <N> |
Number of worker threads | CPU count |
--read-only |
Disable write operations | false |
--cors |
Enable CORS for all origins | false |
Examples¶
Start on default port:
Production configuration:
API Endpoints¶
When the server is running:
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/query |
POST | Execute Cypher query |
/schema |
GET | Get schema definition |
/stats |
GET | Database statistics |
Query API example:
curl -X POST http://localhost:8080/query \
-H "Content-Type: application/json" \
-d '{"query": "MATCH (n) RETURN COUNT(n)"}'
Response:
Schema, Stats, and Index Management¶
Schema inspection, database statistics, and index management are available through Cypher queries in the REPL or via the query command:
Schema inspection:
# View labels
uni query "CALL db.labels() YIELD label RETURN label" --path ./graph
# View relationship types
uni query "CALL db.relationshipTypes() YIELD relationshipType RETURN relationshipType" --path ./graph
# View indexes
uni query "SHOW INDEXES" --path ./graph
Database statistics:
# Count vertices and edges
uni query "MATCH (n) RETURN labels(n)[0] AS label, count(*) AS count" --path ./graph
# Count by edge type
uni query "MATCH ()-[r]->() RETURN type(r) AS type, count(*) AS count" --path ./graph
Index management:
# Create a vector index
uni query "CREATE VECTOR INDEX paper_emb FOR (p:Paper) ON p.embedding OPTIONS {type: 'hnsw', metric: 'cosine'}" --path ./graph
# Create a scalar index
uni query "CREATE INDEX author_name FOR (a:Author) ON a.name" --path ./graph
# Drop an index
uni query "DROP INDEX paper_emb" --path ./graph
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | Storage error (file not found, permission denied) |
| 4 | Query error (parse error, execution failure) |
| 5 | Timeout exceeded |
Shell Completion¶
Generate shell completions for faster CLI usage:
Bash:
Zsh:
Fish:
See Also¶
- Quick Start — Tutorial introduction
- Cypher Querying — Query language reference
- Configuration — Configuration file options