Class GraphDb


  • public class GraphDb
    extends Object
    图服务入口
    Version:
    3.3.0
    • Constructor Detail

      • GraphDb

        public GraphDb()
    • Method Detail

      • driver

        public static Graph driver​(String uri,
                                   String graphName,
                                   String token)
        连接到图服务
        Parameters:
        uri - 链接地址
        graphName - 图名称
        token - 用户登录获得的token
        Returns:
        Graph
      • driver

        public static Graph driver​(String uri,
                                   String graphName,
                                   String username,
                                   String password)
        连接到图服务
        Parameters:
        uri - 链接地址
        graphName - 图名称
        username - 用户名
        password - 密码
        Returns:
        Graph
      • connect

        public static com.graphdbapi.driver.v1.Driver connect​(String uri,
                                                              String username,
                                                              String password)
        连接到数据库
        Parameters:
        uri - 链接地址
        username - 用户名
        password - 密码
        Returns:
        Graph
      • driverByRoutingTable

        public static com.graphdbapi.driver.v1.Driver driverByRoutingTable​(Set<String> uris,
                                                                           String username,
                                                                           String password)
        根据指定路由表获取路由driver(不允许使用AutoPartitionLoadBalancingStrategy策略)
        Parameters:
        uris - 链接地址集合(格式:127.0.0.1:7687)
        username - 用户名
        password - 密码
        Returns:
        Graph
      • connectCluster

        public static com.graphdbapi.driver.v1.Driver connectCluster​(Set<String> uris,
                                                                     String username,
                                                                     String password)
                                                              throws UnknownHostException
        多IP连接路由driver
        Parameters:
        uris - 连接的ip地址集合
        username - 用户名
        password - 密码
        Returns:
        Driver
        Throws:
        UnknownHostException
      • connectCluster

        public static com.graphdbapi.driver.v1.Driver connectCluster​(String uris,
                                                                     String username,
                                                                     String password)
                                                              throws UnknownHostException
        多IP连接路由driver
        Parameters:
        uris - 多IP的uri字符串(例:"cluster://192.168.10.125:7687,192.168.10.126:7687")
        username - 用户名
        password - 密码
        Returns:
        Driver
        Throws:
        UnknownHostException
      • driver

        public static Graph driver​(URI uri,
                                   String graphName,
                                   String username,
                                   String password)
        连接到图服务
        Parameters:
        uri - 链接地址
        graphName - 图名称
        username - 用户名
        password - 密码
        Returns:
        Graph
      • driver

        public static Graph driver​(com.graphdbapi.driver.v1.Driver driver,
                                   String graphName)
        连接到图服务
        Parameters:
        driver - 链接
        graphName - 图名称
        Returns:
        Graph
      • driverByName

        public static Graph driverByName​(com.graphdbapi.driver.v1.Driver driver,
                                         String graphName)
        通过图名字获取图服务。通过服务端进行验证。
        Parameters:
        driver - 链接
        graphName - 图名字
        Returns:
        Graph
      • driverByName

        public static Graph driverByName​(com.graphdbapi.driver.v1.Driver driver,
                                         String graphName,
                                         LoadBalancingStrategy graphStrategy)
        通过图名字、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。
        Parameters:
        driver - 链接(使用的时候保证为routingDriver)
        graphName - 图名字
        graphStrategy - 图级别策略
        Returns:
        Graph
      • driverByIndex

        public static Graph driverByIndex​(com.graphdbapi.driver.v1.Driver driver,
                                          int graphIndex)
        通过图index获取图服务。通过服务端进行验证。
        Parameters:
        driver - 链接
        graphIndex - 图index
        Returns:
        Graph
      • driverByIndex

        public static Graph driverByIndex​(com.graphdbapi.driver.v1.Driver driver,
                                          int graphIndex,
                                          LoadBalancingStrategy graphStrategy)
        通过图index、自定义策略获取图服务(创建driver时应该使用的是cluster协议)。通过服务端进行验证。
        Parameters:
        driver - 链接(使用的时候保证为routingDriver)
        graphIndex - 图index
        graphStrategy - 图级别策略
        Returns:
        Graph
      • driver

        public static Graph driver​(com.graphdbapi.driver.v1.Driver driver,
                                   String graphName,
                                   LoadBalancingStrategy graphStrategy)
                            throws NoSuchFieldException
        通过自定义策略实现不同的负载均衡分发的图(创建driver时应该使用的是cluster协议)
        Parameters:
        driver - 链接(使用的时候保证为routingDriver)
        graphName - 图名称
        graphStrategy - 自定义策略
        Returns:
        Graph
        Throws:
        NoSuchFieldException - 使用协议不正确时抛出
      • newGraph

        public static Graph newGraph​(com.graphdbapi.driver.v1.Driver driver,
                                     String graphName,
                                     String groupName)
        新建一个图
        Parameters:
        driver - 链接
        graphName - 图名称
        groupName - 组名称
        Returns:
        Graph
      • graphs

        public static Collection<String> graphs​(com.graphdbapi.driver.v1.Driver driver)
        获取图名字
        Parameters:
        driver - 连接
        Returns:
        图名称列表
      • getDriverVersion

        public static String getDriverVersion()
        获取driver版本
        Returns:
        driver版本
      • metrics

        public static List<MetricInfo> metrics​(com.graphdbapi.driver.v1.Driver driver)
        获取节点的metric信息
        Parameters:
        driver - 连接
        Returns:
        图名称列表