Can't remove embedded list item from 3 levels down

56 views
Skip to first unread message

boro...@gmail.com

unread,
Oct 12, 2016, 1:32:35 AM10/12/16
to OrientDB
Hello,

I have an embedded list implemented 3 levels down (3 embeddings from the root class). I seem to have a problem removing just inserted list element. I followed the examples in the manual and it works on a single embedding fine, but in my case it just fails. See below:

// added record
update #25:0 add settings.leads.TempLead.overrideProperties = {"@type":"d", "@class":"PropertyOverride", "standardProperty":"utilityCompany", "customProperty":"utilityProvider"}

orientdb {db=Customers}> select settings.leads.TempLead.overrideProperties from #25:0
+----+------------------+
|#   |settings          |
+----+------------------+
|0   |[PropertyOverride]|
+----+------------------+

// trying to remove it
orientdb {db=Customers}> update #25:0 remove settings.leads.TempLead.overrideProperties = settings.leads.TempLead.overrideProperties[0]

Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:
update #25:0 remove settings.leads.TempLead.overrideProperties = settings.leads.TempLead.overrideProperties[0]
                            ^
Encountered " "." ". "" at line 1, column 29.

The "overrideProperties" property was created as EmbeddedMap
create property LeadClass.overrideProperties EMBEDDEDLIST PropertyOverride (NOTNULL TRUE)


Am I doing the remove command correctly? Why is it complaining about a "." between the 'settings' and 'leads'? It is the same exact path to the inserted element as was used in the "add" command above.

I'm using OrientDB 2.2.10

Thanks.

user.w...@gmail.com

unread,
Oct 12, 2016, 2:35:08 AM10/12/16
to OrientDB
Hi,

can you post you schema? I don't understand very well your structure. 

Regards,
Michela

boro...@gmail.com

unread,
Oct 12, 2016, 11:47:25 AM10/12/16
to OrientDB
Hi Michela, here are the schemas starting from the most inner class and up all the way to account. 

// Property Override
create class PropertyOverride extends V
create property PropertyOverride.standardProperty STRING (NOTNULL TRUE)
create property PropertyOverride.customProperty STRING (NOTNULL TRUE)
create property PropertyOverride.customValues EMBEDDEDMAP STRING (NOTNULL TRUE)

// Class Override
create class LeadClass extends V
create property LeadClass.template STRING (NOTNULL TRUE)
create property LeadClass.booleanTrue STRING (NOTNULL TRUE, COLLATE "ci")
create property LeadClass.booleanFalse STRING (NOTNULL TRUE, COLLATE "ci")
create property LeadClass.dateFormat STRING (NOTNULL TRUE, COLLATE "ci")
create property LeadClass.timestampFormat STRING (NOTNULL TRUE, COLLATE "ci")
create property LeadClass.overrideProperties EMBEDDEDLIST PropertyOverride (NOTNULL TRUE)

// Account Settings
create class AccountSettings extends V
create property AccountSettings.leads EMBEDDEDMAP LeadClass

// Account
create class Account extends V
create property Account.id INTEGER (DEFAULT "sequence('accountId').next()", READONLY TRUE)
create property Account.created DATETIME (DEFAULT "sysdate()", READONLY TRUE)
create property Account.active BOOLEAN (NOTNULL TRUE, DEFAULT FALSE)
create property Account.company STRING (NOTNULL TRUE, MANDATORY TRUE, MIN 2, MAX 50, COLLATE "ci")
create property Account.settings EMBEDDED AccountSettings

The #25:0 (in the original post) is the actual Account record. What I'm trying to do is to simply add/remove PropertyOverride embedded classes to the LeadClass.overrideProperties embedded list in the LeadClass. I could add it easy as mentioned before, but when I tried to remove it I ran into exceptions. All is done in the terminal. Thanks for helping to figure it out.

Oleksandr Gubchenko

unread,
Oct 12, 2016, 12:16:28 PM10/12/16
to orient-...@googlegroups.com
Can you add an insert that you are using to originally create the #25:0 ?

Thanks.

Oleksandr Gubchenko

unread,
Oct 12, 2016, 12:21:25 PM10/12/16
to OrientDB
Is this issue similar to your case? Can you confirm?

boro...@gmail.com

unread,
Oct 13, 2016, 1:37:25 AM10/13/16
to OrientDB
Hi Oleksandr,

Interesting, I think it is similar or related to that issue of 5703. When I wrapped the whole string into `` characters it worked, or kind of worked. Check this out:

orientdb {db=Tetraop}> update #25:0 remove `settings.leads.TempLead.overrideProperties[0]`
Updated record(s) '1' in 0.001000 sec(s).

orientdb
{db=Tetraop}> select settings.leads.TempLead.overrideProperties from #25:0

+----+------------------------------------+

|#   |settings                            |

+----+------------------------------------+

|0   |[PropertyOverride{customValues:[1]}]|

+----+------------------------------------+


It appears as it removed the record, but when I did a select, the record is still there. That's false positive

orientdb {db=Tetraop}> update #25:0 remove `settings.leads.TempLead.overrideProperties` = settings.leads.TempLead.overrideProperties[0]
Updated record(s) '1' in 0.002000 sec(s).

orientdb
{db=Tetraop}> select settings.leads.TempLead.overrideProperties from #25:0                               +----+--------+

|#   |settings|

+----+--------+

|0   |[]      |

+----+--------+


Now it removed the record and the list is empty. This behavior raises 3 questions:
  1. Why do we need to use `` if this issues seemed to be fixed in the issue 5703
  2. Is the first way a legit way to remove list items? If so, why did it give false positive?
  3. What is the right and bullet proof way to remove embedded list items?

For your previous request, this is how I did the insert:

update #25:0 add settings.leads.TempLead.overrideProperties = {"@type":"d", "@class":"PropertyOverride", "standardProperty":"utilityCompany", "customProperty":"utilityProvider"}

Thanks for looking into this.

Luigi Dell'Aquila

unread,
Oct 13, 2016, 2:58:33 AM10/13/16
to orient-...@googlegroups.com
Hi guys,

Ok, it's correct, it "kind of" works because of some internal corner cases, but it's definitely a dirty work around :-D 
Anyway, I'll fix the main problem in next days

Thanks

Luigi

--

---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

boro...@gmail.com

unread,
Oct 13, 2016, 12:23:35 PM10/13/16
to OrientDB
Thanks Luigi. Shall it be filed as a bug?

To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.

Luigi Dell'Aquila

unread,
Oct 13, 2016, 12:51:57 PM10/13/16
to orient-...@googlegroups.com
Yes, please

Thanks

Luigi

To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.

boro...@gmail.com

unread,
Oct 14, 2016, 11:33:57 AM10/14/16
to OrientDB
Bug submitted.
Reply all
Reply to author
Forward
0 new messages