Constructor
new Graph(graphId, hostopt, portopt, optionsopt)
Creates a client to a specific graph running on the specific host/post
See: node_redis for more options on createClient
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
graphId |
string | the graph id | |
host |
string | RedisClient |
<optional> |
Redis host or node_redis client or ioredis client |
port |
string | number |
<optional> |
Redis port (integer) |
options |
Object |
<optional> |
node_redis options |
Methods
_extractStrings(resultSet) → {Array.<string>}
Auxiliary function to extract string(s) data from procedures such as:
db.labels, db.propertyKeys and db.relationshipTypes
Parameters:
Name | Type | Description |
---|---|---|
resultSet |
ResultSet | a procedure result set |
Returns:
strings array.
- Type
- Array.<string>
buildParamsHeader(params) → {string}
Extracts parameters from dictionary into cypher parameters string.
Parameters:
Name | Type | Description |
---|---|---|
params |
Map | parameters dictionary. |
Returns:
a cypher parameters string.
- Type
- string
callProcedure(procedure, argsopt, yopt) → {Promise.<ResultSet>}
Calls procedure
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
procedure |
string | Procedure to call | |
args |
Array.<string> |
<optional> |
Arguments to pass |
y |
Array.<string> |
<optional> |
Yield outputs |
Returns:
a promise contains the procedure result set data
- Type
- Promise.<ResultSet>
close()
Closes the client.
(async) deleteGraph() → {Promise.<ResultSet>}
Deletes the entire graph
Returns:
a promise contains the delete operation running time statistics
- Type
- Promise.<ResultSet>
(async) fetchAndGetLabel(id) → {Promise.<string>}
Retrieve all the labels from the graph and returns the wanted label
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of label. (integer) |
Returns:
String label.
- Type
- Promise.<string>
(async) fetchAndGetProperty(id) → {Promise.<string>}
Retrieves al the properties from the graph, and returns the wanted property
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of property. (integer) |
Returns:
String property.
- Type
- Promise.<string>
(async) fetchAndGetRelationship(id) → {Promise.<string>}
Retrieves al the relationships types from the graph, and returns the wanted type
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of relationship type. (integer) |
Returns:
String relationship type.
- Type
- Promise.<string>
getLabel(id) → {string}
Retrieves label by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of label. (integer) |
Returns:
String label.
- Type
- string
getProperty(id) → {string}
Retrieves property name by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of property. (integer) |
Returns:
String property.
- Type
- string
getRelationship(id) → {string}
Retrieves relationship type by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | internal ID of relationship type. (integer) |
Returns:
relationship type.
- Type
- string
(async) labels()
Retrieves all labels in graph.
paramToString(paramValue) → {string}
Transforms a parameter value to string.
Parameters:
Name | Type | Description |
---|---|---|
paramValue |
* |
Returns:
the string representation of paramValue.
- Type
- string
(async) propertyKeys()
Retrieves all properties in graph.
(async) query(query, paramsopt) → {Promise.<ResultSet>}
Execute a Cypher query
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
string | Cypher query | |
params |
Map |
<optional> |
Parameters map |
Returns:
a promise contains a result set
- Type
- Promise.<ResultSet>
(async) readonlyQuery(query, paramsopt) → {Promise.<ResultSet>}
Execute a Cypher readonly query
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
string | Cypher query | |
params |
Map |
<optional> |
Parameters map |
Returns:
a promise contains a result set
- Type
- Promise.<ResultSet>
(async) relationshipTypes()
Retrieves all relationship types in graph.