修改密码

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

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
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

搜索

      更新

      概述

      update()子句更新图集中符合过滤条件的点、边的属性值(除_id_uuid外)。

      语法

      // 更新点
      update().nodes(<filter>)
        .set({<property1>: <value1>, <property2>: <value2> ...})
        .limit(<N>)
      
      // 更新边
      update().edges(<filter>)
        .set({<property1>: <value1>, <property2>: <value2> ...})
        .limit(<N>)
      
      • 符合nodes()edges()方法中指定条件的点或边会被更新。过滤条件为空时,更新全部点、边。
      • set()方法里指定新的属性值。
      • limit()方法(可选)中限制执行更新的数据量。
      • 支持定义子句别名,数据类型为NODE或EDGE。

      示例图集

      在一个空图集中,逐行运行以下赢图GQL语句,创建示例图集:

      create().node_schema("user").edge_schema("follow")
      create().node_property(@user, "name").node_property(@user, "age", int32).edge_property(@follow, "time", datetime)
      insert().into(@user).nodes([{_id:"U001", _uuid:1, name:"Jason", age:30}, {_id:"U002", _uuid:2, name:"Tim"}, {_id:"U003", _uuid:3, name:"Grace", age:25}, {_id:"U004", _uuid:4, name:"Ted", age:26}])
      insert().into(@follow).edges([{_uuid:1, _from_uuid:4, _to_uuid:1, time:"2021-9-10"}, {_uuid:2, _from_uuid:3, _to_uuid:2, time:"2020-3-12"}, {_uuid:3, _from_uuid:4, _to_uuid:2, time:"2023-7-30"}])
      

      示例

      更新点

      update().nodes({name == "Tim"}).set({name: "Tom"})
      

      本例更新name属性值为Tim的点,即_id为U002的点。

      更新边

      update().edges({time > "2021-5-1"}).set({time: dateAdd(time, 1, "day")}) as edges
      return edges{*}
      

      本例更新time属性值晚于2021-5-1的边,将其time属性值增加一天。

      结果:

      _uuid _from _to
      _from_uuid
      _to_uuid
      time
      1 U004 U001 4 1 2021-09-11 00:00:00
      3 U004 U002 4 2 2023-07-31 00:00:00

      更新所有点/边

      update().nodes().set({age: age + 1}) as n
      return table(n.name, n.age)
      

      结果:

      name age
      Jason 31
      Tom null
      Grace 26
      Ted 27

      限制更新数量

      update().nodes({@user}).set({name: lower(name)}).limit(2) as nodes
      return nodes{*}
      

      本例将@user点的name属性值改为小写,且仅更新最先找到的两个点。

      结果:

      _id _uuid name age
      U001 1 jason 31
      U002 2 tom null

      常见失败原因

      • set()方法中指定_uuid_id的值,导致更新失败,因为唯一标识符属性值不可更新。
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写