修改密码

请输入密码
请输入密码 请输入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

搜索

      插入覆盖

      概述

      插入覆盖子句insert().overwrite().into()覆盖一个schema中已有的点、边,或插入新的点、边。

      语法

      // 插入或覆盖点
      insert().overwrite().into(@<schema>).nodes([
        {<property1>: <value1>, <property2>: <value2>, ...},
        {<property1>: <value1>, <property2>: <value2>, ...}
      ])
      
      // 插入或覆盖边
      insert().overwrite().into(@<schema>).edges([
        {<property1>: <value1>, <property2>: <value2>, ...},
        {<property1>: <value1>, <property2>: <value2>, ...}
      ])
      
      • into()方法中指定一个schema。
      • nodes()edges()方法中添加一个或多个点或边。
        • { }里填写点、边属性键值对。
        • 如果只插入覆盖一个点或一条边,可以省略外层中括号[ ]
      • 支持定义子句别名,数据类型为NODE或EDGE。

      当一个点或一条边被覆盖时:

      • 使用_id和/或_uuid指定要覆盖的点;使用_uuid_from_to(或_from_uuid_to_uuid)指定要覆盖的边。
      • 指定的自定义属性值被覆盖;未指定的自定义属性被赋值为null
      • 系统属性(_id_uuid_from_to_from_uuid_to_uuid)的值保持不变。

      如果指定的_id_uuid在当前图集中不存在,或未指定_id_uuid,则插入新的点。

      如果指定的_uuid在当前图集中不存在,或未指定_uuid,则插入新的边。

      示例图集

      在一个空图集中,逐行运行以下赢图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"}])
      

      示例

      插入覆盖点

      insert().overwrite().into(@user).nodes([
        {_id: "U001", name: "John"},
        {_id: "U005", name: "Alice"},
        {age: 12}
      ]) as n
      return n{*}
      
      • 第一个点指定_id为U001,在当前图集中已存在,因此覆盖原数据。
      • 第二个点指定_id为U005,在当前图集中不存在,因此作为新数据插入。
      • 第三个点未指定_id_uuid,因此作为新数据插入。

      结果:

      _id
      _uuid name age
      U001 1 John null
      U005 5 Alice null
      ULTIPA8000000000000006 6 null 12

      插入覆盖边

      insert().overwrite().into(@follow).edges([
        {_uuid: 1, _from: "U004", _to: "U001"},
        {_uuid: 4, _from: "U002", _to: "U003"},
        {_from: "U002", _to: "U001", time: "2023-9-6"}
      ]) as e
      return e{*}
      
      • 第一条边指定_uuid为1、_from为U004、_to为U001,在当前图集中已存在,因此覆盖原数据。
      • 第二条边指定_uuid为4,在当前图集中不存在,因此作为新数据插入。
      • 第三条边未指定_uuid,因此作为新数据插入。

      结果:

      _uuid _from _to
      _from_uuid
      _to_uuid
      time
      1 U004 U001 4 1 null
      4 U002 U003 2 3 null
      5 U002 U001 2 1 2023-09-06 00:00:00

      常见失败原因

      • 指定的点、边数据与指定的schema不匹配。
      • 同时指定点的_id_uuid时,其中一个值在图集中存在,而另一个值不存在。
      • 同时指定点的_id_uuid时,虽然它们都在图集中存在,但是二者不匹配。
      • 未指定边的起点或终点。
      • 指定的边起点或终点在图集中不存在。
      • 指定边的_uuid在图集中存在,但指定的边起点或终点不正确。
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写