R/getID.R

Defines functions getID getID.entity

Documented in getID

#' Internal IDs
#' 
#' Retrieve the internal ID of a node or relationship object.
#' 
#' @param entity A node or relationship object.
#' 
#' @return An integer.
#' 
#' @examples
#' \dontrun{
#' graph = startGraph("http://localhost:7474/db/data/")
#' clear(graph)
#' 
#' alice = createNode(graph, "Person", name = "Alice")
#' getID(alice)
#' }
#' 
#' @export
getID = function(entity) UseMethod("getID")

#' @export
getID.entity = function(entity) {
  id = as.numeric(unlist(strsplit(unlist(strsplit(attr(entity, "self"), "db/data/"))[2], "/"))[2])
  return(id)
}

Try the RNeo4j package in your browser

Any scripts or data that you put into this service are public.

RNeo4j documentation built on May 29, 2017, 4:01 p.m.