About parsing to AST

56 views
Skip to first unread message

卓鑫雲

unread,
Jun 22, 2022, 10:57:37 AM6/22/22
to openCypher
Dear all,
I am a postgraduate student and my project is to implement the cypher to my own engine. I read the code for several days and still have some questions. Hope to get some help. Thanks very much. 
I run the function like this, and then get the result: 
Query(SingleQuery(List(Match(false,Pattern(List(EveryPath(RelationshipChain(NodePattern(Some(Variable(movie)),Some(Leaf(LabelName(Movie))),None,None),RelationshipPattern(None,Some(Leaf(RelTypeName(ACTED_IN))),None,None,None,INCOMING),NodePattern(Some(Variable(actor)),Some(Leaf(LabelName(Actor))),None,None))))),List(),None))))
Is this the final AST? I have this question because The type of To.statement is ast.statement, not a tree.
q1.png

To know the meaning of the result, I find the definition of Match. But I don't know the meaning of optional, hints, position.  
q2.png




Arne Fischereit

unread,
Jun 23, 2022, 9:20:25 AM6/23/22
to openCypher
Hi again,

Thank you for your interest in the Cypher front end.

Regarding your questions:
  • Yes, the result of `statement()` is a `Statement` which is the type of the root node in our AST. All nodes in the AST extend the trait `ASTNode`. Those are the nodes in the AST.
  • The documentation on Cypher should give you ample information to start with on what an optional match or a hint is.
I hope that gave you some clarification for you immediate issues.

Cheers,

Arne

卓鑫雲

unread,
Jun 23, 2022, 11:36:42 AM6/23/22
to openCypher
Thank you so much, I will see more about that.

卓鑫雲

unread,
Jul 5, 2022, 4:29:20 PM7/5/22
to openCypher
Hi Arne,
Can I ask after I get the statement, how can I get the parameter within this statement? Do I need to split the statement by myself? OR I think after parsing, there will be a node "Match" and also other objects generated. Then if I can get that, I can get the value by for example, Match.option. I guess the function dup(children) is related but I don't know how to use it, since it needs a parameter children.

Kind regard,
zhuo

Reply all
Reply to author
Forward
0 new messages