Re: [CDO] Allowing (or ignoring) duplicate objects for certain types [message #906413] |
Sat, 01 September 2012 11:40 |
|
Hi Shahim,
Please ask CDO questions on the EMF forum.
Comments below...
Am 01.09.2012 11:25, schrieb Shahim Essaid:
> Hi all,
>
> Is it possible to extend or modify the CDO client and server API to allow for new objects with the same CDOID as one
> already in the repository?
No, that's bad.
> I have few immutable object types that represent statements (logical axioms) and the CDOID is a SHA1 digest of the
> statement type and the named entities in the statement. I want to allow for adding new statements by clients even if
> the same statement is already in the repository.
That's a problem you must solve on the layer where you add these things. You can reuse objects by looking them up by
their SHA1 but you must not simply re-add them and hope that CDO recognizes their identical content.
> In other words, there is only one copy of an instance of a specific statement (because same statements will have the
> same SHA1) and any object that refers to an identical statement should refer to the one already in the repository. Is
> this possible?
No.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Allowing (or ignoring) duplicate objects for certain types [message #906518 is a reply to message #906413] |
Sat, 01 September 2012 18:58 |
Shahim Essaid Messages: 40 Registered: July 2009 |
Member |
|
|
Thank you for the quick answer, Eike. Please see comments below..
>> Is it possible to extend or modify the CDO client and server API to allow for new objects with the same CDOID as one
>> already in the repository?
>No, that's bad.
True, but in my case these objects represent values and I only need to store one definition or representation of the value. Later duplicate objects that are "new" can be safely ignored.
>> I have few immutable object types that represent statements (logical axioms) and the CDOID is a SHA1 digest of the
>> statement type and the named entities in the statement. I want to allow for adding new statements by clients even if
>> the same statement is already in the repository.
>That's a problem you must solve on the layer where you add these things. You can reuse objects by looking them up by
>their SHA1 but you must not simply re-add them and hope that CDO recognizes their identical content.
I was hoping that I might be able to reimplement an interface to get a behavior similar to MySql's "insert ignore ...." for a few of my EMF/CDO types instead of having to constantly check if the object is already in the repository.
Is the duplicate key check done in the IStore? Can I modify the MySq store to ignore duplicates and return the already existing object/revision when a transaction is committed?
Edit: a related question but I can start a new thread if needed. If I have auditing enabled for a repository and I save an object with an SHA1 ID and it is later deleted, what happens if I need to add the same object with the same ID again at a later time? Will that be considered a duplicate (because of the auditing and same ID) or will it be assigned a newer revision as a continuation of the first instance of the object?
Best,
Shahim
[Updated on: Sat, 01 September 2012 19:09] Report message to a moderator
|
|
|
Re: [CDO] Allowing (or ignoring) duplicate objects for certain types [message #906522 is a reply to message #906518] |
Sat, 01 September 2012 19:07 |
|
Hi Shahim,
I'm sorry but I must repeat: I don't think that CDO should care about objects that are equal but not the same. And I
don't think that it's easily possible achieve this in CDO. I can't give any pointers. You'll have to do this in your
application.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 01.09.2012 20:58, schrieb Shahim Essaid:
> Thank you for the quick answer, Eike. Please see comments below..
>
>>> Is it possible to extend or modify the CDO client and server API to allow for new objects with the same CDOID as one
>>> already in the repository?
>> No, that's bad.
> True, but in my case these objects represent values and I only need to store one definition or representation of the
> value. Later duplicate objects that are "new" can be safely ignored.
>
>>> I have few immutable object types that represent statements (logical axioms) and the CDOID is a SHA1 digest of the
>>> statement type and the named entities in the statement. I want to allow for adding new statements by clients even
>>> if the same statement is already in the repository.
>> That's a problem you must solve on the layer where you add these things. You can reuse objects by looking them up by
>> their SHA1 but you must not simply re-add them and hope that CDO recognizes their identical content.
> I was hoping that I might be able to reimplement an interface to get a behavior similar to MySql's "insert ignore
> ...." for a few of my EMF/CDO types instead of having to constantly check if the object is already in the repository.
> Is the duplicate key check done in the IStore? Can I modify the MySq store to ignore duplicates and return the already
> existing object/revision when a transaction is committed?
>
> Best,
> Shahim
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.05401 seconds