I tried running my scripts to create the graph, and then with the server 
running, I tried connecting via the console and can run the function.  The 
console where I'm running the server prints out the messages showing that 
it created edges, but the edges aren't being actually added to my 
database...

OrientDB console v.2.2.10 (build 
2.2.x@rc32d4ee06d4c38e27eb66931d027eb54854872ff; 2016-09-15 08:47:27+0000) 
www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

*orientdb>* CONNECT REMOTE:localhost/test-add_edge_by_date.orientdb admin 
admin

Connecting to database [REMOTE:localhost/test-add_edge_by_date.orientdb] 
with user 'admin'...OK
*orientdb {db=test-add_edge_by_date.orientdb}>* select from V

+----+-----+--------+-------------------+----+
|#   |@RID |@CLASS  |date               |id  |
+----+-----+--------+-------------------+----+
|0   |#25:0|myVertex|2014-01-02 00:00:00|A   |
|1   |#26:0|myVertex|2015-01-02 00:00:00|B   |
|2   |#27:0|myVertex|2016-01-02 00:00:00|C   |
|3   |#28:0|myVertex|2013-06-01 00:00:00|D   |
|4   |#29:0|myVertex|2014-06-01 00:00:00|E   |
|5   |#30:0|myVertex|2016-06-01 00:00:00|F   |
+----+-----+--------+-------------------+----+

6 item(s) found. Query executed in 0.004 sec(s).
*orientdb {db=test-add_edge_by_date.orientdb}> *select from E


0 item(s) found. Query executed in 0.002 sec(s). 

*orientdb {db=test-add_edge_by_date.orientdb}>* select 
createSameDayOfYearEdges()

+----+
|#   |
+----+
|0   |
+----+

1 item(s) found. Query executed in 0.031 sec(s).


This gets printed to the console:

2016-09-21 15:55:37:703 INFO  {db=test-add_edge_by_date.orientdb} Create 
edge from #25:0 to #26:0. [ScriptObjectMirror]
2016-09-21 15:55:37:708 INFO  {db=test-add_edge_by_date.orientdb} Create 
edge from #26:0 to #27:0. [ScriptObjectMirror]
2016-09-21 15:55:37:709 INFO  {db=test-add_edge_by_date.orientdb} Create 
edge from #28:0 to #29:0. [ScriptObjectMirror]


... but querying for edges still comes up empty:
 

*orientdb {db=test-add_edge_by_date.orientdb}>* select from E


0 item(s) found. Query executed in 0.001 sec(s).

If I run the same select createSameDayOfYearEdges() call from within 
Studio, I see the same messages on the console, but the edges actually get 
saved.  I can see this on the console if I query for edges again:

*orientdb {db=test-add_edge_by_date.orientdb}>* select from E

+----+-----+-------------+-----+-----+
|#   |@RID |@CLASS       |out  |in   |
+----+-----+-------------+-----+-----+
|0   |#33:0|sameDayOfYear|#28:0|#29:0|
|1   |#39:0|sameDayOfYear|#25:0|#26:0|
|2   |#40:0|sameDayOfYear|#26:0|#27:0|
+----+-----+-------------+-----+-----+

3 item(s) found. Query executed in 0.002 sec(s).


Soooo... any ideas why the edges aren't being saved when I run it from the 
console?

-William



On Wednesday, September 21, 2016 at 3:29:10 PM UTC-6, Ivan Mainetti wrote:
>
> 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 <eval> at line number 2
>>>>      Error: <eval>: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.

Reply via email to