Hello,

If neo4j will allow the following 
allshortestPaths(rootTopic-[:Seller]->()<-[:Buyer]-sellerCompanyTopic) that 
would be very useful.

MATCH 
(sellerCompanyTopic:Company)-[rel:Seller]->(sr:SalesRelation)-[rel2:Buyer]-(buyer:Company),
 
sr<-[pa:PriceAgreement]-(contract:Contract)
WHERE ((contract.ContractEndDate >= 635796943890000000) AND 
(contract.ContractStartDate <= 635796943890000000)
 AND (pa.EndDate >= 635796951430000000) AND (pa.StartDate <= 
635796951430000000))
MATCH (rootTopic:Company) WHERE rootTopic.ID = 172086
OPTIONAL MATCH p = 
allshortestPaths(rootTopic-[:Seller|Buyer*]-sellerCompanyTopic)
WITH rootTopic, sellerCompanyTopic, buyer, contract,  
reduce(
index = 0, 
rel IN relationships(p)| 
case 
when index % 2 = 0 AND type(rel) = 'Buyer'
then -1000
when index % 2 = 1 AND type(rel) = 'Seller'
then -1000
ELSE index + 1
END
) AS Related
WHERE rootTopic = sellerCompanyTopic OR rootTopic = buyer OR Related > 0
RETURN distinct buyer.ID AS BuyerTopicID, contract.ID AS ContractTopicID, 
case 
when Related is null
then 1
when Related < 0
then 0
when rootTopic = buyer
then 0
ELSE Related
END AS Depth
ORDER BY BuyerTopicID, ContractTopicID

Best Regards,
Ryan

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