gcyphrq 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/engine/cypher-engine.d.ts +39 -0
- package/dist/engine/cypher-engine.d.ts.map +1 -0
- package/dist/engine/cypher-parser.d.ts +3 -0
- package/dist/engine/cypher-parser.d.ts.map +1 -0
- package/dist/graph.d.ts +24 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/index.js +5816 -0
- package/dist/indexes.d.ts +38 -0
- package/dist/indexes.d.ts.map +1 -0
- package/dist/lib.d.ts +189 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +1455 -0
- package/dist/types/cypher.d.ts +139 -0
- package/dist/types/cypher.d.ts.map +1 -0
- package/docs/404.md +11 -0
- package/docs/_config.yml +42 -0
- package/docs/_includes/footer.html +6 -0
- package/docs/_includes/head.html +13 -0
- package/docs/_includes/nav.html +23 -0
- package/docs/_layouts/default.html +20 -0
- package/docs/assets/cypher-highlight.js +171 -0
- package/docs/assets/favicon.svg +4 -0
- package/docs/assets/main.css +416 -0
- package/docs/cli.md +115 -0
- package/docs/examples.md +223 -0
- package/docs/getting-started.md +158 -0
- package/docs/index.md +89 -0
- package/docs/library-api.md +618 -0
- package/docs/query-guide.md +302 -0
- package/docs/skill.md +219 -0
- package/examples/README.md +187 -0
- package/examples/cloud-infra.json +199 -0
- package/examples/social-graph.json +11 -0
- package/package.json +71 -0
package/docs/examples.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Examples
|
|
4
|
+
description: 19 ready-to-run Cypher queries against the bundled cloud infrastructure graph.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<div class="breadcrumb">
|
|
8
|
+
<a href="{{ '/' | relative_url }}">Home</a> <span>›</span> Examples
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
# Examples
|
|
12
|
+
|
|
13
|
+
This page provides ready-to-run Cypher queries against the bundled example graphs.
|
|
14
|
+
|
|
15
|
+
## Available Graphs
|
|
16
|
+
|
|
17
|
+
| File | Description |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `social-graph.json` | A small social network with three users connected by `FRIEND` relationships |
|
|
20
|
+
| `cloud-infra.json` | A full startup cloud infrastructure — 52 nodes, 110 edges — with RPC services, message queues, databases, workers, monitoring, and external APIs |
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Load a graph from file
|
|
26
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH (u:User) RETURN u'
|
|
27
|
+
|
|
28
|
+
# Pipe a graph from stdin
|
|
29
|
+
cat examples/social-graph.json | gcyphrq -g - -e 'MATCH (u:User) RETURN u'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## `cloud-infra.json` — Query Examples
|
|
35
|
+
|
|
36
|
+
This graph models an entire startup's cloud service infrastructure. Use it to explore real-world queries like impact analysis, dependency chains, and service topology.
|
|
37
|
+
|
|
38
|
+
### 1. List all RPC services
|
|
39
|
+
|
|
40
|
+
Find every service of type `RPC` running in the infrastructure:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service {type: "RPC"}) RETURN s'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Trace the full request path from the public API to databases
|
|
47
|
+
|
|
48
|
+
Follow the call chain from the API Gateway, 2–4 hops deep, to see which databases a request can reach:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (api:Service {name: "API Gateway"})-[r*2..4]->(db:Database) RETURN api, r, db'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Find all services that depend on a specific database
|
|
55
|
+
|
|
56
|
+
Discover every service that has a direct connection to the PostgreSQL primary:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service)-[:TCP]->(db:Database {name: "PostgreSQL Primary"}) RETURN s'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Count how many services each message queue feeds into
|
|
63
|
+
|
|
64
|
+
Group by message queue and count the downstream consumers:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (mq:Infrastructure {type: "MessageQueue"})-[:TCP]->(w:Service) WITH mq, count(w) AS consumerCount RETURN mq, consumerCount'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 5. Find the blast radius of a service failure
|
|
71
|
+
|
|
72
|
+
If the Kafka cluster goes down, which services are directly or indirectly affected (up to 2 hops)?
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (kafka:Infrastructure {name: "Kafka Cluster"})-[r*1..2]-(affected) RETURN kafka, r, affected'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 6. List all external dependencies per service
|
|
79
|
+
|
|
80
|
+
For each RPC service, find which external APIs it calls (directly or through intermediaries, up to 3 hops):
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service {type: "RPC"})-[r*1..3]->(ext:External) RETURN s, ext'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 7. Find which services call Stripe
|
|
87
|
+
|
|
88
|
+
Trace from any service through up to 3 hops to find which ones reach the Stripe API:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service)-[r*1..3]->(stripe:External {name: "Stripe API"}) RETURN s, stripe'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 8. Map the replication topology
|
|
95
|
+
|
|
96
|
+
Find all replication relationships between databases:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (primary:Database)-[r:Replication]->(replica:Database) RETURN primary, r, replica'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 9. Find the longest dependency chain
|
|
103
|
+
|
|
104
|
+
Trace paths from the CDN (edge) down through the infrastructure to storage or databases (up to 6 hops):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (cdn:Service {name: "CloudFront CDN"})-[r*1..6]->(leaf:Database) RETURN cdn, r, leaf'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 10. List all services hosted on the primary EKS cluster
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (eks:Infrastructure {name: "EKS Cluster"})-[:Hosts]->(s:Service) RETURN s'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 11. Find which services talk to Vault for secrets
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service)-[:HTTPS]->(v:Security {name: "Vault"}) RETURN s'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 12. Count outgoing connections per service
|
|
123
|
+
|
|
124
|
+
Rank services by how many direct dependencies they have:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service)-[]->(target) WITH s, count(target) AS outDegree WHERE outDegree > 2 RETURN s, outDegree'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 13. Sort services by name (ORDER BY)
|
|
131
|
+
|
|
132
|
+
Return all services sorted alphabetically by name:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service) RETURN s.name ORDER BY s.name ASC'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 14. Top-N services by connection count (ORDER BY + LIMIT)
|
|
139
|
+
|
|
140
|
+
Find the 3 services with the most outgoing connections:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service)-[]->(target) WITH s, count(target) AS outDegree ORDER BY outDegree DESC LIMIT 3 RETURN s.name, outDegree'
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 15. Limit results to first N (LIMIT)
|
|
147
|
+
|
|
148
|
+
Return only the first 5 databases in the infrastructure:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (d:Database) RETURN d.name LIMIT 5'
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 16. Sort by multiple columns
|
|
155
|
+
|
|
156
|
+
Sort services first by type (ascending), then by name (descending):
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service) RETURN s.type, s.name ORDER BY s.type ASC, s.name DESC'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 17. Skip first N results (SKIP)
|
|
163
|
+
|
|
164
|
+
Skip the first 5 services when listing all services:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service) RETURN s.name SKIP 5'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 18. Pagination with ORDER BY + SKIP + LIMIT
|
|
171
|
+
|
|
172
|
+
Get page 2 of services sorted by name (10 per page):
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
gcyphrq -g examples/cloud-infra.json -e 'MATCH (s:Service) RETURN s.name ORDER BY s.name ASC SKIP 10 LIMIT 10'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 19. Average, min, max aggregations
|
|
179
|
+
|
|
180
|
+
Compute average, minimum, and maximum across all users:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH (u:User) RETURN avg(u.age) AS avgAge, min(u.age) AS minAge, max(u.age) AS maxAge'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## `social-graph.json` — Query Examples
|
|
189
|
+
|
|
190
|
+
This small graph contains three users connected by `FRIEND` relationships:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Alice --FRIEND--> Bob --FRIEND--> Charlie
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### List all users
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH (u:User) RETURN u.name'
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Find Alice's friends
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH (a:User {name: "Alice"})-[:FRIEND]->(f) RETURN f.name'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Find friends of friends (2-hop path)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH (a:User {name: "Alice"})-[:FRIEND*2..2]-(fof:User) RETURN fof.name'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Count total friendships
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gcyphrq -g examples/social-graph.json -e 'MATCH ()-[r:FRIEND]->() RETURN count(r) AS totalFriendships'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Next Steps
|
|
221
|
+
|
|
222
|
+
- **[Query Guide](query-guide)** — Full Cypher syntax reference and query patterns
|
|
223
|
+
- **[Library API](library-api)** — Use gcyphrq programmatically in your code
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Getting Started
|
|
4
|
+
description: Install gcyphrq and run your first Cypher query.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<div class="breadcrumb">
|
|
8
|
+
<a href="{{ '/' | relative_url }}">Home</a> <span>›</span> Getting Started
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
# Getting Started
|
|
12
|
+
|
|
13
|
+
This guide will help you install `gcyphrq` and run your first Cypher query against an in-memory graph.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js** {{ site.node_version }} or later
|
|
18
|
+
- **npm** (or any compatible package manager)
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Global CLI
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g gcyphrq
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This makes the `gcyphrq` command available globally on your PATH.
|
|
29
|
+
|
|
30
|
+
### Project dependency
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install gcyphrq
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### From source
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/plelevier/gcyphrq.git
|
|
40
|
+
cd gcyphrq
|
|
41
|
+
npm install
|
|
42
|
+
npm run build
|
|
43
|
+
npm link
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Your First Query
|
|
47
|
+
|
|
48
|
+
### 1. Create a graph file
|
|
49
|
+
|
|
50
|
+
Create a file called `social-graph.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"nodes": [
|
|
55
|
+
{ "id": "alice", "label": "User", "name": "Alice", "age": 30 },
|
|
56
|
+
{ "id": "bob", "label": "User", "name": "Bob", "age": 25 },
|
|
57
|
+
{ "id": "charlie","label": "User", "name": "Charlie","age": 35 }
|
|
58
|
+
],
|
|
59
|
+
"edges": [
|
|
60
|
+
{ "source": "alice", "target": "bob", "type": "FRIEND" },
|
|
61
|
+
{ "source": "bob", "target": "charlie", "type": "FRIEND" }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Run a query
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gcyphrq -g social-graph.json -e 'MATCH (u:User) RETURN u.name, u.age'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Output:**
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
[
|
|
76
|
+
{ "name": "Alice", "age": 30 },
|
|
77
|
+
{ "name": "Bob", "age": 25 },
|
|
78
|
+
{ "name": "Charlie", "age": 35 }
|
|
79
|
+
]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Pipe to `jq`
|
|
83
|
+
|
|
84
|
+
The CLI outputs raw JSON, so you can pipe it directly to `jq`:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
gcyphrq -g social-graph.json -e 'MATCH (u:User) RETURN u.name' | jq '.[].name'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Graph File Format
|
|
91
|
+
|
|
92
|
+
Graphs are described as JSON files with two arrays:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"nodes": [
|
|
97
|
+
{ "id": "<unique-id>", "label": "<label>", "<property>": "<value>", ... }
|
|
98
|
+
],
|
|
99
|
+
"edges": [
|
|
100
|
+
{ "source": "<source-id>", "target": "<target-id>", "type": "<edge-type>", ... }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Node properties
|
|
106
|
+
|
|
107
|
+
- **`id`** — required, unique string identifier for each node
|
|
108
|
+
- **`label`** — optional, used for filtering in Cypher queries (e.g., `(u:User)`)
|
|
109
|
+
- Additional properties become node attributes accessible in queries
|
|
110
|
+
|
|
111
|
+
### Edge properties
|
|
112
|
+
|
|
113
|
+
- **`source`** — required, the `id` of the source node
|
|
114
|
+
- **`target`** — required, the `id` of the target node
|
|
115
|
+
- **`type`** — optional, used for filtering in Cypher queries (e.g., `[:FRIEND]`)
|
|
116
|
+
- Additional properties become edge attributes
|
|
117
|
+
- Edge IDs are auto-generated by Graphology (you cannot specify custom edge IDs)
|
|
118
|
+
|
|
119
|
+
<div class="callout">
|
|
120
|
+
<p><strong>Note:</strong> Multi-graphs (multiple edges between the same pair of nodes) are not supported.</p>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
## Reading from stdin
|
|
124
|
+
|
|
125
|
+
Instead of a file, you can pipe the graph from stdin using `-g -`:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
cat my-graph.json | gcyphrq -g - -e 'MATCH (u:User) RETURN u'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Using as a Library
|
|
132
|
+
|
|
133
|
+
For programmatic access, import `gcyphrq` in your TypeScript or Node.js project:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { executeQuery } from 'gcyphrq';
|
|
137
|
+
|
|
138
|
+
const graphData = {
|
|
139
|
+
nodes: [
|
|
140
|
+
{ id: 'alice', label: 'User', name: 'Alice', age: 30 },
|
|
141
|
+
{ id: 'bob', label: 'User', name: 'Bob', age: 25 },
|
|
142
|
+
],
|
|
143
|
+
edges: [
|
|
144
|
+
{ source: 'alice', target: 'bob', type: 'FRIEND' },
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const results = executeQuery(graphData, 'MATCH (u:User) RETURN u.name, u.age');
|
|
149
|
+
console.log(results);
|
|
150
|
+
// [ { name: 'Alice', age: 30 }, { name: 'Bob', age: 25 } ]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Next Steps
|
|
154
|
+
|
|
155
|
+
- **[CLI Reference](cli)** — Full documentation of CLI options and usage patterns
|
|
156
|
+
- **[Query Guide](query-guide)** — Cypher syntax reference, supported features, and query patterns
|
|
157
|
+
- **[Library API](library-api)** — Complete API reference for Node.js / TypeScript usage
|
|
158
|
+
- **[Examples](examples)** — 18 ready-to-run queries against the bundled cloud infrastructure graph
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Home
|
|
4
|
+
description: A Cypher graph query engine for in-memory graphs built on Graphology.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<div class="hero">
|
|
8
|
+
<h1>gcyphrq</h1>
|
|
9
|
+
<p class="tagline">A Cypher graph query engine for in-memory graphs. Parse a graph from JSON, run a Cypher query, get raw JSON results.</p>
|
|
10
|
+
<div class="hero-actions">
|
|
11
|
+
<a href="{{ '/getting-started/' | relative_url }}" class="btn btn-primary">Getting Started →</a>
|
|
12
|
+
<a href="https://github.com/plelevier/gcyphrq" class="btn btn-secondary" target="_blank" rel="noopener noreferrer">View on GitHub ↗</a>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="feature-grid">
|
|
17
|
+
<div class="feature-card">
|
|
18
|
+
<h3>🔍 Cypher Queries</h3>
|
|
19
|
+
<p>Full support for <code>MATCH</code>, <code>OPTIONAL MATCH</code>, <code>WITH</code>, <code>RETURN</code>, <code>ORDER BY</code>, <code>SKIP</code>, <code>LIMIT</code>, and mutations.</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="feature-card">
|
|
22
|
+
<h3>📐 Variable-Length Paths</h3>
|
|
23
|
+
<p>Traverse graphs with variable-depth paths like <code>-[r:FRIEND*1..3]-</code> to explore connections at any depth.</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="feature-card">
|
|
26
|
+
<h3>📦 CLI & Library</h3>
|
|
27
|
+
<p>Use as a CLI tool for quick queries or import as a TypeScript/Node.js library in your projects.</p>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="feature-card">
|
|
30
|
+
<h3>📊 Aggregations</h3>
|
|
31
|
+
<p>Group and aggregate with <code>count()</code>, <code>sum()</code>, <code>avg()</code>, <code>min()</code>, <code>max()</code> and implicit grouping via <code>WITH</code> pipelining.</p>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="feature-card">
|
|
34
|
+
<h3>✏️ Mutations</h3>
|
|
35
|
+
<p>Create, update, and delete nodes and edges with <code>CREATE</code>, <code>SET</code>, and <code>DELETE</code> clauses.</p>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="feature-card">
|
|
38
|
+
<h3>🔧 TypeScript</h3>
|
|
39
|
+
<p>Full type declarations shipped with the package. Works seamlessly in TypeScript projects.</p>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
Install and run your first query in seconds:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Install globally
|
|
51
|
+
npm install -g gcyphrq
|
|
52
|
+
|
|
53
|
+
# Run a query against a JSON graph
|
|
54
|
+
gcyphrq -g my-graph.json -e 'MATCH (u:User) RETURN u.name'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or use it as a library:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { executeQuery } from 'gcyphrq';
|
|
61
|
+
|
|
62
|
+
const results = executeQuery(graphData, 'MATCH (u:User) RETURN u.name');
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Supported Cypher Features
|
|
66
|
+
|
|
67
|
+
| Feature | Status |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `MATCH` with node labels and properties | <span class="badge badge-success">✅</span> |
|
|
70
|
+
| Variable-length paths `*min..max` | <span class="badge badge-success">✅</span> |
|
|
71
|
+
| Directional edges `->`, `<-`, `-` | <span class="badge badge-success">✅</span> |
|
|
72
|
+
| `OPTIONAL MATCH` | <span class="badge badge-success">✅</span> |
|
|
73
|
+
| `RETURN` with aliases | <span class="badge badge-success">✅</span> |
|
|
74
|
+
| `WITH` + implicit grouping | <span class="badge badge-success">✅</span> |
|
|
75
|
+
| `count()`, `sum()`, `avg()`, `min()`, `max()` aggregations | <span class="badge badge-success">✅</span> |
|
|
76
|
+
| `WHERE` with `>`, `<`, `=`, `CONTAINS` | <span class="badge badge-success">✅</span> |
|
|
77
|
+
| `CREATE`, `SET`, `DELETE` mutations | <span class="badge badge-success">✅</span> |
|
|
78
|
+
| `ORDER BY` (single/multi-column) | <span class="badge badge-success">✅</span> |
|
|
79
|
+
| `SKIP` / `LIMIT` | <span class="badge badge-success">✅</span> |
|
|
80
|
+
| Subqueries, `CALL`, APOC | <span class="badge badge-danger">❌</span> |
|
|
81
|
+
|
|
82
|
+
## Example Graphs
|
|
83
|
+
|
|
84
|
+
Two example graphs are bundled with the package:
|
|
85
|
+
|
|
86
|
+
- **`social-graph.json`** — A small social network with three users connected by `FRIEND` relationships
|
|
87
|
+
- **`cloud-infra.json`** — A full startup cloud infrastructure with 52 nodes and 110 edges
|
|
88
|
+
|
|
89
|
+
See the [Examples](examples) page for 19 ready-to-run queries against the cloud infrastructure graph.
|