Skip to content

Commit 55accb2

Browse files
authored
Add example to README
1 parent c793f32 commit 55accb2

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
1-
Java client for RedisGraph
1+
# JRedisGraph
2+
RedisGraph Java client
3+
4+
5+
# Example: Using the Java Client
6+
7+
```java
8+
package com.redislabs.redisgraph;
9+
10+
public class RedisGraphExample {
11+
public static void main(String[] args) {
12+
13+
RedisGraphAPI api = new RedisGraphAPI("social");
14+
15+
api.query("CREATE (:person{name:'roi',age:32})");
16+
api.query("CREATE (:person{name:'amit',age:30})");
17+
18+
api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[knows]->(a)");
19+
20+
ResultSet resultSet = api.query("MATCH (a:person)-[knows]->(:person) RETURN a");
21+
22+
while(resultSet.hasNext()){
23+
Record record = resultSet.next();
24+
System.out.println(record.getString("a.name"));
25+
}
26+
}
27+
}
28+
29+
```

0 commit comments

Comments
 (0)