DOCUMENT START NON-TERMINALS SPARQLUpdate := Prologue ( ( Update | Manage ) )* Update := ( Modify | Insert | Delete | Load | Clear ) Modify := ( GraphIRI )* ConstructTemplate ConstructTemplate ( WhereClause )? Delete := ( DeleteData | DeleteTemplate ) DeleteData := ( ( )? IRIref )* ConstructTemplate DeleteTemplate := ( ( )? IRIref )* ConstructTemplate ( WhereClause )? Insert := ( InsertData | InsertTemplate ) InsertData := ( ( )? IRIref )* ConstructTemplate InsertTemplate := ( ( )? IRIref )* ConstructTemplate ( WhereClause )? GraphIRI := IRIref Load := ( IRIref )+ ( IRIref )? Clear := ( GraphIRI )? Manage := ( Create | Drop ) Create := ( )? GraphIRI Drop := ( )? GraphIRI // void Transaction() : {} // { // TransBegin() | TransCommit() | TransAbort() // } // // void TransBegin() : {} // { // (IRIref())? // { System.out.println("++ Begin") ; } // } // // void TransCommit() : {} // { // (IRIref())? // { System.out.println("++ Commit") ; } // } // // void TransAbort() : {} // { // (IRIref())? // { System.out.println("++ Abort") ; } // } Prologue := ( BaseDecl )? ( PrefixDecl )* BaseDecl := IRI_REF PrefixDecl := IRI_REF WhereClause := ( )? GroupGraphPattern // ---- General Graph Pattern GroupGraphPattern := ( TriplesBlock )? ( ( GraphPatternNotTriples | Filter ) ( )? ( TriplesBlock )? )* TriplesBlock := TriplesSameSubject ( ( TriplesBlock )? )? // ----- GraphPatternNotTriples := ( OptionalGraphPattern | GroupOrUnionGraphPattern | GraphGraphPattern ) // ---- Definitions of each pattern element OptionalGraphPattern := GroupGraphPattern GraphGraphPattern := VarOrIRIref GroupGraphPattern // G (union G)* can be a single group pattern // or a group pattern as part of an union. GroupOrUnionGraphPattern := GroupGraphPattern ( GroupGraphPattern )* Filter := Constraint Constraint := ( BrackettedExpression | BuiltInCall | FunctionCall ) FunctionCall := IRIref ArgList ArgList := ( | Expression ( Expression )* ) // -------- Construct patterns ConstructTemplate := ( ConstructTriples )? ConstructTriples := TriplesSameSubject ( ( ConstructTriples )? )? // -------- Triple lists with property and object lists TriplesSameSubject := VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList PropertyListNotEmpty := Verb ObjectList ( ( Verb ObjectList )? )* PropertyList := ( PropertyListNotEmpty )? // // Recursive // void PropertyListNotEmpty(Node s, TripleCollector acc) : { Node p ; } // { // p = Verb() // ObjectList(s, p, acc) // ( PropertyList(s, acc) ) ? // #ifdef ARQ // | // Reification(s, acc) // #endif // } // // Recursive // void ObjectList(Node s, Node p, TripleCollector acc): { Node o ; } // { // { int mark = acc.mark() ; } // o = GraphNode(acc) // { insert(acc, mark, s, p, o) ; } // ( ObjectList(s, p , acc) )? // } ObjectList := Object ( Object )* Object := GraphNode Verb := ( VarOrIRIref | ) // -------- Triple expansions // Anything that can stand in a node slot and which is // a number of triples TriplesNode := Collection | BlankNodePropertyList BlankNodePropertyList := PropertyListNotEmpty // ------- RDF collections Collection := ( GraphNode )+ // -------- Nodes in a graph pattern or template GraphNode := VarOrTerm | TriplesNode VarOrTerm := ( Var | GraphTerm ) // Property (if no bNodes) + DESCRIBE VarOrIRIref := ( Var | IRIref ) // // GRAPH and property if including blank nodes are properties. // Node VarOrBlankNodeOrIRIref() : {Node n = null ; } // { // ( n = Var() | n = BlankNode() | n = IRIref() ) // { return n ; } // } Var := ( | ) GraphTerm := IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | // -------- Constraint syntax Expression := ConditionalOrExpression ConditionalOrExpression := ConditionalAndExpression ( ConditionalAndExpression )* ConditionalAndExpression := ValueLogical ( ValueLogical )* ValueLogical := RelationalExpression RelationalExpression := NumericExpression ( NumericExpression | NumericExpression | NumericExpression | NumericExpression | NumericExpression | NumericExpression )? NumericExpression := AdditiveExpression AdditiveExpression := MultiplicativeExpression ( MultiplicativeExpression | MultiplicativeExpression | NumericLiteralPositive | NumericLiteralNegative )* MultiplicativeExpression := UnaryExpression ( UnaryExpression | UnaryExpression )* UnaryExpression := PrimaryExpression | PrimaryExpression | PrimaryExpression | PrimaryExpression PrimaryExpression := ( BrackettedExpression | BuiltInCall | IRIrefOrFunction | RDFLiteral | NumericLiteral | BooleanLiteral | Var ) BrackettedExpression := Expression BuiltInCall := Expression | Expression | Expression Expression | Expression | Var | Expression Expression | Expression | Expression | Expression | Expression | RegexExpression RegexExpression := Expression Expression ( Expression )? // The case of "q:name()" or just "q:name" // by expanding out FunctionCall() IRIrefOrFunction := IRIref ( ArgList )? RDFLiteral := String ( ( ) | ( IRIref ) )? NumericLiteral := ( NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative ) NumericLiteralUnsigned := | | NumericLiteralPositive := | | NumericLiteralNegative := | | BooleanLiteral := | String := ( | | | ) IRIref := IRI_REF | PrefixedName PrefixedName := ( | ) BlankNode := | IRI_REF := DOCUMENT END