GIE 支持 Cypher 查询语言

我们已经实现了Neo4j的Bolt协议,方便您将Neo4j应用程序连接到GIE的前端服务。

第一步是获取Bolt连接器的Cypher端点

  • 按照说明在K8s集群中部署GIE

  • 按照说明在本地机器上启动GIE。

通过Python驱动连接

GIE 让使用 Neo4j 的 [Python Driver]](https://pypi.org/project/neo4j/) 连接已加载的图变得简单。

首先安装依赖项:

pip3 install neo4j

然后连接到服务并运行查询:

from neo4j import GraphDatabase, RoutingControl

URI = "neo4j://localhost:7687"  # neo4j:// + Cypher endpoint you've obtained
AUTH = ("", "")  # We have not implemented authentication yet

def print_top_10(driver):
    records, _, _ = driver.execute_query(
        "MATCH (n) RETURN n Limit 10",
        routing_=RoutingControl.READ,
    )
    for record in records:
        print(record["n"])


with GraphDatabase.driver(URI, auth=AUTH) as driver:
    print_top_10(driver)

提示

更简单的选择是通过GraphScope的python SDK使用interactive对象提交Cypher查询,这是一个封装了Neo4j Python驱动程序的包装器,会自动获取端点。

通过Cypher-Shell连接

  1. 下载并解压 cypher-shell

    wget https://dist.neo4j.org/cypher-shell/cypher-shell-4.4.19.zip
    unzip cypher-shell-4.4.19.zip && cd cypher-shell
    
  2. 连接到您已获取的Cypher端点的Bolt连接器

    ./cypher-shell -a neo4j://localhost:7687
    
  3. 运行查询

    @neo4j> Match (n) Return n Limit 10;