Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Available from Onesait Platform version 4.2.0 and higher

Introduction

In this post we are going to explain how to work with stored entities on Nebula Graph, for the cases in which you want to work with graph-based storage technologies.

Entity creation

To create the entity, we will have to select the option 'Create entity in network database'.

In the first tab we will fill in the basic data about the entity, which will represent a space in Nebula Graph, that is, it will contain the definition of the vertices and edges. We will have to choose the number of partitions and replicas for the entity (space) that we are going to create, by default 15 and 1 respectively.

In the next tab we will define the vertices and edges, as we add properties of both they will appear in the associated table.

Then click on the create button.

If we access the 'view entity' icon (eye) we will be able to see the definition of vertices and edges.

Entering data

Once the entity is created, we can execute all types of nGQL queries from query tool.

For this example we will create the following data:

#VERTICES
INSERT VERTEX player(name, age) VALUES "player100":("Tim Duncan", 42);
INSERT VERTEX player(name, age) VALUES "player101":("Tony Parker", 36);
INSERT VERTEX player(name, age) VALUES "player102":("LaMarcus Aldridge", 33);
INSERT VERTEX player(name, age) VALUES "player103":("Michael Jordan", 52);
INSERT VERTEX team(name) VALUES "team203":("Trail Blazers"), "team204":("Spurs");
#ARISTAS
INSERT EDGE follow(degree) VALUES "player101" -> "player100":(95);
INSERT EDGE follow(degree) VALUES "player101" -> "player102":(90);
INSERT EDGE follow(degree) VALUES "player101" -> "player103":(70);
INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75);
INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75);
INSERT EDGE follow(degree) VALUES "player103" -> "player101":(55);
INSERT EDGE serve(start_year, end_year) VALUES "player101" -> "team204":(1999, 2018),"player102" -> "team203":(2006,  2015),"player103" -> "team203":(1990,  2022);

With this we will now have data to perform queries.

Queries

As we have said before, we can make any type of query in nGQL format, let's see some examples:

FETCH PROP ON player "player100" YIELD properties(vertex) as player_properties;
GO FROM "player101" OVER follow YIELD id($$) as vid;
GO FROM "player101" OVER follow YIELD dst(edge) AS id | GO FROM $-.id OVER serve YIELD properties($$).name AS Team,  properties($^).name AS Player;

Apification

We can also apify the entity to perform queries via HTTP.

When we select a network type entity to qualify, only one operation will be available.

Nebula Graph UI

From the entity list, when an entity is stored in Nebula Graph, you will have an option to access the Nebula UI.

When accessing, a new tab will open, where we will have to enter the following data of acceso:

Host:

graphd:9669

Default credentials are:

root / nebula

And select the entity/space in the combo box:

Then we will access the Explorer to be able to visualize the graph of our data within the entity.

To visualize a complete initial network, we can select the button 'Start with vertices', and then 'Import Sample'.

  • No labels