Basic templates describe the filtering rules the minimum unit (node, edge) in the path has to meet. Basic templates assembled into path or subgraph can make structural matching in the graph to accommodate the business needs with celerity and great customizability.
Ultipa currently supports the following 4 basic templates:
Basic Template | Type | Description | Structure of Custom Alias |
---|---|---|---|
n() |
Single node | The filtering rules of one node in the path ![]() |
NODE |
e() , e()[1] ,le() , le()[1] , re() , re()[1] |
Single edge | The filtering rules of one edge in the path; edge direction is none, left or right (the same below)![]() |
EDGE |
e()[<steps>] ,le()[<steps>] ,re()[<steps>] |
Multi-edge | The filtering rules of multiple consecutive edges in the path ![]() format of [<steps>] (N ≥ 2): [N] : N edges [:N] : 1~N edges [0:N] : 0~N edges (see note below) [M:N] : M~N edges [*:N] : the shortest paths within N edges |
Not supported |
e().nf()[<steps>] ,le().nf()[<steps>] ,re().nf()[<steps>] |
Multi-edge with Intermediate Nodes | The filtering rules of multiple consecutive edges and nodes between those edges in the path ![]() format of [<steps>] is the same as above |
Not supported |
Note: when setting [0:N] as length of a multi-edge template, the 0-step is triggered only when the node templates before and after this multi-edge template have the same filtering condition, in which case this multi-edge template is considered dismissed the twose node templates are considered the same node.
Assembling Rules
- Rule No.1: A path starts and ends with node, and consists of alternating nodes and edges.
For instance, a 3-step path that has different filtering conditions of each node and edge can be written as n().e().n().e().n().e().n(), independent filter and alias can be set for each node or edge in the path:

n({@mgr}).re({@manage}).n({@cst} as n1)
.re({@has}).n({@acct} as n2)
.re({@buy} as e1).n({@product}) as p
- Rule No.2: Continous edges and intermediate nodes with same filtering condition can be merged in a multiple-edge template.
For instance, a 5-step path that has same filtering condition for its nodes and edges from step-2 to step-4, can use multi-edge template e().nf()[3] to represent those edges and intermediate nodes. But custom alias is not applicable in multiple-edge template:

n({@cst}).re({@has}).n({@acct} as n1)
.re({@transfer}).nf({@acct})[3].n({@acct} as n2)
.le({@has}).n({@cst}) as p
- Rule No.3: Set depth as a range instead of a fixed number, to expand the query scope.
For instance, to limit the number of transactions in each path within 3, use multi-edge template e().nf()[:3]:

n({@cst} as n1).re({@has}).n({@acct} as c1)
.re({@transfer})[:3].n({@acct} c1)
.le({@has}).n({@cst}) as p