// Several examples of simple gremlin commands

g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      valueMap()
      
g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      elementMap()
      
g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      elementMap().
      unfold()

g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      elementMap().
      toList().
      each {
        l -> println ""
             l.each {
                k,v -> println "${k} = ${v}"
                }
        }; null

g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      out().
      has('lbl', 'candidate').
      valueMap()

// Get data (from HBase) attached in 'candidate's       
g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      out().
      has('lbl', 'candidate').
      out().
      has('lbl', 'datalink').
      each {
        println(Lomikel.getDataLink(it))
        }

g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      out().
      has('lbl', 'cutout').g.V().has('lbl', 'source').
      has('objectId', 'ZTF18abimyys').
      out().
      has('lbl', 'alert').
      out().
      has('lbl', 'candidate').
      out().
      has('lbl', 'datalink').
      each {
        println(Lomikel.getDataLink(it))
        }
      out().
      has('lbl', 'datalink').
      each {
        println(Lomikel.getDataLink(it))
        }

// Geometric searches
FinkBrowser.geosearch(g, 230, 30, 0.2, 2459601.03, 2459601.04, 10).elementMap().unfold()  
FinkBrowser.geosearch(g, 230, 30, 0.2, 2459601.03, 2459601.04, 10).in().elementMap().unfold()  
FinkBrowser.geosearch(g, 230, 30, 0.2, 2459601.03, 2459601.04, 10).in().in().elementMap().unfold()  
FinkBrowser.geosearch(g, 230, 30, 0.2, 2459601.03, 2459601.04, 10).in().in().out().elementMap().unfold()
 
// Candidate searches
FinkBrowser.candidates(g, 'ZTF18aagsirm')
