PGX supports the following primitive data types.
double. These types have the same size, range and precision of the corresponding Java primitive data type.
booleandata type has only two possible values: true and false. As with Java and C++, its size is not precisely defined.
Stringis a primitive data type in PGX. PGX follows the Java conventions for String representation.
time with time zone, and
timestamp with time zone. These types correspond to the Java types
OffsetDateTimefrom the standard library package
edgeof the graph itself is a proper type in PGX.
An overview of the different data types and their integration in different languages and APIs is as follows:
|data type||loading & storing||PGX Java API||PGQL and Filter Expression||Green-Marl|
|int / integer||int / integer||int||INT / INTEGER||int|
|time with time zone||time_with_timezone||OffsetTime||TIME WITH TIME ZONE||-|
|timestamp with time zone||timestamp_with_timezone||OffsetDateTime||TIMESTAMP WITH TIME ZONE||-|
All properties and scalar variables should be one of the above primitive data types.
edge) is itself a valid primitive data type. For
instance, in a path-finding algorithm, each vertex can have a temporary property
predecessor that stores which incoming neighbor is the predecessor vertex in
the path. Such a property would have the type
Also note that in the graph config,
local_date should be used instead of
To see examples of usage of datetime data types, see Using Datetime Data Types.
The following table summarizes the minimum and maximum values for each data type. Note that for float and double types, the smallest absolute value is included in the table, the minimum value is the negative of maximum value for these types.
|data type||min value||max value|
|int / integer||-2147483648||2147483647|
|timestamp||-292275055-05-17 00:00:00.000||292278994-08-17 07:12:55.807|
|time with time zone||00:00:00.000+18:00||23:59:59.999-18:00|
|timestamp with time zone||-292275055-05-17 00:00:00.000+18:00||292278994-08-17 07:12:55.807-18:00|
For string values, PGX supports arbitrary long strings.
PGX supports three different collection types:
All of these collections can contain values of the
vertex type, but each has different semantics regarding uniqueness and preserving the order of its elements:
sequence works basically like a list. It preserves the order of the elements added to it, and the same element can appear multiple times.
set can contain the same value once at the most. Adding a value that is already in the
set will have no effect.
set does not preserve the order of the elements it contains.
Order: just like the
order collection will contain each element once at the most. But the
order preserves the order of the elements inserted into it; i.e., it is a FIFO data structure.
To see examples of creation and usage of the different collections, see Using Collections.
Some operations, like
PgxGraph.getEdges() return immutable collections.
These collections behave like normal collections, but cannot be modified by operations like
An immutable collection can be transformed into a mutable collection by using the
toMutable method, which returns a mutable copy of the collection.
toMutable is called on a collection that is already mutable, the method has the same result as the method
To check if a collection is mutable, the
isMutable method can be used.
PGX provides two different kinds of maps:
PropertyType. This is the kind of maps to use if the key or value types are graph-related like
EDGEotherwise using session-bound maps is recommended.
To see examples of creation and usage of maps, see Using Maps.