Skip to content

Commit 1925927

Browse files
author
DvirDukhan
committed
changed readme.md. Renamed classes & interfaces
1 parent c9f06df commit 1925927

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ import java.util.List;
9494
public class RedisGraphExample {
9595
public static void main(String[] args) {
9696
// general context api. Not bound to graph key or connection
97-
RedisGraphGeneralContext api = new RedisGraph();
97+
RedisGraph graph = new RedisGraph();
9898

9999
// send queries to a specific graph called "social"
100-
api.query("social","CREATE (:person{name:'roi',age:32})");
101-
api.query("social","CREATE (:person{name:%s,age:%d})", "amit", 30);
102-
api.query("social","MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
100+
graph.query("social","CREATE (:person{name:'roi',age:32})");
101+
graph.query("social","CREATE (:person{name:%s,age:%d})", "amit", 30);
102+
graph.query("social","MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
103103

104-
ResultSet resultSet = api.query("social", "MATCH (a:person)-[r:knows]->(b:person) RETURN a, r, b");
104+
ResultSet resultSet = graph.query("social", "MATCH (a:person)-[r:knows]->(b:person) RETURN a, r, b");
105105
while(resultSet.hasNext()) {
106106
Record record = resultSet.next();
107107
// get values
@@ -113,16 +113,16 @@ public class RedisGraphExample {
113113
}
114114

115115
// delete graph
116-
api.deleteGraph("social");
116+
graph.deleteGraph("social");
117117

118118
// get connection context
119-
RedisGraphContexted contextApi = api.getContextedAPI();
120-
contextApi.query("contextSocial","CREATE (:person{name:'roi',age:32})");
121-
contextApi.query("contextSocial","CREATE (:person{name:%s,age:%d})", "amit", 30);
122-
contextApi.query("contextSocial", "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
119+
RedisGraphContext context = graph.getContext();
120+
context.query("contextSocial","CREATE (:person{name:'roi',age:32})");
121+
context.query("contextSocial","CREATE (:person{name:%s,age:%d})", "amit", 30);
122+
context.query("contextSocial", "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)");
123123
// WATCH/MULTI/EXEC
124-
contextApi.watch("contextSocial");
125-
RedisGraphTransaction t = contextApi.multi();
124+
context.watch("contextSocial");
125+
RedisGraphTransaction t = context.multi();
126126
t.query("contextSocial", "MATCH (a:person)-[r:knows]->(b:person) RETURN a, r, b");
127127
// support for Redis/Jedis native commands in transaction
128128
t.set("x", "1");
@@ -131,7 +131,7 @@ public class RedisGraphExample {
131131
List<Object> execResults = t.exec();
132132
System.out.println(execResults.toString());
133133

134-
contextApi.deleteGraph("contextSocial");
134+
context.deleteGraph("contextSocial");
135135
}
136136
}
137137

src/main/java/com/redislabs/redisgraph/RedisGraphContexted.java renamed to src/main/java/com/redislabs/redisgraph/RedisGraphContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import redis.clients.jedis.Jedis;
44

5-
public interface RedisGraphContexted extends RedisGraph {
5+
public interface RedisGraphContext extends RedisGraph {
66

77

88
/**
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.redislabs.redisgraph;
22

3-
public interface RedisGraphGeneralContext extends RedisGraph {
3+
public interface RedisGraphContextGenerator extends RedisGraph {
44

55
/**
66
* Generate a connection bounded api
77
* @return a connection bounded api
88
*/
9-
RedisGraphContexted getContextedAPI();
9+
RedisGraphContext getContext();
1010

1111
}

src/main/java/com/redislabs/redisgraph/impl/api/ContextedRedisGraph.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.redislabs.redisgraph.impl.api;
22

3-
import com.redislabs.redisgraph.RedisGraphContexted;
3+
import com.redislabs.redisgraph.RedisGraphContext;
44
import com.redislabs.redisgraph.ResultSet;
55
import com.redislabs.redisgraph.impl.Utils;
66
import com.redislabs.redisgraph.impl.graph_cache.RedisGraphCaches;
@@ -12,10 +12,10 @@
1212
import java.util.List;
1313

1414
/**
15-
* An implementaion of RedisGraphContexted. Allows sending RedisGraph and some Redis commands,
15+
* An implementaion of RedisGraphContext. Allows sending RedisGraph and some Redis commands,
1616
* within a specific connection context
1717
*/
18-
public class ContextedRedisGraph extends AbstractRedisGraph implements RedisGraphContexted, RedisGraphCacheHolder {
18+
public class ContextedRedisGraph extends AbstractRedisGraph implements RedisGraphContext, RedisGraphCacheHolder {
1919

2020
private Jedis connectionContext;
2121
private RedisGraphCaches caches;

src/main/java/com/redislabs/redisgraph/impl/api/RedisGraph.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.redislabs.redisgraph.impl.api;
22

3-
import com.redislabs.redisgraph.RedisGraphContexted;
4-
import com.redislabs.redisgraph.RedisGraphGeneralContext;
3+
import com.redislabs.redisgraph.RedisGraphContext;
4+
import com.redislabs.redisgraph.RedisGraphContextGenerator;
55
import com.redislabs.redisgraph.ResultSet;
66
import com.redislabs.redisgraph.impl.graph_cache.RedisGraphCaches;
77
import redis.clients.jedis.Jedis;
@@ -12,7 +12,7 @@
1212
/**
1313
*
1414
*/
15-
public class RedisGraph extends AbstractRedisGraph implements RedisGraphGeneralContext {
15+
public class RedisGraph extends AbstractRedisGraph implements RedisGraphContextGenerator {
1616

1717
private final Pool<Jedis> client;
1818
private RedisGraphCaches caches = new RedisGraphCaches();
@@ -99,7 +99,7 @@ public String deleteGraph(String graphId) {
9999
* @return ContextedRedisGraph
100100
*/
101101
@Override
102-
public RedisGraphContexted getContextedAPI() {
102+
public RedisGraphContext getContext() {
103103
ContextedRedisGraph contextedRedisGraph = new ContextedRedisGraph(getConnection());
104104
contextedRedisGraph.setRedisGraphCaches(this.caches);
105105
return contextedRedisGraph;

src/test/java/com/redislabs/redisgraph/RedisGraphAPITest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static com.redislabs.redisgraph.Header.ResultSetColumnTypes.*;
2424

2525
public class RedisGraphAPITest {
26-
private RedisGraphGeneralContext api;
26+
private RedisGraphContextGenerator api;
2727

2828
public RedisGraphAPITest() {
2929
}
@@ -504,7 +504,7 @@ public void testEscapedQuery() {
504504

505505
@Test
506506
public void testMultiExec(){
507-
RedisGraphTransaction transaction = api.getContextedAPI().multi();
507+
RedisGraphTransaction transaction = api.getContext().multi();
508508

509509
transaction.set("x", "1");
510510
transaction.query("social", "CREATE (:Person {name:'a'})");
@@ -651,7 +651,7 @@ public void testContextedAPI(){
651651
expectedEdge.addProperty(falseBooleanProperty);
652652
expectedEdge.addProperty(nullProperty);
653653

654-
RedisGraphContexted c = api.getContextedAPI();
654+
RedisGraphContext c = api.getContext();
655655

656656
Assert.assertNotNull(c.query("social", "CREATE (:person{name:%s',age:%d, doubleValue:%f, boolValue:%b, nullValue:null})", name, age, doubleValue, boolValue));
657657
Assert.assertNotNull(c.query("social", "CREATE (:person{name:'amit',age:30})"));
@@ -719,8 +719,8 @@ public void testContextedAPI(){
719719
@Test
720720
public void testWriteTransactionWatch(){
721721

722-
RedisGraphContexted c1 = api.getContextedAPI();
723-
RedisGraphContexted c2 = api.getContextedAPI();
722+
RedisGraphContext c1 = api.getContext();
723+
RedisGraphContext c2 = api.getContext();
724724

725725
c1.watch("social");
726726
RedisGraphTransaction t1 = c1.multi();
@@ -747,8 +747,8 @@ public void testWriteTransactionWatch(){
747747
@Test
748748
public void testReadTransactionWatch(){
749749

750-
RedisGraphContexted c1 = api.getContextedAPI();
751-
RedisGraphContexted c2 = api.getContextedAPI();
750+
RedisGraphContext c1 = api.getContext();
751+
RedisGraphContext c2 = api.getContext();
752752
Assert.assertNotEquals(c1.getConnectionContext(), c2.getConnectionContext());
753753
c1.query("social", "CREATE (:Person {name:'a'})");
754754
c1.watch("social");

0 commit comments

Comments
 (0)