Problem inserting properties for Vertex's properties using a groovy script

34 views
Skip to first unread message

ic...@onematch.com.br

unread,
Jun 16, 2016, 4:13:23 PM6/16/16
to Aurelius
Hello there,

I'm trying to add some Vertex and Edges for my Titan Instance reading data from a csv file...
Trying to insert a property (which is a ETL date) for some Vertex property via groovy script nothing happens, the gremlin just insert the vertex propery... but when I do the same process in a Gremlin REPL it works perfectly.

My code is something like above:

Is exact the same that I execute in a Gremlin REPL terminal, and it works well

def getOrCreate( id, type ) {
  def p = g.V().has('internal_id',id)
  return (p.hasNext()) ? p.next() : graph.addVertex(T.label, type, 'some_id', id)
}

new File('../data/sample-file.dat').text.eachLine { line ->
  def (id, label, key, value, etl_date) = line.split(/:/).toList()
  def vertex = getOrCreate(id, label)
  vertex.property(key, value)
  g.V(vertex).properties(key).property('etl_date',etl_date)
}



Daniel Kuppitz

unread,
Jun 16, 2016, 4:17:41 PM6/16/16
to aureliu...@googlegroups.com
Problem:   Whatever ... but when I do the same process in a Gremlin REPL it works perfectly.
Solution:  .iterate() your query.

Cheers,
Daniel


--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/417ae7a4-3958-4ea7-a626-9ed235ed404c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Mallette

unread,
Jun 16, 2016, 4:33:09 PM6/16/16
to Aurelius

ic...@onematch.com.br

unread,
Jun 17, 2016, 10:22:57 AM6/17/16
to Aurelius
Thank you Daniel and Stephen!

It helped me a lot.

Cheers,
Icaro
Reply all
Reply to author
Forward
0 new messages