cypher: Cypher Queries to Data Frames

Description Usage Arguments Details Value See Also Examples

View source: R/cypher.R

Description

Retrieve Cypher query results as a data frame.

Usage

1
cypher(graph, query, ...)

Arguments

graph

A graph object.

query

A character string.

...

A named list. Parameters to pass to the query in the form key = value, if applicable.

Details

If returning data, you can only query for tabular results. That is, you can't return node or relationship entities. See cypherToList for returning non-tabular data.

Value

A data.frame.

See Also

cypherToList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
graph = startGraph("http://localhost:7474/db/data/")
clear(graph)

alice = createNode(graph, "Person", name = "Alice", age = 23)
bob = createNode(graph, "Person", name = "Bob", age = 22)
charles = createNode(graph, "Person", name = "Charles", age = 25)
david = createNode(graph, "Person", name = "David", age = 20)

createRel(alice, "KNOWS", bob)
createRel(alice, "KNOWS", charles)
createRel(charles, "KNOWS", david)

cypher(graph, "MATCH n RETURN n.name, n.age")

query = "MATCH n WHERE n.age < {age} RETURN n.name, n.age"
cypher(graph, query, age = 24)

query = "MATCH n WHERE n.name IN {names} RETURN n.name, n.age"
names = c("Alice", "Charles")
cypher(graph, query, names = names)

query = "MATCH n WHERE n.age > {age1} AND n.age < {age2} RETURN n.name"
cypher(graph, query, age1=22, age2=30)

params = list(age1=22, age2=30)
cypher(graph, query, params)

## End(Not run)


RNeo4j documentation built on May 19, 2017, 1:50 p.m.
Search within the RNeo4j package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.