W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2004

text grammar for DAWG ql AndyS 2004-09-20

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Fri, 24 Sep 2004 12:28:52 +0100
To: "RDF Data Access Working Group" <public-rdf-dawg@w3.org>, "Seaborne, Andy" <andy.seaborne@hp.com>
Message-Id: <20040924122852.20246df6@hoth.ilrt.bris.ac.uk>

Here's a text version of the original grammar AndyS had in
http://lists.w3.org/Archives/Public/public-rdf-dawg/2004JulSep/0511.html
(pretty much lynx -nolinks -dump dawg.html with some line wrapping, plus
grepping out the terminals)

You can diff this and what I had in 
  http://lists.w3.org/Archives/Public/public-rdf-dawg/2004JulSep/0524.html
to see what I changed

Dave

                           BNF for DAWG QL

                            NON-TERMINALS

CompilationUnit ::= Query <EOF>

CommaOpt ::= ( <COMMA> )?

Query ::= ( PrefixDecl )* ( SelectClause |
         ConstructClause |
         DescribeClause |
         AskClause ) ( PrefixDecl )* ( FromClause )? ( <WHERE> GraphPattern )?

SelectClause ::= ( <SELECT> VarAsNode ( CommaOpt VarAsNode )* |
         <SELECT> <STAR> )

DescribeClause ::= ( <DESCRIBE> VarOrURI ( CommaOpt VarOrURI )* |
         <DESCRIBE> <STAR> )

ConstructClause ::= ( <CONSTRUCT> ConstructPattern |
         <CONSTRUCT> <STAR> )

ConstructPattern ::= TriplePatternList

AskClause ::= <ASK>

FromClause ::= <FROM> FromSelector ( CommaOpt FromSelector )*

FromSelector ::= URL

GraphPattern ::= PatternGroup

SourceGraphPattern ::= ( <SOURCE> <STAR> PatternGroup1 |
         <SOURCE> VarOrURI PatternGroup1 )

OptionalGraphPattern ::= ( <OPTIONAL> PatternGroup1 |
         <LBRACKET> PatternGroup <RBRACKET> )

PatternGroup ::= PatternElement ( PatternElement )*

PatternElement ::= ( TriplePatternList |
         ExplicitGroup |
         PatternElementForms )

PatternGroup1 ::= PatternElement1

PatternElement1 ::= ( SingleTriplePatternOrGroup |
         PatternElementForms )

PatternElementForms ::= ( SourceGraphPattern |
         OptionalGraphPattern |
         <AND> Expression )

SingleTriplePatternOrGroup ::= ( TriplePattern |
         ExplicitGroup )

ExplicitGroup ::= <LPAREN> PatternGroup <RPAREN>

TriplePatternList ::= TriplePattern ( TriplePattern )*

TriplePattern ::= <LPAREN> VarOrURI VarOrURI VarOrLiteral <RPAREN>

VarOrURI ::= ( VarAsNode |
         URI )

VarOrLiteral ::= ( VarAsNode |
         Literal )

VarAsNode ::= <VAR>

VarAsExpr ::= <VAR>

PrefixDecl ::= ( <PREFIX> <NCNAME> <COLON> QuotedURI |
         <PREFIX> <COLON> QuotedURI )

Expression ::= ConditionalOrExpression

ConditionalOrExpression ::= ConditionalXorExpression ( <SC_OR> ConditionalXorExpression )*

ConditionalXorExpression ::= ConditionalAndExpression

ConditionalAndExpression ::= ValueLogical ( <SC_AND> ValueLogical )*

ValueLogical ::= StringEqualityExpression

StringEqualityExpression ::= NumericalLogical ( <STR_EQ> NumericalLogical |
         <STR_NE> NumericalLogical |
         <STR_MATCH> PatternLiteral |
         <STR_NMATCH> PatternLiteral )*

NumericalLogical ::= EqualityExpression

EqualityExpression ::= RelationalExpression ( <EQ> RelationalExpression |
         <NEQ> RelationalExpression )?

RelationalExpression ::= NumericExpression ( <LT> NumericExpression |
         <GT> NumericExpression |
         <LE> NumericExpression |
         <GE> NumericExpression )?

NumericExpression ::= ShiftExpression

ShiftExpression ::= AdditiveExpression

AdditiveExpression ::= MultiplicativeExpression ( <PLUS> MultiplicativeExpression |
         <MINUS> MultiplicativeExpression )*

MultiplicativeExpression ::= UnaryExpression ( <STAR> UnaryExpression |
         <SLASH> UnaryExpression |
         <REM> UnaryExpression )*

UnaryExpression ::= ( <PLUS> UnaryExpressionNotPlusMinus |
         <MINUS> UnaryExpressionNotPlusMinus |
         UnaryExpressionNotPlusMinus )

UnaryExpressionNotPlusMinus ::= ( <TILDE> |
         <BANG> ) UnaryExpression |
         PrimaryExpression

PrimaryExpression ::= ( VarAsExpr |
         Literal |
         FunctionCall |
         <LPAREN> Expression <RPAREN> )

FunctionCall ::= <AMP> <QNAME> <LPAREN> ArgList <RPAREN>

ArgList ::= ( VarOrLiteral ( <COMMA> VarOrLiteral )* )?

Literal ::= URI |
         NumericLiteral |
         TextLiteral

NumericLiteral ::= <INTEGER_LITERAL> |
         <FLOATING_POINT_LITERAL>

TextLiteral ::= ( <STRING_LITERAL1> |
         <STRING_LITERAL2> ) ( <LANG> )? ( <DATATYPE> URI )?

PatternLiteral ::=

URL ::= URI

URI ::= QuotedURI |
         QName

QName ::= <QNAME>

QuotedURI ::= <URI>


Terminals

<AMP>
<AND>
<ASK>
<BANG>
<COLON>
<COMMA>
<CONSTRUCT>
<DATATYPE>
<DESCRIBE>
<EOF>
<EQ>
<FLOATING_POINT_LITERAL>
<FROM>
<GE>
<GT>
<INTEGER_LITERAL>
<LANG>
<LBRACKET>
<LE>
<LPAREN>
<LT>
<MINUS>
<NCNAME>
<NEQ>
<OPTIONAL>
<PLUS>
<PREFIX>
<QNAME>
<RBRACKET>
<REM>
<RPAREN>
<SC_AND>
<SC_OR>
<SELECT>
<SLASH>
<SOURCE>
<STAR>
<STRING_LITERAL1>
<STRING_LITERAL2>
<STR_EQ>
<STR_MATCH>
<STR_NE>
<STR_NMATCH>
<TILDE>
<URI>
<VAR>
<WHERE>
Received on Friday, 24 September 2004 11:31:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:20 GMT