Skip to content

Commit 80440bc

Browse files
authored
Merge pull request #651 from technige/4.0-renames
4.0 renames
2 parents 2cd0301 + 5ebe0f9 commit 80440bc

File tree

182 files changed

+2056
-2052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+2056
-2052
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To run a simple query, the following can be used:
4949
```java
5050
Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "PasSW0rd"));
5151
try (Session session = driver.session()) {
52-
StatementResult rs = session.run("CREATE (n) RETURN n");
52+
Result result = session.run("CREATE (n) RETURN n");
5353
}
5454
driver.close();
5555
```

driver/src/main/java/org/neo4j/driver/Bookmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* the database is as up-to-date as the latest transaction referenced by the supplied bookmarks.
3030
*
3131
* Within a session, bookmark propagation is carried out automatically.
32-
* Thus all transactions in a session including explicit and implicit transactions are ensured to be carried out one after another.
32+
* Thus all transactions in a session (both managed and unmanaged) are guaranteed to be carried out one after another.
3333
*
3434
* To opt out of this mechanism for unrelated units of work, applications can use multiple sessions.
3535
*/

driver/src/main/java/org/neo4j/driver/Driver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public interface Driver extends AutoCloseable
167167
* This will return the type system supported by the driver.
168168
* The types supported on a particular server a session is connected against might not contain all of the types defined here.
169169
*
170-
* @return type system used by this statement runner for classifying values
170+
* @return type system used by this query runner for classifying values
171171
*/
172172
@Experimental
173173
TypeSystem defaultTypeSystem();

driver/src/main/java/org/neo4j/driver/Statement.java renamed to driver/src/main/java/org/neo4j/driver/Query.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,29 @@
3131
import static org.neo4j.driver.Values.value;
3232

3333
/**
34-
* An executable statement, i.e. the statements' text and its parameters.
34+
* The components of a Cypher query, containing the query text and parameter map.
3535
*
3636
* @see Session
3737
* @see Transaction
38-
* @see StatementResult
39-
* @see StatementResult#consume()
38+
* @see Result
39+
* @see Result#consume()
4040
* @see ResultSummary
4141
* @since 1.0
4242
*/
4343
@Immutable
44-
public class Statement
44+
public class Query
4545
{
4646
private final String text;
4747
private final Value parameters;
4848

4949
/**
50-
* Create a new statement.
51-
* @param text the statement text
52-
* @param parameters the statement parameters
50+
* Create a new query.
51+
* @param text the query text
52+
* @param parameters the parameter map
5353
*/
54-
public Statement( String text, Value parameters )
54+
public Query(String text, Value parameters )
5555
{
56-
this.text = validateQuery( text );
56+
this.text = validateQueryText( text );
5757
if( parameters == null )
5858
{
5959
this.parameters = Values.EmptyMap;
@@ -69,79 +69,79 @@ else if ( parameters instanceof MapValue )
6969
}
7070

7171
/**
72-
* Create a new statement.
73-
* @param text the statement text
74-
* @param parameters the statement parameters
72+
* Create a new query.
73+
* @param text the query text
74+
* @param parameters the parameter map
7575
*/
76-
public Statement( String text, Map<String, Object> parameters )
76+
public Query(String text, Map<String, Object> parameters )
7777
{
7878
this( text, Values.value( parameters ) );
7979
}
8080

8181
/**
82-
* Create a new statement.
83-
* @param text the statement text
82+
* Create a new query.
83+
* @param text the query text
8484
*/
85-
public Statement( String text )
85+
public Query(String text )
8686
{
8787
this( text, Values.EmptyMap );
8888
}
8989

9090
/**
91-
* @return the statement's text
91+
* @return the query text
9292
*/
9393
public String text()
9494
{
9595
return text;
9696
}
9797

9898
/**
99-
* @return the statement's parameters
99+
* @return the parameter map
100100
*/
101101
public Value parameters()
102102
{
103103
return parameters;
104104
}
105105

106106
/**
107-
* @param newText the new statement's text
108-
* @return a new statement with updated text
107+
* @param newText the new query text
108+
* @return a new Query object with updated text
109109
*/
110-
public Statement withText( String newText )
110+
public Query withText(String newText )
111111
{
112-
return new Statement( newText, parameters );
112+
return new Query( newText, parameters );
113113
}
114114

115115
/**
116-
* @param newParameters the new statement's parameters
117-
* @return a new statement with updated parameters
116+
* @param newParameters the new parameter map
117+
* @return a new Query object with updated parameters
118118
*/
119-
public Statement withParameters( Value newParameters )
119+
public Query withParameters(Value newParameters )
120120
{
121-
return new Statement( text, newParameters );
121+
return new Query( text, newParameters );
122122
}
123123

124124
/**
125-
* @param newParameters the new statement's parameters
126-
* @return a new statement with updated parameters
125+
* @param newParameters the new parameter map
126+
* @return a new Query object with updated parameters
127127
*/
128-
public Statement withParameters( Map<String, Object> newParameters )
128+
public Query withParameters(Map<String, Object> newParameters )
129129
{
130-
return new Statement( text, newParameters );
130+
return new Query( text, newParameters );
131131
}
132132

133133
/**
134-
* Create a new statement with new parameters derived by updating this'
135-
* statement's parameters using the given updates.
134+
* Create a new query with new parameters derived by updating this'
135+
* query's parameters using the given updates.
136136
*
137137
* Every update key that points to a null value will be removed from
138-
* the new statement's parameters. All other entries will just replace
139-
* any existing parameter in the new statement.
138+
* the new query's parameters. All other entries will just replace
139+
* any existing parameter in the new query.
140140
*
141141
* @param updates describing how to update the parameters
142-
* @return a new statement with updated parameters
142+
* @return a new query with updated parameters
143143
*/
144-
public Statement withUpdatedParameters( Value updates )
144+
public Query withUpdatedParameters(Value updates )
145145
{
146146
if ( updates == null || updates.isEmpty() )
147147
{
@@ -179,8 +179,8 @@ public boolean equals( Object o )
179179
return false;
180180
}
181181

182-
Statement statement = (Statement) o;
183-
return text.equals( statement.text ) && parameters.equals( statement.parameters );
182+
Query query = (Query) o;
183+
return text.equals( query.text ) && parameters.equals( query.parameters );
184184

185185
}
186186

@@ -195,13 +195,13 @@ public int hashCode()
195195
@Override
196196
public String toString()
197197
{
198-
return format( "Statement{text='%s', parameters=%s}", text, parameters );
198+
return format( "Query{text='%s', parameters=%s}", text, parameters );
199199
}
200200

201-
private static String validateQuery( String query )
201+
private static String validateQueryText(String query )
202202
{
203-
checkArgument( query != null, "Cypher query should not be null" );
204-
checkArgument( !query.isEmpty(), "Cypher query should not be an empty string" );
203+
checkArgument( query != null, "Cypher query text should not be null" );
204+
checkArgument( !query.isEmpty(), "Cypher query text should not be an empty string" );
205205
return query;
206206
}
207207
}

driver/src/main/java/org/neo4j/driver/StatementRunner.java renamed to driver/src/main/java/org/neo4j/driver/QueryRunner.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,28 @@
2121
import java.util.Map;
2222

2323
/**
24-
* Common interface for components that can execute Neo4j statements.
24+
* Common interface for components that can execute Neo4j queries.
2525
*
2626
* <h2>Important notes on semantics</h2>
2727
* <p>
28-
* Statements run in the same {@link StatementRunner} are guaranteed
29-
* to execute in order, meaning changes made by one statement will be seen
30-
* by all subsequent statements in the same {@link StatementRunner}.
28+
* queries run in the same {@link QueryRunner} are guaranteed
29+
* to execute in order, meaning changes made by one query will be seen
30+
* by all subsequent queries in the same {@link QueryRunner}.
3131
* <p>
3232
* However, to allow handling very large results, and to improve performance,
3333
* result streams are retrieved lazily from the network.
34-
* This means that when any of {@link #run(Statement)}
35-
* methods return a result, the statement has only started executing - it may not
34+
* This means that when any of {@link #run(Query)}
35+
* methods return a result, the query has only started executing - it may not
3636
* have completed yet. Most of the time, you will not notice this, because the
37-
* driver automatically waits for statements to complete at specific points to
37+
* driver automatically waits for queries to complete at specific points to
3838
* fulfill its contracts.
3939
* <p>
40-
* Specifically, the driver will ensure all outstanding statements are completed
40+
* Specifically, the driver will ensure all outstanding queries are completed
4141
* whenever you:
4242
*
4343
* <ul>
4444
* <li>Read from or discard a result, for instance via
45-
* {@link StatementResult#next()} or {@link StatementResult#consume()} </li>
45+
* {@link Result#next()} or {@link Result#consume()} </li>
4646
* <li>Explicitly commit/rollback a transaction using blocking {@link Transaction#close()} </li>
4747
* <li>Close a session using blocking {@link Session#close()}</li>
4848
* </ul>
@@ -59,13 +59,13 @@
5959
* @see Transaction
6060
* @since 1.0
6161
*/
62-
public interface StatementRunner
62+
public interface QueryRunner
6363
{
6464
/**
65-
* Run a statement and return a result stream.
65+
* Run a query and return a result stream.
6666
* <p>
6767
* This method takes a set of parameters that will be injected into the
68-
* statement by Neo4j. Using parameters is highly encouraged, it helps avoid
68+
* query by Neo4j. Using parameters is highly encouraged, it helps avoid
6969
* dangerous cypher injection attacks and improves database performance as
7070
* Neo4j can re-use query plans more often.
7171
* <p>
@@ -77,25 +77,25 @@ public interface StatementRunner
7777
* might be more helpful, it converts your map to a {@link Value} for you.
7878
*
7979
* <h2>Example</h2>
80-
* <pre class="doctest:StatementRunnerDocIT#parameterTest">
80+
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
8181
* {@code
8282
*
83-
* StatementResult cursor = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
83+
* Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
8484
* Values.parameters( "myNameParam", "Bob" ) );
8585
* }
8686
* </pre>
8787
*
88-
* @param statementTemplate text of a Neo4j statement
88+
* @param query text of a Neo4j query
8989
* @param parameters input parameters, should be a map Value, see {@link Values#parameters(Object...)}.
9090
* @return a stream of result values and associated metadata
9191
*/
92-
StatementResult run( String statementTemplate, Value parameters );
92+
Result run(String query, Value parameters );
9393

9494
/**
95-
* Run a statement and return a result stream.
95+
* Run a query and return a result stream.
9696
* <p>
9797
* This method takes a set of parameters that will be injected into the
98-
* statement by Neo4j. Using parameters is highly encouraged, it helps avoid
98+
* query by Neo4j. Using parameters is highly encouraged, it helps avoid
9999
* dangerous cypher injection attacks and improves database performance as
100100
* Neo4j can re-use query plans more often.
101101
* <p>
@@ -104,61 +104,61 @@ public interface StatementRunner
104104
* a list of allowed types.
105105
*
106106
* <h2>Example</h2>
107-
* <pre class="doctest:StatementRunnerDocIT#parameterTest">
107+
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
108108
* {@code
109109
*
110110
* Map<String, Object> parameters = new HashMap<String, Object>();
111111
* parameters.put("myNameParam", "Bob");
112112
*
113-
* StatementResult cursor = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
113+
* Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
114114
* parameters );
115115
* }
116116
* </pre>
117117
*
118-
* @param statementTemplate text of a Neo4j statement
119-
* @param statementParameters input data for the statement
118+
* @param query text of a Neo4j query
119+
* @param parameters input data for the query
120120
* @return a stream of result values and associated metadata
121121
*/
122-
StatementResult run( String statementTemplate, Map<String,Object> statementParameters );
122+
Result run(String query, Map<String,Object> parameters );
123123

124124
/**
125-
* Run a statement and return a result stream.
125+
* Run a query and return a result stream.
126126
* <p>
127127
* This method takes a set of parameters that will be injected into the
128-
* statement by Neo4j. Using parameters is highly encouraged, it helps avoid
128+
* query by Neo4j. Using parameters is highly encouraged, it helps avoid
129129
* dangerous cypher injection attacks and improves database performance as
130130
* Neo4j can re-use query plans more often.
131131
* <p>
132132
* This version of run takes a {@link Record} of parameters, which can be useful
133-
* if you want to use the output of one statement as input for another.
133+
* if you want to use the output of one query as input for another.
134134
*
135-
* @param statementTemplate text of a Neo4j statement
136-
* @param statementParameters input data for the statement
135+
* @param query text of a Neo4j query
136+
* @param parameters input data for the query
137137
* @return a stream of result values and associated metadata
138138
*/
139-
StatementResult run( String statementTemplate, Record statementParameters );
139+
Result run(String query, Record parameters );
140140

141141
/**
142-
* Run a statement and return a result stream.
142+
* Run a query and return a result stream.
143143
*
144-
* @param statementTemplate text of a Neo4j statement
144+
* @param query text of a Neo4j query
145145
* @return a stream of result values and associated metadata
146146
*/
147-
StatementResult run( String statementTemplate );
147+
Result run(String query );
148148

149149
/**
150-
* Run a statement and return a result stream.
150+
* Run a query and return a result stream.
151151
* <h2>Example</h2>
152-
* <pre class="doctest:StatementRunnerDocIT#statementObjectTest">
152+
* <pre class="doctest:QueryRunnerDocIT#queryObjectTest">
153153
* {@code
154154
*
155-
* Statement statement = new Statement( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
156-
* StatementResult cursor = session.run( statement.withParameters( Values.parameters( "myNameParam", "Bob" ) ) );
155+
* Query query = new Query( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
156+
* Result result = session.run( query.withParameters( Values.parameters( "myNameParam", "Bob" ) ) );
157157
* }
158158
* </pre>
159159
*
160-
* @param statement a Neo4j statement
160+
* @param query a Neo4j query
161161
* @return a stream of result values and associated metadata
162162
*/
163-
StatementResult run( Statement statement );
163+
Result run(Query query);
164164
}

driver/src/main/java/org/neo4j/driver/Record.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
/**
3333
* Container for Cypher result values.
3434
* <p>
35-
* Streams of records are returned from Cypher statement execution, contained
36-
* within a {@link StatementResult}.
35+
* Streams of records are returned from Cypher query execution, contained
36+
* within a {@link Result}.
3737
* <p>
3838
* A record is a form of ordered map and, as such, contained values can be
3939
* accessed by either positional {@link #get(int) index} or textual

driver/src/main/java/org/neo4j/driver/Records.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Static utility methods for retaining records
2525
*
26-
* @see StatementResult#list()
26+
* @see Result#list()
2727
* @since 1.0
2828
*/
2929
public abstract class Records

0 commit comments

Comments
 (0)