DOCUMENT START NON-TERMINALS CompilationUnit := Query Query := Prolog ( SelectClause | ConstructClause | DescribeClause | AskClause ) ( WhereClause )? ( LimitClause )? Prolog := ( BaseDecl )? ( PrefixDecl )* BaseDecl := QuotedURIref PrefixDecl := ( QuotedURIref | QuotedURIref ) // ---- Query type clauses SelectClause := ( ( )? ) DescribeClause := ( ( VarOrURI )+ | ) ConstructClause := ConstructTemplate AskClause := WhereClause := ( )? GraphPattern LimitClause := // ---- General Graph Pattern // Basic building block. GraphPattern := PatternElement ( PatternElement )* ( )? // ---- All the elements that can make up a pattern PatternElement := ( Triples | OptionalGraphPattern | UnionGraphPattern | GraphPattern | GraphGraphPattern | Constraint ) // ---- Definitions of each pattern element OptionalGraphPattern := GraphPattern GraphGraphPattern := ( GraphPattern | VarOrURI GraphPattern ) UnionGraphPattern := GraphPattern ( GraphPattern )* Constraint := Expression // -------- Construct patterns ConstructTemplate := Triples ( Triples )* ( )? // -------- Triple lists with property and object lists // The grammar construct between the DOTs Triples := VarOrTerm PropertyList | TriplesNode ( PropertyList )? PropertyList := ( VarOrURI | ) ObjectList ( PropertyList )* | Reification ObjectList := ( VarOrTerm | TriplesNode ) ( ObjectList )* // -------- Triple expansions // Anything that can stand in a node slot and which is // a number of triples TriplesNode := Collection | BlankNodePropertyList | Reification BlankNodePropertyList := PropertyList Reification := "<<" GraphNode GraphNode GraphNode ">>" // ------- RDF collections Collection := CollectionTail CollectionTail := ( GraphNode CollectionTail | ) // -------- Nodes in a graph pattern or template GraphNode := VarOrTerm | TriplesNode VarOrTerm := ( Var | GraphTerm ) // Property + DESCRIBE VarOrURI := ( Var | URI ) Var := GraphTerm := RDFTerm | // Constraint syntax follows. // **** Debug point Expression := ConditionalOrExpression ConditionalOrExpression := ConditionalXorExpression ( ConditionalXorExpression )* ConditionalXorExpression := ConditionalAndExpression ConditionalAndExpression := ValueLogical ( ValueLogical )* // End of boolean expressions ValueLogical := RelationalExpression RelationalExpression := NumericExpression ( NumericExpression | NumericExpression | NumericExpression | NumericExpression | NumericExpression | NumericExpression )? // **** Debug point NumericExpression := AdditiveExpression AdditiveExpression := MultiplicativeExpression ( MultiplicativeExpression | MultiplicativeExpression )* MultiplicativeExpression := UnaryExpression ( UnaryExpression | UnaryExpression )* UnaryExpression := ( | ) CallExpression | CallExpression | CallExpression | CallExpression CallExpression := Expression | Expression | Expression | Expression String ( String )? | Var | Expression | Expression | Expression | FunctionCall | PrimaryExpression PrimaryExpression := ( Var | RDFTerm | Expression ) FunctionCall := URI ArgList ArgList := ( Expression ( Expression )* )? // Term as used in expressions RDFTerm := URI | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode NumericLiteral := Integer | FloatingPoint RDFLiteral := String ( )? ( URI )? BooleanLiteral := | String := ( | ) URI := QuotedURIref | QName QName := ( | ) BlankNode := | QuotedURIref := Integer := FloatingPoint := DOCUMENT END