Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of: uppercase, lowercase, numbers, and special characters.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

The MAC address of the server you want to deploy.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Applied Validity Period(days)
Effective Date
Excpired Date
Mac Address
Apply Comment
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
  • Country:
  • Language:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.0
Search
    English
    v5.0

      Quantified Path Patterns

      Overview

      A quantified path pattern constructs a path of variable length, where either the entire path or a segment of it is repeated a specified number of times. A quantified path pattern can be formed by applying a quantifier to either an edge pattern or a parenthesized path pattern.

      <quantified path pattern> ::= <quantified edges> | <quantified paths>
        
      <quantified edges> ::= <edge pattern> <quantifier>
      
      <quantified paths> ::= <parenthesized path pattern> <quantifier>
      

      In implementation, a quantified path pattern must be concatenated with other path factors, explicitly or implicitly, using a node pattern. Refer to the examples for further clarification.

      Quantifiers

      A quantifier is written as postfix on either an edge pattern or a parenthesized path pattern.

      Quantifier
      Description
      {m,n} Between m and n repetitions
      {m} Exactly m repetitions
      {m,} m or more repetitions
      {,n} Between 0 and n repetitions
      * Between 0 and more repetitions
      + Between 1 and more repetitions

      When the repetition of 0 is indicated, a path (or subpath) with zero edges that only contains the initial node will be included in the matchings.

      Syntactic restrictions are in place to prevent infinite looping, which could occur when an unbounded quantifier is used to match a graph that contains cycles.

      Quantified Edges

      Quantified edges are built by an edge pattern followed by a quantifier that specifies how many times the edge repeats. Note that the quantifier can be applied to both full and abbreviated edge patterns.

      This path pattern expression is equivalent to:

      The repeated edges are implicitly connected by empty node patterns.

      Example Graph

      The following examples run against this graph:

      To create this graph, run the following query against an empty graph:

      INSERT (purplechalk:User {_id: "U01", name: "purplechalk"}),
             (mochaeach:User {_id: "U02", name: "mochaeach"}),
             (rowlock:User {_id: "U03", name: "rowlock"}),
             (quasar92:User {_id: "U04", name: "Quasar92"}),
             (velvet:User {_id: "U05", name: "Velvet"}),
             (brainy:User {_id: "U06", name: "Brainy"}),
             (quickfox:User {_id: "U07", name: "Quickfox"}),
             (inception:Movie {_id: "M01", name: "Inception"}),
             (purplechalk)-[:Follows]->(mochaeach),
             (mochaeach)-[:Follows]->(rowlock),
             (rowlock)-[:Follows]->(quasar92),
             (quasar92)-[:Follows]->(velvet),
             (brainy)-[:Follows]->(mochaeach),
             (mochaeach)-[:Likes]->(inception),
             (quickfox)-[:Likes]->(inception)
      

      Fixed Lowerbound and Upperbound

      Gets users who Brainy can reach by 1 to 3 outgoing edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]->{1,3}(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["mochaeach", "rowlock", "Quasar92"]

      Fixed Length

      Gets users who Brainy can reach by exactly 2 outgoing edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]->{2}(u:User)
      RETURN collect_list(u.name)  AS names
      

      Result:

      names
      ["rowlock"]

      Fixed Lowerbound

      Gets users who Brainy can reach by 2 or more edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]-{2,}(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["rowlock", "purplechalk", "Quasar92", "Velvet"]

      Gets users who Brainy can reach by 0 or more outgoing edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]->*(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["Brainy", "mochaeach", "rowlock", "Quasar92", "Velvet"]

      Gets users who Brainy can reach by 1 or more outgoing edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]->+(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["mochaeach", "rowlock", "Quasar92", "Velvet"]

      Fixed Upperbound

      Gets users who Brainy can reach by 0 to 2 edges labeled Follows:

      MATCH (:User {name: 'Brainy'})-[:Follows]-{,2}(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["Brainy", "mochaeach", "rowlock", "purplechalk"]

      Quantified Abbreviated Edges

      With an abbreviated edge pattern, there is no label and property restrictions on the edge. The following example gets users who Brainy can reach by 1 to 2 edges:

      MATCH (:User {name: 'Brainy'})-{1,2}(u:User)
      RETURN collect_list(u.name) AS names
      

      Result:

      names
      ["mochaeach", "rowlock", "purplechalk", "QuickFox"]

      Quantified Paths

      Quantified paths are built by an parenthesized path pattern followed by a quantifier that specifies how many times the path repeats.

      This path pattern expression is equivalent to:

      At the transition between groups, two node patterns are concatenated consecutively. They are combined to a single node pattern with all filtering conditions merged conjunctively. In this example, this is straightforward since the only filtering applied is the User label:

      With this, the above is simplified to:

      Example Graph

      The following examples run against this graph:

      To create this graph, run the following query against an empty graph:

      INSERT (jack:User {_id: "U01", name: "Jack"}),
             (mike:User {_id: "U02", name: "Mike"}),
             (c1:Device {_id: "Comp1"}),
             (c2:Device {_id: "Comp2"}),
             (c3:Device {_id: "Comp3"}),
             (c4:Device {_id: "Comp4"}),
             (jack)-[:Owns]->(c1),
             (mike)-[:Owns]->(c4),
             (c1)-[:Flows {packets: 20}]->(c2),
             (c1)-[:Flows {packets: 30}]->(c4),
             (c2)-[:Flows {packets: 34}]->(c3),
             (c2)-[:Flows {packets: 12}]->(c4),
             (c3)-[:Flows {packets: 74}]->(c4)
      

      Fixed Lowerbound and Upperbound

      Gets paths of 1 to 3 outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device)){1,3}
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id:"U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 30}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 20}]->(:Device {_id: "Comp2"})-[:Flows {packets: 34}]->(:Device {_id: "Comp3"})-[:Flows {packets: 74}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Fixed Length

      Gets paths of 3 outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device)){3}
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 20}]->(:Device {_id: "Comp2"})-[:Flows {packets: 34}]->(:Device {_id: "Comp3"})-[:Flows {packets: 74}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Fixed Lowerbound

      Gets paths of 2 or more outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device)){2,}
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 20}]->(:Device {_id: "Comp2"})-[:Flows {packets: 34}]->(:Device {_id: "Comp3"})-[:Flows {packets: 74}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Gets paths of 0 or more outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device))*
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 30}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 20}]->(:Device {_id: "Comp2"})-[:Flows {packets: 34}]->(:Device {_id: "Comp3"})-[:Flows {packets: 74}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Gets paths of 1 or more outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device))+
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 30}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 20}]->(:Device {_id: "Comp2"})-[:Flows {packets: 34}]->(:Device {_id: "Comp3"})-[:Flows {packets: 74}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Fixed Upperbound

      Gets paths of 0 to 2 outgoing data flows from the device owned by Jack to the device owned by Mike, where each data flow has more than 15 packets:

      MATCH p = (:User {name: 'Jack'})-[:Owns]->()
            ((:Device)-[f:Flows WHERE f.packets > 15]->(:Device)){,2}
            ()<-[:Owns]-(:User {name: 'Mike'})
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "Jack"})-[:Owns]->(:Device {_id: "Comp1"})-[:Flows {packets: 30}]->(:Device {_id: "Comp4"})<-[:Owns]-(:User {_id: "U02", name: "Mike"})

      Degree of Reference of Element Variables

      If an element variable is declared in a quantified path pattern, then it may bind to more than one graph element. References to the element variable are interpreted contextually.

      Singleton Degree of Reference

      This feature is not yet supported.

      If the reference occurs inside the quantified path pattern, then the reference has singleton degree of reference and references at most one graph element.

      MATCH p = ((a)-[]->(b) WHERE a.age < b.age){1,2}
      RETURN p
      

      Result:

      p
      (:User {_id: "U01", name: "rowlock", age: 24})-[:Follows {score: 2}]->(:User {_id: "U02", name: "Quasar92", age: 29})
      (:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35})
      (:User {_id: "U01", name: "rowlock", age: 24})-[:Follows {score: 2}]->(:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35})

      In this query, a and b are singletons that represent individual nodes. The condition a.age < b.age is evaluated for each pair of nodes a and b as the path is matched.

      Group Degree of Reference

      If the reference occurs outside the quantified path pattern, then the reference has group degree of reference and references to the complete list of graph elements. In this circumstance, the element variable is viewed as a group variable.

      MATCH p = ((a)-[]->(b)){1,2}
      RETURN p, a, b
      

      Result:

      p
      a b
      (:User {_id: "U01", name: "rowlock", age: 24})-[:Follows {score: 2}]->(:User {_id: "U02", name: "Quasar92", age: 29}) [(:User {_id: "U01", name: "rowlock", age: 24})] [(:User {_id: "U02", name: "Quasar92", age: 29})]
      (:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35}) [(:User {_id: "U02", name: "Quasar92", age: 29})] [(:User {_id: "U03", name: "claire", age: 35})]
      (:User {_id: "U01", name: "rowlock", age: 24})-[:Follows {score: 2}]->(:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35}) [(:User {_id: "U01", name: "rowlock", age: 24}), (:User {_id: "U02", name: "Quasar92", age: 29})] [(:User {_id: "U02", name: "Quasar92", age: 29}), (:User {_id: "U03", name: "claire", age: 35})]

      Variables a and b are exposed as group variables in the RETURN statement. Each of them represents a list of nodes encountered along the matched paths, rather than a single node.

      The following query throws syntax error since it treats a and b as singleton variables outside a quantified path pattern:

      MATCH p = ((a)-[]->(b)){1,2}
      WHERE a.age < b.age
      RETURN p
      

      The horizontal aggregation feature is not yet supported.

      Group variables can be used to aggregate data along the quantified paths or edges, which is the horizontal aggregation.

      MATCH p = ()-[e]->{1,2}()
      WHERE sum(e.score) > 2
      RETURN p, collect_list(e.score) AS scores
      

      Result:

      p
      scores
      (:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35}) [3]
      (:User {_id: "U01", name: "rowlock", age: 24})-[:Follows {score: 2}]->(:User {_id: "U02", name: "Quasar92", age: 29})-[:Follows {score: 3}]->(:User {_id: "U03", name: "claire", age: 35}) [2, 3]
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写