Hi,

Mabey something more simple like this

MATCH (u1:People { name: "MYname" }),(u2:People { name: "myfriend" }), 
knowledgePath = allShortestPaths(u1-[:KNOWS*..4]-(u2)) WITH nodes(
knowledgePath) AS knowledgeNodes,u1,u2 MATCH users-[:ASSOCIATED_TO]->(
profile) WITH profile,knowledgeNodes,u1,u2 WITH extract(users IN 
knowledgeNodes | profile.name) AS knowledge RETURN DISTINCT head(knowledge);

Den måndagen den 31:e mars 2014 kl. 14:46:45 UTC+2 skrev Michael Azerhad:
>
> Hi,
>
> Let's assume this beginning of Cypher query, aiming to retrieve all 
> shortest paths (regarding knowledge) between two users:
>
> MATCH (u1:User {id: "1"}), (u2:User {id: "2"}), knowledgePath 
> =allShortestPaths
> (u1-[:KNOWS*..4]-(u2))
>
> Besides, each User is linked to a UserProfile node in the graph through 
> the relationship ASSOCIATED_TO.
>
> So, what I want is to end up retrieving the UserProfile's firstName 
> property and  UserProfile's lastName property of each knowledge, including 
> the boundaries (the 2 extreme users).
>
> I tried this:
>
> MATCH (u1:User {id: "1"}), (u2:User {id: "2"}), knowledgePath 
> =allShortestPaths
> (u1-[:KNOWS*..4]-(u2))
> WITH nodes(knowledgePath) as knowledgeNodes
> RETURN extract(users in knowledgeNodes | extract( p in users-[:
> ASSOCIATED_TO]->() | last(nodes(p)))) as knowledge
>
>
> This returns me a collection of each UserProfile Node (each whole node) 
> .....
>
> My preference would be:
> As my specification evoked above, returning collection of only some 
> UserProfile's properties for each knowledge. (firstName AND lastName)
>
> A better preference would be:
> Not returning a collection of knowledge (with good properties as expected) 
> at once in one record, but rather distinct records, each one containing 
> (firstName, LastName)
>
> What could I do to do the trick?
>
> Thanks a lot,
>
> Michael 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" 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.

Reply via email to