RNeo4j: Neo4j Driver for R
Neo4jドライバー
- CRAN: http://cran.r-project.org/web/packages/RNeo4j/index.html
- GitHub: http://github.com/nicolewhite/RNeo4j
> library(RNeo4j)
バージョン: 1.6.4
関数名 | 概略 |
---|---|
RNeo4j |
Neo4j Driver for R |
addConstraint |
Uniqueness Constraints |
addIndex |
Indexes |
addLabel |
Node Labels |
allDijkstra |
Weighted Shortest Paths |
allShortestPaths |
Shortest Paths and Weighted Shortest Paths |
appendCypher |
Transactions |
browse |
Neo4j Browser |
clear |
Clear the Database |
createNode |
Nodes |
createRel |
Relationships |
cypher |
Cypher Queries to Data Frames |
cypherToList |
Cypher Queries to Lists |
delete |
Delete Nodes and Relationships |
deleteProp |
Delete Node and Relationship Properties |
dijkstra |
Weighted Shortest Paths |
dropConstraint |
Uniqueness Constraints |
dropIndex |
Indexes |
dropLabel |
Node Labels |
endNode |
Retrieve Nodes from Relationships or Paths |
getConstraint |
Uniqueness Constraints |
getID |
Internal IDs |
getIndex |
Indexes |
getLabel |
Node Labels |
getLabeledNodes |
Retrieve Nodes by Label and Property |
getNodes |
Retrieve Nodes with Cypher Queries |
getOrCreateNode |
Create Unique Node or Retrieve Unique Node |
getPaths |
Retrieve Paths with Cypher Queries |
getRels |
Retrieve Relationships with Cypher Queries |
getSingleNode |
Retrieve Nodes with Cypher Queries |
getSinglePath |
Retrieve Paths with Cypher Queries |
getSingleRel |
Retrieve Relationships with Cypher Queries |
getType |
Relationship Types |
getUniqueNode |
Retrieve Nodes by Label and Property |
importSample |
Import Sample Datasets |
incomingRels |
Retrieve Relationships from Nodes |
nodes |
Retrieve Nodes from Paths |
outgoingRels |
Retrieve Relationships from Nodes |
rels |
Retrieve Relationships from Paths |
shortestPath |
Shortest Paths and Weighted Shortest Paths |
startGraph |
Connect to the Database |
startNode |
Retrieve Nodes from Relationships or Paths |
updateProp |
Update Node and Relationship Properties |
addIndex
browse
ブラウズ
> browse(graph)
clear
データベース情報の削除。すべてのノードや関係などを消去する
> graph = startGraph("http://localhost:7474/db/data/", username = "neo4j", password = "<PW>")
> clear(graph)
createNode
ラベルと属性を含んだノードを作成する
> n.hoxo_m <- createNode(graph, "Member", name = "hoxo_m", role = "Qiita")
> n.r_linux <- createNode(graph, "Member", name = "R_Linux", role = "総務")
> n.u_ribo <- createNode(graph, "Member", name = "u_ribo", role = "清掃屋")
> n.teramonagi <- createNode(graph, "Member", list(name = "teramonagi", role = "タワーマンション在住希望"))
> n.zashiki <- createNode(graph, "Member", list(name = "_zashiki"))
> n.aich_08_ <- createNode(graph, "Member", list(name = "aich_08_", role = "ピンク"))
createRel
> r1 <- createRel(n.hoxo_m, "FOLLOW", n.r_linux, binary = 1)
cypher
> query = " MATCH n RETURN n.name, n.role"
> (f <- cypher(graph, query))
cypherToList
クエリーの実行結果をリストとして返す
> cypherToList(graph, "MATCH n RETURN n.name, n.role")
delete
> # createNode(), createRel()で作成したオブジェクトを削除する
> delete(n.u_ribo)
deleteProp
> deleteProp(n.hoxo_m, all = TRUE)
getID
> getID(n.hoxo_m)
Error in getID(n.hoxo_m): object 'n.hoxo_m' not found
> getID(n.u_ribo)
Error in getID(n.u_ribo): object 'n.u_ribo' not found
importSample
サンプルのデータベースをインポートする
Arguments
- graph
- data...
tweets
,dfw
,caltrain
,movies
- input
> importSample(graph, "movies", input = FALSE)
startGraph
データベースへの接続
Arguments
- url
- username
- password
- opts
> # neo4jを起動している状態で
> graph <- startGraph("http://localhost:7474/db/data/", username = "<username>", password = "<password>")
updateProp
既存のノード情報・関係を更新する
> alice <- createNode(graph, "Person", name = "Alice")
> alice <- updateProp(alice, age = 24, eyes = "green")