Giter Club home page Giter Club logo

Comments (5)

davebshow avatar davebshow commented on September 26, 2024

I'm a bit confused here. The section just above the one from the link you pasted has an example connecting to the server with Cluster: http://goblin.readthedocs.io/en/latest/driver.html#connecting-to-a-cluster.

The driver docs also have examples: http://aiogremlin.readthedocs.io/en/latest/usage.html#using-the-driver-module

from goblin.

StanYaha avatar StanYaha commented on September 26, 2024

Yes. I want to know if i can insert Vertex and Edges with Cluster!

from goblin.

davebshow avatar davebshow commented on September 26, 2024

Sure you can. You can submit any script to the server with Cluster. For creating vertices and edges I would use the addV and addE steps. Alternatively, you could use the GLV to create vertices and edges.

Using Cluster:

import asyncio
from aiogremlin import Cluster
loop = asyncio.get_event_loop()

cluster = await Cluster.open(loop)
client = await cluster.connect()
result_set = await client.submit("g.addV('person').property('name','stephen')")
results = await result_set.all()
await client.close()  # closes underlying cluster

With the GLV:

from aiogremlin import DriverRemoteConnection
remote_connection = await DriverRemoteConnection.open('ws://localhost:8182/gremlin', 'g')
g = Graph().traversal().withRemote(remote_connection)
stephen = await g.addV('person').property('name','stephen').next()
await remote_connection.close()

from goblin.

StanYaha avatar StanYaha commented on September 26, 2024

Thank you!
My leader ask me to write restful api with goblin, so front-end developer can call it with url
Do you have any suggestions?I am really confused!

from goblin.

davebshow avatar davebshow commented on September 26, 2024

Well, you would have to create a regular REST API. The business logic behind the resources would use goblin to make calls to the DB, and the data would have to be serialized and sent as a response to the client.

from goblin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.