修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Blaze (v4)

Standalone

Please complete this required field.

Please complete this required field.

Please complete this required field.

Please complete this required field.

如果不需要 HDC 服务,则此项留空。

Please complete this required field.

如果不需要 HDC 服务,则此项留空。

Please complete this required field.

Please complete this required field.

所有服务器的MAC地址,由换行符或逗号分隔。

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
Shard 服务最大数量
Shard 服务最大总核数
HDC 服务最大数量
HDC 服务最大总核数
申请天数
审批日期
过期日期
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

v5.0
搜索
    v5.0

      HDC图查询

      概述

      使用以下语法在HDC图上执行图查询:

      exec{
        <query>
      } on <hdcGraphName>
      

      HDC图支持更高效率地从数据库查询数据。但请留意,HDC图不支持修改图结构以及插入、更新、删除数据等操作。

      示例图集

      在一个空图中运行以下语句定义图结构并插入数据:

      create().node_schema("entity").edge_schema("link");
      create().edge_property(@link, "weight", float);
      insert().into(@entity).nodes([{_id:"A"},{_id:"B"},{_id:"C"},{_id:"D"}]);
      insert().into(@link).edges([{_from:"A", _to:"B", weight:1},{_from:"A", _to:"C", weight:1.5},{_from:"A", _to:"D", weight:0.5},{_from:"B", _to:"C", weight:2},{_from:"C", _to:"D", weight:0.5}]);
      

      HDC图查询

      为全图创建名为hdcGraph的HDC图:

      hdc.graph.create("hdcGraph", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      hdcGraph上执行查询:

      exec{
        n({_id == "A"}).e()[2].n({_id == "C"}) as p
        return p{*}
      } on hdcGraph
      

      结果:p

      限制图遍历方向

      在创建HDC图时,若direction选项设定为inout,图遍历会被限制只能沿入边或出边进行。若在查询中从缺失的方向进行遍历,会引发报错或生成空结果。

      创建HDC图hdcGraph_in_edges,其中包含所有点和入边:

      hdc.graph.create("hdcGraph_in_edges", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "in",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      以下查询试图在hdcGraph_in_edges上遍历点A的出边,没有结果返回:

      exec{
        n({_id == "A"}).re().n() as p
        return p{*}
      } on hdcGraph_in_edges
      

      HDC图不包含点ID

      在创建HDC图时,若load_id选项设定为false,则HDC图不包含点的_id值。若在查询中引用了_id,则会引发报错或生成空结果。

      创建HDC图hdcGraph_no_id,其中不包含点的_id值:

      hdc.graph.create("hdcGraph_no_id", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: false,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      以下查询使用_id过滤hdcGraph_no_id中的点,由于该HDC图不包含点的_id,执行报错:

      exec{
        n({_id == "A"}).e()[2].n({_id == "C"}) as p
        return p{*}
      } on hdcGraph_no_id
      

      HDC图不包含属性

      如果创建HDC图时未包含某些属性,查询引用这些属性时会引发报错或生成空结果。

      创建HDC图hdcGraph_no_weight,其中包含所有点属性,但只包含link边的系统属性:

      hdc.graph.create("hdcGraph_no_weight", {
        nodes: {"*": ["*"]},
        edges: {"link": []},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      以下查询在hdcGraph_no_weight上查找加权最短路径,以边属性@link.weight计算权重。由于weight属性缺失,执行报错:

      exec{
        ab().src({_id == "A"}).dest({_id == "C"}).depth(2).shortest(@link.weight) as p
        return p
      } on hdcGraph_no_weight
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写