修改密码

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

搜索
    中文

      WITH 传递

      格式、参数

      WITH 可以对数据流进行函数运算,并传递给后面的语句。输入中有非同源列时,对非同源列所在的数据流进行笛卡尔乘积组合。

      语法:

      • 格式:with <column1> as <alias1>, <column2> as <alias2>, ...
      • 参数:(见下表)
      • 受影响列:<column> 及其所有同源列
      名称 类型 规范 描述
      <column> NODE,EDGE,PATH,ATTR,ARRAY,TABLE / 传递值,多个传递值可以为同源列、非同源列
      <alias> string 同自定义别名的命名规范 传递值的别名,可省略

      使用 V4.0 版引擎时,别名需要经过 WITH 传递后才能被后面相隔较远的语句使用;V4.1 版中无需此操作。

      详解

      find().nodes() as n1 limit 2
      n(3).e()[2].n(as n2) as path
      with pnodes(path) as array, distinct(n2.color) as colors
      with n1, array
      return n1, array, colors
      

      上面 UQL 代码中的第一个 WITH 子句对 path 和 n2 两个同源列进行了函数运算和同步去重,第二个 WITH 子句将两个非同源列所在的数据流进行了笛卡尔乘积:

      WITH 子句中对某列去重时,其同源列也一同去重。

      传递一个列

      示例:找出级别最高的银行卡

      find().nodes({@card}) as n1
      with max(n1.level) as maxLevel
      find().nodes({@card.level == maxLevel}) as n2
      return n2{*}
      

      传递非同源列(笛卡尔积组合)

      示例:将数列 1、2、3 与数列 4、5 进行笛卡尔乘积,以表格形式返回

      uncollect [1,2,3] as a1
      uncollect [4,5] as a2
      with a1, a2
      return table(a1, a2)
      

      示例:找出拥有银行卡 CA001、CA002、CA003 的顾客,找出品类为 book 的商品,查找这些顾客对这些商品的购买、浏览路径

      khop().n({_id in ["CA001","CA002","CA003"]}).e({@has}).n({@customer}) as n1
      n({@prodCAT.name == "book"}).e().n({@product} as n2)
      with distinct(n1)
      with n1, n2
      n(n1).e({@buy || @view}).n(n2) as p
      return p{*}
      

      分析:查找多张银行卡的使用者时需注意去重;WITH 子句中进行 distinct() 去重运算时不能接收非同源列的传入;本例中 WITH 子句对 n1、n2 进行笛卡尔积的效果与组网查询中的互组网功能类似,本例等效于:

      khop().n({_id in ["CA001","CA002","CA003"]}).e({@has}).n({@customer}) as n1
      n({@prodCAT.name == "book"}).e().n({@product} as n2)
      with collect(distinct(n1)) as a1
      with a1, collect(n2) as a2
      autonet().src(a1).dest(a2).depth(1) as p
      return p{*}
      

      复杂语句 with 举例

      示例:分别找出向银行卡 CA021、CA022、CA029 转账的银行卡,找出这三组银行卡各自的级别最高的卡,将卡号合并为数组后与收款卡对应返回

      n({_id in ["CA021","CA022","CA029"]} as payee).le({@transfer}).n({@card} as payer) 
      with payee, payer
      group by payee
      with max(payer.level) as maxLevel
      n(payee).le({@transfer}).n({@card.level == maxLevel} as topPayer)
      group by payee
      return payee, collect(topPayer)
      

      分析:第一个 WITH 子句的作用是在 V4.0 版本中延长别名 payee、payer 在整个 UQL 语句中的声明周期,在 V4.1 版中该子句可以省略。

      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写