Run your Query
To run your query, simply click on . G.V() will attempt running your query against your server, and display the results window indicating the output of your query. More information is available at Results View
You can have multiple queries specified in the same Query Editor. If there is more than one query in your editor, clicking on Run Query will run the query nearest to your mouse cursor. You can easily swap between queries to run by clicking on the query you would like to run before running it.
When running your query, remember to specify a terminal step (e.g. toList, next, iterate). Not specifying the terminal step will allow the query to run, but will not extract any results.
Text to Gremlin
G.V() offers an experimental OpenAI integration that allows generating Gremlin queries via the OpenAI API.
The prompt G.V() sends to the OpenAI API contains details of your graph database's data model to give it the best chance of generating a Gremlin query that will work for your graph database.
It is therefore important to understand first and foremost that when using this feature, you will be sending details of the structure of your data to the OpenAI API, but not any of the data itself contained within your database itself.
For a reference of what information is generated as part of G.V()'s data model, please refer to the Data Model Management documentation.
When converting a text prompt to a Gremlin Query, you will be offered two options:
- OpenAI Prompt: The text prompt to send to the OpenAI API to be converted to a Gremlin query
- Query Output Format: The output format for the query that the OpenAI API will generate. Currently can be set to Raw, which lets the OpenAI API decide on the appropriate format to use, of Graph, which adds additional information in the prompt to force the OpenAI API to generate a query that will output in a format that leads to a graph visualisation in G.V().
This is an experimental feature. OpenAI is an evolving tool that is getting increasingly better at generating accurate Gremlin queries, but will not always get it right. If a generated query does not meet the criteria of your prompt, try and make your prompt more detailed.
The OpenAI API will have information of your graph's data model and therefore understand language that is derivative or synonym to the labels and property keys available in your graph database. Your prompt should include keywords that match your graph database's labels and property keys. Here are some examples of prompts:
- get all countries with at least 50 airports
- show all payments made to account 0008-7960-9302-7255 and the merchants for the transactions
- show all payments made to account 0008-7960-9302-7255 and the ip addresses in the transactions
Using Apache TinkerPop™'s ANTLR grammar, G.V() will attempt to proactively warn of any syntax error in your query. Syntax errors in your query are highlighted in the code editor and listed below it. Note that at this moment, G.V() will not warn of any semantic error (e.g. using the select step with an unknown select key), but will in future versions.
Using Apache TinkerPop™'s ANTLR grammar, G.V() will provide smart autocomplete suggestions as you're typing your query. Additionally, G.V() loads the structure of your graph data in the background and will make suggestions on Edge, Vertex and Property labels. Additionally when entering a specific step in your query, a Javadoc style popup will display above the line you're typing in showing the available parameters and variations of the step.
Translate a Query to a target Gremlin Language Variant
To translate your query directly to a target Gremlin Language Variant (GLV), click on and select your target language in the resulting modal window. Note that if there are any syntax errors in your query, this feature will be unavailable.
For more details, go to the Gremlin Query Debugging documentation.
Formatting using Gremlint
To format your query using Gremlint, click on
Fetch All Edges Between Vertices
By default, when fetching vertices only from your Gremlin Server, the resulting graph visualisation will not include any edges. Toggling on will cause all edges found between resulting vertices to also be returned, allowing for a more useful graph visualisation experience. This is equivalent to adding the .bothE() step to your graph traversal when it returns vertices.
Fetch Vertex Meta Properties
By default, when fetching vertices, only direct properties will be returned by your Gremlin Server. For convenience purposes, toggling on will automatically append any meta properties on vertices returned by your query. Note that this is modifying the results of your query and therefore doesn't represent the effective response returned by Gremlin Server, but it allows to quickly visualize the entire data appended to your vertices.
If enabled, submits your query as a script using Gremlin Client as opposed to running it as bytecode.
This is primarily useful to submit scripts that aren't Gremlin queries (e.g. JanusGraph Schema Management commands). This may also be useful in situations where your server implementation contains custom code that doesn't bundle with the default Apache TinkerPop code, to prevent serialisation issues. This may also be required to submit complex lambdas. This option is off by default and can be toggled by clicking on
This option is not applicable to Azure Cosmos DB/Azure Cosmos DB Emulator which does not support Bytecode, nor G.V()'s Playground where custom code/serialization is not applicable.
When using Console Mode, autocomplete features and syntax checking are both disabled as G.V() does not support autocomplete for provider specific server language feature (e.g. JanusGraph Schema Management API)
Save a Query
To save your query, click on . If you haven't previously saved your query, you will also be prompted to specify a name for it. If your query can be saved, this will be signified by a * displayed next to the query's name.
G.V() will automatically remember all the queries you've previously opened. You can safely close G.V() and return to your queries when you next re-open the application.
View Query History
To view previous queries run in your query editor, click on . The query history view allows to to navigate previously ran queries.
Toggle Editor Autocomplete Suggestions
Autocomplete popups can be dismissed by pressing the Escape key or clicking away from them. Alternatively, they can be enabled/disabled on an editor by clicking on . The default value for this setting when opening a new query editor is determined by the Enable Query Editor Smart Autocomplete setting in the Application Settings
Organize your Queries Into Folders
G.V() allows you to organize your queries into folders. You can manage folders from the Connection side menu. From there, you can perform the following folder actions:
- Create a new folder
- Delete a folder
- Move a folder into another
- Move a query to a folder
Additionally when saving a query, you will be given the option to choose a folder to save the query to.
The following keyboard shortcuts are currently available on the query editor:
- Ctrl+Space: Toggle Autocomplete
- Escape: Close Autocomplete Window
- Alt+Enter: Submit Query
- Ctrl+F: Format Query
- Ctrl+T: Translate Query
- Ctrl-S: Save Query
- Ctrl-W: Close Query
You can view the currently available keyboard shortcuts directly from the query editor by clicking the icon.
For macOS users, you can also substitute Ctrl with Cmd.