Skip to content

Commit

Permalink
Added more examples #107 #122
Browse files Browse the repository at this point in the history
  • Loading branch information
krlawrence authored Mar 16, 2019
1 parent c759ff4 commit 9015d5f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sample-code/glv-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const gremlin = require('gremlin');
const Graph = gremlin.structure.Graph;
const __ = gremlin.process.statics;
const { t: { id }, order,cardinality,column,scope } = gremlin.process;
const { t: { id }, order,cardinality,column,scope,P } = gremlin.process;

// Note that if we just wanted to import 'decr' rather than all of order we could do:
// const { order: { decr } } = gremlin.process;
Expand All @@ -37,7 +37,7 @@ async function runTests() {
const texas = await
g.V().has('region','US-TX').
values('city').
order().by(order.decr).
order().
toList();
console.log("Airports in Texas");
console.log(texas);
Expand All @@ -49,6 +49,13 @@ async function runTests() {
toList();
console.log("Route counts for airports in Texas");
console.log(runways);

const most_runways = await
g.V().has('runways',P.gt(5)).
order().by('runways',order.decr).
local(__.values('code','runways').fold()).toList();
console.log("Airports with the most runways");
console.log(most_runways);
} catch(e) {
console.error(`Something went wrong:\n ${e}`);
} finally {
Expand All @@ -69,3 +76,5 @@ async function runTests() {
}());




0 comments on commit 9015d5f

Please sign in to comment.