Overview
A distributed projection resides in the memory of the corresponding shard servers where the data is persistently stored. It can hold either full or partial data from a graphset. The term "distributed projection" refers to the fact that the data within it can still be distributed across the memory of multiple shards.
All distributed projections of a graphset are lost when the data in the graphset is migrated to different shards.
Managing distributed projections using GQL is not supported yet.
Showing Distributed Projections
Retrieves information about all distributed projections of the current graphset:
show().project()
It returns a table _projectList
with the following fields:
Field |
Description |
---|---|
project_name |
Name of the projection. |
project_type |
Type of the projection, which is distributed . |
graph_name |
Name of the current graphset from which the data was loaded. |
status |
Current state of the projection, which can be DONE or CREATING , FAILED or UNKNOWN . |
stats |
Node and edge statistics per shard, including address of the leader replica of the current graphset, edge_in_count , edge_out_count and node_count . |
config |
Configurations for the distributed projection. |
Creating a Distributed Projection
The create.project()
statement creates an in-memory projection of the current graphset to shard servers. The project creation is executed as a job, you may run show().job(<id?>)
afterward to verify the success of the creation.
Syntax
create().project(
"<projectName>",
{
nodes: {
"<schema1?>": ["<property1?>", "<property2?>", ...],
"<schema2?>": ["<property1?>", "<property2?>", ...],
...
},
edges: {
"<schema1?>": ["<property1?>", "<property2?>", ...],
"<schema2?>": ["<property1?>", "<property2?>", ...],
...
},
direction: "<edgeDirection?>",
load_id: <boolean?>
}
)
Method | Param | Description | Optional | |
---|---|---|---|---|
project() |
<projectName> |
Name of the projection. Each distributed projection name within a database must be unique and cannot duplicate the name of any HDC graph of the same graphset. | No | |
Config map | nodes |
Specifies nodes to project based on schemas and properties. The _uuid is loaded by default, while _id is configurable with load_id . Sets to "*": ["*"] to load all nodes. |
Yes | |
edges |
Specifies edges to project based on schemas and properties. All system properties are loaded by default. Sets to "*": ["*"] to load all edges. |
Yes | ||
direction |
Since each edge is physically stored twice - as an incoming edge along its destination node and an outgoing edge with its source node - you can choose to project only incoming edges with in , only outgoing edges with out , or both with undirected (the default setting). Please note that in or out restricts graph traversal during computation to the specified direction. |
No | ||
load_id |
Sets to false to project nodes without _id values to save the memory space; it defaults to true . |
Yes |
Examples
To project the entire current graphset to its shard servers as distGraph
:
create().project("distGraph", {
nodes: {"*": ["*"]},
edges: {"*": ["*"]},
direction: "undirected",
load_id: true
})
To project @account
and @movie
nodes with selected properties and incoming @rate
edges in the current graphset to its shard servers as distGraph_1
, while omitting nodes' _id
values:
create().project("distGraph_1", {
nodes: {
"account": ["name", "gender"],
"movie": ["name", "year"]
},
edges: {"rate": ["*"]},
direction: "in",
load_id: false
})
Dropping a Distributed Projection
You can drop any distributed projection of the current graphset from the shard servers using the drop().project()
statement.
The following example deletes the distributed projection named distGraph_1
:
drop().project("distGraph_1")