Created
February 6, 2014 23:17
-
-
Save jbmusso/8854526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Proposal: transactions over the Gremlin extension | |
var tx = new Transaction(); // g.begin(); | |
var v1 = tx.g.addVertex('v1', {name: 'Alice'}); | |
var v2 = tx.g.addVertex('v2', {name: 'Bob'}); | |
tx.g.addEdge(v1, v2, 'knows', {since: '1970'}); | |
// And/or, alternatively: | |
var tx = new Transaction(); | |
tx.g.addVertex('v1', {name: 'Alice'}); | |
tx.g.addVertex('v2', {name: 'Bob'}); | |
tx.g.addEdge('v1', 'v2', 'knows', {since: '1970'}); // Graph elements references passed as strings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks good. My preference would be to allow both styles. The top one provides a reference to the vertex. So if I decide to add more properties before sending the transaction I could. i.e.
The second one allows for chaining, so I could do something like:
I assume that the addEdge method finalises the transaction. I would suggest providing a
tx.commit()
or when chainingso that the user determines when to send the transaction.
Frank