Skip to content

Instantly share code, notes, and snippets.

@jmfloreszazo
Last active October 28, 2022 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmfloreszazo/2727c64e43534e7cfc5fc1b1e6564827 to your computer and use it in GitHub Desktop.
Save jmfloreszazo/2727c64e43534e7cfc5fc1b1e6564827 to your computer and use it in GitHub Desktop.
dotNetMLG2022
// Clear All
g.E().drop()
g.V().drop()
// Create vertices
g.addV('Employees').property('id', 'Disnesh').property('age', 28).property('occupation', 'Software designer').property('born', 'ISB').property('city', 'SJC')
g.addV('Employees').property('id', 'Gilfoyle').property('age', 30).property('occupation', 'VP of Architecture').property('born', 'YUL') .property('city', 'SJC')
g.addV('Employees').property('id', 'Richard').property('age', 29).property('occupation', 'CEO').property('born', 'OKC').property('city', 'SJC')
g.addV('Employer').property('id', 'Pied Piper').property('founded', '2014').property('city', 'SJC')
// Create edges
g.V().has('id', 'Disnesh').addE('worksAt').property('weekends', true).to(g.V().has('id', 'Pied Piper'))
g.V().has('id', 'Gilfoyle').addE('worksAt').to(g.V().has('id', 'Pied Piper'))
g.V().has('id', 'Richard').addE('worksAt').property('weekends', true).to(g.V().has('id', 'Pied Piper'))
g.V().has('id', 'Richard').addE('manages').to(g.V().has('id', 'Disnesh'))
g.V().has('id', 'Richard').addE('manages').to(g.V().has('id', 'Gilfoyle'))
// Show samples
g.V()
g.E()
// Who works at Pied Piper (i.e.; which vertices have worksAt edges pointing to Pied Piper)?
g.V('id', 'Pied Piper').in('worksAt')
// Where does Alan work (i.e.; which vertices have worksAt edges pointed to by Gilfoyle)?
g.V('id', 'Gilfoyle').out('worksAt')
// What are all of Richard's outgoing relationships (i.e; which vertices have any edges pointed to by Richard)?
g.V('id', 'Richard').out()
// Get RUs form SQL
SELECT * FROM c
// Get RUs form Graph
g.V()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment