ammar.M01.source-code.basic-grammar.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2015-2016 "Neo Technology," Network Engine for Objects in Lund AB [http://neotechnology.com] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE grammar [ <!ENTITY WS "<non-terminal ref='WS'/>"> <!ENTITY SP "<non-terminal ref='SP'/>"> <!ENTITY expr "<non-terminal ref='Expression'/>"> <!ENTITY var "<non-terminal ref='Variable'/>"> ]> <grammar language="Cypher Basic Grammar" xmlns="http://opencypher.org/grammar" xmlns:rr="http://opencypher.org/railroad" xmlns:oc="http://opencypher.org/opencypher"> <!-- / WHERE \ --> <production name="Where" rr:inline="true"> WHERE &SP; &expr; </production> <!-- \ WHERE / --> <!-- / PATTERNS \ --> <production name="Pattern"> <non-terminal ref="PatternPart"/> <repeat> , <non-terminal ref="PatternPart"/></repeat> </production> <production name="PatternPart" rr:inline="true"> <alt> <seq>&var; &WS; = &WS;<non-terminal ref="AnonymousPatternPart"/></seq> <non-terminal ref="AnonymousPatternPart"/> </alt> </production> <production name="AnonymousPatternPart" rr:inline="true"> <alt> <non-terminal ref="ShortestPathPattern"/> <non-terminal ref="PatternElement"/> </alt> </production> <production name="ShortestPathPattern" rr:inline="true" oc:legacy="true"> <alt> <seq>shortestPath ( <non-terminal ref="PatternElement"/> )</seq> <seq>allShortestPaths ( <non-terminal ref="PatternElement"/> )</seq> </alt> </production> <production name="PatternElement"> <alt> <seq> <non-terminal ref="NodePattern"/> <repeat>&WS; <non-terminal ref="PatternElementChain"/></repeat> </seq> <seq>( <non-terminal ref="PatternElement"/> )</seq> </alt> </production> <production name="NodePattern"> ( &WS; <opt>&var; &WS;</opt> <opt><non-terminal ref="NodeLabels"/> &WS;</opt> <opt><non-terminal ref="Properties"/> &WS;</opt> ) </production> <production name="PatternElementChain" rr:inline="true"> <non-terminal ref="RelationshipPattern"/> &WS; <non-terminal ref="NodePattern"/> </production> <production name="RelationshipPattern"> <alt> <seq> <non-terminal ref="LeftArrowHead" rr:title="<"/> &WS; <non-terminal ref="Dash" rr:title="-"/> &WS; <opt><non-terminal ref="RelationshipDetail"/></opt> &WS; <non-terminal ref="Dash" rr:title="-"/> &WS; <non-terminal ref="RightArrowHead" rr:title=">"/> </seq> <seq> <non-terminal ref="LeftArrowHead" rr:title="<"/> &WS; <non-terminal ref="Dash" rr:title="-"/> &WS; <opt><non-terminal ref="RelationshipDetail"/></opt> &WS; <non-terminal ref="Dash" rr:title="-"/> </seq> <seq> <non-terminal ref="Dash" rr:title="-"/> &WS; <opt><non-terminal ref="RelationshipDetail"/></opt> &WS; <non-terminal ref="Dash" rr:title="-"/> &WS; <non-terminal ref="RightArrowHead" rr:title=">"/> </seq> <seq> <non-terminal ref="Dash" rr:title="-"/> &WS; <opt><non-terminal ref="RelationshipDetail"/></opt> &WS; <non-terminal ref="Dash" rr:title="-"/> </seq> </alt> </production> <production name="RelationshipDetail"> [ <opt>&var;</opt> <opt>?</opt> <opt><non-terminal ref="RelationshipTypes"/></opt> <opt>*<non-terminal ref="RangeLiteral"/></opt> <opt><non-terminal ref="Properties"/></opt> ] </production> <production name="Properties" rr:inline="true"> <alt> <non-terminal ref="MapLiteral"/> <non-terminal ref="Parameter"/> <non-terminal ref="LegacyParameter"/> </alt> </production> <production name="RelType" rr:inline="true" oc:legacy="true"> :<non-terminal ref="RelTypeName"/> </production> <production name="RelationshipTypes" rr:inline="true"> :<non-terminal ref="RelTypeName"/> <repeat>&WS;|<opt>:</opt>&WS;<non-terminal ref="RelTypeName"/></repeat> </production> <production name="NodeLabels" rr:inline="true"> <non-terminal ref="NodeLabel"/> <repeat>&WS;<non-terminal ref="NodeLabel"/></repeat> </production> <production name="NodeLabel" rr:inline="true"> : <non-terminal ref="LabelName"/> </production> <production name="RangeLiteral" rr:inline="true"> &WS; <opt><non-terminal ref="IntegerLiteral"/> &WS;</opt> <opt>.. &WS; <opt><non-terminal ref="IntegerLiteral"/> &WS;</opt></opt> </production> <production name="LabelName" rr:inline="true"> <non-terminal ref="SymbolicName" rr:title="label"/> </production> <production name="RelTypeName" rr:inline="true"> <non-terminal ref="SymbolicName" rr:title="relationship type"/> </production> <!-- \ PATTERNS / --> <!-- / EXPRESSIONS \ --> <production name="Expression"> <non-terminal ref="Expression12"/> </production> <production name="Expression12" rr:inline="true"> <non-terminal ref="Expression11"/> <repeat>&SP; OR &SP;<non-terminal ref="Expression11"/></repeat> </production> <production name="Expression11" rr:inline="true"> <non-terminal ref="Expression10"/> <repeat>&SP; XOR &SP;<non-terminal ref="Expression10"/></repeat> </production> <production name="Expression10" rr:inline="true"> <non-terminal ref="Expression9"/> <repeat>&SP; AND &SP;<non-terminal ref="Expression9"/></repeat> </production> <production name="Expression9" rr:inline="true"> <repeat>&SP; NOT &SP;</repeat> <non-terminal ref="Expression8"/> </production> <production name="Expression8" rr:inline="true"> <non-terminal ref="Expression7"/> <repeat>&WS;<non-terminal ref="PartialComparisonExpression"/></repeat> </production> <production name="Expression7" rr:inline="true"> <non-terminal ref="Expression6"/> <repeat><alt> <seq> &WS; + &WS; <non-terminal ref="Expression6"/></seq> <seq> &WS; - &WS; <non-terminal ref="Expression6"/></seq> </alt></repeat> </production> <production name="Expression6" rr:inline="true"> <non-terminal ref="Expression5"/> <repeat><alt> <seq> &WS; * &WS; <non-terminal ref="Expression5"/></seq> <seq> &WS; / &WS; <non-terminal ref="Expression5"/></seq> <seq> &WS; % &WS; <non-terminal ref="Expression5"/></seq> </alt></repeat> </production> <production name="Expression5" rr:inline="true"> <non-terminal ref="Expression4"/> <repeat> &WS; ^ &WS; <non-terminal ref="Expression4"/></repeat> </production> <production name="Expression4" rr:inline="true"> <repeat><alt>+ -</alt> &WS; </repeat> <non-terminal ref="Expression3"/> </production> <production name="Expression3" rr:inline="true"> <non-terminal ref="Expression2"/> <repeat><alt> <seq> &WS; [ &expr; ] </seq> <seq> &WS; [ <opt>&expr;</opt> .. <opt>&expr;</opt> ] </seq> <seq> <alt> <seq>&WS; =~</seq> <seq>&SP; IN</seq> <seq>&SP; STARTS &SP; WITH</seq> <seq>&SP; ENDS &SP; WITH</seq> <seq>&SP; CONTAINS</seq> </alt> &WS; <non-terminal ref="Expression2"/> </seq> <seq> &SP; IS &SP; NULL </seq> <seq> &SP; IS &SP; NOT &SP; NULL </seq> </alt></repeat> </production> <production name="Expression2" rr:inline="true"> <non-terminal ref="Atom"/> <repeat><alt> <non-terminal ref="PropertyLookup"/> <non-terminal ref="NodeLabels"/> </alt></repeat> </production> <production name="Atom"> <alt> <non-terminal ref="NumberLiteral"/> <non-terminal ref="StringLiteral"/> <non-terminal ref="Parameter"/> <non-terminal ref="LegacyParameter"/> TRUE FALSE NULL <non-terminal ref="CaseExpression"/> <seq>COUNT ( * )</seq> <non-terminal ref="MapLiteral"/> <non-terminal ref="ListComprehension"/> <seq> [ &WS; &expr; &WS; <repeat> , &WS; &expr; &WS; </repeat> ] </seq> <seq>FILTER &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; ) </seq> <seq>EXTRACT &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; <opt>&WS; | &expr;</opt> ) </seq> <non-terminal ref="Reduce"/> <seq>ALL &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; ) </seq> <seq>ANY &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; ) </seq> <seq>NONE &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; ) </seq> <seq>SINGLE &WS; ( &WS; <non-terminal ref="FilterExpression"/> &WS; ) </seq> <non-terminal ref="ShortestPathPattern"/> <non-terminal ref="RelationshipsPattern"/> <non-terminal ref="parenthesizedExpression"/> <non-terminal ref="FunctionInvocation"/> &var; </alt> </production> <production name="Reduce" rr:inline="true" oc:legacy="true"> REDUCE &WS; ( &var; = &expr; , <non-terminal ref="IdInColl"/> | &expr; ) </production> <production name="PartialComparisonExpression" rr:inline="true"> <alt> <seq> <literal value="="/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value="<>"/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value="!="/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value="<"/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value=">"/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value="<="/> &WS; <non-terminal ref="Expression7"/> </seq> <seq> <literal value=">="/> &WS; <non-terminal ref="Expression7"/> </seq> </alt> </production> <production name="parenthesizedExpression" rr:inline="true"> ( &WS; &expr; &WS; ) </production> <production name="RelationshipsPattern" rr:inline="true"> <non-terminal ref="NodePattern"/> <repeat min="1">&WS;<non-terminal ref="PatternElementChain"/></repeat> </production> <production name="FilterExpression"> <non-terminal ref="IdInColl"/> <opt>&WS;<non-terminal ref="Where"/></opt> </production> <production name="IdInColl" rr:inline="true"> &var; &SP; IN &SP; &expr; </production> <production name="FunctionInvocation"> <non-terminal ref="FunctionName"/> &WS; ( &WS; <opt>DISTINCT</opt> <opt>&expr;<repeat>, &WS; &expr;</repeat></opt> &WS; ) </production> <production name="FunctionName" rr:inline="true"> <non-terminal ref="SymbolicName" rr:title="function name"/> </production> <production name="ListComprehension" rr:inline="true"> [ <non-terminal ref="FilterExpression"/> <opt>&WS; | &expr;</opt> ] </production> <production name="PropertyLookup"> &WS; . &WS; <alt> <seq><non-terminal ref="PropertyKeyName"/><alt>? !</alt><!-- !OpCharTail --></seq> <non-terminal ref="PropertyKeyName"/> </alt> </production> <production name="CaseExpression" oc:legacy="true"> <alt> <seq>CASE <repeat min="1">&WS; <non-terminal ref="CaseAlternatives"/></repeat></seq> <seq>CASE &expr; <repeat min="1">&WS; <non-terminal ref="CaseAlternatives"/></repeat></seq> </alt> <opt>&WS; ELSE &WS; &expr;</opt> &WS; END </production> <production name="CaseAlternatives" rr:inline="true" oc:legacy="true"> WHEN &WS; &expr; &WS; THEN &WS; &expr; </production> <production name="Variable" rr:inline="true"> <non-terminal ref="SymbolicName" rr:title="variable"/> </production> <production name="StringLiteral"> <alt> <seq>" <repeat><alt> <character><except literal="\"/><except literal='"'/></character> <non-terminal ref="EscapedChar"/> </alt></repeat> "</seq> <seq>' <repeat><alt> <character><except literal="\"/><except literal="'"/></character> <non-terminal ref="EscapedChar"/> </alt></repeat> '</seq> </alt> </production> <production name="EscapedChar"> \ <alt> \ <!-- Encodes a backslash --> ' <!-- Encodes a single quote --> " <!-- Encodes a double quote --> b <!-- Encodes backspace --> f <!-- Encodes page break of "form feed" --> n <!-- Encodes newline --> r <!-- Encodes Carriage return --> t <!-- Encodes a Tab character --> _ <!-- Encodes underscore --> % <!-- Encodes a precent sign --> <seq> <!-- UTF16 --> u <repeat min="4" max="4"><non-terminal ref="HexDigit"/></repeat> </seq> <seq> <!-- UTF32 --> U <repeat min="8" max="8"><non-terminal ref="HexDigit"/></repeat> </seq> </alt> </production> <production name="NumberLiteral"> <alt> <non-terminal ref="DoubleLiteral"/> <non-terminal ref="IntegerLiteral"/> </alt> </production> <production name="MapLiteral"> { &WS; <opt> <non-terminal ref="PropertyKeyName"/> &WS; : &WS; &expr; &WS; <repeat>, &WS;<non-terminal ref="PropertyKeyName"/> &WS; : &WS; &expr; &WS;</repeat> </opt> } </production> <production name="LegacyParameter" oc:legacy="true"> { &WS; <alt> <non-terminal ref="SymbolicName"/> <non-terminal ref="DecimalInteger"/> </alt> &WS; } </production> <production name="Parameter"> $ <alt> <non-terminal ref="SymbolicName"/> <non-terminal ref="DecimalInteger"/> </alt> </production> <production name="PropertyExpression"> <non-terminal ref="Atom"/> <repeat min="1">&WS;<non-terminal ref="PropertyLookup"/></repeat> </production> <production name="PropertyKeyName" rr:inline="true"> <non-terminal ref="SymbolicName" rr:title="property key"/> </production> <production name="IntegerLiteral"> <alt> <non-terminal ref="HexInteger"/> <non-terminal ref="OctalInteger"/> <non-terminal ref="DecimalInteger"/> </alt> </production> <production name="HexInteger"> 0x <non-terminal ref="HexString"/> </production> <production name="DecimalInteger"> <alt> <seq> <alt>1 2 3 4 5 6 7 8 9</alt> <opt><non-terminal ref="DigitString"/></opt> </seq> 0 </alt> </production> <production name="OctalInteger"> 0 <non-terminal ref="OctalString"/> </production> <production name="HexString"> <repeat min="1"><non-terminal ref="HexDigit"/></repeat> </production> <production name="DigitString"> <repeat min="1"><non-terminal ref="Digit"/></repeat> </production> <production name="OctalString"> <repeat min="1"><non-terminal ref="OctDigit"/></repeat> </production> <production name="HexDigit"> <alt>0 1 2 3 4 5 6 7 8 9 a b c d e f</alt> </production> <production name="Digit" rr:inline="true"> <alt>0 1 2 3 4 5 6 7 8 9</alt> </production> <production name="OctDigit"> <alt>0 1 2 3 4 5 6 7</alt> </production> <production name="DoubleLiteral"> <alt> <non-terminal ref="ExponentDecimalReal"/> <non-terminal ref="RegularDecimalReal"/> </alt> </production> <production name="ExponentDecimalReal"> <alt> <repeat min="1"><alt><non-terminal ref="Digit"/>.</alt></repeat> <non-terminal ref="DecimalInteger" /> </alt> <alt>e E</alt> <alt> <non-terminal ref="DigitString"/> <non-terminal ref="DecimalInteger"/> </alt> </production> <production name="RegularDecimalReal"> <alt> <repeat><non-terminal ref="Digit"/></repeat> <non-terminal ref="DecimalInteger" /> </alt> . <alt> <non-terminal ref="DigitString"/> <non-terminal ref="DecimalInteger" /> </alt> </production> <!-- \ EXPRESSIONS / --> <!-- / UTILITY DEFINITIONS \ --> <production name="SymbolicName"> <alt> <non-terminal ref="UnescapedSymbolicName"/> <non-terminal ref="EscapedSymbolicName"/> </alt> </production> <production name="UnescapedSymbolicName" rr:inline="true"> <non-terminal ref="IdentifierStart"/> <repeat><non-terminal ref="IdentifierPart"/></repeat> </production> <production name="IdentifierStart" rr:inline="true"> <description> Based on the unicode identifier and pattern syntax (http://www.unicode.org/reports/tr31/) And extended with a few characters. </description> <alt> <character set="ID_Start"/> <literal value="_"/> <!-- '_' - LOW LINE --> <literal value="‿"/> <!-- '‿' - UNDERTIE --> <literal value="⁀"/> <!-- '⁀' - CHARACTER TIE --> <literal value="⁔"/> <!-- '⁔' - INVERTED UNDERTIE --> <literal value="︳"/> <!-- '︳' - PRESENTATION FORM FOR VERTICAL LOW LINE --> <literal value="︴"/> <!-- '︴' - PRESENTATION FORM FOR VERTICAL WAVY LOW LINE --> <literal value="﹍"/> <!-- '﹍' - DASHED LOW LINE --> <literal value="﹎"/> <!-- '﹎' - CENTRELINE LOW LINE --> <literal value="﹏"/> <!-- '﹏' - WAVY LOW LINE --> <literal value="_"/> <!-- '_' - FULLWIDTH LOW LINE --> </alt> </production> <production name="IdentifierPart" rr:inline="true"> <description> Based on the unicode identifier and pattern syntax (http://www.unicode.org/reports/tr31/) And extended with a few characters. </description> <alt> <character set="ID_Continue"/> <character set="Sc"/> </alt> </production> <production name="EscapedSymbolicName" rr:inline="true"> <description> Any character except "`", enclosed within `backticks`. Backticks are escaped with double backticks. </description> <repeat min="1"> ` <repeat><character><except literal="`"/></character></repeat> ` </repeat> </production> <production name="WS" rr:skip="true"> <repeat><non-terminal ref='whitespace'/></repeat> </production> <production name="SP" rr:skip="true"> <repeat min="1"><non-terminal ref='whitespace'/></repeat> </production> <production name="whitespace"> <alt> <!-- The code points accepted by Character.isWhitespace(int) in Java --> <!-- ASCII whitespace characters --> <character set="SPACE"/> <!-- SPACE --> <character set="TAB"/> <!-- (Horisontal) Tab --> <character set="LF"/> <!-- Line Feed --> <character set="VT"/> <!-- Vertical Tab --> <character set="FF"/> <!-- Form Feed --> <character set="CR"/> <!-- Carriage Return --> <character set="FS"/> <!-- File Separator --> <character set="GS"/> <!-- Group Separator --> <character set="RS"/> <!-- Record Separator --> <character set="US"/> <!-- Unit Separator --> <!-- Unicode whitespace characters --> <literal value=" "/> <!-- OGHAM SPACE MARK --> <literal value="᠎"/> <!-- MONGOLIAN VOWEL SEPARATOR --> <literal value=" "/> <!-- EN QUAD --> <literal value=" "/> <!-- EM QUAD --> <literal value=" "/> <!-- EN SPACE --> <literal value=" "/> <!-- EM SPACE --> <literal value=" "/> <!-- THREE-PER-EM SPACE --> <literal value=" "/> <!-- FOUR-PER-EM SPACE --> <literal value=" "/> <!-- SIX-PER-EM SPACE --> <literal value=" "/> <!-- PUNCTUATION SPACE --> <literal value=" "/> <!-- THIN SPACE --> <literal value=" "/> <!-- HAIR SPACE --> <literal value="
"/> <!-- LINE SEPARATOR --> <literal value="
"/> <!-- PARAGRAPH SEPARATOR --> <literal value=" "/> <!-- MEDIUM MATHEMATICAL SPACE --> <literal value=" "/> <!-- IDEOGRAPHIC SPACE --> <!-- Other whitespace characters --> <!-- Non-breaking space characters --> <literal value=" "/> <!-- NO-BREAK SPACE --> <literal value=" "/> <!-- FIGURE SPACE --> <literal value=" "/> <!-- NARROW NO-BREAK SPACE --> <!-- Comments are parsed as whitespace --> <non-terminal ref="Comment"/> </alt> </production> <production name="Comment"> <alt> <seq>/* <repeat><alt> <character><except literal="*"/></character> <seq>* <character><except literal="/"/></character></seq> </alt></repeat> */</seq> <seq>// <character> <except literal=" "/> <except literal=" "/> </character> <opt><literal value=" "/></opt> <alt><literal value=" "/><character set="EOI"/></alt> </seq> </alt> </production> <production name="LeftArrowHead"> <alt> < <!-- '<' less-than sign --> ⟨ <!-- '⟨' mathematical left angle bracket --> 〈 <!-- '〈' left angle bracket --> ﹤ <!-- '﹤' small less-than sign --> < <!-- '<' full-width less-than sign --> </alt> </production> <production name="RightArrowHead"> <alt> > <!-- '>' greater-than sign --> ⟩ <!-- '⟩' mathematical left angle bracket --> 〉 <!-- '〉' right angle bracket --> ﹥ <!-- '﹥' small greater-than sign --> > <!-- '>' full-width greater-than sign --> </alt> </production> <production name="Dash"> <alt> - <!-- '‑' hyphen-minus --> ­ <!-- '-' soft hyphen --> ‐ <!-- '-' hyphen --> ‑ <!-- '‐' non-breaking hyphen --> ‒ <!-- '‒' figure dash --> – <!-- '–' en dash --> — <!-- '—' em dash --> ― <!-- '―' horizontal bar --> − <!-- '−' minus sign --> ﹘ <!-- '﹘' small em dash --> ﹣ <!-- '﹣' small hyphen-minus --> - <!-- '-' full-width hyphen-minus --> </alt> </production> <!-- \ UTILITY DEFINITIONS / --> </grammar>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy