Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "MATCH" clause by default when we chain "->match()" method #106

Open
aguidis opened this issue May 2, 2016 · 0 comments
Open

Add a "MATCH" clause by default when we chain "->match()" method #106

aguidis opened this issue May 2, 2016 · 0 comments

Comments

@aguidis
Copy link

aguidis commented May 2, 2016

Hi,

I would like to have your opinion on the way of adding MATCH clauses. At the moment, when we chain ->match() methods you add a comma, to separate the patterns.

It seems that this way of chaining MATCH patterns (with a comma) works well with basic patterns like (node1)-[:directRelation]->(node2). But in my case, I would like to match nodes (with specific labels) which are not directly connected to other nodes (with a different label).

I'm facing a problem with this kind of request:

match (list:List)-[:contains]->(product:Product)
where (ID(list) IN [740])
match (product:Product)-[*]->(product_sector:ProductSector),(product:Product)-[*]->(product_family:ProductFamily),(rating:Rating)-[:object]->(product:Product),(rating:Rating)-[:hasType]->(group:RatingGroup)
where (ID(group) IN [730])
return product.name AS name,product_sector.name AS product_sector,product_family.name AS product_family,group.name AS type, rating.numericalValue AS value

I would like to fetch all products contained in a specific list and I want to match other node information related to each Product like ProductSector, ProductSector but I only want Products which have a Rating and where the ratings belong to a specific RatingGroup.

With this syntax I have "no rows" as result.

I found out (thanks to the nice answers on this topic)
that the use of a comma in a MATCH clause means that we are looking for multiple connected patterns. Example :

MATCH (a)-->(b)<--(c), (b)-->(d) is the equivalent of MATCH (a)-->(b)<--(c)-->(d)

But in my case, I'm looking for unconnected patterns. As inside each MATCH clause, each relationship will be traversed only once, I edited the Cypher.php in order to add automatically a MATCH clause by default.

Moreover I don't use the func_get_args because we lose the ability of supplying default values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant