Session Manager
Nebula Graph employs the Role Based Access Control. So, when the client first connects to the query engine, it needs to authenticate itself. When it succeeds, the query engine creates a new session and returns the session ID to the client. All sessions are managed by the Session Manager. The session will remember the current graph space and access rights to the space. The session will also keep some session-wide configurations and be used as a temporary storage to store information across multiple requests in the same session.

The session will be dropped when the client connection is closed or is idle for a period of time. The length of the idle time is configurable. When the client sends a request to the query engine, it needs to attach the current session ID. Otherwise, the query engine will reject the request. When the query engine accesses the storage engine, it will attach the session object to every request. This is so the storage engine does not have to manage sessions.

Parser
The first thing that the query engine will do when receiving a request is to parse the statements in the request. This is done by the Parser. Most of the Parser code is generated by the famous flex/bison tool set. The lexicon and syntax files for the nGQL can be found in the src/parser folder in the source code tree. The nGQL is designed in a way that is close enough to SQL. The idea is lessen the learning curve as much as possible.

Graph databases currently do not have a unified international query language standard. As soon as the ISO’s GQL committee releases their first draft, Nebula Graph plans to make nGQL compatible with the proposed GQL standards.

The output of the Parser is an Abstract Syntax Tree (AST), which will be passed on to the next module, the Execution Planner.

#graph database #query engine #gql #database

An Introduction to Nebula Graph’s Query Engine - DZone Database
1.35 GEEK