Skip to content

Instantly share code, notes, and snippets.

@danshev
danshev / first-traversal.graphml
Created May 15, 2022 18:23
First Traversal Query
g.withSack(120).V( DEPARTURE_PORT ).
repeat(
(outE().hasLabel('VOYAGES_TO').
sack(sum).by('duration')).
sack(sum).by(constant(45)
).
inV().simplePath()
).
until(
has('code', CANDIDATE_PORT ).
@danshev
danshev / first-graph-test-data.graphml
Created May 15, 2022 20:18
Some basic info to support development of data model
<graphml xmlns='http://graphml.graphdrawing.org/xmlns'>
<key id='type' for='node' attr.name='type' attr.type='string'></key>
<key id='code' for='node' attr.name='code' attr.type='string'></key>
<key id='desc' for='node' attr.name='desc' attr.type='string'></key>
<key id='author' for='node' attr.name='author' attr.type='string'></key>
<key id='date' for='node' attr.name='date' attr.type='string'></key>
<key id='labelV' for='node' attr.name='labelV' attr.type='string'></key>
<key id='labelE' for='edge' attr.name='labelE' attr.type='string'></key>
<key id='mode' for='edge' attr.name='mode' attr.type='string'></key>
*******************************************************
Neptune Gremlin Profile
*******************************************************
Query String
==================
g.withSack(120).V('BOS').
repeat(
outE().hasLabel('VOYAGES_TO').sack(sum).by('duration').
sack(sum).by(constant(45))
@danshev
danshev / getGremlinClient.ts
Created August 13, 2024 18:08
TypeScript for connecting to AWS Neptune w/ v4 Signature
import { driver, structure, process as gremlinProcess } from 'gremlin';
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
import { getUrlAndHeaders } from 'gremlin-aws-sigv4/lib/utils';
async function getCredentials() {
try {
const provider = fromNodeProviderChain({
clientConfig: { region: process.env.REGION },
});
const credentials = await provider();