Hi Erik,
I'm afraid I don't completely understand your model:
- how are the edges directed? From parent to child or from child to parent?
- are File and Folder two different classes that extend V?
- what does the "file" property represent? Is it a string or what?
If I got it right, you have many alternatives to do this, one is as follows:
TRAVERSE in('scopedEdge') FROM (
SELECT expand(in('scopeEdge')
) FROM V WHERE file IS NOT NULL
or
SELECT FROM V
WHERE out("scopedEdge").size() > 0
or
MATCH
{class:File, where:(file is not null)} <-scopedEdge- {} <-scopedEdge-
{as:folder, while:(true)}
RETURN $elements
I hope it helps
Thanks
Luigi
2017-06-19 15:15 GMT+02:00 Erik T <[email protected]>:
> I have a tree with 5 vertices
>
> Folder (a)
> / \
> (b) File Folder (c)
> / \
> (d) File Folder (e)
>
> I would like to retrieve the folders that contain a file. So I want to get
> back (a) and (c) from my query. The edges are lightweight edges and are
> labeled 'scopeEdge'. I placed a property on the files in my tree and
> labeled them 'file'. These queries don't work
>
> select out from V where file is not null --> gives back temporary vertices
>
> select from V where out('scopeEdge').file is not null --> gives back (a),
> (b), (c), (d), and (e)
>
> I can get 1 query to work but its really complicated. It makes me think
> I'm doing something wrong. Is there something easier than this?
>
> SELECT FROM (TRAVERSE in('scopedEdge') FROM (SELECT FROM #RID# WHERE file IS
> NOT NULL)) WHERE $depth > 0 --> gives back (a) and (c)
>
>
>
> --
>
> ---
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.