Return-Path: X-Original-To: apmail-incubator-jena-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-jena-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 98B938E31 for ; Mon, 5 Sep 2011 12:55:45 +0000 (UTC) Received: (qmail 70382 invoked by uid 500); 5 Sep 2011 12:55:45 -0000 Delivered-To: apmail-incubator-jena-commits-archive@incubator.apache.org Received: (qmail 70353 invoked by uid 500); 5 Sep 2011 12:55:43 -0000 Mailing-List: contact jena-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jena-dev@incubator.apache.org Delivered-To: mailing list jena-commits@incubator.apache.org Received: (qmail 70342 invoked by uid 99); 5 Sep 2011 12:55:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 12:55:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2011 12:55:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3101F23889EB; Mon, 5 Sep 2011 12:55:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1165266 - in /incubator/jena/Jena2/ARQ/trunk: Grammar/ src/com/hp/hpl/jena/sparql/lang/arq/ Date: Mon, 05 Sep 2011 12:55:14 -0000 To: jena-commits@incubator.apache.org From: andy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110905125515.3101F23889EB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: andy Date: Mon Sep 5 12:55:14 2011 New Revision: 1165266 URL: http://svn.apache.org/viewvc?rev=1165266&view=rev Log: (empty) Added: incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt (with props) incubator/jena/Jena2/ARQ/trunk/Grammar/Q.arq incubator/jena/Jena2/ARQ/trunk/Grammar/json-extra.jj Modified: incubator/jena/Jena2/ARQ/trunk/Grammar/arq.jj incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj incubator/jena/Jena2/ARQ/trunk/Grammar/master.jj incubator/jena/Jena2/ARQ/trunk/Grammar/sparql_11.jj incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParserBase.java Added: incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt?rev=1165266&view=auto ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt (added) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt Mon Sep 5 12:55:14 2011 @@ -0,0 +1,10 @@ +Problems: the lexer has moved ahread too far and so: + +JSON +{ "abc" : "def" } +WHERE +{ + ?s ?p ?o +} + +attempts to parse WHERE in JSON more (it's a KeyString) Propchange: incubator/jena/Jena2/ARQ/trunk/Grammar/AFS_json_notes.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/jena/Jena2/ARQ/trunk/Grammar/Q.arq URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/Q.arq?rev=1165266&view=auto ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/Q.arq (added) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/Q.arq Mon Sep 5 12:55:14 2011 @@ -0,0 +1,6 @@ +JSON +{ "abc" : "def" } +WHERE +{ + ?s ?p ?o +} \ No newline at end of file Modified: incubator/jena/Jena2/ARQ/trunk/Grammar/arq.jj URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/arq.jj?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/arq.jj (original) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/arq.jj Mon Sep 5 12:55:14 2011 @@ -56,7 +56,11 @@ void QueryUnit(): { } void Query() : { } { Prologue() - ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() ) + ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() +// #ifdef ARQ +// | JsonTemplateQuery() +// #endif + ) BindingsClause() } void UpdateUnit() : {} Added: incubator/jena/Jena2/ARQ/trunk/Grammar/json-extra.jj URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/json-extra.jj?rev=1165266&view=auto ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/json-extra.jj (added) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/json-extra.jj Mon Sep 5 12:55:14 2011 @@ -0,0 +1,196 @@ +/* Grammar extract - JSON tokens, parser state */ + +// Do \ u inside JavaCC?? + + +TOKEN [IGNORE_CASE] : { } + +void JsonTemplateQuery() : {} +{ + + { token_source.SwitchTo(JSONX) ; } + json() + { token_source.SwitchTo(DEFAULT) ; } +} + + SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + + TOKEN : +{ + < J_ECHAR: "\\" ( "t"|"b"|"n"|"r"|"f"|"\\"|"\""|"'") > + +| < J_STRING: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > +| < #J_AZ: ( ["A"-"Z"] | ["a"-"z"] ) > + +| +| +| + + +// WARNING : This accepts all keywords. +| < J_KEY_STRING: ( | "_") ( | "_" | )* > + +| < #J_DIGITS: (["0"-"9"])+> +| < J_INTEGER: > +| < J_DECIMAL: ( "." ()* | "." ) > +| < J_DOUBLE: // Required exponent. + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > + +| < J_VAR: "?" > + +| < J_POSITIVE_INTEGER: > +| < J_POSITIVE_DECIMAL: > +| < J_POSITIVE_DOUBLE: > + +| < J_NEGATIVE_INTEGER: > +| < J_NEGATIVE_DECIMAL: > +| < J_NEGATIVE_DOUBLE: > + +| < #J_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > + +| < J_LBRACE: "{" > +| < J_RBRACE: "}" > + +| < J_LBRACKET: "[" > +| < J_RBRACKET: "]" > + +| < J_LPAREN: "(" > +| < J_RPAREN: ")" > + +| < J_COMMA: "," > +| < J_COLON: ":" > + +| < J_PLUS: "+" > +| < J_MINUS: "-" > +} + +void json() : {} +{ + { jsonStartParse() ; } + JObject() + { jsonFinishParse() ; } +} + + +void json_any() : {} +{ + { jsonStartParse() ; } + (JValue())? + { jsonFinishParse() ; } +} + + +// ---- Structures + +void JValue() : {} +{ + JSimpleValue() +| JObject() +| JArray() +} + +void JObject() : { } +{ + + { jsonStartObject() ; } + (JMembers())? + { jsonFinishObject(); } + +} + +void JMembers() : {} +{ + JPair() + ( JPair())* +} + +void JPair() : {} +{ + { jsonStartPair() ; } + ( JString() | JKeyString() ) + { jsonKeyPair() ; } + + JValue() + { jsonFinishPair() ; } +} + +void JArray() : {} +{ + + { jsonStartArray() ; } + (JElements())? + { jsonFinishArray() ; } + +} + +void JElements() : { } +{ + JArrayValue() + ( JArrayValue())* +} + +void JArrayValue() : { } +{ + JValue() { jsonElement() ; } +} + +// ---- + +void JSimpleValue() : {} +{ + JString() +| JNumber() +| JTrue() +| JFalse() +| JNull() +} + +void JNumber() : { Token t ; } +{ + t = { jsonValueInteger(t.image) ; } +| t = { jsonValueDecimal(t.image) ; } +| t = { jsonValueDouble(t.image) ; } +| t = { jsonValueInteger(t.image) ; } +| t = { jsonValueDecimal(t.image) ; } +| t = { jsonValueDouble(t.image) ; } +| t = { jsonValueInteger(t.image) ; } +| t = { jsonValueDecimal(t.image) ; } +| t = { jsonValueDouble(t.image) ; } +} + +void JString() : { Token t ; } +{ + t = { jsonValueString(t.image); } +} + +void JKeyString() : { Token t ; } +{ + t = { jsonValueKeyString(t.image); } +} + +void JVar() : { Token t ; } +{ + t = { jsonValueVar(t.image) ; } +} + +void JTrue() : { Token t ; } +{ + { jsonValueBoolean(true) ; } +} + +void JFalse() : { Token t ; } +{ + { jsonValueBoolean(false) ; } +} + +void JNull() : { Token t ; } +{ + { jsonValueNull() ; } +} Modified: incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj (original) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/json.jj Mon Sep 5 12:55:14 2011 @@ -1,272 +1,272 @@ -#if 0 -// (Run through cpp -P -C first) -#endif - -#define PACKAGE org.openjena.atlas.json.io.parserjavacc.javacc -#define CLASS JSON_Parser -#define PARSERBASE JSON_ParserBase - -options -{ - JAVA_UNICODE_ESCAPE = true ; - UNICODE_INPUT = false ; - - STATIC = false ; -// DEBUG_PARSER = true ; -// DEBUG_TOKEN_MANAGER = true ; -} - - -PARSER_BEGIN(CLASS) -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -package PACKAGE ; - -public class CLASS extends PARSERBASE -{ -} -PARSER_END(CLASS) - - -SKIP : { <" " | "\t" | "\n" | "\r" | "\f"> } -TOKEN: { } - -// Do \ u inside JavaCC?? - -//TOKEN [IGNORE_CASE] : -TOKEN : -{ - -| < #QUOTE_3D: "\"\"\""> -| < #QUOTE_3S: "'''"> -| < STRING_LITERAL1: - // Single quoted string - "'" ( (~["'","\\","\n","\r"]) | )* "'" > -| < STRING_LITERAL2: - // Double quoted string - "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > -| < STRING_LITERAL_LONG1: - - ( ("'" | "''")? (~["'","\\"] | ))* - > - -| < STRING_LITERAL_LONG2: - - ( ("\"" | "\"\"")? (~["\"","\\"] | ))* - > - - - - -| < #DIGITS: (["0"-"9"])+> -| < INTEGER: > -| < DECIMAL: ( "." ()* | "." ) > -| < DOUBLE: // Required exponent. - ( - (["0"-"9"])+ "." (["0"-"9"])* - | "." (["0"-"9"])+ () - | (["0"-"9"])+ - ) - > - -| < POSITIVE_INTEGER: > -| < POSITIVE_DECIMAL: > -| < POSITIVE_DOUBLE: > - -| < NEGATIVE_INTEGER: > -| < NEGATIVE_DECIMAL: > -| < NEGATIVE_DOUBLE: > - -| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > - - -| -| -| - -| < LBRACE: "{" > -| < RBRACE: "}" > - -| < LBRACKET: "[" > -| < RBRACKET: "]" > - -| < LPAREN: "(" > -| < RPAREN: ")" > - -| -| - -| -| -} - -// ---- Parser entry points - -void unit() : {} -{ - { startParse() ; } - object() - { finishParse() ; } - -} - - -void any() : {} -{ - { startParse() ; } - (Value())? - { finishParse() ; } - -} - - -// ---- Structures - -void Value() : {} -{ - SimpleValue() -| object() -| Array() -} - -void object() : { } -{ - - { startObject() ; } - (Members())? - { finishObject(); } - -} - -void Members() : {} -{ - Pair() - ( Pair())* -} - -void Pair() : {} -{ - { startPair() ; } - String() - { keyPair() ; } - - Value() - { finishPair() ; } -} - -void Array() : {} -{ - - { startArray() ; } - (Elements())? - { finishArray() ; } - -} - -void Elements() : { } -{ - ArrayValue() - ( ArrayValue())* -} - -void ArrayValue() : { } -{ - Value() { element() ; } -} - -// ---- - -void SimpleValue() : {} -{ - String() -| Number() -| True() -| False() -| Null() -} - -void Number() : { Token t ; } -{ - t = { valueInteger(t.image) ; } -| t = { valueDecimal(t.image) ; } -| t = { valueDouble(t.image) ; } -| t = { valueInteger(t.image) ; } -| t = { valueDecimal(t.image) ; } -| t = { valueDouble(t.image) ; } -| t = { valueInteger(t.image) ; } -| t = { valueDecimal(t.image) ; } -| t = { valueDouble(t.image) ; } -} - -// Token to Java Object : These rules exist to inject the -// necessary Java objects and code for the tokens. -void String() : { Token t ; } -{ - t = { valueString(t.image); } - // -} - -void True() : { Token t ; } -{ - { valueBoolean(true) ; } -} - -void False() : { Token t ; } -{ - { valueBoolean(false) ; } -} - -void Null() : { Token t ; } -{ - { valueNull() ; } -} - - -/* - * (c) Copyright 2008 Hewlett-Packard Development Company, LP - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* -# Local Variables: -# tab-width: 4 -# indent-tabs-mode: nil -# comment-default-style: "//" -# End: -*/ +#if 0 +// (Run through cpp -P -C first) +#endif + +#define PACKAGE org.openjena.atlas.json.io.parserjavacc.javacc +#define CLASS JSON_Parser +#define PARSERBASE JSON_ParserBase + +options +{ + JAVA_UNICODE_ESCAPE = true ; + UNICODE_INPUT = false ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + + +PARSER_BEGIN(CLASS) +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +package PACKAGE ; + +public class CLASS extends PARSERBASE +{ +} +PARSER_END(CLASS) + + +SKIP : { <" " | "\t" | "\n" | "\r" | "\f"> } +TOKEN: { } + +// Do \ u inside JavaCC?? + +//TOKEN [IGNORE_CASE] : +TOKEN : +{ + +| < #QUOTE_3D: "\"\"\""> +| < #QUOTE_3S: "'''"> +| < STRING_LITERAL1: + // Single quoted string + "'" ( (~["'","\\","\n","\r"]) | )* "'" > +| < STRING_LITERAL2: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > +| < STRING_LITERAL_LONG1: + + ( ("'" | "''")? (~["'","\\"] | ))* + > + +| < STRING_LITERAL_LONG2: + + ( ("\"" | "\"\"")? (~["\"","\\"] | ))* + > + + + + +| < #DIGITS: (["0"-"9"])+> +| < INTEGER: > +| < DECIMAL: ( "." ()* | "." ) > +| < DOUBLE: // Required exponent. + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > + +| < POSITIVE_INTEGER: > +| < POSITIVE_DECIMAL: > +| < POSITIVE_DOUBLE: > + +| < NEGATIVE_INTEGER: > +| < NEGATIVE_DECIMAL: > +| < NEGATIVE_DOUBLE: > + +| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > + + +| +| +| + +| < LBRACE: "{" > +| < RBRACE: "}" > + +| < LBRACKET: "[" > +| < RBRACKET: "]" > + +| < LPAREN: "(" > +| < RPAREN: ")" > + +| +| + +| +| +} + +// ---- Parser entry points + +void unit() : {} +{ + { startParse() ; } + object() + { finishParse() ; } + +} + + +void any() : {} +{ + { startParse() ; } + (Value())? + { finishParse() ; } + +} + + +// ---- Structures + +void Value() : {} +{ + SimpleValue() +| object() +| Array() +} + +void object() : { } +{ + + { startObject() ; } + (Members())? + { finishObject(); } + +} + +void Members() : {} +{ + Pair() + ( Pair())* +} + +void Pair() : {} +{ + { startPair() ; } + String() + { keyPair() ; } + + Value() + { finishPair() ; } +} + +void Array() : {} +{ + + { startArray() ; } + (Elements())? + { finishArray() ; } + +} + +void Elements() : { } +{ + ArrayValue() + ( ArrayValue())* +} + +void ArrayValue() : { } +{ + Value() { element() ; } +} + +// ---- + +void SimpleValue() : {} +{ + String() +| Number() +| True() +| False() +| Null() +} + +void Number() : { Token t ; } +{ + t = { valueInteger(t.image) ; } +| t = { valueDecimal(t.image) ; } +| t = { valueDouble(t.image) ; } +| t = { valueInteger(t.image) ; } +| t = { valueDecimal(t.image) ; } +| t = { valueDouble(t.image) ; } +| t = { valueInteger(t.image) ; } +| t = { valueDecimal(t.image) ; } +| t = { valueDouble(t.image) ; } +} + +// Token to Java Object : These rules exist to inject the +// necessary Java objects and code for the tokens. +void String() : { Token t ; } +{ + t = { valueString(t.image); } + // +} + +void True() : { Token t ; } +{ + { valueBoolean(true) ; } +} + +void False() : { Token t ; } +{ + { valueBoolean(false) ; } +} + +void Null() : { Token t ; } +{ + { valueNull() ; } +} + + +/* + * (c) Copyright 2008 Hewlett-Packard Development Company, LP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ Modified: incubator/jena/Jena2/ARQ/trunk/Grammar/master.jj URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/master.jj?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/master.jj (original) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/master.jj Mon Sep 5 12:55:14 2011 @@ -96,7 +96,11 @@ void QueryUnit(): { } void Query() : { } { Prologue() - ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() ) + ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() +// #ifdef ARQ +// | JsonTemplateQuery() +// #endif + ) BindingsClause() } @@ -197,6 +201,10 @@ void SelectClause() : { Var v ; Expr ex { allowAggregatesInExpressions = false ; } } +#ifdef 0 +#include "json-extra.jj" +#endif + void ConstructQuery() : { Template t ; TripleCollectorBGP acc = new TripleCollectorBGP() ; } { Modified: incubator/jena/Jena2/ARQ/trunk/Grammar/sparql_11.jj URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/Grammar/sparql_11.jj?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/Grammar/sparql_11.jj (original) +++ incubator/jena/Jena2/ARQ/trunk/Grammar/sparql_11.jj Mon Sep 5 12:55:14 2011 @@ -56,7 +56,11 @@ void QueryUnit(): { } void Query() : { } { Prologue() - ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() ) + ( SelectQuery() | ConstructQuery() | DescribeQuery() | AskQuery() +// #ifdef ARQ +// | JsonTemplateQuery() +// #endif + ) BindingsClause() } void UpdateUnit() : {} Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java (original) +++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java Mon Sep 5 12:55:14 2011 @@ -5132,26 +5132,6 @@ public class ARQParser extends ARQParser finally { jj_save(3, xla); } } - private boolean jj_3R_68() { - if (jj_3R_78()) return true; - return false; - } - - private boolean jj_3R_67() { - if (jj_3R_77()) return true; - return false; - } - - private boolean jj_3R_62() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_67()) { - jj_scanpos = xsp; - if (jj_3R_68()) return true; - } - return false; - } - private boolean jj_3_4() { if (jj_scan_token(SEMICOLON)) return true; if (jj_scan_token(SEPARATOR)) return true; @@ -5592,6 +5572,26 @@ public class ARQParser extends ARQParser return false; } + private boolean jj_3R_68() { + if (jj_3R_78()) return true; + return false; + } + + private boolean jj_3R_67() { + if (jj_3R_77()) return true; + return false; + } + + private boolean jj_3R_62() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_67()) { + jj_scanpos = xsp; + if (jj_3R_68()) return true; + } + return false; + } + /** Generated Token Manager. */ public ARQParserTokenManager token_source; JavaCharStream jj_input_stream; Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParserBase.java URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParserBase.java?rev=1165266&r1=1165265&r2=1165266&view=diff ============================================================================== --- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParserBase.java (original) +++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/lang/arq/ARQParserBase.java Mon Sep 5 12:55:14 2011 @@ -5,12 +5,57 @@ */ package com.hp.hpl.jena.sparql.lang.arq; +import org.openjena.atlas.json.io.JSONHandler ; +import org.openjena.atlas.json.io.JSONHandlerBase ; +import org.openjena.atlas.lib.NotImplemented ; + import com.hp.hpl.jena.sparql.lang.ParserQueryBase ; class ARQParserBase extends ParserQueryBase implements ARQParserConstants { + // JSON + JSONHandler handler = new JSONHandlerBase() ; + + public void setHandler(JSONHandler handler) + { + if ( handler == null ) + this.handler = new JSONHandlerBase() ; + else + this.handler = handler ; + } + + // All the signals from the parsing process. + protected void jsonStartParse() { handler.startParse() ; } + protected void jsonFinishParse() { handler.finishParse() ; } + + protected void jsonStartObject() { handler.startObject() ; } + protected void jsonFinishObject() { handler.finishObject() ; } + + protected void jsonStartPair() { handler.startPair() ; } + protected void jsonKeyPair() { handler.keyPair() ; } + protected void jsonFinishPair() { handler.finishPair() ; } + + protected void jsonStartArray() { handler.startArray() ; } + protected void jsonElement() { handler.element() ; } + protected void jsonFinishArray() { handler.finishArray() ; } + + protected void jsonValueString(String image) + { + // Strip quotes + image = image.substring(1,image.length()-1) ; + handler.valueString(image) ; + } + + protected void jsonValueKeyString(String image) { handler.valueString(image) ; } + protected void jsonValueInteger(String image) { handler.valueInteger(image) ; } + protected void jsonValueDecimal(String image) { handler.valueDecimal(image) ; } + protected void jsonValueDouble(String image) { handler.valueDouble(image) ; } + protected void jsonValueBoolean(boolean b) { handler.valueBoolean(b) ; } + protected void jsonValueNull() { handler.valueNull() ; } + + protected void jsonValueVar(String image) { throw new NotImplemented("yet") ; } } /*