Guide of StarShadow
1. Menu Bar Functions
- Add Connection, see Add Database Connection
If you don't have your own graph database yet, you can get a free graph database in the following ways:
- Install NebulaGraph Using RPM or DEB Packages
- NebulaGraph 3.4.0 provided by Alibaba Cloud Computing Nest
- For more installation methods, please refer to the NebulaGraph Official Documentation
- Open Folder, the first time you open it will default to creating a folder in the user documents, developers can choose a new path by themselves;
- Recently Opened, save multiple selected folder paths, developers can switch between multiple paths according to the project being developed;
- Exit.
2. Add Database Connection (The current version only supports NebulaGraph)
- Data source name, for your own distinction between different data sources
- Select the database type (default NebulaGraph)
- Host address, example: gdbc.nebula://192.168.0.1:9669
- Username, example: root
- Password, example: nebula
- Test connection
- Complete data source addition
3. Data Source Tree Structure
- Data source name (custom)
- basketballplayer
- Tags
- player
- team
- Relationships
- follow
- serve
- Queries (can be used to store nGQL used by the project)
- Common Queries (folder)
- View the teams that James has served (nGQL)
- Daily Operations (folder)
- View the number of session connections (nGQL)
- Common Queries (folder)
- Tags
- spaceName2
- ...
- basketballplayer
4. Operations Supported by the Data Source Tree Structure and Their Descriptions (using the above data source tree structure as an example)
4.1, [Data Source Name] Node
- When refreshing, execute SHOW SPACES Used to update the schema tree structure when adding graph spaces, node types, or edge types.
- Expand the left arrow to refresh the same
- When creating a graph space, execute CREATE SPACE Used to create a new graph space on the current host.
- Edit Used to modify connection parameters when the connection parameters change.
- Delete Delete the current data source without any operation on the database data.
4.2, [basketballplayer] Node (Graph Space Node)
Click In the main operation area, open the panel and display the data volume of each tag/type in the current graph space, execute SHOW STATS Prerequisite: The current graph space has executed SUBMIT JOB STATS.
Refresh Used to update the structure of the schema when adding node types or edge types.
When copying, execute CREATE SPACE Only copy the schema of the current space, execute the following statement:
cypherCREATE SPACE IF NOT EXISTS newSpace AS basketballplayer;
When clearing data, execute CLEAR SPACE Keep the schema of the current space and clear all data, execute the following statement:
cypherCLEAR SPACE IF EXISTS basketballplayer;
When deleting, execute DROP SPACE Delete the current graph space, and neither the schema nor the data is retained. Execute the following statement:
cypherDROP SPACE basketballplayer;
4.3, [Tags] Node
- Refresh
- SHOW TAGScypher
SHOW TAGS;
- SHOW TAGS
4.4, [player] Node (Tag in the database)
- When clicked, execute MATCH Open a table panel in the main operation area to display the current tag data and load it by page, 100 data per page, execute the following statement:cypher
MATCH (n:player) RETURN id(n), n.`player`.`name` as `name`, n.`player`.`age` as `age` SKIP 0 LIMIT 100; MATCH (n:player) RETURN id(n), n.`player`.`name` as `name`, n.`player`.`age` as `age` SKIP 100 LIMIT 100; // ...
- Edit, execute ALTER TAG
- Delete, execute DROP TAGcypher
DROP TAG `player`;
4.5, [follow] Node (edgeType in the database)
- When clicked, execute MATCH Open a table panel in the main operation area to display the current edgeType data and load it by page, 100 data per page, execute the following statement: (Need to create an index in the edge table, if the display fails, you can create an index through the [Index] button.)cypher
MATCH (src)-[r:follow]->(dst) RETURN id(src), rank(r), id(dst), r.`degree` as `degree` SKIP 0 LIMIT 100; MATCH (src)-[r:follow]->(dst) RETURN id(src), rank(r), id(dst), r.`degree` as `degree` SKIP 100 LIMIT 100; // ...
- Edit, execute ALTER EDGE
- Delete, execute DROP EDGEcypher
DROP EDGE `follow`;
4.6, [Query] Node
- Refresh Synchronize the file structure of the selected project workspace.
- Add Create a new
.ngql
file. - Add Group Create a new folder.
- Delete Delete files and folders from the file system.
4.7, [Daily Operations] Node
A folder type node, same as the [Query] node.
4.8, [View the teams that James has served] and other nGQL file nodes
Rename: Rename the file;
Delete: Delete the nGQL file.
5. Operations Supported by the Main Operation Area and Their Descriptions
5.1, Space Operation Area
Entry: Click the graph space node to display, such as: [basketballplayer].
- Import: Support csv import, and support creating schema through the first line of csv;
- Select All (originally intended to select schema for batch operations, such as backup, not implemented).
5.2, Tag Operation Area
Entry: Click the tag node to display, such as: [player].
- Refresh: Return to the first page;
- Index:
Display index SHOW INDEXES
Create index CREATE TAG INDEX
cypherCREATE TAG INDEX `i_player_age` ON `player`(`age`);
Rebuild index REBUILD INDEX
cypherREBUILD TAG INDEX `i_player_age`;
Delete index DROP INDEX
cypherDROP TAG INDEX `i_player_age`;
- Add Data, support adding data in a single line INSERT VERTEX:cypher
INSERT VERTEX `player` (name, age) VALUES 'player999': ('Kobe', 41);
- Data Table Support:
- View detailed data of a single row;
- Edit data of a single row UPDATE VERTEX;cypher
UPDATE VERTEX ON `player` 'player999' SET age = 18
- Copy the current right-clicked single-row data (except vid), the script is the same as [Add Data];
- Delete node DELETE VERTEX:cypher
DELETE VERTEX 'player999';
5.3, Edge Operation Area
Entry: Click the relationship node to display, such as: [follow].
- Refresh: Return to the first page;
- Index:
- Display index SHOW INDEXES
- Create index CREATE INDEXcypher
CREATE EDGE INDEX `i_follow` ON `follow`();
- Rebuild index REBUILD INDEXcypher
REBUILD EDGE INDEX `i_follow`;
- Delete index DROP INDEXcypher
DROP EDGE INDEX `i_follow`;
- Add Data, support adding data in a single line INSERT EDGE:cypher
INSERT EDGE `follow` (degree) VALUES 'player999' -> 'player888': (1);
5.4, Query Operation Area
Entry: Click the query node to display, such as: [View the teams that James has served].
Execution Plan When checked, the execution plan EXPLAIN and PROFILE will be returned at the same time as the query is executed.
cypherPROFILE $ngql
Run
- When there is no selected script in the editing area, execute all scripts;
- When there is a selected script in the editing area, execute the selected script.
Beautify Code (not fully tested, may cause nGQL to be unusable)
- When there is no selected script in the editing area, format the nGQL code in the current editing area;
- When there is a selected script in the editing area, format the selected nGQL code.
Parameter Area
- Different from the parameters in the database.
- You can add parameters in the parameter area by clicking
+
, such as: name | Kobe | string, and usein ngql.
cypherMATCH (n:player) WHERE n.player.name == '{{name}}' RETURN n;
- Support adding multiple sets of parameter schemes, developers can switch according to the query needs without modifying the nGQL script in the editing area.
6. End
Developers can complete the above database operations without writing the corresponding nGQL scripts through the graphical interface.
According to the introduction of the two documents, I believe you have a general understanding of the use of StarShadow. Looking forward to having fun in the world of StarShadow.