@@ -21,6 +21,8 @@ GraphQL is enabled by default. The endpoints are:
2121
2222Navigate to ` http://localhost:7474/playground ` to access the interactive GraphQL Playground with full schema introspection and auto-complete.
2323
24+ - ** NOTE:** Must add headers ` { "Authorization": "Bearer asdfsgagsaga....."} ` to your http headers in the playground to use authentication!
25+
2426## Schema Overview
2527
2628### Core Types
@@ -35,12 +37,21 @@ type Node {
3537 updatedAt : DateTime
3638 hasEmbedding : Boolean !
3739 embeddingDimensions : Int !
38-
40+
3941 # Traversal
40- relationships (types : [String ! ], direction : RelationshipDirection , limit : Int ): [Relationship ! ]!
42+ relationships (
43+ types : [String ! ]
44+ direction : RelationshipDirection
45+ limit : Int
46+ ): [Relationship ! ]!
4147 outgoing (types : [String ! ], limit : Int ): [Relationship ! ]!
4248 incoming (types : [String ! ], limit : Int ): [Relationship ! ]!
43- neighbors (direction : RelationshipDirection , relationshipTypes : [String ! ], labels : [String ! ], limit : Int ): [Node ! ]!
49+ neighbors (
50+ direction : RelationshipDirection
51+ relationshipTypes : [String ! ]
52+ labels : [String ! ]
53+ limit : Int
54+ ): [Node ! ]!
4455 similar (limit : Int , threshold : Float ): [SimilarNode ! ]!
4556}
4657
@@ -74,7 +85,10 @@ query Stats {
7485 relationshipCount
7586 embeddedNodeCount
7687 uptimeSeconds
77- labels { label count }
88+ labels {
89+ label
90+ count
91+ }
7892 }
7993}
8094
@@ -108,14 +122,12 @@ query Labels {
108122``` graphql
109123# Create a node
110124mutation CreatePerson {
111- createNode (input : {
112- labels : ["Person" ]
113- properties : {
114- name : " Alice Smith"
115- age : 30
116- email : " alice@example.com"
125+ createNode (
126+ input : {
127+ labels : ["Person" ]
128+ properties : { name : " Alice Smith" , age : 30 , email : " alice@example.com" }
117129 }
118- } ) {
130+ ) {
119131 id
120132 labels
121133 properties
@@ -124,27 +136,35 @@ mutation CreatePerson {
124136
125137# Create a relationship
126138mutation CreateKnows {
127- createRelationship (input : {
128- startNodeId : " alice-id"
129- endNodeId : " bob-id"
130- type : " KNOWS"
131- properties : { since : " 2024-01-01" }
132- }) {
139+ createRelationship (
140+ input : {
141+ startNodeId : " alice-id"
142+ endNodeId : " bob-id"
143+ type : " KNOWS"
144+ properties : { since : " 2024-01-01" }
145+ }
146+ ) {
133147 id
134148 type
135- startNode { id }
136- endNode { id }
149+ startNode {
150+ id
151+ }
152+ endNode {
153+ id
154+ }
137155 }
138156}
139157
140158# Bulk create nodes
141159mutation BulkCreate {
142- bulkCreateNodes (input : {
143- nodes : [
144- { labels : ["Person" ], properties : { name : " Alice" } }
145- { labels : ["Person" ], properties : { name : " Bob" } }
146- ]
147- }) {
160+ bulkCreateNodes (
161+ input : {
162+ nodes : [
163+ { labels : ["Person" ], properties : { name : " Alice" } }
164+ { labels : ["Person" ], properties : { name : " Bob" } }
165+ ]
166+ }
167+ ) {
148168 created
149169 skipped
150170 errors
@@ -157,13 +177,16 @@ mutation BulkCreate {
157177``` graphql
158178# Hybrid search (vector + BM25)
159179query Search {
160- search (query : " software engineer" , options : {
161- limit : 10
162- labels : ["Person" ]
163- method : HYBRID
164- }) {
180+ search (
181+ query : " software engineer"
182+ options : { limit : 10 , labels : ["Person" ], method : HYBRID }
183+ ) {
165184 results {
166- node { id labels properties }
185+ node {
186+ id
187+ labels
188+ properties
189+ }
167190 score
168191 rrfScore
169192 vectorRank
@@ -178,7 +201,11 @@ query Search {
178201# Find similar nodes
179202query FindSimilar {
180203 similar (nodeId : " node-id" , limit : 5 , threshold : 0.7 ) {
181- node { id labels properties }
204+ node {
205+ id
206+ labels
207+ properties
208+ }
182209 similarity
183210 }
184211}
@@ -189,9 +216,11 @@ query FindSimilar {
189216``` graphql
190217# Execute Cypher queries
191218query CypherQuery {
192- cypher (input : {
193- statement : " MATCH (p:Person)-[:WORKS_AT]->(c:Company) RETURN p.name, c.name LIMIT 10"
194- }) {
219+ cypher (
220+ input : {
221+ statement : " MATCH (p:Person)-[:WORKS_AT]->(c:Company) RETURN p.name, c.name LIMIT 10"
222+ }
223+ ) {
195224 columns
196225 rows
197226 rowCount
@@ -200,21 +229,25 @@ query CypherQuery {
200229
201230# Cypher with parameters
202231query CypherWithParams {
203- cypher (input : {
204- statement : " MATCH (p:Person) WHERE p.age > $minAge RETURN p"
205- parameters : { minAge : 25 }
206- }) {
232+ cypher (
233+ input : {
234+ statement : " MATCH (p:Person) WHERE p.age > $minAge RETURN p"
235+ parameters : { minAge : 25 }
236+ }
237+ ) {
207238 columns
208239 rows
209240 }
210241}
211242
212243# Cypher mutations
213244mutation CypherCreate {
214- executeCypher (input : {
215- statement : " CREATE (n:Person {name: $name}) RETURN n"
216- parameters : { name : " Charlie" }
217- }) {
245+ executeCypher (
246+ input : {
247+ statement : " CREATE (n:Person {name: $name}) RETURN n"
248+ parameters : { name : " Charlie" }
249+ }
250+ ) {
218251 rowCount
219252 }
220253}
@@ -230,11 +263,18 @@ query NodeWithRelationships {
230263 labels
231264 outgoing (limit : 10 ) {
232265 type
233- endNode { id labels properties }
266+ endNode {
267+ id
268+ labels
269+ properties
270+ }
234271 }
235272 incoming (limit : 10 ) {
236273 type
237- startNode { id labels }
274+ startNode {
275+ id
276+ labels
277+ }
238278 }
239279 }
240280}
@@ -260,8 +300,20 @@ query Neighborhood {
260300 depth : 2
261301 labels : ["Person" , " Company" ]
262302 ) {
263- nodes { id labels }
264- relationships { id type startNode { id } endNode { id } }
303+ nodes {
304+ id
305+ labels
306+ }
307+ relationships {
308+ id
309+ type
310+ startNode {
311+ id
312+ }
313+ endNode {
314+ id
315+ }
316+ }
265317 }
266318}
267319```
@@ -271,10 +323,9 @@ query Neighborhood {
271323``` graphql
272324# Update node properties
273325mutation UpdatePerson {
274- updateNode (input : {
275- id : " node-id"
276- properties : { age : 31 , title : " Senior Engineer" }
277- }) {
326+ updateNode (
327+ input : { id : " node-id" , properties : { age : 31 , title : " Senior Engineer" } }
328+ ) {
278329 id
279330 properties
280331 }
@@ -363,9 +414,9 @@ curl -X POST http://localhost:7474/graphql \
363414### JavaScript/TypeScript
364415
365416``` typescript
366- const response = await fetch (' /graphql' , {
367- method: ' POST' ,
368- headers: { ' Content-Type' : ' application/json' },
417+ const response = await fetch (" /graphql" , {
418+ method: " POST" ,
419+ headers: { " Content-Type" : " application/json" },
369420 body: JSON .stringify ({
370421 query: `
371422 query GetNode($id: ID!) {
@@ -376,8 +427,8 @@ const response = await fetch('/graphql', {
376427 }
377428 }
378429 ` ,
379- variables: { id: ' node-123' }
380- })
430+ variables: { id: " node-123" },
431+ }),
381432});
382433
383434const { data, errors } = await response .json ();
0 commit comments