Re: [orientdb] Referential integrity

2015-11-02 Thread DmitriR
Luigi - Thanks a lot! The schema query is perfect. 

Dmitri


On Nov 2, 2015, at 5:16 AM, Luigi Dell'Aquila  
wrote:

> Hi Dmitri,
> 
> if you have a full schema defined you can query it with
> 
> select customFields from (
> select 
> expand(classes
> ) from metadata:schema 
> ) where name="YourClassName"
> 
> and
> 
> select customFields from (
>   select 
> expand
> (properties) from (
>  select 
> expand(classes
> ) from metadata:schema 
>   ) where name="YourClassName"
> ) where name="PropertyName"
> 
> If you have partial or no schema defined, you can use FIND REFERENCES command 
> 
> http://orientdb.com/docs/last/SQL-Find-References.html
> 
> Just take into consideration  that it scans the whole database, so it's very 
> inefficient
> 
> Thanks
> 
> Luigi
> 
> 
> 2015-10-30 22:15 GMT+01:00 :
> Luigi - Thank you. I understand the tradeoff. 
> 
> OK, I have to manage this manually. What is the best way?
> 
> Is there any way to query the schema and find out which objects have fields 
> that reference a particular class? (so that I can NULL them and then remove 
> the class)
> 
> Regarding using Graph type: yes, maybe. But I really like the simple dot 
> notation as it works with LINKs. I think it is very elegant. (I take my 
> syntactic sugar wherever I find it)
> 
> 
> On Friday, October 30, 2015 at 3:55:07 AM UTC-4, Luigi Dell'Aquila wrote:
> Hi Dmitri,
> 
> Document layer does not manage link consistency, just for a matter of 
> performance, but Graph layer does (eg. it removes dangling edges when you 
> delete a vertex). My advice is to use edges instead of links, it will also 
> give you another advantage, that is having bi-directional traversal of 
> pointers
> 
> Thanks
> 
> Luigi
> 
> 
> 2015-10-30 2:47 GMT+01:00 :
> Hello, 
> 
> This question was asked in 2013, and Luca's reply was as follows:
> 
> On Monday, May 20, 2013 at 6:20:24 PM UTC-4, Lvc@ wrote:If you remove a 
> document is your responsibility to clean all the references.
> 
> Does this answer still hold? If yes, how can I find all the references to a 
> class that is about to be deleted? (or what is the recommended way of 
> otherwise dealing with this issue?)
> 
> I am using 2.1.2 (trying it out) and I was quite amazed to find that the 
> database allowed me to drop the referenced class and kept the RID of the 
> referenced object (dangling pointer, basically). 
> 
> The scary thing was that once I created (and populated) another class, the 
> cluster id was reused, and the RID happily pointed to a new, entirely 
> unrelated object. 
> 
> Thanks!
> Dmitri
> 
> 
> 
> -- 
> 
> --- 
> 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-databa...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 
> --- 
> 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.
> 
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "OrientDB" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/orient-database/IZp9Qw7Kgps/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> orient-database+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 

--- 
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.


Re: [orientdb] Referential integrity

2015-11-02 Thread Luigi Dell'Aquila
Hi Dmitri,

if you have a full schema defined you can query it with

select customFields from (
select expand(classes) from metadata:schema
) where name="YourClassName"

and

select customFields from (
  select expand(properties) from (
 select expand(classes) from metadata:schema
  ) where name="YourClassName"
) where name="PropertyName"

If you have partial or no schema defined, you can use FIND REFERENCES
command

http://orientdb.com/docs/last/SQL-Find-References.html

Just take into consideration  that it scans the whole database, so it's
very inefficient

Thanks

Luigi


2015-10-30 22:15 GMT+01:00 :

> Luigi - Thank you. I understand the tradeoff.
>
> OK, I have to manage this manually. What is the best way?
>
> Is there any way to query the schema and find out which objects have
> fields that reference a particular class? (so that I can NULL them and then
> remove the class)
>
> Regarding using Graph type: yes, maybe. But I really like the simple dot
> notation as it works with LINKs. I think it is very elegant. (I take my
> syntactic sugar wherever I find it)
>
>
> On Friday, October 30, 2015 at 3:55:07 AM UTC-4, Luigi Dell'Aquila wrote:
>>
>> Hi Dmitri,
>>
>> Document layer does not manage link consistency, just for a matter of
>> performance, but Graph layer does (eg. it removes dangling edges when you
>> delete a vertex). My advice is to use edges instead of links, it will also
>> give you another advantage, that is having bi-directional traversal of
>> pointers
>>
>> Thanks
>>
>> Luigi
>>
>>
>> 2015-10-30 2:47 GMT+01:00 :
>>
>>> Hello,
>>>
>>> This question was asked in 2013, and Luca's reply was as follows:
>>>
>>> On Monday, May 20, 2013 at 6:20:24 PM UTC-4, Lvc@ wrote:If you remove a
 document is your responsibility to clean all the references.

>>>
>>> Does this answer still hold? If yes, how can I find all the references
>>> to a class that is about to be deleted? (or what is the recommended way of
>>> otherwise dealing with this issue?)
>>>
>>> I am using 2.1.2 (trying it out) and I was quite amazed to find that the
>>> database allowed me to drop the referenced class and kept the RID of the
>>> referenced object (dangling pointer, basically).
>>>
>>> The scary thing was that once I created (and populated) another class,
>>> the cluster id was reused, and the RID happily pointed to a new, entirely
>>> unrelated object.
>>>
>>> Thanks!
>>> Dmitri
>>>
>>>
>>> --
>>>
>>> ---
>>> 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-databa...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>
> ---
> 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.
>

-- 

--- 
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.


Re: [orientdb] Referential integrity

2015-10-30 Thread Luigi Dell'Aquila
Hi Dmitri,

Document layer does not manage link consistency, just for a matter of
performance, but Graph layer does (eg. it removes dangling edges when you
delete a vertex). My advice is to use edges instead of links, it will also
give you another advantage, that is having bi-directional traversal of
pointers

Thanks

Luigi


2015-10-30 2:47 GMT+01:00 :

> Hello,
>
> This question was asked in 2013, and Luca's reply was as follows:
>
> On Monday, May 20, 2013 at 6:20:24 PM UTC-4, Lvc@ wrote:If you remove a
>> document is your responsibility to clean all the references.
>>
>
> Does this answer still hold? If yes, how can I find all the references to
> a class that is about to be deleted? (or what is the recommended way of
> otherwise dealing with this issue?)
>
> I am using 2.1.2 (trying it out) and I was quite amazed to find that the
> database allowed me to drop the referenced class and kept the RID of the
> referenced object (dangling pointer, basically).
>
> The scary thing was that once I created (and populated) another class, the
> cluster id was reused, and the RID happily pointed to a new, entirely
> unrelated object.
>
> Thanks!
> Dmitri
>
>
> --
>
> ---
> 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.
>

-- 

--- 
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.


Re: [orientdb] Referential integrity

2015-10-30 Thread xzfqnx
Luigi - Thank you. I understand the tradeoff. 

OK, I have to manage this manually. What is the best way?

Is there any way to query the schema and find out which objects have fields 
that reference a particular class? (so that I can NULL them and then remove 
the class)

Regarding using Graph type: yes, maybe. But I really like the simple dot 
notation as it works with LINKs. I think it is very elegant. (I take my 
syntactic sugar wherever I find it)


On Friday, October 30, 2015 at 3:55:07 AM UTC-4, Luigi Dell'Aquila wrote:
>
> Hi Dmitri,
>
> Document layer does not manage link consistency, just for a matter of 
> performance, but Graph layer does (eg. it removes dangling edges when you 
> delete a vertex). My advice is to use edges instead of links, it will also 
> give you another advantage, that is having bi-directional traversal of 
> pointers
>
> Thanks
>
> Luigi
>
>
> 2015-10-30 2:47 GMT+01:00 :
>
>> Hello, 
>>
>> This question was asked in 2013, and Luca's reply was as follows:
>>
>> On Monday, May 20, 2013 at 6:20:24 PM UTC-4, Lvc@ wrote:If you remove a 
>>> document is your responsibility to clean all the references.
>>>
>>
>> Does this answer still hold? If yes, how can I find all the references to 
>> a class that is about to be deleted? (or what is the recommended way of 
>> otherwise dealing with this issue?)
>>
>> I am using 2.1.2 (trying it out) and I was quite amazed to find that the 
>> database allowed me to drop the referenced class and kept the RID of the 
>> referenced object (dangling pointer, basically). 
>>
>> The scary thing was that once I created (and populated) another class, 
>> the cluster id was reused, and the RID happily pointed to a new, entirely 
>> unrelated object. 
>>
>> Thanks!
>> Dmitri
>>
>>
>> -- 
>>
>> --- 
>> 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-databa...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
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.