Concatenate Linklists

#1

Regarding the documentation:
V 3.0 has a new || operator that allows to concatenate lists and sets:
(…)
or to concatenate multiple values:

UPDATE AClass SET aListProperty = aListProperty || [“a value to add”, “another value”]

I tried this with linklists

  
 CREATE CLASS first_list EXTENDS V
 CREATE CLASS second_list EXTENDS V
 CREATE PROPERTY first_list.second_list LINKLIST second_list
 CREATE VERTEX first_list CONTENT {"label":0,"second_list":[]}   --> #34:0
 --  create second_list verttices ... # 41:n .. 48:n

update #34:0 set  second_list = second_list || ["#43:1", "#44:1", "#45:1", "#46:1", "#47:1", "#48:1", "#41:2", "#42:2", "#43:2", "#44:2"]    return after @this
ERROR->com.orientechnologies.orient.core.exception.OValidationException: 
The field 'first_list.second_list' has been declared as LINKLIST but the value is not a record or a record-id
	DB name="temp"
	Error Code="4"

a single

 INFO->CREATE VERTEX second_list CONTENT {"label":4}
 INFO->update #35:12 set  second_list = second_list || #41:123    return after @this

works perfect.

Expected Behavior? Then this limitation should be mentioned in the documentation

0 Likes

#2

My mistake. Links must not enclosed by “”"

INFO->update #36:12 set  second_list = second_list || [ #47:123, #48:123, #41:124, #42:124, #43:124, #44:124, #45:124, #46:124, #47:124, #48:124 ]   return after @this

works perfect

( https://github.com/topofocus/active-orient/wiki/1:N-Relation)

0 Likes