ch.hsr.bieridee.utils
Class Cypher

java.lang.Object
  extended by ch.hsr.bieridee.utils.Cypher

public final class Cypher
extends java.lang.Object

Class containing all the cipher queries.


Method Summary
static double executeAndGetDouble(java.lang.String query, java.lang.String valueName)
          Returns the double value returned by the given cypher-query.
static double executeAndGetDouble(java.lang.String query, java.lang.String valueName, java.lang.String... params)
           
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column)
          Returns the nodes found by the given cypher-query as a list.
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column, int limit)
           
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column, int limit, int skipCount)
           
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column, int limit, int skipCount, java.lang.String... params)
           
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column, int limit, java.lang.String... params)
           
static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query, java.lang.String column, java.lang.String... params)
          Returns the nodes found by the given cypher-query as a list.
static org.neo4j.graphdb.Node executeAndGetSingleNode(java.lang.String query, java.lang.String column)
          Returns a single node found by the given cypher-query.
static org.neo4j.graphdb.Node executeAndGetSingleNode(java.lang.String query, java.lang.String column, java.lang.String... params)
          Returns a single node found by the given cypher-query.
static java.util.List<java.lang.String> executeAndGetStrings(java.lang.String query, java.lang.String columnName)
          Returns a list of strings as result of the given query.
static void setDB(org.neo4j.kernel.EmbeddedGraphDatabase db)
          Sets the database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column)
Returns the nodes found by the given cypher-query as a list.

Parameters:
query - The Cypher query.
column - Column name containing the Nodes that will be returned.
Returns:
A List containing the nodes returned by the query.

setDB

public static void setDB(org.neo4j.kernel.EmbeddedGraphDatabase db)
Sets the database.

Parameters:
db - The database.

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column,
                                                                        java.lang.String... params)
Returns the nodes found by the given cypher-query as a list.

Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned.
params - These parameters will be used as replacements for the occurences of the literal '$$' in the cypher query (in the given order). First $$ would be replaced by the first params value, second $$ by the params' second and so on.
Returns:
A List containing the nodes returned by the query.

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column,
                                                                        int limit,
                                                                        java.lang.String... params)
Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned
limit - Max. number of Nodes returned.
params - These parameters will be used as replacements for the occurences of the literal '$$' in the cypher query (in the given order). First $$ would be replaced by the first params value, second $$ by the params' second and so on.
Returns:
A List containing the nodes returned by the query.

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column,
                                                                        int limit,
                                                                        int skipCount,
                                                                        java.lang.String... params)
Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned
limit - Max. number of Nodes returned.
params - These parameters will be used as replacements for the occurences of the literal '$$' in the cypher query (in the given order). First $$ would be replaced by the first params value, second $$ by the params' second and so on.
skipCount - Number of Elements to be skipped for paging.
Returns:
A List containing the nodes returned by the query.

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column,
                                                                        int limit)
Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned.
limit - number of Nodes returned.
Returns:
A List containg the nodes returned by the query.

executeAndGetNodes

public static java.util.List<org.neo4j.graphdb.Node> executeAndGetNodes(java.lang.String query,
                                                                        java.lang.String column,
                                                                        int limit,
                                                                        int skipCount)
Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned.
limit - number of Nodes returned.
skipCount - Number of elements to be skipped for paging.
Returns:
A List containg the nodes returned by the query.

executeAndGetSingleNode

public static org.neo4j.graphdb.Node executeAndGetSingleNode(java.lang.String query,
                                                             java.lang.String column)
Returns a single node found by the given cypher-query.

Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned.
Returns:
The desired node or null if none found

executeAndGetSingleNode

public static org.neo4j.graphdb.Node executeAndGetSingleNode(java.lang.String query,
                                                             java.lang.String column,
                                                             java.lang.String... params)
Returns a single node found by the given cypher-query.

Parameters:
query - The cypher query
column - Column name containing the Nodes that will be returned.
params - These parameters will be used as replacements for the occurences of the literal '$$' in the cypher query (in the given order). First $$ would be replaced by the first params value, second $$ by the params' second and so on.
Returns:
The desired node

executeAndGetDouble

public static double executeAndGetDouble(java.lang.String query,
                                         java.lang.String valueName)
Returns the double value returned by the given cypher-query.

Parameters:
query - The cypher query to be executed
valueName - Name of the value in the query
Returns:
The calculated value

executeAndGetDouble

public static double executeAndGetDouble(java.lang.String query,
                                         java.lang.String valueName,
                                         java.lang.String... params)
Parameters:
query - The cypher query to be executed
valueName - Name of the value in the query
params - Parameters to be replaced in the query (in the given order)
Returns:
Double value.

executeAndGetStrings

public static java.util.List<java.lang.String> executeAndGetStrings(java.lang.String query,
                                                                    java.lang.String columnName)
Returns a list of strings as result of the given query.

Parameters:
query - he cypher query to be executed
columnName - The column name to be returned
Returns:
List of strings