Comment on page

Getting Started


Make sure that the PuppyGraph has been deployed following AMI Version or Docker Deployment.

Set Username and Password

You can then access PuppyGraph in your browser with the URL http://<hostname>:8081. For example, a locally deployed PuppyGraph is available at http://localhost:8081.
First, login PuppyGraph with the default username and passowrd.
You may want to update the username and password. Click the "reset admin credentials" button to reset the username and password.
In this example, we will use the default username puppygraph and the password is 888888.
INFO[06:38:21] username password not initialized, please follow the instructions to configure
input username [default: puppygraph]: puppygraph
input password [default: ]: ******
INFO[06:38:52] password updated successfully, please restart the console
Refresh the page to restart the console. After logging in with the username and password, you will see PuppyGraph management UI.
PuppyGraph UI

Graph Creation and Query

We now demonstrate how to load a graph into PuppyGraph and query its data.
The demo loads the data into PuppyGraph itself. For use cases where PuppyGraph connects to external data sources, please see: Query Data Lakes and Query Databases.

Example Graph

In this demo, we use a graph with 6 vertices and 6 edges:
example graph
We provided a shortcut to setup the schema and data for the example graph. Click the "Try demo schema and data" button and they graph will setup automatically for you.
Click the demo button to automatically setup demo graph
After setup, you can view the schema on the web UI. You will find the graph has 2 vertex types and 2 edge types.
View schema
When do manually, it requires two steps to make this graph ready in PuppyGraph. You can refer to the setup-demo-graph-manually.

Query the Graph

Query using Gremlin

Query with Embedded Gremlin Console

PuppyGraph provides an embedded Gremlin console.
Start Gremlin console from the UI
It then starts a Gremlin Console like the following:
Welcome to PuppyGraph, type help to see the command list
[PuppyGraph]> console
INFO: Created user preferences directory.
(o o)
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
The following sample query asks for all the "names" of the nodes in the Graph.
And the output will be like this:
gremlin> g.V().value("name")
More examples:
gremlin> g.V('person:::v1')
gremlin> g.V('person:::v1').values('name')
gremlin> g.V('person:::v1').outE('knows')
gremlin> g.V('person:::v1').out('knows').values('name')
gremlin> g.V('person:::v1').out('knows').has('age', gt(30)).values('name')
gremlin> :x

Query with Java Client

In order to connect with Java Client, the following dependencies have to be added into Java dependency.
The following is an example of connection Gremlin Server.
public class TestGraphBinaryMessageSerializerV1 {
public static void main(String[] args) throws Exception {
Cluster cluster = Cluster.build().addContactPoint("").create();
Client client = cluster.connect();
GraphTraversalSource g = AnonymousTraversalSource.traversal()
.withRemote(DriverRemoteConnection.using(client, "g"));

Query with Python Client

It is recommended to use official gremlin-python client.
python3 -m pip install gremlinpython
After installation, you can query the local Gremlin server using the the native driver.
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
# ['ripple', 'lop', 'josh', 'peter', 'vadas', 'marko']
# ['vadas', 'peter', 'marko', 'josh']
# ['josh', 'vadas']
It is also possible to submit the query directly so that the query string is consistent with the one used in the Gremlin console.
from gremlin_python.driver import client
result_set = client.submit('g.V().values("name")')
# ['ripple', 'lop', 'marko', 'peter', 'vadas', 'josh']
result_set = client.submit('g.V().hasLabel("person").values("name")')
#['marko', 'vadas', 'peter', 'josh']

Query using Cypher

PuppyGraph also provides an embedded Cypher console.
The output will be like this
Welcome to PuppyGraph, type help to see the command list
[PuppyGraph]> cypher-console
(o o)
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
==>opencypher.gremlin activated
==>Configured localhost/
==>All scripts will now be sent to Gremlin Server - [localhost/] - type ':remote console' to return to local mode
Here is a sample query that matches the Gremlin query above. Make sure to include :> prefix in the cypher query input text.
:> MATCH (p:person) RETURN p.name
Output will be like this:
gremlin> :> MATCH (p:person) RETURN p.name
Last modified 11d ago