hi

If you store the depth of the path as an integer property of each child, 
you can then restrict you query by the depth below a parent as well.

Cheers

T

On Monday, June 25, 2012 12:35:11 PM UTC+8, gor wrote:
>
> the parent_path property could work. thanks.
>
> On Monday, June 25, 2012 11:49:12 AM UTC+8, timh wrote:
>>
>> Hi
>>
>> Here is one approach you could use.
>>
>> In each entity store a list of paths of each parent.  ie in second 
>> scenario
>>
>> H has a list property called parent_paths it would have the following 
>> values ['/a/g','/a'] and its children would have ['/a','/a/g','/a/g/h'] etc
>>
>> Then given any entity you can fetch all levels of descendants. So in your 
>> example  you just need to query for any entity
>> that has '/a/g/h'  in its parent_paths.  This doesn't allow you to 
>> restrict depth though.
>>
>> Cheers
>>
>> Tim
>>
>> On Monday, June 25, 2012 11:17:50 AM UTC+8, gor wrote:
>>>
>>> *Scenario 1:*
>>> If I have a Great Grandpa ancestor (let's name him A); And my key is 
>>> from "child1"; is there a way to check that my great grandpa is A? (hope I 
>>> can do that without needing to loop)
>>>
>>> Or can I check, if child1's key is of the path "A->B->C".
>>> *A -> B -> C -> (child1, child2...)*
>>>
>>> *Scenario 2:*
>>> From the above. Great Grandpa has another descendants from "G", and 
>>> would like to retrieve "H"s children:
>>>
>>> *A-> B -> C -> (children of C)*
>>> *...-> G -> H -> (children of H)*
>>>
>>> I like to retrieve "H"s children, thinking that Grandpa knows the path 
>>> from A, G, to H... can I do that? (hope I can do this in a query, without 
>>> looping)
>>>
>>> If you have a Go1 example: that would be awesome... 
>>>
>>> Thanks Google! and I love you!
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/mp0GXxN-Bb8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to