This page explains what graph data looks like and how they are described in UQL. This must be mastered before leanring and using Ultipa Graph System.
Graph Data

Node
The two circles Areith and Waiter shown in Chart1 are nodes.
Nodes represent entities in the world.
Edge
The black arrow workAs in Chart1 is an edge, it points from Areith to Waiter.
Edges represent relations between entities.
Schema
The Person, Job and workAs in the code in Chart1 are schemas.
Schemas represent different types of node or edge.
Property
The name and title in the code in Chart1 are properties.
Properties are the components of a schema to describe in detail the type of node or edge this schema represents.
Path

The sequence of connected and alternating nodes and edges Areith, worksAs and Waiter in Chart2 is a path. Another sequence Waiter, worksAs, Areith, studyAt, Oxford is also a path.
A path starts from and ends with node, contains at least one edge. It represents multi-step correlations of entities, which makes it the most queried in graph computing.
Describe Nodes

There are a bunch of parameters that can describe node(s) in UQL. Take parameter n()
as an example:
n() // any node in the graph
n({@Student}) // nodes of schema 'Student'
n({name == "Jason"}) // nodes whose property 'name' is 'Jason'
n({@Student.name == "Jason"}) // nodes of schema 'Student' whose property 'name' is 'Jason'
n(as a) // any node in the graph, and give these nodes an alias 'a'
n({@Student} as a) // ...
...
Features of describing nodes using n()
:
- An empty
n()
sets no particular requirements on nodes - Filtering schema requires symbol
@
- Schema and property can be filtered in combinition or separately
- Assigning alias to the found nodes requires keyword
as
All parameters that can describe node(s) in UQL:
nodes()
: used in node query, update and deletionn()
: used in template query (a type of path query)nf()
: used in template querysrc()
: used in non-template path querydest()
: used in non-template path querynode_filter()
: used in non-template path query
Describe Edges

Take e()
as an example to see how edges can be described:
e() // any edge in the graph
e({@workAs}) // edges of schema 'workAs'
e({since == 2012}) // edges whose property 'since' is '2012'
e({@workAs.since == 2012}) // edges of schema 'workAs' whose property 'since' is '2012'
e(as b) // any edge in the graph, and give these edges an alias 'b'
e({@workAs} as b) // ...
...
Similar with describing nodes using n()
, describing edges using e()
has below features:
- An empty
e()
sets no particular requirements on edges - Filtering schema requires symbol
@
- Schema and property can be filtered in combinition or separately
- Assigning alias to the found edges requires keyword
as
(note:e()
does not always supports defining alias)
All parameters that can describe edge(s) in UQL:
edges()
: used in edge query, update and deletione()
: used in template queryle()
: used in template queryre()
: used in template queryedge_filter()
: used in non-template path query
Describe Paths (Template)

Paths described using n()
and e()
are template:
// any 1-hop path in the graph
n().e().n()
// any 2-hop path in the graph
n().e().n().e().n()
n().e()[2].n()
// 1-hop paths 'Person-workAs-waiter'
// give these Person an alias 'individual', give these paths an alias 'career'
n({@Person} as individual).e({@workAs}).n({@Job.title == "Waiter"}) as career
// 2-hop paths 'Areith-workAs-Job-workAs-Person'
// give these Job an alias 'job', give these Person at the end an alias 'other'
n({@Person.name == "Areith"}).e({@workAs}).n({@Job} as job).e({@workAs}).n({@Person} as other)
...
Features of path template:
- Path templates are as intuitive as how they are visualized in a graph
- Alias can be assigned for a single node, edge, as well as the whole path

Are the two paths described in Chart6 the same? As paths in Ultipa are composed and parsed from left to right, the two templates are not the same, but they do describe the same graph data.