On Thu, Dec 8, 2011 at 9:56 AM, Rickard Öberg <
rickard.ob...@neotechnology.com> wrote:

> Here's a problem I had recently: I have an organizational structure
>
defined as a tree. On each level there might be cases assigned for
> completion.
>
> Given a OU I want to find all OU's that has the given OU as root, and
> then all the cases associated with those OU's, and then perform some
> operation on them. For example: "For all cases handled in Department X
> (or any subdepartments of X), calculate average completion time".
>
> I'm guessing something like this:
> start ou=node(1234)
> match (ou)-[:CHILD_OU*..100]->(child_ou)<-[:OWNER]-(case)
> where case.status = "CLOSED"
> return avg(case.completionTime)
>
> Question is, will the OU itself be included? Or does this imply that
> there *has* to be a child-OU?


That query does imply that there has to be a child-OU. The minimal length
for a path where you haven't specified anything manually is one. You can be
explicit about the fact that children are not needed by saying that min
length of the path is
zero<http://docs.neo4j.org/chunked/snapshot/query-match.html#match-zero-length-paths>.


Andrés
_______________________________________________
NOTICE: THIS MAILING LIST IS BEING SWITCHED TO GOOGLE GROUPS, please register 
and consider posting at https://groups.google.com/forum/#!forum/neo4j

Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to