## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE ) ## ----install-cran------------------------------------------------------------- # install.packages("AstraeaDB") ## ----install-github----------------------------------------------------------- # # install.packages("remotes") # remotes::install_github("AstraeaDB/R-AstraeaDB") ## ----install-arrow------------------------------------------------------------ # install.packages("arrow") ## ----check-server------------------------------------------------------------- # library(AstraeaDB) # astraea_server_available() # #> [1] TRUE ## ----quickstart--------------------------------------------------------------- # library(AstraeaDB) # # # 1. Connect to the server (convenience wrapper) # client <- astraea_connect() # # # 2. Health check # client$ping() # # # 3. Create nodes # alice_id <- client$create_node( # labels = c("Person"), # properties = list(name = "Alice", age = 30, city = "San Francisco") # ) # # bob_id <- client$create_node( # labels = c("Person"), # properties = list(name = "Bob", age = 25, city = "New York") # ) # # # 4. Create an edge # edge_id <- client$create_edge( # source = alice_id, # target = bob_id, # edge_type = "KNOWS", # properties = list(since = 2020), # weight = 0.9 # ) # # # 5. Read a node back # node <- client$get_node(alice_id) # node$labels # #> [1] "Person" # node$properties$name # #> [1] "Alice" # # # 6. Find neighbors # neighbors <- client$neighbors(alice_id, direction = "outgoing") # # # 7. Run a GQL query # result <- client$query("MATCH (p:Person) RETURN p.name, p.city") # # # 8. Disconnect when finished # client$disconnect()