[orientdb] Re: Calling a custom function from the console?
Ah! Thanks! On Thursday, September 22, 2016 at 9:05:33 AM UTC-6, alessand...@gmail.com wrote: > > Hi, > in your function createSameDayOfYearEdges you must insert g.commit() and > it works also from console. > > Best regards, > Alessandro > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[orientdb] Re: Calling a custom function from the console?
Hi, in your function createSameDayOfYearEdges you must insert g.commit() and it works also from console. Best regards, Alessandro -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[orientdb] Re: Calling a custom function from the console?
that's definitely the issue! JS functions are *server side functions *so they are interpreted by the running server Il giorno mercoledì 21 settembre 2016 23:19:08 UTC+2, William ha scritto: > > Hi Ivan, > > I'm running 2.2.10-community under OSX. > > I'm not running server when I try it... could that be part of the issue? > > -William > > > > On Wednesday, September 21, 2016 at 2:43:06 PM UTC-6, Ivan Mainetti wrote: >> >> Hi, >> which version of Orientdb are you using?* I'm trying on 2.2.10 and not >> getting that error.* >> >> >> Il giorno mercoledì 21 settembre 2016 22:16:21 UTC+2, William ha scritto: >>> >>> Hi, >>> >>> I have a simple graph with date information on each node in which the >>> vertices are: >>> >>> id,date >>> A,2014-01-02 >>> B,2015-01-02 >>> C,2016-01-02 >>> D,2013-06-01 >>> E,2014-06-01 >>> F,2016-06-01 >>> >>> I'm trying to put together something that would let me generate edges >>> between nodes that occur on some date to a node with the same date on the >>> following year. For the vertices above, I'd end up with: >>> >>> A -> B -> C >>> D -> E >>> F >>> >>> I have put together a quick and dirty JS function to do this called >>> createSameDayOfYearEdges(). I add it into the graph using a console call >>> that executes a CREATE FUNCTION call. If I fire up Studio after creating >>> the graph from my scripts, its there and running the query "SELECT >>> createSameDayOfYearEdges()" works properly... but if I try to run it using >>> that SELECT from the console it does not work. The error message I'm >>> seeing says: >>> >>> >>> orientdb {db=test-add_edge_by_date.orientdb}> SELECT >>> createSameDayOfYearEdges() >>> >>> Error: >>> com.orientechnologies.orient.core.command.script.OCommandScriptException: >>> Error on parsing script at position #0: Error on execution of the script >>> Script: createSameDayOfYearEdges >>> --^ >>> DB name="test-add_edge_by_date.orientdb" >>> >>> Error: javax.script.ScriptException: TypeError: orient.getGraph is >>> not a function in at line number 2 >>> Error: :2 TypeError: orient.getGraph is not a function >>> >>> >>> This is a little confusing to me, it would appear that it's trying to >>> execute the script but I'm getting an error... >>> >>> Is it possible to get my function to run from the console, or do I need >>> to approach something like this differently? >>> >>> Thanks! >>> -William >>> >> -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[orientdb] Re: Calling a custom function from the console?
Hi, which version of Orientdb are you using? Il giorno mercoledì 21 settembre 2016 22:16:21 UTC+2, William ha scritto: > > Hi, > > I have a simple graph with date information on each node in which the > vertices are: > > id,date > A,2014-01-02 > B,2015-01-02 > C,2016-01-02 > D,2013-06-01 > E,2014-06-01 > F,2016-06-01 > > I'm trying to put together something that would let me generate edges > between nodes that occur on some date to a node with the same date on the > following year. For the vertices above, I'd end up with: > > A -> B -> C > D -> E > F > > I have put together a quick and dirty JS function to do this called > createSameDayOfYearEdges(). I add it into the graph using a console call > that executes a CREATE FUNCTION call. If I fire up Studio after creating > the graph from my scripts, its there and running the query "SELECT > createSameDayOfYearEdges()" works properly... but if I try to run it using > that SELECT from the console it does not work. The error message I'm > seeing says: > > > orientdb {db=test-add_edge_by_date.orientdb}> SELECT > createSameDayOfYearEdges() > > Error: > com.orientechnologies.orient.core.command.script.OCommandScriptException: > Error on parsing script at position #0: Error on execution of the script > Script: createSameDayOfYearEdges > --^ > DB name="test-add_edge_by_date.orientdb" > > Error: javax.script.ScriptException: TypeError: orient.getGraph is > not a function in at line number 2 > Error: :2 TypeError: orient.getGraph is not a function > > > This is a little confusing to me, it would appear that it's trying to > execute the script but I'm getting an error... > > Is it possible to get my function to run from the console, or do I need to > approach something like this differently? > > Thanks! > -William > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.