修改密码

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

v5.0
搜索
    v5.0

      CASE

      条件表达式CASE可用来判断单个或多个条件,并根据这些条件返回不同的结果。

      <case expression> ::= <simple case> | <searched case>
      

      GQL支持CASE表达式的两种形式:

      示例图集

      以下示例根据该图集运行:

      在空图集中运行以下语句创建示例图集:

      INSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6, author:'Alex', publisher:'PulsePress'}),
             (p2:Paper {_id:'P2', title:'Optimizing Queries', score:9, author:'Alex'}),
             (p3:Paper {_id:'P3', title:'Path Patterns', score:7, author:'Zack', publisher:'BrightLeaf'}),
             (p1)-[:Cites {weight:2}]->(p2),
             (p2)-[:Cites {weight:1}]->(p3)
      

      Simple CASE

      Simple CASE表达式用来判断单个值与多个条件是否匹配,并返回首个匹配的结果。

      <simple case> ::=
        "CASE" <case operand> 
          "WHEN" <when operand list> "THEN" <result>
          [ { "WHEN" <when operand list> "THEN" <result> }... ]
          [ "ELSE" <result> ]
        "END"
           
      <when operand list> ::= <when operand> [ { "," <when operand> }... ]
      

      详情

      • <case operand>是不被括号包裹的表达式,如变量引用,聚合函数等。
      • 执行流程:
        • <case operand>依次与每个<when operand list>进行比较。
        • <when operand list><case operand>匹配时,将返回对应的<result>
        • 若无匹配结果,则返回ELSE从句指定的<result>。若省略ELSE,则默认返回null
      • <when operand list>包含多个<when operand>时,若任意<when operand>判断为真,则<when operand list>认定为真。
      • <when operand>可显式包括=<>><>=<=IS NULLIS NOT NULL等运算符。若仅指定一个常数且不包含其他运算符时,则隐式使用运算符=

      MATCH (n:Paper WHERE n.score > 6)
      RETURN CASE count(n) WHEN 3 THEN "Y" ELSE "N" END AS result
      

      结果:

      result
      N

      MATCH (n:Paper)
      RETURN n.title, n.score,
      CASE n.score 
        WHEN <7 THEN "Low"
        WHEN 7,8 THEN "Medium"
      ELSE "High" END AS scoreLevel
      

      结果:

      n.title n.socre scoreLevel
      Efficient Graph Search 6 Low
      Optimizing Queries 9 High
      Path Patterns 7 Medium

      MATCH (n:Paper)
      RETURN n.title,
      CASE n.publisher 
        WHEN IS NULL THEN "Unknown"
      ELSE n.publisher END AS Publisher
      

      结果:

      n.title Publisher
      Efficient Graph Search PulsePress
      Optimizing Queries Unknown
      Path Patterns BrightLeaf

      Searched CASE

      Searched CASE表达式用来判断多个条件,并返回首个条件判断为真的结果。

      <searched case> ::=
        "CASE"
          "WHEN" <condition> "THEN" <result>
          [ { "WHEN" <condition> "THEN" <result> }... ]
          [ "ELSE" <result> ]
        "END"
      

      详情

      • <condition>为布尔值表达式,计算结果为真或假。
      • 执行流程:
        • 依次判断各<condition>
        • <condition>为真,则立刻返回对应的<result>
        • 若所有<condition>为假,则返回ELSE从句指定的<result>。若省略ELSE,则默认返回null

      MATCH (n:Paper)
      RETURN n.title,
      CASE
        WHEN n.publisher IS NULL THEN "Publisher N/A"
        WHEN n.score < 7 THEN -1
        ELSE n.author
      END AS note
      

      结果:

      n.title note
      Optimizing Queries Publisher N/A
      Efficient Graph Search -1
      Path Patterns Zack
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写