From 32a98497a99f60f4eab823171e3f4fc55f963090 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 20:45:50 +0200 Subject: [PATCH 001/323] initial addition of Unfold to the ARQ grammar, including all code changes necessary for the query engine to handle this new operator (but without invoking any actual functionality if it is present in a query) --- jena-arq/Grammar/arq.jj | 14 + jena-arq/Grammar/main.jj | 15 + .../jena/sparql/algebra/AlgebraGenerator.java | 5 + .../apache/jena/sparql/algebra/OpAsQuery.java | 9 + .../apache/jena/sparql/algebra/OpVars.java | 21 + .../apache/jena/sparql/algebra/OpVisitor.java | 1 + .../jena/sparql/algebra/OpVisitorBase.java | 2 + .../jena/sparql/algebra/OpVisitorByType.java | 4 + .../apache/jena/sparql/algebra/Transform.java | 1 + .../jena/sparql/algebra/TransformCopy.java | 2 + .../jena/sparql/algebra/TransformSingle.java | 2 + .../jena/sparql/algebra/TransformWrapper.java | 2 + .../jena/sparql/algebra/op/OpUnfold.java | 102 + .../optimize/VariableUsageVisitor.java | 12 + .../algebra/walker/ApplyTransformVisitor.java | 5 + .../algebra/walker/OpVisitorByType.java | 5 + .../walker/OpVisitorByTypeAndExpr.java | 6 + .../sparql/algebra/walker/WalkerVisitor.java | 9 + .../engine/iterator/QueryIterUnfold.java | 44 + .../sparql/engine/main/ExecutionDispatch.java | 8 + .../jena/sparql/engine/main/OpExecutor.java | 6 + .../jena/sparql/engine/main/VarFinder.java | 14 +- .../jena/sparql/engine/ref/Evaluator.java | 2 + .../sparql/engine/ref/EvaluatorDispatch.java | 8 + .../sparql/engine/ref/EvaluatorSimple.java | 9 + .../jena/sparql/lang/arq/ARQParser.java | 5037 ++++++++--------- .../sparql/lang/arq/ARQParserConstants.java | 359 +- .../lang/arq/ARQParserTokenManager.java | 2388 ++++---- .../jena/sparql/lang/arq/ParseException.java | 48 +- .../sparql/lang/arq/SimpleCharStream.java | 21 +- .../apache/jena/sparql/lang/arq/Token.java | 7 +- .../jena/sparql/lang/arq/TokenMgrError.java | 37 +- .../java/org/apache/jena/sparql/sse/Tags.java | 1 + .../jena/sparql/sse/writers/WriterOp.java | 19 + .../jena/sparql/syntax/ElementUnfold.java | 86 + .../querybuilder/rewriters/OpRewriter.java | 7 + .../query/rewriter/OpRewriter.java | 13 + 37 files changed, 4123 insertions(+), 4208 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index bf0a2f63bad..30d6f2ea667 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -630,6 +630,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() ) { return el ; } } @@ -751,6 +753,17 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} Element MinusGraphPattern() : { Element el ; } { @@ -1783,6 +1796,7 @@ TOKEN [IGNORE_CASE] : | < SUBJECT: "SUBJECT" > | < PREDICATE: "PREDICATE" > | < OBJECT: "OBJECT" > +| < UNFOLD: "unfold" > | < EXISTS: "exists" > | < NOT: "not" > | < AS: "as" > diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 4e3ec841981..005257c1126 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -898,6 +898,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() #endif ) { return el ; } @@ -1039,6 +1041,18 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } + +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} #endif Element MinusGraphPattern() : { Element el ; } @@ -2522,6 +2536,7 @@ TOKEN [IGNORE_CASE] : | < SUBJECT: "SUBJECT" > | < PREDICATE: "PREDICATE" > | < OBJECT: "OBJECT" > +| < UNFOLD: "unfold" > #endif | < EXISTS: "exists" > | < NOT: "not" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index ad21560b4d0..a39bf9878cf 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -329,6 +329,11 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { return op; } + if ( elt instanceof ElementUnfold ) { + ElementUnfold unfold = (ElementUnfold)elt; + return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + } + // Filters were collected together by prepareGroup // This only handles filters left in place by some magic. if ( elt instanceof ElementFilter ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java index ea895114ae2..206a2fdfff4 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java @@ -798,6 +798,15 @@ public void visit(OpExtend opExtend) { }) ; } + @Override + public void visit(OpUnfold opUnfold) { + Element e = asElement(opUnfold.getSubOp()) ; + // If (unfold ... (table unit)), and first in group, don't add the empty group. + insertIntoGroup(currentGroup(), e) ; + Element elmtUnfold = new ElementUnfold( opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2() ) ; + currentGroup().addElement(elmtUnfold) ; + } + @Override public void visit(OpList opList) { opList.getSubOp().visit(this) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index 60b8641b575..303e6fa097b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -279,6 +279,14 @@ public void visit(OpExtend opExtend) { acc.addAll(opExtend.getVarExprList().getVars()) ; } + @Override + public void visit(OpUnfold opUnfold) { + acc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + acc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { PropFuncArg.addVars(acc, opPropFunc.getSubjectArgs()) ; @@ -380,6 +388,14 @@ public void visit(OpExtend opExtend) { unknownAcc.addAll(opExtend.getVarExprList().getVars()) ; } + @Override + public void visit(OpUnfold opUnfold) { + unknownAcc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + unknownAcc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { addvars(subjAcc, opPropFunc.getSubjectArgs()) ; @@ -450,6 +466,11 @@ public void visit(OpAssign opAssign) { visitExtendAssign(opAssign); } + @Override + public void visit(OpUnfold opUnfold) { + ExprVars.varsMentioned( acc, opUnfold.getExpr() ); + } + // The expression side of (extend) and (assign) private void visitExtendAssign(OpExtendAssign op) { op.getVarExprList().forEachExpr((v,e)->ExprVars.varsMentioned(acc, e)); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java index 040ce7b9d5d..052d9a8e376 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java @@ -42,6 +42,7 @@ public interface OpVisitor public void visit(OpLabel opLabel) ; public void visit(OpAssign opAssign) ; public void visit(OpExtend opExtend) ; + public void visit(OpUnfold opUnfold) ; // Op2 public void visit(OpJoin opJoin) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java index ae593ec7e26..914c65841b2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java @@ -78,6 +78,8 @@ public OpVisitorBase() {} @Override public void visit(OpExtend opExtend) {} + @Override public void visit(OpUnfold opUnfold) {} + @Override public void visit(OpList opList) {} @Override public void visit(OpOrder opOrder) {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java index f980979ea1f..80d7e650008 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java @@ -147,6 +147,10 @@ public void visit(OpAssign opAssign) public void visit(OpExtend opExtend) { visit1(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) + { visit1(opUnfold) ; } + @Override public void visit(OpList opList) { visitModifer(opList) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java index d6a560b05f5..170a57e5c60 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java @@ -44,6 +44,7 @@ public interface Transform public Op transform(OpLabel opLabel, Op subOp) ; public Op transform(OpAssign opAssign, Op subOp) ; public Op transform(OpExtend opExtend, Op subOp) ; + public Op transform(OpUnfold opUnfold, Op subOp) ; // Op2 public Op transform(OpJoin opJoin, Op left, Op right) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java index c82fe96ea09..9f13b7b73d7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java @@ -68,6 +68,8 @@ public class TransformCopy implements Transform public Op transform(OpAssign opAssign, Op subOp) { return xform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return xform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return xform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return xform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java index fee5cce5236..02ca5ecc527 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java @@ -64,6 +64,8 @@ public class TransformSingle implements Transform public Op transform(OpAssign opAssign, Op subOp) { return opAssign ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return opExtend ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return opUnfold ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return opJoin ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java index 6d9bde045ba..55b2c1d922c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java @@ -66,6 +66,8 @@ public TransformWrapper(Transform transform) public Op transform(OpAssign opAssign, Op subOp) { return transform.transform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return transform.transform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return transform.transform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return transform.transform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java new file mode 100644 index 00000000000..55a193e1332 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java @@ -0,0 +1,102 @@ +/* + * 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 org.apache.jena.sparql.algebra.op; + +import java.util.Objects; + +import org.apache.jena.sparql.algebra.Op; +import org.apache.jena.sparql.algebra.OpVisitor; +import org.apache.jena.sparql.algebra.Transform; +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.sse.Tags; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class OpUnfold extends Op1 +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public OpUnfold(Op subOp, Expr expr, Var var1, Var var2) { + super(subOp) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public String getName() { + return Tags.tagUnfold ; + } + + @Override + public void visit(OpVisitor opVisitor) { + opVisitor.visit(this) ; + } + + @Override + public Op1 copy(Op subOp) { + OpUnfold op = new OpUnfold(subOp, expr, var1, var2) ; + return op ; + } + + @Override + public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { + if ( !(other instanceof OpUnfold) ) + return false ; + OpUnfold unfold = (OpUnfold)other ; + + if ( !Objects.equals(var1, unfold.var1) ) + return false ; + if ( !Objects.equals(var2, unfold.var2) ) + return false ; + if ( !Objects.equals(expr, unfold.expr) ) + return false ; + return getSubOp().equalTo(unfold.getSubOp(), labelMap) ; + } + + @Override + public Op apply(Transform transform, Op subOp) { + return transform.transform(this, subOp) ; + } + + @Override + public int hashCode() { + if ( var2 == null ) + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ getSubOp().hashCode() ; + else + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ var2.hashCode() ^ getSubOp().hashCode() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java index 9cc3bb14139..747ee97bf5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java @@ -41,6 +41,7 @@ import org.apache.jena.sparql.algebra.op.OpQuadPattern; import org.apache.jena.sparql.algebra.op.OpTable; import org.apache.jena.sparql.algebra.op.OpTopN; +import org.apache.jena.sparql.algebra.op.OpUnfold; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.Vars; @@ -169,6 +170,17 @@ public void visit(OpExtend opExtend) { action(vars); } + @Override + public void visit(OpUnfold opUnfold) { + Collection vars = new ArrayList<>(); + ExprVars.varsMentioned(vars, opUnfold.getExpr()); + vars.add( opUnfold.getVar1() ); + if ( opUnfold.getVar2() != null ) { + vars.add( opUnfold.getVar2() ); + } + action(vars); + } + @Override public void visit(OpOrder opOrder) { Collection vars = new ArrayList<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index 19543334803..e6028996b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -147,6 +147,11 @@ public void visit(OpExtend opExtend) { visit1(opExtend2) ; } + @Override + public void visit(OpUnfold opUnfold) { + visit1(opUnfold) ; + } + // Special test cases for collectors. // Careful about order. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java index 3f373291f0f..2ec2fbb8020 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java @@ -188,6 +188,11 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java index d4e22634542..7c0b8a80e44 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java @@ -210,6 +210,12 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visitExpr( new ExprList(opUnfold.getExpr()) ) ; + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java index 6243225afc5..d1fa6e7e9eb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java @@ -215,6 +215,15 @@ public void visit(OpExtend opExtend) { after(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) { + before(opUnfold) ; + ExprList varExpr = new ExprList( opUnfold.getExpr() ) ; + visitExpr(varExpr); + visit1$(opUnfold) ; + after(opUnfold) ; + } + // Transforming to quads needs the graph node handled before doing the sub-algebra ops // so it has to be done as before/after by the Walker. By the time visit(OpGraph) is called, // the sub-tree has already been visited. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java new file mode 100644 index 00000000000..d052da6e075 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -0,0 +1,44 @@ +/* + * 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 org.apache.jena.sparql.engine.iterator; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.QueryIterator; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; + +public class QueryIterUnfold extends QueryIteratorWrapper +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { + super(qIter) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + @Override + protected Binding moveToNextBinding() { +System.out.println("QueryIterUnfold"); + return super.moveToNextBinding() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java index 25297db7cc0..edb3873747e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java @@ -300,6 +300,14 @@ public void visit(OpExtend opExtend) push(qIter) ; } + @Override + public void visit(OpUnfold opUnfold) + { + QueryIterator input = pop() ; + QueryIterator qIter = opExecutor.execute(opUnfold, input) ; + push(qIter) ; + } + @Override public void visit(OpSlice opSlice) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 1e0785f5ac1..ad6a068d4d2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -446,6 +446,12 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { return qIter ; } + protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { + QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + return qIter ; + } + public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { return QueryIterRoot.create(execCxt) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index 4d6fce927c7..85b978d418c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -114,7 +114,7 @@ static VarUsageVisitor apply(Op op) { Set filterMentions = null ; // Used in a filter, before defined Set filterMentionsOnly = null ; - // Used in assign or extend expression + // Used in assign or extend or unfold expression Set assignMentions = null ; VarUsageVisitor() { @@ -329,6 +329,18 @@ private void processAssignVarExprList(VarExprList varExprList) { }) ; } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + + defines.add( opUnfold.getVar1() ); + + if ( opUnfold.getVar2() != null ) + defines.add( opUnfold.getVar2() ); + + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + } + @Override public void visit(OpProject opProject) { List vars = opProject.getVars(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java index 995a34c7f0f..af9a9acf47c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java @@ -28,6 +28,7 @@ import org.apache.jena.sparql.core.Var ; import org.apache.jena.sparql.core.VarExprList ; import org.apache.jena.sparql.engine.ExecutionContext ; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator ; import org.apache.jena.sparql.expr.ExprList ; import org.apache.jena.sparql.pfunction.PropFuncArg ; @@ -45,6 +46,7 @@ public interface Evaluator public Table assign(Table table, VarExprList exprs) ; public Table extend(Table table, VarExprList exprs) ; + public Table unfold(Table table, Expr expr, Var var1, Var var2) ; public Table join(Table tableLeft, Table tableRight) ; public Table leftJoin(Table tableLeft, Table tableRight, ExprList expr) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java index b8937f2a660..dff42060be2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java @@ -327,6 +327,14 @@ public void visit(OpExtend opExtend) push(table) ; } + @Override + public void visit(OpUnfold opUnfold) + { + Table table = eval(opUnfold.getSubOp()) ; + table = evaluator.unfold(table, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + push(table) ; + } + @Override public void visit(OpGroup opGroup) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index 72ffa0b8aca..963755f7c46 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -41,6 +41,7 @@ import org.apache.jena.sparql.engine.binding.Binding ; import org.apache.jena.sparql.engine.iterator.* ; import org.apache.jena.sparql.engine.main.QC ; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator ; import org.apache.jena.sparql.expr.ExprList ; import org.apache.jena.sparql.pfunction.PropFuncArg ; @@ -265,6 +266,14 @@ public Table extend(Table table, VarExprList exprs) return new TableN(qIter) ; } + @Override + public Table unfold(Table table, Expr expr, Var var1, Var var2) + { + QueryIterator qIter = table.iterator(getExecContext()) ; + qIter = new QueryIterUnfold(qIter, expr, var1, var2) ; + return new TableN(qIter) ; + } + @Override public Table unit() { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index f820cdb37d4..1c1a2038a4e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -1,4 +1,3 @@ -/* ARQParser.java */ /* Generated By:JavaCC: Do not edit this line. ARQParser.java */ package org.apache.jena.sparql.lang.arq ; import org.apache.jena.graph.* ; @@ -18,116 +17,108 @@ public class ARQParser extends ARQParserBase implements ARQParserConstants { final public void QueryUnit() throws ParseException { ByteOrderMark(); -startQuery() ; + startQuery() ; Query(); jj_consume_token(0); -finishQuery() ; -} + finishQuery() ; + } final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: SelectQuery(); break; - } - case CONSTRUCT:{ + case CONSTRUCT: ConstructQuery(); break; - } - case DESCRIBE:{ + case DESCRIBE: DescribeQuery(); break; - } - case ASK:{ + case ASK: AskQuery(); break; - } - case JSON:{ + case JSON: JsonQuery(); break; - } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); -} + } final public void UpdateUnit() throws ParseException { ByteOrderMark(); -startUpdateRequest() ; + startUpdateRequest() ; Update(); jj_consume_token(0); -finishUpdateRequest() ; -} + finishUpdateRequest() ; + } final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOM: jj_consume_token(BOM); break; - } default: jj_la1[1] = jj_gen; ; } -} + } final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BASE: - case PREFIX:{ + case PREFIX: ; break; - } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BASE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BASE: BaseDecl(); break; - } - case PREFIX:{ + case PREFIX: PrefixDecl(); break; - } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -} + } - final public void BaseDecl() throws ParseException {Token t ; String iri ; + final public void BaseDecl() throws ParseException { + Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); -setBase(iri, t.beginLine, t.beginColumn ) ; -} + setBase(iri, t.beginLine, t.beginColumn ) ; + } - final public void PrefixDecl() throws ParseException {Token t ; String iri ; + final public void PrefixDecl() throws ParseException { + Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); -String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); + String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; -} + } final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[4] = jj_gen; break label_2; @@ -136,45 +127,43 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); -} + } - final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException { + Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); -getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DISTINCT: - case REDUCED:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + case REDUCED: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -getQuery().setDistinct(true); + getQuery().setDistinct(true); break; - } - case REDUCED:{ + case REDUCED: jj_consume_token(REDUCED); -getQuery().setReduced(true); + getQuery().setReduced(true); break; - } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[6] = jj_gen; ; } -setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -274,16 +263,15 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addResultVar(v) ; + getQuery().addResultVar(v) ; break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -380,27 +368,25 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: if (jj_2_1(2)) { expr = BuiltInCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -409,17 +395,15 @@ final public void SubSelect() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } default: jj_la1[7] = jj_gen; jj_consume_token(-1); @@ -427,32 +411,29 @@ final public void SubSelect() throws ParseException { } } break; - } - case LPAREN:{ -v = null ; + case LPAREN: + v = null ; jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[8] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addResultVar(v, expr) ; -getQuery().setQueryResultStar(false) ; + getQuery().addResultVar(v, expr) ; + getQuery().setQueryResultStar(false) ; break; - } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -552,45 +533,42 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[10] = jj_gen; break label_3; } } break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void ConstructQuery() throws ParseException {Template t ; + final public void ConstructQuery() throws ParseException { + Template t ; QuadAcc acc = new QuadAcc() ; jj_consume_token(CONSTRUCT); -getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: t = ConstructTemplate(); -getQuery().setConstructTemplate(t) ; + getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[12] = jj_gen; break label_4; @@ -600,16 +578,14 @@ final public void SubSelect() throws ParseException { WhereClause(); SolutionModifier(); break; - } case FROM: - case WHERE:{ + case WHERE: label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[13] = jj_gen; break label_5; @@ -621,54 +597,51 @@ final public void SubSelect() throws ParseException { ConstructQuads(acc); jj_consume_token(RBRACE); SolutionModifier(); -t = new Template(acc) ; + t = new Template(acc) ; getQuery().setConstructTemplate(t) ; ElementGroup elg = createQueryPattern(t); getQuery().setQueryPattern(elg) ; break; - } default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DescribeQuery() throws ParseException {Node n ; + final public void DescribeQuery() throws ParseException { + Node n ; jj_consume_token(DESCRIBE); -getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: label_6: while (true) { n = VarOrIri(); -getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[15] = jj_gen; break label_6; } } -getQuery().setQueryResultStar(false) ; + getQuery().setQueryResultStar(false) ; break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[16] = jj_gen; jj_consume_token(-1); @@ -676,40 +649,37 @@ final public void SubSelect() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[17] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHERE: - case LBRACE:{ + case LBRACE: WhereClause(); break; - } default: jj_la1[18] = jj_gen; ; } SolutionModifier(); -} + } final public void AskQuery() throws ParseException { jj_consume_token(ASK); -getQuery().setQueryAskType() ; + getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[19] = jj_gen; break label_8; @@ -718,17 +688,16 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonQuery() throws ParseException { JsonClause(); label_9: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[20] = jj_gen; break label_9; @@ -737,20 +706,19 @@ final public void JsonQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonClause() throws ParseException { jj_consume_token(JSON); -getQuery().setQueryJsonType() ; + getQuery().setQueryJsonType() ; jj_consume_token(LBRACE); JsonObjectMember(); label_10: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[21] = jj_gen; break label_10; @@ -759,28 +727,27 @@ final public void JsonClause() throws ParseException { JsonObjectMember(); } jj_consume_token(RBRACE); -} + } - final public void JsonObjectMember() throws ParseException {Node o ; String s ; Token t; + final public void JsonObjectMember() throws ParseException { + Node o ; String s ; Token t; s = String(); t = jj_consume_token(PNAME_NS); -if ( ! t.image.equals(":") ) + if ( ! t.image.equals(":") ) throwParseException("Prefix name expression not legal at this point : "+t.image, t.beginLine, t.beginColumn) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: o = Var(); -getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: o = RDFLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -789,116 +756,111 @@ final public void JsonClause() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: o = NumericLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case TRUE: - case FALSE:{ + case FALSE: o = BooleanLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: DefaultGraphClause(); break; - } - case NAMED:{ + case NAMED: NamedGraphClause(); break; - } default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DefaultGraphClause() throws ParseException {String iri ; + final public void DefaultGraphClause() throws ParseException { + String iri ; iri = SourceSelector(); -getQuery().addGraphURI(iri) ; -} + getQuery().addGraphURI(iri) ; + } - final public void NamedGraphClause() throws ParseException {String iri ; + final public void NamedGraphClause() throws ParseException { + String iri ; jj_consume_token(NAMED); iri = SourceSelector(); -getQuery().addNamedGraphURI(iri) ; -} + getQuery().addNamedGraphURI(iri) ; + } - final public String SourceSelector() throws ParseException {String iri ; + final public String SourceSelector() throws ParseException { + String iri ; iri = iri(); -{if ("" != null) return iri ;} + {if (true) return iri ;} throw new Error("Missing return statement in function"); -} + } - final public void WhereClause() throws ParseException {Element el ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WHERE:{ + final public void WhereClause() throws ParseException { + Element el ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: jj_consume_token(WHERE); break; - } default: jj_la1[24] = jj_gen; ; } -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -getQuery().setQueryPattern(el) ; -finishWherePattern() ; -} + getQuery().setQueryPattern(el) ; + finishWherePattern() ; + } final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GROUP:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: GroupClause(); break; - } default: jj_la1[25] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HAVING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: HavingClause(); break; - } default: jj_la1[26] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ORDER:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: OrderClause(); break; - } default: jj_la1[27] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: - case OFFSET:{ + case OFFSET: LimitOffsetClauses(); break; - } default: jj_la1[28] = jj_gen; ; } -} + } final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -906,7 +868,7 @@ final public void GroupClause() throws ParseException { label_11: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -991,19 +953,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[29] = jj_gen; break label_11; } } -} + } - final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void GroupCondition() throws ParseException { + Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -1082,55 +1044,50 @@ final public void GroupClause() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[30] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addGroupBy(v ,expr) ; + getQuery().addGroupBy(v ,expr) ; break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addGroupBy(v) ; + getQuery().addGroupBy(v) ; break; - } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void HavingClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_12: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1213,31 +1170,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[32] = jj_gen; break label_12; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void HavingCondition() throws ParseException {Expr c ; + final public void HavingCondition() throws ParseException { + Expr c ; c = Constraint(); -getQuery().addHavingCondition(c) ; -} + getQuery().addHavingCondition(c) ; + } final public void OrderClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_13: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1324,34 +1281,32 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[33] = jj_gen; break label_13; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; -direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void OrderCondition() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASC: - case DESC:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASC:{ + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: jj_consume_token(ASC); -direction = Query.ORDER_ASCENDING ; + direction = Query.ORDER_ASCENDING ; break; - } - case DESC:{ + case DESC: jj_consume_token(DESC); -direction = Query.ORDER_DESCENDING ; + direction = Query.ORDER_DESCENDING ; break; - } default: jj_la1[34] = jj_gen; jj_consume_token(-1); @@ -1359,7 +1314,6 @@ final public void OrderClause() throws ParseException { } expr = BrackettedExpression(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -1444,8 +1398,8 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1528,98 +1482,93 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: expr = Constraint(); break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); break; - } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[36] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( v == null ) + if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; -} + } final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case OFFSET:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OFFSET: OffsetClause(); break; - } default: jj_la1[37] = jj_gen; ; } break; - } - case OFFSET:{ + case OFFSET: OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); break; - } default: jj_la1[38] = jj_gen; ; } break; - } default: jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void LimitClause() throws ParseException {Token t ; + final public void LimitClause() throws ParseException { + Token t ; jj_consume_token(LIMIT); t = jj_consume_token(INTEGER); -getQuery().setLimit(integerValue(t.image)) ; -} + getQuery().setLimit(integerValue(t.image)) ; + } - final public void OffsetClause() throws ParseException {Token t ; + final public void OffsetClause() throws ParseException { + Token t ; jj_consume_token(OFFSET); t = jj_consume_token(INTEGER); -getQuery().setOffset(integerValue(t.image)) ; -} + getQuery().setOffset(integerValue(t.image)) ; + } - final public void ValuesClause() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VALUES:{ + final public void ValuesClause() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VALUES: t = jj_consume_token(VALUES); -startValuesClause(t.beginLine, t.beginColumn) ; + startValuesClause(t.beginLine, t.beginColumn) ; DataBlock(); -finishValuesClause(t.beginLine, t.beginColumn) ; + finishValuesClause(t.beginLine, t.beginColumn) ; break; - } default: jj_la1[40] = jj_gen; ; } -} + } final public void Update() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INSERT: case DELETE: case INSERT_DATA: @@ -1632,7 +1581,7 @@ final public void Update() throws ParseException { case MOVE: case COPY: case DROP: - case WITH:{ + case WITH: Update1(); label_14: while (true) { @@ -1645,168 +1594,155 @@ final public void Update() throws ParseException { Prologue(); Update1(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); Prologue(); break; - } default: jj_la1[41] = jj_gen; ; } break; - } default: jj_la1[42] = jj_gen; ; } -} + } - final public void Update1() throws ParseException {Update up = null ; -startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LOAD:{ + final public void Update1() throws ParseException { + Update up = null ; + startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOAD: up = Load(); break; - } - case CLEAR:{ + case CLEAR: up = Clear(); break; - } - case DROP:{ + case DROP: up = Drop(); break; - } - case ADD:{ + case ADD: up = Add(); break; - } - case MOVE:{ + case MOVE: up = Move(); break; - } - case COPY:{ + case COPY: up = Copy(); break; - } - case CREATE:{ + case CREATE: up = Create(); break; - } - case DELETE_WHERE:{ + case DELETE_WHERE: up = DeleteWhere(); break; - } case INSERT: case DELETE: - case WITH:{ + case WITH: up = Modify(); break; - } - case INSERT_DATA:{ + case INSERT_DATA: InsertData(); break; - } - case DELETE_DATA:{ + case DELETE_DATA: DeleteData(); break; - } default: jj_la1[43] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if (null != up) emitUpdate(up) ; + if (null != up) emitUpdate(up) ; finishUpdateOperation() ; -} + } - final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; + final public Update Load() throws ParseException { + String url ; Node dest = null ; boolean silent = false ; jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[44] = jj_gen; ; } url = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTO:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTO: jj_consume_token(INTO); dest = GraphRef(); break; - } default: jj_la1[45] = jj_gen; ; } -{if ("" != null) return new UpdateLoad(url, dest, silent) ;} + {if (true) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Clear() throws ParseException {boolean silent = false ; Target target ; + final public Update Clear() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[46] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateClear(target, silent) ;} + {if (true) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Drop() throws ParseException {boolean silent = false ; Target target ; + final public Update Drop() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[47] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateDrop(target, silent) ;} + {if (true) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Create() throws ParseException {Node iri ; boolean silent = false ; + final public Update Create() throws ParseException { + Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[48] = jj_gen; ; } iri = GraphRef(); -{if ("" != null) return new UpdateCreate(iri, silent) ;} + {if (true) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[49] = jj_gen; ; @@ -1814,18 +1750,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateAdd(src, dest, silent) ;} + {if (true) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[50] = jj_gen; ; @@ -1833,18 +1769,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateMove(src, dest, silent) ;} + {if (true) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[51] = jj_gen; ; @@ -1852,70 +1788,70 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateCopy(src, dest, silent) ;} + {if (true) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException { + QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataInsert(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataInsert(qd, beginLine, beginColumn) ; + finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException { + QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataDelete(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataDelete(qd, beginLine, beginColumn) ; + finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException { + QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -{if ("" != null) return new UpdateDeleteWhere(qp) ;} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + {if (true) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Modify() throws ParseException {Element el ; String iri = null ; + final public Update Modify() throws ParseException { + Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; -startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WITH:{ + startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WITH: jj_consume_token(WITH); iri = iri(); -Node n = createNode(iri) ; up.setWithIRI(n) ; + Node n = createNode(iri) ; up.setWithIRI(n) ; break; - } default: jj_la1[52] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELETE: DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: InsertClause(up); break; - } default: jj_la1[53] = jj_gen; ; } break; - } - case INSERT:{ + case INSERT: InsertClause(up); break; - } default: jj_la1[54] = jj_gen; jj_consume_token(-1); @@ -1923,11 +1859,10 @@ final public void Update() throws ParseException { } label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case USING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case USING: ; break; - } default: jj_la1[55] = jj_gen; break label_15; @@ -1935,139 +1870,136 @@ final public void Update() throws ParseException { UsingClause(up); } jj_consume_token(WHERE); -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -up.setElement(el) ; -finishWherePattern() ; -finishModifyUpdate() ; -{if ("" != null) return up ;} + up.setElement(el) ; + finishWherePattern() ; + finishModifyUpdate() ; + {if (true) return up ;} throw new Error("Missing return statement in function"); -} + } - final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -up.setHasDeleteClause(true) ; -} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + up.setHasDeleteClause(true) ; + } - final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startInsertTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishInsertTemplate(qp, beginLine, beginColumn) ; -up.setHasInsertClause(true) ; -} + finishInsertTemplate(qp, beginLine, beginColumn) ; + up.setHasInsertClause(true) ; + } - final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException { + String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; update.addUsing(n) ; + n = createNode(iri) ; update.addUsing(n) ; break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); iri = iri(); -n = createNode(iri) ; update.addUsingNamed(n) ; + n = createNode(iri) ; update.addUsingNamed(n) ; break; - } default: jj_la1[56] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public Target GraphOrDefault() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DFT:{ + final public Target GraphOrDefault() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + case GRAPH: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); break; - } default: jj_la1[57] = jj_gen; ; } iri = iri(); -{if ("" != null) return Target.create(createNode(iri)) ;} + {if (true) return Target.create(createNode(iri)) ;} break; - } default: jj_la1[58] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphRef() throws ParseException {String iri ; + final public Node GraphRef() throws ParseException { + String iri ; jj_consume_token(GRAPH); iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} throw new Error("Missing return statement in function"); -} + } - final public Target GraphRefAll() throws ParseException {Node iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + final public Target GraphRefAll() throws ParseException { + Node iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: iri = GraphRef(); -{if ("" != null) return Target.create(iri) ;} + {if (true) return Target.create(iri) ;} break; - } - case DFT:{ + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); -{if ("" != null) return Target.NAMED ;} + {if (true) return Target.NAMED ;} break; - } - case ALL:{ + case ALL: jj_consume_token(ALL); -{if ("" != null) return Target.ALL ;} + {if (true) return Target.ALL ;} break; - } default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2093,36 +2025,33 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[60] = jj_gen; ; } label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: ; break; - } default: jj_la1[61] = jj_gen; break label_16; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[62] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2148,23 +2077,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[63] = jj_gen; ; } } -} + } - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2190,20 +2119,19 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[64] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void ConstructQuads(QuadAcc acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2229,37 +2157,34 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[65] = jj_gen; ; } label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GRAPH: - case LBRACE:{ + case LBRACE: ; break; - } default: jj_la1[66] = jj_gen; break label_17; } ConstructQuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[67] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2285,32 +2210,31 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[68] = jj_gen; ; } } -} + } - final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn = Quad.defaultGraphNodeGenerated ; + final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn = Quad.defaultGraphNodeGenerated ; Node prev = acc.getGraph() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); break; - } default: jj_la1[69] = jj_gen; ; } -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2336,17 +2260,16 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: jj_la1[70] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -2360,41 +2283,41 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[71] = jj_gen; ; } -} + } - final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException { + Element el = null ; Token t ; t = jj_consume_token(LBRACE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ -startSubSelect(beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: + startSubSelect(beginLine, beginColumn) ; SubSelect(); -Query q = endSubSelect(beginLine, beginColumn) ; + Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; - } default: jj_la1[72] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; -ElementGroup elg = new ElementGroup() ; -startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException { + Element el = null ; + ElementGroup elg = new ElementGroup() ; + startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2420,20 +2343,19 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[73] = jj_gen; ; } label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -2441,29 +2363,28 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case BIND: case SERVICE: case LET: + case UNFOLD: case EXISTS: case NOT: case FILTER: - case LBRACE:{ + case LBRACE: ; break; - } default: jj_la1[74] = jj_gen; break label_19; } el = GraphPatternNotTriples(); -elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[75] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2489,31 +2410,30 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[76] = jj_gen; ; } } -endGroup(elg) ; -{if ("" != null) return elg ;} + endGroup(elg) ; + {if (true) return elg ;} throw new Error("Missing return statement in function"); -} + } final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { -if ( acc == null ) + if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2539,161 +2459,155 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesBlock(acc); break; - } default: jj_la1[77] = jj_gen; ; } break; - } default: jj_la1[78] = jj_gen; ; } -{if ("" != null) return acc ;} + {if (true) return acc ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + final public Element GraphPatternNotTriples() throws ParseException { + Element el = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: el = GroupOrUnionGraphPattern(); break; - } - case OPTIONAL:{ + case OPTIONAL: el = OptionalGraphPattern(); break; - } - case MINUS_P:{ + case MINUS_P: el = MinusGraphPattern(); break; - } - case GRAPH:{ + case GRAPH: el = GraphGraphPattern(); break; - } - case SERVICE:{ + case SERVICE: el = ServiceGraphPattern(); break; - } - case FILTER:{ + case FILTER: el = Filter(); break; - } - case BIND:{ + case BIND: el = Bind(); break; - } - case VALUES:{ + case VALUES: el = InlineData(); break; - } - case LET:{ + case LET: el = Assignment(); break; - } - case EXISTS:{ + case EXISTS: el = ExistsElt(); break; - } - case NOT:{ + case NOT: el = NotExistsElt(); break; - } + case UNFOLD: + el = Unfold(); + break; default: jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element OptionalGraphPattern() throws ParseException {Element el ; + final public Element OptionalGraphPattern() throws ParseException { + Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementOptional(el) ;} + {if (true) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException { + Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementNamedGraph(n, el) ;} + {if (true) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException { + Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true; + silent=true; break; - } default: jj_la1[80] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementService(n, el, silent) ;} + {if (true) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Element Bind() throws ParseException {Var v ; Expr expr ; + final public Element Bind() throws ParseException { + Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementBind(v, expr) ;} + {if (true) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element InlineData() throws ParseException {ElementData el ; Token t ; + final public Element InlineData() throws ParseException { + ElementData el ; Token t ; t = jj_consume_token(VALUES); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -el = new ElementData() ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); -finishInlineData(beginLine, beginColumn) ; - {if ("" != null) return el ;} + finishInlineData(beginLine, beginColumn) ; + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: InlineDataOneVar(); break; - } case LPAREN: - case NIL:{ + case NIL: InlineDataFull(); break; - } default: jj_la1[81] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException { + Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2713,48 +2627,45 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: jj_la1[82] = jj_gen; break label_20; } n = DataBlockValue(); -startDataBlockValueRow(beginLine, beginColumn) ; + startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); -} + } - final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public void InlineDataFull() throws ParseException { + Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[83] = jj_gen; break label_21; } v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[84] = jj_gen; jj_consume_token(-1); @@ -2763,24 +2674,23 @@ final public void DataBlock() throws ParseException { jj_consume_token(LBRACE); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: ; break; - } default: jj_la1[85] = jj_gen; break label_22; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: t = jj_consume_token(LPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2800,29 +2710,26 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: jj_la1[86] = jj_gen; break label_23; } n = DataBlockValue(); -emitDataBlockValue(n, beginLine, beginColumn) ; + emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } - case NIL:{ + case NIL: t = jj_consume_token(NIL); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } default: jj_la1[87] = jj_gen; jj_consume_token(-1); @@ -2830,30 +2737,28 @@ final public void DataBlock() throws ParseException { } } jj_consume_token(RBRACE); -} + } - final public Node DataBlockValue() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT2:{ + final public Node DataBlockValue() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LT2: n = TripleTermData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -2862,102 +2767,126 @@ final public void DataBlock() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case UNDEF:{ + case UNDEF: jj_consume_token(UNDEF); -{if ("" != null) return null ;} + {if (true) return null ;} break; - } default: jj_la1[88] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Element Assignment() throws ParseException {Var v ; Expr expr ; + final public Element Assignment() throws ParseException { + Var v ; Expr expr ; jj_consume_token(LET); jj_consume_token(LPAREN); v = Var(); jj_consume_token(ASSIGN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementAssign(v, expr) ;} + {if (true) return new ElementAssign(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ExistsElt() throws ParseException {Element el ; + final public Element ExistsElt() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementExists(el) ;} + {if (true) return new ElementExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element NotExistsElt() throws ParseException {Element el ; + final public Element NotExistsElt() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementNotExists(el) ;} + {if (true) return new ElementNotExists(el) ;} + throw new Error("Missing return statement in function"); + } + + final public Element Unfold() throws ParseException { + Var v1 ; Var v2 = null ; Expr expr ; + jj_consume_token(UNFOLD); + jj_consume_token(LPAREN); + expr = Expression(); + jj_consume_token(AS); + v1 = Var(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + v2 = Var(); + ; + break; + default: + jj_la1[89] = jj_gen; + ; + } + jj_consume_token(RPAREN); + {if (true) return new ElementUnfold(expr, v1, v2) ;} throw new Error("Missing return statement in function"); -} + } - final public Element MinusGraphPattern() throws ParseException {Element el ; + final public Element MinusGraphPattern() throws ParseException { + Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); -{if ("" != null) return new ElementMinus(el) ;} + {if (true) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException { + Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case UNION:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNION: ; break; - } default: - jj_la1[89] = jj_gen; + jj_la1[90] = jj_gen; break label_24; } jj_consume_token(UNION); -if ( el2 == null ) + if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); -el2.addElement(el) ; + el2.addElement(el) ; } -{if ("" != null) return (el2==null)? el : el2 ;} + {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); -} + } - final public Element Filter() throws ParseException {Expr c ; + final public Element Filter() throws ParseException { + Expr c ; jj_consume_token(FILTER); c = Constraint(); -{if ("" != null) return new ElementFilter(c) ;} + {if (true) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Constraint() throws ParseException {Expr c ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr Constraint() throws ParseException { + Expr c ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: c = BrackettedExpression(); break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -3036,137 +2965,132 @@ final public void DataBlock() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: c = BuiltInCall(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: c = FunctionCall(); break; - } default: - jj_la1[90] = jj_gen; + jj_la1[91] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return c ;} + {if (true) return c ;} throw new Error("Missing return statement in function"); -} + } - final public Expr FunctionCall() throws ParseException {String fname ; Args a ; + final public Expr FunctionCall() throws ParseException { + String fname ; Args a ; fname = iri(); a = ArgList(); -if ( AggregateRegistry.isRegistered(fname) ) { + if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(fname, a) ;} + {if (true) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public Args ArgList() throws ParseException { + Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -args.distinct = true ; -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -if ( ! getAllowAggregatesInExpressions() ) + args.distinct = true ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; - } default: - jj_la1[91] = jj_gen; + jj_la1[92] = jj_gen; ; } expr = Expression(); -args.add(expr) ; + args.add(expr) ; label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[92] = jj_gen; + jj_la1[93] = jj_gen; break label_25; } jj_consume_token(COMMA); expr = Expression(); -args.add(expr) ; + args.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[93] = jj_gen; + jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return args ;} + {if (true) return args ;} throw new Error("Missing return statement in function"); -} + } - final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public ExprList ExpressionList() throws ParseException { + Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[94] = jj_gen; + jj_la1[95] = jj_gen; break label_26; } jj_consume_token(COMMA); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[95] = jj_gen; + jj_la1[96] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return exprList ;} + {if (true) return exprList ;} throw new Error("Missing return statement in function"); -} + } - final public Template ConstructTemplate() throws ParseException {QuadAcc acc = new QuadAcc() ; + final public Template ConstructTemplate() throws ParseException { + QuadAcc acc = new QuadAcc() ; Template t = new Template (acc); -setInConstructTemplate(true) ; + setInConstructTemplate(true) ; jj_consume_token(LBRACE); ConstructQuads(acc); jj_consume_token(RBRACE); -setInConstructTemplate(false) ; - {if ("" != null) return t ;} + setInConstructTemplate(false) ; + {if (true) return t ;} throw new Error("Missing return statement in function"); -} + } final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -3180,19 +3104,19 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[96] = jj_gen; + jj_la1[97] = jj_gen; ; } -} + } - final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3216,127 +3140,124 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[97] = jj_gen; + jj_la1[98] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: PropertyListNotEmpty(s, acc); break; - } default: - jj_la1[98] = jj_gen; + jj_la1[99] = jj_gen; ; } -} + } - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { + Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[99] = jj_gen; + jj_la1[100] = jj_gen; break label_28; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: p = Verb(); ObjectList(s, p, null, acc); break; - } default: - jj_la1[100] = jj_gen; + jj_la1[101] = jj_gen; ; } } -} + } - final public Node Verb() throws ParseException {Node p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node Verb() throws ParseException { + Node p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: p = VarOrIri(); break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[101] = jj_gen; + jj_la1[102] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; Object(s, p, path, acc); label_29: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[102] = jj_gen; + jj_la1[103] = jj_gen; break label_29; } jj_consume_token(COMMA); Object(s, p, path, acc); } -} + } - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; Annotation(acc, s, p, path, o); -} + } - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3360,28 +3281,26 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[103] = jj_gen; + jj_la1[104] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3393,18 +3312,18 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: PropertyListPathNotEmpty(s, acc); break; - } default: - jj_la1[104] = jj_gen; + jj_la1[105] = jj_gen; ; } -} + } - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { + Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3414,35 +3333,32 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[105] = jj_gen; + jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); label_30: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[106] = jj_gen; + jj_la1[107] = jj_gen; break label_30; } jj_consume_token(SEMICOLON); -path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3454,8 +3370,8 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CARAT: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3465,159 +3381,160 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[107] = jj_gen; + jj_la1[108] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); break; - } default: - jj_la1[108] = jj_gen; + jj_la1[109] = jj_gen; ; } } -} + } - final public Path VerbPath() throws ParseException {Node p ; Path path ; + final public Path VerbPath() throws ParseException { + Node p ; Path path ; path = Path(); -{if ("" != null) return path ;} + {if (true) return path ;} throw new Error("Missing return statement in function"); -} + } - final public Node VerbSimple() throws ParseException {Node p ; + final public Node VerbSimple() throws ParseException { + Node p ; p = Var(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; ObjectPath(s, p, path, acc); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[109] = jj_gen; + jj_la1[110] = jj_gen; break label_31; } jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } -} + } - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; AnnotationPath(acc, s, p, path, o); -} + } - final public Path PathUnit() throws ParseException {Path p ; + final public Path PathUnit() throws ParseException { + Path p ; ByteOrderMark(); p = Path(); jj_consume_token(0); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path Path() throws ParseException {Path p ; + final public Path Path() throws ParseException { + Path p ; p = PathAlternative(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathAlternative() throws ParseException {Path p1 , p2 ; + final public Path PathAlternative() throws ParseException { + Path p1 , p2 ; p1 = PathSequence(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[110] = jj_gen; + jj_la1[111] = jj_gen; break label_32; } jj_consume_token(VBAR); p2 = PathSequence(); -p1 = PathFactory.pathAlt(p1, p2) ; + p1 = PathFactory.pathAlt(p1, p2) ; } -{if ("" != null) return p1 ;} + {if (true) return p1 ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathSequence() throws ParseException {Path p1 , p2 ; + final public Path PathSequence() throws ParseException { + Path p1 , p2 ; p1 = PathEltOrInverse(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SLASH: - case CARAT:{ + case CARAT: ; break; - } default: - jj_la1[111] = jj_gen; + jj_la1[112] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SLASH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SLASH: jj_consume_token(SLASH); p2 = PathEltOrInverse(); -p1 = PathFactory.pathSeq(p1, p2) ; + p1 = PathFactory.pathSeq(p1, p2) ; break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p2 = PathElt(); -p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; + p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; break; - } default: - jj_la1[112] = jj_gen; + jj_la1[113] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return p1;} + {if (true) return p1;} throw new Error("Missing return statement in function"); -} + } - final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException { + String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: case PLUS: case STAR: - case QMARK:{ + case QMARK: p = PathMod(p); break; - } default: - jj_la1[113] = jj_gen; + jj_la1[114] = jj_gen; ; } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException { + String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3626,351 +3543,327 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case MULTI: case SHORTEST: case LPAREN: - case BANG:{ + case BANG: p = PathElt(); break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p = PathElt(); -p = PathFactory.pathInverse(p) ; + p = PathFactory.pathInverse(p) ; break; - } default: - jj_la1[114] = jj_gen; + jj_la1[115] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case QMARK:{ + final public Path PathMod(Path p) throws ParseException { + long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QMARK: jj_consume_token(QMARK); -{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} + {if (true) return PathFactory.pathZeroOrOne(p) ;} break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} + {if (true) return PathFactory.pathZeroOrMore1(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); -{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} + {if (true) return PathFactory.pathOneOrMore1(p) ;} break; - } - case LBRACE:{ + case LBRACE: jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathZeroOrMoreN(p) ;} + {if (true) return PathFactory.pathZeroOrMoreN(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathOneOrMoreN(p) ;} + {if (true) return PathFactory.pathOneOrMoreN(p) ;} break; - } - case INTEGER:{ + case INTEGER: i1 = Integer(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case RBRACE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} + {if (true) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} break; - } - case INTEGER:{ + case INTEGER: i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, i2) ;} + {if (true) return PathFactory.pathMod(p, i1, i2) ;} break; - } default: - jj_la1[115] = jj_gen; + jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RBRACE:{ + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathFixedLength(p, i1) ;} + {if (true) return PathFactory.pathFixedLength(p, i1) ;} break; - } default: - jj_la1[116] = jj_gen; + jj_la1[117] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case COMMA:{ + case COMMA: jj_consume_token(COMMA); i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} + {if (true) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} break; - } default: - jj_la1[117] = jj_gen; + jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[118] = jj_gen; + jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathPrimary() throws ParseException { + String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; p = PathFactory.pathLink(n) ; + n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = PathFactory.pathLink(nRDFtype) ; + p = PathFactory.pathLink(nRDFtype) ; break; - } - case BANG:{ + case BANG: jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; - } - case DISTINCT:{ + case DISTINCT: jj_consume_token(DISTINCT); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathDistinct(p) ; + p = PathFactory.pathDistinct(p) ; jj_consume_token(RPAREN); break; - } - case SHORTEST:{ + case SHORTEST: jj_consume_token(SHORTEST); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathShortest(p) ; + p = PathFactory.pathShortest(p) ; jj_consume_token(RPAREN); break; - } - case MULTI:{ + case MULTI: jj_consume_token(MULTI); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathMulti(p) ; + p = PathFactory.pathMulti(p) ; jj_consume_token(RPAREN); break; - } default: - jj_la1[119] = jj_gen; + jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; -pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException { + P_Path0 p ; P_NegPropSet pNegSet ; + pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[120] = jj_gen; + jj_la1[121] = jj_gen; break label_34; } jj_consume_token(VBAR); p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; } break; - } default: - jj_la1[121] = jj_gen; + jj_la1[122] = jj_gen; ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[122] = jj_gen; + jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return pNegSet ;} + {if (true) return pNegSet ;} throw new Error("Missing return statement in function"); -} + } - final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException { + String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} + n = createNode(str) ; {if (true) return new P_Link(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_Link(nRDFtype) ;} + {if (true) return new P_Link(nRDFtype) ;} break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} + n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_ReverseLink(nRDFtype) ;} + {if (true) return new P_ReverseLink(nRDFtype) ;} break; - } default: - jj_la1[123] = jj_gen; + jj_la1[124] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[124] = jj_gen; + jj_la1[125] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public long Integer() throws ParseException {Token t ; + final public long Integer() throws ParseException { + Token t ; t = jj_consume_token(INTEGER); -{if ("" != null) return integerValue(t.image) ;} + {if (true) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = Collection(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyList(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[125] = jj_gen; + jj_la1[126] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = CollectionPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyListPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[126] = jj_gen; + jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_35: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3996,37 +3889,37 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[127] = jj_gen; + jj_la1[128] = jj_gen; break label_35; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_36: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4052,56 +3945,54 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[128] = jj_gen; + jj_la1[129] = jj_gen; break label_36; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } final public void AnnotationPath(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createTripleTerm(s, pAnn, o, token.beginLine, token.beginColumn); PropertyListPathNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[129] = jj_gen; + jj_la1[130] = jj_gen; ; } -} + } final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createTripleTerm(s, p, o, token.beginLine, token.beginColumn); PropertyListNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[130] = jj_gen; + jj_la1[131] = jj_gen; ; } -} + } - final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4125,27 +4016,26 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNode(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[131] = jj_gen; + jj_la1[132] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4169,36 +4059,33 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNodePath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[132] = jj_gen; + jj_la1[133] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrTerm() throws ParseException {Node n = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LT2:{ + final public Node VarOrTerm() throws ParseException { + Node n = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LT2: n = TripleTerm(); break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4219,75 +4106,73 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = GraphTerm(); break; - } default: - jj_la1[133] = jj_gen; + jj_la1[134] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TripleTerm() throws ParseException {Node n = null ; Token t ; Node s , p , o ; + final public Node TripleTerm() throws ParseException { + Node n = null ; Token t ; Node s , p , o ; t = jj_consume_token(LT2); s = VarOrTerm(); p = Verb(); o = VarOrTerm(); -n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); + n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node TripleTermData() throws ParseException {Node n = null ; Token t ; String iri ; Node s , p , o ; + final public Node TripleTermData() throws ParseException { + Node n = null ; Token t ; String iri ; Node s , p , o ; t = jj_consume_token(LT2); s = DataValueTerm(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -p = createNode(iri) ; + p = createNode(iri) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[134] = jj_gen; + jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } o = DataValueTerm(); -n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); + n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node DataValueTerm() throws ParseException {Node n = null ; String iri ; Node s , p , o ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataValueTerm() throws ParseException { + Node n = null ; String iri ; Node s , p , o ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4296,117 +4181,109 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LT2:{ + case LT2: n = TripleTermData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[135] = jj_gen; + jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[136] = jj_gen; + jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[137] = jj_gen; + jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Var Var() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR1:{ + final public Var Var() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VAR1: t = jj_consume_token(VAR1); break; - } - case VAR2:{ + case VAR2: t = jj_consume_token(VAR2); break; - } default: - jj_la1[138] = jj_gen; + jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - final public Node GraphTerm() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphTerm() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4415,93 +4292,92 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return nRDFnil ;} + {if (true) return nRDFnil ;} break; - } default: - jj_la1[139] = jj_gen; + jj_la1[140] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr Expression() throws ParseException {Expr expr ; + final public Expr Expression() throws ParseException { + Expr expr ; expr = ConditionalOrExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_37: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: ; break; - } default: - jj_la1[140] = jj_gen; + jj_la1[141] = jj_gen; break label_37; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); -expr1 = new E_LogicalOr(expr1, expr2) ; + expr1 = new E_LogicalOr(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ValueLogical(); label_38: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: ; break; - } default: - jj_la1[141] = jj_gen; + jj_la1[142] = jj_gen; break label_38; } jj_consume_token(SC_AND); expr2 = ValueLogical(); -expr1 = new E_LogicalAnd(expr1, expr2) ; + expr1 = new E_LogicalAnd(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ValueLogical() throws ParseException {Expr expr ; + final public Expr ValueLogical() throws ParseException { + Expr expr ; expr = RelationalExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException { + Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case IN: case EQ: @@ -4509,83 +4385,76 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case GT: case LT: case LE: - case GE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ + case GE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: jj_consume_token(EQ); expr2 = NumericExpression(); -expr1 = new E_Equals(expr1, expr2) ; + expr1 = new E_Equals(expr1, expr2) ; break; - } - case NE:{ + case NE: jj_consume_token(NE); expr2 = NumericExpression(); -expr1 = new E_NotEquals(expr1, expr2) ; + expr1 = new E_NotEquals(expr1, expr2) ; break; - } - case LT:{ + case LT: jj_consume_token(LT); expr2 = NumericExpression(); -expr1 = new E_LessThan(expr1, expr2) ; + expr1 = new E_LessThan(expr1, expr2) ; break; - } - case GT:{ + case GT: jj_consume_token(GT); expr2 = NumericExpression(); -expr1 = new E_GreaterThan(expr1, expr2) ; + expr1 = new E_GreaterThan(expr1, expr2) ; break; - } - case LE:{ + case LE: jj_consume_token(LE); expr2 = NumericExpression(); -expr1 = new E_LessThanOrEqual(expr1, expr2) ; + expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - } - case GE:{ + case GE: jj_consume_token(GE); expr2 = NumericExpression(); -expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; + expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - } - case IN:{ + case IN: jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_OneOf(expr1, a) ; + expr1 = new E_OneOf(expr1, a) ; break; - } - case NOT:{ + case NOT: jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_NotOneOf(expr1, a) ; + expr1 = new E_NotOneOf(expr1, a) ; break; - } default: - jj_la1[142] = jj_gen; + jj_la1[143] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[143] = jj_gen; + jj_la1[144] = jj_gen; ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NumericExpression() throws ParseException {Expr expr ; + final public Expr NumericExpression() throws ParseException { + Expr expr ; expr = AdditiveExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException { + Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_39: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -4593,175 +4462,160 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS:{ + case MINUS: ; break; - } default: - jj_la1[144] = jj_gen; + jj_la1[145] = jj_gen; break label_39; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Add(expr1, expr2) ; + expr1 = new E_Add(expr1, expr2) ; break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Subtract(expr1, expr2) ; + expr1 = new E_Subtract(expr1, expr2) ; break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOUBLE_NEGATIVE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; - } default: - jj_la1[145] = jj_gen; + jj_la1[146] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_40: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[146] = jj_gen; + jj_la1[147] = jj_gen; break label_40; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr3 = UnaryExpression(); -expr2 = new E_Multiply(expr2, expr3) ; + expr2 = new E_Multiply(expr2, expr3) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr3 = UnaryExpression(); -expr2 = new E_Divide(expr2, expr3) ; + expr2 = new E_Divide(expr2, expr3) ; break; - } default: - jj_la1[147] = jj_gen; + jj_la1[148] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -if ( addition ) + if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; - } default: - jj_la1[148] = jj_gen; + jj_la1[149] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = UnaryExpression(); label_41: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MOD: case IDIV: case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[149] = jj_gen; + jj_la1[150] = jj_gen; break label_41; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr2 = UnaryExpression(); -expr1 = new E_Multiply(expr1, expr2) ; + expr1 = new E_Multiply(expr1, expr2) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr2 = UnaryExpression(); -expr1 = new E_Divide(expr1, expr2) ; + expr1 = new E_Divide(expr1, expr2) ; break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); expr2 = UnaryExpression(); -expr1 = new E_OpNumericMod(expr1, expr2) ; + expr1 = new E_OpNumericMod(expr1, expr2) ; break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); expr2 = UnaryExpression(); -expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; + expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; - } default: - jj_la1[150] = jj_gen; + jj_la1[151] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr UnaryExpression() throws ParseException {Expr expr ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BANG:{ + final public Expr UnaryExpression() throws ParseException { + Expr expr ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: jj_consume_token(BANG); expr = PrimaryExpression(); -{if ("" != null) return new E_LogicalNot(expr) ;} + {if (true) return new E_LogicalNot(expr) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryPlus(expr) ;} + {if (true) return new E_UnaryPlus(expr) ;} break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryMinus(expr) ;} + {if (true) return new E_UnaryMinus(expr) ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4862,26 +4716,25 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case LPAREN: - case LT2:{ + case LT2: expr = PrimaryExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: - jj_la1[151] = jj_gen; + jj_la1[152] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr PrimaryExpression() throws ParseException { + Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: expr = BrackettedExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -4960,26 +4813,23 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = iriOrFunction(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4988,52 +4838,47 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } - case LT2:{ + case LT2: n = ExprTripleTerm(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } default: - jj_la1[152] = jj_gen; + jj_la1[153] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node ExprVarOrTerm() throws ParseException {Node n; String s; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node ExprVarOrTerm() throws ParseException { + Node n; String s; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: s = iri(); -n = createNode(s); + n = createNode(s); break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -5042,56 +4887,55 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } - case LT2:{ + case LT2: n = ExprTripleTerm(); break; - } default: - jj_la1[153] = jj_gen; + jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node ExprTripleTerm() throws ParseException {Token t ; Node s,p,o,n; + final public Node ExprTripleTerm() throws ParseException { + Token t ; Node s,p,o,n; t = jj_consume_token(LT2); s = ExprVarOrTerm(); p = Verb(); o = ExprVarOrTerm(); -n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); + n = createTripleTerm(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Expr BrackettedExpression() throws ParseException {Expr expr ; + final public Expr BrackettedExpression() throws ParseException { + Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr BuiltInCall() throws ParseException {Expr expr ; + final public Expr BuiltInCall() throws ParseException { + Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AGG: case COUNT: case MIN: @@ -5107,427 +4951,375 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VAR_SAMP: case VAR_POP: case SAMPLE: - case GROUP_CONCAT:{ + case GROUP_CONCAT: expr = Aggregate(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STR:{ + case STR: jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Str(expr) ;} + {if (true) return new E_Str(expr) ;} break; - } - case LANG:{ + case LANG: jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Lang(expr) ;} + {if (true) return new E_Lang(expr) ;} break; - } - case LANGMATCHES:{ + case LANGMATCHES: jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_LangMatches(expr1, expr2) ;} + {if (true) return new E_LangMatches(expr1, expr2) ;} break; - } - case DTYPE:{ + case DTYPE: jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Datatype(expr) ;} + {if (true) return new E_Datatype(expr) ;} break; - } - case BOUND:{ + case BOUND: jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} + {if (true) return new E_Bound(new ExprVar(gn)) ;} break; - } - case IRI:{ + case IRI: jj_consume_token(IRI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[154] = jj_gen; + jj_la1[155] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_IRI(expr1, expr2) ;} + {if (true) return makeFunction_IRI(expr1, expr2) ;} break; - } - case URI:{ + case URI: jj_consume_token(URI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[155] = jj_gen; + jj_la1[156] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_URI(expr1, expr2) ;} + {if (true) return makeFunction_URI(expr1, expr2) ;} break; - } - case BNODE:{ + case BNODE: jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_BNode(expr1) ;} + {if (true) return new E_BNode(expr1) ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return new E_BNode() ;} + {if (true) return new E_BNode() ;} break; - } default: - jj_la1[156] = jj_gen; + jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RAND:{ + case RAND: jj_consume_token(RAND); jj_consume_token(NIL); -{if ("" != null) return new E_Random() ;} + {if (true) return new E_Random() ;} break; - } - case ABS:{ + case ABS: jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumAbs(expr1) ;} + {if (true) return new E_NumAbs(expr1) ;} break; - } - case CEIL:{ + case CEIL: jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumCeiling(expr1) ;} + {if (true) return new E_NumCeiling(expr1) ;} break; - } - case FLOOR:{ + case FLOOR: jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumFloor(expr1) ;} + {if (true) return new E_NumFloor(expr1) ;} break; - } - case ROUND:{ + case ROUND: jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumRound(expr1) ;} + {if (true) return new E_NumRound(expr1) ;} break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericMod(expr1, expr2);} + {if (true) return new E_OpNumericMod(expr1, expr2);} break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericIntegerDivide(expr1, expr2);} + {if (true) return new E_OpNumericIntegerDivide(expr1, expr2);} break; - } - case CONCAT:{ + case CONCAT: jj_consume_token(CONCAT); a = ExpressionList(); -{if ("" != null) return new E_StrConcat(a) ;} + {if (true) return new E_StrConcat(a) ;} break; - } - case SUBSTR:{ + case SUBSTR: expr = SubstringExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STRLEN:{ + case STRLEN: jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLength(expr1) ;} + {if (true) return new E_StrLength(expr1) ;} break; - } - case REPLACE:{ + case REPLACE: expr = StrReplaceExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case UCASE:{ + case UCASE: jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrUpperCase(expr1) ;} + {if (true) return new E_StrUpperCase(expr1) ;} break; - } - case LCASE:{ + case LCASE: jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLowerCase(expr1) ;} + {if (true) return new E_StrLowerCase(expr1) ;} break; - } - case ENCODE_FOR_URI:{ + case ENCODE_FOR_URI: jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEncodeForURI(expr1) ;} + {if (true) return new E_StrEncodeForURI(expr1) ;} break; - } - case CONTAINS:{ + case CONTAINS: jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrContains(expr1, expr2) ;} + {if (true) return new E_StrContains(expr1, expr2) ;} break; - } - case STRSTARTS:{ + case STRSTARTS: jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} + {if (true) return new E_StrStartsWith(expr1, expr2) ;} break; - } - case STRENDS:{ + case STRENDS: jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} + {if (true) return new E_StrEndsWith(expr1, expr2) ;} break; - } - case STRBEFORE:{ + case STRBEFORE: jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrBefore(expr1, expr2) ;} + {if (true) return new E_StrBefore(expr1, expr2) ;} break; - } - case STRAFTER:{ + case STRAFTER: jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrAfter(expr1, expr2) ;} + {if (true) return new E_StrAfter(expr1, expr2) ;} break; - } - case YEAR:{ + case YEAR: jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeYear(expr1) ;} + {if (true) return new E_DateTimeYear(expr1) ;} break; - } - case MONTH:{ + case MONTH: jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMonth(expr1) ;} + {if (true) return new E_DateTimeMonth(expr1) ;} break; - } - case DAY:{ + case DAY: jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeDay(expr1) ;} + {if (true) return new E_DateTimeDay(expr1) ;} break; - } - case HOURS:{ + case HOURS: jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeHours(expr1) ;} + {if (true) return new E_DateTimeHours(expr1) ;} break; - } - case MINUTES:{ + case MINUTES: jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMinutes(expr1) ;} + {if (true) return new E_DateTimeMinutes(expr1) ;} break; - } - case SECONDS:{ + case SECONDS: jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeSeconds(expr1) ;} + {if (true) return new E_DateTimeSeconds(expr1) ;} break; - } - case TIMEZONE:{ + case TIMEZONE: jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTimezone(expr1) ;} + {if (true) return new E_DateTimeTimezone(expr1) ;} break; - } - case TZ:{ + case TZ: jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTZ(expr1) ;} + {if (true) return new E_DateTimeTZ(expr1) ;} break; - } - case NOW:{ + case NOW: jj_consume_token(NOW); jj_consume_token(NIL); -{if ("" != null) return new E_Now() ;} + {if (true) return new E_Now() ;} break; - } - case UUID:{ + case UUID: jj_consume_token(UUID); jj_consume_token(NIL); -{if ("" != null) return new E_UUID() ;} + {if (true) return new E_UUID() ;} break; - } - case STRUUID:{ + case STRUUID: jj_consume_token(STRUUID); jj_consume_token(NIL); -{if ("" != null) return new E_StrUUID() ;} + {if (true) return new E_StrUUID() ;} break; - } - case MD5:{ + case MD5: jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_MD5(expr1) ;} + {if (true) return new E_MD5(expr1) ;} break; - } - case SHA1:{ + case SHA1: jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA1(expr1) ;} + {if (true) return new E_SHA1(expr1) ;} break; - } - case SHA256:{ + case SHA256: jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA256(expr1) ;} + {if (true) return new E_SHA256(expr1) ;} break; - } - case SHA384:{ + case SHA384: jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA384(expr1) ;} + {if (true) return new E_SHA384(expr1) ;} break; - } - case SHA512:{ + case SHA512: jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA512(expr1) ;} + {if (true) return new E_SHA512(expr1) ;} break; - } - case VERSION:{ + case VERSION: jj_consume_token(VERSION); jj_consume_token(NIL); -{if ("" != null) return new E_Version();} + {if (true) return new E_Version();} break; - } - case COALESCE:{ + case COALESCE: jj_consume_token(COALESCE); a = ExpressionList(); -{if ("" != null) return new E_Coalesce(a) ;} + {if (true) return new E_Coalesce(a) ;} break; - } - case CALL:{ + case CALL: jj_consume_token(CALL); -a = new ExprList() ; + a = new ExprList() ; jj_consume_token(LPAREN); expr = Expression(); -a.add(expr) ; + a.add(expr) ; label_42: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[157] = jj_gen; + jj_la1[158] = jj_gen; break label_42; } jj_consume_token(COMMA); expr = Expression(); -a.add(expr) ; + a.add(expr) ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Call(a) ;} + {if (true) return new E_Call(a) ;} break; - } - case IF:{ + case IF: jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -5536,103 +5328,90 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} + {if (true) return new E_Conditional(expr, expr1, expr2) ;} break; - } - case STRLANG:{ + case STRLANG: jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLang(expr1, expr2) ;} + {if (true) return new E_StrLang(expr1, expr2) ;} break; - } - case STRDT:{ + case STRDT: jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} + {if (true) return new E_StrDatatype(expr1, expr2) ;} break; - } - case SAME_TERM:{ + case SAME_TERM: jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SameTerm(expr1, expr2) ;} + {if (true) return new E_SameTerm(expr1, expr2) ;} break; - } - case IS_IRI:{ + case IS_IRI: jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsIRI(expr) ;} + {if (true) return new E_IsIRI(expr) ;} break; - } - case IS_URI:{ + case IS_URI: jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsURI(expr) ;} + {if (true) return new E_IsURI(expr) ;} break; - } - case IS_BLANK:{ + case IS_BLANK: jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsBlank(expr) ;} + {if (true) return new E_IsBlank(expr) ;} break; - } - case IS_LITERAL:{ + case IS_LITERAL: jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsLiteral(expr) ;} + {if (true) return new E_IsLiteral(expr) ;} break; - } - case IS_NUMERIC:{ + case IS_NUMERIC: jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsNumeric(expr) ;} + {if (true) return new E_IsNumeric(expr) ;} break; - } - case REGEX:{ + case REGEX: expr = RegexExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case EXISTS:{ + case EXISTS: expr = ExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case NOT:{ + case NOT: expr = NotExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case IS_TRIPLE:{ + case IS_TRIPLE: jj_consume_token(IS_TRIPLE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsTriple(expr) ;} + {if (true) return new E_IsTriple(expr) ;} break; - } - case TRIPLE:{ + case TRIPLE: jj_consume_token(TRIPLE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5641,84 +5420,81 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr3 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleFn(expr1, expr2, expr3) ;} + {if (true) return new E_TripleFn(expr1, expr2, expr3) ;} break; - } - case SUBJECT:{ + case SUBJECT: jj_consume_token(SUBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleSubject(expr) ;} + {if (true) return new E_TripleSubject(expr) ;} break; - } - case PREDICATE:{ + case PREDICATE: jj_consume_token(PREDICATE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TriplePredicate(expr) ;} + {if (true) return new E_TriplePredicate(expr) ;} break; - } - case OBJECT:{ + case OBJECT: jj_consume_token(OBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleObject(expr) ;} + {if (true) return new E_TripleObject(expr) ;} break; - } default: - jj_la1[158] = jj_gen; + jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException { + Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); flagsExpr = Expression(); break; - } default: - jj_la1[159] = jj_gen; + jj_la1[160] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} + {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr3 = Expression(); break; - } default: - jj_la1[160] = jj_gen; + jj_la1[161] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} + {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5726,61 +5502,61 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr4 = Expression(); break; - } default: - jj_la1[161] = jj_gen; + jj_la1[162] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} + {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ExistsFunc() throws ParseException {Element el ; + final public Expr ExistsFunc() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprExists(el) ;} + {if (true) return createExprExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NotExistsFunc() throws ParseException {Element el ; + final public Expr NotExistsFunc() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprNotExists(el) ;} + {if (true) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException { + Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; -startAggregate(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COUNT:{ + startAggregate(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[162] = jj_gen; + jj_la1[163] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -5884,1347 +5660,1210 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case LT2: case BANG: case PLUS: - case MINUS:{ + case MINUS: expr = Expression(); break; - } default: - jj_la1[163] = jj_gen; + jj_la1[164] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); -if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } + if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - } - case SUM:{ + case SUM: t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[164] = jj_gen; + jj_la1[165] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSum(distinct, expr) ; + agg = AggregatorFactory.createSum(distinct, expr) ; break; - } - case MIN:{ + case MIN: t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[165] = jj_gen; + jj_la1[166] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMin(distinct, expr) ; + agg = AggregatorFactory.createMin(distinct, expr) ; break; - } - case MAX:{ + case MAX: t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[166] = jj_gen; + jj_la1[167] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMax(distinct, expr) ; + agg = AggregatorFactory.createMax(distinct, expr) ; break; - } - case AVG:{ + case AVG: t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[167] = jj_gen; + jj_la1[168] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createAvg(distinct, expr) ; + agg = AggregatorFactory.createAvg(distinct, expr) ; break; - } - case MEDIAN:{ + case MEDIAN: t = jj_consume_token(MEDIAN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[168] = jj_gen; + jj_la1[169] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMedian(distinct, expr) ; + agg = AggregatorFactory.createMedian(distinct, expr) ; break; - } - case MODE:{ + case MODE: t = jj_consume_token(MODE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[169] = jj_gen; + jj_la1[170] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMode(distinct, expr) ; + agg = AggregatorFactory.createMode(distinct, expr) ; break; - } - case SAMPLE:{ + case SAMPLE: t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[170] = jj_gen; + jj_la1[171] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSample(distinct, expr) ; + agg = AggregatorFactory.createSample(distinct, expr) ; break; - } - case GROUP_CONCAT:{ + case GROUP_CONCAT: t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[171] = jj_gen; + jj_la1[172] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: if (jj_2_5(2)) { jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[172] = jj_gen; + jj_la1[173] = jj_gen; ; } } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[173] = jj_gen; + jj_la1[174] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; - } default: - jj_la1[174] = jj_gen; + jj_la1[175] = jj_gen; ; } jj_consume_token(RPAREN); -agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; + agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; - } - case STDEV:{ + case STDEV: t = jj_consume_token(STDEV); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[175] = jj_gen; + jj_la1[176] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; break; - } - case STDEV_SAMP:{ + case STDEV_SAMP: t = jj_consume_token(STDEV_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[176] = jj_gen; + jj_la1[177] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; break; - } - case STDEV_POP:{ + case STDEV_POP: t = jj_consume_token(STDEV_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[177] = jj_gen; + jj_la1[178] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; break; - } - case VARIANCE:{ + case VARIANCE: t = jj_consume_token(VARIANCE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[178] = jj_gen; + jj_la1[179] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; break; - } - case VAR_SAMP:{ + case VAR_SAMP: t = jj_consume_token(VAR_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[179] = jj_gen; + jj_la1[180] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; break; - } - case VAR_POP:{ + case VAR_POP: t = jj_consume_token(VAR_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[180] = jj_gen; + jj_la1[181] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; break; - } - case AGG:{ + case AGG: t = jj_consume_token(AGG); -String iri ; + String iri ; iri = iri(); -Args a = new Args() ; + Args a = new Args() ; a = ArgList(); -agg = AggregatorFactory.createCustom(iri, a) ; + agg = AggregatorFactory.createCustom(iri, a) ; break; - } default: - jj_la1[181] = jj_gen; + jj_la1[182] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( ! getAllowAggregatesInExpressions() ) + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: - jj_la1[182] = jj_gen; + jj_la1[183] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: - jj_la1[183] = jj_gen; + jj_la1[184] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[184] = jj_gen; + jj_la1[185] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: - jj_la1[185] = jj_gen; + jj_la1[186] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[186] = jj_gen; + jj_la1[187] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[187] = jj_gen; + jj_la1[188] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[188] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: - jj_la1[189] = jj_gen; + jj_la1[190] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: - jj_la1[190] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: - jj_la1[191] = jj_gen; + jj_la1[192] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[192] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[193] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - private boolean jj_2_1(int xla) - { + private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_1()); } + try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - private boolean jj_2_2(int xla) - { + private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_2()); } + try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - private boolean jj_2_3(int xla) - { + private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_3()); } + try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - private boolean jj_2_4(int xla) - { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_4()); } + try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - private boolean jj_2_5(int xla) - { + private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_5()); } + try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - private boolean jj_3R_SubstringExpression_1522_5_117() - { - if (jj_scan_token(SUBSTR)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_RegexExpression_1510_5_119() - { + private boolean jj_3R_119() { if (jj_scan_token(REGEX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1504_5_109() - { + private boolean jj_3R_109() { if (jj_scan_token(OBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1502_5_108() - { + private boolean jj_3R_108() { if (jj_scan_token(PREDICATE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1500_5_107() - { + private boolean jj_3R_107() { if (jj_scan_token(SUBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1498_5_106() - { + private boolean jj_3R_106() { if (jj_scan_token(TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3_2() - { - if (jj_scan_token(SEMICOLON)) return true; - if (jj_3R_Prologue_70_3_44()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(145)) { - jj_scanpos = xsp; - if (jj_scan_token(146)) { - jj_scanpos = xsp; - if (jj_scan_token(153)) { - jj_scanpos = xsp; - if (jj_scan_token(148)) { - jj_scanpos = xsp; - if (jj_scan_token(149)) { - jj_scanpos = xsp; - if (jj_scan_token(150)) { - jj_scanpos = xsp; - if (jj_scan_token(147)) { - jj_scanpos = xsp; - if (jj_scan_token(158)) { - jj_scanpos = xsp; - if (jj_scan_token(141)) { - jj_scanpos = xsp; - if (jj_scan_token(140)) { - jj_scanpos = xsp; - if (jj_scan_token(159)) { - jj_scanpos = xsp; - if (jj_scan_token(142)) { - jj_scanpos = xsp; - if (jj_scan_token(143)) { - jj_scanpos = xsp; - if (jj_scan_token(144)) return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_BuiltInCall_1496_5_105() - { + private boolean jj_3R_105() { if (jj_scan_token(IS_TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1495_5_104() - { - if (jj_3R_NotExistsFunc_1551_4_121()) return true; + private boolean jj_3R_104() { + if (jj_3R_121()) return true; return false; } - private boolean jj_3R_BuiltInCall_1494_5_103() - { - if (jj_3R_ExistsFunc_1545_4_120()) return true; + private boolean jj_3R_103() { + if (jj_3R_120()) return true; return false; } - private boolean jj_3R_BuiltInCall_1493_5_102() - { - if (jj_3R_RegexExpression_1510_5_119()) return true; + private boolean jj_3R_102() { + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_BuiltInCall_1490_5_101() - { + private boolean jj_3R_101() { if (jj_scan_token(IS_NUMERIC)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Collection_1108_3_156() - { + private boolean jj_3R_156() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1488_5_100() - { + private boolean jj_3R_100() { if (jj_scan_token(IS_LITERAL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1486_5_99() - { + private boolean jj_3R_99() { if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1484_5_98() - { + private boolean jj_3R_98() { if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1482_5_97() - { + private boolean jj_3_2() { + if (jj_scan_token(SEMICOLON)) return true; + if (jj_3R_44()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(146)) { + jj_scanpos = xsp; + if (jj_scan_token(147)) { + jj_scanpos = xsp; + if (jj_scan_token(154)) { + jj_scanpos = xsp; + if (jj_scan_token(149)) { + jj_scanpos = xsp; + if (jj_scan_token(150)) { + jj_scanpos = xsp; + if (jj_scan_token(151)) { + jj_scanpos = xsp; + if (jj_scan_token(148)) { + jj_scanpos = xsp; + if (jj_scan_token(159)) { + jj_scanpos = xsp; + if (jj_scan_token(142)) { + jj_scanpos = xsp; + if (jj_scan_token(141)) { + jj_scanpos = xsp; + if (jj_scan_token(160)) { + jj_scanpos = xsp; + if (jj_scan_token(143)) { + jj_scanpos = xsp; + if (jj_scan_token(144)) { + jj_scanpos = xsp; + if (jj_scan_token(145)) return true; + } + } + } + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_97() { if (jj_scan_token(IS_IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1480_5_96() - { + private boolean jj_3R_96() { if (jj_scan_token(SAME_TERM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1478_5_95() - { + private boolean jj_3R_95() { if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1476_5_94() - { + private boolean jj_3R_94() { if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1472_5_93() - { + private boolean jj_3R_93() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BlankNodePropertyList_1085_3_157() - { + private boolean jj_3R_157() { if (jj_scan_token(LBRACKET)) return true; return false; } - private boolean jj_3R_BuiltInCall_1465_5_92() - { + private boolean jj_3R_92() { if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1463_5_91() - { + private boolean jj_3R_91() { if (jj_scan_token(COALESCE)) return true; - if (jj_3R_ExpressionList_826_3_116()) return true; + if (jj_3R_116()) return true; return false; } - private boolean jj_3R_TriplesNode_1081_3_150() - { - if (jj_3R_BlankNodePropertyList_1085_3_157()) return true; + private boolean jj_3R_150() { + if (jj_3R_157()) return true; return false; } - private boolean jj_3R_BuiltInCall_1462_5_90() - { + private boolean jj_3R_90() { if (jj_scan_token(VERSION)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1461_5_89() - { + private boolean jj_3R_89() { if (jj_scan_token(SHA512)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_TriplesNode_1079_3_125() - { + private boolean jj_3R_125() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesNode_1079_3_149()) { + if (jj_3R_149()) { jj_scanpos = xsp; - if (jj_3R_TriplesNode_1081_3_150()) return true; + if (jj_3R_150()) return true; } return false; } - private boolean jj_3R_TriplesNode_1079_3_149() - { - if (jj_3R_Collection_1108_3_156()) return true; + private boolean jj_3R_149() { + if (jj_3R_156()) return true; return false; } - private boolean jj_3R_BuiltInCall_1460_5_88() - { + private boolean jj_3R_88() { if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1459_5_87() - { + private boolean jj_3R_87() { if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1458_5_86() - { + private boolean jj_3R_86() { if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1457_5_85() - { + private boolean jj_3R_85() { if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1456_5_84() - { + private boolean jj_3R_84() { if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1455_5_83() - { + private boolean jj_3R_83() { if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1454_5_82() - { + private boolean jj_3R_82() { if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1453_5_81() - { + private boolean jj_3R_81() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1452_5_80() - { + private boolean jj_3R_80() { if (jj_scan_token(TIMEZONE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1451_5_79() - { + private boolean jj_3R_79() { if (jj_scan_token(SECONDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1450_5_78() - { + private boolean jj_3R_78() { if (jj_scan_token(MINUTES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1449_5_77() - { + private boolean jj_3R_77() { if (jj_scan_token(HOURS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1448_5_76() - { + private boolean jj_3R_76() { if (jj_scan_token(DAY)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1447_5_75() - { + private boolean jj_3R_75() { if (jj_scan_token(MONTH)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1446_5_74() - { + private boolean jj_3R_74() { if (jj_scan_token(YEAR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1444_5_73() - { + private boolean jj_3R_73() { if (jj_scan_token(STRAFTER)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1442_5_72() - { + private boolean jj_3R_72() { if (jj_scan_token(STRBEFORE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1440_5_71() - { + private boolean jj_3R_71() { if (jj_scan_token(STRENDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1438_5_70() - { + private boolean jj_3R_70() { if (jj_scan_token(STRSTARTS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1436_5_69() - { + private boolean jj_3R_69() { if (jj_scan_token(CONTAINS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1435_5_68() - { + private boolean jj_3R_68() { if (jj_scan_token(ENCODE_FOR_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1434_5_67() - { + private boolean jj_3R_67() { if (jj_scan_token(LCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1433_5_66() - { + private boolean jj_3R_66() { if (jj_scan_token(UCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1432_5_65() - { - if (jj_3R_StrReplaceExpression_1534_3_118()) return true; + private boolean jj_3R_65() { + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_BuiltInCall_1431_5_64() - { + private boolean jj_3R_64() { if (jj_scan_token(STRLEN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1430_5_63() - { - if (jj_3R_SubstringExpression_1522_5_117()) return true; + private boolean jj_3R_63() { + if (jj_3R_117()) return true; return false; } - private boolean jj_3R_BuiltInCall_1429_5_62() - { + private boolean jj_3R_62() { if (jj_scan_token(CONCAT)) return true; - if (jj_3R_ExpressionList_826_3_116()) return true; + if (jj_3R_116()) return true; return false; } - private boolean jj_3R_BuiltInCall_1428_5_61() - { + private boolean jj_3R_61() { if (jj_scan_token(IDIV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1427_5_60() - { + private boolean jj_3R_60() { if (jj_scan_token(MOD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1426_5_59() - { + private boolean jj_3R_59() { if (jj_scan_token(ROUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1425_5_58() - { + private boolean jj_3R_58() { if (jj_scan_token(FLOOR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1424_5_57() - { + private boolean jj_3R_57() { if (jj_scan_token(CEIL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1423_5_56() - { + private boolean jj_3R_56() { if (jj_scan_token(ABS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1422_5_55() - { + private boolean jj_3R_55() { if (jj_scan_token(RAND)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1420_7_115() - { + private boolean jj_3R_115() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1417_7_114() - { + private boolean jj_3R_114() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1416_5_54() - { + private boolean jj_3R_54() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1417_7_114()) { + if (jj_3R_114()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1420_7_115()) return true; + if (jj_3R_115()) return true; } return false; } - private boolean jj_3R_BuiltInCall_1414_5_53() - { + private boolean jj_3R_53() { if (jj_scan_token(URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1412_5_52() - { + private boolean jj_3R_52() { if (jj_scan_token(IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1410_5_51() - { + private boolean jj_3R_51() { if (jj_scan_token(BOUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1408_5_50() - { + private boolean jj_3R_50() { if (jj_scan_token(DTYPE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1405_5_49() - { + private boolean jj_3R_49() { if (jj_scan_token(LANGMATCHES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1403_5_48() - { + private boolean jj_3R_48() { if (jj_scan_token(LANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1401_5_47() - { + private boolean jj_3R_47() { if (jj_scan_token(STR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1399_5_46() - { - if (jj_3R_Aggregate_1561_3_113()) return true; + private boolean jj_3R_46() { + if (jj_3R_113()) return true; return false; } - private boolean jj_3R_BuiltInCall_1399_5_43() - { + private boolean jj_3R_43() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1399_5_46()) { + if (jj_3R_46()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1401_5_47()) { + if (jj_3R_47()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1403_5_48()) { + if (jj_3R_48()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1405_5_49()) { + if (jj_3R_49()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1408_5_50()) { + if (jj_3R_50()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1410_5_51()) { + if (jj_3R_51()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1412_5_52()) { + if (jj_3R_52()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1414_5_53()) { + if (jj_3R_53()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1416_5_54()) { + if (jj_3R_54()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1422_5_55()) { + if (jj_3R_55()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1423_5_56()) { + if (jj_3R_56()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1424_5_57()) { + if (jj_3R_57()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1425_5_58()) { + if (jj_3R_58()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1426_5_59()) { + if (jj_3R_59()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1427_5_60()) { + if (jj_3R_60()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1428_5_61()) { + if (jj_3R_61()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1429_5_62()) { + if (jj_3R_62()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1430_5_63()) { + if (jj_3R_63()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1431_5_64()) { + if (jj_3R_64()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1432_5_65()) { + if (jj_3R_65()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1433_5_66()) { + if (jj_3R_66()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1434_5_67()) { + if (jj_3R_67()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1435_5_68()) { + if (jj_3R_68()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1436_5_69()) { + if (jj_3R_69()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1438_5_70()) { + if (jj_3R_70()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1440_5_71()) { + if (jj_3R_71()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1442_5_72()) { + if (jj_3R_72()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1444_5_73()) { + if (jj_3R_73()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1446_5_74()) { + if (jj_3R_74()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1447_5_75()) { + if (jj_3R_75()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1448_5_76()) { + if (jj_3R_76()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1449_5_77()) { + if (jj_3R_77()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1450_5_78()) { + if (jj_3R_78()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1451_5_79()) { + if (jj_3R_79()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1452_5_80()) { + if (jj_3R_80()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1453_5_81()) { + if (jj_3R_81()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1454_5_82()) { + if (jj_3R_82()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1455_5_83()) { + if (jj_3R_83()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1456_5_84()) { + if (jj_3R_84()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1457_5_85()) { + if (jj_3R_85()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1458_5_86()) { + if (jj_3R_86()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1459_5_87()) { + if (jj_3R_87()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1460_5_88()) { + if (jj_3R_88()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1461_5_89()) { + if (jj_3R_89()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1462_5_90()) { + if (jj_3R_90()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1463_5_91()) { + if (jj_3R_91()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1465_5_92()) { + if (jj_3R_92()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1472_5_93()) { + if (jj_3R_93()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1476_5_94()) { + if (jj_3R_94()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1478_5_95()) { + if (jj_3R_95()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1480_5_96()) { + if (jj_3R_96()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1482_5_97()) { + if (jj_3R_97()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1484_5_98()) { + if (jj_3R_98()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1486_5_99()) { + if (jj_3R_99()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1488_5_100()) { + if (jj_3R_100()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1490_5_101()) { + if (jj_3R_101()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1493_5_102()) { + if (jj_3R_102()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1494_5_103()) { + if (jj_3R_103()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1495_5_104()) { + if (jj_3R_104()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1496_5_105()) { + if (jj_3R_105()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1498_5_106()) { + if (jj_3R_106()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1500_5_107()) { + if (jj_3R_107()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1502_5_108()) { + if (jj_3R_108()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1504_5_109()) return true; + if (jj_3R_109()) return true; } } } @@ -7291,349 +6930,304 @@ private boolean jj_3R_BuiltInCall_1399_5_43() return false; } - private boolean jj_3R_IRIREF_1721_3_152() - { + private boolean jj_3R_152() { if (jj_scan_token(IRIref)) return true; return false; } - private boolean jj_3R_BlankNode_1717_3_180() - { + private boolean jj_3R_180() { if (jj_scan_token(ANON)) return true; return false; } - private boolean jj_3R_BlankNode_1714_3_170() - { + private boolean jj_3R_170() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BlankNode_1714_3_179()) { + if (jj_3R_179()) { jj_scanpos = xsp; - if (jj_3R_BlankNode_1717_3_180()) return true; + if (jj_3R_180()) return true; } return false; } - private boolean jj_3R_BlankNode_1714_3_179() - { + private boolean jj_3R_179() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; } - private boolean jj_3R_GroupGraphPattern_562_3_143() - { - if (jj_scan_token(LBRACE)) return true; - return false; - } - - private boolean jj_3R_PrefixedName_1708_5_172() - { + private boolean jj_3R_172() { if (jj_scan_token(PNAME_NS)) return true; return false; } - private boolean jj_3_3() - { - if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_854_3_45()) return true; - return false; - } - - private boolean jj_3R_PrefixedName_1705_5_171() - { + private boolean jj_3R_171() { if (jj_scan_token(PNAME_LN)) return true; return false; } - private boolean jj_3R_PrefixedName_1705_3_166() - { + private boolean jj_3R_166() { Token xsp; xsp = jj_scanpos; - if (jj_3R_PrefixedName_1705_5_171()) { + if (jj_3R_171()) { jj_scanpos = xsp; - if (jj_3R_PrefixedName_1708_5_172()) return true; + if (jj_3R_172()) return true; } return false; } - private boolean jj_3R_iri_1701_3_159() - { - if (jj_3R_PrefixedName_1705_3_166()) return true; + private boolean jj_3R_159() { + if (jj_3R_166()) return true; return false; } - private boolean jj_3R_iri_1699_3_151() - { + private boolean jj_3R_151() { Token xsp; xsp = jj_scanpos; - if (jj_3R_iri_1699_3_158()) { + if (jj_3R_158()) { jj_scanpos = xsp; - if (jj_3R_iri_1701_3_159()) return true; + if (jj_3R_159()) return true; } return false; } - private boolean jj_3R_iri_1699_3_158() - { - if (jj_3R_IRIREF_1721_3_152()) return true; + private boolean jj_3R_158() { + if (jj_3R_152()) return true; + return false; + } + + private boolean jj_3R_143() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_45()) return true; return false; } - private boolean jj_3R_String_1690_5_184() - { + private boolean jj_3R_184() { if (jj_scan_token(STRING_LITERAL_LONG2)) return true; return false; } - private boolean jj_3R_String_1689_5_183() - { + private boolean jj_3R_183() { if (jj_scan_token(STRING_LITERAL_LONG1)) return true; return false; } - private boolean jj_3R_String_1688_5_182() - { + private boolean jj_3R_182() { if (jj_scan_token(STRING_LITERAL2)) return true; return false; } - private boolean jj_3R_String_1687_5_181() - { + private boolean jj_3R_181() { if (jj_scan_token(STRING_LITERAL1)) return true; return false; } - private boolean jj_3R_String_1687_3_173() - { + private boolean jj_3R_173() { Token xsp; xsp = jj_scanpos; - if (jj_3R_String_1687_5_181()) { + if (jj_3R_181()) { jj_scanpos = xsp; - if (jj_3R_String_1688_5_182()) { + if (jj_3R_182()) { jj_scanpos = xsp; - if (jj_3R_String_1689_5_183()) { + if (jj_3R_183()) { jj_scanpos = xsp; - if (jj_3R_String_1690_5_184()) return true; + if (jj_3R_184()) return true; } } } return false; } - private boolean jj_3R_BooleanLiteral_1683_3_178() - { + private boolean jj_3R_178() { if (jj_scan_token(FALSE)) return true; return false; } - private boolean jj_3R_BooleanLiteral_1681_3_169() - { + private boolean jj_3R_169() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BooleanLiteral_1681_3_177()) { + if (jj_3R_177()) { jj_scanpos = xsp; - if (jj_3R_BooleanLiteral_1683_3_178()) return true; + if (jj_3R_178()) return true; } return false; } - private boolean jj_3R_BooleanLiteral_1681_3_177() - { + private boolean jj_3R_177() { if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1677_3_196() - { + private boolean jj_3R_196() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1676_3_195() - { + private boolean jj_3R_195() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1675_3_194() - { + private boolean jj_3R_194() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1675_3_187() - { + private boolean jj_3R_187() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralNegative_1675_3_194()) { + if (jj_3R_194()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1676_3_195()) { + if (jj_3R_195()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1677_3_196()) return true; + if (jj_3R_196()) return true; } } return false; } - private boolean jj_3R_NumericLiteralPositive_1671_3_193() - { + private boolean jj_3R_193() { if (jj_scan_token(DOUBLE_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1670_3_192() - { + private boolean jj_3R_192() { if (jj_scan_token(DECIMAL_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1669_3_191() - { + private boolean jj_3R_191() { if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1669_3_186() - { + private boolean jj_3R_186() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralPositive_1669_3_191()) { + if (jj_3R_191()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1670_3_192()) { + if (jj_3R_192()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1671_3_193()) return true; + if (jj_3R_193()) return true; } } return false; } - private boolean jj_3R_NumericLiteralUnsigned_1665_3_190() - { + private boolean jj_3R_190() { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1664_3_189() - { + private boolean jj_3R_189() { if (jj_scan_token(DECIMAL)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1663_3_188() - { + private boolean jj_3R_188() { if (jj_scan_token(INTEGER)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1663_3_185() - { + private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralUnsigned_1663_3_188()) { + if (jj_3R_188()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1664_3_189()) { + if (jj_3R_189()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1665_3_190()) return true; + if (jj_3R_190()) return true; } } return false; } - private boolean jj_3R_NumericLiteral_1657_5_176() - { - if (jj_3R_NumericLiteralNegative_1675_3_187()) return true; + private boolean jj_3R_176() { + if (jj_3R_187()) return true; return false; } - private boolean jj_3R_NumericLiteral_1656_5_175() - { - if (jj_3R_NumericLiteralPositive_1669_3_186()) return true; + private boolean jj_3R_175() { + if (jj_3R_186()) return true; return false; } - private boolean jj_3R_NumericLiteral_1655_5_174() - { - if (jj_3R_NumericLiteralUnsigned_1663_3_185()) return true; + private boolean jj_3R_174() { + if (jj_3R_185()) return true; return false; } - private boolean jj_3R_NumericLiteral_1654_3_168() - { + private boolean jj_3R_168() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteral_1655_5_174()) { + if (jj_3R_174()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1656_5_175()) { + if (jj_3R_175()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1657_5_176()) return true; + if (jj_3R_176()) return true; } } return false; } - private boolean jj_3_1() - { - if (jj_3R_BuiltInCall_1399_5_43()) return true; + private boolean jj_3R_167() { + if (jj_3R_173()) return true; return false; } - private boolean jj_3R_RDFLiteral_1643_3_167() - { - if (jj_3R_String_1687_3_173()) return true; + private boolean jj_3_1() { + if (jj_3R_43()) return true; return false; } - private boolean jj_3R_GraphTerm_1245_3_165() - { + private boolean jj_3R_165() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_GraphTerm_1244_3_164() - { - if (jj_3R_BlankNode_1714_3_170()) return true; + private boolean jj_3R_164() { + if (jj_3R_170()) return true; return false; } - private boolean jj_3R_GraphTerm_1243_3_163() - { - if (jj_3R_BooleanLiteral_1681_3_169()) return true; + private boolean jj_3R_163() { + if (jj_3R_169()) return true; return false; } - private boolean jj_3R_GraphTerm_1242_3_162() - { - if (jj_3R_NumericLiteral_1654_3_168()) return true; + private boolean jj_3R_162() { + if (jj_3R_168()) return true; return false; } - private boolean jj_3R_GraphTerm_1241_3_161() - { - if (jj_3R_RDFLiteral_1643_3_167()) return true; + private boolean jj_3R_161() { + if (jj_3R_167()) return true; return false; } - private boolean jj_3R_TriplesSameSubject_857_3_112() - { - if (jj_3R_TriplesNode_1079_3_125()) return true; + private boolean jj_3R_112() { + if (jj_3R_125()) return true; return false; } - private boolean jj_3R_GraphTerm_1240_3_155() - { + private boolean jj_3R_155() { Token xsp; xsp = jj_scanpos; - if (jj_3R_GraphTerm_1240_3_160()) { + if (jj_3R_160()) { jj_scanpos = xsp; - if (jj_3R_GraphTerm_1241_3_161()) { + if (jj_3R_161()) { jj_scanpos = xsp; - if (jj_3R_GraphTerm_1242_3_162()) { + if (jj_3R_162()) { jj_scanpos = xsp; - if (jj_3R_GraphTerm_1243_3_163()) { + if (jj_3R_163()) { jj_scanpos = xsp; - if (jj_3R_GraphTerm_1244_3_164()) { + if (jj_3R_164()) { jj_scanpos = xsp; - if (jj_3R_GraphTerm_1245_3_165()) return true; + if (jj_3R_165()) return true; } } } @@ -7642,31 +7236,27 @@ private boolean jj_3R_GraphTerm_1240_3_155() return false; } - private boolean jj_3R_GraphTerm_1240_3_160() - { - if (jj_3R_iri_1699_3_151()) return true; + private boolean jj_3R_160() { + if (jj_3R_151()) return true; return false; } - private boolean jj_3R_TriplesSameSubject_854_3_45() - { + private boolean jj_3R_45() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesSameSubject_854_3_111()) { + if (jj_3R_111()) { jj_scanpos = xsp; - if (jj_3R_TriplesSameSubject_857_3_112()) return true; + if (jj_3R_112()) return true; } return false; } - private boolean jj_3R_TriplesSameSubject_854_3_111() - { - if (jj_3R_VarOrTerm_1189_3_124()) return true; + private boolean jj_3R_111() { + if (jj_3R_124()) return true; return false; } - private boolean jj_3R_Var_1235_5_154() - { + private boolean jj_3R_154() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7676,270 +7266,238 @@ private boolean jj_3R_Var_1235_5_154() return false; } - private boolean jj_3_4() - { + private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_854_3_45()) return true; - return false; - } - - private boolean jj_3R_Prologue_70_18_123() - { - if (jj_3R_PrefixDecl_79_5_145()) return true; - return false; - } - - private boolean jj_3R_PrefixDecl_79_5_145() - { - if (jj_scan_token(PREFIX)) return true; - if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_IRIREF_1721_3_152()) return true; + if (jj_3R_45()) return true; return false; } - private boolean jj_3R_Aggregate_1608_5_141() - { + private boolean jj_3R_141() { if (jj_scan_token(AGG)) return true; - if (jj_3R_iri_1699_3_151()) return true; + if (jj_3R_151()) return true; return false; } - private boolean jj_3R_Aggregate_1606_5_140() - { + private boolean jj_3R_140() { if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BaseDecl_74_3_144() - { - if (jj_scan_token(BASE)) return true; - if (jj_3R_IRIREF_1721_3_152()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1604_5_139() - { + private boolean jj_3R_139() { if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_70_5_110() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Prologue_70_5_122()) { - jj_scanpos = xsp; - if (jj_3R_Prologue_70_18_123()) return true; - } + private boolean jj_3R_123() { + if (jj_3R_145()) return true; return false; } - private boolean jj_3R_Prologue_70_5_122() - { - if (jj_3R_BaseDecl_74_3_144()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1602_5_138() - { + private boolean jj_3R_138() { if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_70_3_44() - { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Prologue_70_5_110()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_137() { + if (jj_scan_token(STDEV_POP)) return true; + if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1600_5_137() - { - if (jj_scan_token(STDEV_POP)) return true; - if (jj_scan_token(LPAREN)) return true; + private boolean jj_3R_145() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_152()) return true; return false; } - private boolean jj_3R_Aggregate_1598_5_136() - { + private boolean jj_3R_136() { if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1596_5_135() - { + private boolean jj_3R_135() { if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_ExpressionList_829_5_142() - { + private boolean jj_3R_142() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_ExpressionList_826_3_116() - { + private boolean jj_3R_144() { + if (jj_scan_token(BASE)) return true; + if (jj_3R_152()) return true; + return false; + } + + private boolean jj_3R_116() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(184)) { + jj_scanpos = xsp; + if (jj_3R_142()) return true; + } + return false; + } + + private boolean jj_3R_110() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(183)) { + if (jj_3R_122()) { jj_scanpos = xsp; - if (jj_3R_ExpressionList_829_5_142()) return true; + if (jj_3R_123()) return true; } return false; } - private boolean jj_3_5() - { + private boolean jj_3R_122() { + if (jj_3R_144()) return true; + return false; + } + + private boolean jj_3_5() { if (jj_scan_token(SEMICOLON)) return true; if (jj_scan_token(SEPARATOR)) return true; return false; } - private boolean jj_3R_Aggregate_1583_5_134() - { + private boolean jj_3R_44() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_110()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_134() { if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1581_5_133() - { + private boolean jj_3R_133() { if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1579_5_132() - { + private boolean jj_3R_132() { if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_TripleTerm_1197_3_153() - { + private boolean jj_3R_153() { if (jj_scan_token(LT2)) return true; return false; } - private boolean jj_3R_Aggregate_1577_5_131() - { + private boolean jj_3R_131() { if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1575_5_130() - { + private boolean jj_3R_130() { if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1191_5_148() - { - if (jj_3R_GraphTerm_1240_3_155()) return true; + private boolean jj_3R_148() { + if (jj_3R_155()) return true; return false; } - private boolean jj_3R_VarOrTerm_1190_5_147() - { - if (jj_3R_Var_1235_5_154()) return true; + private boolean jj_3R_147() { + if (jj_3R_154()) return true; return false; } - private boolean jj_3R_Aggregate_1573_5_129() - { + private boolean jj_3R_129() { if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1189_5_146() - { - if (jj_3R_TripleTerm_1197_3_153()) return true; + private boolean jj_3R_146() { + if (jj_3R_153()) return true; return false; } - private boolean jj_3R_Aggregate_1571_5_128() - { + private boolean jj_3R_128() { if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1189_3_124() - { + private boolean jj_3R_124() { Token xsp; xsp = jj_scanpos; - if (jj_3R_VarOrTerm_1189_5_146()) { + if (jj_3R_146()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1190_5_147()) { + if (jj_3R_147()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1191_5_148()) return true; + if (jj_3R_148()) return true; } } return false; } - private boolean jj_3R_Aggregate_1569_5_127() - { + private boolean jj_3R_127() { if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1562_5_126() - { + private boolean jj_3R_126() { if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1561_3_113() - { + private boolean jj_3R_113() { Token xsp; xsp = jj_scanpos; - if (jj_3R_Aggregate_1562_5_126()) { + if (jj_3R_126()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1569_5_127()) { + if (jj_3R_127()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1571_5_128()) { + if (jj_3R_128()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1573_5_129()) { + if (jj_3R_129()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1575_5_130()) { + if (jj_3R_130()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1577_5_131()) { + if (jj_3R_131()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1579_5_132()) { + if (jj_3R_132()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1581_5_133()) { + if (jj_3R_133()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1583_5_134()) { + if (jj_3R_134()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1596_5_135()) { + if (jj_3R_135()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1598_5_136()) { + if (jj_3R_136()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1600_5_137()) { + if (jj_3R_137()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1602_5_138()) { + if (jj_3R_138()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1604_5_139()) { + if (jj_3R_139()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1606_5_140()) { + if (jj_3R_140()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1608_5_141()) return true; + if (jj_3R_141()) return true; } } } @@ -7958,27 +7516,30 @@ private boolean jj_3R_Aggregate_1561_3_113() return false; } - private boolean jj_3R_NotExistsFunc_1551_4_121() - { + private boolean jj_3R_121() { if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } - private boolean jj_3R_ExistsFunc_1545_4_120() - { + private boolean jj_3R_120() { if (jj_scan_token(EXISTS)) return true; - if (jj_3R_GroupGraphPattern_562_3_143()) return true; + if (jj_3R_143()) return true; return false; } - private boolean jj_3R_StrReplaceExpression_1534_3_118() - { + private boolean jj_3R_118() { if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } + private boolean jj_3R_117() { + if (jj_scan_token(SUBSTR)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7990,7 +7551,7 @@ private boolean jj_3R_StrReplaceExpression_1534_3_118() private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[194]; + final private int[] jj_la1 = new int[195]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -8000,201 +7561,187 @@ private boolean jj_3R_StrReplaceExpression_1534_3_118() static private int[] jj_la1_6; static private int[] jj_la1_7; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - jj_la1_init_7(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x800000,0xf87f0000,0xf87f0000,0xf87f0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x1000000,0x2000000,0x0,0x0,0xf87f0000,0x800000,0xf87f0000,0xf87f0000,0xf87f0018,0x18,0xf87f0000,0xf87f0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x60f602,0x0,0x0,0x0,0x0,0x60f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x800,0xf87f0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf87f0000,0xf87f0000,0x0,0x0,0x0,0x0,0x0,0xf87f0000,0x0,0x0,0x0,0x0,0xf87f0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff97b7ff,0xff97b7ff,0xff97b7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff97b7ff,0x0,0xff97b7ff,0xff97b7ff,0xff97b7ff,0x0,0xff97b7ff,0xff97b7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff97b7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600000,0x600000,0x0,0x600000,0x600000,0x0,0x0,0x0,0x0,0x0,0x600000,0x0,0x0,0x0,0x0,0x600000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff97b7ff,0xff97b7ff,0x0,0x0,0x0,0x0,0x0,0xff97b7ff,0x0,0x0,0x0,0x0,0xff97b7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x600,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x7df,0x7df,0x7df,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1df,0x0,0x1df,0x1df,0x1df,0x0,0x1df,0x1df,0x0,0x0,0x0,0x0,0x0,0x427ff000,0x427ff000,0x1000000,0x4000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x1000000,0x40000000,0x1000,0x3000,0x80000000,0x0,0x0,0x10000000,0x30000000,0x600,0x0,0x0,0x600,0x600,0x600,0x0,0x0,0x600,0x0,0x600,0x0,0x0,0x600,0x0,0x0,0x600,0x600,0x0,0x0,0x1000000,0x0,0x600,0x0,0x0,0x0,0x600,0x0,0x600,0x0,0x1df,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x600,0x0,0x0,0x600,0x600,0x600,0x0,0x600,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7df,0x7df,0x600,0x0,0x0,0x0,0x0,0x1df,0x0,0x0,0x0,0x0,0x7df,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e03fe,0x0,0x3e03fe,0x3e03fe,0x3e03fe,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x0,0x40000000,0x1e03fe,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x200000,0x200000,0x200000,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be03fe,0x0,0x80000000,0x14be03fe,0x14be03fe,0x14be03fe,0x1000000,0x80000000,0x14be03fe,0x0,0x14be03fe,0x80000000,0x0,0x14be03fe,0x1000000,0x80000000,0x14be03fe,0x14be03fe,0x80000000,0x1000000,0x0,0xa00000,0x1e03fe,0x0,0xa00000,0xa00000,0x1e03fe,0xa00000,0x1e03fe,0x0,0x200000,0x0,0x40000000,0xa00000,0x40000000,0xa00000,0x80000000,0x14be03fe,0x0,0x20000000,0x0,0x0,0x40000000,0x14be03fe,0x200000,0x200000,0x20000000,0x200000,0x200000,0x40000000,0x0,0x0,0x0,0x1000000,0x200000,0x2000002,0x42000000,0x40000002,0x1000000,0x200000,0x0,0x0,0x200000,0x0,0x0,0x4200000,0x4200000,0x14be03fe,0x14be03fe,0x0,0x0,0x14be03fe,0x14be03fe,0x109e03fe,0x0,0x1e03fe,0x0,0x10000000,0x0,0x109e03fe,0x0,0x0,0x0,0x0,0x3f0,0x3f0,0x0,0x0,0x3f0,0x0,0x0,0x3e03fe,0x3e03fe,0x1e03fe,0x40000000,0x40000000,0xa00000,0x40000000,0x0,0x40000000,0x40000000,0x40000000,0x0,0x3e03fe,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000000,0x20000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa00000,0x0,0x0,0x3fe,0xe,0x70,0x380,0x0,0x1e0000,0x0,0x0,0x10000000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x80,0x80,0x80,0x0,0x0,0x80,0x0,0x80,0x0,0x0,0x80,0x0,0x0,0x80,0x80,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x80,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x80,0x800400,0x800400,0x0,0x800400,0x800400,0x0,0x400000,0x840000,0x840000,0x4028000,0x800400,0x0,0x0,0x28000,0x4028000,0x400,0x400000,0x800000,0x800000,0x0,0x800000,0x0,0x0,0x80,0x80,0x100,0x100,0x80,0x80,0x80,0x0,0x80,0x0,0x0,0x0,0x0,0x2000,0x4000,0x3f,0x3f,0x18000,0x0,0x60000,0x60000,0x18000,0x60000,0x60000,0x18480,0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x38480,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + jj_la1_init_7(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0xc00000,0x0,0xc00000,0xc00000,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0xfbf,0xfbf,0xfbf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x3bf,0x0,0x3bf,0x3bf,0x3bf,0x0,0x3bf,0x3bf,0x0,0x0,0x0,0x0,0x0,0x84ffe000,0x84ffe000,0x2000000,0x8000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x80000000,0x2000,0x6000,0x0,0x0,0x0,0x20000000,0x60000000,0xc00,0x0,0x0,0xc00,0xc00,0xc00,0x0,0x0,0xc00,0x0,0xc00,0x0,0x0,0xc00,0x0,0x0,0xc00,0xc00,0x0,0x0,0x2000000,0x0,0xc00,0x0,0x0,0x0,0xc00,0x0,0xc00,0x0,0x0,0x3bf,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0x0,0x0,0xc00,0xc00,0xc00,0x0,0xc00,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbf,0xfbf,0xc00,0x0,0x0,0x0,0x0,0x3bf,0x0,0x0,0x0,0x0,0xfbf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3c07fc,0x0,0x7c07fc,0x7c07fc,0x7c07fc,0x0,0x0,0x2000000,0x0,0x0,0x0,0x2000000,0x0,0x0,0x80000000,0x3c07fc,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x400000,0x400000,0x400000,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x297c07fc,0x0,0x0,0x297c07fc,0x297c07fc,0x297c07fc,0x2000000,0x0,0x297c07fc,0x0,0x297c07fc,0x0,0x0,0x297c07fc,0x2000000,0x0,0x297c07fc,0x297c07fc,0x0,0x2000000,0x0,0x1400000,0x3c07fc,0x0,0x1400000,0x1400000,0x3c07fc,0x1400000,0x3c07fc,0x80000000,0x0,0x400000,0x0,0x80000000,0x1400000,0x80000000,0x1400000,0x0,0x297c07fc,0x0,0x40000000,0x0,0x0,0x80000000,0x297c07fc,0x400000,0x400000,0x40000000,0x400000,0x400000,0x80000000,0x0,0x0,0x0,0x2000000,0x400000,0x4000004,0x84000000,0x80000004,0x2000000,0x400000,0x0,0x0,0x400000,0x0,0x0,0x8400000,0x8400000,0x297c07fc,0x297c07fc,0x0,0x0,0x297c07fc,0x297c07fc,0x213c07fc,0x0,0x3c07fc,0x0,0x20000000,0x0,0x213c07fc,0x0,0x0,0x0,0x0,0x7e0,0x7e0,0x0,0x0,0x7e0,0x0,0x0,0x7c07fc,0x7c07fc,0x3c07fc,0x80000000,0x80000000,0x1400000,0x80000000,0x0,0x80000000,0x80000000,0x80000000,0x0,0x7c07fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x40000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1400000,0x0,0x0,0x7fc,0x1c,0xe0,0x700,0x0,0x3c0000,0x0,0x0,0x20000000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x1,0x100,0x100,0x100,0x0,0x1,0x100,0x0,0x100,0x1,0x0,0x100,0x0,0x1,0x100,0x100,0x1,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x100,0x0,0x0,0x0,0x0,0x0,0x100,0x1000800,0x1000800,0x0,0x1000800,0x1000800,0x0,0x800000,0x1080000,0x1080000,0x8050000,0x1000800,0x0,0x0,0x50000,0x8050000,0x800,0x800000,0x1000000,0x1000000,0x0,0x1000000,0x0,0x0,0x100,0x100,0x200,0x200,0x100,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x4000,0x8000,0x7e,0x7e,0x30000,0x0,0xc0000,0xc0000,0x30000,0xc0000,0xc0000,0x30900,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x70900,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_7() { + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with InputStream. */ public ARQParser(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public ARQParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor. */ public ARQParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new ARQParserTokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor with generated Token Manager. */ public ARQParser(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - @Override - public Throwable fillInStackTrace() { - return this; - } - } - static private final LookaheadSuccess jj_ls = new LookaheadSuccess(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -8204,103 +7751,86 @@ private int jj_ntk_f() { private int jj_endpos; private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + exists = true; + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.add(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } } /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[231]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 194; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 195; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - } - } - p = p.next; - } while (p != null); - - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; + jj_rescan = true; + for (int i = 0; i < 5; i++) { + try { + JJCalls p = jj_2_rtns[i]; + do { + if (p.gen > jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; } private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; + int gen; + Token first; + int arg; + JJCalls next; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java index 9efd44f9992..dda5831a724 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java @@ -105,361 +105,363 @@ public interface ARQParserConstants { /** RegularExpression Id. */ int OBJECT = 52; /** RegularExpression Id. */ - int EXISTS = 53; + int UNFOLD = 53; /** RegularExpression Id. */ - int NOT = 54; + int EXISTS = 54; /** RegularExpression Id. */ - int AS = 55; + int NOT = 55; /** RegularExpression Id. */ - int GROUP = 56; + int AS = 56; /** RegularExpression Id. */ - int HAVING = 57; + int GROUP = 57; /** RegularExpression Id. */ - int SEPARATOR = 58; + int HAVING = 58; /** RegularExpression Id. */ - int AGG = 59; + int SEPARATOR = 59; /** RegularExpression Id. */ - int COUNT = 60; + int AGG = 60; /** RegularExpression Id. */ - int MIN = 61; + int COUNT = 61; /** RegularExpression Id. */ - int MAX = 62; + int MIN = 62; /** RegularExpression Id. */ - int SUM = 63; + int MAX = 63; /** RegularExpression Id. */ - int AVG = 64; + int SUM = 64; /** RegularExpression Id. */ - int MEDIAN = 65; + int AVG = 65; /** RegularExpression Id. */ - int MODE = 66; + int MEDIAN = 66; /** RegularExpression Id. */ - int STDEV = 67; + int MODE = 67; /** RegularExpression Id. */ - int STDEV_SAMP = 68; + int STDEV = 68; /** RegularExpression Id. */ - int STDEV_POP = 69; + int STDEV_SAMP = 69; /** RegularExpression Id. */ - int VARIANCE = 70; + int STDEV_POP = 70; /** RegularExpression Id. */ - int VAR_SAMP = 71; + int VARIANCE = 71; /** RegularExpression Id. */ - int VAR_POP = 72; + int VAR_SAMP = 72; /** RegularExpression Id. */ - int SAMPLE = 73; + int VAR_POP = 73; /** RegularExpression Id. */ - int GROUP_CONCAT = 74; + int SAMPLE = 74; /** RegularExpression Id. */ - int FILTER = 75; + int GROUP_CONCAT = 75; /** RegularExpression Id. */ - int BOUND = 76; + int FILTER = 76; /** RegularExpression Id. */ - int COALESCE = 77; + int BOUND = 77; /** RegularExpression Id. */ - int IN = 78; + int COALESCE = 78; /** RegularExpression Id. */ - int IF = 79; + int IN = 79; /** RegularExpression Id. */ - int BNODE = 80; + int IF = 80; /** RegularExpression Id. */ - int IRI = 81; + int BNODE = 81; /** RegularExpression Id. */ - int URI = 82; + int IRI = 82; /** RegularExpression Id. */ - int CAST = 83; + int URI = 83; /** RegularExpression Id. */ - int CALL = 84; + int CAST = 84; /** RegularExpression Id. */ - int MULTI = 85; + int CALL = 85; /** RegularExpression Id. */ - int SHORTEST = 86; + int MULTI = 86; /** RegularExpression Id. */ - int STR = 87; + int SHORTEST = 87; /** RegularExpression Id. */ - int STRLANG = 88; + int STR = 88; /** RegularExpression Id. */ - int STRDT = 89; + int STRLANG = 89; /** RegularExpression Id. */ - int DTYPE = 90; + int STRDT = 90; /** RegularExpression Id. */ - int LANG = 91; + int DTYPE = 91; /** RegularExpression Id. */ - int LANGMATCHES = 92; + int LANG = 92; /** RegularExpression Id. */ - int IS_URI = 93; + int LANGMATCHES = 93; /** RegularExpression Id. */ - int IS_IRI = 94; + int IS_URI = 94; /** RegularExpression Id. */ - int IS_BLANK = 95; + int IS_IRI = 95; /** RegularExpression Id. */ - int IS_LITERAL = 96; + int IS_BLANK = 96; /** RegularExpression Id. */ - int IS_NUMERIC = 97; + int IS_LITERAL = 97; /** RegularExpression Id. */ - int REGEX = 98; + int IS_NUMERIC = 98; /** RegularExpression Id. */ - int SAME_TERM = 99; + int REGEX = 99; /** RegularExpression Id. */ - int RAND = 100; + int SAME_TERM = 100; /** RegularExpression Id. */ - int ABS = 101; + int RAND = 101; /** RegularExpression Id. */ - int CEIL = 102; + int ABS = 102; /** RegularExpression Id. */ - int FLOOR = 103; + int CEIL = 103; /** RegularExpression Id. */ - int ROUND = 104; + int FLOOR = 104; /** RegularExpression Id. */ - int MOD = 105; + int ROUND = 105; /** RegularExpression Id. */ - int IDIV = 106; + int MOD = 106; /** RegularExpression Id. */ - int CONCAT = 107; + int IDIV = 107; /** RegularExpression Id. */ - int SUBSTR = 108; + int CONCAT = 108; /** RegularExpression Id. */ - int STRLEN = 109; + int SUBSTR = 109; /** RegularExpression Id. */ - int REPLACE = 110; + int STRLEN = 110; /** RegularExpression Id. */ - int UCASE = 111; + int REPLACE = 111; /** RegularExpression Id. */ - int LCASE = 112; + int UCASE = 112; /** RegularExpression Id. */ - int ENCODE_FOR_URI = 113; + int LCASE = 113; /** RegularExpression Id. */ - int CONTAINS = 114; + int ENCODE_FOR_URI = 114; /** RegularExpression Id. */ - int STRSTARTS = 115; + int CONTAINS = 115; /** RegularExpression Id. */ - int STRENDS = 116; + int STRSTARTS = 116; /** RegularExpression Id. */ - int STRBEFORE = 117; + int STRENDS = 117; /** RegularExpression Id. */ - int STRAFTER = 118; + int STRBEFORE = 118; /** RegularExpression Id. */ - int YEAR = 119; + int STRAFTER = 119; /** RegularExpression Id. */ - int MONTH = 120; + int YEAR = 120; /** RegularExpression Id. */ - int DAY = 121; + int MONTH = 121; /** RegularExpression Id. */ - int HOURS = 122; + int DAY = 122; /** RegularExpression Id. */ - int MINUTES = 123; + int HOURS = 123; /** RegularExpression Id. */ - int SECONDS = 124; + int MINUTES = 124; /** RegularExpression Id. */ - int TIMEZONE = 125; + int SECONDS = 125; /** RegularExpression Id. */ - int TZ = 126; + int TIMEZONE = 126; /** RegularExpression Id. */ - int NOW = 127; + int TZ = 127; /** RegularExpression Id. */ - int UUID = 128; + int NOW = 128; /** RegularExpression Id. */ - int STRUUID = 129; + int UUID = 129; /** RegularExpression Id. */ - int VERSION = 130; + int STRUUID = 130; /** RegularExpression Id. */ - int MD5 = 131; + int VERSION = 131; /** RegularExpression Id. */ - int SHA1 = 132; + int MD5 = 132; /** RegularExpression Id. */ - int SHA224 = 133; + int SHA1 = 133; /** RegularExpression Id. */ - int SHA256 = 134; + int SHA224 = 134; /** RegularExpression Id. */ - int SHA384 = 135; + int SHA256 = 135; /** RegularExpression Id. */ - int SHA512 = 136; + int SHA384 = 136; /** RegularExpression Id. */ - int TRUE = 137; + int SHA512 = 137; /** RegularExpression Id. */ - int FALSE = 138; + int TRUE = 138; /** RegularExpression Id. */ - int DATA = 139; + int FALSE = 139; /** RegularExpression Id. */ - int INSERT = 140; + int DATA = 140; /** RegularExpression Id. */ - int DELETE = 141; + int INSERT = 141; /** RegularExpression Id. */ - int INSERT_DATA = 142; + int DELETE = 142; /** RegularExpression Id. */ - int DELETE_DATA = 143; + int INSERT_DATA = 143; /** RegularExpression Id. */ - int DELETE_WHERE = 144; + int DELETE_DATA = 144; /** RegularExpression Id. */ - int LOAD = 145; + int DELETE_WHERE = 145; /** RegularExpression Id. */ - int CLEAR = 146; + int LOAD = 146; /** RegularExpression Id. */ - int CREATE = 147; + int CLEAR = 147; /** RegularExpression Id. */ - int ADD = 148; + int CREATE = 148; /** RegularExpression Id. */ - int MOVE = 149; + int ADD = 149; /** RegularExpression Id. */ - int COPY = 150; + int MOVE = 150; /** RegularExpression Id. */ - int META = 151; + int COPY = 151; /** RegularExpression Id. */ - int SILENT = 152; + int META = 152; /** RegularExpression Id. */ - int DROP = 153; + int SILENT = 153; /** RegularExpression Id. */ - int INTO = 154; + int DROP = 154; /** RegularExpression Id. */ - int TO = 155; + int INTO = 155; /** RegularExpression Id. */ - int DFT = 156; + int TO = 156; /** RegularExpression Id. */ - int ALL = 157; + int DFT = 157; /** RegularExpression Id. */ - int WITH = 158; + int ALL = 158; /** RegularExpression Id. */ - int USING = 159; + int WITH = 159; /** RegularExpression Id. */ - int DIGITS = 160; + int USING = 160; /** RegularExpression Id. */ - int INTEGER = 161; + int DIGITS = 161; /** RegularExpression Id. */ - int DECIMAL = 162; + int INTEGER = 162; /** RegularExpression Id. */ - int DOUBLE = 163; + int DECIMAL = 163; /** RegularExpression Id. */ - int INTEGER_POSITIVE = 164; + int DOUBLE = 164; /** RegularExpression Id. */ - int DECIMAL_POSITIVE = 165; + int INTEGER_POSITIVE = 165; /** RegularExpression Id. */ - int DOUBLE_POSITIVE = 166; + int DECIMAL_POSITIVE = 166; /** RegularExpression Id. */ - int INTEGER_NEGATIVE = 167; + int DOUBLE_POSITIVE = 167; /** RegularExpression Id. */ - int DECIMAL_NEGATIVE = 168; + int INTEGER_NEGATIVE = 168; /** RegularExpression Id. */ - int DOUBLE_NEGATIVE = 169; + int DECIMAL_NEGATIVE = 169; /** RegularExpression Id. */ - int EXPONENT = 170; + int DOUBLE_NEGATIVE = 170; /** RegularExpression Id. */ - int QUOTE_3D = 171; + int EXPONENT = 171; /** RegularExpression Id. */ - int QUOTE_3S = 172; + int QUOTE_3D = 172; /** RegularExpression Id. */ - int ECHAR = 173; + int QUOTE_3S = 173; /** RegularExpression Id. */ - int UCHAR = 174; + int ECHAR = 174; /** RegularExpression Id. */ - int UCHAR4 = 175; + int UCHAR = 175; /** RegularExpression Id. */ - int UCHAR8 = 176; + int UCHAR4 = 176; /** RegularExpression Id. */ - int STRING_LITERAL1 = 177; + int UCHAR8 = 177; /** RegularExpression Id. */ - int STRING_LITERAL2 = 178; + int STRING_LITERAL1 = 178; /** RegularExpression Id. */ - int STRING_LITERAL_LONG1 = 179; + int STRING_LITERAL2 = 179; /** RegularExpression Id. */ - int STRING_LITERAL_LONG2 = 180; + int STRING_LITERAL_LONG1 = 180; /** RegularExpression Id. */ - int LPAREN = 181; + int STRING_LITERAL_LONG2 = 181; /** RegularExpression Id. */ - int RPAREN = 182; + int LPAREN = 182; /** RegularExpression Id. */ - int NIL = 183; + int RPAREN = 183; /** RegularExpression Id. */ - int LBRACE = 184; + int NIL = 184; /** RegularExpression Id. */ - int RBRACE = 185; + int LBRACE = 185; /** RegularExpression Id. */ - int LBRACKET = 186; + int RBRACE = 186; /** RegularExpression Id. */ - int RBRACKET = 187; + int LBRACKET = 187; /** RegularExpression Id. */ - int ANON = 188; + int RBRACKET = 188; /** RegularExpression Id. */ - int SEMICOLON = 189; + int ANON = 189; /** RegularExpression Id. */ - int COMMA = 190; + int SEMICOLON = 190; /** RegularExpression Id. */ - int DOT = 191; + int COMMA = 191; /** RegularExpression Id. */ - int EQ = 192; + int DOT = 192; /** RegularExpression Id. */ - int NE = 193; + int EQ = 193; /** RegularExpression Id. */ - int GT = 194; + int NE = 194; /** RegularExpression Id. */ - int LT = 195; + int GT = 195; /** RegularExpression Id. */ - int LE = 196; + int LT = 196; /** RegularExpression Id. */ - int GE = 197; + int LE = 197; /** RegularExpression Id. */ - int GT2 = 198; + int GE = 198; /** RegularExpression Id. */ - int LT2 = 199; + int GT2 = 199; /** RegularExpression Id. */ - int L_ANN = 200; + int LT2 = 200; /** RegularExpression Id. */ - int R_ANN = 201; + int L_ANN = 201; /** RegularExpression Id. */ - int BANG = 202; + int R_ANN = 202; /** RegularExpression Id. */ - int TILDE = 203; + int BANG = 203; /** RegularExpression Id. */ - int COLON = 204; + int TILDE = 204; /** RegularExpression Id. */ - int SC_OR = 205; + int COLON = 205; /** RegularExpression Id. */ - int SC_AND = 206; + int SC_OR = 206; /** RegularExpression Id. */ - int PLUS = 207; + int SC_AND = 207; /** RegularExpression Id. */ - int MINUS = 208; + int PLUS = 208; /** RegularExpression Id. */ - int STAR = 209; + int MINUS = 209; /** RegularExpression Id. */ - int SLASH = 210; + int STAR = 210; /** RegularExpression Id. */ - int DATATYPE = 211; + int SLASH = 211; /** RegularExpression Id. */ - int AT = 212; + int DATATYPE = 212; /** RegularExpression Id. */ - int ASSIGN = 213; + int AT = 213; /** RegularExpression Id. */ - int VBAR = 214; + int ASSIGN = 214; /** RegularExpression Id. */ - int CARAT = 215; + int VBAR = 215; /** RegularExpression Id. */ - int FPATH = 216; + int CARAT = 216; /** RegularExpression Id. */ - int RPATH = 217; + int FPATH = 217; /** RegularExpression Id. */ - int QMARK = 218; + int RPATH = 218; /** RegularExpression Id. */ - int SURROGATE_PAIR = 219; + int QMARK = 219; /** RegularExpression Id. */ - int PN_CHARS_BASE = 220; + int SURROGATE_PAIR = 220; /** RegularExpression Id. */ - int PN_CHARS_U = 221; + int PN_CHARS_BASE = 221; /** RegularExpression Id. */ - int PN_CHARS = 222; + int PN_CHARS_U = 222; /** RegularExpression Id. */ - int PN_PREFIX = 223; + int PN_CHARS = 223; /** RegularExpression Id. */ - int PN_LOCAL = 224; + int PN_PREFIX = 224; /** RegularExpression Id. */ - int VARNAME = 225; + int PN_LOCAL = 225; /** RegularExpression Id. */ - int PN_LOCAL_ESC = 226; + int VARNAME = 226; /** RegularExpression Id. */ - int PLX = 227; + int PN_LOCAL_ESC = 227; /** RegularExpression Id. */ - int HEX = 228; + int PLX = 228; /** RegularExpression Id. */ - int PERCENT = 229; + int HEX = 229; /** RegularExpression Id. */ - int UNKNOWN = 230; + int PERCENT = 230; + /** RegularExpression Id. */ + int UNKNOWN = 231; /** Lexical state. */ int DEFAULT = 0; @@ -519,6 +521,7 @@ public interface ARQParserConstants { "\"SUBJECT\"", "\"PREDICATE\"", "\"OBJECT\"", + "\"unfold\"", "\"exists\"", "\"not\"", "\"as\"", diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java index d10b079f6f3..07a45b58068 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java @@ -1,4 +1,3 @@ -/* ARQParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ARQParserTokenManager.java */ package org.apache.jena.sparql.lang.arq ; import org.apache.jena.graph.* ; @@ -14,8 +13,8 @@ import org.apache.jena.sparql.core.Quad ; /** Token Manager. */ -@SuppressWarnings ("unused") -public class ARQParserTokenManager implements ARQParserConstants { +public class ARQParserTokenManager implements ARQParserConstants +{ /** Debug output. */ public java.io.PrintStream debugStream = System.out; @@ -27,7 +26,8 @@ private int jjStopAtPos(int pos, int kind) jjmatchedPos = pos; return pos + 1; } -private int jjMoveStringLiteralDfa0_0(){ +private int jjMoveStringLiteralDfa0_0() +{ switch(curChar) { case 9: @@ -46,164 +46,164 @@ private int jjMoveStringLiteralDfa0_0(){ jjmatchedKind = 1; return jjMoveNfa_0(0, 0); case 33: - jjmatchedKind = 202; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2L); + jjmatchedKind = 203; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4L); case 38: - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4000L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8000L); case 40: - jjmatchedKind = 181; + jjmatchedKind = 182; return jjMoveNfa_0(0, 0); case 41: - jjmatchedKind = 182; + jjmatchedKind = 183; return jjMoveNfa_0(0, 0); case 42: - jjmatchedKind = 209; + jjmatchedKind = 210; return jjMoveNfa_0(0, 0); case 43: - jjmatchedKind = 207; + jjmatchedKind = 208; return jjMoveNfa_0(0, 0); case 44: - jjmatchedKind = 190; + jjmatchedKind = 191; return jjMoveNfa_0(0, 0); case 45: - jjmatchedKind = 208; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x1000000L); + jjmatchedKind = 209; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2000000L); case 46: - jjmatchedKind = 191; + jjmatchedKind = 192; return jjMoveNfa_0(0, 0); case 47: - jjmatchedKind = 210; + jjmatchedKind = 211; return jjMoveNfa_0(0, 0); case 58: - jjmatchedKind = 204; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x200000L); + jjmatchedKind = 205; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x400000L); case 59: - jjmatchedKind = 189; + jjmatchedKind = 190; return jjMoveNfa_0(0, 0); case 60: - jjmatchedKind = 195; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2000090L); + jjmatchedKind = 196; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4000120L); case 61: - jjmatchedKind = 192; + jjmatchedKind = 193; return jjMoveNfa_0(0, 0); case 62: - jjmatchedKind = 194; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x60L); + jjmatchedKind = 195; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0xc0L); case 63: - jjmatchedKind = 218; + jjmatchedKind = 219; return jjMoveNfa_0(0, 0); case 64: - jjmatchedKind = 212; + jjmatchedKind = 213; return jjMoveNfa_0(0, 0); case 65: - return jjMoveStringLiteralDfa1_0(0x880010810000000L, 0x2000000001L, 0x20100000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x40200000L, 0x0L); case 66: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x11000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); case 67: - return jjMoveStringLiteralDfa1_0(0x1000000008000000L, 0x4084000182000L, 0x4c0000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x980000L, 0x0L); case 68: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x200000004000000L, 0x12002800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x24005000L, 0x0L); case 69: - return jjMoveStringLiteralDfa1_0(0x20000000000000L, 0x2000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); case 70: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x8000000800L, 0x400L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x800L, 0x0L); case 71: - return jjMoveStringLiteralDfa1_0(0x100020000000000L, 0x400L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); case 72: - return jjMoveStringLiteralDfa1_0(0x200000000000000L, 0x400000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); case 73: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x403e002c000L, 0x4001000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x807c0058000L, 0x8002000L, 0x0L); case 74: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 76: - return jjMoveStringLiteralDfa1_0(0x800020000000L, 0x1000018000000L, 0x20000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800020000000L, 0x2000030000000L, 0x40000L, 0x0L); case 77: - return jjMoveStringLiteralDfa1_0(0x6000100000000000L, 0x900020000200006L, 0xa00008L, 0x0L); + return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x1400010L, 0x0L); case 78: - return jjMoveStringLiteralDfa1_0(0x40002000000000L, 0x8000000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x1L, 0x0L); case 79: return jjMoveStringLiteralDfa1_0(0x100400c0000000L, 0x0L, 0x0L, 0x0L); case 80: return jjMoveStringLiteralDfa1_0(0x8000000200000L, 0x0L, 0x0L, 0x0L); case 82: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x411400000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); case 83: - return jjMoveStringLiteralDfa1_0(0x8404400000400000L, 0x1078300803c00238L, 0x10001f2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x804400000400000L, 0x20f0601007800471L, 0x20003e4L, 0x0L); case 84: - return jjMoveStringLiteralDfa1_0(0x1000000000000L, 0x6000000000000000L, 0x8000200L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000000000L, 0xc000000000000000L, 0x10000400L, 0x0L); case 85: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x800000040000L, 0x80000001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20080400000000L, 0x1000000080000L, 0x100000002L, 0x0L); case 86: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x1c0L, 0x4L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x8L, 0x0L); case 87: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x40000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x80000000L, 0x0L); case 89: - return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); case 91: - jjmatchedKind = 186; + jjmatchedKind = 187; return jjMoveNfa_0(0, 0); case 93: - jjmatchedKind = 187; + jjmatchedKind = 188; return jjMoveNfa_0(0, 0); case 94: - jjmatchedKind = 215; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x80000L); + jjmatchedKind = 216; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x100000L); case 97: jjmatchedKind = 19; - return jjMoveStringLiteralDfa1_0(0x880010810000000L, 0x2000000001L, 0x20100000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x40200000L, 0x0L); case 98: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x11000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); case 99: - return jjMoveStringLiteralDfa1_0(0x1000000008000000L, 0x4084000182000L, 0x4c0000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x980000L, 0x0L); case 100: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x200000004000000L, 0x12002800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x24005000L, 0x0L); case 101: - return jjMoveStringLiteralDfa1_0(0x20000000000000L, 0x2000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); case 102: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x8000000800L, 0x400L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x800L, 0x0L); case 103: - return jjMoveStringLiteralDfa1_0(0x100020000000000L, 0x400L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); case 104: - return jjMoveStringLiteralDfa1_0(0x200000000000000L, 0x400000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); case 105: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x403e002c000L, 0x4001000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0x807c0058000L, 0x8002000L, 0x0L); case 106: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 108: - return jjMoveStringLiteralDfa1_0(0x800020000000L, 0x1000018000000L, 0x20000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800020000000L, 0x2000030000000L, 0x40000L, 0x0L); case 109: - return jjMoveStringLiteralDfa1_0(0x6000100000000000L, 0x900020000200006L, 0xa00008L, 0x0L); + return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x1400010L, 0x0L); case 110: - return jjMoveStringLiteralDfa1_0(0x40002000000000L, 0x8000000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x1L, 0x0L); case 111: return jjMoveStringLiteralDfa1_0(0x100400c0000000L, 0x0L, 0x0L, 0x0L); case 112: return jjMoveStringLiteralDfa1_0(0x8000000200000L, 0x0L, 0x0L, 0x0L); case 114: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x411400000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); case 115: - return jjMoveStringLiteralDfa1_0(0x8404400000400000L, 0x1078300803c00238L, 0x10001f2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x804400000400000L, 0x20f0601007800471L, 0x20003e4L, 0x0L); case 116: - return jjMoveStringLiteralDfa1_0(0x1000000000000L, 0x6000000000000000L, 0x8000200L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000000000L, 0xc000000000000000L, 0x10000400L, 0x0L); case 117: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x800000040000L, 0x80000001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20080400000000L, 0x1000000080000L, 0x100000002L, 0x0L); case 118: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x1c0L, 0x4L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x8L, 0x0L); case 119: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x40000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x80000000L, 0x0L); case 121: - return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); case 123: - jjmatchedKind = 184; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x100L); + jjmatchedKind = 185; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x200L); case 124: - jjmatchedKind = 214; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2200L); + jjmatchedKind = 215; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4400L); case 125: - jjmatchedKind = 185; + jjmatchedKind = 186; return jjMoveNfa_0(0, 0); case 126: - jjmatchedKind = 203; + jjmatchedKind = 204; return jjMoveNfa_0(0, 0); case 65279: jjmatchedKind = 9; @@ -212,7 +212,8 @@ private int jjMoveStringLiteralDfa0_0(){ return jjMoveNfa_0(0, 0); } } -private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3){ +private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3) +{ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 0); @@ -220,118 +221,118 @@ private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, switch(curChar) { case 38: - if ((active3 & 0x4000L) != 0L) + if ((active3 & 0x8000L) != 0L) { - jjmatchedKind = 206; + jjmatchedKind = 207; jjmatchedPos = 1; } break; case 45: - if ((active3 & 0x2000000L) != 0L) + if ((active3 & 0x4000000L) != 0L) { - jjmatchedKind = 217; + jjmatchedKind = 218; jjmatchedPos = 1; } break; case 60: - if ((active3 & 0x80L) != 0L) + if ((active3 & 0x100L) != 0L) { - jjmatchedKind = 199; + jjmatchedKind = 200; jjmatchedPos = 1; } break; case 61: - if ((active3 & 0x2L) != 0L) + if ((active3 & 0x4L) != 0L) { - jjmatchedKind = 193; + jjmatchedKind = 194; jjmatchedPos = 1; } - else if ((active3 & 0x10L) != 0L) + else if ((active3 & 0x20L) != 0L) { - jjmatchedKind = 196; + jjmatchedKind = 197; jjmatchedPos = 1; } - else if ((active3 & 0x20L) != 0L) + else if ((active3 & 0x40L) != 0L) { - jjmatchedKind = 197; + jjmatchedKind = 198; jjmatchedPos = 1; } - else if ((active3 & 0x200000L) != 0L) + else if ((active3 & 0x400000L) != 0L) { - jjmatchedKind = 213; + jjmatchedKind = 214; jjmatchedPos = 1; } break; case 62: - if ((active3 & 0x40L) != 0L) + if ((active3 & 0x80L) != 0L) { - jjmatchedKind = 198; + jjmatchedKind = 199; jjmatchedPos = 1; } - else if ((active3 & 0x1000000L) != 0L) + else if ((active3 & 0x2000000L) != 0L) { - jjmatchedKind = 216; + jjmatchedKind = 217; jjmatchedPos = 1; } break; case 65: - return jjMoveStringLiteralDfa2_0(active0, 0x4200002200100000L, active1, 0x20000181c1803c0L, active2, 0xc00L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8400002200100000L, active1, 0x400003038300780L, active2, 0x1800L, active3, 0L); case 66: - return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x2000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); case 67: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1800000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); case 68: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x100008L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x200010L, active3, 0L); case 69: - return jjMoveStringLiteralDfa2_0(active0, 0x400c01005400000L, active1, 0x1080404400000002L, active2, 0x10802004L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x21004008L, active3, 0L); case 70: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 80; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 71: - return jjMoveStringLiteralDfa2_0(active0, 0x800000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 72: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x400000L, active2, 0x1f0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x3e0L, active3, 0L); case 73: - return jjMoveStringLiteralDfa2_0(active0, 0x2000300020800000L, active1, 0x2800000000000800L, active2, 0x41000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x82000000L, active3, 0L); case 76: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8000000000L, active2, 0x20040000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x40080000L, active3, 0L); case 78: - if ((active1 & 0x4000L) != 0L) + if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 79; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x2000000010000L, active2, 0x4001000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x20090400000000L, active1, 0x4000000020000L, active2, 0x8002000L, active3, 0L); case 79: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 156; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x1040000008000000L, active1, 0x85040b0000003004L, active2, 0x620000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0xc40001L, active3, 0L); case 80: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 82: - return jjMoveStringLiteralDfa2_0(active0, 0x109024080200000L, active1, 0x60400L, active2, 0x2080200L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x209024080200000L, active1, 0xc0800L, active2, 0x4100400L, active3, 0L); case 83: - if ((active0 & 0x80000000000000L) != 0L) + if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2000812000000L, active1, 0x3e0000000L, active2, 0x80000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000812000000L, active1, 0x7c0000000L, active2, 0x100000000L, active3, 0L); case 84: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x78200003800038L, active2, 0x2L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x4L, active3, 0L); case 85: - return jjMoveStringLiteralDfa2_0(active0, 0x8004000000000000L, active1, 0x100000200000L, active2, 0x1L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0x200000400001L, active2, 0x2L, active3, 0L); case 86: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); case 88: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); case 89: if ((active0 & 0x100000000L) != 0L) { @@ -340,77 +341,77 @@ else if ((active3 & 0x1000000L) != 0L) } break; case 90: - if ((active1 & 0x4000000000000000L) != 0L) + if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 127; jjmatchedPos = 1; } break; case 94: - if ((active3 & 0x80000L) != 0L) + if ((active3 & 0x100000L) != 0L) { - jjmatchedKind = 211; + jjmatchedKind = 212; jjmatchedPos = 1; } break; case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x4200002200100000L, active1, 0x20000181c1803c0L, active2, 0xc00L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8400002200100000L, active1, 0x400003038300780L, active2, 0x1800L, active3, 0L); case 98: - return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x2000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); case 99: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1800000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); case 100: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x100008L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x200010L, active3, 0L); case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x400c01005400000L, active1, 0x1080404400000002L, active2, 0x10802004L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x21004008L, active3, 0L); case 102: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 80; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 103: - return jjMoveStringLiteralDfa2_0(active0, 0x800000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x400000L, active2, 0x1f0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x3e0L, active3, 0L); case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x2000300020800000L, active1, 0x2800000000000800L, active2, 0x41000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x82000000L, active3, 0L); case 108: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x8000000000L, active2, 0x20040000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x40080000L, active3, 0L); case 110: - if ((active1 & 0x4000L) != 0L) + if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 79; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x2000000010000L, active2, 0x4001000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x20090400000000L, active1, 0x4000000020000L, active2, 0x8002000L, active3, 0L); case 111: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 156; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x1040000008000000L, active1, 0x85040b0000003004L, active2, 0x620000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0xc40001L, active3, 0L); case 112: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x109024080200000L, active1, 0x60400L, active2, 0x2080200L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x209024080200000L, active1, 0xc0800L, active2, 0x4100400L, active3, 0L); case 115: - if ((active0 & 0x80000000000000L) != 0L) + if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2000812000000L, active1, 0x3e0000000L, active2, 0x80000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000812000000L, active1, 0x7c0000000L, active2, 0x100000000L, active3, 0L); case 116: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x78200003800038L, active2, 0x2L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x4L, active3, 0L); case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x8004000000000000L, active1, 0x100000200000L, active2, 0x1L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0x200000400001L, active2, 0x2L, active3, 0L); case 118: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x1L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); case 121: if ((active0 & 0x100000000L) != 0L) { @@ -419,28 +420,28 @@ else if ((active3 & 0x1000000L) != 0L) } break; case 122: - if ((active1 & 0x4000000000000000L) != 0L) + if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 127; jjmatchedPos = 1; } break; case 124: - if ((active3 & 0x100L) != 0L) + if ((active3 & 0x200L) != 0L) { - jjmatchedKind = 200; + jjmatchedKind = 201; jjmatchedPos = 1; } - else if ((active3 & 0x2000L) != 0L) + else if ((active3 & 0x4000L) != 0L) { - jjmatchedKind = 205; + jjmatchedKind = 206; jjmatchedPos = 1; } break; case 125: - if ((active3 & 0x200L) != 0L) + if ((active3 & 0x400L) != 0L) { - jjmatchedKind = 201; + jjmatchedKind = 202; jjmatchedPos = 1; } break; @@ -449,7 +450,8 @@ else if ((active3 & 0x2000L) != 0L) } return jjMoveNfa_0(0, 1); } -private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3){ +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2) | (active3 &= old3)) == 0L) return jjMoveNfa_0(0, 1); try { curChar = input_stream.readChar(); } @@ -459,68 +461,68 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long a switch(curChar) { case 53: - if ((active2 & 0x8L) != 0L) + if ((active2 & 0x10L) != 0L) { - jjmatchedKind = 131; + jjmatchedKind = 132; jjmatchedPos = 2; } break; case 65: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x81800000002000L, active2, 0x201f0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x403e0L); case 66: - return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0x100080000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0x200100000000L, active2, 0L); case 67: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1002000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); case 68: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 106; jjmatchedPos = 2; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x200000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 149; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x3eL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); case 69: - return jjMoveStringLiteralDfa3_0(active0, 0x8008000200000L, active1, 0L, active2, 0xc0000L); + return jjMoveStringLiteralDfa3_0(active0, 0x8008000200000L, active1, 0L, active2, 0x180000L); case 70: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x10000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000040000000L, active1, 0L, active2, 0x20000000L); case 71: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 2; } - else if ((active1 & 0x1L) != 0L) + else if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x400000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); case 73: - if ((active1 & 0x20000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 82; jjmatchedPos = 2; } - else if ((active1 & 0x40000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 83; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x21080000000000L, active1, 0x44040000000L, active2, 0x80000001L); + return jjMoveStringLiteralDfa3_0(active0, 0x41080000000000L, active1, 0x88080000000L, active2, 0x100000002L); case 74: return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 75: @@ -531,137 +533,137 @@ else if ((active1 & 0x40000L) != 0L) } break; case 76: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 158; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x100300800L, active2, 0x1002400L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x2004800L); case 77: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x2000000800000200L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); case 78: - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x904081218000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); case 79: - return jjMoveStringLiteralDfa3_0(active0, 0x100004002000000L, active1, 0x8000410400L, active2, 0x2000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x4000000L); case 80: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0x400000000000L, active2, 0x400000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x800000L); case 82: - if ((active1 & 0x800000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 88; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x782000030001c0L, active2, 0x6L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0xcL); case 83: - if ((active1 & 0x2000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 102; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x80000L, active2, 0x1000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x2000L); case 84: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2040000000000L, active1, 0x4000000L, active2, 0x44800800L); + return jjMoveStringLiteralDfa3_0(active0, 0x2040000000000L, active1, 0x8000000L, active2, 0x89001000L); case 85: - return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x400010020001000L, active2, 0x200L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x400L); case 86: - return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L, active1, 0L, active2, 0x200000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x400000L); case 87: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 128; jjmatchedPos = 2; } break; case 88: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } break; case 89: - if ((active1 & 0x200000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 122; jjmatchedPos = 2; } break; case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x81800000002000L, active2, 0x201f0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x403e0L); case 98: - return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0x100080000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L, active1, 0x200100000000L, active2, 0L); case 99: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x1002000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); case 100: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 106; jjmatchedPos = 2; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x200000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 149; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x3eL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x8008000200000L, active1, 0L, active2, 0xc0000L); + return jjMoveStringLiteralDfa3_0(active0, 0x8008000200000L, active1, 0L, active2, 0x180000L); case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x10000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000040000000L, active1, 0L, active2, 0x20000000L); case 103: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 2; } - else if ((active1 & 0x1L) != 0L) + else if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x400000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); case 105: - if ((active1 & 0x20000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 82; jjmatchedPos = 2; } - else if ((active1 & 0x40000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 83; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x21080000000000L, active1, 0x44040000000L, active2, 0x80000001L); + return jjMoveStringLiteralDfa3_0(active0, 0x41080000000000L, active1, 0x88080000000L, active2, 0x100000002L); case 106: return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 107: @@ -672,78 +674,78 @@ else if ((active1 & 0x40000L) != 0L) } break; case 108: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 158; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x100300800L, active2, 0x1002400L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x2004800L); case 109: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x2000000800000200L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); case 110: - if ((active0 & 0x2000000000000000L) != 0L) + if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x904081218000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x100004002000000L, active1, 0x8000410400L, active2, 0x2000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x4000000L); case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0x400000000000L, active2, 0x400000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x800000L); case 114: - if ((active1 & 0x800000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 88; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x782000030001c0L, active2, 0x6L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0xcL); case 115: - if ((active1 & 0x2000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 102; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x80000L, active2, 0x1000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x2000L); case 116: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2040000000000L, active1, 0x4000000L, active2, 0x44800800L); + return jjMoveStringLiteralDfa3_0(active0, 0x2040000000000L, active1, 0x8000000L, active2, 0x89001000L); case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x400010020001000L, active2, 0x200L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x400L); case 118: - return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L, active1, 0L, active2, 0x200000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x400000L); case 119: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 128; jjmatchedPos = 2; } break; case 120: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } break; case 121: - if ((active1 & 0x200000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 122; jjmatchedPos = 2; } break; @@ -752,7 +754,8 @@ else if ((active0 & 0x40000000000000L) != 0L) } return jjMoveNfa_0(0, 2); } -private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 2); try { curChar = input_stream.readChar(); } @@ -762,115 +765,115 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - if ((active2 & 0x10L) != 0L) + if ((active2 & 0x20L) != 0L) { - jjmatchedKind = 132; + jjmatchedKind = 133; jjmatchedPos = 3; } break; case 50: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x60L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0xc0L); case 51: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x80L); - case 53: return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x100L); + case 53: + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x200L); case 65: - if ((active2 & 0x800L) != 0L) + if ((active2 & 0x1000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 140; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 152; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L, active1, 0x40000004000000L, active2, 0x100c0000L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x20180000L); case 66: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 67: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x80000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); case 68: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x1000000000L) != 0L) + else if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 101; jjmatchedPos = 3; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 129; jjmatchedPos = 3; } - else if ((active2 & 0x20000L) != 0L) + else if ((active2 & 0x40000L) != 0L) { - jjmatchedKind = 145; + jjmatchedKind = 146; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0x2010000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0x4020000L, active2, 0L); case 69: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x4L) != 0L) + else if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 3; } - else if ((active2 & 0x200L) != 0L) + else if ((active2 & 0x400L) != 0L) { - jjmatchedKind = 137; + jjmatchedKind = 138; jjmatchedPos = 3; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 150; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10002480400000L, active1, 0x2010000c00000038L, active2, 0x1003000L); + return jjMoveStringLiteralDfa4_0(active0, 0x10002480400000L, active1, 0x4020001800000070L, active2, 0x2006000L); case 70: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 71: - if ((active1 & 0x8000000L) != 0L) + if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 92; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x10000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); case 72: - if ((active2 & 0x40000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 159; jjmatchedPos = 3; } break; case 73: - return jjMoveStringLiteralDfa4_0(active0, 0x200040020000000L, active1, 0x100000042L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); case 74: return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); case 76: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 85; jjmatchedPos = 3; } - else if ((active1 & 0x4000000000L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 103; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x600081002000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); case 77: if ((active0 & 0x4000000000L) != 0L) { @@ -884,152 +887,152 @@ else if ((active1 & 0x4000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x10000001000L, active2, 0x80000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x100000000L); case 79: - if ((active2 & 0x4000000L) != 0L) + if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x1002008000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20080000000000L, active1, 0x2004010000000000L, active2, 0L); case 80: - if ((active2 & 0x2000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 154; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x1020000000000L, active1, 0x200L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x1020000000000L, active1, 0x400L, active2, 0L); case 82: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 120; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2008000000000L, active1, 0x400000060400000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2008000000000L, active1, 0x8000000c0800000L, active2, 0L); case 83: - return jjMoveStringLiteralDfa4_0(active0, 0x20000048000000L, active1, 0x9900000000000L, active2, 0x404L); + return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x808L); case 84: - if ((active1 & 0x80000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 84; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x104000000200800L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); case 85: - return jjMoveStringLiteralDfa4_0(active0, 0x100100201000000L, active1, 0x800000200000400L, active2, 0x2L); + return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x4L); case 86: - if ((active1 & 0x40000000000L) != 0L) + if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 107; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 89: - if ((active2 & 0x400000L) != 0L) + if ((active2 & 0x800000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 151; jjmatchedPos = 3; } break; case 95: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x180L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x300L, active2, 0L); case 97: - if ((active2 & 0x800L) != 0L) + if ((active2 & 0x1000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 140; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 152; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x400000000000000L, active1, 0x40000004000000L, active2, 0x100c0000L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x20180000L); case 98: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 99: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x80000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); case 100: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x1000000000L) != 0L) + else if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 101; jjmatchedPos = 3; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 129; jjmatchedPos = 3; } - else if ((active2 & 0x20000L) != 0L) + else if ((active2 & 0x40000L) != 0L) { - jjmatchedKind = 145; + jjmatchedKind = 146; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0x2010000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0x4020000L, active2, 0L); case 101: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x4L) != 0L) + else if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 3; } - else if ((active2 & 0x200L) != 0L) + else if ((active2 & 0x400L) != 0L) { - jjmatchedKind = 137; + jjmatchedKind = 138; jjmatchedPos = 3; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 150; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10002480400000L, active1, 0x2010000c00000038L, active2, 0x1003000L); + return jjMoveStringLiteralDfa4_0(active0, 0x10002480400000L, active1, 0x4020001800000070L, active2, 0x2006000L); case 102: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 103: - if ((active1 & 0x8000000L) != 0L) + if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 92; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x10000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); case 104: - if ((active2 & 0x40000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 159; jjmatchedPos = 3; } break; case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x200040020000000L, active1, 0x100000042L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); case 106: return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); case 108: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 85; jjmatchedPos = 3; } - else if ((active1 & 0x4000000000L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 103; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x600081002000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); case 109: if ((active0 & 0x4000000000L) != 0L) { @@ -1043,50 +1046,50 @@ else if ((active1 & 0x4000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x10000001000L, active2, 0x80000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x100000000L); case 111: - if ((active2 & 0x4000000L) != 0L) + if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x1002008000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20080000000000L, active1, 0x2004010000000000L, active2, 0L); case 112: - if ((active2 & 0x2000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 154; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x1020000000000L, active1, 0x200L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x1020000000000L, active1, 0x400L, active2, 0L); case 114: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 120; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2008000000000L, active1, 0x400000060400000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2008000000000L, active1, 0x8000000c0800000L, active2, 0L); case 115: - return jjMoveStringLiteralDfa4_0(active0, 0x20000048000000L, active1, 0x9900000000000L, active2, 0x404L); + return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x808L); case 116: - if ((active1 & 0x80000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 84; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x104000000200800L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x100100201000000L, active1, 0x800000200000400L, active2, 0x2L); + return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x4L); case 118: - if ((active1 & 0x40000000000L) != 0L) + if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 107; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 121: - if ((active2 & 0x400000L) != 0L) + if ((active2 & 0x800000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 151; jjmatchedPos = 3; } break; @@ -1095,7 +1098,8 @@ else if ((active1 & 0x4000000000L) != 0L) } return jjMoveNfa_0(0, 3); } -private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 3); try { curChar = input_stream.readChar(); } @@ -1105,15 +1109,15 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x200L); case 50: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x20L); - case 53: return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x40L); - case 56: + case 53: return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x80L); + case 56: + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100L); case 65: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4480081000042L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); case 67: return jjMoveStringLiteralDfa5_0(active0, 0x10000001400000L, active1, 0L, active2, 0L); case 68: @@ -1122,55 +1126,55 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x1000L) != 0L) + else if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 77; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 105; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); case 69: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x10000L) != 0L) + else if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 81; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 112; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 113; jjmatchedPos = 4; } - else if ((active2 & 0x400L) != 0L) + else if ((active2 & 0x800L) != 0L) { - jjmatchedKind = 138; + jjmatchedKind = 139; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x4000240000000L, active1, 0x20200000002800L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x4000240000000L, active1, 0x40400000005000L, active2, 0L); case 70: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 71: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 160; jjmatchedPos = 4; } break; @@ -1180,115 +1184,115 @@ else if ((active2 & 0x400L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x100000000000000L) != 0L) + else if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 121; jjmatchedPos = 4; } break; case 73: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 86; jjmatchedPos = 4; } - else if ((active1 & 0x20000000L) != 0L) + else if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 94; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 95; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0xa400000a00000L, active1, 0L, active2, 0x4L); + return jjMoveStringLiteralDfa5_0(active0, 0xa400000a00000L, active1, 0L, active2, 0x8L); case 76: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000L, active1, 0x200L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x21000000000000L, active1, 0x400L, active2, 0L); case 77: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x210000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); case 78: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L, active1, 0x1010000000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x2000000L); case 79: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 80: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x500L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); case 82: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 104; jjmatchedPos = 4; } - else if ((active2 & 0x40000L) != 0L) + else if ((active2 & 0x80000L) != 0L) { - jjmatchedKind = 146; + jjmatchedKind = 147; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000004000000L, active1, 0L, active2, 0x1000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000004000000L, active1, 0L, active2, 0x2000L); case 83: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x400000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 123; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0L); case 84: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x1000000000000000L) != 0L) + else if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 4; } - else if ((active1 & 0x2000000L) != 0L) + else if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 90; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x20000008000000L, active1, 0x808100904400000L, active2, 0x82000L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x104000L); case 85: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x10000002L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x20000004L); case 86: - if ((active1 & 0x8L) != 0L) + if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x30L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); case 88: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 99; jjmatchedPos = 4; } break; case 90: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); case 97: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4480081000042L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); case 99: return jjMoveStringLiteralDfa5_0(active0, 0x10000001400000L, active1, 0L, active2, 0L); case 100: @@ -1297,55 +1301,55 @@ else if ((active1 & 0x2000000L) != 0L) jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x1000L) != 0L) + else if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 77; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 105; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); case 101: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x10000L) != 0L) + else if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 81; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 112; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 113; jjmatchedPos = 4; } - else if ((active2 & 0x400L) != 0L) + else if ((active2 & 0x800L) != 0L) { - jjmatchedKind = 138; + jjmatchedKind = 139; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x4000240000000L, active1, 0x20200000002800L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x4000240000000L, active1, 0x40400000005000L, active2, 0L); case 102: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 103: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 160; jjmatchedPos = 4; } break; @@ -1355,119 +1359,120 @@ else if ((active2 & 0x400L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x100000000000000L) != 0L) + else if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 121; jjmatchedPos = 4; } break; case 105: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 86; jjmatchedPos = 4; } - else if ((active1 & 0x20000000L) != 0L) + else if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 94; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 95; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0xa400000a00000L, active1, 0L, active2, 0x4L); + return jjMoveStringLiteralDfa5_0(active0, 0xa400000a00000L, active1, 0L, active2, 0x8L); case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000L, active1, 0x200L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x21000000000000L, active1, 0x400L, active2, 0L); case 109: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x210000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); case 110: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L, active1, 0x1010000000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x2000000L); case 111: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 112: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x500L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); case 114: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 104; jjmatchedPos = 4; } - else if ((active2 & 0x40000L) != 0L) + else if ((active2 & 0x80000L) != 0L) { - jjmatchedKind = 146; + jjmatchedKind = 147; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000004000000L, active1, 0L, active2, 0x1000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000004000000L, active1, 0L, active2, 0x2000L); case 115: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x400000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 123; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0L); case 116: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x1000000000000000L) != 0L) + else if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 4; } - else if ((active1 & 0x2000000L) != 0L) + else if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 90; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x20000008000000L, active1, 0x808100904400000L, active2, 0x82000L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x104000L); case 117: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x10000002L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x20000004L); case 118: - if ((active1 & 0x8L) != 0L) + if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x30L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); case 120: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 99; jjmatchedPos = 4; } break; case 122: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 4); } -private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 4); try { curChar = input_stream.readChar(); } @@ -1477,97 +1482,102 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long a switch(curChar) { case 50: - if ((active2 & 0x100L) != 0L) + if ((active2 & 0x200L) != 0L) { - jjmatchedKind = 136; + jjmatchedKind = 137; jjmatchedPos = 5; } break; case 52: - if ((active2 & 0x20L) != 0L) + if ((active2 & 0x40L) != 0L) { - jjmatchedKind = 133; + jjmatchedKind = 134; jjmatchedPos = 5; } - else if ((active2 & 0x80L) != 0L) + else if ((active2 & 0x100L) != 0L) { - jjmatchedKind = 135; + jjmatchedKind = 136; jjmatchedPos = 5; } break; case 54: - if ((active2 & 0x40L) != 0L) + if ((active2 & 0x80L) != 0L) { - jjmatchedKind = 134; + jjmatchedKind = 135; jjmatchedPos = 5; } break; case 65: - return jjMoveStringLiteralDfa6_0(active0, 0x400000000000000L, active1, 0x8000010000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L, active1, 0x10000020000100L, active2, 0L); case 67: - return jjMoveStringLiteralDfa6_0(active0, 0xc400000000000L, active1, 0x400000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0xc400000000000L, active1, 0x800000000000L, active2, 0L); case 68: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x1010000000000000L, active2, 0L); + if ((active0 & 0x20000000000000L) != 0L) + { + jjmatchedKind = 53; + jjmatchedPos = 5; + } + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); case 69: if ((active0 & 0x1000000000000L) != 0L) { jjmatchedKind = 48; jjmatchedPos = 5; } - else if ((active1 & 0x200L) != 0L) + else if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 5; } - else if ((active2 & 0x2000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 142; jjmatchedPos = 5; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x100000L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 148; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x802000b00400000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); case 70: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 71: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 5; } break; case 73: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x4000000000000L, active2, 0x2L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x4L); case 76: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x10000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x20000000L); case 78: - if ((active1 & 0x2L) != 0L) + if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 110; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x81000040L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); case 79: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2000000000000100L, active2, 0x4L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x8L); case 80: return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L, active1, 0L, active2, 0L); case 82: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 109; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1577,12 +1587,12 @@ else if ((active1 & 0x100000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); case 84: if ((active0 & 0x400000L) != 0L) { @@ -1599,22 +1609,22 @@ else if ((active0 & 0x10000000000000L) != 0L) jjmatchedKind = 52; jjmatchedPos = 5; } - else if ((active1 & 0x80000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 108; jjmatchedPos = 5; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 141; jjmatchedPos = 5; } - else if ((active2 & 0x1000000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 153; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 88: if ((active0 & 0x200000L) != 0L) { @@ -1623,75 +1633,80 @@ else if ((active2 & 0x1000000L) != 0L) } break; case 89: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); case 95: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x430L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x860L, active2, 0L); case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x400000000000000L, active1, 0x8000010000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L, active1, 0x10000020000100L, active2, 0L); case 99: - return jjMoveStringLiteralDfa6_0(active0, 0xc400000000000L, active1, 0x400000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0xc400000000000L, active1, 0x800000000000L, active2, 0L); case 100: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x1010000000000000L, active2, 0L); + if ((active0 & 0x20000000000000L) != 0L) + { + jjmatchedKind = 53; + jjmatchedPos = 5; + } + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); case 101: if ((active0 & 0x1000000000000L) != 0L) { jjmatchedKind = 48; jjmatchedPos = 5; } - else if ((active1 & 0x200L) != 0L) + else if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 5; } - else if ((active2 & 0x2000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 142; jjmatchedPos = 5; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x100000L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 148; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x802000b00400000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); case 102: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 103: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 5; } break; case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x4000000000000L, active2, 0x2L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x4L); case 108: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x10000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x20000000L); case 110: - if ((active1 & 0x2L) != 0L) + if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 110; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x81000040L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); case 111: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2000000000000100L, active2, 0x4L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x8L); case 112: return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L, active1, 0L, active2, 0L); case 114: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 109; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1701,12 +1716,12 @@ else if ((active1 & 0x100000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); case 116: if ((active0 & 0x400000L) != 0L) { @@ -1723,22 +1738,22 @@ else if ((active0 & 0x10000000000000L) != 0L) jjmatchedKind = 52; jjmatchedPos = 5; } - else if ((active1 & 0x80000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 108; jjmatchedPos = 5; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 141; jjmatchedPos = 5; } - else if ((active2 & 0x1000000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 153; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 120: if ((active0 & 0x200000L) != 0L) { @@ -1747,13 +1762,14 @@ else if ((active2 & 0x1000000L) != 0L) } break; case 121: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 5); } -private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 5); try { curChar = input_stream.readChar(); } @@ -1767,16 +1783,16 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long a case 66: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 67: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x2440L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); case 68: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x2L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 130; jjmatchedPos = 6; } break; @@ -1786,96 +1802,96 @@ else if ((active2 & 0x2L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 111; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 71: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 89; jjmatchedPos = 6; } break; case 75: - if ((active1 & 0x80000000L) != 0L) + if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 96; jjmatchedPos = 6; } break; case 76: return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L, active1, 0L, active2, 0L); case 77: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); case 78: - if ((active2 & 0x4L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 131; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); case 79: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 80: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4000020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); case 82: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000b00000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); case 83: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 117; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 124; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 125; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x400010L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); case 84: if ((active0 & 0x4000000000000L) != 0L) { jjmatchedKind = 50; jjmatchedPos = 6; } - else if ((active2 & 0x10000000L) != 0L) + else if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 157; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x400000000000000L, active1, 0x10000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); case 85: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); case 95: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); case 97: return jjMoveStringLiteralDfa7_0(active0, 0x8040000000000L, active1, 0L, active2, 0L); case 98: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 99: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x2440L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); case 100: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x2L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 130; jjmatchedPos = 6; } break; @@ -1885,77 +1901,77 @@ else if ((active2 & 0x2L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 111; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); case 103: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 89; jjmatchedPos = 6; } break; case 107: - if ((active1 & 0x80000000L) != 0L) + if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 96; jjmatchedPos = 6; } break; case 108: return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L, active1, 0L, active2, 0L); case 109: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); case 110: - if ((active2 & 0x4L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 131; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); case 111: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); case 112: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4000020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); case 114: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000b00000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); case 115: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 117; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 124; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 125; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x400010L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); case 116: if ((active0 & 0x4000000000000L) != 0L) { jjmatchedKind = 50; jjmatchedPos = 6; } - else if ((active2 & 0x10000000L) != 0L) + else if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 157; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x400000000000000L, active1, 0x10000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); case 117: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); default : @@ -1963,7 +1979,8 @@ else if ((active2 & 0x10000000L) != 0L) } return jjMoveNfa_0(0, 6); } -private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 6); try { curChar = input_stream.readChar(); } @@ -1973,9 +1990,9 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long a switch(curChar) { case 65: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000010L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); case 67: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x10000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); case 69: if ((active0 & 0x4000000L) != 0L) { @@ -1987,31 +2004,31 @@ else if ((active0 & 0x2000000000000L) != 0L) jjmatchedKind = 49; jjmatchedPos = 7; } - else if ((active1 & 0x40L) != 0L) + else if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 7; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 78; jjmatchedPos = 7; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 91; jjmatchedPos = 7; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 126; jjmatchedPos = 7; } break; case 70: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x2000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); case 73: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); case 76: if ((active0 & 0x40000000000L) != 0L) { @@ -2020,32 +2037,32 @@ else if ((active1 & 0x2000000000000000L) != 0L) } break; case 77: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 100; jjmatchedPos = 7; } break; case 79: - return jjMoveStringLiteralDfa8_0(active0, 0x400000000000000L, active1, 0x420L); + return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); case 80: - if ((active1 & 0x80L) != 0L) + if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } break; case 82: - if ((active1 & 0x40000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 119; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x20000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); case 83: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 115; jjmatchedPos = 7; } break; @@ -2055,16 +2072,16 @@ else if ((active1 & 0x2000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x400000L) != 0L) + else if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 87; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000L, active1, 0x8000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000L, active1, 0x10000000000000L); case 97: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000010L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x10000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); case 101: if ((active0 & 0x4000000L) != 0L) { @@ -2076,31 +2093,31 @@ else if ((active0 & 0x2000000000000L) != 0L) jjmatchedKind = 49; jjmatchedPos = 7; } - else if ((active1 & 0x40L) != 0L) + else if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 7; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 78; jjmatchedPos = 7; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 91; jjmatchedPos = 7; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 126; jjmatchedPos = 7; } break; case 102: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x2000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); case 105: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); case 108: if ((active0 & 0x40000000000L) != 0L) { @@ -2109,32 +2126,32 @@ else if ((active1 & 0x2000000000000000L) != 0L) } break; case 109: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 100; jjmatchedPos = 7; } break; case 111: - return jjMoveStringLiteralDfa8_0(active0, 0x400000000000000L, active1, 0x420L); + return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); case 112: - if ((active1 & 0x80L) != 0L) + if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } break; case 114: - if ((active1 & 0x40000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 119; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x20000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); case 115: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 115; jjmatchedPos = 7; } break; @@ -2144,18 +2161,19 @@ else if ((active1 & 0x2000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x400000L) != 0L) + else if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 87; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000L, active1, 0x8000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000L, active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 7); } -private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1){ +private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1) +{ if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjMoveNfa_0(0, 7); try { curChar = input_stream.readChar(); } @@ -2165,9 +2183,9 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 98; jjmatchedPos = 8; } break; @@ -2177,45 +2195,45 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a jjmatchedKind = 51; jjmatchedPos = 8; } - else if ((active1 & 0x20000000000000L) != 0L) + else if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 118; jjmatchedPos = 8; } break; case 72: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); case 76: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 97; jjmatchedPos = 8; } break; case 77: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); case 78: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x400L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); case 79: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); case 80: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 8; } break; case 82: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 8; } break; case 83: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 116; jjmatchedPos = 8; } break; @@ -2227,9 +2245,9 @@ else if ((active1 & 0x20000000000000L) != 0L) } break; case 99: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 98; jjmatchedPos = 8; } break; @@ -2239,45 +2257,45 @@ else if ((active1 & 0x20000000000000L) != 0L) jjmatchedKind = 51; jjmatchedPos = 8; } - else if ((active1 & 0x20000000000000L) != 0L) + else if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 118; jjmatchedPos = 8; } break; case 104: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); case 108: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 97; jjmatchedPos = 8; } break; case 109: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); case 110: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x400L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); case 111: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); case 112: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 8; } break; case 114: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 8; } break; case 115: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 116; jjmatchedPos = 8; } break; @@ -2293,7 +2311,8 @@ else if ((active1 & 0x20000000000000L) != 0L) } return jjMoveNfa_0(0, 8); } -private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1){ +private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) +{ if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjMoveNfa_0(0, 8); try { curChar = input_stream.readChar(); } @@ -2303,37 +2322,38 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - return jjMoveStringLiteralDfa10_0(active1, 0x400L); + return jjMoveStringLiteralDfa10_0(active1, 0x800L); case 69: - return jjMoveStringLiteralDfa10_0(active1, 0x10000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); case 80: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 9; } break; case 82: - return jjMoveStringLiteralDfa10_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); case 99: - return jjMoveStringLiteralDfa10_0(active1, 0x400L); + return jjMoveStringLiteralDfa10_0(active1, 0x800L); case 101: - return jjMoveStringLiteralDfa10_0(active1, 0x10000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); case 112: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 9; } break; case 114: - return jjMoveStringLiteralDfa10_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); default : break; } return jjMoveNfa_0(0, 9); } -private int jjMoveStringLiteralDfa10_0(long old1, long active1){ +private int jjMoveStringLiteralDfa10_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 9); try { curChar = input_stream.readChar(); } @@ -2343,22 +2363,22 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ switch(curChar) { case 65: - return jjMoveStringLiteralDfa11_0(active1, 0x400L); + return jjMoveStringLiteralDfa11_0(active1, 0x800L); case 83: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 93; jjmatchedPos = 10; } break; case 95: - return jjMoveStringLiteralDfa11_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa11_0(active1, 0x4000000000000L); case 97: - return jjMoveStringLiteralDfa11_0(active1, 0x400L); + return jjMoveStringLiteralDfa11_0(active1, 0x800L); case 115: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 93; jjmatchedPos = 10; } break; @@ -2367,7 +2387,8 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ } return jjMoveNfa_0(0, 10); } -private int jjMoveStringLiteralDfa11_0(long old1, long active1){ +private int jjMoveStringLiteralDfa11_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 10); try { curChar = input_stream.readChar(); } @@ -2377,29 +2398,30 @@ private int jjMoveStringLiteralDfa11_0(long old1, long active1){ switch(curChar) { case 84: - if ((active1 & 0x400L) != 0L) + if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 75; jjmatchedPos = 11; } break; case 85: - return jjMoveStringLiteralDfa12_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); case 116: - if ((active1 & 0x400L) != 0L) + if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 75; jjmatchedPos = 11; } break; case 117: - return jjMoveStringLiteralDfa12_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); default : break; } return jjMoveNfa_0(0, 11); } -private int jjMoveStringLiteralDfa12_0(long old1, long active1){ +private int jjMoveStringLiteralDfa12_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 11); try { curChar = input_stream.readChar(); } @@ -2409,15 +2431,16 @@ private int jjMoveStringLiteralDfa12_0(long old1, long active1){ switch(curChar) { case 82: - return jjMoveStringLiteralDfa13_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); case 114: - return jjMoveStringLiteralDfa13_0(active1, 0x2000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); default : break; } return jjMoveNfa_0(0, 12); } -private int jjMoveStringLiteralDfa13_0(long old1, long active1){ +private int jjMoveStringLiteralDfa13_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 12); try { curChar = input_stream.readChar(); } @@ -2427,16 +2450,16 @@ private int jjMoveStringLiteralDfa13_0(long old1, long active1){ switch(curChar) { case 73: - if ((active1 & 0x2000000000000L) != 0L) + if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 114; jjmatchedPos = 13; } break; case 105: - if ((active1 & 0x2000000000000L) != 0L) + if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 114; jjmatchedPos = 13; } break; @@ -2515,51 +2538,51 @@ private int jjMoveNfa_0(int startState, int curPos) case 0: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 161) - kind = 161; - { jjCheckNAddStates(0, 6); } + if (kind > 162) + kind = 162; + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); } else if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 148; else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 124; else if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); else if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); } else if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); else if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2575,11 +2598,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 7: if (curChar == 62 && kind > 10) @@ -2612,11 +2635,11 @@ else if (curChar == 39) case 16: case 21: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 19: if ((0x3ff000000000000L & l) != 0L) @@ -2628,18 +2651,18 @@ else if (curChar == 39) break; case 22: if (curChar == 58) - { jjAddStates(40, 41); } + jjAddStates(40, 41); break; case 23: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2647,7 +2670,7 @@ else if (curChar == 39) break; case 32: if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); break; case 33: case 34: @@ -2655,11 +2678,11 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 38: if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); break; case 39: case 40: @@ -2667,62 +2690,62 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 46: if (curChar == 45) - { jjCheckNAdd(47); } + jjCheckNAdd(47); break; case 47: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 49: if (curChar == 35) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 50: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 51: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 52: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 57: if (curChar == 10) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 58: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 57; break; case 65: - if ((0x8400000000L & l) != 0L && kind > 173) - kind = 173; + if ((0x8400000000L & l) != 0L && kind > 174) + kind = 174; break; case 66: if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 67: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 68: - if (curChar == 39 && kind > 177) - kind = 177; + if (curChar == 39 && kind > 178) + kind = 178; break; case 70: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 72: if ((0x3ff000000000000L & l) != 0L) @@ -2751,11 +2774,11 @@ else if (curChar == 39) case 78: case 83: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 81: if ((0x3ff000000000000L & l) != 0L) @@ -2767,19 +2790,19 @@ else if (curChar == 39) break; case 84: if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 85: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 86: - if (curChar == 34 && kind > 178) - kind = 178; + if (curChar == 34 && kind > 179) + kind = 179; break; case 88: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 90: if ((0x3ff000000000000L & l) != 0L) @@ -2808,11 +2831,11 @@ else if (curChar == 39) case 96: case 101: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 99: if ((0x3ff000000000000L & l) != 0L) @@ -2824,24 +2847,24 @@ else if (curChar == 39) break; case 102: if (curChar == 39) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 103: case 106: if (curChar == 39) - { jjCheckNAddTwoStates(104, 107); } + jjCheckNAddTwoStates(104, 107); break; case 104: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 105: if (curChar == 39) - { jjAddStates(58, 59); } + jjAddStates(58, 59); break; case 108: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 110: if ((0x3ff000000000000L & l) != 0L) @@ -2870,11 +2893,11 @@ else if (curChar == 39) case 116: case 121: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 119: if ((0x3ff000000000000L & l) != 0L) @@ -2885,8 +2908,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 121; break; case 122: - if (curChar == 39 && kind > 179) - kind = 179; + if (curChar == 39 && kind > 180) + kind = 180; break; case 123: if (curChar == 39) @@ -2902,24 +2925,24 @@ else if (curChar == 39) break; case 126: if (curChar == 34) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 127: case 130: if (curChar == 34) - { jjCheckNAddTwoStates(128, 131); } + jjCheckNAddTwoStates(128, 131); break; case 128: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 129: if (curChar == 34) - { jjAddStates(64, 65); } + jjAddStates(64, 65); break; case 132: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 134: if ((0x3ff000000000000L & l) != 0L) @@ -2948,11 +2971,11 @@ else if (curChar == 39) case 140: case 145: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 143: if ((0x3ff000000000000L & l) != 0L) @@ -2963,8 +2986,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 145; break; case 146: - if (curChar == 34 && kind > 180) - kind = 180; + if (curChar == 34 && kind > 181) + kind = 181; break; case 147: if (curChar == 34) @@ -2980,31 +3003,31 @@ else if (curChar == 39) break; case 150: if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 151: if (curChar == 35) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 152: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 153: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 154: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 155: - if (curChar == 41 && kind > 183) - kind = 183; + if (curChar == 41 && kind > 184) + kind = 184; break; case 156: if (curChar == 10) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 157: if (curChar == 13) @@ -3012,23 +3035,23 @@ else if (curChar == 39) break; case 159: if (curChar == 35) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 160: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 161: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 162: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 164: if (curChar == 10) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 165: if (curChar == 13) @@ -3036,7 +3059,7 @@ else if (curChar == 39) break; case 167: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(81, 83); } + jjAddStates(81, 83); break; case 168: if ((0x3ff200000000000L & l) != 0L) @@ -3048,7 +3071,7 @@ else if (curChar == 39) break; case 173: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(84, 86); } + jjAddStates(84, 86); break; case 174: if ((0x3ff200000000000L & l) != 0L) @@ -3056,18 +3079,18 @@ else if (curChar == 39) break; case 175: if (curChar == 58) - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 176: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -3075,11 +3098,11 @@ else if (curChar == 39) break; case 182: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 183: if (curChar == 37) - { jjAddStates(92, 93); } + jjAddStates(92, 93); break; case 184: if ((0x3ff000000000000L & l) != 0L) @@ -3087,7 +3110,7 @@ else if (curChar == 39) break; case 185: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x3ff000000000000L & l) != 0L) @@ -3106,7 +3129,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 192: if (curChar == 37) @@ -3121,34 +3144,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 203: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 206: if (curChar == 35) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 207: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 208: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 209: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 214: if (curChar == 10) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 215: if (curChar == 13) @@ -3156,23 +3179,23 @@ else if (curChar == 39) break; case 221: if (curChar == 35) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 222: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 223: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 224: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 230: if (curChar == 10) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 231: if (curChar == 13) @@ -3181,262 +3204,262 @@ else if (curChar == 39) case 236: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 161) - kind = 161; - { jjCheckNAddStates(0, 6); } + if (kind > 162) + kind = 162; + jjCheckNAddStates(0, 6); break; case 237: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 161) - kind = 161; - { jjCheckNAdd(237); } + if (kind > 162) + kind = 162; + jjCheckNAdd(237); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 239: if (curChar == 46) - { jjCheckNAdd(240); } + jjCheckNAdd(240); break; case 240: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 162) - kind = 162; - { jjCheckNAdd(240); } + if (kind > 163) + kind = 163; + jjCheckNAdd(240); break; case 241: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(241, 242); } + jjCheckNAddTwoStates(241, 242); break; case 242: if (curChar == 46) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 245: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(246); } + jjCheckNAdd(246); break; case 246: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAdd(246); } + if (kind > 164) + kind = 164; + jjCheckNAdd(246); break; case 247: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(247, 248); } + jjCheckNAddTwoStates(247, 248); break; case 249: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(250); } + jjCheckNAdd(250); break; case 250: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAdd(250); } + if (kind > 164) + kind = 164; + jjCheckNAdd(250); break; case 251: if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); break; case 252: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(252, 253); } + jjCheckNAddTwoStates(252, 253); break; case 254: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(255); } + jjCheckNAdd(255); break; case 255: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAdd(255); } + if (kind > 164) + kind = 164; + jjCheckNAdd(255); break; case 256: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 257: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; - { jjCheckNAdd(257); } + if (kind > 165) + kind = 165; + jjCheckNAdd(257); break; case 258: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(258, 259); } + jjCheckNAddTwoStates(258, 259); break; case 259: if (curChar == 46) - { jjCheckNAdd(260); } + jjCheckNAdd(260); break; case 260: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(260); } + if (kind > 166) + kind = 166; + jjCheckNAdd(260); break; case 261: if (curChar == 46) - { jjCheckNAdd(262); } + jjCheckNAdd(262); break; case 262: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(262, 263); } + jjCheckNAddTwoStates(262, 263); break; case 264: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(265); } + jjCheckNAdd(265); break; case 265: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; - { jjCheckNAdd(265); } + if (kind > 167) + kind = 167; + jjCheckNAdd(265); break; case 266: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(112, 115); } + jjCheckNAddStates(112, 115); break; case 267: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(267, 268); } + jjCheckNAddTwoStates(267, 268); break; case 268: if (curChar == 46) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 269: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 271: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(272); } + jjCheckNAdd(272); break; case 272: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; - { jjCheckNAdd(272); } + if (kind > 167) + kind = 167; + jjCheckNAdd(272); break; case 273: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(273, 274); } + jjCheckNAddTwoStates(273, 274); break; case 275: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(276); } + jjCheckNAdd(276); break; case 276: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; - { jjCheckNAdd(276); } + if (kind > 167) + kind = 167; + jjCheckNAdd(276); break; case 277: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 278: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; - { jjCheckNAdd(278); } + if (kind > 168) + kind = 168; + jjCheckNAdd(278); break; case 279: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(279, 280); } + jjCheckNAddTwoStates(279, 280); break; case 280: if (curChar == 46) - { jjCheckNAdd(281); } + jjCheckNAdd(281); break; case 281: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(281); } + if (kind > 169) + kind = 169; + jjCheckNAdd(281); break; case 282: if (curChar == 46) - { jjCheckNAdd(283); } + jjCheckNAdd(283); break; case 283: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(283, 284); } + jjCheckNAddTwoStates(283, 284); break; case 285: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(286); } + jjCheckNAdd(286); break; case 286: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; - { jjCheckNAdd(286); } + if (kind > 170) + kind = 170; + jjCheckNAdd(286); break; case 287: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(116, 119); } + jjCheckNAddStates(116, 119); break; case 288: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(288, 289); } + jjCheckNAddTwoStates(288, 289); break; case 289: if (curChar == 46) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 290: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 292: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(293); } + jjCheckNAdd(293); break; case 293: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; - { jjCheckNAdd(293); } + if (kind > 170) + kind = 170; + jjCheckNAdd(293); break; case 294: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(294, 295); } + jjCheckNAddTwoStates(294, 295); break; case 296: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(297); } + jjCheckNAdd(297); break; case 297: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; - { jjCheckNAdd(297); } + if (kind > 170) + kind = 170; + jjCheckNAdd(297); break; default : break; } @@ -3451,32 +3474,32 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); else if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 65; else if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 22; if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 62; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 8: if (curChar == 92) - { jjAddStates(130, 131); } + jjAddStates(130, 131); break; case 9: if (curChar == 85) @@ -3509,11 +3532,11 @@ else if ((0x20000000200L & l) != 0L) case 16: case 21: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 18: if (curChar == 117) @@ -3532,11 +3555,11 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3552,7 +3575,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 39: case 40: @@ -3560,36 +3583,36 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 44: if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); break; case 45: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(45, 46); } + jjCheckNAddTwoStates(45, 46); break; case 47: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 48: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 50: - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 53: - if ((0x200000002L & l) != 0L && kind > 142) - kind = 142; + if ((0x200000002L & l) != 0L && kind > 143) + kind = 143; break; case 54: if ((0x10000000100000L & l) != 0L) @@ -3628,20 +3651,20 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 65; break; case 65: - if ((0x14404410000000L & l) != 0L && kind > 173) - kind = 173; + if ((0x14404410000000L & l) != 0L && kind > 174) + kind = 174; break; case 67: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 69: if (curChar == 92) - { jjAddStates(132, 134); } + jjAddStates(132, 134); break; case 70: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 71: if (curChar == 85) @@ -3674,11 +3697,11 @@ else if ((0x20000000200L & l) != 0L) case 78: case 83: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 80: if (curChar == 117) @@ -3694,15 +3717,15 @@ else if ((0x20000000200L & l) != 0L) break; case 85: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 87: if (curChar == 92) - { jjAddStates(135, 137); } + jjAddStates(135, 137); break; case 88: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 89: if (curChar == 85) @@ -3735,11 +3758,11 @@ else if ((0x20000000200L & l) != 0L) case 96: case 101: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 98: if (curChar == 117) @@ -3755,15 +3778,15 @@ else if ((0x20000000200L & l) != 0L) break; case 104: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 107: if (curChar == 92) - { jjAddStates(138, 140); } + jjAddStates(138, 140); break; case 108: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 109: if (curChar == 85) @@ -3796,11 +3819,11 @@ else if ((0x20000000200L & l) != 0L) case 116: case 121: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 118: if (curChar == 117) @@ -3816,15 +3839,15 @@ else if ((0x20000000200L & l) != 0L) break; case 128: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 131: if (curChar == 92) - { jjAddStates(141, 143); } + jjAddStates(141, 143); break; case 132: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 133: if (curChar == 85) @@ -3857,11 +3880,11 @@ else if ((0x20000000200L & l) != 0L) case 140: case 145: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 142: if (curChar == 117) @@ -3876,49 +3899,49 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 145; break; case 152: - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 158: if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 160: - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 163: - if (curChar == 93 && kind > 188) - kind = 188; + if (curChar == 93 && kind > 189) + kind = 189; break; case 166: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3926,11 +3949,11 @@ else if ((0x20000000200L & l) != 0L) break; case 181: if (curChar == 92) - { jjAddStates(144, 145); } + jjAddStates(144, 145); break; case 182: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 184: if ((0x7e0000007eL & l) != 0L) @@ -3938,7 +3961,7 @@ else if ((0x20000000200L & l) != 0L) break; case 185: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x7e0000007eL & l) != 0L) @@ -3961,7 +3984,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 193: if ((0x7e0000007eL & l) != 0L) @@ -3972,22 +3995,22 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 204: if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); break; case 205: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 207: - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 210: - if ((0x200000002L & l) != 0L && kind > 143) - kind = 143; + if ((0x200000002L & l) != 0L && kind > 144) + kind = 144; break; case 211: if ((0x10000000100000L & l) != 0L) @@ -4019,14 +4042,14 @@ else if ((0x20000000200L & l) != 0L) break; case 220: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 222: - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 225: - if ((0x2000000020L & l) != 0L && kind > 144) - kind = 144; + if ((0x2000000020L & l) != 0L && kind > 145) + kind = 145; break; case 226: if ((0x4000000040000L & l) != 0L) @@ -4062,39 +4085,39 @@ else if ((0x20000000200L & l) != 0L) break; case 244: if ((0x2000000020L & l) != 0L) - { jjAddStates(146, 147); } + jjAddStates(146, 147); break; case 248: if ((0x2000000020L & l) != 0L) - { jjAddStates(148, 149); } + jjAddStates(148, 149); break; case 253: if ((0x2000000020L & l) != 0L) - { jjAddStates(150, 151); } + jjAddStates(150, 151); break; case 263: if ((0x2000000020L & l) != 0L) - { jjAddStates(152, 153); } + jjAddStates(152, 153); break; case 270: if ((0x2000000020L & l) != 0L) - { jjAddStates(154, 155); } + jjAddStates(154, 155); break; case 274: if ((0x2000000020L & l) != 0L) - { jjAddStates(156, 157); } + jjAddStates(156, 157); break; case 284: if ((0x2000000020L & l) != 0L) - { jjAddStates(158, 159); } + jjAddStates(158, 159); break; case 291: if ((0x2000000020L & l) != 0L) - { jjAddStates(160, 161); } + jjAddStates(160, 161); break; case 295: if ((0x2000000020L & l) != 0L) - { jjAddStates(162, 163); } + jjAddStates(162, 163); break; default : break; } @@ -4102,7 +4125,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -4113,31 +4136,31 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 23: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4145,11 +4168,11 @@ else if ((0x20000000200L & l) != 0L) break; case 26: if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjAddStates(166, 167); } + jjAddStates(166, 167); break; case 27: if (jjCanMove_4(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 28: if (jjCanMove_5(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4164,136 +4187,136 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 33: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 34: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 35: if (jjCanMove_8(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 36: if (!jjCanMove_9(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 37: if (jjCanMove_10(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 39: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 40: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 41: if (jjCanMove_11(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 42: if (!jjCanMove_12(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 43: if (jjCanMove_13(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 50: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(45, 50); } + jjAddStates(45, 50); break; case 67: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(37, 39); } + jjAddStates(37, 39); break; case 85: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(34, 36); } + jjAddStates(34, 36); break; case 104: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(54, 57); } + jjAddStates(54, 57); break; case 128: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(60, 63); } + jjAddStates(60, 63); break; case 152: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 160: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(72, 77); } + jjAddStates(72, 77); break; case 166: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 170: if (jjCanMove_14(hiByte, i1, i2, l1, l2)) - { jjAddStates(168, 169); } + jjAddStates(168, 169); break; case 171: if (jjCanMove_15(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 172: if (jjCanMove_16(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4301,11 +4324,11 @@ else if ((0x20000000200L & l) != 0L) break; case 179: if (jjCanMove_17(hiByte, i1, i2, l1, l2)) - { jjAddStates(170, 171); } + jjAddStates(170, 171); break; case 180: if (jjCanMove_18(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 189: if (jjCanMove_19(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4320,41 +4343,41 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 197: if (jjCanMove_22(hiByte, i1, i2, l1, l2)) - { jjAddStates(172, 173); } + jjAddStates(172, 173); break; case 198: if (jjCanMove_23(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 199: if (jjCanMove_24(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 200: if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 201: if (jjCanMove_26(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(174, 177); } + jjCheckNAddStates(174, 177); break; case 202: if (jjCanMove_27(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(178, 181); } + jjCheckNAddStates(178, 181); break; case 207: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(94, 99); } + jjAddStates(94, 99); break; case 222: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(103, 108); } + jjAddStates(103, 108); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -4390,50 +4413,6 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, -null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -"\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", -"\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", "\173\174", "\174\175", -"\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", "\57", "\136\136", -"\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, null, null, null, -null, null, null, null, null, null, null, null, }; -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} static final int[] jjnextStates = { 237, 238, 239, 241, 242, 247, 248, 278, 279, 280, 282, 287, 257, 258, 259, 261, 266, 176, 190, 192, 195, 151, 154, 155, 39, 43, 6, 7, 8, 1, 2, 4, @@ -4759,6 +4738,113 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", +"\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", "\173\174", +"\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", "\57", +"\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, null, null, +null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffc47fdffffffffL, 0xfffffffL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[298]; +private final int[] jjstateSet = new int[596]; +protected char curChar; +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 298; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4780,10 +4866,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4841,31 +4926,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4893,98 +4953,4 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } - /** Constructor. */ - public ARQParserTokenManager(SimpleCharStream stream){ - - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - - input_stream = stream; - } - - /** Constructor. */ - public ARQParserTokenManager (SimpleCharStream stream, int lexState){ - ReInit(stream); - SwitchTo(lexState); - } - - /** Reinitialise parser. */ - - public void ReInit(SimpleCharStream stream) - { - - - jjmatchedPos = - jjnewStateCnt = - 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() - { - int i; - jjround = 0x80000001; - for (i = 298; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - /** Reinitialise parser. */ - public void ReInit(SimpleCharStream stream, int lexState) - - { - ReInit(stream); - SwitchTo(lexState); - } - - /** Switch to specified lex state. */ - public void SwitchTo(int lexState) - { - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffe23feffffffffL, 0x7ffffffL, -}; -static final long[] jjtoSkip = { - 0x7eL, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x40L, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoMore = { - 0x0L, 0x0L, 0x0L, 0x0L, -}; - protected SimpleCharStream input_stream; - - private final int[] jjrounds = new int[298]; - private final int[] jjstateSet = new int[2 * 298]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java index cb1919325b9..b41e002b02e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ -/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ package org.apache.jena.sparql.lang.arq ; /** @@ -20,11 +20,6 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -65,7 +60,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * following this token will (therefore) be the first error token. + * followng this token will (therefore) be the first error token. */ public Token currentToken; @@ -93,8 +88,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -106,7 +101,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(EOL).append(" "); + expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -122,26 +117,21 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - if (currentToken.next != null) { - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - } - retval += "." + EOL; - - - if (expectedTokenSequences.length == 0) { - // Nothing to add here + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; } else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); + retval += "Was expecting one of:" + eol + " "; } - + retval += expected.toString(); return retval; } + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -149,11 +139,13 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -192,4 +184,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=7f03520468cc43d4f83f09bbb6a97299 (do not edit this line) */ +/* JavaCC - OriginalChecksum=48a48010f2f271416e60bbfb8cf25e4b (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java index d6ffb88916a..37e4f47459a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; @@ -30,12 +30,10 @@ public class SimpleCharStream protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - - public void setTabSize(int i) { tabSize = i; } - public int getTabSize() { return tabSize; } + protected int tabSize = 8; + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) @@ -203,20 +201,22 @@ public char readChar() throws java.io.IOException return c; } + @Deprecated /** * @deprecated * @see #getEndColumn */ - @Deprecated + public int getColumn() { return bufcolumn[bufpos]; } + @Deprecated /** * @deprecated * @see #getEndLine */ - @Deprecated + public int getLine() { return bufline[bufpos]; } @@ -466,7 +466,6 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } + } -/* JavaCC - OriginalChecksum=5f495744c87e77321fd570f94f38cd5d (do not edit this line) */ +/* JavaCC - OriginalChecksum=68955e9beb09d3242a6c5c1ee95dd485 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java index b4da352e69a..892cc587bd7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=0ea2e0bf17ab3b36b824cbe5bb2a103c (do not edit this line) */ +/* JavaCC - OriginalChecksum=d9b4c8c9332fa3054a004615fdb22b89 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java index ee0ae084bb6..9731cd9bb79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.arq ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,21 +99,19 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ - protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - char curChar1 = (char)curChar; - return("Lexical error at line " + // - errorLine + ", column " + // - errorColumn + ". Encountered: " + // - (EOFSeen ? "" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + (int)curChar + "),")) + // - (errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + // - (lexState == 0 ? "" : " (in lexical state " + lexState + ")"); + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); } /** @@ -123,7 +123,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -143,8 +142,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } -/* JavaCC - OriginalChecksum=6f8bb1bf2d7bf314888e29762aa35fa0 (do not edit this line) */ +/* JavaCC - OriginalChecksum=8f945f6081b6c05a3722e27c60c90cda (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java index 1f7cbf83d7b..e23f3eba042 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java @@ -91,6 +91,7 @@ public class Tags public static final String symAssign = ":="; public static final String tagSlice = "slice"; public static final String tagRename = "rename"; + public static final String tagUnfold = "unfold"; public static final String tagOpTriple = Tags.tagTriple; public static final String tagOpQuad = Tags.tagQuad; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java index 032377287eb..608b228004f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java @@ -541,6 +541,25 @@ public void visit(OpExtend opExtend) { finish(opExtend); } + @Override + public void visit(OpUnfold opUnfold) { + start(opUnfold, NoNL); + + start(); + WriterExpr.output(out, opUnfold.getExpr(), sContext); + out.print(" "); + out.print( opUnfold.getVar1().toString() ); + if ( opUnfold.getVar2() != null ) { + out.print(" "); + out.print( opUnfold.getVar2().toString() ); + } + finish(); + + out.println(); + printOp(opUnfold.getSubOp()); + finish(opUnfold); + } + @Override public void visit(OpSlice opSlice) { start(opSlice, NoNL); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java new file mode 100644 index 00000000000..c408eb1ec01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -0,0 +1,86 @@ +/* + * 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 org.apache.jena.sparql.syntax; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class ElementUnfold extends Element +{ + private Expr expr ; + private Var var1 ; + private Var var2 ; + + public ElementUnfold(Expr expr, Var v1, Var v2) + { + this.expr = expr ; + this.var1 = v1 ; + this.var2 = v2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public boolean equalTo(Element el2, NodeIsomorphismMap isoMap) + { + if ( ! ( el2 instanceof ElementUnfold ) ) + return false ; + ElementUnfold f2 = (ElementUnfold)el2 ; + if ( ! this.getVar1().equals(f2.getVar1()) ) + return false ; + if ( this.getVar2() == null && f2.getVar2() != null ) + return false ; + if ( this.getVar2() != null && this.getVar2().equals(f2.getVar2()) ) + return false ; + if ( ! this.getExpr().equals(f2.getExpr()) ) + return false ; + return true ; + } + + @Override + public int hashCode() + { + if ( var2 == null ) + return var1.hashCode()^expr.hashCode(); + else + return var1.hashCode()^var2.hashCode()^expr.hashCode(); + } + + @Override + public void visit(ElementVisitor v) + { +// TODO: extend ElementVisitor +// v.visit(this) ; + } + +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java index 719927fb37e..589a9f57389 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java @@ -60,6 +60,7 @@ import org.apache.jena.sparql.algebra.op.OpTable; import org.apache.jena.sparql.algebra.op.OpTopN; import org.apache.jena.sparql.algebra.op.OpTriple; +import org.apache.jena.sparql.algebra.op.OpUnfold; import org.apache.jena.sparql.algebra.op.OpUnion; import org.apache.jena.sparql.algebra.table.TableN; import org.apache.jena.sparql.core.BasicPattern; @@ -240,6 +241,12 @@ public void visit(OpExtend opExtend) { push(OpExtend.extend(pop(), rewrite(opExtend.getVarExprList()))); } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + push( new OpUnfold(pop(), opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ); + } + @Override public void visit(OpJoin opJoin) { opJoin.getRight().visit(this); diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java index 4b1ff1b0cb7..4f456f8052d 100644 --- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java +++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java @@ -305,6 +305,19 @@ public void visit(final OpExtend opExtend) { addOp(OpExtend.extend(rewriteOp1(opExtend), opExtend.getVarExprList())); } + /** + * rewrites the subop of unfold. + */ + @Override + public void visit(final OpUnfold opUnfold) { + if (LOG.isDebugEnabled()) { + LOG.debug("Starting visiting OpUnfold"); + } + Op subOp = rewriteOp1(opUnfold); + OpUnfold opUnfold2 = new OpUnfold(subOp, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()); + addOp(opUnfold2); + } + /** * rewrites the subop of filter. */ From d8cf1c144d4cd69f8564462da40ced2daf2fe1aa Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:20:31 +0200 Subject: [PATCH 002/323] extends ElementTransform to cover ElementUnfold --- .../sparql/syntax/syntaxtransform/ElementTransform.java | 1 + .../syntaxtransform/ElementTransformCleanGroupsOfOne.java | 1 + .../syntax/syntaxtransform/ElementTransformCopyBase.java | 7 +++++++ .../syntax/syntaxtransform/ElementTransformIdentity.java | 2 ++ 4 files changed, 11 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java index 3ed995fef7b..9d5d0ff0a42 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java @@ -38,6 +38,7 @@ public interface ElementTransform public Element transform(ElementFilter el, Expr expr2); public Element transform(ElementAssign el, Var v, Expr expr2); public Element transform(ElementBind el, Var v, Expr expr2); + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2); public Triple transform(Triple triple); public Quad transform(Quad quad); public Element transform(ElementData el); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java index d6818301c6b..f8bb6251b14 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java @@ -47,6 +47,7 @@ public Element transform(ElementGroup eltGroup, List elts) { ( elt instanceof ElementFilter ) || ( elt instanceof ElementBind ) || ( elt instanceof ElementAssign ) || + ( elt instanceof ElementUnfold ) || ( elt instanceof ElementMinus ) || ( elt instanceof ElementOptional ) ) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java index 474e674c976..efad6c7004e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java @@ -101,6 +101,13 @@ public Element transform(ElementBind el, Var v, Expr expr2) { return new ElementBind(v, expr2) ; } + @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { + if ( !alwaysCopy && el.getVar1() == v1 && el.getVar2() == v2 && el.getExpr() == expr ) + return el ; + return new ElementUnfold(expr, v1, v2) ; + } + @Override public Element transform(ElementData el) { if( alwaysCopy ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java index d59afc35f85..2c206640601 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java @@ -51,6 +51,8 @@ private ElementTransformIdentity() {} @Override public Element transform(ElementBind el, Var v, Expr expr2) { return el ; } @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { return el ; } + @Override public Triple transform(Triple triple) { return triple; } @Override public Quad transform(Quad quad) { return quad; } From 7ee288e213541e5daa9cbd5722a246d5b789cc96 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:51:58 +0200 Subject: [PATCH 003/323] extends ElementVisitor to cover ElementUnfold --- .../jena/sparql/lang/SyntaxVarScope.java | 18 ++++++++++++++++++ .../sparql/serializer/FormatterElement.java | 12 ++++++++++++ .../jena/sparql/syntax/ElementVisitor.java | 1 + .../sparql/syntax/ElementVisitorBase.java | 3 +++ .../jena/sparql/syntax/ElementWalker.java | 8 ++++++++ .../sparql/syntax/PatternVarsVisitor.java | 7 +++++++ .../syntax/RecursiveElementVisitor.java | 10 ++++++++++ .../ApplyElementTransformVisitor.java | 12 ++++++++++++ .../rewriters/BuildElementVisitor.java | 7 +++++++ .../rewriters/ElementRewriter.java | 19 +++++++++++++++++++ .../updatebuilder/QuadIteratorBuilder.java | 7 +++++++ .../jena/arq/querybuilder/WhereValidator.java | 7 +++++++ 12 files changed, 111 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java index 38d7f960afd..392c01d25b9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java @@ -215,6 +215,7 @@ public static class VarScopeChecker extends ElementVisitorBase { @Override public void visit(ElementGroup el) { // BIND scope rules + // UNFOLD scope rules // (and service warning) for ( int i = 0 ; i < el.size() ; i++ ) { @@ -225,6 +226,11 @@ public void visit(ElementGroup el) { check(accScope, (ElementBind)e); } + if ( e instanceof ElementUnfold ) { + Collection accScope = calcScopeAll(el.getElements(), i); + check(accScope, (ElementUnfold)e); + } + if ( e instanceof ElementService ) { Collection accScope = calcScopeAll(el.getElements(), i); check(accScope, (ElementService)e); @@ -253,6 +259,18 @@ private static void check(Collection scope, ElementBind el) { checkExpr(scope, el.getExpr(), var); } + private static void check(Collection scope, ElementUnfold el) { + Var var1 = el.getVar1(); + if ( scope.contains(var1) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var1 + " in " + el, -1, -1); + + Var var2 = el.getVar2(); + if ( var2 != null && scope.contains(var2) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var2 + " in " + el, -1, -1); + + checkExpr(scope, el.getExpr(), var1); + } + private static void check(Collection scope, ElementService el) { if ( ARQ.isStrictMode() && el.getServiceNode().isVariable() ) { Var var = Var.alloc(el.getServiceNode()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java index 0930a7e45af..d0a802423a7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java @@ -236,6 +236,18 @@ public void visit(ElementBind el) { out.print(")"); } + @Override + public void visit(ElementUnfold el) { + out.print("UNFOLD("); + FmtExprSPARQL v = new FmtExprSPARQL(out, context); + v.format(el.getExpr()); + out.print(" AS "); + out.print("?" + el.getVar1().getVarName()); + if ( el.getVar2() != null ) + out.print(", ?" + el.getVar2().getVarName()); + out.print(")"); + } + @Override public void visit(ElementData el) { QuerySerializer.outputDataBlock(out, el.getVars(), el.getRows(), context); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java index c1e7cf12d6c..4ee79c6f979 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java @@ -25,6 +25,7 @@ public interface ElementVisitor public void visit(ElementFilter el) ; public void visit(ElementAssign el) ; public void visit(ElementBind el) ; + public void visit(ElementUnfold el) ; public void visit(ElementData el) ; public void visit(ElementUnion el) ; public void visit(ElementOptional el) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java index 3c1094df515..a68d32fdd63 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java @@ -36,6 +36,9 @@ public void visit(ElementAssign el) { } @Override public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { } + @Override public void visit(ElementData el) { } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java index 4dd4da0982d..4d2a900e9af 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java @@ -102,6 +102,14 @@ public void visit(ElementBind el) after(el) ; } + @Override + public void visit(ElementUnfold el) + { + before(el) ; + proc.visit(el) ; + after(el) ; + } + @Override public void visit(ElementData el) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java index 50818105873..362077bbbcb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java @@ -82,6 +82,13 @@ public void visit(ElementBind el) { acc.add(el.getVar()); } + @Override + public void visit(ElementUnfold el) { + acc.add(el.getVar1()); + if ( el.getVar2() != null ) + acc.add(el.getVar2()); + } + @Override public void visit(ElementData el) { acc.addAll(el.getVars()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/RecursiveElementVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/RecursiveElementVisitor.java index 7f6da15bdfd..77c2f7abcde 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/RecursiveElementVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/RecursiveElementVisitor.java @@ -60,6 +60,9 @@ public void endElement (ElementAssign el) {} public void startElement(ElementBind el) {} public void endElement (ElementBind el) {} + public void startElement(ElementUnfold el) {} + public void endElement (ElementUnfold el) {} + public void startElement(ElementData el) {} public void endElement (ElementData el) {} @@ -143,6 +146,13 @@ public void visit(ElementBind el) endElement(el) ; } + @Override + public void visit(ElementUnfold el) + { + startElement(el) ; + endElement(el) ; + } + @Override public void visit(ElementData el) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java index 1769155ec16..3c5916fd6e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java @@ -99,6 +99,18 @@ public void visit(ElementBind el) { push(el2) ; } + @Override + public void visit(ElementUnfold el) { + Var v1 = el.getVar1() ; + Var v1T = TransformElementLib.applyVar(v1, exprTransform) ; + Var v2 = el.getVar2() ; + Var v2T = (v2 == null) ? null : TransformElementLib.applyVar(v2, exprTransform) ; + Expr expr = el.getExpr() ; + Expr exprT = ExprTransformer.transform(exprTransform, expr) ; + Element el2 = transform.transform(el, exprT, v1T, v2T) ; + push(el2) ; + } + @Override public void visit(ElementData el) { Element el2 = transform.transform(el) ; diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java index 5a1a1185d84..a1d893b2b99 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java @@ -36,6 +36,7 @@ import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; +import org.apache.jena.sparql.syntax.ElementUnfold; import org.apache.jena.sparql.syntax.ElementUnion; import org.apache.jena.sparql.syntax.ElementVisitor; @@ -85,6 +86,12 @@ public void visit(ElementBind el) { result = el; } + @Override + public void visit(ElementUnfold el) { + // no change + result = el; + } + @Override public void visit(ElementData el) { // no change diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java index c3528bbce49..ecb0a9f4e88 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.Map; +import java.util.Objects; import org.apache.jena.arq.querybuilder.AbstractQueryBuilder; import org.apache.jena.graph.Node; @@ -43,6 +44,7 @@ import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; +import org.apache.jena.sparql.syntax.ElementUnfold; import org.apache.jena.sparql.syntax.ElementUnion; import org.apache.jena.sparql.syntax.ElementVisitor; @@ -117,6 +119,23 @@ public void visit(ElementBind el) { } } + @Override + public void visit(ElementUnfold el) { +// TODO: double check this method; I copied and adapted the method of +// ElementBind (see above) but I am not entirely sure it is correct + Node n1 = changeNode(el.getVar1()); + Node n2 = changeNode(el.getVar2()); + if ( Objects.equals(n1, el.getVar1()) && Objects.equals(n2, el.getVar2()) ) { + ExprRewriter exprRewriter = new ExprRewriter(values); + el.getExpr().visit(exprRewriter); + push( new ElementUnfold(exprRewriter.getResult(), el.getVar1(), el.getVar2()) ); + } else { + // push( new ElementBind( el.getVar(), NodeValue.makeNode( n )) ); + // no op + push(new ElementTriplesBlock()); + } + } + @Override public void visit(ElementData el) { ElementData retval = new ElementData(); diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java index 54247bb1486..2c8076a1b05 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java @@ -42,6 +42,7 @@ import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; +import org.apache.jena.sparql.syntax.ElementUnfold; import org.apache.jena.sparql.syntax.ElementUnion; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.util.iterator.ExtendedIterator; @@ -108,6 +109,12 @@ public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { + throw new QueryParseException("unfold not permitted in data quad", -1, -1); + + } + @Override public void visit(ElementData el) { throw new QueryParseException("element data not permitted in data quad", -1, -1); diff --git a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java index 38d6e39841e..2640c82d77c 100644 --- a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java +++ b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java @@ -35,6 +35,7 @@ import org.apache.jena.sparql.syntax.ElementService; import org.apache.jena.sparql.syntax.ElementSubQuery; import org.apache.jena.sparql.syntax.ElementTriplesBlock; +import org.apache.jena.sparql.syntax.ElementUnfold; import org.apache.jena.sparql.syntax.ElementUnion; import org.apache.jena.sparql.syntax.ElementVisitor; import org.apache.jena.sparql.util.NodeIsomorphismMap; @@ -107,6 +108,12 @@ public void visit(ElementBind el) { return; } + @Override + public void visit(ElementUnfold el) { + checkMatching(el); + return; + } + @Override public void visit(ElementData el) { checkMatching(el); From d5fadf88045d81acf3d7ba43eeb0c2995c223cfd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Jul 2022 21:01:45 +0200 Subject: [PATCH 004/323] initial functional version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 89 +++++++++++++++++-- .../jena/sparql/engine/main/OpExecutor.java | 2 +- .../sparql/engine/ref/EvaluatorSimple.java | 2 +- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d052da6e075..0ecadc1484f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -18,27 +18,104 @@ package org.apache.jena.sparql.engine.iterator; +import java.util.Iterator; + +import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.NodeFactoryExtra; -public class QueryIterUnfold extends QueryIteratorWrapper +public class QueryIterUnfold extends QueryIterRepeatApply { + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; - public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { - super(qIter) ; + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, ExecutionContext execCxt) { + super(qIter, execCxt) ; this.expr = expr ; this.var1 = var1 ; this.var2 = var2 ; } @Override - protected Binding moveToNextBinding() { -System.out.println("QueryIterUnfold"); - return super.moveToNextBinding() ; + protected QueryIterator nextStage(Binding inputBinding) { + NodeValue nv = expr.eval( inputBinding, getExecContext() ); + Node n = nv.asNode(); + if ( n.isLiteral() ) { + String dtURI = n.getLiteralDatatypeURI(); + if ( datatypeUriUntypedList.equals(dtURI) ) + return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + } + + return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + } + + protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseUntypedList(listAsValue); + return new QueryIteratorBase() { + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("a QueryIterator in QueryIterUnfold"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + }; + } + + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + final String[] listAsArray = listAsValue.split(","); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + return new Iterator<>() { + int i = 0; + + @Override + public boolean hasNext() { + return i < listAsArray.length; + } + + @Override + public Node next() { + String listElmt = listAsArray[i].strip(); + i++; + if ( pmap != null ) + return NodeFactoryExtra.parseNode(listElmt, pmap); + else + return NodeFactoryExtra.parseNode(listElmt); + } + }; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index ad6a068d4d2..4e2d2af8e55 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -448,7 +448,7 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; return qIter ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index 963755f7c46..e0e803c82e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -270,7 +270,7 @@ public Table extend(Table table, VarExprList exprs) public Table unfold(Table table, Expr expr, Var var1, Var var2) { QueryIterator qIter = table.iterator(getExecContext()) ; - qIter = new QueryIterUnfold(qIter, expr, var1, var2) ; + qIter = new QueryIterUnfold(qIter, expr, var1, var2, getExecContext()) ; return new TableN(qIter) ; } From 5c4ee991df148c6f598461cde1250229538753e4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 6 Jul 2022 21:05:28 +0200 Subject: [PATCH 005/323] enable visiting of ElementUnfold --- .../main/java/org/apache/jena/sparql/syntax/ElementUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java index c408eb1ec01..0ad02807627 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -79,8 +79,7 @@ public int hashCode() @Override public void visit(ElementVisitor v) { -// TODO: extend ElementVisitor -// v.visit(this) ; + v.visit(this) ; } } From 65e7f70a5be5d86432eee09a66ee7a7293bce9b2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 12:26:09 +0200 Subject: [PATCH 006/323] fully working version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 220 +++++++++++++++--- 1 file changed, 187 insertions(+), 33 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 0ecadc1484f..1f512244564 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,9 +19,14 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -36,6 +41,14 @@ public class QueryIterUnfold extends QueryIterRepeatApply { public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); protected final Expr expr ; protected final Var var1 ; @@ -56,6 +69,12 @@ protected QueryIterator nextStage(Binding inputBinding) { String dtURI = n.getLiteralDatatypeURI(); if ( datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedList.equals(dtURI) ) + return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriUntypedMap.equals(dtURI) ) + return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedMap.equals(dtURI) ) + return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); @@ -63,59 +82,194 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIteratorBase() { - @Override - public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("a QueryIterator in QueryIterUnfold"); - } + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } - @Override - protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); - } + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + + return parseList(listAsValue); + } + + protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseTypedList(listAsValue); + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } + + protected Iterator parseTypedList(String listAsValue) { + listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); + return parseList(listAsValue); + } + + protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + + protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + protected Iterator parseList(String listAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = extractListElements(listAsValue); + return new Iterator<>() { @Override - protected boolean hasNextBinding() { + public boolean hasNext() { return itListElmts.hasNext(); } @Override - protected void requestCancel() { } // nothing to do really - - @Override - protected void closeIterator() { } // nothing to do really + public Node next() { + final String listElmt = itListElmts.next(); + final Node n; + if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + else if ( pmap != null ) + n = NodeFactoryExtra.parseNode(listElmt, pmap); + else + n = NodeFactoryExtra.parseNode(listElmt); + return n; + } }; } - protected Iterator parseUntypedList(String listAsValue) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + protected Iterator extractListElements(String listAsValue) { + listAsValue = listAsValue.strip(); + + if ( listAsValue.isEmpty() ) { + return new Iterator() { + @Override public boolean hasNext() { return false; } + @Override public String next() { throw new NoSuchElementException(); } + }; + } // TODO: this method needs to be improved and, in particular, made more robust in terms // of parsing the given lexical form of the literal; for instance, simply splitting // by commas is an issue if the list contains literals with commas inside -- can we // use existing code for parsing Turtle here? - final String[] listAsArray = listAsValue.split(","); - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - return new Iterator<>() { - int i = 0; + return new ListElementExtractor(listAsValue); + } - @Override - public boolean hasNext() { - return i < listAsArray.length; + + protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected final Binding inputBinding; + protected final Iterator itListElmts; + + public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + this.inputBinding = inputBinding; + this.itListElmts = itListElmts; + } + + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorker"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected static class ListElementExtractor implements Iterator { + protected final String listAsString; + protected int cursor = 0; + protected String nextElmt = null; + + public ListElementExtractor( final String listAsString ) { + this.listAsString = listAsString.strip(); + } + + @Override + public boolean hasNext() { + if ( nextElmt != null ) + return true; + + consumeWhiteSpace(); + if ( cursor >= listAsString.length() ) { + return false; } - @Override - public Node next() { - String listElmt = listAsArray[i].strip(); - i++; - if ( pmap != null ) - return NodeFactoryExtra.parseNode(listElmt, pmap); - else - return NodeFactoryExtra.parseNode(listElmt); + final int nextElmtBegin = cursor; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); } - }; + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + nextElmt = listAsString.substring(nextElmtBegin, cursor); + cursor++; // move cursor to after comma + return true; + } + + @Override + public String next() { + if ( ! hasNext() ) + throw new NoSuchElementException(); + + String r = nextElmt; + nextElmt = null; + return r; + } + + protected void consumeWhiteSpace() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + cursor++; + } + + protected void advanceToEndOfSubList() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToEndOfSubMap() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToNextCommaOrEnd() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + cursor++; + } } } From 32349cb53289e0ca11765347ff97b41349185ce0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:10:46 +0200 Subject: [PATCH 007/323] bug fix: if evaluating the expression of an UNFOLD operator fails, create no assignment --- .../sparql/engine/iterator/QueryIterUnfold.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 1f512244564..e3f14076753 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -34,6 +34,7 @@ import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.util.NodeFactoryExtra; @@ -63,7 +64,18 @@ public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, Execu @Override protected QueryIterator nextStage(Binding inputBinding) { - NodeValue nv = expr.eval( inputBinding, getExecContext() ); + final NodeValue nv; + try { + nv = expr.eval( inputBinding, getExecContext() ); + } + catch ( final ExprEvalException ex ) { + // If the expression failed to evaluate, we create no + // no assignment (exactly as in the case of BIND, see + // the 'accept' method in 'QueryIterAssign') + + return QueryIterSingleton.create( inputBinding, getExecContext() ); + } + Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); From 47e59845e5fd4920601cf46fea1885c294ab07ad Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:14:50 +0200 Subject: [PATCH 008/323] bug fix: if evaluating the expression of an UNFOLD operator does not result in a relevant literal, create no assignment --- .../apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e3f14076753..bb0a88067c7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,7 +19,6 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; -import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -89,7 +88,7 @@ protected QueryIterator nextStage(Binding inputBinding) { return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } - return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + return QueryIterSingleton.create( inputBinding, getExecContext() ); } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { From a5632e0aa3476a18252c763946a141c04743a148 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 19:09:47 +0200 Subject: [PATCH 009/323] adds support for UNFOLDing of untyped maps --- .../engine/iterator/QueryIterUnfold.java | 251 ++++++++++++++---- 1 file changed, 204 insertions(+), 47 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index bb0a88067c7..571df3b3191 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -93,7 +94,7 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseUntypedList(String listAsValue) { @@ -105,7 +106,7 @@ protected Iterator parseUntypedList(String listAsValue) { protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseTypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseTypedList(String listAsValue) { @@ -114,7 +115,15 @@ protected Iterator parseTypedList(String listAsValue) { } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + Iterator> itMapElmts = parseUntypedMap(mapAsValue); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); + } + + protected Iterator> parseUntypedMap(String mapAsValue) { + if ( mapAsValue.startsWith("{") ) + mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); + + return parseMap(mapAsValue); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { @@ -138,9 +147,9 @@ public Node next() { n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); @@ -169,46 +178,136 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } + protected Iterator> parseMap(String mapAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator> itMapElmts = extractMapElements(mapAsValue); + return new Iterator<>() { + @Override + public boolean hasNext() { + return itMapElmts.hasNext(); + } + + @Override + public Map.Entry next() { + final Map.Entry mapElmt = itMapElmts.next(); + final String keyAsString = mapElmt.getKey(); + final String valueAsString = mapElmt.getValue(); + + final Node keyAsNode; + if ( pmap != null ) + keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); + else + keyAsNode = NodeFactoryExtra.parseNode(keyAsString); + + final Node valueAsNode; + if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + else if ( pmap != null ) + valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); + else + valueAsNode = NodeFactoryExtra.parseNode(valueAsString); + + return new Map.Entry<>() { + @Override public Node getKey() { return keyAsNode; } + @Override public Node getValue() { return valueAsNode; } + @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } + }; + } + }; + } + + protected Iterator> extractMapElements(String mapAsValue) { + mapAsValue = mapAsValue.strip(); + + if ( mapAsValue.isEmpty() ) { + return new Iterator>() { + @Override public boolean hasNext() { return false; } + @Override public Map.Entry next() { throw new NoSuchElementException(); } + }; + } + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + return new MapElementExtractor(mapAsValue); + } + - protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; - protected final Iterator itListElmts; + protected final Iterator itElmts; - public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.inputBinding = inputBinding; - this.itListElmts = itListElmts; + this.itElmts = itElmts; + } + + @Override + protected boolean hasNextBinding() { return itElmts.hasNext(); } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); } @Override public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("QueryIterUnfoldWorker"); + out.write("QueryIterUnfoldWorkerForLists"); } @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + return BindingFactory.binding( inputBinding, var1, itElmts.next() ); } + } - @Override - protected boolean hasNextBinding() { - return itListElmts.hasNext(); + + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); } @Override - protected void requestCancel() { } // nothing to do really + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorkerForMaps"); + } @Override - protected void closeIterator() { } // nothing to do really + protected Binding moveToNextBinding() { + final Map.Entry elmt = itElmts.next(); + if ( var2 == null ) + return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); + else + return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + } } - protected static class ListElementExtractor implements Iterator { - protected final String listAsString; + protected static abstract class ElementExtractorBase implements Iterator { + protected final String str; protected int cursor = 0; - protected String nextElmt = null; + private T nextElmt = null; - public ListElementExtractor( final String listAsString ) { - this.listAsString = listAsString.strip(); + protected ElementExtractorBase( final String str ) { + this.str = str.strip(); } @Override @@ -216,47 +315,35 @@ public boolean hasNext() { if ( nextElmt != null ) return true; - consumeWhiteSpace(); - if ( cursor >= listAsString.length() ) { - return false; - } - - final int nextElmtBegin = cursor; - if ( listAsString.charAt(cursor) == '[' ) { - advanceToEndOfSubList(); - } - else if ( listAsString.charAt(cursor) == '{' ) { - advanceToEndOfSubMap(); - } - advanceToNextCommaOrEnd(); - nextElmt = listAsString.substring(nextElmtBegin, cursor); - cursor++; // move cursor to after comma - return true; + nextElmt = produceNext(); + return ( nextElmt != null ); } @Override - public String next() { + public T next() { if ( ! hasNext() ) throw new NoSuchElementException(); - String r = nextElmt; + final T r = nextElmt; nextElmt = null; return r; } + protected abstract T produceNext(); + protected void consumeWhiteSpace() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + while ( cursor < str.length() && str.charAt(cursor) == ' ' ) cursor++; } protected void advanceToEndOfSubList() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + while ( cursor < str.length() && str.charAt(cursor) != ']' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -264,13 +351,13 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToEndOfSubMap() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + while ( cursor < str.length() && str.charAt(cursor) != '}' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -278,7 +365,77 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToNextCommaOrEnd() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + while ( cursor < str.length() && str.charAt(cursor) != ',' ) + cursor++; + } + } + + + protected static class ListElementExtractor extends ElementExtractorBase { + public ListElementExtractor( final String listAsString ) { + super(listAsString); + } + + @Override + public String produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextElmtBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextElmt = str.substring(nextElmtBegin, cursor).strip(); + cursor++; // move cursor to after comma + return nextElmt; + } + } + + + protected static class MapElementExtractor extends ElementExtractorBase> { + public MapElementExtractor( final String mapAsString ) { + super(mapAsString); + } + + @Override + public Map.Entry produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextKeyBegin = cursor; + advanceToNextColon(); + final String nextKey = str.substring(nextKeyBegin, cursor).strip(); + + cursor++; // move cursor to after colon + consumeWhiteSpace(); + final int nextValueBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextValue = str.substring(nextValueBegin, cursor).strip(); + cursor++; // move cursor to after comma + + return new Map.Entry<>() { + @Override public String getKey() { return nextKey; } + @Override public String getValue() { return nextValue; } + @Override public String setValue(String v) { throw new UnsupportedOperationException(); } + }; + } + + protected void advanceToNextColon() { + while ( cursor < str.length() && str.charAt(cursor) != ':' ) cursor++; } } From 9dd373aad35cca21d907ee4a1e1c8202df1326b8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 14:28:32 +0200 Subject: [PATCH 010/323] adds FOLD --- jena-arq/Grammar/arq.jj | 13 + jena-arq/Grammar/main.jj | 16 + .../jena/sparql/expr/aggregate/AggFold.java | 284 ++++ .../sparql/expr/aggregate/AggregatorBase.java | 2 + .../expr/aggregate/AggregatorFactory.java | 4 + .../jena/sparql/lang/arq/ARQParser.java | 382 +++-- .../sparql/lang/arq/ARQParserConstants.java | 322 ++-- .../lang/arq/ARQParserTokenManager.java | 1392 +++++++++-------- 8 files changed, 1411 insertions(+), 1004 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 30d6f2ea667..8ee34eed1ef 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1618,6 +1618,17 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; { agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; } | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { String typeIRI1 = null ; + String typeIRI2 = null ; + Expr orderByExpr = null ; + Var orderByVar = null ; + int orderByDirection = Query.ORDER_DEFAULT ; } + + expr = Expression() ( typeIRI1 = iri() )? + ( expr2 = Expression() ( typeIRI2 = iri() )? )? + + { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } | t = { String iri ; } iri = iri() @@ -1817,6 +1828,8 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +| < FOLD: "fold" > +| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 005257c1126..57cd62d17b3 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -2269,6 +2269,18 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { String typeIRI1 = null ; + String typeIRI2 = null ; + Expr orderByExpr = null ; + Var orderByVar = null ; + int orderByDirection = Query.ORDER_DEFAULT ; } + + expr = Expression() ( typeIRI1 = iri() )? + ( expr2 = Expression() ( typeIRI2 = iri() )? )? + + { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } + /* Explicit syntax (aggregate even if not registered) */ | t = { String iri ; } @@ -2561,6 +2573,10 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +#ifdef ARQ +| < FOLD: "fold" > +| < TYPE: "type" > +#endif | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java new file mode 100644 index 00000000000..20d1eb03965 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -0,0 +1,284 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprLib; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.ExprNode; +import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprVisitor; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueString; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.graph.NodeTransform; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFold extends AggregatorBase +{ + protected final Expr expr1; // While the values of these member variables + protected final Expr expr2; // can also be extracted from the ExprList (see + protected final String typeIRI1; // createExprList below), keeping these copies + protected final String typeIRI2; // here makes it easier to access these values. + + public AggFold( final Expr expr1 ) { + this(expr1, null, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1 ) { + this(expr1, typeIRI1, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { + this(expr1, typeIRI1, expr2, null); + } + + public AggFold( final Expr expr1, final Expr expr2 ) { + this(expr1, null, expr2, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { + super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + + this.expr1 = expr1; + this.expr2 = expr2; + this.typeIRI1 = typeIRI1; + this.typeIRI2 = typeIRI2; + } + + protected static ExprList createExprList( final Expr expr1, final String typeIRI1, + final Expr expr2, final String typeIRI2 ) { + final ExprList l = new ExprList(expr1); + + if ( typeIRI1 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI1) ); + } + + if ( expr2 != null ) { + l.add(expr2); + } + + if ( typeIRI2 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI2) ); + } + + return l; + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() < 1 || exprs.size() > 6 ) + throw new IllegalArgumentException(); + + final Iterator it = exprs.iterator(); + final Expr _expr1 = it.next(); + + final Expr _expr2; + final String _typeIRI1; + final String _typeIRI2; + + Expr lookAhead = it.hasNext() ? it.next() : null; + // _typeIRI1 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI1 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI1 = null; + } + + // _expr2 + if ( lookAhead != null ) { + _expr2 = lookAhead; + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _expr2 = null; + } + + // _typeIRI2 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI2 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI2 = null; + } + + if ( lookAhead != null ) { + throw new IllegalArgumentException(); + } + + return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFold ) ) + return false; + final AggFold fold = (AggFold) other; + return exprList.equals(fold.exprList, bySyntax); + } + + @Override + public Accumulator createAccumulator() { + if ( expr2 == null ) + return new ListAccumulator(); + else + return new MapAccumulator(); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + int hc = HC_AggFold; + for ( final Expr e : getExprList() ) { + hc ^= e.hashCode(); + } + return hc; + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + ExprUtils.fmtSPARQL(out, expr1, sCxt); + + if ( typeIRI1 != null ) { + out.append( " TYPE " + typeIRI1 ); + } + + if ( expr2 != null ) { + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); + } + + if ( typeIRI2 != null ) { + out.append( " TYPE " + typeIRI2 ); + } + + out.append(")"); + return out.asString(); + } + + + protected static Expr dummyExprForType = new ExprNode() { + @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } + + @Override public int hashCode() { return -88888; } + + @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + + @Override public Expr copySubstitute(Binding binding) { return this; } + + @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + + @Override public NodeValue eval(Binding binding, FunctionEnv env) { + throw new InternalErrorException("Attempt to eval DummyExprForType"); + } + }; + + protected class ListAccumulator implements Accumulator { + final protected List list = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nv != null ) + list.add( nv.asNode() ); + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + return NodeValue.makeNode(n); + } + } + + protected class MapAccumulator implements Accumulator { + final protected List keys = new ArrayList<>(); + final protected List values = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( key != null && value != null ) { + keys.add( key.asNode() ); + values.add( value.asNode() ); + } + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! keys.isEmpty() ) { + final Iterator it = keys.iterator(); + final Iterator it2 = values.iterator(); + final Node firstKey = it.next(); + final Node firstValue = it2.next(); + final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); + final String firstValueAsString = NodeFmtLib.strTTL(firstValue); + sb.append(firstKeyAsString); + sb.append(" : "); + sb.append(firstValueAsString); + while ( it.hasNext() ) { + final Node nextKey = it.next(); + final Node nextValue = it2.next(); + final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); + final String nextValueAsString = NodeFmtLib.strTTL(nextValue); + sb.append(", "); + sb.append(nextKeyAsString); + sb.append(" : "); + sb.append(nextValueAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + return NodeValue.makeNode(n); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index 247948dd4fc..4b496f5495d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -186,4 +186,6 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; + protected static final int HC_AggFold = 0x186 ; + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index ee99bf43e8c..a7a81aa8729 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,6 +71,10 @@ public static Aggregator createAggNull() { return new AggNull() ; } + public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { + return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + } + public static Aggregator createCustom(String iri, Args a) { return createCustom(iri, a.distinct, ExprList.copy(a)) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 1c1a2038a4e..d41d73698d1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -190,6 +190,7 @@ final public void SelectClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -296,6 +297,7 @@ final public void SelectClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -460,6 +462,7 @@ final public void SelectClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -895,6 +898,7 @@ final public void GroupClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -987,6 +991,7 @@ final public void GroupCondition() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1112,6 +1117,7 @@ final public void HavingClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1223,6 +1229,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1340,6 +1347,7 @@ final public void OrderCondition() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1424,6 +1432,7 @@ final public void OrderCondition() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -2908,6 +2917,7 @@ final public Expr Constraint() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4642,6 +4652,7 @@ final public Expr UnaryExpression() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4756,6 +4767,7 @@ final public Expr PrimaryExpression() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4950,6 +4962,7 @@ final public Expr BuiltInCall() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: expr = Aggregate(); @@ -5583,6 +5596,7 @@ final public Expr Aggregate() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -5935,6 +5949,45 @@ final public Expr Aggregate() throws ParseException { jj_consume_token(RPAREN); agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; break; + case FOLD: + t = jj_consume_token(FOLD); + String typeIRI1 = null ; + String typeIRI2 = null ; + Expr orderByExpr = null ; + Var orderByVar = null ; + int orderByDirection = Query.ORDER_DEFAULT ; + jj_consume_token(LPAREN); + expr = Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TYPE: + jj_consume_token(TYPE); + typeIRI1 = iri(); + break; + default: + jj_la1[182] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + expr2 = Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TYPE: + jj_consume_token(TYPE); + typeIRI2 = iri(); + break; + default: + jj_la1[183] = jj_gen; + ; + } + break; + default: + jj_la1[184] = jj_gen; + ; + } + jj_consume_token(RPAREN); + agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; + break; case AGG: t = jj_consume_token(AGG); String iri ; @@ -5944,7 +5997,7 @@ final public Expr Aggregate() throws ParseException { agg = AggregatorFactory.createCustom(iri, a) ; break; default: - jj_la1[182] = jj_gen; + jj_la1[185] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5967,7 +6020,7 @@ final public Expr iriOrFunction() throws ParseException { a = ArgList(); break; default: - jj_la1[183] = jj_gen; + jj_la1[186] = jj_gen; ; } if ( a == null ) @@ -6000,13 +6053,13 @@ final public Node RDFLiteral() throws ParseException { uri = iri(); break; default: - jj_la1[184] = jj_gen; + jj_la1[187] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[185] = jj_gen; + jj_la1[188] = jj_gen; ; } {if (true) return createLiteral(lex, lang, uri) ;} @@ -6032,7 +6085,7 @@ final public Node NumericLiteral() throws ParseException { n = NumericLiteralNegative(); break; default: - jj_la1[186] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6056,7 +6109,7 @@ final public Node NumericLiteralUnsigned() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[187] = jj_gen; + jj_la1[190] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6079,7 +6132,7 @@ final public Node NumericLiteralPositive() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[188] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6102,7 +6155,7 @@ final public Node NumericLiteralNegative() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[189] = jj_gen; + jj_la1[192] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6120,7 +6173,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE ;} break; default: - jj_la1[190] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6147,7 +6200,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[191] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6170,7 +6223,7 @@ final public String iri() throws ParseException { {if (true) return iri ;} break; default: - jj_la1[192] = jj_gen; + jj_la1[195] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6189,7 +6242,7 @@ final public String PrefixedName() throws ParseException { {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; default: - jj_la1[193] = jj_gen; + jj_la1[196] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6208,7 +6261,7 @@ final public Node BlankNode() throws ParseException { {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; default: - jj_la1[194] = jj_gen; + jj_la1[197] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6314,7 +6367,7 @@ private boolean jj_3R_101() { return false; } - private boolean jj_3R_156() { + private boolean jj_3R_157() { if (jj_scan_token(LPAREN)) return true; return false; } @@ -6342,33 +6395,33 @@ private boolean jj_3_2() { if (jj_3R_44()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(146)) { - jj_scanpos = xsp; - if (jj_scan_token(147)) { - jj_scanpos = xsp; - if (jj_scan_token(154)) { + if (jj_scan_token(148)) { jj_scanpos = xsp; if (jj_scan_token(149)) { jj_scanpos = xsp; - if (jj_scan_token(150)) { + if (jj_scan_token(156)) { jj_scanpos = xsp; if (jj_scan_token(151)) { jj_scanpos = xsp; - if (jj_scan_token(148)) { + if (jj_scan_token(152)) { jj_scanpos = xsp; - if (jj_scan_token(159)) { + if (jj_scan_token(153)) { jj_scanpos = xsp; - if (jj_scan_token(142)) { + if (jj_scan_token(150)) { jj_scanpos = xsp; - if (jj_scan_token(141)) { + if (jj_scan_token(161)) { jj_scanpos = xsp; - if (jj_scan_token(160)) { + if (jj_scan_token(144)) { jj_scanpos = xsp; if (jj_scan_token(143)) { jj_scanpos = xsp; - if (jj_scan_token(144)) { + if (jj_scan_token(162)) { jj_scanpos = xsp; - if (jj_scan_token(145)) return true; + if (jj_scan_token(145)) { + jj_scanpos = xsp; + if (jj_scan_token(146)) { + jj_scanpos = xsp; + if (jj_scan_token(147)) return true; } } } @@ -6415,7 +6468,7 @@ private boolean jj_3R_93() { return false; } - private boolean jj_3R_157() { + private boolean jj_3R_158() { if (jj_scan_token(LBRACKET)) return true; return false; } @@ -6432,8 +6485,8 @@ private boolean jj_3R_91() { return false; } - private boolean jj_3R_150() { - if (jj_3R_157()) return true; + private boolean jj_3R_151() { + if (jj_3R_158()) return true; return false; } @@ -6452,15 +6505,15 @@ private boolean jj_3R_89() { private boolean jj_3R_125() { Token xsp; xsp = jj_scanpos; - if (jj_3R_149()) { + if (jj_3R_150()) { jj_scanpos = xsp; - if (jj_3R_150()) return true; + if (jj_3R_151()) return true; } return false; } - private boolean jj_3R_149() { - if (jj_3R_156()) return true; + private boolean jj_3R_150() { + if (jj_3R_157()) return true; return false; } @@ -6930,222 +6983,227 @@ private boolean jj_3R_43() { return false; } - private boolean jj_3R_152() { + private boolean jj_3R_153() { if (jj_scan_token(IRIref)) return true; return false; } - private boolean jj_3R_180() { + private boolean jj_3R_181() { if (jj_scan_token(ANON)) return true; return false; } - private boolean jj_3R_170() { + private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_179()) { + if (jj_3R_180()) { jj_scanpos = xsp; - if (jj_3R_180()) return true; + if (jj_3R_181()) return true; } return false; } - private boolean jj_3R_179() { + private boolean jj_3R_180() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; } - private boolean jj_3R_172() { + private boolean jj_3R_173() { if (jj_scan_token(PNAME_NS)) return true; return false; } - private boolean jj_3R_171() { + private boolean jj_3R_172() { if (jj_scan_token(PNAME_LN)) return true; return false; } - private boolean jj_3R_166() { + private boolean jj_3R_167() { Token xsp; xsp = jj_scanpos; - if (jj_3R_171()) { + if (jj_3R_172()) { jj_scanpos = xsp; - if (jj_3R_172()) return true; + if (jj_3R_173()) return true; } return false; } - private boolean jj_3R_159() { - if (jj_3R_166()) return true; + private boolean jj_3R_160() { + if (jj_3R_167()) return true; return false; } - private boolean jj_3R_151() { + private boolean jj_3R_152() { Token xsp; xsp = jj_scanpos; - if (jj_3R_158()) { + if (jj_3R_159()) { jj_scanpos = xsp; - if (jj_3R_159()) return true; + if (jj_3R_160()) return true; } return false; } - private boolean jj_3R_158() { - if (jj_3R_152()) return true; - return false; - } - - private boolean jj_3R_143() { - if (jj_scan_token(LBRACE)) return true; + private boolean jj_3R_159() { + if (jj_3R_153()) return true; return false; } - private boolean jj_3_3() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_45()) return true; + private boolean jj_3R_185() { + if (jj_scan_token(STRING_LITERAL_LONG2)) return true; return false; } private boolean jj_3R_184() { - if (jj_scan_token(STRING_LITERAL_LONG2)) return true; + if (jj_scan_token(STRING_LITERAL_LONG1)) return true; return false; } private boolean jj_3R_183() { - if (jj_scan_token(STRING_LITERAL_LONG1)) return true; + if (jj_scan_token(STRING_LITERAL2)) return true; return false; } private boolean jj_3R_182() { - if (jj_scan_token(STRING_LITERAL2)) return true; + if (jj_scan_token(STRING_LITERAL1)) return true; return false; } - private boolean jj_3R_181() { - if (jj_scan_token(STRING_LITERAL1)) return true; + private boolean jj_3R_144() { + if (jj_scan_token(LBRACE)) return true; return false; } - private boolean jj_3R_173() { + private boolean jj_3R_174() { Token xsp; xsp = jj_scanpos; - if (jj_3R_181()) { - jj_scanpos = xsp; if (jj_3R_182()) { jj_scanpos = xsp; if (jj_3R_183()) { jj_scanpos = xsp; - if (jj_3R_184()) return true; + if (jj_3R_184()) { + jj_scanpos = xsp; + if (jj_3R_185()) return true; } } } return false; } - private boolean jj_3R_178() { + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_179() { if (jj_scan_token(FALSE)) return true; return false; } - private boolean jj_3R_169() { + private boolean jj_3R_170() { Token xsp; xsp = jj_scanpos; - if (jj_3R_177()) { + if (jj_3R_178()) { jj_scanpos = xsp; - if (jj_3R_178()) return true; + if (jj_3R_179()) return true; } return false; } - private boolean jj_3R_177() { + private boolean jj_3R_178() { if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_196() { + private boolean jj_3R_197() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_195() { + private boolean jj_3R_196() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_194() { + private boolean jj_3R_195() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } - private boolean jj_3R_187() { + private boolean jj_3R_188() { Token xsp; xsp = jj_scanpos; - if (jj_3R_194()) { - jj_scanpos = xsp; if (jj_3R_195()) { jj_scanpos = xsp; - if (jj_3R_196()) return true; + if (jj_3R_196()) { + jj_scanpos = xsp; + if (jj_3R_197()) return true; } } return false; } - private boolean jj_3R_193() { + private boolean jj_3R_194() { if (jj_scan_token(DOUBLE_POSITIVE)) return true; return false; } - private boolean jj_3R_192() { + private boolean jj_3R_193() { if (jj_scan_token(DECIMAL_POSITIVE)) return true; return false; } - private boolean jj_3R_191() { + private boolean jj_3R_192() { if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } - private boolean jj_3R_186() { + private boolean jj_3R_187() { Token xsp; xsp = jj_scanpos; - if (jj_3R_191()) { - jj_scanpos = xsp; if (jj_3R_192()) { jj_scanpos = xsp; - if (jj_3R_193()) return true; + if (jj_3R_193()) { + jj_scanpos = xsp; + if (jj_3R_194()) return true; } } return false; } - private boolean jj_3R_190() { + private boolean jj_3R_191() { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_189() { + private boolean jj_3R_190() { if (jj_scan_token(DECIMAL)) return true; return false; } - private boolean jj_3R_188() { + private boolean jj_3R_189() { if (jj_scan_token(INTEGER)) return true; return false; } - private boolean jj_3R_185() { + private boolean jj_3R_186() { Token xsp; xsp = jj_scanpos; - if (jj_3R_188()) { - jj_scanpos = xsp; if (jj_3R_189()) { jj_scanpos = xsp; - if (jj_3R_190()) return true; + if (jj_3R_190()) { + jj_scanpos = xsp; + if (jj_3R_191()) return true; } } return false; } + private boolean jj_3R_177() { + if (jj_3R_188()) return true; + return false; + } + private boolean jj_3R_176() { if (jj_3R_187()) return true; return false; @@ -7156,26 +7214,21 @@ private boolean jj_3R_175() { return false; } - private boolean jj_3R_174() { - if (jj_3R_185()) return true; - return false; - } - - private boolean jj_3R_168() { + private boolean jj_3R_169() { Token xsp; xsp = jj_scanpos; - if (jj_3R_174()) { - jj_scanpos = xsp; if (jj_3R_175()) { jj_scanpos = xsp; - if (jj_3R_176()) return true; + if (jj_3R_176()) { + jj_scanpos = xsp; + if (jj_3R_177()) return true; } } return false; } - private boolean jj_3R_167() { - if (jj_3R_173()) return true; + private boolean jj_3R_168() { + if (jj_3R_174()) return true; return false; } @@ -7184,11 +7237,16 @@ private boolean jj_3_1() { return false; } - private boolean jj_3R_165() { + private boolean jj_3R_166() { if (jj_scan_token(NIL)) return true; return false; } + private boolean jj_3R_165() { + if (jj_3R_171()) return true; + return false; + } + private boolean jj_3R_164() { if (jj_3R_170()) return true; return false; @@ -7204,21 +7262,14 @@ private boolean jj_3R_162() { return false; } - private boolean jj_3R_161() { - if (jj_3R_167()) return true; - return false; - } - private boolean jj_3R_112() { if (jj_3R_125()) return true; return false; } - private boolean jj_3R_155() { + private boolean jj_3R_156() { Token xsp; xsp = jj_scanpos; - if (jj_3R_160()) { - jj_scanpos = xsp; if (jj_3R_161()) { jj_scanpos = xsp; if (jj_3R_162()) { @@ -7227,7 +7278,9 @@ private boolean jj_3R_155() { jj_scanpos = xsp; if (jj_3R_164()) { jj_scanpos = xsp; - if (jj_3R_165()) return true; + if (jj_3R_165()) { + jj_scanpos = xsp; + if (jj_3R_166()) return true; } } } @@ -7236,8 +7289,14 @@ private boolean jj_3R_155() { return false; } - private boolean jj_3R_160() { - if (jj_3R_151()) return true; + private boolean jj_3R_161() { + if (jj_3R_152()) return true; + return false; + } + + private boolean jj_3R_142() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_152()) return true; return false; } @@ -7256,7 +7315,7 @@ private boolean jj_3R_111() { return false; } - private boolean jj_3R_154() { + private boolean jj_3R_155() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7273,8 +7332,8 @@ private boolean jj_3_4() { } private boolean jj_3R_141() { - if (jj_scan_token(AGG)) return true; - if (jj_3R_151()) return true; + if (jj_scan_token(FOLD)) return true; + if (jj_scan_token(LPAREN)) return true; return false; } @@ -7291,7 +7350,7 @@ private boolean jj_3R_139() { } private boolean jj_3R_123() { - if (jj_3R_145()) return true; + if (jj_3R_146()) return true; return false; } @@ -7307,10 +7366,10 @@ private boolean jj_3R_137() { return false; } - private boolean jj_3R_145() { + private boolean jj_3R_146() { if (jj_scan_token(PREFIX)) return true; if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_152()) return true; + if (jj_3R_153()) return true; return false; } @@ -7326,23 +7385,23 @@ private boolean jj_3R_135() { return false; } - private boolean jj_3R_142() { + private boolean jj_3R_143() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_144() { + private boolean jj_3R_145() { if (jj_scan_token(BASE)) return true; - if (jj_3R_152()) return true; + if (jj_3R_153()) return true; return false; } private boolean jj_3R_116() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(184)) { + if (jj_scan_token(186)) { jj_scanpos = xsp; - if (jj_3R_142()) return true; + if (jj_3R_143()) return true; } return false; } @@ -7358,7 +7417,7 @@ private boolean jj_3R_110() { } private boolean jj_3R_122() { - if (jj_3R_144()) return true; + if (jj_3R_145()) return true; return false; } @@ -7395,7 +7454,7 @@ private boolean jj_3R_132() { return false; } - private boolean jj_3R_153() { + private boolean jj_3R_154() { if (jj_scan_token(LT2)) return true; return false; } @@ -7412,13 +7471,13 @@ private boolean jj_3R_130() { return false; } - private boolean jj_3R_148() { - if (jj_3R_155()) return true; + private boolean jj_3R_149() { + if (jj_3R_156()) return true; return false; } - private boolean jj_3R_147() { - if (jj_3R_154()) return true; + private boolean jj_3R_148() { + if (jj_3R_155()) return true; return false; } @@ -7428,8 +7487,8 @@ private boolean jj_3R_129() { return false; } - private boolean jj_3R_146() { - if (jj_3R_153()) return true; + private boolean jj_3R_147() { + if (jj_3R_154()) return true; return false; } @@ -7442,11 +7501,11 @@ private boolean jj_3R_128() { private boolean jj_3R_124() { Token xsp; xsp = jj_scanpos; - if (jj_3R_146()) { - jj_scanpos = xsp; if (jj_3R_147()) { jj_scanpos = xsp; - if (jj_3R_148()) return true; + if (jj_3R_148()) { + jj_scanpos = xsp; + if (jj_3R_149()) return true; } } return false; @@ -7497,7 +7556,10 @@ private boolean jj_3R_113() { jj_scanpos = xsp; if (jj_3R_140()) { jj_scanpos = xsp; - if (jj_3R_141()) return true; + if (jj_3R_141()) { + jj_scanpos = xsp; + if (jj_3R_142()) return true; + } } } } @@ -7524,7 +7586,7 @@ private boolean jj_3R_121() { private boolean jj_3R_120() { if (jj_scan_token(EXISTS)) return true; - if (jj_3R_143()) return true; + if (jj_3R_144()) return true; return false; } @@ -7551,7 +7613,7 @@ private boolean jj_3R_117() { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[195]; + final private int[] jj_la1 = new int[198]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -7571,28 +7633,28 @@ private boolean jj_3R_117() { jj_la1_init_7(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0xc00000,0x0,0xc00000,0xc00000,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0xfcbdb7ff,0xfcbdb7ff,0xfcbdb7ff,0x0,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000000,0x3000000,0x0,0x3000000,0x3000000,0x0,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x800,0x0,0x37ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0xfbf,0xfbf,0xfbf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x3bf,0x0,0x3bf,0x3bf,0x3bf,0x0,0x3bf,0x3bf,0x0,0x0,0x0,0x0,0x0,0x84ffe000,0x84ffe000,0x2000000,0x8000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x2000000,0x80000000,0x2000,0x6000,0x0,0x0,0x0,0x20000000,0x60000000,0xc00,0x0,0x0,0xc00,0xc00,0xc00,0x0,0x0,0xc00,0x0,0xc00,0x0,0x0,0xc00,0x0,0x0,0xc00,0xc00,0x0,0x0,0x2000000,0x0,0xc00,0x0,0x0,0x0,0xc00,0x0,0xc00,0x0,0x0,0x3bf,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0x0,0x0,0xc00,0xc00,0xc00,0x0,0xc00,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbf,0xfbf,0xc00,0x0,0x0,0x0,0x0,0x3bf,0x0,0x0,0x0,0x0,0xfbf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,}; + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x3eff,0x3eff,0x3eff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0xeff,0x0,0xeff,0xeff,0xeff,0x0,0xeff,0xeff,0x0,0x0,0x0,0x0,0x0,0x13ff8000,0x13ff8000,0x8000000,0x20000000,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x0,0x8000,0x18000,0x0,0x0,0x0,0x80000000,0x80000000,0x3000,0x0,0x0,0x3000,0x3000,0x3000,0x0,0x0,0x3000,0x0,0x3000,0x0,0x0,0x3000,0x0,0x0,0x3000,0x3000,0x0,0x0,0x8000000,0x0,0x3000,0x0,0x0,0x0,0x3000,0x0,0x3000,0x0,0x0,0xeff,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0x0,0x0,0x3000,0x3000,0x3000,0x0,0x3000,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3eff,0x3eff,0x3000,0x0,0x0,0x0,0x0,0xeff,0x0,0x0,0x0,0x0,0x3eff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3c07fc,0x0,0x7c07fc,0x7c07fc,0x7c07fc,0x0,0x0,0x2000000,0x0,0x0,0x0,0x2000000,0x0,0x0,0x80000000,0x3c07fc,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x400000,0x400000,0x400000,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x297c07fc,0x0,0x0,0x297c07fc,0x297c07fc,0x297c07fc,0x2000000,0x0,0x297c07fc,0x0,0x297c07fc,0x0,0x0,0x297c07fc,0x2000000,0x0,0x297c07fc,0x297c07fc,0x0,0x2000000,0x0,0x1400000,0x3c07fc,0x0,0x1400000,0x1400000,0x3c07fc,0x1400000,0x3c07fc,0x80000000,0x0,0x400000,0x0,0x80000000,0x1400000,0x80000000,0x1400000,0x0,0x297c07fc,0x0,0x40000000,0x0,0x0,0x80000000,0x297c07fc,0x400000,0x400000,0x40000000,0x400000,0x400000,0x80000000,0x0,0x0,0x0,0x2000000,0x400000,0x4000004,0x84000000,0x80000004,0x2000000,0x400000,0x0,0x0,0x400000,0x0,0x0,0x8400000,0x8400000,0x297c07fc,0x297c07fc,0x0,0x0,0x297c07fc,0x297c07fc,0x213c07fc,0x0,0x3c07fc,0x0,0x20000000,0x0,0x213c07fc,0x0,0x0,0x0,0x0,0x7e0,0x7e0,0x0,0x0,0x7e0,0x0,0x0,0x7c07fc,0x7c07fc,0x3c07fc,0x80000000,0x80000000,0x1400000,0x80000000,0x0,0x80000000,0x80000000,0x80000000,0x0,0x7c07fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x40000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1400000,0x0,0x0,0x7fc,0x1c,0xe0,0x700,0x0,0x3c0000,0x0,0x0,0x20000000,}; + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf01ff0,0x0,0x1f01ff0,0x1f01ff0,0x1f01ff0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0xf01ff0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x1000000,0x1000000,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0xa5f01ff0,0xa5f01ff0,0x8000000,0x0,0xa5f01ff0,0x0,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0x8000000,0x0,0xa5f01ff0,0xa5f01ff0,0x0,0x8000000,0x0,0x5000000,0xf01ff0,0x0,0x5000000,0x5000000,0xf01ff0,0x5000000,0xf01ff0,0x0,0x0,0x1000000,0x0,0x0,0x5000000,0x0,0x5000000,0x0,0xa5f01ff0,0x0,0x0,0x0,0x0,0x0,0xa5f01ff0,0x1000000,0x1000000,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x8000000,0x1000000,0x10000010,0x10000000,0x10,0x8000000,0x1000000,0x0,0x0,0x1000000,0x0,0x0,0x21000000,0x21000000,0xa5f01ff0,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0xa5f01ff0,0x84f01ff0,0x0,0xf01ff0,0x0,0x80000000,0x0,0x84f01ff0,0x0,0x0,0x0,0x0,0x1f80,0x1f80,0x0,0x0,0x1f80,0x0,0x0,0x1f01ff0,0x1f01ff0,0xf01ff0,0x0,0x0,0x5000000,0x0,0x0,0x0,0x0,0x0,0x0,0x1f01ff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x5000000,0x0,0x0,0x1ff0,0x70,0x380,0x1c00,0x0,0xf00000,0x0,0x0,0x80000000,}; } private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x1,0x100,0x100,0x100,0x0,0x1,0x100,0x0,0x100,0x1,0x0,0x100,0x0,0x1,0x100,0x100,0x1,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x100,0x0,0x0,0x0,0x0,0x0,0x100,0x1000800,0x1000800,0x0,0x1000800,0x1000800,0x0,0x800000,0x1080000,0x1080000,0x8050000,0x1000800,0x0,0x0,0x50000,0x8050000,0x800,0x800000,0x1000000,0x1000000,0x0,0x1000000,0x0,0x0,0x100,0x100,0x200,0x200,0x100,0x100,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x4000,0x8000,0x7e,0x7e,0x30000,0x0,0xc0000,0xc0000,0x30000,0xc0000,0xc0000,0x30900,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x70900,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x4,0x400,0x400,0x400,0x0,0x4,0x400,0x0,0x400,0x4,0x0,0x400,0x0,0x4,0x400,0x400,0x4,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x400,0x0,0x400,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x0,0x4,0x400,0x0,0x1,0x0,0x0,0x2,0x400,0x4002000,0x4002000,0x1,0x4002000,0x4002000,0x2,0x2000000,0x4200000,0x4200000,0x20140000,0x4002000,0x0,0x2,0x140002,0x20140000,0x2000,0x2000000,0x4000000,0x4000000,0x0,0x4000000,0x0,0x0,0x400,0x400,0x800,0x800,0x400,0x400,0x400,0x0,0x400,0x0,0x0,0x0,0x0,0x10000,0x20000,0x1f8,0x1f8,0xc0000,0x0,0x300000,0x300000,0xc0000,0x300000,0x300000,0xc2400,0x400,0x400,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x0,0x1c2400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; @@ -7609,7 +7671,7 @@ public ARQParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7624,7 +7686,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7635,7 +7697,7 @@ public ARQParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7646,7 +7708,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7656,7 +7718,7 @@ public ARQParser(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7666,7 +7728,7 @@ public void ReInit(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 195; i++) jj_la1[i] = -1; + for (int i = 0; i < 198; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7781,12 +7843,12 @@ private void jj_add_error_token(int kind, int pos) { /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); - boolean[] la1tokens = new boolean[232]; + boolean[] la1tokens = new boolean[234]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 195; i++) { + for (int i = 0; i < 198; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< 162) - kind = 162; + if (kind > 164) + kind = 164; jjCheckNAddStates(0, 6); } else if (curChar == 45) @@ -2728,8 +2748,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 57; break; case 65: - if ((0x8400000000L & l) != 0L && kind > 174) - kind = 174; + if ((0x8400000000L & l) != 0L && kind > 176) + kind = 176; break; case 66: if (curChar == 39) @@ -2740,8 +2760,8 @@ else if (curChar == 39) jjCheckNAddStates(37, 39); break; case 68: - if (curChar == 39 && kind > 178) - kind = 178; + if (curChar == 39 && kind > 180) + kind = 180; break; case 70: if ((0x8400000000L & l) != 0L) @@ -2797,8 +2817,8 @@ else if (curChar == 39) jjCheckNAddStates(34, 36); break; case 86: - if (curChar == 34 && kind > 179) - kind = 179; + if (curChar == 34 && kind > 181) + kind = 181; break; case 88: if ((0x8400000000L & l) != 0L) @@ -2908,8 +2928,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 121; break; case 122: - if (curChar == 39 && kind > 180) - kind = 180; + if (curChar == 39 && kind > 182) + kind = 182; break; case 123: if (curChar == 39) @@ -2986,8 +3006,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 145; break; case 146: - if (curChar == 34 && kind > 181) - kind = 181; + if (curChar == 34 && kind > 183) + kind = 183; break; case 147: if (curChar == 34) @@ -3022,8 +3042,8 @@ else if (curChar == 39) jjCheckNAddStates(21, 23); break; case 155: - if (curChar == 41 && kind > 184) - kind = 184; + if (curChar == 41 && kind > 186) + kind = 186; break; case 156: if (curChar == 10) @@ -3204,15 +3224,15 @@ else if (curChar == 39) case 236: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 162) - kind = 162; + if (kind > 164) + kind = 164; jjCheckNAddStates(0, 6); break; case 237: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 162) - kind = 162; + if (kind > 164) + kind = 164; jjCheckNAdd(237); break; case 238: @@ -3226,8 +3246,8 @@ else if (curChar == 39) case 240: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; + if (kind > 165) + kind = 165; jjCheckNAdd(240); break; case 241: @@ -3249,8 +3269,8 @@ else if (curChar == 39) case 246: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; + if (kind > 166) + kind = 166; jjCheckNAdd(246); break; case 247: @@ -3264,8 +3284,8 @@ else if (curChar == 39) case 250: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; + if (kind > 166) + kind = 166; jjCheckNAdd(250); break; case 251: @@ -3283,8 +3303,8 @@ else if (curChar == 39) case 255: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; + if (kind > 166) + kind = 166; jjCheckNAdd(255); break; case 256: @@ -3294,8 +3314,8 @@ else if (curChar == 39) case 257: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; + if (kind > 167) + kind = 167; jjCheckNAdd(257); break; case 258: @@ -3309,8 +3329,8 @@ else if (curChar == 39) case 260: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; + if (kind > 168) + kind = 168; jjCheckNAdd(260); break; case 261: @@ -3328,8 +3348,8 @@ else if (curChar == 39) case 265: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; + if (kind > 169) + kind = 169; jjCheckNAdd(265); break; case 266: @@ -3355,8 +3375,8 @@ else if (curChar == 39) case 272: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; + if (kind > 169) + kind = 169; jjCheckNAdd(272); break; case 273: @@ -3370,8 +3390,8 @@ else if (curChar == 39) case 276: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; + if (kind > 169) + kind = 169; jjCheckNAdd(276); break; case 277: @@ -3381,8 +3401,8 @@ else if (curChar == 39) case 278: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; + if (kind > 170) + kind = 170; jjCheckNAdd(278); break; case 279: @@ -3396,8 +3416,8 @@ else if (curChar == 39) case 281: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; + if (kind > 171) + kind = 171; jjCheckNAdd(281); break; case 282: @@ -3415,8 +3435,8 @@ else if (curChar == 39) case 286: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; + if (kind > 172) + kind = 172; jjCheckNAdd(286); break; case 287: @@ -3442,8 +3462,8 @@ else if (curChar == 39) case 293: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; + if (kind > 172) + kind = 172; jjCheckNAdd(293); break; case 294: @@ -3457,8 +3477,8 @@ else if (curChar == 39) case 297: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; + if (kind > 172) + kind = 172; jjCheckNAdd(297); break; default : break; @@ -3611,8 +3631,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(45, 50); break; case 53: - if ((0x200000002L & l) != 0L && kind > 143) - kind = 143; + if ((0x200000002L & l) != 0L && kind > 145) + kind = 145; break; case 54: if ((0x10000000100000L & l) != 0L) @@ -3651,8 +3671,8 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 65; break; case 65: - if ((0x14404410000000L & l) != 0L && kind > 174) - kind = 174; + if ((0x14404410000000L & l) != 0L && kind > 176) + kind = 176; break; case 67: if ((0xffffffffefffffffL & l) != 0L) @@ -3909,8 +3929,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(72, 77); break; case 163: - if (curChar == 93 && kind > 189) - kind = 189; + if (curChar == 93 && kind > 191) + kind = 191; break; case 166: if ((0x7fffffe07fffffeL & l) != 0L) @@ -4009,8 +4029,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(94, 99); break; case 210: - if ((0x200000002L & l) != 0L && kind > 144) - kind = 144; + if ((0x200000002L & l) != 0L && kind > 146) + kind = 146; break; case 211: if ((0x10000000100000L & l) != 0L) @@ -4048,8 +4068,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(103, 108); break; case 225: - if ((0x2000000020L & l) != 0L && kind > 145) - kind = 145; + if ((0x2000000020L & l) != 0L && kind > 147) + kind = 147; break; case 226: if ((0x4000000040000L & l) != 0L) @@ -4753,18 +4773,18 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", -"\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", "\173\174", -"\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", "\57", -"\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, null, null, -null, null, null, null, null, null, null, null, null, }; +null, null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", +"\54", "\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", +"\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", +"\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, +null, null, null, null, null, null, null, null, null, null, null, }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffc47fdffffffffL, 0xfffffffL, + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfff11ff7ffffffffL, 0x3fffffffL, }; static final long[] jjtoSkip = { 0x7eL, 0x0L, 0x0L, 0x0L, From ba4bb067c3eb3b97bafb802e23d94512b3bb6959 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 17:51:05 +0200 Subject: [PATCH 011/323] extends the implementation of FOLD to actually support the type arguments --- .../jena/sparql/expr/aggregate/AggFold.java | 155 ++++++++++++++---- 1 file changed, 120 insertions(+), 35 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 20d1eb03965..f7ee0f19410 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -3,33 +3,36 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.ExprNode; -import org.apache.jena.sparql.expr.ExprNone; -import org.apache.jena.sparql.expr.ExprVisitor; import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; -import org.apache.jena.sparql.graph.NodeTransform; import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; public class AggFold extends AggregatorBase { + protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); + protected final Expr expr1; // While the values of these member variables protected final Expr expr2; // can also be extracted from the ExprList (see - protected final String typeIRI1; // createExprList below), keeping these copies - protected final String typeIRI2; // here makes it easier to access these values. + protected final Node typeIRI1; // createExprList below), keeping these copies + protected final Node typeIRI2; // here makes it easier to access these values. public AggFold( final Expr expr1 ) { this(expr1, null, null, null); @@ -52,8 +55,8 @@ public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = typeIRI1; - this.typeIRI2 = typeIRI2; + this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; + this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } protected static ExprList createExprList( final Expr expr1, final String typeIRI1, @@ -61,7 +64,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI final ExprList l = new ExprList(expr1); if ( typeIRI1 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI1) ); } @@ -70,7 +73,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI } if ( typeIRI2 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI2) ); } @@ -91,7 +94,7 @@ public Aggregator copy( final ExprList exprs ) { Expr lookAhead = it.hasNext() ? it.next() : null; // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI1 = ((NodeValueString) lookAhead).getString(); @@ -114,7 +117,7 @@ public Aggregator copy( final ExprList exprs ) { } // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI2 = ((NodeValueString) lookAhead).getString(); @@ -168,6 +171,8 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { + final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); + final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); @@ -175,7 +180,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { ExprUtils.fmtSPARQL(out, expr1, sCxt); if ( typeIRI1 != null ) { - out.append( " TYPE " + typeIRI1 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI1, pmap) ); } if ( expr2 != null ) { @@ -184,29 +190,42 @@ public String asSparqlExpr( final SerializationContext sCxt ) { } if ( typeIRI2 != null ) { - out.append( " TYPE " + typeIRI2 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI2, pmap) ); } out.append(")"); return out.asString(); } + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); - protected static Expr dummyExprForType = new ExprNode() { - @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } - - @Override public int hashCode() { return -88888; } - - @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + WriterExpr.output(out, expr1, null); - @Override public Expr copySubstitute(Binding binding) { return this; } + if ( typeIRI1 != null ) { + out.append( " TYPE " ); + out.append( typeIRI1.toString() ); + } - @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + if ( expr2 != null ) { + out.append(", "); + WriterExpr.output(out, expr2, null); + } - @Override public NodeValue eval(Binding binding, FunctionEnv env) { - throw new InternalErrorException("Attempt to eval DummyExprForType"); + if ( typeIRI2 != null ) { + out.append( " TYPE " ); + out.append( typeIRI2.toString() ); } - }; + + out.decIndent(); + out.append(")"); + return out.asString(); + } protected class ListAccumulator implements Accumulator { final protected List list = new ArrayList<>(); @@ -214,13 +233,25 @@ protected class ListAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) - list.add( nv.asNode() ); + if ( nv != null ) { + final Node n = nv.asNode(); + if ( typeIRI1 != null ) { // check the type of the node + final String nTypeIRI; + if ( n.isLiteral() ) + nTypeIRI = n.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the node if it is not of the expected type + } + list.add(n); + } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("["); if ( ! list.isEmpty() ) { final Iterator it = list.iterator(); final Node firstNode = it.next(); @@ -233,7 +264,19 @@ public NodeValue getValue() { sb.append(nextNodeAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + sb.append("]"); + + final RDFDatatype datatype; + if ( typeIRI1 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + datatype = QueryIterUnfold.datatypeTypedList; + } + else { + datatype = QueryIterUnfold.datatypeUntypedList; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } @@ -244,17 +287,41 @@ protected class MapAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( key != null && value != null ) { - keys.add( key.asNode() ); - values.add( value.asNode() ); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvKey != null && nvValue != null ) { + final Node key = nvKey.asNode(); + final Node value = nvValue.asNode(); + + if ( typeIRI1 != null ) { // check the type of the key + final String nTypeIRI; + if ( key.isLiteral() ) + nTypeIRI = key.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the key is not of the expected type + } + + if ( typeIRI2 != null ) { // check the type of the value + final String nTypeIRI; + if ( value.isLiteral() ) + nTypeIRI = value.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI2.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the value is not of the expected type + } + + keys.add(key); + values.add(value); } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("{"); if ( ! keys.isEmpty() ) { final Iterator it = keys.iterator(); final Iterator it2 = values.iterator(); @@ -276,7 +343,25 @@ public NodeValue getValue() { sb.append(nextValueAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + sb.append("}"); + + final RDFDatatype datatype; + if ( typeIRI1 != null || typeIRI2 != null ) { + sb.append("^^"); + if ( typeIRI1 != null ) { + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + } + if ( typeIRI2 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI2) ); + } + datatype = QueryIterUnfold.datatypeTypedMap; + } + else { + datatype = QueryIterUnfold.datatypeUntypedMap; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } From 3c451e1f95eb08a7ea7c5daa3eb82986de1263cd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 18:49:06 +0200 Subject: [PATCH 012/323] adds support for collection-related functions --- .../engine/iterator/QueryIterUnfold.java | 40 ++++++----- .../jena/sparql/function/ARQFunctions.java | 2 + .../CollectionLiteralFunctions.java | 10 +++ .../function/library/collection/SizeFct.java | 70 +++++++++++++++++++ 4 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 571df3b3191..e7bda9055a8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -93,45 +93,54 @@ protected QueryIterator nextStage(Binding inputBinding) { } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseUntypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = parseUntypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseUntypedList(String listAsValue) { + public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { if ( listAsValue.startsWith("[") ) listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseTypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator itListElmts = parseTypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseTypedList(String listAsValue) { + public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - Iterator> itMapElmts = parseUntypedMap(mapAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator> parseUntypedMap(String mapAsValue) { + public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { if ( mapAsValue.startsWith("{") ) mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - return parseMap(mapAsValue); + return parseMap(mapAsValue, pmap); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator parseList(String listAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { + mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); + return parseMap(mapAsValue, pmap); + } + + public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { final Iterator itListElmts = extractListElements(listAsValue); return new Iterator<>() { @Override @@ -160,7 +169,7 @@ else if ( pmap != null ) }; } - protected Iterator extractListElements(String listAsValue) { + public static Iterator extractListElements(String listAsValue) { listAsValue = listAsValue.strip(); if ( listAsValue.isEmpty() ) { @@ -178,8 +187,7 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } - protected Iterator> parseMap(String mapAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { final Iterator> itMapElmts = extractMapElements(mapAsValue); return new Iterator<>() { @Override @@ -222,7 +230,7 @@ else if ( pmap != null ) }; } - protected Iterator> extractMapElements(String mapAsValue) { + public static Iterator> extractMapElements(String mapAsValue) { mapAsValue = mapAsValue.strip(); if ( mapAsValue.isEmpty() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index a7452a464ae..2acb95dbf84 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -33,5 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); + CollectionLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java new file mode 100644 index 00000000000..f1bb072c595 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -0,0 +1,10 @@ +package org.apache.jena.sparql.function.library.collection; + +import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.FunctionRegistry; + +public class CollectionLiteralFunctions { + public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java new file mode 100644 index 00000000000..94a3f0748b7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -0,0 +1,70 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; + +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class SizeFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + final String datatypeURI = n.getLiteralDatatypeURI(); + final int size; + if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } + + return NodeValue.makeInteger(size); + } + + protected int determineSizeOfUntypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfUntypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineNumberOfElements( final Iterator it ) { + int i = 0; + while ( it.hasNext() ) { + i++; + it.next(); + } + return i; + } + +} From 87eb345a2c6432b0b3269984615cf70c8526e291 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 17 Aug 2022 18:38:31 +0200 Subject: [PATCH 013/323] adds POC of a 'concat' function for lists --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ConcatFct.java | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index f1bb072c595..5beaeec3aa8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,5 +6,6 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java new file mode 100644 index 00000000000..4ccf1688fcb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -0,0 +1,87 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ConcatFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { + final String list1AsString = getInputListAsString(v1); + final String list2AsString = getInputListAsString(v2); +System.out.println("list1AsString " + list1AsString); +System.out.println("list2AsString " + list2AsString); + return createResultList(list1AsString, list2AsString); + } + + protected String getInputListAsString( final NodeValue v ) { + final Node n = v.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + v); + + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + throw new ExprEvalException("Literal with wrong datatype: " + v); + } + + return n.getLiteralLexicalForm(); + } + + protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { + final String resultListAsString = createResultListAsString(list1AsString, list2AsString); + final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + +System.out.println("resultListAsString " + resultListAsString); + final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + return NodeValue.makeNode(n); + } + + protected String createResultListAsString( final String list1AsString, final String list2AsString ) { + final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); + final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); + final Iterator it = new ConcatenatingIterator(it1, it2); + + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( it.hasNext() ) { + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + sb.append("]"); + + return sb.toString(); + } + + protected static class ConcatenatingIterator implements Iterator { + protected final Iterator it1; + protected final Iterator it2; + public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } + @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } + @Override public T next() { + if ( it1.hasNext() ) + return it1.next(); + else if ( it2.hasNext() ) + return it2.next(); + else + throw new NoSuchElementException(); + } + } + +} From d0d4a1c3ca1eae3c10663dd6f5d115b132ebc998 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 Aug 2022 11:57:06 +0200 Subject: [PATCH 014/323] creates Node_LiteralWithList and Node_LiteralWithMap, so far only as placeholders for adding special functionality for such types of literals --- .../engine/iterator/QueryIterUnfold.java | 40 +++++++------------ .../jena/sparql/expr/aggregate/AggFold.java | 11 ++--- .../library/collection/ConcatFct.java | 5 ++- .../function/library/collection/SizeFct.java | 10 +++-- .../jena/graph/Node_LiteralWithList.java | 19 +++++++++ .../jena/graph/Node_LiteralWithMap.java | 18 +++++++++ 6 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e7bda9055a8..e621756f764 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,10 +23,10 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -41,17 +41,7 @@ public class QueryIterUnfold extends QueryIterRepeatApply { - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - protected final Expr expr ; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; @@ -79,13 +69,13 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( datatypeUriUntypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriUntypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } @@ -153,13 +143,13 @@ public Node next() { final String listElmt = itListElmts.next(); final Node n; if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); else @@ -209,13 +199,13 @@ public Map.Entry next() { final Node valueAsNode; if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); else diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index f7ee0f19410..337d034c01f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -9,11 +9,12 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -270,10 +271,10 @@ public NodeValue getValue() { if ( typeIRI1 != null ) { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = QueryIterUnfold.datatypeTypedList; + datatype = Node_LiteralWithList.datatypeTypedList; } else { - datatype = QueryIterUnfold.datatypeUntypedList; + datatype = Node_LiteralWithList.datatypeUntypedList; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); @@ -355,10 +356,10 @@ public NodeValue getValue() { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI2) ); } - datatype = QueryIterUnfold.datatypeTypedMap; + datatype = Node_LiteralWithMap.datatypeTypedMap; } else { - datatype = QueryIterUnfold.datatypeUntypedMap; + datatype = Node_LiteralWithMap.datatypeUntypedMap; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 4ccf1688fcb..b9d1b3a6c79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; @@ -30,7 +31,7 @@ protected String getInputListAsString( final NodeValue v ) { throw new ExprEvalException("Not a literal: " + v); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { throw new ExprEvalException("Literal with wrong datatype: " + v); } @@ -39,7 +40,7 @@ protected String getInputListAsString( final NodeValue v ) { protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; System.out.println("resultListAsString " + resultListAsString); final Node n = NodeFactory.createLiteral(resultListAsString, datatype); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 94a3f0748b7..982d6b8e5a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -3,6 +3,8 @@ import java.util.Iterator; import org.apache.jena.graph.Node; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -19,16 +21,16 @@ public NodeValue exec( final NodeValue nv ) { final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); } else { diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java new file mode 100644 index 00000000000..37cb8ca1f3e --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java @@ -0,0 +1,19 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithList extends Node_Literal +{ + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + + public Node_LiteralWithList( final LiteralLabel label ) { + super(label); + } + + +} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java new file mode 100644 index 00000000000..27d5bef8656 --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java @@ -0,0 +1,18 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithMap extends Node_Literal +{ + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); + + public Node_LiteralWithMap( final LiteralLabel label ) { + super(label); + } + +} From f5f3d51cd8b804191beb47bf7f840a738f8281e2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 10:35:24 +0100 Subject: [PATCH 015/323] adds an actual parser for the lexical form of cdt:List and cdt:Map literals, and proper integration into the Jena Graph API (via special LiteralLabel implementations) --- jena-arq/Grammar/arq.jj | 11 +- jena-arq/Grammar/cdt_literals.jj | 366 +++++ jena-arq/Grammar/grammarCDTs | 59 + jena-arq/Grammar/main.jj | 11 +- .../java/org/apache/jena/cdt/CDTFactory.java | 68 + .../main/java/org/apache/jena/cdt/CDTKey.java | 62 + .../jena/cdt/CDTLiteralParseException.java | 31 + .../java/org/apache/jena/cdt/CDTValue.java | 100 ++ .../jena/cdt/CompositeDatatypeBase.java | 45 + .../jena/cdt/CompositeDatatypeList.java | 181 +++ .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 154 ++ .../apache/jena/cdt/LiteralLabelForList.java | 79 + .../apache/jena/cdt/LiteralLabelForMap.java | 79 + .../apache/jena/cdt/ParserForCDTLiterals.java | 155 ++ .../jena/cdt/parser/CDTLiteralParser.java | 570 +++++++ .../cdt/parser/CDTLiteralParserConstants.java | 147 ++ .../parser/CDTLiteralParserTokenManager.java | 1045 +++++++++++++ .../jena/cdt/parser/JavaCharStream.java | 703 +++++++++ .../jena/cdt/parser/ParseException.java | 205 +++ .../org/apache/jena/cdt/parser/Token.java | 149 ++ .../apache/jena/cdt/parser/TokenMgrError.java | 167 ++ .../engine/iterator/QueryIterUnfold.java | 260 ++-- .../jena/sparql/expr/aggregate/AggFold.java | 266 +--- .../expr/aggregate/AggregatorFactory.java | 4 +- .../library/collection/ConcatFct.java | 96 +- .../function/library/collection/SizeFct.java | 76 +- .../jena/sparql/lang/arq/ARQParser.java | 134 +- .../sparql/lang/arq/ARQParserConstants.java | 319 ++-- .../lang/arq/ARQParserTokenManager.java | 1376 ++++++++--------- .../jena/graph/Node_LiteralWithList.java | 19 - .../jena/graph/Node_LiteralWithMap.java | 18 - 32 files changed, 5643 insertions(+), 1487 deletions(-) create mode 100644 jena-arq/Grammar/cdt_literals.jj create mode 100755 jena-arq/Grammar/grammarCDTs create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserConstants.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 8ee34eed1ef..57157bbd44f 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1619,16 +1619,14 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { String typeIRI1 = null ; - String typeIRI2 = null ; - Expr orderByExpr = null ; + { Expr orderByExpr = null ; Var orderByVar = null ; int orderByDirection = Query.ORDER_DEFAULT ; } - expr = Expression() ( typeIRI1 = iri() )? - ( expr2 = Expression() ( typeIRI2 = iri() )? )? + expr = Expression() + ( expr2 = Expression() )? - { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } + { agg = AggregatorFactory.createFold(expr, expr2) ; } | t = { String iri ; } iri = iri() @@ -1829,7 +1827,6 @@ TOKEN [IGNORE_CASE] : | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > | < FOLD: "fold" > -| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj new file mode 100644 index 00000000000..eac97b2827e --- /dev/null +++ b/jena-arq/Grammar/cdt_literals.jj @@ -0,0 +1,366 @@ +/* + * 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. + */ + +options +{ + // Use \ u escapes in streams AND use a reader for the query + // => get both raw and escaped unicode + + JAVA_UNICODE_ESCAPE = true ; + UNICODE_INPUT = false ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + +PARSER_BEGIN(CDTLiteralParser) +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase +{ +} +PARSER_END(CDTLiteralParser) + +// --- Entry point + +void parse() : {} +{ + ( List() | Map() ) +} + +List List() : { List l = new ArrayList(); } +{ + + + ( ListElement(l) )? + + ( ListElement(l) )* + + // should we permit a trailing comma? + + + + { return l; } +} + +void ListElement(List l) : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } +| + n = BlankNode() { l.add( CDTFactory.createValue(n) ); } +| + n = RDFLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = NumericLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = BooleanLiteral() { l.add( CDTFactory.createValue(n) ); } +| + { l.add( CDTFactory.getNullValue() ); } +| + subList = List() { l.add( CDTFactory.createValue(subList) ); } +| + m = Map() { l.add( CDTFactory.createValue(m) ); } +} + +Map Map() : { Map m = new HashMap(); } +{ + + + ( MapEntry(m) )? + + ( MapEntry(m) )* + + + + { return m; } +} + +void MapEntry(Map m) : { CDTKey key; CDTValue value; } +{ + key = MapKey() + + + + value = MapValue() + + { + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) throw new ParseException("map with non-unique key (" + key.toString() + ")"); + } +} + +CDTKey MapKey() : { String iri; Node n; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } +| + n = BlankNode() { return CDTFactory.createKey(n); } +| + n = RDFLiteral() { return CDTFactory.createKey(n); } +| + n = NumericLiteral() { return CDTFactory.createKey(n); } +| + n = BooleanLiteral() { return CDTFactory.createKey(n); } +} + +CDTValue MapValue() : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } +| + n = BlankNode() { return CDTFactory.createValue(n); } +| + n = RDFLiteral() { return CDTFactory.createValue(n); } +| + n = NumericLiteral() { return CDTFactory.createValue(n); } +| + n = BooleanLiteral() { return CDTFactory.createValue(n); } +| + { return CDTFactory.getNullValue(); } +| + subList = List() { return CDTFactory.createValue(subList); } +| + m = Map() { return CDTFactory.createValue(m); } +} + + +// ---- Basic terms + +String IRI_REF() : { Token t ; } +{ + t = + { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } +} + +Node BlankNode() : { Token t = null ; } +{ + t = + + { + return createBNode(t.image, t.beginLine, t.beginColumn); + } +} + +Node NumericLiteral() : { Token t ; } +{ + t = { return createLiteralInteger(t.image); } +| t = { return createLiteralDecimal(t.image); } +| t = { return createLiteralDouble(t.image); } +} + +Node BooleanLiteral() : {} +{ + { return XSD_TRUE; } + | + { return XSD_FALSE; } +} + +Node RDFLiteral() : { String lex = null ; } +{ + lex = String() + // Optional lang tag and datatype. + { String lang = null ; String dt = null ; } + ( + lang = Langtag() + | + ( dt = IRI_REF() ) // divergence from the Turtle parser here; instead of IRIref(), we only permit IRI_REF() + )? + + { + return createLiteral(lex, lang, dt); + } +} + +String Langtag() : { Token t ; } +{ + t = // divergence from the Turtle parser here, which also permits AnyDirective() at this point + { String lang = stripChars(t.image, 1) ; return lang ; } +} + +String String() : { Token t ; String lex ; } +{ + ( t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + ) + { lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + return lex ; + } +} + + +// ------------------------------------------ +// Tokens + +// Comments and whitespace + +SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + +TOKEN: { <#WS: " " | "\t" | "\n" | "\r" | "\f"> } + + +// ------------------------------------------------- +// Keywords + +TOKEN [IGNORE_CASE] : +{ + < TRUE: "true" > +| < FALSE: "false" > + +// ------------------------------------------------- + +| < INTEGER: (["-","+"])? > +| + < DECIMAL: (["-","+"])? + (()+ "." ()* | "." ()+) + > + // Required exponent. +| < DOUBLE: + (["+","-"])? + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > +| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| < #QUOTE_3D: "\"\"\""> +| < #QUOTE_3S: "'''"> +// "u" done by javacc input stream. +// "U" escapes not supported yet for Java strings +| + +| < STRING_LITERAL1: + // Single quoted string + "'" ( (~["'","\\","\n","\r"]) | )* "'" > + +| < STRING_LITERAL2: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > + +| < STRING_LITERAL_LONG1: + + ( ~["'","\\"] | | ("'" ~["'"]) | ("''" ~["'"]))* + > + +| < STRING_LITERAL_LONG2: + + ( ~["\"","\\"] | | ("\"" ~["\""]) | ("\"\"" ~["\""]))* + > +| < DIGITS: (["0"-"9"])+> +// | +} + +TOKEN: +{ + // Includes # for relative URIs + ","<", "\"", "{", "}", "^", "\\", "|", "`", + "\u0000"-"\u0020"])* ">" > +| > +| ()+("-" ()+)* > +| <#A2Z: ["a"-"z","A"-"Z"]> +| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> +} + + +TOKEN : +{ + < NULL: "null" > + +| < LBRACE: "{" > +| < RBRACE: "}" > + +| < LBRACKET: "[" > +| < RBRACKET: "]" > + +| < COMMA: "," > +| < COLON: ":" > +} + +// Operator + +TOKEN : +{ + < DATATYPE: "^^"> +| < AT: "@"> +} + +TOKEN: +{ + <#PN_CHARS_BASE: + ["A"-"Z"] | ["a"-"z"] | + ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | + ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | + ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | + ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] + > + // [#x10000-#xEFFFF] +| + <#PN_CHARS_U: | "_" > +| +// No DOT + <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > +| + // With a leading "_", no dot at end of local name. + <#PN_LOCAL: ( | ["0"-"9"]) ((|".")* )? > +} + +// Catch-all tokens. Must be last. +// Any non-whitespace. Causes a parser exception, rather than a +// token manager error (with hidden line numbers). +// Only bad IRIs (e.g. spaces) now give unhelpful parse errors. +TOKEN: +{ + <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > +} + +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs new file mode 100755 index 00000000000..fb95f355e44 --- /dev/null +++ b/jena-arq/Grammar/grammarCDTs @@ -0,0 +1,59 @@ +#!/bin/bash +## 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. + +# Parser builder + +DIR="../src/main/java/org/apache/jena/cdt/parser" +FILE=cdt_literals.jj +CLASS=CDTLiteralParser + +(cd "$DIR" ; rm -f *.java ) + +echo "---- Process grammar ----" + +javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" + +RC=$? +[ "$RC" = 0 ] || return + +## echo "---- Create text form ----" +## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" + +echo "---- Fixing Java warnings in TokenMgrError" +F="$DIR/TokenMgrError.java" +if [ -e "$F" ] +then + sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic class TokenMgrError/' < $F > F + mv F $F +fi + +## JavaCharStream -- SimpleCharStream is OK. +echo "---- Fixing Java warnings in JavaCharStream..." +F="$DIR/JavaCharStream.java" +if [ -e "$F" ] +then + sed -e 's/public/\n@SuppressWarnings("all")\npublic/' < $F > F + mv F $F +fi + +echo "---- Fixing Java warnings in ${CLASS} ..." +F="$DIR/${CLASS}.java" +sed -e 's/@SuppressWarnings("serial")//' \ + < $F > F +mv F $F + +echo "---- Done" diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 57cd62d17b3..2a17409a5d7 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -2270,16 +2270,14 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { String typeIRI1 = null ; - String typeIRI2 = null ; - Expr orderByExpr = null ; + { Expr orderByExpr = null ; Var orderByVar = null ; int orderByDirection = Query.ORDER_DEFAULT ; } - expr = Expression() ( typeIRI1 = iri() )? - ( expr2 = Expression() ( typeIRI2 = iri() )? )? + expr = Expression() + ( expr2 = Expression() )? - { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } + { agg = AggregatorFactory.createFold(expr, expr2) ; } /* Explicit syntax (aggregate even if not registered) */ | t = @@ -2575,7 +2573,6 @@ TOKEN [IGNORE_CASE] : | < VAR_POP: "var_pop" > #ifdef ARQ | < FOLD: "fold" > -| < TYPE: "type" > #endif | < SAMPLE: "sample" > diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java new file mode 100644 index 00000000000..1c96d41b629 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -0,0 +1,68 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.graph.Node; + +public class CDTFactory +{ + public static CDTKey createKey( final Node n ) { + return new CDTKey() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final Node n ) { + return new CDTValue() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final List l ) { + return new CDTValue() { + @Override public boolean isList() { return true; } + @Override public List asList() { return l; } + }; + } + + public static CDTValue createValue( final Map m ) { + return new CDTValue() { + @Override public boolean isMap() { return true; } + @Override public Map asMap() { return m; } + }; + } + + public static CDTValue getNullValue() { + if ( nullValue == null ) { + return new CDTValue() { + @Override public boolean isNull() { return true; } + }; + } + + return nullValue; + } + + private static CDTValue nullValue = null; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java new file mode 100644 index 00000000000..32c455d1810 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.graph.Node; + +public abstract class CDTKey +{ + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public boolean equals( final Object other ) { + if ( !(other instanceof CDTKey) ) { + return false; + } + + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + + @Override + public String toString() { + if ( isNode() ) { + return asNode().toString(); + } + else { + return super.toString(); + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java new file mode 100644 index 00000000000..01325265fc1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.shared.JenaException; + +public class CDTLiteralParseException extends JenaException +{ + private static final long serialVersionUID = -6244204787118953600L; + + public CDTLiteralParseException() { super(); } + public CDTLiteralParseException(Throwable cause) { super(cause); } + public CDTLiteralParseException(String msg) { super(msg); } + public CDTLiteralParseException(String msg, Throwable cause) { super(msg, cause); } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java new file mode 100644 index 00000000000..e0bd1443def --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +public abstract class CDTValue extends CDTKey +{ + /** + * Returns true if this object is a list. In that case, {@link #asList()} + * can be used to get it as an actual {@link List} object. + */ + public boolean isList() { + return false; + } + + /** + * Returns true if this object is a map. In that case, {@link #asMap()} + * can be used to get it as an actual {@link Map} object. + */ + public boolean isMap() { + return false; + } + + /** + * Returns true if this is a null value. + */ + public boolean isNull() { + return false; + } + + /** + * Returns this object as a list, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public List asList() { + throw new UnsupportedOperationException( this + " is not a list" ); + } + + /** + * Returns this object as a map, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public Map asMap() { + throw new UnsupportedOperationException( this + " is not a map" ); + } + + @Override + public final boolean equals( final Object other ) { + if ( !(other instanceof CDTValue) ) { + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + else { + return false; + } + } + + if ( isNull() ) { + return false; + } + + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) { + return false; + } + + if ( isNode() && otherValue.isNode() ) { + return asNode().equals( otherValue.asNode() ); + } + else if ( isList() && otherValue.isList() ) { + return asList().equals( otherValue.asList() ); + } + else if ( isMap() && otherValue.isMap() ) { + return asMap().equals( otherValue.asMap() ); + } + else { + return false; + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java new file mode 100644 index 00000000000..ca5e1878c18 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -0,0 +1,45 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.datatypes.RDFDatatype; + +public abstract class CompositeDatatypeBase implements RDFDatatype +{ + @Override + public Class getJavaClass() { + return null; + } + + @Override + public Object cannonicalise( final Object value ) { + return value; + } + + @Override + public Object extendedTypeDefinition() { + return null; + } + + @Override + public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) { + return this; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java new file mode 100644 index 00000000000..9c43f8978c9 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -0,0 +1,181 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeList extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static CompositeDatatypeList type = new CompositeDatatypeList(); + + protected CompositeDatatypeList() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseList(list); + } + + public static String unparseList( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + public static String unparseListElement( final CDTValue elmt ) { + if ( elmt.isNode() ) + return NodeFmtLib.strTTL( elmt.asNode() ); + else if ( elmt.isList() ) + return unparseList( elmt.asList() ); + else if ( elmt.isMap() ) + return CompositeDatatypeMap.unparseMap( elmt.asMap() ); + else if ( elmt.isNull() ) + return "null"; + else + throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + } + + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + return parseList(lexicalForm); + } + + public static List parseList( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof List) ) { + return false; + } + + final List l = (List) value; + for ( final Object e : l ) { + if ( !(e instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForList objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForList makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForList ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final List list1 = getValue(value1); + final List list2 = getValue(value2); + + return list1.equals(list2); + } + + public static List getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseList(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java new file mode 100644 index 00000000000..4c71bd18569 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -0,0 +1,175 @@ +package org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeMap extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); + + protected CompositeDatatypeMap() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof Map) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + + return unparseMap(map); + } + + public static String unparseMap( final Map map ) { + final StringBuilder sb = new StringBuilder(); + sb.append("{"); + if ( ! map.isEmpty() ) { + final Iterator> it = map.entrySet().iterator(); + + final Map.Entry firstEntry = it.next(); + unparseMapEntry(firstEntry, sb); + + while ( it.hasNext() ) { + sb.append(", "); + + final Map.Entry nextEntry = it.next(); + unparseMapEntry(nextEntry, sb); + } + } + + sb.append("}"); + return sb.toString(); + } + + public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + if ( entry.getKey().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); + else + throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); + + sb.append(" : "); + + if ( entry.getValue().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); + else if ( entry.getValue().isList() ) + sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); + else if ( entry.getValue().isMap() ) + sb.append( unparseMap( entry.getValue().asMap() ) ); + else if ( entry.getValue().isNull() ) + sb.append( "null" ); + else + throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + return parseMap(lexicalForm); + } + + public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); + + return map1.equals(map2); + } + + public static Map getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return ( (LiteralLabelForMap) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseMap(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java new file mode 100644 index 00000000000..c5215fccdc2 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -0,0 +1,154 @@ +package org.apache.jena.cdt; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.rdf.model.impl.Util; + +public abstract class LiteralLabelForCDTs implements LiteralLabel +{ + protected final int hash; + + private T valueForm; + private String lexicalForm; + private boolean lexicalFormTested; + + public LiteralLabelForCDTs( final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = null; + + this.lexicalFormTested = true; + this.hash = valueForm.hashCode(); + } + + public LiteralLabelForCDTs( final String lexicalForm ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = false; + this.hash = lexicalForm.hashCode(); + } + + @Override + public boolean isXML() { + return false; + } + + @Override + public boolean isWellFormed() { + if ( lexicalFormTested ) { + return valueForm != null; + } + + try { + getValue(); + } + catch ( final DatatypeFormatException ex ) { + return false; + } + + return true; + } + + @Override + public boolean isWellFormedRaw() { + return isWellFormed(); + } + + @Override + public String toString( final boolean quoting ) { + final StringBuilder b = new StringBuilder(); + + if ( quoting ) b.append('"'); + + String lex = getLexicalForm(); + lex = Util.replace(lex, "\"", "\\\""); + b.append(lex); + + if ( quoting ) b.append('"'); + + b.append("^^").append( getDatatypeURI() ); + + return b.toString(); + } + + @Override + public String toString() { + return toString(false); + } + + @Override + public String getLexicalForm() { + if ( lexicalForm == null ) { + lexicalForm = unparseValueForm(valueForm); + } + + return lexicalForm; + } + + protected abstract String unparseValueForm( T valueForm ); + + protected boolean isLexicalFormSet() { + return lexicalForm != null; + } + + protected boolean isValueFormSet() { + return valueForm != null; + } + + @Override + public Object getIndexingValue() { + return getLexicalForm(); + } + + @Override + public String language() { + return ""; + } + + @Override + public T getValue() throws DatatypeFormatException { + if ( valueForm == null && ! lexicalFormTested ) { + lexicalFormTested = true; + + // The following function may fail with a DatatypeFormatException, + // in which case 'valueForm' will remain being 'null' but we won't + // try again at the next call of 'getValue()' because now we have + // set 'lexicalFormTested'. + + valueForm = parseLexicalForm(lexicalForm); + } + + return valueForm; + } + + protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { + return false; + } + + if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { + return true; + } + + return getValue().equals( other.getValue() ); + } + + @Override + public int getDefaultHashcode() { + return hash; + } + + @Override + public int hashCode() { + return hash; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java new file mode 100644 index 00000000000..bc626e0fd01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForList extends LiteralLabelForCDTs> +{ + public LiteralLabelForList( final List valueForm ) { + super(valueForm); + } + + public LiteralLabelForList( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( List valueForm ) { + return CompositeDatatypeList.unparseList(valueForm); + } + + @Override + protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeList.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForList ) { + final LiteralLabelForList otherListLiteral = (LiteralLabelForList) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherListLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherListLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherListLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java new file mode 100644 index 00000000000..1d5093e1da7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForMap extends LiteralLabelForCDTs> +{ + public LiteralLabelForMap( final Map valueForm ) { + super(valueForm); + } + + public LiteralLabelForMap( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( Map valueForm ) { + return CompositeDatatypeMap.unparseMap(valueForm); + } + + @Override + protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeMap.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForMap ) { + final LiteralLabelForMap otherMapLiteral = (LiteralLabelForMap) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherMapLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherMapLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherMapLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java new file mode 100644 index 00000000000..844bca2ed49 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -0,0 +1,155 @@ +/* + * 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 org.apache.jena.cdt; + +import java.io.InputStream; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.parser.CDTLiteralParser; +import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.ttl.turtle.parser.TokenMgrError; +import org.apache.jena.util.FileUtils; + +public class ParserForCDTLiterals +{ + public static List parseListLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static List parseListLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static List parseListLiteral( final Reader reader, final boolean recursive ) { + final List list; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + list = parser.List(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! list.isEmpty() ) { + for ( int i = 0; i < list.size(); i++ ) { + final CDTValue v = list.get(i); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subList) ); + } + else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subMap) ); + } + } + } + } + + return list; + } + + public static Map parseMapLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + final Map map; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + map = parser.Map(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! map.isEmpty() ) { + for ( final CDTKey key : map.keySet() ) { + final CDTValue v = map.get(key); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } + else if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subList) ); + } + } + } + } + + return map; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java new file mode 100644 index 00000000000..a41a068d605 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -0,0 +1,570 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParser.java */ +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { + +// --- Entry point + final public void parse() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACKET: + List(); + break; + case LBRACE: + Map(); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public List List() throws ParseException { + List l = new ArrayList(); + jj_consume_token(LBRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + case NULL: + case LBRACE: + case LBRACKET: + ListElement(l); + break; + default: + jj_la1[1] = jj_gen; + ; + } + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + jj_consume_token(COMMA); + ListElement(l); + } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void ListElement(List l) throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); l.add( CDTFactory.createValue(n) ); + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + l.add( CDTFactory.createValue(n) ); + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case NULL: + jj_consume_token(NULL); + l.add( CDTFactory.getNullValue() ); + break; + case LBRACKET: + subList = List(); + l.add( CDTFactory.createValue(subList) ); + break; + case LBRACE: + m = Map(); + l.add( CDTFactory.createValue(m) ); + break; + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public Map Map() throws ParseException { + Map m = new HashMap(); + jj_consume_token(LBRACE); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + MapEntry(m); + break; + default: + jj_la1[4] = jj_gen; + ; + } + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[5] = jj_gen; + break label_2; + } + jj_consume_token(COMMA); + MapEntry(m); + } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void MapEntry(Map m) throws ParseException { + CDTKey key; CDTValue value; + key = MapKey(); + jj_consume_token(COLON); + value = MapValue(); + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) {if (true) throw new ParseException("map with non-unique key (" + key.toString() + ")");} + } + + final public CDTKey MapKey() throws ParseException { + String iri; Node n; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createKey(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public CDTValue MapValue() throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createValue(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case NULL: + jj_consume_token(NULL); + {if (true) return CDTFactory.getNullValue();} + break; + case LBRACKET: + subList = List(); + {if (true) return CDTFactory.createValue(subList);} + break; + case LBRACE: + m = Map(); + {if (true) return CDTFactory.createValue(m);} + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + +// ---- Basic terms + final public String IRI_REF() throws ParseException { + Token t ; + t = jj_consume_token(IRIref); + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + throw new Error("Missing return statement in function"); + } + + final public Node BlankNode() throws ParseException { + Token t = null ; + t = jj_consume_token(BLANK_NODE_LABEL); + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn);} + throw new Error("Missing return statement in function"); + } + + final public Node NumericLiteral() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: + t = jj_consume_token(INTEGER); + {if (true) return createLiteralInteger(t.image);} + break; + case DECIMAL: + t = jj_consume_token(DECIMAL); + {if (true) return createLiteralDecimal(t.image);} + break; + case DOUBLE: + t = jj_consume_token(DOUBLE); + {if (true) return createLiteralDouble(t.image);} + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node BooleanLiteral() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + jj_consume_token(TRUE); + {if (true) return XSD_TRUE;} + break; + case FALSE: + jj_consume_token(FALSE); + {if (true) return XSD_FALSE;} + break; + default: + jj_la1[9] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node RDFLiteral() throws ParseException { + String lex = null ; + lex = String(); + String lang = null ; String dt = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + lang = Langtag(); + break; + case DATATYPE: + jj_consume_token(DATATYPE); + dt = IRI_REF(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[11] = jj_gen; + ; + } + {if (true) return createLiteral(lex, lang, dt);} + throw new Error("Missing return statement in function"); + } + + final public String Langtag() throws ParseException { + Token t ; + t = jj_consume_token(LANGTAG); + String lang = stripChars(t.image, 1) ; {if (true) return lang ;} + throw new Error("Missing return statement in function"); + } + + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: + t = jj_consume_token(STRING_LITERAL1); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL2: + t = jj_consume_token(STRING_LITERAL2); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL_LONG1: + t = jj_consume_token(STRING_LITERAL_LONG1); + lex = stripQuotes3(t.image) ; + break; + case STRING_LITERAL_LONG2: + t = jj_consume_token(STRING_LITERAL_LONG2); + lex = stripQuotes3(t.image) ; + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + {if (true) return lex ;} + throw new Error("Missing return statement in function"); + } + + /** Generated Token Manager. */ + public CDTLiteralParserTokenManager token_source; + JavaCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private int jj_gen; + final private int[] jj_la1 = new int[13]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static { + jj_la1_init_0(); + jj_la1_init_1(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + } + + /** Constructor with InputStream. */ + public CDTLiteralParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public CDTLiteralParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor. */ + public CDTLiteralParser(java.io.Reader stream) { + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor with generated Token Manager. */ + public CDTLiteralParser(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[40]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 13; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1<", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "\"\\f\"", + "", + "\"true\"", + "\"false\"", + "", + "", + "", + "", + "\"\\\"\\\"\\\"\"", + "\"\\\'\\\'\\\'\"", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\"null\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\",\"", + "\":\"", + "\"^^\"", + "\"@\"", + "", + "", + "", + "", + "", + }; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java new file mode 100644 index 00000000000..c7c080e9454 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -0,0 +1,1045 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParserTokenManager.java */ +/* + * 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 org.apache.jena.cdt.parser; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +/** Token Manager. */ +public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 9: + jjmatchedKind = 2; + return jjMoveNfa_0(0, 0); + case 10: + jjmatchedKind = 3; + return jjMoveNfa_0(0, 0); + case 12: + jjmatchedKind = 5; + return jjMoveNfa_0(0, 0); + case 13: + jjmatchedKind = 4; + return jjMoveNfa_0(0, 0); + case 32: + jjmatchedKind = 1; + return jjMoveNfa_0(0, 0); + case 44: + jjmatchedKind = 31; + return jjMoveNfa_0(0, 0); + case 58: + jjmatchedKind = 32; + return jjMoveNfa_0(0, 0); + case 64: + jjmatchedKind = 34; + return jjMoveNfa_0(0, 0); + case 70: + return jjMoveStringLiteralDfa1_0(0x100L); + case 84: + return jjMoveStringLiteralDfa1_0(0x80L); + case 91: + jjmatchedKind = 29; + return jjMoveNfa_0(0, 0); + case 93: + jjmatchedKind = 30; + return jjMoveNfa_0(0, 0); + case 94: + return jjMoveStringLiteralDfa1_0(0x200000000L); + case 102: + return jjMoveStringLiteralDfa1_0(0x100L); + case 110: + return jjMoveStringLiteralDfa1_0(0x4000000L); + case 116: + return jjMoveStringLiteralDfa1_0(0x80L); + case 123: + jjmatchedKind = 27; + return jjMoveNfa_0(0, 0); + case 125: + jjmatchedKind = 28; + return jjMoveNfa_0(0, 0); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 0); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 82: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 94: + if ((active0 & 0x200000000L) != 0L) + { + jjmatchedKind = 33; + jjmatchedPos = 1; + } + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 114: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); + default : + break; + } + return jjMoveNfa_0(0, 1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 1); + } + switch(curChar) + { + case 76: + return jjMoveStringLiteralDfa3_0(active0, 0x100L); + case 85: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x4000100L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + default : + break; + } + return jjMoveNfa_0(0, 2); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 2); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 2); + } + switch(curChar) + { + case 69: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 83: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + case 101: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 108: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 3; + } + break; + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + default : + break; + } + return jjMoveNfa_0(0, 3); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 3); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 3); + } + switch(curChar) + { + case 69: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + case 101: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 4); +} +static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { + 0xfffe7000fffffff6L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x7e00000000ffffffL +}; +static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec5 = { + 0x0L, 0xbfff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec6 = { + 0x3000L, 0xffff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec7 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L +}; +static final long[] jjbitVec8 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffL +}; +static final long[] jjbitVec9 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffffL +}; +static final long[] jjbitVec10 = { + 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec11 = { + 0xffffffffffffffffL, 0xbfffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec12 = { + 0x8000000000003000L, 0xffff000000000001L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int strKind = jjmatchedKind; + int strPos = jjmatchedPos; + int seenUpto; + input_stream.backup(seenUpto = curPos + 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error"); } + curPos = 0; + int startsAt = 0; + jjnewStateCnt = 74; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + } + else if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + else if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + else if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + else if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + else if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + if (curChar == 34) + jjCheckNAddStates(13, 15); + else if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 1: + if ((0x8400000000L & l) != 0L && kind > 15) + kind = 15; + break; + case 2: + if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 3: + if ((0xffffff7fffffdbffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 5: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 6: + if (curChar == 39 && kind > 16) + kind = 16; + break; + case 7: + if (curChar == 34) + jjCheckNAddStates(13, 15); + break; + case 8: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 10: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 11: + if (curChar == 34 && kind > 17) + kind = 17; + break; + case 12: + if (curChar == 39) + jjCheckNAddStates(19, 22); + break; + case 13: + case 17: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 15: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 16: + case 19: + if (curChar == 39) + jjCheckNAdd(17); + break; + case 18: + if (curChar == 39) + jjAddStates(23, 24); + break; + case 20: + if (curChar == 39 && kind > 18) + kind = 18; + break; + case 21: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 23: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 34) + jjCheckNAddStates(25, 28); + break; + case 25: + case 29: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 27: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 28: + case 31: + if (curChar == 34) + jjCheckNAdd(29); + break; + case 30: + if (curChar == 34) + jjAddStates(29, 30); + break; + case 32: + if (curChar == 34 && kind > 19) + kind = 19; + break; + case 33: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 34: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 35: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + break; + case 36: + if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + break; + case 37: + if ((0xaffffffa00000000L & l) != 0L) + jjCheckNAddTwoStates(37, 38); + break; + case 38: + if (curChar == 62 && kind > 21) + kind = 21; + break; + case 39: + if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 40: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x3ff200000000000L & l) != 0L && kind > 22) + kind = 22; + break; + case 46: + if (curChar == 45) + jjCheckNAdd(47); + break; + case 47: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 48: + if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + break; + case 49: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(49); + break; + case 50: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(50, 51); + break; + case 51: + if (curChar != 46) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 52: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 53: + if (curChar == 46) + jjCheckNAdd(54); + break; + case 54: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(54); + break; + case 55: + if (curChar == 46) + jjCheckNAdd(56); + break; + case 56: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(56, 57); + break; + case 58: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(59); + break; + case 59: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(59); + break; + case 60: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(31, 34); + break; + case 61: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(61, 62); + break; + case 62: + if (curChar == 46) + jjCheckNAddTwoStates(63, 64); + break; + case 63: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(63, 64); + break; + case 65: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(66); + break; + case 66: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(66); + break; + case 67: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(67, 68); + break; + case 69: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(70); + break; + case 70: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(70); + break; + case 71: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + break; + case 72: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 20) + kind = 20; + jjCheckNAdd(72); + break; + case 73: + if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + if (curChar == 64) + jjCheckNAdd(45); + else if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + else if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 1: + if ((0x14404410144044L & l) != 0L && kind > 15) + kind = 15; + break; + case 3: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 4: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 5: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 8: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 9: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 13: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 14: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 15: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 17: + jjCheckNAddStates(19, 22); + break; + case 25: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 26: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 27: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 29: + jjCheckNAddStates(25, 28); + break; + case 37: + if ((0xc7fffffeafffffffL & l) != 0L) + jjAddStates(35, 36); + break; + case 40: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x7fffffe87fffffeL & l) != 0L && kind > 22) + kind = 22; + break; + case 43: + if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 44: + if (curChar == 64) + jjCheckNAdd(45); + break; + case 45: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(45, 46); + break; + case 47: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 57: + if ((0x2000000020L & l) != 0L) + jjAddStates(37, 38); + break; + case 64: + if ((0x2000000020L & l) != 0L) + jjAddStates(39, 40); + break; + case 68: + if ((0x2000000020L & l) != 0L) + jjAddStates(41, 42); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 3: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(16, 18); + break; + case 8: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(13, 15); + break; + case 13: + case 17: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(19, 22); + break; + case 25: + case 29: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(25, 28); + break; + case 37: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(35, 36); + break; + case 40: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 22) + kind = 22; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 74 - (jjnewStateCnt = startsAt))) + break; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { break; } + } + if (jjmatchedPos > strPos) + return curPos; + + int toRet = Math.max(curPos, seenUpto); + + if (curPos < toRet) + for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; ) + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); } + + if (jjmatchedPos < strPos) + { + jjmatchedKind = strKind; + jjmatchedPos = strPos; + } + else if (jjmatchedPos == strPos && jjmatchedKind > strKind) + jjmatchedKind = strKind; + + return toRet; +} +static final int[] jjnextStates = { + 49, 50, 51, 61, 62, 67, 68, 72, 49, 50, 53, 55, 60, 8, 9, 11, + 3, 4, 6, 13, 14, 16, 18, 19, 21, 25, 26, 28, 30, 31, 33, 61, + 62, 67, 68, 37, 38, 58, 59, 65, 66, 69, 70, +}; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 3: + return ((jjbitVec5[i2] & l2) != 0L); + case 32: + return ((jjbitVec6[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec10[i2] & l2) != 0L); + case 3: + return ((jjbitVec11[i2] & l2) != 0L); + case 32: + return ((jjbitVec12[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +"\156\165\154\154", "\173", "\175", "\133", "\135", "\54", "\72", "\136\136", "\100", null, null, +null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0x7fcff8f81L, +}; +static final long[] jjtoSkip = { + 0x3eL, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[74]; +private final int[] jjstateSet = new int[148]; +protected char curChar; +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 74; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java new file mode 100644 index 00000000000..0db07c051d1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java @@ -0,0 +1,703 @@ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (with java-like unicode escape processing). + */ + + +@SuppressWarnings("all") +public +class JavaCharStream +{ + /** Whether parser is static. */ + +@SuppressWarnings("all") +public static final boolean staticFlag = false; + + static final int hexval(char c) throws java.io.IOException { + switch(c) + { + case '0' : + return 0; + case '1' : + return 1; + case '2' : + return 2; + case '3' : + return 3; + case '4' : + return 4; + case '5' : + return 5; + case '6' : + return 6; + case '7' : + return 7; + case '8' : + return 8; + case '9' : + return 9; + + case 'a' : + case 'A' : + return 10; + case 'b' : + case 'B' : + return 11; + case 'c' : + case 'C' : + return 12; + case 'd' : + case 'D' : + return 13; + case 'e' : + case 'E' : + return 14; + case 'f' : + case 'F' : + return 15; + } + + throw new java.io.IOException(); // Should never come here + } + +/** Position in buffer. */ + +@SuppressWarnings("all") +public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] nextCharBuf; + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int nextCharInd = -1; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, + 4096 - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + if (bufpos != 0) + { + --bufpos; + backup(0); + } + else + { + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + } + + protected char ReadByte() throws java.io.IOException + { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + +/** @return starting character for token. */ + +@SuppressWarnings("all") +public char BeginToken() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + tokenBegin = bufpos; + return buffer[bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + protected void AdjustBuffSize() + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = 0; + available = tokenBegin; + } + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + +@SuppressWarnings("all") +public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + char c; + + if (++bufpos == available) + AdjustBuffSize(); + + if ((buffer[bufpos] = c = ReadByte()) == '\\') + { + UpdateLineColumn(c); + + int backSlashCnt = 1; + + for (;;) // Read all the backslashes + { + if (++bufpos == available) + AdjustBuffSize(); + + try + { + if ((buffer[bufpos] = c = ReadByte()) != '\\') + { + UpdateLineColumn(c); + // found a non-backslash char. + if ((c == 'u') && ((backSlashCnt & 1) == 1)) + { + if (--bufpos < 0) + bufpos = bufsize - 1; + + break; + } + + backup(backSlashCnt); + return '\\'; + } + } + catch(java.io.IOException e) + { + // We are returning one backslash so we should only backup (count-1) + if (backSlashCnt > 1) + backup(backSlashCnt-1); + + return '\\'; + } + + UpdateLineColumn(c); + backSlashCnt++; + } + + // Here, we have seen an odd number of backslash's followed by a 'u' + try + { + while ((c = ReadByte()) == 'u') + ++column; + + buffer[bufpos] = c = (char)(hexval(c) << 12 | + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); + + column += 4; + } + catch(java.io.IOException e) + { + throw new Error("Invalid escape character at line " + line + + " column " + column + "."); + } + + if (backSlashCnt == 1) + return c; + else + { + backup(backSlashCnt - 1); + return '\\'; + } + } + else + { + UpdateLineColumn(c); + return c; + } + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + +@SuppressWarnings("all") +public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + +@SuppressWarnings("all") +public int getLine() { + return bufline[bufpos]; + } + +/** Get end column. */ + +@SuppressWarnings("all") +public int getEndColumn() { + return bufcolumn[bufpos]; + } + +/** Get end line. */ + +@SuppressWarnings("all") +public int getEndLine() { + return bufline[bufpos]; + } + +/** @return column of token start */ + +@SuppressWarnings("all") +public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + +/** @return line number of token start */ + +@SuppressWarnings("all") +public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Retreat. */ + +@SuppressWarnings("all") +public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + + /** @return token image as String */ + +@SuppressWarnings("all") +public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** @return suffix */ + +@SuppressWarnings("all") +public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Set buffers back to null when finished. */ + +@SuppressWarnings("all") +public void Done() + { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + +@SuppressWarnings("all") +public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=2ebc561fdb294979325bb97dfcdf1b61 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java new file mode 100644 index 00000000000..9fff7e2c63a --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java @@ -0,0 +1,205 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=0bd53902852438cd5670da2f50328753 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java new file mode 100644 index 00000000000..3e7793689f3 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java @@ -0,0 +1,149 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=0bb1e7330fe557a4194caa87be20ae38 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java new file mode 100644 index 00000000000..307f2e7efde --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java @@ -0,0 +1,167 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +/* + * 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 org.apache.jena.cdt.parser; + +/** Token Manager Error. */ + +@SuppressWarnings("all") +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=8d2f5d5473ff1b03e240576a846cb262 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e621756f764..d376b2ea921 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,11 +23,15 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; @@ -37,7 +41,6 @@ import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; -import org.apache.jena.sparql.util.NodeFactoryExtra; public class QueryIterUnfold extends QueryIterRepeatApply { @@ -69,174 +72,25 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) - return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) - return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) - return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) - return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( CompositeDatatypeList.uri.equals(dtURI) ) + return unfoldList( n.getLiteral(), inputBinding ); + if ( CompositeDatatypeMap.uri.equals(dtURI) ) + return unfoldMap( n.getLiteral(), inputBinding ); } return QueryIterSingleton.create( inputBinding, getExecContext() ); } - protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - final Iterator itListElmts = parseUntypedList(listAsValue, pmap); + protected QueryIterator unfoldList( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable itListElmts = CompositeDatatypeList.getValue(lit); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - - return parseList(listAsValue, pmap); + protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable> itMapEntries = CompositeDatatypeMap.getValue(lit).entrySet(); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } - protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator itListElmts = parseTypedList(listAsValue, pmap); - return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); - } - - public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { - listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue, pmap); - } - - protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { - if ( mapAsValue.startsWith("{") ) - mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - - return parseMap(mapAsValue, pmap); - } - - protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { - mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); - return parseMap(mapAsValue, pmap); - } - - public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { - final Iterator itListElmts = extractListElements(listAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itListElmts.hasNext(); - } - - @Override - public Node next() { - final String listElmt = itListElmts.next(); - final Node n; - if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); - else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - n = NodeFactoryExtra.parseNode(listElmt, pmap); - else - n = NodeFactoryExtra.parseNode(listElmt); - return n; - } - }; - } - - public static Iterator extractListElements(String listAsValue) { - listAsValue = listAsValue.strip(); - - if ( listAsValue.isEmpty() ) { - return new Iterator() { - @Override public boolean hasNext() { return false; } - @Override public String next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new ListElementExtractor(listAsValue); - } - - public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { - final Iterator> itMapElmts = extractMapElements(mapAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itMapElmts.hasNext(); - } - - @Override - public Map.Entry next() { - final Map.Entry mapElmt = itMapElmts.next(); - final String keyAsString = mapElmt.getKey(); - final String valueAsString = mapElmt.getValue(); - - final Node keyAsNode; - if ( pmap != null ) - keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); - else - keyAsNode = NodeFactoryExtra.parseNode(keyAsString); - - final Node valueAsNode; - if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); - else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); - else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); - else - valueAsNode = NodeFactoryExtra.parseNode(valueAsString); - - return new Map.Entry<>() { - @Override public Node getKey() { return keyAsNode; } - @Override public Node getValue() { return valueAsNode; } - @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } - }; - } - }; - } - - public static Iterator> extractMapElements(String mapAsValue) { - mapAsValue = mapAsValue.strip(); - - if ( mapAsValue.isEmpty() ) { - return new Iterator>() { - @Override public boolean hasNext() { return false; } - @Override public Map.Entry next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new MapElementExtractor(mapAsValue); - } protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { @@ -248,6 +102,10 @@ protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.itElmts = itElmts; } + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterable itElmts) { + this( inputBinding, itElmts.iterator() ); + } + @Override protected boolean hasNextBinding() { return itElmts.hasNext(); } @@ -259,9 +117,13 @@ protected void closeIterator() { } // nothing to do really } - protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); + } - public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterable itListElmts) { super(inputBinding, itListElmts); } @@ -272,14 +134,40 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itElmts.next() ); + final CDTValue nextElmt = itElmts.next(); + + if ( nextElmt.isNull() ) { + return inputBinding; + } + + final Node value; + if ( nextElmt.isNode() ) { + value = nextElmt.asNode(); + } + else if ( nextElmt.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); + value = NodeFactory.createLiteral(lit); + } + else if ( nextElmt.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); + value = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, value); } } - protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); + } - public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterable> itMapElmts) { super(inputBinding, itMapElmts); } @@ -290,11 +178,39 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - final Map.Entry elmt = itElmts.next(); - if ( var2 == null ) - return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); - else - return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + final Map.Entry elmt = itElmts.next(); + final CDTKey key = elmt.getKey(); + final CDTValue value = elmt.getValue(); + + final Node keyNode; + if ( key.isNode() ) { + keyNode = key.asNode(); + } + else { + throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); + } + + if ( value.isNull() ) { + return BindingFactory.binding( inputBinding, var1, keyNode ); + } + + final Node valueNode; + if ( value.isNode() ) { + valueNode = value.asNode(); + } + else if ( value.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( value.asList() ); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( value.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); + valueNode = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 337d034c01f..93f9a3fb87e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -1,26 +1,25 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.riot.system.PrefixMap; -import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; -import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; @@ -28,114 +27,43 @@ public class AggFold extends AggregatorBase { - protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); - - protected final Expr expr1; // While the values of these member variables - protected final Expr expr2; // can also be extracted from the ExprList (see - protected final Node typeIRI1; // createExprList below), keeping these copies - protected final Node typeIRI2; // here makes it easier to access these values. + protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see + protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. public AggFold( final Expr expr1 ) { - this(expr1, null, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1 ) { - this(expr1, typeIRI1, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { - this(expr1, typeIRI1, expr2, null); + this(expr1, null); } public AggFold( final Expr expr1, final Expr expr2 ) { - this(expr1, null, expr2, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { - super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; - this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } - protected static ExprList createExprList( final Expr expr1, final String typeIRI1, - final Expr expr2, final String typeIRI2 ) { + protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { final ExprList l = new ExprList(expr1); - if ( typeIRI1 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI1) ); - } - if ( expr2 != null ) { l.add(expr2); } - if ( typeIRI2 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI2) ); - } - return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 6 ) + if ( exprs.size() < 1 || exprs.size() > 2 ) throw new IllegalArgumentException(); final Iterator it = exprs.iterator(); final Expr _expr1 = it.next(); - final Expr _expr2; - final String _typeIRI1; - final String _typeIRI2; - Expr lookAhead = it.hasNext() ? it.next() : null; - // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI1 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI1 = null; - } - // _expr2 - if ( lookAhead != null ) { - _expr2 = lookAhead; - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _expr2 = null; - } + final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI2 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI2 = null; - } - - if ( lookAhead != null ) { - throw new IllegalArgumentException(); - } - - return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + return new AggFold(_expr1, _expr2); } @Override @@ -172,29 +100,17 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { - final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); - final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI1, pmap) ); - } - if ( expr2 != null ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI2, pmap) ); - } - out.append(")"); return out.asString(); } @@ -208,161 +124,71 @@ public String toPrefixString() { WriterExpr.output(out, expr1, null); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( typeIRI1.toString() ); - } - if ( expr2 != null ) { out.append(", "); WriterExpr.output(out, expr2, null); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( typeIRI2.toString() ); - } - out.decIndent(); out.append(")"); return out.asString(); } protected class ListAccumulator implements Accumulator { - final protected List list = new ArrayList<>(); + final protected List list = new ArrayList<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v; final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) { - final Node n = nv.asNode(); - if ( typeIRI1 != null ) { // check the type of the node - final String nTypeIRI; - if ( n.isLiteral() ) - nTypeIRI = n.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the node if it is not of the expected type - } - list.add(n); + if ( nv == null ) { + v = CDTFactory.getNullValue(); + } + else { + v = CDTFactory.createValue( nv.asNode() ); } + + list.add(v); } @Override public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); - } - } - sb.append("]"); - - final RDFDatatype datatype; - if ( typeIRI1 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = Node_LiteralWithList.datatypeTypedList; - } - else { - datatype = Node_LiteralWithList.datatypeUntypedList; - } - - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + final LiteralLabelForList lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } protected class MapAccumulator implements Accumulator { - final protected List keys = new ArrayList<>(); - final protected List values = new ArrayList<>(); + final protected Map map = new HashMap<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( nvKey != null && nvValue != null ) { - final Node key = nvKey.asNode(); - final Node value = nvValue.asNode(); - - if ( typeIRI1 != null ) { // check the type of the key - final String nTypeIRI; - if ( key.isLiteral() ) - nTypeIRI = key.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the key is not of the expected type - } - - if ( typeIRI2 != null ) { // check the type of the value - final String nTypeIRI; - if ( value.isLiteral() ) - nTypeIRI = value.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI2.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the value is not of the expected type - } - - keys.add(key); - values.add(value); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nvKey == null ) { + return; // ignore if creating the key using the given binding failed } - } - @Override - public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("{"); - if ( ! keys.isEmpty() ) { - final Iterator it = keys.iterator(); - final Iterator it2 = values.iterator(); - final Node firstKey = it.next(); - final Node firstValue = it2.next(); - final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); - final String firstValueAsString = NodeFmtLib.strTTL(firstValue); - sb.append(firstKeyAsString); - sb.append(" : "); - sb.append(firstValueAsString); - while ( it.hasNext() ) { - final Node nextKey = it.next(); - final Node nextValue = it2.next(); - final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); - final String nextValueAsString = NodeFmtLib.strTTL(nextValue); - sb.append(", "); - sb.append(nextKeyAsString); - sb.append(" : "); - sb.append(nextValueAsString); - } - } - sb.append("}"); - - final RDFDatatype datatype; - if ( typeIRI1 != null || typeIRI2 != null ) { - sb.append("^^"); - if ( typeIRI1 != null ) { - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - } - if ( typeIRI2 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI2) ); - } - datatype = Node_LiteralWithMap.datatypeTypedMap; + final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); + + // TODO: what do we do if the map already contains an entry with the same key? + + final CDTValue value; + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvValue == null ) { + value = CDTFactory.getNullValue(); } else { - datatype = Node_LiteralWithMap.datatypeUntypedMap; + value = CDTFactory.createValue( nvValue.asNode() ); } - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + map.put(key, value); + } + + @Override + public NodeValue getValue() { + final LiteralLabelForMap lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index a7a81aa8729..d11f16dfde9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,8 +71,8 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { - return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + public static Aggregator createFold(Expr expr1, Expr expr2) { + return new AggFold(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index b9d1b3a6c79..c950980ac3c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,14 +1,15 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; -import java.util.NoSuchElementException; +import java.util.ArrayList; +import java.util.List; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -17,71 +18,40 @@ public class ConcatFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final String list1AsString = getInputListAsString(v1); - final String list2AsString = getInputListAsString(v2); -System.out.println("list1AsString " + list1AsString); -System.out.println("list2AsString " + list2AsString); - return createResultList(list1AsString, list2AsString); - } - - protected String getInputListAsString( final NodeValue v ) { - final Node n = v.asNode(); - - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + v); - - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - throw new ExprEvalException("Literal with wrong datatype: " + v); - } - - return n.getLiteralLexicalForm(); - } + final List list1 = getInputList(v1); + final List list2 = getInputList(v2); - protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { - final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; + final List result = new ArrayList<>(); + result.addAll(list1); + result.addAll(list2); -System.out.println("resultListAsString " + resultListAsString); - final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } - protected String createResultListAsString( final String list1AsString, final String list2AsString ) { - final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); - final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); - final Iterator it = new ConcatenatingIterator(it1, it2); + protected List getInputList( final NodeValue nv ) { + final Node n = nv.asNode(); - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( it.hasNext() ) { - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + return CompositeDatatypeList.parseList(lex); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); } } - sb.append("]"); - - return sb.toString(); - } - - protected static class ConcatenatingIterator implements Iterator { - protected final Iterator it1; - protected final Iterator it2; - public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } - @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } - @Override public T next() { - if ( it1.hasNext() ) - return it1.next(); - else if ( it2.hasNext() ) - return it2.next(); - else - throw new NoSuchElementException(); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 982d6b8e5a6..b4f76e2565f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -1,11 +1,12 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; - +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -19,54 +20,33 @@ public NodeValue exec( final NodeValue nv ) { if ( ! n.isLiteral() ) throw new ExprEvalException("Not a literal: " + nv); - final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { - size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { - size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { - size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + size = ( (LiteralLabelForList) lit ).getValue().size(); + } + else if ( lit instanceof LiteralLabelForMap ) { + size = ( (LiteralLabelForMap) lit ).getValue().size(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeList.parseList(lex).size(); + } + else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeMap.parseMap(lex).size(); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } return NodeValue.makeInteger(size); } - protected int determineSizeOfUntypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfUntypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineNumberOfElements( final Iterator it ) { - int i = 0; - while ( it.hasNext() ) { - i++; - it.next(); - } - return i; - } - } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index d41d73698d1..6ff84fa6625 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -5951,42 +5951,22 @@ final public Expr Aggregate() throws ParseException { break; case FOLD: t = jj_consume_token(FOLD); - String typeIRI1 = null ; - String typeIRI2 = null ; Expr orderByExpr = null ; Var orderByVar = null ; int orderByDirection = Query.ORDER_DEFAULT ; jj_consume_token(LPAREN); expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TYPE: - jj_consume_token(TYPE); - typeIRI1 = iri(); - break; - default: - jj_la1[182] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TYPE: - jj_consume_token(TYPE); - typeIRI2 = iri(); - break; - default: - jj_la1[183] = jj_gen; - ; - } break; default: - jj_la1[184] = jj_gen; + jj_la1[182] = jj_gen; ; } jj_consume_token(RPAREN); - agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; + agg = AggregatorFactory.createFold(expr, expr2) ; break; case AGG: t = jj_consume_token(AGG); @@ -5997,7 +5977,7 @@ final public Expr Aggregate() throws ParseException { agg = AggregatorFactory.createCustom(iri, a) ; break; default: - jj_la1[185] = jj_gen; + jj_la1[183] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6020,7 +6000,7 @@ final public Expr iriOrFunction() throws ParseException { a = ArgList(); break; default: - jj_la1[186] = jj_gen; + jj_la1[184] = jj_gen; ; } if ( a == null ) @@ -6053,13 +6033,13 @@ final public Node RDFLiteral() throws ParseException { uri = iri(); break; default: - jj_la1[187] = jj_gen; + jj_la1[185] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[188] = jj_gen; + jj_la1[186] = jj_gen; ; } {if (true) return createLiteral(lex, lang, uri) ;} @@ -6085,7 +6065,7 @@ final public Node NumericLiteral() throws ParseException { n = NumericLiteralNegative(); break; default: - jj_la1[189] = jj_gen; + jj_la1[187] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6109,7 +6089,7 @@ final public Node NumericLiteralUnsigned() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[190] = jj_gen; + jj_la1[188] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6132,7 +6112,7 @@ final public Node NumericLiteralPositive() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[191] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6155,7 +6135,7 @@ final public Node NumericLiteralNegative() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[192] = jj_gen; + jj_la1[190] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6173,7 +6153,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE ;} break; default: - jj_la1[193] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6200,7 +6180,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[194] = jj_gen; + jj_la1[192] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6223,7 +6203,7 @@ final public String iri() throws ParseException { {if (true) return iri ;} break; default: - jj_la1[195] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6242,7 +6222,7 @@ final public String PrefixedName() throws ParseException { {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; default: - jj_la1[196] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6261,7 +6241,7 @@ final public Node BlankNode() throws ParseException { {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; default: - jj_la1[197] = jj_gen; + jj_la1[195] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6395,33 +6375,33 @@ private boolean jj_3_2() { if (jj_3R_44()) return true; Token xsp; xsp = jj_scanpos; + if (jj_scan_token(147)) { + jj_scanpos = xsp; if (jj_scan_token(148)) { jj_scanpos = xsp; - if (jj_scan_token(149)) { + if (jj_scan_token(155)) { jj_scanpos = xsp; - if (jj_scan_token(156)) { + if (jj_scan_token(150)) { jj_scanpos = xsp; if (jj_scan_token(151)) { jj_scanpos = xsp; if (jj_scan_token(152)) { jj_scanpos = xsp; - if (jj_scan_token(153)) { + if (jj_scan_token(149)) { jj_scanpos = xsp; - if (jj_scan_token(150)) { + if (jj_scan_token(160)) { jj_scanpos = xsp; - if (jj_scan_token(161)) { + if (jj_scan_token(143)) { jj_scanpos = xsp; - if (jj_scan_token(144)) { + if (jj_scan_token(142)) { jj_scanpos = xsp; - if (jj_scan_token(143)) { + if (jj_scan_token(161)) { jj_scanpos = xsp; - if (jj_scan_token(162)) { + if (jj_scan_token(144)) { jj_scanpos = xsp; if (jj_scan_token(145)) { jj_scanpos = xsp; - if (jj_scan_token(146)) { - jj_scanpos = xsp; - if (jj_scan_token(147)) return true; + if (jj_scan_token(146)) return true; } } } @@ -7073,6 +7053,12 @@ private boolean jj_3R_144() { return false; } + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_45()) return true; + return false; + } + private boolean jj_3R_174() { Token xsp; xsp = jj_scanpos; @@ -7089,12 +7075,6 @@ private boolean jj_3R_174() { return false; } - private boolean jj_3_3() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_45()) return true; - return false; - } - private boolean jj_3R_179() { if (jj_scan_token(FALSE)) return true; return false; @@ -7294,12 +7274,6 @@ private boolean jj_3R_161() { return false; } - private boolean jj_3R_142() { - if (jj_scan_token(AGG)) return true; - if (jj_3R_152()) return true; - return false; - } - private boolean jj_3R_45() { Token xsp; xsp = jj_scanpos; @@ -7325,6 +7299,12 @@ private boolean jj_3R_155() { return false; } + private boolean jj_3R_142() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_152()) return true; + return false; + } + private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; if (jj_3R_45()) return true; @@ -7399,7 +7379,7 @@ private boolean jj_3R_145() { private boolean jj_3R_116() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(186)) { + if (jj_scan_token(185)) { jj_scanpos = xsp; if (jj_3R_143()) return true; } @@ -7613,7 +7593,7 @@ private boolean jj_3R_117() { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[198]; + final private int[] jj_la1 = new int[196]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -7633,28 +7613,28 @@ private boolean jj_3R_117() { jj_la1_init_7(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0xfcbdb7ff,0xfcbdb7ff,0xfcbdb7ff,0x0,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000000,0x3000000,0x0,0x3000000,0x3000000,0x0,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0xfcbdb7ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x800,0x0,0x37ff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x3eff,0x3eff,0x3eff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0xeff,0x0,0xeff,0xeff,0xeff,0x0,0xeff,0xeff,0x0,0x0,0x0,0x0,0x0,0x13ff8000,0x13ff8000,0x8000000,0x20000000,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x8000000,0x0,0x8000,0x18000,0x0,0x0,0x0,0x80000000,0x80000000,0x3000,0x0,0x0,0x3000,0x3000,0x3000,0x0,0x0,0x3000,0x0,0x3000,0x0,0x0,0x3000,0x0,0x0,0x3000,0x3000,0x0,0x0,0x8000000,0x0,0x3000,0x0,0x0,0x0,0x3000,0x0,0x3000,0x0,0x0,0xeff,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0x0,0x0,0x3000,0x3000,0x3000,0x0,0x3000,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3eff,0x3eff,0x3000,0x0,0x0,0x0,0x0,0xeff,0x0,0x0,0x0,0x0,0x3eff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x0,0x0,0x0,0x0,}; + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf01ff0,0x0,0x1f01ff0,0x1f01ff0,0x1f01ff0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0xf01ff0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x1000000,0x1000000,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0xa5f01ff0,0xa5f01ff0,0x8000000,0x0,0xa5f01ff0,0x0,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0x8000000,0x0,0xa5f01ff0,0xa5f01ff0,0x0,0x8000000,0x0,0x5000000,0xf01ff0,0x0,0x5000000,0x5000000,0xf01ff0,0x5000000,0xf01ff0,0x0,0x0,0x1000000,0x0,0x0,0x5000000,0x0,0x5000000,0x0,0xa5f01ff0,0x0,0x0,0x0,0x0,0x0,0xa5f01ff0,0x1000000,0x1000000,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x8000000,0x1000000,0x10000010,0x10000000,0x10,0x8000000,0x1000000,0x0,0x0,0x1000000,0x0,0x0,0x21000000,0x21000000,0xa5f01ff0,0xa5f01ff0,0x0,0x0,0xa5f01ff0,0xa5f01ff0,0x84f01ff0,0x0,0xf01ff0,0x0,0x80000000,0x0,0x84f01ff0,0x0,0x0,0x0,0x0,0x1f80,0x1f80,0x0,0x0,0x1f80,0x0,0x0,0x1f01ff0,0x1f01ff0,0xf01ff0,0x0,0x0,0x5000000,0x0,0x0,0x0,0x0,0x0,0x0,0x1f01ff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x5000000,0x0,0x0,0x1ff0,0x70,0x380,0x1c00,0x0,0xf00000,0x0,0x0,0x80000000,}; + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; } private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x4,0x400,0x400,0x400,0x0,0x4,0x400,0x0,0x400,0x4,0x0,0x400,0x0,0x4,0x400,0x400,0x4,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x400,0x0,0x400,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x0,0x4,0x400,0x0,0x1,0x0,0x0,0x2,0x400,0x4002000,0x4002000,0x1,0x4002000,0x4002000,0x2,0x2000000,0x4200000,0x4200000,0x20140000,0x4002000,0x0,0x2,0x140002,0x20140000,0x2000,0x2000000,0x4000000,0x4000000,0x0,0x4000000,0x0,0x0,0x400,0x400,0x800,0x800,0x400,0x400,0x400,0x0,0x400,0x0,0x0,0x0,0x0,0x10000,0x20000,0x1f8,0x1f8,0xc0000,0x0,0x300000,0x300000,0xc0000,0x300000,0x300000,0xc2400,0x400,0x400,0x2,0x2,0x0,0x2,0x0,0x2,0x2,0x2,0x0,0x1c2400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; @@ -7671,7 +7651,7 @@ public ARQParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7686,7 +7666,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7697,7 +7677,7 @@ public ARQParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7708,7 +7688,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7718,7 +7698,7 @@ public ARQParser(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7728,7 +7708,7 @@ public void ReInit(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 198; i++) jj_la1[i] = -1; + for (int i = 0; i < 196; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7843,12 +7823,12 @@ private void jj_add_error_token(int kind, int pos) { /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); - boolean[] la1tokens = new boolean[234]; + boolean[] la1tokens = new boolean[233]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 198; i++) { + for (int i = 0; i < 196; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< 164) - kind = 164; + if (kind > 163) + kind = 163; jjCheckNAddStates(0, 6); } else if (curChar == 45) @@ -2748,8 +2738,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 57; break; case 65: - if ((0x8400000000L & l) != 0L && kind > 176) - kind = 176; + if ((0x8400000000L & l) != 0L && kind > 175) + kind = 175; break; case 66: if (curChar == 39) @@ -2760,8 +2750,8 @@ else if (curChar == 39) jjCheckNAddStates(37, 39); break; case 68: - if (curChar == 39 && kind > 180) - kind = 180; + if (curChar == 39 && kind > 179) + kind = 179; break; case 70: if ((0x8400000000L & l) != 0L) @@ -2817,8 +2807,8 @@ else if (curChar == 39) jjCheckNAddStates(34, 36); break; case 86: - if (curChar == 34 && kind > 181) - kind = 181; + if (curChar == 34 && kind > 180) + kind = 180; break; case 88: if ((0x8400000000L & l) != 0L) @@ -2928,8 +2918,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 121; break; case 122: - if (curChar == 39 && kind > 182) - kind = 182; + if (curChar == 39 && kind > 181) + kind = 181; break; case 123: if (curChar == 39) @@ -3006,8 +2996,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 145; break; case 146: - if (curChar == 34 && kind > 183) - kind = 183; + if (curChar == 34 && kind > 182) + kind = 182; break; case 147: if (curChar == 34) @@ -3042,8 +3032,8 @@ else if (curChar == 39) jjCheckNAddStates(21, 23); break; case 155: - if (curChar == 41 && kind > 186) - kind = 186; + if (curChar == 41 && kind > 185) + kind = 185; break; case 156: if (curChar == 10) @@ -3224,15 +3214,15 @@ else if (curChar == 39) case 236: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; + if (kind > 163) + kind = 163; jjCheckNAddStates(0, 6); break; case 237: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; + if (kind > 163) + kind = 163; jjCheckNAdd(237); break; case 238: @@ -3246,8 +3236,8 @@ else if (curChar == 39) case 240: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; + if (kind > 164) + kind = 164; jjCheckNAdd(240); break; case 241: @@ -3269,8 +3259,8 @@ else if (curChar == 39) case 246: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; + if (kind > 165) + kind = 165; jjCheckNAdd(246); break; case 247: @@ -3284,8 +3274,8 @@ else if (curChar == 39) case 250: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; + if (kind > 165) + kind = 165; jjCheckNAdd(250); break; case 251: @@ -3303,8 +3293,8 @@ else if (curChar == 39) case 255: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; + if (kind > 165) + kind = 165; jjCheckNAdd(255); break; case 256: @@ -3314,8 +3304,8 @@ else if (curChar == 39) case 257: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; + if (kind > 166) + kind = 166; jjCheckNAdd(257); break; case 258: @@ -3329,8 +3319,8 @@ else if (curChar == 39) case 260: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; + if (kind > 167) + kind = 167; jjCheckNAdd(260); break; case 261: @@ -3348,8 +3338,8 @@ else if (curChar == 39) case 265: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; + if (kind > 168) + kind = 168; jjCheckNAdd(265); break; case 266: @@ -3375,8 +3365,8 @@ else if (curChar == 39) case 272: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; + if (kind > 168) + kind = 168; jjCheckNAdd(272); break; case 273: @@ -3390,8 +3380,8 @@ else if (curChar == 39) case 276: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; + if (kind > 168) + kind = 168; jjCheckNAdd(276); break; case 277: @@ -3401,8 +3391,8 @@ else if (curChar == 39) case 278: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; + if (kind > 169) + kind = 169; jjCheckNAdd(278); break; case 279: @@ -3416,8 +3406,8 @@ else if (curChar == 39) case 281: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; + if (kind > 170) + kind = 170; jjCheckNAdd(281); break; case 282: @@ -3435,8 +3425,8 @@ else if (curChar == 39) case 286: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 172) - kind = 172; + if (kind > 171) + kind = 171; jjCheckNAdd(286); break; case 287: @@ -3462,8 +3452,8 @@ else if (curChar == 39) case 293: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 172) - kind = 172; + if (kind > 171) + kind = 171; jjCheckNAdd(293); break; case 294: @@ -3477,8 +3467,8 @@ else if (curChar == 39) case 297: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 172) - kind = 172; + if (kind > 171) + kind = 171; jjCheckNAdd(297); break; default : break; @@ -3631,8 +3621,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(45, 50); break; case 53: - if ((0x200000002L & l) != 0L && kind > 145) - kind = 145; + if ((0x200000002L & l) != 0L && kind > 144) + kind = 144; break; case 54: if ((0x10000000100000L & l) != 0L) @@ -3671,8 +3661,8 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 65; break; case 65: - if ((0x14404410000000L & l) != 0L && kind > 176) - kind = 176; + if ((0x14404410000000L & l) != 0L && kind > 175) + kind = 175; break; case 67: if ((0xffffffffefffffffL & l) != 0L) @@ -3929,8 +3919,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(72, 77); break; case 163: - if (curChar == 93 && kind > 191) - kind = 191; + if (curChar == 93 && kind > 190) + kind = 190; break; case 166: if ((0x7fffffe07fffffeL & l) != 0L) @@ -4029,8 +4019,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(94, 99); break; case 210: - if ((0x200000002L & l) != 0L && kind > 146) - kind = 146; + if ((0x200000002L & l) != 0L && kind > 145) + kind = 145; break; case 211: if ((0x10000000100000L & l) != 0L) @@ -4068,8 +4058,8 @@ else if ((0x20000000200L & l) != 0L) jjCheckNAddStates(103, 108); break; case 225: - if ((0x2000000020L & l) != 0L && kind > 147) - kind = 147; + if ((0x2000000020L & l) != 0L && kind > 146) + kind = 146; break; case 226: if ((0x4000000040000L & l) != 0L) @@ -4773,8 +4763,8 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", -"\54", "\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", +null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", +"\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", "\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", "\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, null, null, null, null, null, null, null, null, null, null, null, }; @@ -4784,7 +4774,7 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l "DEFAULT", }; static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfff11ff7ffffffffL, 0x3fffffffL, + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfff88ffbffffffffL, 0x1fffffffL, }; static final long[] jjtoSkip = { 0x7eL, 0x0L, 0x0L, 0x0L, diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java deleted file mode 100644 index 37cb8ca1f3e..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithList extends Node_Literal -{ - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - - public Node_LiteralWithList( final LiteralLabel label ) { - super(label); - } - - -} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java deleted file mode 100644 index 27d5bef8656..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithMap extends Node_Literal -{ - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - public Node_LiteralWithMap( final LiteralLabel label ) { - super(label); - } - -} From ec8a76ed869c0b63f3af3f760518592367b2fd83 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 11:14:29 +0100 Subject: [PATCH 016/323] updating the URI prefix 'cdt:' --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- .../src/main/java/org/apache/jena/sparql/ARQConstants.java | 3 +++ .../library/collection/CollectionLiteralFunctions.java | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 9c43f8978c9..8c1ac8b74de 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -27,7 +27,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 4c71bd18569..a148cc166e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -9,7 +9,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index 08e1d906855..af978795a34 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -77,6 +77,9 @@ public class ARQConstants /** URI scheme that triggers the loader to load a java class */ public static final String javaClassURIScheme = "java:" ; + /** The ARQ function library URI space */ + public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 5beaeec3aa8..fe5f8956bf8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,7 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } } From 9b6967c43308725faf779cfc0dbd3cba910d3131 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 13:09:21 +0100 Subject: [PATCH 017/323] adds the constructor function cdt:List --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/ListFct.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index fe5f8956bf8..98a1e89e37c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,6 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java new file mode 100644 index 00000000000..420ab788576 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -0,0 +1,37 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class ListFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + // nothing to do here + } + + @Override + public NodeValue exec( final List args ) { + final List list = new ArrayList<>( args.size() ); + + for ( final NodeValue nv : args ) { + final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 3f5b140c9572073aeeadf433be30875696b18ff1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 16:16:18 +0100 Subject: [PATCH 018/323] adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL --- .../apache/jena/sparql/expr/NodeValue.java | 21 +++++++++++++++++++ .../sparql/expr/ValueSpaceClassification.java | 3 +++ 2 files changed, 24 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 41ecb541325..c33e25edd8e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -34,6 +34,8 @@ import org.apache.jena.atlas.lib.DateTimeUtils ; import org.apache.jena.atlas.lib.StrUtils ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.cdt.CompositeDatatypeList ; +import org.apache.jena.cdt.CompositeDatatypeMap ; import org.apache.jena.datatypes.DatatypeFormatException ; import org.apache.jena.datatypes.RDFDatatype ; import org.apache.jena.datatypes.TypeMapper ; @@ -533,6 +535,19 @@ && nSameAs(t1.getPredicate(), t2.getPredicate()) if ( ! SystemARQ.ValueExtensions && ( nv1.isLiteral() && nv2.isLiteral() ) ) raise(new ExprEvalException("Incompatible: "+nv1+" and "+nv2)) ; return false ; + + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeList.type.isEqual(lit1, lit2) ; + } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; + } } throw new ARQInternalErrorException("sameValueAs failure "+nv1+" and "+nv2) ; @@ -856,6 +871,12 @@ private static ValueSpaceClassification classifyValueSpace(NodeValue nv) if ( nv.isSortKey() ) return VSPACE_SORTKEY ; + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; + if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; + } + if ( NodeUtils.hasLang(nv.asNode()) ) return VSPACE_LANG ; return VSPACE_UNKNOWN ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpaceClassification.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpaceClassification.java index e3c403f5e6a..d27f6d7b0d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpaceClassification.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpaceClassification.java @@ -35,6 +35,9 @@ public enum ValueSpaceClassification { VSPACE_G_MONTH, VSPACE_G_DAY, + VSPACE_CDT_LIST, + VSPACE_CDT_MAP, + VSPACE_STRING, VSPACE_LANG, VSPACE_SORTKEY, VSPACE_BOOLEAN, VSPACE_UNKNOWN, From c9f5d11e46fdaa474313fe970c7696619c443ed2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 21:19:37 +0100 Subject: [PATCH 019/323] correct recursive implementation of 'equals' in 'CDTValue' --- .../main/java/org/apache/jena/cdt/CDTKey.java | 8 +- .../java/org/apache/jena/cdt/CDTValue.java | 83 ++++++++++++++++--- .../jena/cdt/CompositeDatatypeList.java | 25 +++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 20 +++++ 4 files changed, 120 insertions(+), 16 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 32c455d1810..53f4246c1a1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -42,12 +42,12 @@ public Node asNode() { @Override public boolean equals( final Object other ) { - if ( !(other instanceof CDTKey) ) { - return false; + if ( other instanceof CDTKey ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); } - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + return false; } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index e0bd1443def..5d2dcd70394 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -21,6 +21,9 @@ import java.util.List; import java.util.Map; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; + public abstract class CDTValue extends CDTKey { /** @@ -64,6 +67,10 @@ public Map asMap() { @Override public final boolean equals( final Object other ) { + if ( isNull() ) { + return false; + } + if ( !(other instanceof CDTValue) ) { if ( other instanceof CDTKey && isNode() ) { final CDTKey otherKey = (CDTKey) other; @@ -74,27 +81,81 @@ public final boolean equals( final Object other ) { } } - if ( isNull() ) { + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) return false; + + if ( isNode() ) return isEqual( asNode(), otherValue ); + + if ( isList() ) return isEqual( asList(), otherValue ); + + if ( isMap() ) return isEqual( asMap(), otherValue ); + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + + public static boolean isEqual( final Node n1, final CDTValue v2 ) { + if ( CompositeDatatypeList.isListLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isList() ) { + return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); + } + return false; } - final CDTValue otherValue = (CDTValue) other; + if ( CompositeDatatypeMap.isMapLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isMap() ) { + return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + } - if ( otherValue.isNull() ) { return false; } - if ( isNode() && otherValue.isNode() ) { - return asNode().equals( otherValue.asNode() ); + if ( v2.isNode() ) { + return v2.asNode().equals(n1); } - else if ( isList() && otherValue.isList() ) { - return asList().equals( otherValue.asList() ); + + return false; + } + + public static boolean isEqual( final List list1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.getValue(lit2).equals(list1); } - else if ( isMap() && otherValue.isMap() ) { - return asMap().equals( otherValue.asMap() ); + + if ( v2.isList() ) { + return v2.asList().equals(list1); } - else { - return false; + + return false; + } + + public static boolean isEqual( final Map map1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeMap.getValue(lit2).equals(map1); } + + if ( v2.isMap() ) { + return v2.asMap().equals(map1); + } + + return false; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 8c1ac8b74de..15ff18434f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -150,11 +151,33 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - +System.out.println("list1"); +System.out.println(list1); +System.out.println("list2"); +System.out.println(list2); return list1.equals(list2); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index a148cc166e2..784cf6bfaf4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -4,6 +4,7 @@ import java.util.Map; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -144,6 +145,25 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Map map1 = getValue(value1); From a18ac70e196ce965f5609c33d6d2f7d34ae76c82 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 09:46:50 +0100 Subject: [PATCH 020/323] adds the cdt:contains function --- .../main/java/org/apache/jena/cdt/CDTKey.java | 6 +- .../java/org/apache/jena/cdt/CDTValue.java | 5 +- .../apache/jena/cdt/ParserForCDTLiterals.java | 33 ++--- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsFct.java | 130 ++++++++++++++++++ 5 files changed, 155 insertions(+), 20 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 53f4246c1a1..d42794c877b 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -44,7 +45,10 @@ public Node asNode() { public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + + final NodeValue thisNV = NodeValue.makeNode( asNode() ); + final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); + return NodeValue.sameAs(thisNV, otherNV); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5d2dcd70394..5dd74a0bce6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -23,6 +23,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTValue extends CDTKey { @@ -126,7 +127,9 @@ public static boolean isEqual( final Node n1, final CDTValue v2 ) { } if ( v2.isNode() ) { - return v2.asNode().equals(n1); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + return NodeValue.sameAs(nv1, nv2); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 844bca2ed49..645cfa15a38 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -27,6 +27,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.graph.Node; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -73,16 +74,14 @@ public static List parseListLiteral( final Reader reader, final boolea if ( recursive && ! list.isEmpty() ) { for ( int i = 0; i < list.size(); i++ ) { final CDTValue v = list.get(i); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -133,18 +132,16 @@ public static Map parseMapLiteral( final Reader reader, final b if ( recursive && ! map.isEmpty() ) { for ( final CDTKey key : map.keySet() ) { final CDTValue v = map.get(key); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); - map.put( key, CDTFactory.createValue(subMap) ); - } - else if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } } } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 98a1e89e37c..afa7c7e2f77 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -8,5 +8,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java new file mode 100644 index 00000000000..a940b91bf33 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -0,0 +1,130 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + final Node n2 = nv2.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + final boolean result; + if ( CompositeDatatypeList.isListLiteral(n2) ) { + result = containsList( list, n2.getLiteral() ); + } + else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { + result = containsMap( list, n2.getLiteral() ); + } + else { + result = containsNode( list, nv2 ); + } + + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term, assuming + * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + */ + protected boolean containsNode( final List list, final NodeValue n ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + final NodeValue vv = NodeValue.makeNode( v.asNode() ); + if ( NodeValue.sameAs(vv,n) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the list represented by + * the given cdt:List literal (i.e., assumes that the given literal + * is a cdt:List literal). + */ + protected boolean containsList( final List list, final LiteralLabel lit ) { + // get the list for the literal only if needed + List otherList = null; + + for ( final CDTValue v : list ) { + final List vList; + if ( v.isList() ) { + vList = v.asList(); + } + else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { + vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); + } + else { + vList = null; + } + + if ( vList != null ) { + // now we need to get the list + if ( otherList == null ) { + otherList = CompositeDatatypeList.getValue(lit); + } + + if ( vList.equals(otherList) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the map represented by + * the given cdt:Map literal (i.e., assumes that the given literal + * is a cdt:Map literal). + */ + protected boolean containsMap( final List list, final LiteralLabel lit) { + // get the map for the literal only if needed + Map otherMap = null; + + for ( final CDTValue v : list ) { + final Map vMap; + if ( v.isMap() ) { + vMap = v.asMap(); + } + else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { + vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); + } + else { + vMap = null; + } + + if ( vMap != null ) { + // now we need to get the map + if ( otherMap == null ) { + otherMap = CompositeDatatypeMap.getValue(lit); + } + + if ( vMap.equals(otherMap) ) { + return true; + } + } + } + + return false; + } +} From 6d167ee7abfd05052450fa18c80b34b54e1218bd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:03:55 +0100 Subject: [PATCH 021/323] remove debug printing --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15ff18434f2..3a9b0b9cad8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -174,10 +174,6 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); -System.out.println("list1"); -System.out.println(list1); -System.out.println("list2"); -System.out.println(list2); return list1.equals(list2); } From f6e7d680972d0694ced73a89559b547009547c14 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:05:01 +0100 Subject: [PATCH 022/323] adds CDTLiteralParserBase to create special Node objects for cdt:List literals and cdt:Map literals --- jena-arq/Grammar/cdt_literals.jj | 3 +-- .../apache/jena/cdt/CDTLiteralParserBase.java | 25 +++++++++++++++++++ .../jena/cdt/parser/CDTLiteralParser.java | 3 +-- .../parser/CDTLiteralParserTokenManager.java | 1 - 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index eac97b2827e..5ee872ef62e 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -57,9 +57,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase +public class CDTLiteralParser extends CDTLiteralParserBase { } PARSER_END(CDTLiteralParser) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java new file mode 100644 index 00000000000..737aaf509eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -0,0 +1,25 @@ +package org.apache.jena.cdt; + +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParserBase extends TurtleParserBase +{ + @Override + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final LiteralLabel lit = new LiteralLabelForList(lex); + return NodeFactory.createLiteral(lit); + } + + if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final LiteralLabel lit = new LiteralLabelForMap(lex); + return NodeFactory.createLiteral(lit); + } + + return super.createLiteral(lex, langTag, datatypeURI); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index a41a068d605..832cc84b276 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -26,9 +26,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { +public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point final public void parse() throws ParseException { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index c7c080e9454..bcf9c3cb8e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From e74bcd5e4e4e7af66c2e0f410aa2d06389201bae Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:12:07 +0100 Subject: [PATCH 023/323] bug fix: avoid NPE --- .../main/java/org/apache/jena/cdt/CDTLiteralParserBase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 737aaf509eb..e42b9c339d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -9,12 +9,12 @@ public class CDTLiteralParserBase extends TurtleParserBase { @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); } - if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForMap(lex); return NodeFactory.createLiteral(lit); } From c8ce862d2096f9240fd370ee583a5a3ee84fe0fe Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 19 Nov 2022 16:32:34 +0100 Subject: [PATCH 024/323] bug fix in the CDT grammar (it was possible to have lists that begin with a comma) --- jena-arq/Grammar/cdt_literals.jj | 33 ++++--- jena-arq/Grammar/grammarCDTs | 10 ++- .../jena/cdt/parser/CDTLiteralParser.java | 86 +++++++++---------- 3 files changed, 67 insertions(+), 62 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 5ee872ef62e..514be16467b 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -63,28 +63,26 @@ public class CDTLiteralParser extends CDTLiteralParserBase } PARSER_END(CDTLiteralParser) -// --- Entry point - -void parse() : {} -{ - ( List() | Map() ) -} +// --- Entry point for cdt:List literals List List() : { List l = new ArrayList(); } { - ( ListElement(l) )? - - ( ListElement(l) )* - - // should we permit a trailing comma? + ( NonEmptyListContent(l) )? { return l; } } +void NonEmptyListContent(List l) : { } +{ + ListElement(l) + + ( ListElement(l) )* +} + void ListElement(List l) : { String iri; Node n; List subList; Map m; } { iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } @@ -104,19 +102,26 @@ void ListElement(List l) : { String iri; Node n; List subLis m = Map() { l.add( CDTFactory.createValue(m) ); } } +// --- Entry point for cdt:Map literals + Map Map() : { Map m = new HashMap(); } { - ( MapEntry(m) )? - - ( MapEntry(m) )* + ( NonEmptyMapContent(m) )? { return m; } } +void NonEmptyMapContent(Map m) : { } +{ + MapEntry(m) + + ( MapEntry(m) )* +} + void MapEntry(Map m) : { CDTKey key; CDTValue value; } { key = MapKey() diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs index fb95f355e44..8bbaf8685d4 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/grammarCDTs @@ -30,8 +30,8 @@ javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" RC=$? [ "$RC" = 0 ] || return -## echo "---- Create text form ----" -## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" +echo "---- Create text form ----" +jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" echo "---- Fixing Java warnings in TokenMgrError" F="$DIR/TokenMgrError.java" @@ -56,4 +56,10 @@ sed -e 's/@SuppressWarnings("serial")//' \ < $F > F mv F $F +echo "---- Create HTML form ----" +./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html +./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html + +echo "Check X and Y for IRI_REF because \" became '" + echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 832cc84b276..8f0b6cb9404 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -29,22 +29,7 @@ public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { -// --- Entry point - final public void parse() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACKET: - List(); - break; - case LBRACE: - Map(); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - +// --- Entry point for cdt:List literals final public List List() throws ParseException { List l = new ArrayList(); jj_consume_token(LBRACKET); @@ -63,12 +48,19 @@ final public List List() throws ParseException { case NULL: case LBRACE: case LBRACKET: - ListElement(l); + NonEmptyListContent(l); break; default: - jj_la1[1] = jj_gen; + jj_la1[0] = jj_gen; ; } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyListContent(List l) throws ParseException { + ListElement(l); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -76,15 +68,12 @@ final public List List() throws ParseException { ; break; default: - jj_la1[2] = jj_gen; + jj_la1[1] = jj_gen; break label_1; } jj_consume_token(COMMA); ListElement(l); } - jj_consume_token(RBRACKET); - {if (true) return l;} - throw new Error("Missing return statement in function"); } final public void ListElement(List l) throws ParseException { @@ -129,12 +118,13 @@ final public void ListElement(List l) throws ParseException { l.add( CDTFactory.createValue(m) ); break; default: - jj_la1[3] = jj_gen; + jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } +// --- Entry point for cdt:Map literals final public Map Map() throws ParseException { Map m = new HashMap(); jj_consume_token(LBRACE); @@ -150,12 +140,19 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG2: case IRIref: case BLANK_NODE_LABEL: - MapEntry(m); + NonEmptyMapContent(m); break; default: - jj_la1[4] = jj_gen; + jj_la1[3] = jj_gen; ; } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyMapContent(Map m) throws ParseException { + MapEntry(m); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -163,15 +160,12 @@ final public Map Map() throws ParseException { ; break; default: - jj_la1[5] = jj_gen; + jj_la1[4] = jj_gen; break label_2; } jj_consume_token(COMMA); MapEntry(m); } - jj_consume_token(RBRACE); - {if (true) return m;} - throw new Error("Missing return statement in function"); } final public void MapEntry(Map m) throws ParseException { @@ -213,7 +207,7 @@ final public CDTKey MapKey() throws ParseException { {if (true) return CDTFactory.createKey(n);} break; default: - jj_la1[6] = jj_gen; + jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -262,7 +256,7 @@ final public CDTValue MapValue() throws ParseException { {if (true) return CDTFactory.createValue(m);} break; default: - jj_la1[7] = jj_gen; + jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -300,7 +294,7 @@ final public Node NumericLiteral() throws ParseException { {if (true) return createLiteralDouble(t.image);} break; default: - jj_la1[8] = jj_gen; + jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -318,7 +312,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE;} break; default: - jj_la1[9] = jj_gen; + jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -341,13 +335,13 @@ final public Node RDFLiteral() throws ParseException { dt = IRI_REF(); break; default: - jj_la1[10] = jj_gen; + jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[11] = jj_gen; + jj_la1[10] = jj_gen; ; } {if (true) return createLiteral(lex, lang, dt);} @@ -381,7 +375,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[12] = jj_gen; + jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -399,7 +393,7 @@ final public String String() throws ParseException { public Token jj_nt; private int jj_ntk; private int jj_gen; - final private int[] jj_la1 = new int[13]; + final private int[] jj_la1 = new int[12]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { @@ -407,10 +401,10 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; } /** Constructor with InputStream. */ @@ -424,7 +418,7 @@ public CDTLiteralParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -438,7 +432,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor. */ @@ -448,7 +442,7 @@ public CDTLiteralParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -458,7 +452,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ @@ -467,7 +461,7 @@ public CDTLiteralParser(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -476,7 +470,7 @@ public void ReInit(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { @@ -532,7 +526,7 @@ public ParseException generateParseException() { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 13; i++) { + for (int i = 0; i < 12; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< Date: Sun, 20 Nov 2022 20:56:26 +0100 Subject: [PATCH 025/323] changes CDTValue such that it can be only null or an RDF term --- .../java/org/apache/jena/cdt/CDTFactory.java | 16 +- .../main/java/org/apache/jena/cdt/CDTKey.java | 10 ++ .../java/org/apache/jena/cdt/CDTValue.java | 138 ++++-------------- .../jena/cdt/CompositeDatatypeList.java | 14 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 21 +-- .../apache/jena/cdt/ParserForCDTLiterals.java | 8 +- .../engine/iterator/QueryIterUnfold.java | 67 +++++---- .../library/collection/ConcatFct.java | 25 ++-- .../library/collection/ContainsFct.java | 96 +----------- .../function/library/collection/SizeFct.java | 19 +-- 10 files changed, 115 insertions(+), 299 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index 1c96d41b629..dddd36a52d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -22,6 +22,8 @@ import java.util.Map; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; public class CDTFactory { @@ -40,17 +42,15 @@ public static CDTValue createValue( final Node n ) { } public static CDTValue createValue( final List l ) { - return new CDTValue() { - @Override public boolean isList() { return true; } - @Override public List asList() { return l; } - }; + final LiteralLabel lit = new LiteralLabelForList(l); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue createValue( final Map m ) { - return new CDTValue() { - @Override public boolean isMap() { return true; } - @Override public Map asMap() { return m; } - }; + final LiteralLabel lit = new LiteralLabelForMap(m); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue getNullValue() { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index d42794c877b..1b2dd152155 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey @@ -63,4 +64,13 @@ public String toString() { return super.toString(); } } + + /** + * Returns a string representation of this element + * to be included in the lexical form of literals. + */ + public String asLexicalForm() { + return NodeFmtLib.strTTL( asNode() ); + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5dd74a0bce6..b252a7082f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -18,147 +18,67 @@ package org.apache.jena.cdt; -import java.util.List; -import java.util.Map; - import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.riot.out.NodeFmtLib; public abstract class CDTValue extends CDTKey { /** - * Returns true if this object is a list. In that case, {@link #asList()} - * can be used to get it as an actual {@link List} object. - */ - public boolean isList() { - return false; - } - - /** - * Returns true if this object is a map. In that case, {@link #asMap()} - * can be used to get it as an actual {@link Map} object. - */ - public boolean isMap() { - return false; - } - - /** - * Returns true if this is a null value. + * Returns true if this is a null value (in which + * case {@link #isNode()} must return false). */ public boolean isNull() { return false; } - /** - * Returns this object as a list, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public List asList() { - throw new UnsupportedOperationException( this + " is not a list" ); - } - - /** - * Returns this object as a map, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public Map asMap() { - throw new UnsupportedOperationException( this + " is not a map" ); - } - @Override public final boolean equals( final Object other ) { if ( isNull() ) { return false; } - if ( !(other instanceof CDTValue) ) { - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); - } - else { - return false; - } - } - - final CDTValue otherValue = (CDTValue) other; - - if ( otherValue.isNull() ) return false; - - if ( isNode() ) return isEqual( asNode(), otherValue ); - - if ( isList() ) return isEqual( asList(), otherValue ); - - if ( isMap() ) return isEqual( asMap(), otherValue ); - - throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); - } - - public static boolean isEqual( final Node n1, final CDTValue v2 ) { - if ( CompositeDatatypeList.isListLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); - - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); - } - - if ( v2.isList() ) { - return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); - } - - return false; - } - - if ( CompositeDatatypeMap.isMapLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); + if ( other instanceof CDTValue ) { + final CDTValue otherValue = (CDTValue) other; - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); + if ( otherValue.isNull() ) { + return false; } - if ( v2.isMap() ) { - return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( v2.isNode() ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); - return NodeValue.sameAs(nv1, nv2); + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().sameValueAs( otherKey.asNode() ); } return false; } - public static boolean isEqual( final List list1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.getValue(lit2).equals(list1); - } - - if ( v2.isList() ) { - return v2.asList().equals(list1); - } - - return false; - } - - public static boolean isEqual( final Map map1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeMap.getValue(lit2).equals(map1); + @Override + public String asLexicalForm() { + if ( isNull() ) { + return "null"; } - if ( v2.isMap() ) { - return v2.asMap().equals(map1); + if ( isNode() ) { + final Node n = asNode(); + if ( CompositeDatatypeList.isListLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else { + return NodeFmtLib.strTTL(n); + } } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 3a9b0b9cad8..5a778f6c772 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,7 +24,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -70,16 +69,7 @@ public static String unparseList( final List list ) { } public static String unparseListElement( final CDTValue elmt ) { - if ( elmt.isNode() ) - return NodeFmtLib.strTTL( elmt.asNode() ); - else if ( elmt.isList() ) - return unparseList( elmt.asList() ); - else if ( elmt.isMap() ) - return CompositeDatatypeMap.unparseMap( elmt.asMap() ); - else if ( elmt.isNull() ) - return "null"; - else - throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + return elmt.asLexicalForm(); } @Override @@ -177,7 +167,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return list1.equals(list2); } - public static List getValue( final LiteralLabel lit ) { + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 784cf6bfaf4..6dec66e9920 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,7 +6,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeMap extends CompositeDatatypeBase { @@ -54,23 +53,9 @@ public static String unparseMap( final Map map ) { } public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { - if ( entry.getKey().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); - else - throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); - + sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); - - if ( entry.getValue().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); - else if ( entry.getValue().isList() ) - sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); - else if ( entry.getValue().isMap() ) - sb.append( unparseMap( entry.getValue().asMap() ) ); - else if ( entry.getValue().isNull() ) - sb.append( "null" ); - else - throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + sb.append( entry.getValue().asLexicalForm() ); } @Override @@ -172,7 +157,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return map1.equals(map2); } - public static Map getValue( final LiteralLabel lit ) { + public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 645cfa15a38..4284f6f3c1d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -76,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea final CDTValue v = list.get(i); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } @@ -134,11 +134,11 @@ public static Map parseMapLiteral( final Reader reader, final b final CDTValue v = map.get(key); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d376b2ea921..90fa39330b6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -140,23 +141,28 @@ protected Binding moveToNextBinding() { return inputBinding; } - final Node value; if ( nextElmt.isNode() ) { - value = nextElmt.asNode(); - } - else if ( nextElmt.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); - value = NodeFactory.createLiteral(lit); - } - else if ( nextElmt.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); - value = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + final Node n = nextElmt.asNode(); + + final Node value; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + value = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + value = NodeFactory.createLiteral(lit); + } + else { + value = n; + } + + return BindingFactory.binding(inputBinding, var1, value); } - return BindingFactory.binding(inputBinding, var1, value); + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); } } @@ -194,23 +200,28 @@ protected Binding moveToNextBinding() { return BindingFactory.binding( inputBinding, var1, keyNode ); } - final Node valueNode; if ( value.isNode() ) { - valueNode = value.asNode(); - } - else if ( value.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( value.asList() ); - valueNode = NodeFactory.createLiteral(lit); - } - else if ( value.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); - valueNode = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + final Node n = value.asNode(); + + final Node valueNode; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + valueNode = NodeFactory.createLiteral(lit); + } + else { + valueNode = n; + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } - return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index c950980ac3c..3b4a2dfa52e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -21,6 +21,14 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { final List list1 = getInputList(v1); final List list2 = getInputList(v2); + if ( list1.isEmpty() ) { + return v2; + } + + if ( list2.isEmpty() ) { + return v1; + } + final List result = new ArrayList<>(); result.addAll(list1); result.addAll(list2); @@ -33,22 +41,11 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { protected List getInputList( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + nv); try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - return CompositeDatatypeList.parseList(lex); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); - } + return CompositeDatatypeList.getValue( n.getLiteral() ); } catch ( final DatatypeFormatException ex ) { throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index a940b91bf33..b0a323e2e4c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -1,14 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; -import java.util.Map; -import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -18,72 +14,23 @@ public class ContainsFct extends FunctionBase2 @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - final Node n2 = nv2.asNode(); if ( ! CompositeDatatypeList.isListLiteral(n1) ) throw new ExprEvalException("Not a list literal: " + nv1); final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); - - final boolean result; - if ( CompositeDatatypeList.isListLiteral(n2) ) { - result = containsList( list, n2.getLiteral() ); - } - else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { - result = containsMap( list, n2.getLiteral() ); - } - else { - result = containsNode( list, nv2 ); - } - + final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } /** - * Returns true if the given list contains the given RDF term, assuming - * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + * Returns true if the given list contains the given RDF term. */ - protected boolean containsNode( final List list, final NodeValue n ) { + protected boolean containsNode( final List list, final NodeValue nv ) { for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv,n) ) { - return true; - } - } - } - - return false; - } - - /** - * Returns true if the given list contains the list represented by - * the given cdt:List literal (i.e., assumes that the given literal - * is a cdt:List literal). - */ - protected boolean containsList( final List list, final LiteralLabel lit ) { - // get the list for the literal only if needed - List otherList = null; - - for ( final CDTValue v : list ) { - final List vList; - if ( v.isList() ) { - vList = v.asList(); - } - else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { - vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); - } - else { - vList = null; - } - - if ( vList != null ) { - // now we need to get the list - if ( otherList == null ) { - otherList = CompositeDatatypeList.getValue(lit); - } - - if ( vList.equals(otherList) ) { + if ( NodeValue.sameAs(vv, nv) ) { return true; } } @@ -92,39 +39,4 @@ else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { return false; } - /** - * Returns true if the given list contains the map represented by - * the given cdt:Map literal (i.e., assumes that the given literal - * is a cdt:Map literal). - */ - protected boolean containsMap( final List list, final LiteralLabel lit) { - // get the map for the literal only if needed - Map otherMap = null; - - for ( final CDTValue v : list ) { - final Map vMap; - if ( v.isMap() ) { - vMap = v.asMap(); - } - else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { - vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); - } - else { - vMap = null; - } - - if ( vMap != null ) { - // now we need to get the map - if ( otherMap == null ) { - otherMap = CompositeDatatypeMap.getValue(lit); - } - - if ( vMap.equals(otherMap) ) { - return true; - } - } - } - - return false; - } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index b4f76e2565f..4121ba8db3b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,8 +2,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; @@ -24,22 +22,15 @@ public NodeValue exec( final NodeValue nv ) { try { final LiteralLabel lit = n.getLiteral(); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - size = ( (LiteralLabelForList) lit ).getValue().size(); - } - else if ( lit instanceof LiteralLabelForMap ) { - size = ( (LiteralLabelForMap) lit ).getValue().size(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeList.parseList(lex).size(); + + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + size = CompositeDatatypeList.getValue(lit).size(); } else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeMap.parseMap(lex).size(); + size = CompositeDatatypeMap.getValue(lit).size(); } else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); } } catch ( final DatatypeFormatException ex ) { From 61ab51bf17a046e69ec921907deacc5b9f52413a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 22:17:37 +0100 Subject: [PATCH 026/323] adds cdt:containsTerm function --- .../apache/jena/cdt/LiteralLabelForCDTs.java | 19 +++++++++ .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsTermFct.java | 42 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index c5215fccdc2..0f87a5ea33f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,5 +1,7 @@ package org.apache.jena.cdt; +import java.util.Objects; + import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.rdf.model.impl.Util; @@ -141,6 +143,23 @@ public boolean sameValueAs( final LiteralLabel other ) { return getValue().equals( other.getValue() ); } + @Override + public boolean equals( final Object other ) { + if ( this == other ) return true; + + if ( other == null || !(other instanceof LiteralLabel) ) return false; + + final LiteralLabel otherLiteral = (LiteralLabel) other; + + final String otherLang = otherLiteral.language(); + if ( otherLang != null && ! otherLang.isEmpty() ) return false; + + final String otherDTypeURI = otherLiteral.getDatatypeURI(); + if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; + + return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); + } + @Override public int getDefaultHashcode() { return hash; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index afa7c7e2f77..7796fef6e8d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -9,5 +9,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java new file mode 100644 index 00000000000..6951d89992e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsTermFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final boolean result = containsTerm( list, nv2 ); + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term. + */ + protected boolean containsTerm( final List list, final NodeValue nv ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + if ( NodeFunctions.sameTerm(v.asNode(), nv.asNode()) ) { + return true; + } + } + } + + return false; + } + +} From 116591b1e4d4fb943160fce931b38f5eaa16ff09 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 23:04:23 +0100 Subject: [PATCH 027/323] adds cdt:get function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/GetFct.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 7796fef6e8d..4f3959b7342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -10,5 +10,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java new file mode 100644 index 00000000000..41227a7bb10 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -0,0 +1,46 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class GetFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + if ( index > list.size() ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final CDTValue value = list.get( index-1 ); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From 0e08dd625b69dacf949b0a2d6d4be05d563333c8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:27:38 +0100 Subject: [PATCH 028/323] adds cdt:head function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/HeadFct.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 4f3959b7342..9a521880665 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,5 +11,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java new file mode 100644 index 00000000000..5fcaf302c84 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -0,0 +1,38 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class HeadFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final CDTValue value = list.get(0); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From 18d9dc91137ae8a53c26464251206d4489514827 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:37 +0100 Subject: [PATCH 029/323] adds base class FunctionBase1List --- .../library/collection/FunctionBase1List.java | 27 +++++++++++++++++++ .../function/library/collection/HeadFct.java | 14 ++-------- 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java new file mode 100644 index 00000000000..0f49e6b61fd --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -0,0 +1,27 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public abstract class FunctionBase1List extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + return _exec(list); + } + + protected abstract NodeValue _exec( List list ); +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 5fcaf302c84..4deed24468e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -3,23 +3,13 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; -public class HeadFct extends FunctionBase1 +public class HeadFct extends FunctionBase1List { @Override - public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + protected NodeValue _exec( final List list ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From a838a90f0685c810252180e89319b650896d9942 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:57 +0100 Subject: [PATCH 030/323] adds cdt:tail function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/TailFct.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 9a521880665..8f203ffe4ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -12,5 +12,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java new file mode 100644 index 00000000000..15abce441fa --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -0,0 +1,26 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class TailFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list ) { + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final List sublist = list.subList( 1, list.size() ); + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 60ae5325341951afefd3aba12b0f474a8ebb562a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:02:27 +0100 Subject: [PATCH 031/323] changes arguments of '_exec' in FunctionBase1List --- .../sparql/function/library/collection/FunctionBase1List.java | 4 ++-- .../jena/sparql/function/library/collection/HeadFct.java | 2 +- .../jena/sparql/function/library/collection/TailFct.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 0f49e6b61fd..99210c10f0d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -20,8 +20,8 @@ public NodeValue exec( final NodeValue nv ) { final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - return _exec(list); + return _exec(list, nv); } - protected abstract NodeValue _exec( List list ); + protected abstract NodeValue _exec( List list, NodeValue nvList ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 4deed24468e..aebd5f39611 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -9,7 +9,7 @@ public class HeadFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index 15abce441fa..a56581d3195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -13,7 +13,7 @@ public class TailFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From 0471144e367a4394e9cc9477c397291a3e4390e9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:28:07 +0100 Subject: [PATCH 032/323] adds cdt:reverse function --- .../CollectionLiteralFunctions.java | 5 +-- .../library/collection/ReverseFct.java | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 8f203ffe4ba..31451f73fbb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,13 +5,14 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java new file mode 100644 index 00000000000..e2d2d3fd4ed --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -0,0 +1,33 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Arrays; +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; + +public class ReverseFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list, final NodeValue nvList ) { + if ( list.size() < 2 ) + return nvList; + + final CDTValue[] reverseArray = new CDTValue[ list.size() ]; + int i = list.size() - 1; + for ( final CDTValue v : list ) { + reverseArray[i] = v; + i--; + } + + final List reverseList = Arrays.asList(reverseArray); + final LiteralLabel lit = new LiteralLabelForList(reverseList); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 180d0e06a1dcd93b71ab6f578ed90a3fca04c6a0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 11:33:32 +0100 Subject: [PATCH 033/323] adds cdt:subseq function --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/SubSeqFct.java | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 31451f73fbb..1e16821a71e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java new file mode 100644 index 00000000000..d5e8f7b736b --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -0,0 +1,90 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Collections; +import java.util.List; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class SubSeqFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 && args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec( final List args ) { + final NodeValue nv1 = args.get(0); + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final NodeValue nv2 = args.get(1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final int length; + final List list; + if ( args.size() == 3 ) { + final NodeValue nv3 = args.get(2); + + if ( ! nv3.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv3); + + length = nv3.getInteger().intValue(); + + if ( length < 0 ) + throw new ExprEvalException("Illegal length value: " + nv3); + + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + } + else { + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + length = list.size() - index + 1; + } + + if ( index > list.size() + 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + if ( index + length > list.size() + 1 ) + throw new ExprEvalException("Beyond list length (index: " + index + ", length: " + length + ")"); + + final List sublist; + if ( index == list.size() + 1 ) { + if ( length != 0 ) + throw new ExprEvalException("Illegal arguments (index: " + index + ", length: " + length + ")"); + + if ( list.isEmpty() ) + return nv1; + + sublist = Collections.emptyList(); + } + else { + sublist = list.subList( index - 1, index - 1 + length ); + } + + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 08b8237e45882ae99154b63866f1f8f11ba57d95 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 22:10:18 +0100 Subject: [PATCH 034/323] bugfix in 'isEqual' of CompositeDatatypeList (needs to throw ExprEvalException if null values are there) --- .../java/org/apache/jena/cdt/CDTValue.java | 32 +++++++++++++++++-- .../jena/cdt/CompositeDatatypeList.java | 16 +++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index b252a7082f8..9ac6500d668 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -20,6 +20,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.expr.ExprEvalException; public abstract class CDTValue extends CDTKey { @@ -32,16 +33,25 @@ public boolean isNull() { } @Override - public final boolean equals( final Object other ) { - if ( isNull() ) { + public boolean equals( final Object other ) { + try { + return sameAs(other); + } + catch ( final ExprEvalException ex ) { return false; } + } + + public boolean sameAs( final Object other ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - return false; + throw new ExprEvalException(); } if ( isNode() ) { @@ -59,6 +69,22 @@ public final boolean equals( final Object other ) { return false; } + public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } + + if ( otherValue.isNull() ) { + throw new ExprEvalException(); + } + + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); + } + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + @Override public String asLexicalForm() { if ( isNull() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 5a778f6c772..78178ba8ce1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -164,7 +164,21 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - return list1.equals(list2); + + if ( list1.size() != list2.size() ) return false; + if ( list1.isEmpty() ) return true; + + final Iterator it1 = list1.iterator(); + final Iterator it2 = list2.iterator(); + while ( it1.hasNext() ) { + final CDTValue v1 = it1.next(); + final CDTValue v2 = it2.next(); + if ( ! v1.sameAs(v2) ) { + return false; + } + } + + return true; } public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { From c8bbf9c1f4b3cb3eb3c1b43749fad7c96f69a221 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 1 Dec 2022 09:26:45 +0100 Subject: [PATCH 035/323] fix: comparing two cdt:List literals using the = operator may still return false even if the lists contain null (but are clearly different in other parts) --- .../src/main/java/org/apache/jena/cdt/CDTValue.java | 8 ++++---- .../org/apache/jena/cdt/CompositeDatatypeList.java | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 9ac6500d668..7347d694adf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -44,14 +44,14 @@ public boolean equals( final Object other ) { public boolean sameAs( final Object other ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { @@ -71,11 +71,11 @@ public boolean sameAs( final Object other ) throws ExprEvalException { public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 78178ba8ce1..4d0888915f4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -170,14 +171,20 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); + boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - if ( ! v1.sameAs(v2) ) { - return false; + try { + if ( ! v1.sameAs(v2) ) return false; + } + catch ( final ExprEvalException ex ) { + errorCaught = true; } } + if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); + return true; } From 53043337c57754fe39b6e2e0784fca252f2d748a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 13 Dec 2022 15:42:49 +0100 Subject: [PATCH 036/323] changes the implementation of the cdt:List constructor to be a functional form (rather than a function) which can be used to have null values in the constructed lists --- .../function/library/collection/ListFct.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index 420ab788576..a8820ed567a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -9,9 +9,13 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; public class ListFct extends FunctionBase { @@ -21,11 +25,18 @@ public void checkBuild( final String uri, final ExprList args ) { } @Override - public NodeValue exec( final List args ) { + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { final List list = new ArrayList<>( args.size() ); - for ( final NodeValue nv : args ) { - final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + for ( final Expr e : args ) { + CDTValue v; + try { + final NodeValue nv = e.eval(binding, env); + v = CDTFactory.createValue( nv.asNode() ); + } catch ( final ExprException ex ) { + v = CDTFactory.getNullValue(); + } + list.add(v); } @@ -34,4 +45,9 @@ public NodeValue exec( final List args ) { return NodeValue.makeNode(n); } + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + } From becc10033bd4e0fba626f79247933815dc5ef98c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 4 Jan 2023 19:49:36 +0100 Subject: [PATCH 037/323] makes cdt:concat an n-ary function --- .../library/collection/ConcatFct.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 3b4a2dfa52e..89526d9215d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -11,27 +11,38 @@ import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; +import org.apache.jena.sparql.function.FunctionBase; -public class ConcatFct extends FunctionBase2 +public class ConcatFct extends FunctionBase { @Override - public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final List list1 = getInputList(v1); - final List list2 = getInputList(v2); + public void checkBuild( final String uri, final ExprList args ) { + // nothing to check + } - if ( list1.isEmpty() ) { - return v2; + @Override + public NodeValue exec( final List args ) { + if ( args.isEmpty() ) { + final List result = new ArrayList<>(); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); } - if ( list2.isEmpty() ) { - return v1; + if ( args.size() == 1 ) { + final NodeValue nv = args.get(0); + // make sure that the argument is a well-formed cdt:List literal + getInputList(nv); + + return nv; } final List result = new ArrayList<>(); - result.addAll(list1); - result.addAll(list2); + for ( final NodeValue nv : args ) { + result.addAll( getInputList(nv) ); + } final LiteralLabel lit = new LiteralLabelForList(result); final Node n = NodeFactory.createLiteral(lit); From b03670e9ff0b958a1bed026c6e032551ff40f3d7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 13:30:26 +0100 Subject: [PATCH 038/323] support for the two-variables version of UNFOLD for cdt:List literals --- .../engine/iterator/QueryIterUnfold.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 90fa39330b6..05c83f0ba10 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -30,6 +30,7 @@ import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; @@ -120,6 +121,8 @@ protected void closeIterator() { } // nothing to do really protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected int nextIndex = 0; + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { super(inputBinding, itListElmts); } @@ -136,9 +139,22 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { final CDTValue nextElmt = itElmts.next(); + nextIndex++; // index values to be assigned to the second variable start at 1 + + final Node indexNode; + if ( var2 != null ) { + final String indexStr = Integer.toString(nextIndex); + indexNode = NodeFactory.createLiteral(indexStr, XSDDatatype.XSDinteger); + } + else { + indexNode = null; + } if ( nextElmt.isNull() ) { - return inputBinding; + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var2, indexNode); + else + return inputBinding; } if ( nextElmt.isNode() ) { @@ -159,7 +175,10 @@ else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof Li value = n; } - return BindingFactory.binding(inputBinding, var1, value); + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var1, value, var2, indexNode); + else + return BindingFactory.binding(inputBinding, var1, value); } throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); From c70b8cbb0f106c5f62570c860370efe2262ec956 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 14:17:18 +0100 Subject: [PATCH 039/323] support for the one-variable version of UNFOLD for cdt:Map literals --- .../org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 05c83f0ba10..fa1e3c7c570 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -215,7 +215,7 @@ protected Binding moveToNextBinding() { throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); } - if ( value.isNull() ) { + if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); } From ed504e0cc8da767264560e1b5a54532ab71392bd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 May 2023 11:02:31 +0200 Subject: [PATCH 040/323] support for comparison of cdt:List literals (i.e., < and >) --- .../jena/cdt/CompositeDatatypeList.java | 50 +++++++++++++++++-- .../apache/jena/sparql/expr/NodeValue.java | 13 +++++ 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 4d0888915f4..2c59bad884d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -25,6 +25,8 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -171,7 +173,6 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); - boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); @@ -179,15 +180,56 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( ! v1.sameAs(v2) ) return false; } catch ( final ExprEvalException ex ) { - errorCaught = true; + throw new ExprEvalException("nulls in lists cannot be compared"); } } - if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); - return true; } + public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final List list1; + final List list2; + try { + list1 = getValue(value1); + list2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( list1.isEmpty() && list2.isEmpty() ) return 0; + if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; + if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + + final int n = Math.min( list1.size(), list2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTValue elmt1 = list1.get(i); + final CDTValue elmt2 = list2.get(i); + + if ( elmt1.isNull() || elmt2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + + final int c; + try { + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c != 0 ) return c; + } + } + + return ( list1.size() - list2.size() ); + } + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index c33e25edd8e..53189aadc9c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -796,6 +796,19 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom throw new ARQInternalErrorException("NodeValue.raise returned") ; } + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeList.type.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN: { // One or two unknown value spaces. From a299826f9395e655e565efd0d2761cce0033d28c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 May 2023 09:11:55 +0200 Subject: [PATCH 041/323] bug fix: visit(OpUnfold) must pop the current expression from the stack --- .../jena/sparql/algebra/walker/ApplyTransformVisitor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index e6028996b28..0e9ae51129c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -149,6 +149,10 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { + final Expr e2 = pop(exprStack); + if ( ! opUnfold.getExpr().equals(e2) ) + throw new IllegalArgumentException("Expression on stack differs from expression of UNFOLD."); + visit1(opUnfold) ; } From f0d4bc8af542370685c86640a31e0726744150a9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 8 Jun 2023 22:50:18 +0200 Subject: [PATCH 042/323] changes implementation of 'list-equal' and 'list-less-than' such that comparing blank nodes (as list elements) raises an error --- .../jena/cdt/CompositeDatatypeList.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2c59bad884d..13cb5ee8d01 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -176,12 +176,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - try { - if ( ! v1.sameAs(v2) ) return false; - } - catch ( final ExprEvalException ex ) { + + if ( v1.isNull() || v2.isNull() ) { throw new ExprEvalException("nulls in lists cannot be compared"); } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) { + return false; + } } return true; @@ -211,9 +220,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); + + if ( n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); - final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); final int c; try { From fdb58cdb945647b6e0ab5b24b7d3137759198930 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 15 Jun 2023 17:43:33 +0200 Subject: [PATCH 043/323] FOLD must not accept blank nodes as keys for maps --- .../java/org/apache/jena/sparql/expr/aggregate/AggFold.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 93f9a3fb87e..b30a46fe7f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -168,6 +168,9 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { if ( nvKey == null ) { return; // ignore if creating the key using the given binding failed } + if ( nvKey.isBlank() ) { + return; // ignore if the key would be a blank node + } final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); From 652ffa0c8953860090758b281f455db3fcbe077c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 16:49:32 +0200 Subject: [PATCH 044/323] adds the map version of cdt:get, in this context also changes 'equals' of CDTKey (it must be true only for same terms not for same values) --- .../main/java/org/apache/jena/cdt/CDTKey.java | 12 +++-- .../function/library/collection/GetFct.java | 45 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 1b2dd152155..532ac98b10d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -20,7 +20,6 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -47,14 +46,19 @@ public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - final NodeValue thisNV = NodeValue.makeNode( asNode() ); - final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); - return NodeValue.sameAs(thisNV, otherNV); + final Node n1 = asNode(); + final Node n2 = otherKey.asNode(); + return n1.equals(n2); } return false; } + @Override + public int hashCode() { + return asNode().hashCode(); + } + @Override public String toString() { if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index 41227a7bb10..ae11240dc47 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -1,10 +1,15 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,9 +20,16 @@ public class GetFct extends FunctionBase2 public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + if ( CompositeDatatypeList.isListLiteral(n1) ) + return getFromList( n1.getLiteral(), nv2 ); + if ( CompositeDatatypeMap.isMapLiteral(n1) ) + return getFromMap( n1.getLiteral(), nv2 ); + + throw new ExprEvalException("Neither a list nor a map literal: " + nv1); + } + + protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -26,7 +38,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CompositeDatatypeList.getValue(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -43,4 +55,31 @@ else if ( value.isNode() ) { } } + protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + final Map map = CompositeDatatypeMap.getValue(n1); + + if ( map.isEmpty() ) + throw new ExprEvalException("empty map"); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + if ( value == null ) { + throw new ExprEvalException("key is not in the map"); + } + else if ( value.isNull() ) { + throw new ExprEvalException("value for key is in null"); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + } From 2df7015c1d34b5b4eecd6eeefd32c1d5e17f32dd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:21:41 +0200 Subject: [PATCH 045/323] adds support for cdt:containsKey --- .../CollectionLiteralFunctions.java | 6 ++- .../library/collection/ContainsKeyFct.java | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 1e16821a71e..86b9f93d0e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,11 +6,13 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsKey", ContainsKeyFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java new file mode 100644 index 00000000000..f3a54dbe3c7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsKeyFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + final Node n2 = nv2.asNode(); + + // If the second argument is not an IRI or a literal, then it cannot be + // a map key in the given map and, by definition of cdt:containsKey, we + // have to return false. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return NodeValue.booleanReturn(false); + + if ( map.isEmpty() ) + return NodeValue.booleanReturn(false); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + return NodeValue.booleanReturn( value != null ); + } + +} From 14b088d633daccf891fb338294632673b87c2b1f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:37:56 +0200 Subject: [PATCH 046/323] adds support for cdt:keys --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/KeysFct.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 86b9f93d0e7..36ddc929809 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,6 +11,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java new file mode 100644 index 00000000000..a2f4cb7a8c8 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -0,0 +1,40 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class KeysFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a map literal: " + nv); + + final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + + final List list = new ArrayList<>( map.size() ); + for ( final CDTKey key : map.keySet() ) { + final CDTValue value = CDTFactory.createValue( key.asNode() ); + list.add(value); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From 0c0555e4cca3dabdae1e261dd229f0934c4fe1d0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 19:31:07 +0200 Subject: [PATCH 047/323] adds support for cdt:remove --- .../library/collection/RemoveFct.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java new file mode 100644 index 00000000000..fd298d94010 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -0,0 +1,51 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class RemoveFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + if ( map.isEmpty() ) + return nv1; + + final Node n2 = nv2.asNode(); + + // If the second term is not a map key (and the first term is a well- + // formed cdt:Map literal), the first term needs to be returned as is. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return nv1; + + final CDTKey key = CDTFactory.createKey(n2); + + if ( ! map.containsKey(key) ) + return nv1; + + final Map newMap = new HashMap<>(map); + newMap.remove(key); + + final LiteralLabel lit = new LiteralLabelForMap(newMap); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From b04b287cebd4d78bebcfe41eecc7119b6a1a4e2f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 14:57:25 +0200 Subject: [PATCH 048/323] bug fix: CDTValue needs to override toString() and hashCode() and cannot rely on CDTKey for that; now it is not a subclass of CDTKey anymore --- .../java/org/apache/jena/cdt/CDTFactory.java | 1 - .../main/java/org/apache/jena/cdt/CDTKey.java | 16 +------ .../java/org/apache/jena/cdt/CDTValue.java | 48 ++++++++++++++++--- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index dddd36a52d0..912f32a47cf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -29,7 +29,6 @@ public class CDTFactory { public static CDTKey createKey( final Node n ) { return new CDTKey() { - @Override public boolean isNode() { return true; } @Override public Node asNode() { return n; } }; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 532ac98b10d..7631565e88c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -23,15 +23,6 @@ public abstract class CDTKey { - /** - * Returns true if this object is an RDF term (i.e., an IRI, a literal, - * or a blank node). In that case, {@link #asNode()} can be used to get - * a corresponding {@link Node} representation of this RDF term. - */ - public boolean isNode() { - return false; - } - /** * Returns this object as an RDF term (i.e., an IRI, a literal, * or a blank node), assuming it is one. If it is not, then an @@ -61,12 +52,7 @@ public int hashCode() { @Override public String toString() { - if ( isNode() ) { - return asNode().toString(); - } - else { - return super.toString(); - } + return asNode().toString(); } /** diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 7347d694adf..3baed568f3e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -22,7 +22,7 @@ import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.ExprEvalException; -public abstract class CDTValue extends CDTKey +public abstract class CDTValue { /** * Returns true if this is a null value (in which @@ -32,6 +32,46 @@ public boolean isNull() { return false; } + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public String toString() { + if ( isNode() ) + return asNode().toString(); + + if ( isNull() ) + return "null"; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + + @Override + public int hashCode() { + if ( isNode() ) + return asNode().hashCode();; + + if ( isNull() ) + return 1; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + @Override public boolean equals( final Object other ) { try { @@ -61,11 +101,6 @@ public boolean sameAs( final Object other ) throws ExprEvalException { throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().sameValueAs( otherKey.asNode() ); - } - return false; } @@ -85,7 +120,6 @@ public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalExceptio throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - @Override public String asLexicalForm() { if ( isNull() ) { return "null"; From 824acc5d6d0dad382ff1719083ea3540c9c53ea0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:31:56 +0200 Subject: [PATCH 049/323] adds CDTLiteralFunctionUtils --- .../collection/CDTLiteralFunctionUtils.java | 119 ++++++++++++++++++ .../library/collection/ConcatFct.java | 37 ++---- .../library/collection/ContainsFct.java | 10 +- .../library/collection/ContainsKeyFct.java | 9 +- .../library/collection/ContainsTermFct.java | 10 +- .../library/collection/FunctionBase1List.java | 11 +- .../function/library/collection/GetFct.java | 13 +- .../function/library/collection/KeysFct.java | 16 +-- .../function/library/collection/ListFct.java | 8 +- .../library/collection/RemoveFct.java | 15 +-- .../library/collection/ReverseFct.java | 8 +- .../function/library/collection/SizeFct.java | 27 ++-- .../library/collection/SubSeqFct.java | 17 +-- .../function/library/collection/TailFct.java | 8 +- 14 files changed, 155 insertions(+), 153 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java new file mode 100644 index 00000000000..d1d3f90c69e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java @@ -0,0 +1,119 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class CDTLiteralFunctionUtils +{ + /** + * Uses {@link CompositeDatatypeList#isListLiteral(Node)} to check whether + * the given node is a cdt:List literal and throws an exception if not. + */ + public static final void ensureListLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + n); + } + + /** + * Uses {@link CompositeDatatypeMap#isMapLiteral(Node)} to check whether + * the given node is a cdt:Map literal and throws an exception if not. + */ + public static final void ensureMapLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a cdt:Map literal: " + n); + } + + /** + * Assumes that the given node is a cdt:List literal and uses + * {@link CompositeDatatypeList#getValue(LiteralLabel)} to get + * the list. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. + */ + public static final List getList( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeList.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:List literal: " + n, ex); + } + } + + /** + * Assumes that the given node is a cdt:Map literal and uses + * {@link CompositeDatatypeMap#getValue(LiteralLabel)} to get + * the map. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. + */ + public static final Map getMap( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeMap.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n, ex); + } + } + + /** + * Calls {@link #ensureListLiteral(Node)} first, and {@link #getList(Node)} + * afterwards. + */ + public static final List checkAndGetList( final Node n ) throws ExprEvalException { + ensureListLiteral(n); + return getList(n); + } + + /** + * Calls {@link #ensureMapLiteral(Node)} first, and {@link #getMap(Node)} + * afterwards. + */ + public static final Map checkAndGetMap( final Node n ) throws ExprEvalException { + ensureMapLiteral(n); + return getMap(n); + } + + public static final List checkAndGetList( final NodeValue nv ) throws ExprEvalException { + return checkAndGetList( nv.asNode() ); + } + + public static final Map checkAndGetMap( final NodeValue nv ) throws ExprEvalException { + return checkAndGetMap( nv.asNode() ); + } + + /** + * Creates a {@link NodeValue} with a cdt:List literal that represents the + * given list. + */ + public static final NodeValue createNodeValue( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + + /** + * Creates a {@link NodeValue} with a cdt:Map literal that represents the + * given map. + */ + public static final NodeValue createNodeValue( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 89526d9215d..2867a64ccae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,16 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; @@ -25,42 +19,25 @@ public void checkBuild( final String uri, final ExprList args ) { @Override public NodeValue exec( final List args ) { if ( args.isEmpty() ) { - final List result = new ArrayList<>(); - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + final List result = Collections.emptyList(); + return CDTLiteralFunctionUtils.createNodeValue(result); } if ( args.size() == 1 ) { final NodeValue nv = args.get(0); // make sure that the argument is a well-formed cdt:List literal - getInputList(nv); + CDTLiteralFunctionUtils.checkAndGetList(nv); return nv; } final List result = new ArrayList<>(); for ( final NodeValue nv : args ) { - result.addAll( getInputList(nv) ); + final List l = CDTLiteralFunctionUtils.checkAndGetList(nv); + result.addAll(l); } - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - - protected List getInputList( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a cdt:List literal: " + nv); - - try { - return CompositeDatatypeList.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); - } + return CDTLiteralFunctionUtils.createNodeValue(result); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index b0a323e2e4c..6784dff603f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -13,12 +10,7 @@ public class ContainsFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java index f3a54dbe3c7..6cfcb050dc3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -5,9 +5,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,12 +13,7 @@ public class ContainsKeyFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); final Node n2 = nv2.asNode(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java index 6951d89992e..3ce25c92108 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; import org.apache.jena.sparql.function.FunctionBase2; @@ -14,12 +11,7 @@ public class ContainsTermFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsTerm( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 99210c10f0d..77491640be0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -13,13 +10,7 @@ public abstract class FunctionBase1List extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv); return _exec(list, nv); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index ae11240dc47..7a2a4e48ae6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -9,7 +9,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -21,15 +20,15 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); if ( CompositeDatatypeList.isListLiteral(n1) ) - return getFromList( n1.getLiteral(), nv2 ); + return getFromList(n1, nv2); if ( CompositeDatatypeMap.isMapLiteral(n1) ) - return getFromMap( n1.getLiteral(), nv2 ); + return getFromMap(n1, nv2); throw new ExprEvalException("Neither a list nor a map literal: " + nv1); } - protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromList( final Node n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -38,7 +37,7 @@ protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue(n1); + final List list = CDTLiteralFunctionUtils.getList(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -55,12 +54,12 @@ else if ( value.isNode() ) { } } - protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromMap( final Node n1, final NodeValue nv2 ) { final Node n2 = nv2.asNode(); if ( ! n2.isURI() && ! n2.isLiteral() ) throw new ExprEvalException("Not a valid map key: " + nv2); - final Map map = CompositeDatatypeMap.getValue(n1); + final Map map = CDTLiteralFunctionUtils.getMap(n1); if ( map.isEmpty() ) throw new ExprEvalException("empty map"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java index a2f4cb7a8c8..507c041fa2a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -7,12 +7,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -20,12 +14,7 @@ public class KeysFct extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n) ) - throw new ExprEvalException("Not a map literal: " + nv); - - final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv); final List list = new ArrayList<>( map.size() ); for ( final CDTKey key : map.keySet() ) { @@ -33,8 +22,7 @@ public NodeValue exec( final NodeValue nv ) { list.add(value); } - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(list); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index a8820ed567a..d151df0132e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -5,10 +5,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprException; @@ -40,9 +36,7 @@ public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv en list.add(v); } - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(list); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java index fd298d94010..f226ed1163d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -6,12 +6,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -19,12 +14,7 @@ public class RemoveFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); if ( map.isEmpty() ) return nv1; @@ -44,8 +34,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Map newMap = new HashMap<>(map); newMap.remove(key); - final LiteralLabel lit = new LiteralLabelForMap(newMap); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(newMap); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java index e2d2d3fd4ed..ffcb70bd1fa 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -4,10 +4,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.NodeValue; public class ReverseFct extends FunctionBase1List @@ -25,9 +21,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { } final List reverseList = Arrays.asList(reverseArray); - final LiteralLabel lit = new LiteralLabelForList(reverseList); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(reverseList); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 4121ba8db3b..4958369b0f3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,9 +2,7 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -15,26 +13,15 @@ public class SizeFct extends FunctionBase1 public NodeValue exec( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); - final int size; - try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - size = CompositeDatatypeList.getValue(lit).size(); - } - else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - size = CompositeDatatypeMap.getValue(lit).size(); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); - } + if ( CompositeDatatypeList.isListLiteral(n) ) { + size = CDTLiteralFunctionUtils.getList(n).size(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + size = CDTLiteralFunctionUtils.getMap(n).size(); } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); + else { + throw new ExprEvalException("Neither a list nor a map literal: " + nv); } return NodeValue.makeInteger(size); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java index d5e8f7b736b..3c0d200eabb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -5,11 +5,7 @@ import org.apache.jena.atlas.lib.Lib; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.query.QueryBuildException; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; @@ -20,7 +16,7 @@ public class SubSeqFct extends FunctionBase { @Override public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 && args.size() > 3 ) + if ( args.size() < 2 || args.size() > 3 ) throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); } @@ -29,8 +25,7 @@ public NodeValue exec( final List args ) { final NodeValue nv1 = args.get(0); final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + CDTLiteralFunctionUtils.ensureListLiteral(n1); final NodeValue nv2 = args.get(1); @@ -55,10 +50,10 @@ public NodeValue exec( final List args ) { if ( length < 0 ) throw new ExprEvalException("Illegal length value: " + nv3); - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); } else { - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); length = list.size() - index + 1; } @@ -82,9 +77,7 @@ public NodeValue exec( final List args ) { sublist = list.subList( index - 1, index - 1 + length ); } - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index a56581d3195..a8c38a88cc1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -3,10 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -18,9 +14,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { throw new ExprEvalException("Empty list"); final List sublist = list.subList( 1, list.size() ); - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } From 11955eaaaa51ea96f2e14a9c669bd55d53737aca Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:32:48 +0200 Subject: [PATCH 050/323] adds support for cdt:put --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/PutFct.java | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 36ddc929809..fa97a88d342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java new file mode 100644 index 00000000000..dfb34b5b4ea --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java @@ -0,0 +1,94 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class PutFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 || args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() < 2 || args.size() > 3 ) + throw new ExprException("wrong number of arguments (" + args.size() + "), must be 2 or 3"); + + // check the second argument first because that's less expensive + final NodeValue nv2 = args.get(1).eval(binding, env); + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + // now check the first argument + final NodeValue nv1 = args.get(0).eval(binding, env); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + + final CDTKey key = CDTFactory.createKey(n2); + + // produce a map value from the third argument (if any) + final CDTValue newValue; + if ( args.size() == 2 ) { + newValue = CDTFactory.getNullValue(); + } + else { // in this case, we have that args.size() == 3 + NodeValue nv3 = null; + try { + nv3 = args.get(2).eval(binding, env); + } + catch ( final ExprException ex ) { + // nothing to do here + } + + if ( nv3 != null ) { + newValue = CDTFactory.createValue( nv3.asNode() ); + } + else { + newValue = CDTFactory.getNullValue(); + } + } + + // check if the given map already contains the exact same map entry + // if so, simply return the given cdt:Map literal + final CDTValue oldValue = map.get(key); + if ( oldValue != null ) { + if ( oldValue.isNull() && newValue.isNull() ) + return nv1; + + if ( ! oldValue.isNull() && ! newValue.isNull() ) { + final Node on = oldValue.asNode(); + final Node nn = newValue.asNode(); + if ( on.equals(nn) ) + return nv1; + } + } + + final Map newMap = new HashMap<>(map); + newMap.put(key, newValue); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From 57e5f41e8333b76cba8330ecdd22a9ad9996e6ae Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:34:57 +0200 Subject: [PATCH 051/323] renames CollectionLiteralFunctions to CDTLiteralFunctions --- .../java/org/apache/jena/sparql/function/ARQFunctions.java | 4 ++-- ...llectionLiteralFunctions.java => CDTLiteralFunctions.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/{CollectionLiteralFunctions.java => CDTLiteralFunctions.java} (97%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 2acb95dbf84..7694f96276a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; +import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -34,6 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); - CollectionLiteralFunctions.register(reg); + CDTLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java index fa97a88d342..b388733831c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java @@ -3,7 +3,7 @@ import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; -public class CollectionLiteralFunctions { +public class CDTLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); From 39e1cde97c3d86cded06d8126a20865b488ef301 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:36:46 +0200 Subject: [PATCH 052/323] renames 'org.apache.jena.sparql.function.library.collections' package to 'org.apache.jena.sparql.function.library.cdt' --- .../main/java/org/apache/jena/sparql/function/ARQFunctions.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctionUtils.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctions.java | 2 +- .../sparql/function/library/{collection => cdt}/ConcatFct.java | 2 +- .../function/library/{collection => cdt}/ContainsFct.java | 2 +- .../function/library/{collection => cdt}/ContainsKeyFct.java | 2 +- .../function/library/{collection => cdt}/ContainsTermFct.java | 2 +- .../function/library/{collection => cdt}/FunctionBase1List.java | 2 +- .../sparql/function/library/{collection => cdt}/GetFct.java | 2 +- .../sparql/function/library/{collection => cdt}/HeadFct.java | 2 +- .../sparql/function/library/{collection => cdt}/KeysFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ListFct.java | 2 +- .../sparql/function/library/{collection => cdt}/PutFct.java | 2 +- .../sparql/function/library/{collection => cdt}/RemoveFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ReverseFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SizeFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SubSeqFct.java | 2 +- .../sparql/function/library/{collection => cdt}/TailFct.java | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctionUtils.java (98%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctions.java (96%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ConcatFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsKeyFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsTermFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/FunctionBase1List.java (88%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/GetFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/HeadFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/KeysFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ListFct.java (95%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/PutFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/RemoveFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ReverseFct.java (91%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SizeFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SubSeqFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/TailFct.java (89%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 7694f96276a..9c76c037231 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java similarity index 98% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d1d3f90c69e..1fa1b956656 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java similarity index 96% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index b388733831c..94c3a8af018 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index 2867a64ccae..fc7ed60734d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index 6784dff603f..f9751d78ca5 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index 6cfcb050dc3..eca1978ba1e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index 3ce25c92108..da670a6508e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java similarity index 88% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index 77491640be0..b6f45b33e4b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index 7a2a4e48ae6..c83cd9b764f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index aebd5f39611..1f331c936ac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 507c041fa2a..6c393370ff1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java similarity index 95% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index d151df0132e..ca7c0f92715 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index dfb34b5b4ea..0df7dcfdf00 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index f226ed1163d..0a4a5a99b36 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java similarity index 91% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index ffcb70bd1fa..3d28e7a76e0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 4958369b0f3..5166f1440d9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 3c0d200eabb..80a99fb32f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Collections; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java similarity index 89% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index a8c38a88cc1..70805975786 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; From 9edbb324f5bbe6805564a6c1fcca3c96ca8365c3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 19:06:28 +0200 Subject: [PATCH 053/323] adds support for cdt:Map constructor --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MapFct.java | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 94c3a8af018..36d36c7fc95 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java new file mode 100644 index 00000000000..3dba18232eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -0,0 +1,84 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class MapFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() % 2 == 1 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() % 2 == 1 ) + throw new ExprException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + + final Map map = new HashMap<>(); + + final Iterator it = args.iterator(); + while ( it.hasNext() ) { + final Expr exprKey = it.next(); + final Expr exprValue = it.next(); + + final CDTKey key = getKey(exprKey, binding, env); + if ( key != null ) { + final CDTValue value = getValue(exprValue, binding, env); + map.put(key, value); + } + } + + return CDTLiteralFunctionUtils.createNodeValue(map); + } + + protected CDTKey getKey( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return null; + } + + final Node n = nv.asNode(); + if ( ! n.isURI() && ! n.isLiteral() ) + return null; + + return CDTFactory.createKey(n); + } + + protected CDTValue getValue( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return CDTFactory.getNullValue(); + } + + return CDTFactory.createValue( nv.asNode() ); + } + + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From a7be37ef1559756ca328e38cb44e6a5f4003ebf1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 21 Aug 2023 12:56:33 +0200 Subject: [PATCH 054/323] big fix: CDTKey does not have a 'isNode()' function anymore --- .../jena/sparql/engine/iterator/QueryIterUnfold.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index fa1e3c7c570..2b518efc68c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -207,13 +207,7 @@ protected Binding moveToNextBinding() { final CDTKey key = elmt.getKey(); final CDTValue value = elmt.getValue(); - final Node keyNode; - if ( key.isNode() ) { - keyNode = key.asNode(); - } - else { - throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); - } + final Node keyNode = key.asNode(); if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); From 0636902731c6c6bdea78e14e5c00f45b6cbf00d3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 14:16:31 +0200 Subject: [PATCH 055/323] the datatypes for the CDT literals need to be registered --- jena-arq/src/main/java/org/apache/jena/query/ARQ.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java index 262452075b6..8c7f6ce0de6 100644 --- a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java +++ b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java @@ -18,6 +18,9 @@ package org.apache.jena.query; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.datatypes.TypeMapper; import org.apache.jena.http.sys.HttpRequestModifier; import org.apache.jena.http.sys.RegistryRequestModifier; import org.apache.jena.riot.RIOT ; @@ -644,6 +647,10 @@ public static void init() { AggregateRegistry.init() ; PropertyFunctionRegistry.init() ; + // Register the datatypes for the CDT literals + TypeMapper.getInstance().registerDatatype(CompositeDatatypeList.type) ; + TypeMapper.getInstance().registerDatatype(CompositeDatatypeMap.type) ; + JenaSystem.logLifecycle("ARQ.init - finish") ; } } From ce98c0a35b15677047c69b0a3b5b3c524b1de731 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 17:32:00 +0200 Subject: [PATCH 056/323] changes the implementation of LiteralLabelForCDTs to use the corresponding CompositeDatatypeBase implementation more directly --- .../jena/cdt/CompositeDatatypeBase.java | 7 ++++- .../jena/cdt/CompositeDatatypeList.java | 12 ++++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 7 ++++- .../apache/jena/cdt/LiteralLabelForCDTs.java | 31 +++++++------------ .../apache/jena/cdt/LiteralLabelForList.java | 20 +----------- .../apache/jena/cdt/LiteralLabelForMap.java | 20 +----------- 6 files changed, 36 insertions(+), 61 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index ca5e1878c18..5c1e768a424 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -18,9 +18,10 @@ package org.apache.jena.cdt; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; -public abstract class CompositeDatatypeBase implements RDFDatatype +public abstract class CompositeDatatypeBase implements RDFDatatype { @Override public Class getJavaClass() { @@ -42,4 +43,8 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) return this; } + @Override + public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; + + public abstract String unparseValue( final T value ); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 13cb5ee8d01..2b4aa0a30c6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -28,7 +28,7 @@ import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; -public class CompositeDatatypeList extends CompositeDatatypeBase +public class CompositeDatatypeList extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); @@ -49,6 +49,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final List list = (List) value; + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { return unparseList(list); } @@ -246,11 +251,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } + @SuppressWarnings("unchecked") public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } else { + final Object value = lit.getValue(); + //if ( value != null && value instanceof List ) + //return (List) value; + final String lex = lit.getLexicalForm(); return parseList(lex); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 6dec66e9920..9853c41fb18 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -7,7 +7,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -public class CompositeDatatypeMap extends CompositeDatatypeBase +public class CompositeDatatypeMap extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); @@ -28,6 +28,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final Map map = (Map) value; + return unparseValue(map); + } + + @Override + public String unparseValue( final Map map ) { return unparseMap(map); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 0f87a5ea33f..6fea1cfee96 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -30,6 +30,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + @Override + public abstract CompositeDatatypeBase getDatatype(); + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + @Override public boolean isXML() { return false; @@ -81,14 +89,12 @@ public String toString() { @Override public String getLexicalForm() { if ( lexicalForm == null ) { - lexicalForm = unparseValueForm(valueForm); + lexicalForm = getDatatype().unparseValue(valueForm); } return lexicalForm; } - protected abstract String unparseValueForm( T valueForm ); - protected boolean isLexicalFormSet() { return lexicalForm != null; } @@ -117,30 +123,15 @@ public T getValue() throws DatatypeFormatException { // try again at the next call of 'getValue()' because now we have // set 'lexicalFormTested'. - valueForm = parseLexicalForm(lexicalForm); + valueForm = getDatatype().parse(lexicalForm); } return valueForm; } - protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - @Override public boolean sameValueAs( final LiteralLabel other ) { - if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { - return false; - } - - if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { - return true; - } - - return getValue().equals( other.getValue() ); + return getDatatype().isEqual(this, other); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index bc626e0fd01..e84fe915333 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -20,8 +20,6 @@ import java.util.List; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForList extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForList( final String lexicalForm ) { } @Override - protected String unparseValueForm( List valueForm ) { - return CompositeDatatypeList.unparseList(valueForm); - } - - @Override - protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 1d5093e1da7..18ad753f62c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -20,8 +20,6 @@ import java.util.Map; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForMap extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForMap( final String lexicalForm ) { } @Override - protected String unparseValueForm( Map valueForm ) { - return CompositeDatatypeMap.unparseMap(valueForm); - } - - @Override - protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; } From f36fd4b82bf843de943a7340a1adeded54e6a639 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 15 Sep 2023 09:52:19 +0200 Subject: [PATCH 057/323] some clean up in CompositeDatatypeList and in CompositeDatatypeMap --- .../jena/cdt/CompositeDatatypeList.java | 199 +++++++++--------- .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++++++-------- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 3 files changed, 188 insertions(+), 188 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2b4aa0a30c6..d73d1314227 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -40,73 +40,6 @@ public String getURI() { return uri; } - @Override - public String unparse( final Object value ) { - if ( !(value instanceof List) ) { - throw new IllegalArgumentException(); - } - - @SuppressWarnings("unchecked") - final List list = (List) value; - - return unparseValue(list); - } - - @Override - public String unparseValue( final List list ) { - return unparseList(list); - } - - public static String unparseList( final List list ) { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final CDTValue firstElmt = it.next(); - final String firstElmtAsString = unparseListElement(firstElmt); - sb.append(firstElmtAsString); - while ( it.hasNext() ) { - final CDTValue nextElmt = it.next(); - final String nextElmtAsString = unparseListElement(nextElmt); - sb.append(", "); - sb.append(nextElmtAsString); - } - } - sb.append("]"); - return sb.toString(); - } - - public static String unparseListElement( final CDTValue elmt ) { - return elmt.asLexicalForm(); - } - - @Override - public List parse( final String lexicalForm ) throws DatatypeFormatException { - return parseList(lexicalForm); - } - - public static List parseList( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - @Override public boolean isValidValue( final Object value ) { if ( !(value instanceof List) ) { @@ -129,7 +62,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { // datatype and the implementation of LiteralLabelForList makes // sure that these are valid. if ( lit instanceof LiteralLabelForList ) { - return true; + return lit.isWellFormed(); } // However, the given LiteralLabel may come from somewhere else, @@ -149,27 +82,78 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } - /** - * Returns true if the given node is a literal with {@link #uri} - * as its datatype URI. Notice that this does not mean that this - * literal is actually valid; for checking validity, use - * {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final Node n ) { - return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } } - /** - * Returns true if the datatype URI of the given {@link LiteralLabel} is - * {@link #uri}. Notice that this does not mean that this LiteralLabel is - * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final LiteralLabel lit ) { - return lit.getDatatypeURI().equals(uri); + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + protected String unparseListElement( final CDTValue elmt ) { + return elmt.asLexicalForm(); + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isListLiteral(value1) || ! isListLiteral(value2) ) { + return false; + } + final List list1 = getValue(value1); final List list2 = getValue(value2); @@ -201,7 +185,10 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return true; } - public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + /** + * Assumes that the datatype of both of the given literals is cdt:List. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { final List list1; final List list2; try { @@ -251,29 +238,41 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } - @SuppressWarnings("unchecked") + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given literal is {@link #uri}. + * Notice that this does not mean that this literal is actually valid; + * for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + + /** + * Assumes that the datatype of the given literal is cdt:List. + */ public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } - else { - final Object value = lit.getValue(); - //if ( value != null && value instanceof List ) - //return (List) value; - final String lex = lit.getLexicalForm(); - return parseList(lex); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof List) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForList ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); - } + @SuppressWarnings("unchecked") + final List list = (List) value; + return list; } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 9853c41fb18..c80adb4bce9 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -19,6 +19,76 @@ public String getURI() { return uri; } + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return lit.isWellFormed(); + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive ' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + @Override public String unparse( final Object value ) { if ( !(value instanceof Map) ) { @@ -33,10 +103,6 @@ public String unparse( final Object value ) { @Override public String unparseValue( final Map map ) { - return unparseMap(map); - } - - public static String unparseMap( final Map map ) { final StringBuilder sb = new StringBuilder(); sb.append("{"); if ( ! map.isEmpty() ) { @@ -57,82 +123,27 @@ public static String unparseMap( final Map map ) { return sb.toString(); } - public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + protected void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); sb.append( entry.getValue().asLexicalForm() ); } @Override - public Map parse( final String lexicalForm ) throws DatatypeFormatException { - return parseMap(lexicalForm); - } - - public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - - @Override - public boolean isValidValue( final Object value ) { - if ( !(value instanceof Map) ) { - return false; - } - - final Map m = (Map) value; - for ( final Map.Entry e : m.entrySet() ) { - if ( !(e.getKey() instanceof CDTKey) ) { - return false; - } - if ( !(e.getValue() instanceof CDTValue) ) { - return false; - } - } - - return true; + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override - public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForMap objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForMap makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForMap ) { - return true; - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - - final String dtURI = lit.getDatatypeURI(); - if ( dtURI == null || ! dtURI.equals(uri) ) { + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { return false; } - final String lang = lit.language(); - if ( lang != null && ! lang.isEmpty() ) { - return false; - } + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); - final String lex = lit.getLexicalForm(); - return isValid(lex); + return map1.equals(map2); } /** @@ -154,32 +165,22 @@ public static boolean isMapLiteral( final LiteralLabel lit ) { return lit.getDatatypeURI().equals(uri); } - @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); - - return map1.equals(map2); - } - + /** + * Assumes that the datatype of the given literal is cdt:Map. + */ public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } - else { - final String lex = lit.getLexicalForm(); - return parseMap(lex); - } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForMap ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof Map) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + return map; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 53189aadc9c..48fd3e792ae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -801,7 +801,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.type.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2) ; } catch( final ExprNotComparableException e ) { raise(e) ; From 8a5418d95cba3618127a7913e02dce60d2052448 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 18 Sep 2023 10:54:46 +0200 Subject: [PATCH 058/323] fixes implementation of 'map-equal' --- .../apache/jena/cdt/CompositeDatatypeMap.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index c80adb4bce9..e79b3bd3835 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -135,15 +136,36 @@ public int getHashCode( final LiteralLabel lit ) { } @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { + public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { + if ( ! isMapLiteral(lit1) || ! isMapLiteral(lit2) ) { return false; } - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); + final Map map1 = getValue(lit1); + final Map map2 = getValue(lit2); - return map1.equals(map2); + if ( map1.size() != map2.size() ) return false; + + for ( final Map.Entry entry1 : map1.entrySet() ) { + final CDTValue v1 = entry1.getValue(); + final CDTValue v2 = map2.get( entry1.getKey() ); + if ( v2 == null ) return false; + + if ( v1.isNull() || v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared"); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) return false; + } + + return true; } /** From 7909ad4a203305266a777646adcdff8cf11ff6f7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Sep 2023 17:21:20 +0200 Subject: [PATCH 059/323] adds support for cdt:merge --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MergeFct.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 36d36c7fc95..48f5d4a7465 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -14,6 +14,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "merge", MergeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java new file mode 100644 index 00000000000..ddeb872b3ce --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -0,0 +1,30 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class MergeFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Map map1 = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + final Map map2 = CDTLiteralFunctionUtils.checkAndGetMap(nv2); + + if ( map1.isEmpty() ) + return nv2; + + if ( map2.isEmpty() ) + return nv1; + + final Map newMap = new HashMap<>(map2); + newMap.putAll(map1); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + +} From b5d48380662b41d72f3571f550841146f1571ad5 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 11:26:24 +0200 Subject: [PATCH 060/323] extends SPARQL parser to recognize ORDER BY for FOLD --- jena-arq/Grammar/arq.jj | 39 +- jena-arq/Grammar/main.jj | 40 +- .../expr/aggregate/AggregatorFactory.java | 9 +- .../jena/sparql/lang/arq/ARQParser.java | 1304 ++++--- .../sparql/lang/sparql_11/JavaCharStream.java | 155 +- .../sparql/lang/sparql_11/ParseException.java | 48 +- .../sparql/lang/sparql_11/SPARQLParser11.java | 3048 ++++++++--------- .../sparql_11/SPARQLParser11TokenManager.java | 749 ++-- .../jena/sparql/lang/sparql_11/Token.java | 7 +- .../sparql/lang/sparql_11/TokenMgrError.java | 37 +- 10 files changed, 2733 insertions(+), 2703 deletions(-) diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 57157bbd44f..709f90fabd0 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -298,6 +298,26 @@ void OrderCondition() : else getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} void LimitOffsetClauses() : { } { ( @@ -1619,14 +1639,25 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { Expr orderByExpr = null ; - Var orderByVar = null ; - int orderByDirection = Query.ORDER_DEFAULT ; } + { java.util.List scs = null ; + SortCondition sc = null ; } + ( { distinct = true ; } )? expr = Expression() ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? - { agg = AggregatorFactory.createFold(expr, expr2) ; } + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } | t = { String iri ; } iri = iri() diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 2a17409a5d7..469bd59bff6 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -470,6 +470,27 @@ void OrderCondition() : getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( // These are for clarity in the HTML + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() //{ expr = asExpr(v) ; } + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} + void LimitOffsetClauses() : { } { // SPARQL does not care about the order here. @@ -2270,14 +2291,25 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { Expr orderByExpr = null ; - Var orderByVar = null ; - int orderByDirection = Query.ORDER_DEFAULT ; } + { java.util.List scs = null ; + SortCondition sc = null ; } + ( { distinct = true ; } )? expr = Expression() ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? - { agg = AggregatorFactory.createFold(expr, expr2) ; } + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } /* Explicit syntax (aggregate even if not registered) */ | t = diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index d11f16dfde9..6c492069c18 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -18,8 +18,11 @@ package org.apache.jena.sparql.expr.aggregate ; +import java.util.List; + import org.apache.jena.atlas.lib.NotImplemented ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.expr.Expr ; import org.apache.jena.sparql.expr.ExprList ; @@ -71,7 +74,11 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, Expr expr2) { + public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { + if ( distinct ) + throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; + if ( orderBy != null ) + System.out.println( "HERE!! " + orderBy.size() ); return new AggFold(expr1, expr2) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 6ff84fa6625..eda7f2ec07b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -1515,6 +1515,223 @@ final public void OrderCondition() throws ParseException { getQuery().addOrderBy(v, direction) ; } + final public SortCondition OrderConditionForAggregationFunction() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + jj_consume_token(ASC); + direction = Query.ORDER_ASCENDING ; + break; + case DESC: + jj_consume_token(DESC); + direction = Query.ORDER_DESCENDING ; + break; + default: + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + expr = BrackettedExpression(); + break; + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + expr = Constraint(); + break; + case VAR1: + case VAR2: + v = Var(); + break; + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if ( v == null ) + {if (true) return new SortCondition(expr, direction) ;} + else + {if (true) return new SortCondition(v, direction) ;} + throw new Error("Missing return statement in function"); + } + final public void LimitOffsetClauses() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: @@ -1524,7 +1741,7 @@ final public void LimitOffsetClauses() throws ParseException { OffsetClause(); break; default: - jj_la1[37] = jj_gen; + jj_la1[40] = jj_gen; ; } break; @@ -1535,12 +1752,12 @@ final public void LimitOffsetClauses() throws ParseException { LimitClause(); break; default: - jj_la1[38] = jj_gen; + jj_la1[41] = jj_gen; ; } break; default: - jj_la1[39] = jj_gen; + jj_la1[42] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1570,7 +1787,7 @@ final public void ValuesClause() throws ParseException { finishValuesClause(t.beginLine, t.beginColumn) ; break; default: - jj_la1[40] = jj_gen; + jj_la1[43] = jj_gen; ; } } @@ -1609,12 +1826,12 @@ final public void Update() throws ParseException { Prologue(); break; default: - jj_la1[41] = jj_gen; + jj_la1[44] = jj_gen; ; } break; default: - jj_la1[42] = jj_gen; + jj_la1[45] = jj_gen; ; } } @@ -1659,7 +1876,7 @@ final public void Update1() throws ParseException { DeleteData(); break; default: - jj_la1[43] = jj_gen; + jj_la1[46] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1676,7 +1893,7 @@ final public Update Load() throws ParseException { silent = true ; break; default: - jj_la1[44] = jj_gen; + jj_la1[47] = jj_gen; ; } url = iri(); @@ -1686,7 +1903,7 @@ final public Update Load() throws ParseException { dest = GraphRef(); break; default: - jj_la1[45] = jj_gen; + jj_la1[48] = jj_gen; ; } {if (true) return new UpdateLoad(url, dest, silent) ;} @@ -1702,7 +1919,7 @@ final public Update Clear() throws ParseException { silent = true ; break; default: - jj_la1[46] = jj_gen; + jj_la1[49] = jj_gen; ; } target = GraphRefAll(); @@ -1719,7 +1936,7 @@ final public Update Drop() throws ParseException { silent = true ; break; default: - jj_la1[47] = jj_gen; + jj_la1[50] = jj_gen; ; } target = GraphRefAll(); @@ -1736,7 +1953,7 @@ final public Update Create() throws ParseException { silent=true ; break; default: - jj_la1[48] = jj_gen; + jj_la1[51] = jj_gen; ; } iri = GraphRef(); @@ -1753,7 +1970,7 @@ final public Update Add() throws ParseException { silent=true ; break; default: - jj_la1[49] = jj_gen; + jj_la1[52] = jj_gen; ; } src = GraphOrDefault(); @@ -1772,7 +1989,7 @@ final public Update Move() throws ParseException { silent=true ; break; default: - jj_la1[50] = jj_gen; + jj_la1[53] = jj_gen; ; } src = GraphOrDefault(); @@ -1791,7 +2008,7 @@ final public Update Copy() throws ParseException { silent=true ; break; default: - jj_la1[51] = jj_gen; + jj_la1[54] = jj_gen; ; } src = GraphOrDefault(); @@ -1843,7 +2060,7 @@ final public Update Modify() throws ParseException { Node n = createNode(iri) ; up.setWithIRI(n) ; break; default: - jj_la1[52] = jj_gen; + jj_la1[55] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1854,7 +2071,7 @@ final public Update Modify() throws ParseException { InsertClause(up); break; default: - jj_la1[53] = jj_gen; + jj_la1[56] = jj_gen; ; } break; @@ -1862,7 +2079,7 @@ final public Update Modify() throws ParseException { InsertClause(up); break; default: - jj_la1[54] = jj_gen; + jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1873,7 +2090,7 @@ final public Update Modify() throws ParseException { ; break; default: - jj_la1[55] = jj_gen; + jj_la1[58] = jj_gen; break label_15; } UsingClause(up); @@ -1924,7 +2141,7 @@ final public void UsingClause(UpdateWithUsing update) throws ParseException { n = createNode(iri) ; update.addUsingNamed(n) ; break; default: - jj_la1[56] = jj_gen; + jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1946,14 +2163,14 @@ final public Target GraphOrDefault() throws ParseException { jj_consume_token(GRAPH); break; default: - jj_la1[57] = jj_gen; + jj_la1[60] = jj_gen; ; } iri = iri(); {if (true) return Target.create(createNode(iri)) ;} break; default: - jj_la1[58] = jj_gen; + jj_la1[61] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1988,7 +2205,7 @@ final public Target GraphRefAll() throws ParseException { {if (true) return Target.ALL ;} break; default: - jj_la1[59] = jj_gen; + jj_la1[62] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2038,7 +2255,7 @@ final public void Quads(QuadAccSink acc) throws ParseException { TriplesTemplate(acc); break; default: - jj_la1[60] = jj_gen; + jj_la1[63] = jj_gen; ; } label_16: @@ -2048,7 +2265,7 @@ final public void Quads(QuadAccSink acc) throws ParseException { ; break; default: - jj_la1[61] = jj_gen; + jj_la1[64] = jj_gen; break label_16; } QuadsNotTriples(acc); @@ -2057,7 +2274,7 @@ final public void Quads(QuadAccSink acc) throws ParseException { jj_consume_token(DOT); break; default: - jj_la1[62] = jj_gen; + jj_la1[65] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2090,7 +2307,7 @@ final public void Quads(QuadAccSink acc) throws ParseException { TriplesTemplate(acc); break; default: - jj_la1[63] = jj_gen; + jj_la1[66] = jj_gen; ; } } @@ -2132,7 +2349,7 @@ final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { TriplesTemplate(acc); break; default: - jj_la1[64] = jj_gen; + jj_la1[67] = jj_gen; ; } jj_consume_token(RBRACE); @@ -2170,7 +2387,7 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { TriplesTemplate(acc); break; default: - jj_la1[65] = jj_gen; + jj_la1[68] = jj_gen; ; } label_17: @@ -2181,7 +2398,7 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { ; break; default: - jj_la1[66] = jj_gen; + jj_la1[69] = jj_gen; break label_17; } ConstructQuadsNotTriples(acc); @@ -2190,7 +2407,7 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { jj_consume_token(DOT); break; default: - jj_la1[67] = jj_gen; + jj_la1[70] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2223,7 +2440,7 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { TriplesTemplate(acc); break; default: - jj_la1[68] = jj_gen; + jj_la1[71] = jj_gen; ; } } @@ -2238,7 +2455,7 @@ final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseExceptio gn = VarOrBlankNodeOrIri(); break; default: - jj_la1[69] = jj_gen; + jj_la1[72] = jj_gen; ; } setAccGraph(acc, gn) ; @@ -2273,7 +2490,7 @@ final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseExceptio TriplesTemplate(acc); break; default: - jj_la1[70] = jj_gen; + jj_la1[73] = jj_gen; ; } jj_consume_token(RBRACE); @@ -2297,7 +2514,7 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { jj_consume_token(DOT); break; default: - jj_la1[71] = jj_gen; + jj_la1[74] = jj_gen; ; } } @@ -2314,7 +2531,7 @@ final public Element GroupGraphPattern() throws ParseException { el = new ElementSubQuery(q) ; break; default: - jj_la1[72] = jj_gen; + jj_la1[75] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); @@ -2359,7 +2576,7 @@ final public Element GroupGraphPatternSub() throws ParseException { elg.addElement(el) ; break; default: - jj_la1[73] = jj_gen; + jj_la1[76] = jj_gen; ; } label_19: @@ -2380,7 +2597,7 @@ final public Element GroupGraphPatternSub() throws ParseException { ; break; default: - jj_la1[74] = jj_gen; + jj_la1[77] = jj_gen; break label_19; } el = GraphPatternNotTriples(); @@ -2390,7 +2607,7 @@ final public Element GroupGraphPatternSub() throws ParseException { jj_consume_token(DOT); break; default: - jj_la1[75] = jj_gen; + jj_la1[78] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2426,7 +2643,7 @@ final public Element GroupGraphPatternSub() throws ParseException { elg.addElement(el) ; break; default: - jj_la1[76] = jj_gen; + jj_la1[79] = jj_gen; ; } } @@ -2472,12 +2689,12 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { TriplesBlock(acc); break; default: - jj_la1[77] = jj_gen; + jj_la1[80] = jj_gen; ; } break; default: - jj_la1[78] = jj_gen; + jj_la1[81] = jj_gen; ; } {if (true) return acc ;} @@ -2524,7 +2741,7 @@ final public Element GraphPatternNotTriples() throws ParseException { el = Unfold(); break; default: - jj_la1[79] = jj_gen; + jj_la1[82] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2558,7 +2775,7 @@ final public Element ServiceGraphPattern() throws ParseException { silent=true; break; default: - jj_la1[80] = jj_gen; + jj_la1[83] = jj_gen; ; } n = VarOrIri(); @@ -2602,7 +2819,7 @@ final public void DataBlock() throws ParseException { InlineDataFull(); break; default: - jj_la1[81] = jj_gen; + jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2640,7 +2857,7 @@ final public void InlineDataOneVar() throws ParseException { ; break; default: - jj_la1[82] = jj_gen; + jj_la1[85] = jj_gen; break label_20; } n = DataBlockValue(); @@ -2667,7 +2884,7 @@ final public void InlineDataFull() throws ParseException { ; break; default: - jj_la1[83] = jj_gen; + jj_la1[86] = jj_gen; break label_21; } v = Var(); @@ -2676,7 +2893,7 @@ final public void InlineDataFull() throws ParseException { jj_consume_token(RPAREN); break; default: - jj_la1[84] = jj_gen; + jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2689,7 +2906,7 @@ final public void InlineDataFull() throws ParseException { ; break; default: - jj_la1[85] = jj_gen; + jj_la1[88] = jj_gen; break label_22; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2723,7 +2940,7 @@ final public void InlineDataFull() throws ParseException { ; break; default: - jj_la1[86] = jj_gen; + jj_la1[89] = jj_gen; break label_23; } n = DataBlockValue(); @@ -2740,7 +2957,7 @@ final public void InlineDataFull() throws ParseException { finishDataBlockValueRow(beginLine, beginColumn) ; break; default: - jj_la1[87] = jj_gen; + jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2790,7 +3007,7 @@ final public Node DataBlockValue() throws ParseException { {if (true) return null ;} break; default: - jj_la1[88] = jj_gen; + jj_la1[91] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2840,7 +3057,7 @@ final public Element Unfold() throws ParseException { ; break; default: - jj_la1[89] = jj_gen; + jj_la1[92] = jj_gen; ; } jj_consume_token(RPAREN); @@ -2866,7 +3083,7 @@ final public Element GroupOrUnionGraphPattern() throws ParseException { ; break; default: - jj_la1[90] = jj_gen; + jj_la1[93] = jj_gen; break label_24; } jj_consume_token(UNION); @@ -2984,7 +3201,7 @@ final public Expr Constraint() throws ParseException { c = FunctionCall(); break; default: - jj_la1[91] = jj_gen; + jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3025,7 +3242,7 @@ final public Args ArgList() throws ParseException { beginLine, beginColumn) ; break; default: - jj_la1[92] = jj_gen; + jj_la1[95] = jj_gen; ; } expr = Expression(); @@ -3037,7 +3254,7 @@ final public Args ArgList() throws ParseException { ; break; default: - jj_la1[93] = jj_gen; + jj_la1[96] = jj_gen; break label_25; } jj_consume_token(COMMA); @@ -3047,7 +3264,7 @@ final public Args ArgList() throws ParseException { jj_consume_token(RPAREN); break; default: - jj_la1[94] = jj_gen; + jj_la1[97] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3072,7 +3289,7 @@ final public ExprList ExpressionList() throws ParseException { ; break; default: - jj_la1[95] = jj_gen; + jj_la1[98] = jj_gen; break label_26; } jj_consume_token(COMMA); @@ -3082,7 +3299,7 @@ final public ExprList ExpressionList() throws ParseException { jj_consume_token(RPAREN); break; default: - jj_la1[96] = jj_gen; + jj_la1[99] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3119,7 +3336,7 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { jj_consume_token(DOT); break; default: - jj_la1[97] = jj_gen; + jj_la1[100] = jj_gen; ; } } @@ -3162,7 +3379,7 @@ final public void TriplesSameSubject(TripleCollector acc) throws ParseException insert(acc, tempAcc) ; break; default: - jj_la1[98] = jj_gen; + jj_la1[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3179,7 +3396,7 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio PropertyListNotEmpty(s, acc); break; default: - jj_la1[99] = jj_gen; + jj_la1[102] = jj_gen; ; } } @@ -3195,7 +3412,7 @@ final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws Parse ; break; default: - jj_la1[100] = jj_gen; + jj_la1[103] = jj_gen; break label_28; } jj_consume_token(SEMICOLON); @@ -3210,7 +3427,7 @@ final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws Parse ObjectList(s, p, null, acc); break; default: - jj_la1[101] = jj_gen; + jj_la1[104] = jj_gen; ; } } @@ -3231,7 +3448,7 @@ final public Node Verb() throws ParseException { p = nRDFtype ; break; default: - jj_la1[102] = jj_gen; + jj_la1[105] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3249,7 +3466,7 @@ final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) thr ; break; default: - jj_la1[103] = jj_gen; + jj_la1[106] = jj_gen; break label_29; } jj_consume_token(COMMA); @@ -3303,7 +3520,7 @@ final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseExcept insert(acc, tempAcc) ; break; default: - jj_la1[104] = jj_gen; + jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3326,7 +3543,7 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce PropertyListPathNotEmpty(s, acc); break; default: - jj_la1[105] = jj_gen; + jj_la1[108] = jj_gen; ; } } @@ -3351,7 +3568,7 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P p = VerbSimple(); break; default: - jj_la1[106] = jj_gen; + jj_la1[109] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3363,7 +3580,7 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P ; break; default: - jj_la1[107] = jj_gen; + jj_la1[110] = jj_gen; break label_30; } jj_consume_token(SEMICOLON); @@ -3399,14 +3616,14 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P p = VerbSimple(); break; default: - jj_la1[108] = jj_gen; + jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); break; default: - jj_la1[109] = jj_gen; + jj_la1[112] = jj_gen; ; } } @@ -3436,7 +3653,7 @@ final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) ; break; default: - jj_la1[110] = jj_gen; + jj_la1[113] = jj_gen; break label_31; } jj_consume_token(COMMA); @@ -3478,7 +3695,7 @@ final public Path PathAlternative() throws ParseException { ; break; default: - jj_la1[111] = jj_gen; + jj_la1[114] = jj_gen; break label_32; } jj_consume_token(VBAR); @@ -3500,7 +3717,7 @@ final public Path PathSequence() throws ParseException { ; break; default: - jj_la1[112] = jj_gen; + jj_la1[115] = jj_gen; break label_33; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -3515,7 +3732,7 @@ final public Path PathSequence() throws ParseException { p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; break; default: - jj_la1[113] = jj_gen; + jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3535,7 +3752,7 @@ final public Path PathElt() throws ParseException { p = PathMod(p); break; default: - jj_la1[114] = jj_gen; + jj_la1[117] = jj_gen; ; } {if (true) return p ;} @@ -3562,7 +3779,7 @@ final public Path PathEltOrInverse() throws ParseException { p = PathFactory.pathInverse(p) ; break; default: - jj_la1[115] = jj_gen; + jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3614,7 +3831,7 @@ final public Path PathMod(Path p) throws ParseException { {if (true) return PathFactory.pathMod(p, i1, i2) ;} break; default: - jj_la1[116] = jj_gen; + jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3624,7 +3841,7 @@ final public Path PathMod(Path p) throws ParseException { {if (true) return PathFactory.pathFixedLength(p, i1) ;} break; default: - jj_la1[117] = jj_gen; + jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3636,13 +3853,13 @@ final public Path PathMod(Path p) throws ParseException { {if (true) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} break; default: - jj_la1[118] = jj_gen; + jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[119] = jj_gen; + jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3693,7 +3910,7 @@ final public Path PathPrimary() throws ParseException { jj_consume_token(RPAREN); break; default: - jj_la1[120] = jj_gen; + jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3730,7 +3947,7 @@ final public Path PathNegatedPropertySet() throws ParseException { ; break; default: - jj_la1[121] = jj_gen; + jj_la1[124] = jj_gen; break label_34; } jj_consume_token(VBAR); @@ -3739,13 +3956,13 @@ final public Path PathNegatedPropertySet() throws ParseException { } break; default: - jj_la1[122] = jj_gen; + jj_la1[125] = jj_gen; ; } jj_consume_token(RPAREN); break; default: - jj_la1[123] = jj_gen; + jj_la1[126] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3780,13 +3997,13 @@ final public P_Path0 PathOneInPropertySet() throws ParseException { {if (true) return new P_ReverseLink(nRDFtype) ;} break; default: - jj_la1[124] = jj_gen; + jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[125] = jj_gen; + jj_la1[128] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3812,7 +4029,7 @@ final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { {if (true) return n ;} break; default: - jj_la1[126] = jj_gen; + jj_la1[129] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3841,7 +4058,7 @@ final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {if (true) return n ;} break; default: - jj_la1[127] = jj_gen; + jj_la1[130] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3903,7 +4120,7 @@ final public Node Collection(TripleCollectorMark acc) throws ParseException { ; break; default: - jj_la1[128] = jj_gen; + jj_la1[131] = jj_gen; break label_35; } } @@ -3959,7 +4176,7 @@ final public Node CollectionPath(TripleCollectorMark acc) throws ParseException ; break; default: - jj_la1[129] = jj_gen; + jj_la1[132] = jj_gen; break label_36; } } @@ -3980,7 +4197,7 @@ final public void AnnotationPath(TripleCollector acc, Node s, Node p, Path path, jj_consume_token(R_ANN); break; default: - jj_la1[130] = jj_gen; + jj_la1[133] = jj_gen; ; } } @@ -3995,7 +4212,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(R_ANN); break; default: - jj_la1[131] = jj_gen; + jj_la1[134] = jj_gen; ; } } @@ -4036,7 +4253,7 @@ final public Node GraphNode(TripleCollectorMark acc) throws ParseException { {if (true) return n ;} break; default: - jj_la1[132] = jj_gen; + jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4079,7 +4296,7 @@ final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { {if (true) return n ;} break; default: - jj_la1[133] = jj_gen; + jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4120,7 +4337,7 @@ final public Node VarOrTerm() throws ParseException { n = GraphTerm(); break; default: - jj_la1[134] = jj_gen; + jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4156,7 +4373,7 @@ final public Node TripleTermData() throws ParseException { p = nRDFtype ; break; default: - jj_la1[135] = jj_gen; + jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4205,7 +4422,7 @@ final public Node DataValueTerm() throws ParseException { {if (true) return n ;} break; default: - jj_la1[136] = jj_gen; + jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4226,7 +4443,7 @@ final public Node VarOrIri() throws ParseException { n = createNode(iri) ; break; default: - jj_la1[137] = jj_gen; + jj_la1[140] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4252,7 +4469,7 @@ final public Node VarOrBlankNodeOrIri() throws ParseException { n = createNode(iri) ; break; default: - jj_la1[138] = jj_gen; + jj_la1[141] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4270,7 +4487,7 @@ final public Var Var() throws ParseException { t = jj_consume_token(VAR2); break; default: - jj_la1[139] = jj_gen; + jj_la1[142] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4321,7 +4538,7 @@ final public Node GraphTerm() throws ParseException { {if (true) return nRDFnil ;} break; default: - jj_la1[140] = jj_gen; + jj_la1[143] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4345,7 +4562,7 @@ final public Expr ConditionalOrExpression() throws ParseException { ; break; default: - jj_la1[141] = jj_gen; + jj_la1[144] = jj_gen; break label_37; } jj_consume_token(SC_OR); @@ -4366,7 +4583,7 @@ final public Expr ConditionalAndExpression() throws ParseException { ; break; default: - jj_la1[142] = jj_gen; + jj_la1[145] = jj_gen; break label_38; } jj_consume_token(SC_AND); @@ -4439,13 +4656,13 @@ final public Expr RelationalExpression() throws ParseException { expr1 = new E_NotOneOf(expr1, a) ; break; default: - jj_la1[143] = jj_gen; + jj_la1[146] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[144] = jj_gen; + jj_la1[147] = jj_gen; ; } {if (true) return expr1 ;} @@ -4476,7 +4693,7 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: - jj_la1[145] = jj_gen; + jj_la1[148] = jj_gen; break label_39; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4514,7 +4731,7 @@ final public Expr AdditiveExpression() throws ParseException { addition = false ; break; default: - jj_la1[146] = jj_gen; + jj_la1[149] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4526,7 +4743,7 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: - jj_la1[147] = jj_gen; + jj_la1[150] = jj_gen; break label_40; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4541,7 +4758,7 @@ final public Expr AdditiveExpression() throws ParseException { expr2 = new E_Divide(expr2, expr3) ; break; default: - jj_la1[148] = jj_gen; + jj_la1[151] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4552,7 +4769,7 @@ final public Expr AdditiveExpression() throws ParseException { expr1 = new E_Subtract(expr1, expr2) ; break; default: - jj_la1[149] = jj_gen; + jj_la1[152] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4574,7 +4791,7 @@ final public Expr MultiplicativeExpression() throws ParseException { ; break; default: - jj_la1[150] = jj_gen; + jj_la1[153] = jj_gen; break label_41; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4599,7 +4816,7 @@ final public Expr MultiplicativeExpression() throws ParseException { expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; default: - jj_la1[151] = jj_gen; + jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4732,7 +4949,7 @@ final public Expr UnaryExpression() throws ParseException { {if (true) return expr ;} break; default: - jj_la1[152] = jj_gen; + jj_la1[155] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4869,7 +5086,7 @@ final public Expr PrimaryExpression() throws ParseException { {if (true) return asExpr(n) ;} break; default: - jj_la1[153] = jj_gen; + jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4914,7 +5131,7 @@ final public Node ExprVarOrTerm() throws ParseException { n = ExprTripleTerm(); break; default: - jj_la1[154] = jj_gen; + jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5015,7 +5232,7 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: - jj_la1[155] = jj_gen; + jj_la1[158] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5031,7 +5248,7 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: - jj_la1[156] = jj_gen; + jj_la1[159] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5051,7 +5268,7 @@ final public Expr BuiltInCall() throws ParseException { {if (true) return new E_BNode() ;} break; default: - jj_la1[157] = jj_gen; + jj_la1[160] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5322,7 +5539,7 @@ final public Expr BuiltInCall() throws ParseException { ; break; default: - jj_la1[158] = jj_gen; + jj_la1[161] = jj_gen; break label_42; } jj_consume_token(COMMA); @@ -5457,7 +5674,7 @@ final public Expr BuiltInCall() throws ParseException { {if (true) return new E_TripleObject(expr) ;} break; default: - jj_la1[159] = jj_gen; + jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5477,7 +5694,7 @@ final public Expr RegexExpression() throws ParseException { flagsExpr = Expression(); break; default: - jj_la1[160] = jj_gen; + jj_la1[163] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5498,7 +5715,7 @@ final public Expr SubstringExpression() throws ParseException { expr3 = Expression(); break; default: - jj_la1[161] = jj_gen; + jj_la1[164] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5521,7 +5738,7 @@ final public Expr StrReplaceExpression() throws ParseException { expr4 = Expression(); break; default: - jj_la1[162] = jj_gen; + jj_la1[165] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5563,7 +5780,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[163] = jj_gen; + jj_la1[166] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -5678,7 +5895,7 @@ final public Expr Aggregate() throws ParseException { expr = Expression(); break; default: - jj_la1[164] = jj_gen; + jj_la1[167] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5695,7 +5912,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[165] = jj_gen; + jj_la1[168] = jj_gen; ; } expr = Expression(); @@ -5711,7 +5928,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[166] = jj_gen; + jj_la1[169] = jj_gen; ; } expr = Expression(); @@ -5727,7 +5944,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[167] = jj_gen; + jj_la1[170] = jj_gen; ; } expr = Expression(); @@ -5743,7 +5960,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[168] = jj_gen; + jj_la1[171] = jj_gen; ; } expr = Expression(); @@ -5759,7 +5976,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[169] = jj_gen; + jj_la1[172] = jj_gen; ; } expr = Expression(); @@ -5775,7 +5992,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[170] = jj_gen; + jj_la1[173] = jj_gen; ; } expr = Expression(); @@ -5791,7 +6008,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[171] = jj_gen; + jj_la1[174] = jj_gen; ; } expr = Expression(); @@ -5807,7 +6024,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[172] = jj_gen; + jj_la1[175] = jj_gen; ; } expr = Expression(); @@ -5827,7 +6044,7 @@ final public Expr Aggregate() throws ParseException { ordered.add(expr2) ; break; default: - jj_la1[173] = jj_gen; + jj_la1[176] = jj_gen; ; } } else { @@ -5840,14 +6057,14 @@ final public Expr Aggregate() throws ParseException { ordered.add(expr2) ; break; default: - jj_la1[174] = jj_gen; + jj_la1[177] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; default: - jj_la1[175] = jj_gen; + jj_la1[178] = jj_gen; ; } jj_consume_token(RPAREN); @@ -5862,7 +6079,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[176] = jj_gen; + jj_la1[179] = jj_gen; ; } expr = Expression(); @@ -5878,7 +6095,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[177] = jj_gen; + jj_la1[180] = jj_gen; ; } expr = Expression(); @@ -5894,7 +6111,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[178] = jj_gen; + jj_la1[181] = jj_gen; ; } expr = Expression(); @@ -5910,7 +6127,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[179] = jj_gen; + jj_la1[182] = jj_gen; ; } expr = Expression(); @@ -5926,7 +6143,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[180] = jj_gen; + jj_la1[183] = jj_gen; ; } expr = Expression(); @@ -5942,7 +6159,7 @@ final public Expr Aggregate() throws ParseException { distinct = true ; break; default: - jj_la1[181] = jj_gen; + jj_la1[184] = jj_gen; ; } expr = Expression(); @@ -5951,10 +6168,18 @@ final public Expr Aggregate() throws ParseException { break; case FOLD: t = jj_consume_token(FOLD); - Expr orderByExpr = null ; - Var orderByVar = null ; - int orderByDirection = Query.ORDER_DEFAULT ; + java.util.List scs = null ; + SortCondition sc = null ; jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: + jj_consume_token(DISTINCT); + distinct = true ; + break; + default: + jj_la1[185] = jj_gen; + ; + } expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: @@ -5962,11 +6187,122 @@ final public Expr Aggregate() throws ParseException { expr2 = Expression(); break; default: - jj_la1[182] = jj_gen; + jj_la1[186] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: + jj_consume_token(ORDER); + jj_consume_token(BY); + label_43: + while (true) { + sc = OrderConditionForAggregationFunction(); + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case ASC: + case DESC: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + ; + break; + default: + jj_la1[187] = jj_gen; + break label_43; + } + } + break; + default: + jj_la1[188] = jj_gen; ; } jj_consume_token(RPAREN); - agg = AggregatorFactory.createFold(expr, expr2) ; + agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; break; case AGG: t = jj_consume_token(AGG); @@ -5977,7 +6313,7 @@ final public Expr Aggregate() throws ParseException { agg = AggregatorFactory.createCustom(iri, a) ; break; default: - jj_la1[183] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6000,7 +6336,7 @@ final public Expr iriOrFunction() throws ParseException { a = ArgList(); break; default: - jj_la1[184] = jj_gen; + jj_la1[190] = jj_gen; ; } if ( a == null ) @@ -6033,13 +6369,13 @@ final public Node RDFLiteral() throws ParseException { uri = iri(); break; default: - jj_la1[185] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[186] = jj_gen; + jj_la1[192] = jj_gen; ; } {if (true) return createLiteral(lex, lang, uri) ;} @@ -6065,7 +6401,7 @@ final public Node NumericLiteral() throws ParseException { n = NumericLiteralNegative(); break; default: - jj_la1[187] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6089,7 +6425,7 @@ final public Node NumericLiteralUnsigned() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[188] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6112,7 +6448,7 @@ final public Node NumericLiteralPositive() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[189] = jj_gen; + jj_la1[195] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6135,7 +6471,7 @@ final public Node NumericLiteralNegative() throws ParseException { {if (true) return createLiteralDouble(t.image) ;} break; default: - jj_la1[190] = jj_gen; + jj_la1[196] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6153,7 +6489,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE ;} break; default: - jj_la1[191] = jj_gen; + jj_la1[197] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6180,7 +6516,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[192] = jj_gen; + jj_la1[198] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6203,7 +6539,7 @@ final public String iri() throws ParseException { {if (true) return iri ;} break; default: - jj_la1[193] = jj_gen; + jj_la1[199] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6222,7 +6558,7 @@ final public String PrefixedName() throws ParseException { {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; default: - jj_la1[194] = jj_gen; + jj_la1[200] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6241,7 +6577,7 @@ final public Node BlankNode() throws ParseException { {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; default: - jj_la1[195] = jj_gen; + jj_la1[201] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -6290,81 +6626,35 @@ private boolean jj_2_5(int xla) { finally { jj_save(4, xla); } } - private boolean jj_3R_119() { - if (jj_scan_token(REGEX)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_109() { - if (jj_scan_token(OBJECT)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_108() { - if (jj_scan_token(PREDICATE)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_107() { - if (jj_scan_token(SUBJECT)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_106() { - if (jj_scan_token(TRIPLE)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_105() { - if (jj_scan_token(IS_TRIPLE)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_104() { - if (jj_3R_121()) return true; - return false; - } - private boolean jj_3R_103() { if (jj_3R_120()) return true; return false; } private boolean jj_3R_102() { - if (jj_3R_119()) return true; - return false; - } - - private boolean jj_3R_101() { if (jj_scan_token(IS_NUMERIC)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_157() { + private boolean jj_3R_158() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_100() { + private boolean jj_3R_101() { if (jj_scan_token(IS_LITERAL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_99() { + private boolean jj_3R_100() { if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_98() { + private boolean jj_3R_99() { if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -6372,7 +6662,7 @@ private boolean jj_3R_98() { private boolean jj_3_2() { if (jj_scan_token(SEMICOLON)) return true; - if (jj_3R_44()) return true; + if (jj_3R_45()) return true; Token xsp; xsp = jj_scanpos; if (jj_scan_token(147)) { @@ -6418,360 +6708,358 @@ private boolean jj_3_2() { return false; } - private boolean jj_3R_97() { + private boolean jj_3R_98() { if (jj_scan_token(IS_IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_96() { + private boolean jj_3R_97() { if (jj_scan_token(SAME_TERM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_95() { + private boolean jj_3R_96() { if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_94() { + private boolean jj_3R_95() { if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_93() { + private boolean jj_3R_94() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_158() { + private boolean jj_3R_159() { if (jj_scan_token(LBRACKET)) return true; return false; } - private boolean jj_3R_92() { + private boolean jj_3R_93() { if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_91() { + private boolean jj_3R_92() { if (jj_scan_token(COALESCE)) return true; - if (jj_3R_116()) return true; + if (jj_3R_117()) return true; return false; } - private boolean jj_3R_151() { - if (jj_3R_158()) return true; + private boolean jj_3R_152() { + if (jj_3R_159()) return true; return false; } - private boolean jj_3R_90() { + private boolean jj_3R_91() { if (jj_scan_token(VERSION)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_89() { + private boolean jj_3R_90() { if (jj_scan_token(SHA512)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_125() { + private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; - if (jj_3R_150()) { + if (jj_3R_151()) { jj_scanpos = xsp; - if (jj_3R_151()) return true; + if (jj_3R_152()) return true; } return false; } - private boolean jj_3R_150() { - if (jj_3R_157()) return true; + private boolean jj_3R_151() { + if (jj_3R_158()) return true; return false; } - private boolean jj_3R_88() { + private boolean jj_3R_89() { if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_87() { + private boolean jj_3R_88() { if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_86() { + private boolean jj_3R_87() { if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_85() { + private boolean jj_3R_86() { if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_84() { + private boolean jj_3R_85() { if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_83() { + private boolean jj_3R_84() { if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_82() { + private boolean jj_3R_83() { if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_81() { + private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_80() { + private boolean jj_3R_81() { if (jj_scan_token(TIMEZONE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_79() { + private boolean jj_3R_80() { if (jj_scan_token(SECONDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_78() { + private boolean jj_3R_79() { if (jj_scan_token(MINUTES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_77() { + private boolean jj_3R_78() { if (jj_scan_token(HOURS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_76() { + private boolean jj_3R_77() { if (jj_scan_token(DAY)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_75() { + private boolean jj_3R_76() { if (jj_scan_token(MONTH)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_74() { + private boolean jj_3R_75() { if (jj_scan_token(YEAR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_73() { + private boolean jj_3R_74() { if (jj_scan_token(STRAFTER)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_72() { + private boolean jj_3R_73() { if (jj_scan_token(STRBEFORE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_71() { + private boolean jj_3R_72() { if (jj_scan_token(STRENDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_70() { + private boolean jj_3R_71() { if (jj_scan_token(STRSTARTS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_69() { + private boolean jj_3R_70() { if (jj_scan_token(CONTAINS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_68() { + private boolean jj_3R_69() { if (jj_scan_token(ENCODE_FOR_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_67() { + private boolean jj_3R_68() { if (jj_scan_token(LCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_66() { + private boolean jj_3R_67() { if (jj_scan_token(UCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_65() { - if (jj_3R_118()) return true; + private boolean jj_3R_66() { + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_64() { + private boolean jj_3R_65() { if (jj_scan_token(STRLEN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_63() { - if (jj_3R_117()) return true; + private boolean jj_3R_64() { + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_62() { + private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; - if (jj_3R_116()) return true; + if (jj_3R_117()) return true; return false; } - private boolean jj_3R_61() { + private boolean jj_3R_62() { if (jj_scan_token(IDIV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_60() { + private boolean jj_3R_61() { if (jj_scan_token(MOD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_59() { + private boolean jj_3R_60() { if (jj_scan_token(ROUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_58() { + private boolean jj_3R_59() { if (jj_scan_token(FLOOR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_57() { + private boolean jj_3R_58() { if (jj_scan_token(CEIL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_56() { + private boolean jj_3R_57() { if (jj_scan_token(ABS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_55() { + private boolean jj_3R_56() { if (jj_scan_token(RAND)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_115() { + private boolean jj_3R_116() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_114() { + private boolean jj_3R_115() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_54() { + private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_114()) { + if (jj_3R_115()) { jj_scanpos = xsp; - if (jj_3R_115()) return true; + if (jj_3R_116()) return true; } return false; } - private boolean jj_3R_53() { + private boolean jj_3R_54() { if (jj_scan_token(URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_52() { + private boolean jj_3R_53() { if (jj_scan_token(IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_51() { + private boolean jj_3R_52() { if (jj_scan_token(BOUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_50() { + private boolean jj_3R_51() { if (jj_scan_token(DTYPE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_49() { + private boolean jj_3R_50() { if (jj_scan_token(LANGMATCHES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_48() { + private boolean jj_3R_49() { if (jj_scan_token(LANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_47() { + private boolean jj_3R_48() { if (jj_scan_token(STR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_46() { - if (jj_3R_113()) return true; + private boolean jj_3R_47() { + if (jj_3R_114()) return true; return false; } - private boolean jj_3R_43() { + private boolean jj_3R_44() { Token xsp; xsp = jj_scanpos; - if (jj_3R_46()) { - jj_scanpos = xsp; if (jj_3R_47()) { jj_scanpos = xsp; if (jj_3R_48()) { @@ -6896,7 +7184,9 @@ private boolean jj_3R_43() { jj_scanpos = xsp; if (jj_3R_108()) { jj_scanpos = xsp; - if (jj_3R_109()) return true; + if (jj_3R_109()) { + jj_scanpos = xsp; + if (jj_3R_110()) return true; } } } @@ -6963,222 +7253,227 @@ private boolean jj_3R_43() { return false; } - private boolean jj_3R_153() { + private boolean jj_3R_154() { if (jj_scan_token(IRIref)) return true; return false; } - private boolean jj_3R_181() { + private boolean jj_3R_182() { if (jj_scan_token(ANON)) return true; return false; } - private boolean jj_3R_171() { + private boolean jj_3R_172() { Token xsp; xsp = jj_scanpos; - if (jj_3R_180()) { + if (jj_3R_181()) { jj_scanpos = xsp; - if (jj_3R_181()) return true; + if (jj_3R_182()) return true; } return false; } - private boolean jj_3R_180() { + private boolean jj_3R_181() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; } - private boolean jj_3R_173() { + private boolean jj_3R_174() { if (jj_scan_token(PNAME_NS)) return true; return false; } - private boolean jj_3R_172() { + private boolean jj_3R_173() { if (jj_scan_token(PNAME_LN)) return true; return false; } - private boolean jj_3R_167() { + private boolean jj_3R_168() { Token xsp; xsp = jj_scanpos; - if (jj_3R_172()) { + if (jj_3R_173()) { jj_scanpos = xsp; - if (jj_3R_173()) return true; + if (jj_3R_174()) return true; } return false; } - private boolean jj_3R_160() { - if (jj_3R_167()) return true; + private boolean jj_3R_161() { + if (jj_3R_168()) return true; return false; } - private boolean jj_3R_152() { + private boolean jj_3R_153() { Token xsp; xsp = jj_scanpos; - if (jj_3R_159()) { + if (jj_3R_160()) { jj_scanpos = xsp; - if (jj_3R_160()) return true; + if (jj_3R_161()) return true; } return false; } - private boolean jj_3R_159() { - if (jj_3R_153()) return true; + private boolean jj_3R_160() { + if (jj_3R_154()) return true; return false; } - private boolean jj_3R_185() { + private boolean jj_3R_186() { if (jj_scan_token(STRING_LITERAL_LONG2)) return true; return false; } - private boolean jj_3R_184() { + private boolean jj_3R_185() { if (jj_scan_token(STRING_LITERAL_LONG1)) return true; return false; } - private boolean jj_3R_183() { + private boolean jj_3R_184() { if (jj_scan_token(STRING_LITERAL2)) return true; return false; } - private boolean jj_3R_182() { + private boolean jj_3R_183() { if (jj_scan_token(STRING_LITERAL1)) return true; return false; } - private boolean jj_3R_144() { - if (jj_scan_token(LBRACE)) return true; - return false; - } - - private boolean jj_3_3() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_45()) return true; - return false; - } - - private boolean jj_3R_174() { + private boolean jj_3R_175() { Token xsp; xsp = jj_scanpos; - if (jj_3R_182()) { - jj_scanpos = xsp; if (jj_3R_183()) { jj_scanpos = xsp; if (jj_3R_184()) { jj_scanpos = xsp; - if (jj_3R_185()) return true; + if (jj_3R_185()) { + jj_scanpos = xsp; + if (jj_3R_186()) return true; } } } return false; } - private boolean jj_3R_179() { + private boolean jj_3R_180() { if (jj_scan_token(FALSE)) return true; return false; } - private boolean jj_3R_170() { + private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_178()) { + if (jj_3R_179()) { jj_scanpos = xsp; - if (jj_3R_179()) return true; + if (jj_3R_180()) return true; } return false; } - private boolean jj_3R_178() { + private boolean jj_3R_179() { if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_197() { + private boolean jj_3R_145() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3R_198() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_196() { + private boolean jj_3R_197() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_195() { + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_196() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } - private boolean jj_3R_188() { + private boolean jj_3R_189() { Token xsp; xsp = jj_scanpos; - if (jj_3R_195()) { - jj_scanpos = xsp; if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_197()) return true; + if (jj_3R_197()) { + jj_scanpos = xsp; + if (jj_3R_198()) return true; } } return false; } - private boolean jj_3R_194() { + private boolean jj_3R_195() { if (jj_scan_token(DOUBLE_POSITIVE)) return true; return false; } - private boolean jj_3R_193() { + private boolean jj_3R_194() { if (jj_scan_token(DECIMAL_POSITIVE)) return true; return false; } - private boolean jj_3R_192() { + private boolean jj_3R_193() { if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } - private boolean jj_3R_187() { + private boolean jj_3R_188() { Token xsp; xsp = jj_scanpos; - if (jj_3R_192()) { - jj_scanpos = xsp; if (jj_3R_193()) { jj_scanpos = xsp; - if (jj_3R_194()) return true; + if (jj_3R_194()) { + jj_scanpos = xsp; + if (jj_3R_195()) return true; } } return false; } - private boolean jj_3R_191() { + private boolean jj_3R_192() { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_190() { + private boolean jj_3R_191() { if (jj_scan_token(DECIMAL)) return true; return false; } - private boolean jj_3R_189() { + private boolean jj_3R_190() { if (jj_scan_token(INTEGER)) return true; return false; } - private boolean jj_3R_186() { + private boolean jj_3R_187() { Token xsp; xsp = jj_scanpos; - if (jj_3R_189()) { - jj_scanpos = xsp; if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_191()) return true; + if (jj_3R_191()) { + jj_scanpos = xsp; + if (jj_3R_192()) return true; } } return false; } + private boolean jj_3R_178() { + if (jj_3R_189()) return true; + return false; + } + private boolean jj_3R_177() { if (jj_3R_188()) return true; return false; @@ -7189,39 +7484,40 @@ private boolean jj_3R_176() { return false; } - private boolean jj_3R_175() { - if (jj_3R_186()) return true; - return false; - } - - private boolean jj_3R_169() { + private boolean jj_3R_170() { Token xsp; xsp = jj_scanpos; - if (jj_3R_175()) { - jj_scanpos = xsp; if (jj_3R_176()) { jj_scanpos = xsp; - if (jj_3R_177()) return true; + if (jj_3R_177()) { + jj_scanpos = xsp; + if (jj_3R_178()) return true; } } return false; } - private boolean jj_3R_168() { - if (jj_3R_174()) return true; + private boolean jj_3R_169() { + if (jj_3R_175()) return true; return false; } - private boolean jj_3_1() { - if (jj_3R_43()) return true; + private boolean jj_3R_143() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_153()) return true; return false; } - private boolean jj_3R_166() { + private boolean jj_3R_167() { if (jj_scan_token(NIL)) return true; return false; } + private boolean jj_3R_166() { + if (jj_3R_172()) return true; + return false; + } + private boolean jj_3R_165() { if (jj_3R_171()) return true; return false; @@ -7237,21 +7533,14 @@ private boolean jj_3R_163() { return false; } - private boolean jj_3R_162() { - if (jj_3R_168()) return true; - return false; - } - - private boolean jj_3R_112() { - if (jj_3R_125()) return true; + private boolean jj_3R_113() { + if (jj_3R_126()) return true; return false; } - private boolean jj_3R_156() { + private boolean jj_3R_157() { Token xsp; xsp = jj_scanpos; - if (jj_3R_161()) { - jj_scanpos = xsp; if (jj_3R_162()) { jj_scanpos = xsp; if (jj_3R_163()) { @@ -7260,7 +7549,9 @@ private boolean jj_3R_156() { jj_scanpos = xsp; if (jj_3R_165()) { jj_scanpos = xsp; - if (jj_3R_166()) return true; + if (jj_3R_166()) { + jj_scanpos = xsp; + if (jj_3R_167()) return true; } } } @@ -7269,27 +7560,27 @@ private boolean jj_3R_156() { return false; } - private boolean jj_3R_161() { - if (jj_3R_152()) return true; + private boolean jj_3R_162() { + if (jj_3R_153()) return true; return false; } - private boolean jj_3R_45() { + private boolean jj_3R_46() { Token xsp; xsp = jj_scanpos; - if (jj_3R_111()) { + if (jj_3R_112()) { jj_scanpos = xsp; - if (jj_3R_112()) return true; + if (jj_3R_113()) return true; } return false; } - private boolean jj_3R_111() { - if (jj_3R_124()) return true; + private boolean jj_3R_112() { + if (jj_3R_125()) return true; return false; } - private boolean jj_3R_155() { + private boolean jj_3R_156() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7299,215 +7590,212 @@ private boolean jj_3R_155() { return false; } - private boolean jj_3R_142() { - if (jj_scan_token(AGG)) return true; - if (jj_3R_152()) return true; + private boolean jj_3_4() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; return false; } - private boolean jj_3_4() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_45()) return true; + private boolean jj_3_1() { + if (jj_3R_44()) return true; return false; } - private boolean jj_3R_141() { + private boolean jj_3R_142() { if (jj_scan_token(FOLD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_140() { + private boolean jj_3R_141() { if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_139() { + private boolean jj_3R_140() { if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_123() { - if (jj_3R_146()) return true; - return false; - } - - private boolean jj_3R_138() { + private boolean jj_3R_139() { if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_137() { + private boolean jj_3R_138() { if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_146() { - if (jj_scan_token(PREFIX)) return true; - if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_153()) return true; - return false; - } - - private boolean jj_3R_136() { + private boolean jj_3R_137() { if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_135() { + private boolean jj_3R_136() { if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_143() { + private boolean jj_3R_144() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_145() { - if (jj_scan_token(BASE)) return true; - if (jj_3R_153()) return true; - return false; - } - - private boolean jj_3R_116() { + private boolean jj_3R_117() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(185)) { jj_scanpos = xsp; - if (jj_3R_143()) return true; - } - return false; - } - - private boolean jj_3R_110() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_122()) { - jj_scanpos = xsp; - if (jj_3R_123()) return true; + if (jj_3R_144()) return true; } return false; } - private boolean jj_3R_122() { - if (jj_3R_145()) return true; - return false; - } - private boolean jj_3_5() { if (jj_scan_token(SEMICOLON)) return true; if (jj_scan_token(SEPARATOR)) return true; return false; } - private boolean jj_3R_44() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_110()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_135() { + if (jj_scan_token(GROUP_CONCAT)) return true; + if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_134() { - if (jj_scan_token(GROUP_CONCAT)) return true; - if (jj_scan_token(LPAREN)) return true; + private boolean jj_3R_124() { + if (jj_3R_147()) return true; return false; } - private boolean jj_3R_133() { + private boolean jj_3R_134() { if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_132() { + private boolean jj_3R_133() { if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_154() { + private boolean jj_3R_147() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_155() { if (jj_scan_token(LT2)) return true; return false; } - private boolean jj_3R_131() { + private boolean jj_3R_132() { if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_130() { + private boolean jj_3R_131() { if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_149() { - if (jj_3R_156()) return true; + private boolean jj_3R_150() { + if (jj_3R_157()) return true; return false; } - private boolean jj_3R_148() { - if (jj_3R_155()) return true; + private boolean jj_3R_149() { + if (jj_3R_156()) return true; return false; } - private boolean jj_3R_129() { + private boolean jj_3R_130() { if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_147() { + private boolean jj_3R_148() { + if (jj_3R_155()) return true; + return false; + } + + private boolean jj_3R_146() { + if (jj_scan_token(BASE)) return true; if (jj_3R_154()) return true; return false; } - private boolean jj_3R_128() { + private boolean jj_3R_129() { if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_124() { + private boolean jj_3R_125() { Token xsp; xsp = jj_scanpos; - if (jj_3R_147()) { - jj_scanpos = xsp; if (jj_3R_148()) { jj_scanpos = xsp; - if (jj_3R_149()) return true; + if (jj_3R_149()) { + jj_scanpos = xsp; + if (jj_3R_150()) return true; } } return false; } - private boolean jj_3R_127() { + private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) { + jj_scanpos = xsp; + if (jj_3R_124()) return true; + } + return false; + } + + private boolean jj_3R_123() { + if (jj_3R_146()) return true; + return false; + } + + private boolean jj_3R_128() { if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_126() { + private boolean jj_3R_45() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_111()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_127() { if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_113() { + private boolean jj_3R_114() { Token xsp; xsp = jj_scanpos; - if (jj_3R_126()) { - jj_scanpos = xsp; if (jj_3R_127()) { jj_scanpos = xsp; if (jj_3R_128()) { @@ -7538,7 +7826,9 @@ private boolean jj_3R_113() { jj_scanpos = xsp; if (jj_3R_141()) { jj_scanpos = xsp; - if (jj_3R_142()) return true; + if (jj_3R_142()) { + jj_scanpos = xsp; + if (jj_3R_143()) return true; } } } @@ -7558,30 +7848,76 @@ private boolean jj_3R_113() { return false; } - private boolean jj_3R_121() { + private boolean jj_3R_122() { if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } - private boolean jj_3R_120() { + private boolean jj_3R_121() { if (jj_scan_token(EXISTS)) return true; - if (jj_3R_144()) return true; + if (jj_3R_145()) return true; return false; } - private boolean jj_3R_118() { + private boolean jj_3R_119() { if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_117() { + private boolean jj_3R_118() { if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } + private boolean jj_3R_120() { + if (jj_scan_token(REGEX)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_110() { + if (jj_scan_token(OBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_scan_token(PREDICATE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_scan_token(SUBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_107() { + if (jj_scan_token(TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_106() { + if (jj_scan_token(IS_TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_105() { + if (jj_3R_122()) return true; + return false; + } + + private boolean jj_3R_104() { + if (jj_3R_121()) return true; + return false; + } + /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7593,7 +7929,7 @@ private boolean jj_3R_117() { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[196]; + final private int[] jj_la1 = new int[202]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -7613,28 +7949,28 @@ private boolean jj_3R_117() { jj_la1_init_7(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0018,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; } private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; @@ -7651,7 +7987,7 @@ public ARQParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7666,7 +8002,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7677,7 +8013,7 @@ public ARQParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7688,7 +8024,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7698,7 +8034,7 @@ public ARQParser(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7708,7 +8044,7 @@ public void ReInit(ARQParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 196; i++) jj_la1[i] = -1; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -7828,7 +8164,7 @@ public ParseException generateParseException() { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 196; i++) { + for (int i = 0; i < 202; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: jj_la1[153] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[155] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[158] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: jj_la1[160] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: jj_la1[161] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[163] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[164] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } /** Generated Token Manager. */ public SPARQLParser11TokenManager token_source; @@ -5147,149 +4918,141 @@ final public Node BooleanLiteral() throws ParseException { static private int[] jj_la1_5; static private int[] jj_la1_6; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } /** Constructor with InputStream. */ public SPARQLParser11(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public SPARQLParser11(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor. */ public SPARQLParser11(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new SPARQLParser11TokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public SPARQLParser11(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -5298,58 +5061,51 @@ private int jj_ntk_f() { /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[209]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 165; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 165; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); } else if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 117; else if (curChar == 39) @@ -2324,26 +2337,26 @@ else if (curChar == 39) else if (curChar == 36) jjstateSet[jjnewStateCnt++] = 27; else if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); } else if (curChar == 63) jjstateSet[jjnewStateCnt++] = 24; if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); else if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2359,11 +2372,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 9: if ((0x3ff000000000000L & l) != 0L) @@ -2395,7 +2408,7 @@ else if (curChar == 39) break; case 16: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 17: if (curChar == 62 && kind > 10) @@ -2410,11 +2423,11 @@ else if (curChar == 39) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2430,7 +2443,7 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 26: if (curChar == 36) @@ -2442,38 +2455,38 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 31: if (curChar == 45) - { jjCheckNAdd(32); } + jjCheckNAdd(32); break; case 32: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 34: if (curChar == 35) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 35: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 36: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 37: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 42: if (curChar == 10) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 43: if (curChar == 13) @@ -2485,11 +2498,11 @@ else if (curChar == 39) break; case 51: if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 52: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 53: if (curChar == 39 && kind > 161) @@ -2497,7 +2510,7 @@ else if (curChar == 39) break; case 55: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 57: if ((0x3ff000000000000L & l) != 0L) @@ -2529,15 +2542,15 @@ else if (curChar == 39) break; case 64: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 65: if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 66: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 67: if (curChar == 34 && kind > 162) @@ -2545,7 +2558,7 @@ else if (curChar == 39) break; case 69: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 71: if ((0x3ff000000000000L & l) != 0L) @@ -2577,28 +2590,28 @@ else if (curChar == 39) break; case 78: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 79: if (curChar == 39) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 80: case 83: if (curChar == 39) - { jjCheckNAddTwoStates(81, 84); } + jjCheckNAddTwoStates(81, 84); break; case 81: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 82: if (curChar == 39) - { jjAddStates(48, 49); } + jjAddStates(48, 49); break; case 85: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 87: if ((0x3ff000000000000L & l) != 0L) @@ -2630,7 +2643,7 @@ else if (curChar == 39) break; case 94: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 95: if (curChar == 39 && kind > 163) @@ -2650,24 +2663,24 @@ else if (curChar == 39) break; case 99: if (curChar == 34) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 100: case 103: if (curChar == 34) - { jjCheckNAddTwoStates(101, 104); } + jjCheckNAddTwoStates(101, 104); break; case 101: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 102: if (curChar == 34) - { jjAddStates(54, 55); } + jjAddStates(54, 55); break; case 105: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 107: if ((0x3ff000000000000L & l) != 0L) @@ -2699,7 +2712,7 @@ else if (curChar == 39) break; case 114: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 115: if (curChar == 34 && kind > 164) @@ -2719,23 +2732,23 @@ else if (curChar == 39) break; case 119: if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 120: if (curChar == 35) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 121: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 122: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 123: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 124: if (curChar == 41 && kind > 167) @@ -2743,7 +2756,7 @@ else if (curChar == 39) break; case 125: if (curChar == 10) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 126: if (curChar == 13) @@ -2751,23 +2764,23 @@ else if (curChar == 39) break; case 128: if (curChar == 35) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 129: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 130: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 131: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 133: if (curChar == 10) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 134: if (curChar == 13) @@ -2775,7 +2788,7 @@ else if (curChar == 39) break; case 136: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(71, 72); } + jjAddStates(71, 72); break; case 137: if ((0x3ff200000000000L & l) != 0L) @@ -2787,7 +2800,7 @@ else if (curChar == 39) break; case 139: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(73, 74); } + jjAddStates(73, 74); break; case 140: if ((0x3ff200000000000L & l) != 0L) @@ -2795,18 +2808,18 @@ else if (curChar == 39) break; case 141: if (curChar == 58) - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 142: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -2814,11 +2827,11 @@ else if (curChar == 39) break; case 146: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 147: if (curChar == 37) - { jjAddStates(79, 80); } + jjAddStates(79, 80); break; case 148: if ((0x3ff000000000000L & l) != 0L) @@ -2826,7 +2839,7 @@ else if (curChar == 39) break; case 149: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x3ff000000000000L & l) != 0L) @@ -2845,7 +2858,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 155: if (curChar == 37) @@ -2860,34 +2873,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 158: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 161: if (curChar == 35) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 162: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 163: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 164: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 169: if (curChar == 10) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 170: if (curChar == 13) @@ -2895,23 +2908,23 @@ else if (curChar == 39) break; case 176: if (curChar == 35) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 177: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 178: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 179: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 185: if (curChar == 10) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 186: if (curChar == 13) @@ -2922,260 +2935,260 @@ else if (curChar == 39) break; if (kind > 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); break; case 192: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 145) kind = 145; - { jjCheckNAdd(192); } + jjCheckNAdd(192); break; case 193: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(193, 194); } + jjCheckNAddTwoStates(193, 194); break; case 194: if (curChar == 46) - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 195: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 146) kind = 146; - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 196: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(196, 197); } + jjCheckNAddTwoStates(196, 197); break; case 197: if (curChar == 46) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 198: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 200: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 201: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 202: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(202, 203); } + jjCheckNAddTwoStates(202, 203); break; case 204: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 205: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 206: if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); break; case 207: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(207, 208); } + jjCheckNAddTwoStates(207, 208); break; case 209: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 210: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 211: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 212: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 148) kind = 148; - { jjCheckNAdd(212); } + jjCheckNAdd(212); break; case 213: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(213, 214); } + jjCheckNAddTwoStates(213, 214); break; case 214: if (curChar == 46) - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 215: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 149) kind = 149; - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 216: if (curChar == 46) - { jjCheckNAdd(217); } + jjCheckNAdd(217); break; case 217: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(217, 218); } + jjCheckNAddTwoStates(217, 218); break; case 219: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 220: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 221: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(99, 102); } + jjCheckNAddStates(99, 102); break; case 222: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(222, 223); } + jjCheckNAddTwoStates(222, 223); break; case 223: if (curChar == 46) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 224: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 226: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 227: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 228: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(228, 229); } + jjCheckNAddTwoStates(228, 229); break; case 230: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 231: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 232: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 233: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 151) kind = 151; - { jjCheckNAdd(233); } + jjCheckNAdd(233); break; case 234: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(234, 235); } + jjCheckNAddTwoStates(234, 235); break; case 235: if (curChar == 46) - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 236: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 152) kind = 152; - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 237: if (curChar == 46) - { jjCheckNAdd(238); } + jjCheckNAdd(238); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 240: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 241: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 242: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(103, 106); } + jjCheckNAddStates(103, 106); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 244: if (curChar == 46) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 245: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 247: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 248: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 249: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(249, 250); } + jjCheckNAddTwoStates(249, 250); break; case 251: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; case 252: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; default : break; } @@ -3190,28 +3203,28 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); else if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 50; else if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 18; if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 47; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 7: if (curChar == 92) @@ -3251,18 +3264,18 @@ else if ((0x20000000200L & l) != 0L) break; case 16: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 19: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3278,7 +3291,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: case 28: @@ -3286,32 +3299,32 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 29: if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); break; case 30: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(30, 31); } + jjCheckNAddTwoStates(30, 31); break; case 32: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 33: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 35: - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 38: if ((0x200000002L & l) != 0L && kind > 126) @@ -3359,15 +3372,15 @@ else if ((0x20000000200L & l) != 0L) break; case 52: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 54: if (curChar == 92) - { jjAddStates(115, 116); } + jjAddStates(115, 116); break; case 55: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 56: if (curChar == 85) @@ -3403,19 +3416,19 @@ else if ((0x20000000200L & l) != 0L) break; case 64: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 66: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 68: if (curChar == 92) - { jjAddStates(117, 118); } + jjAddStates(117, 118); break; case 69: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 70: if (curChar == 85) @@ -3451,19 +3464,19 @@ else if ((0x20000000200L & l) != 0L) break; case 78: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 81: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 84: if (curChar == 92) - { jjAddStates(119, 120); } + jjAddStates(119, 120); break; case 85: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 86: if (curChar == 85) @@ -3499,19 +3512,19 @@ else if ((0x20000000200L & l) != 0L) break; case 94: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 101: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 104: if (curChar == 92) - { jjAddStates(121, 122); } + jjAddStates(121, 122); break; case 105: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 106: if (curChar == 85) @@ -3547,17 +3560,17 @@ else if ((0x20000000200L & l) != 0L) break; case 114: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 121: - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 127: if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 129: - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 132: if (curChar == 93 && kind > 172) @@ -3565,34 +3578,34 @@ else if ((0x20000000200L & l) != 0L) break; case 135: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 136: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3600,11 +3613,11 @@ else if ((0x20000000200L & l) != 0L) break; case 145: if (curChar == 92) - { jjAddStates(123, 124); } + jjAddStates(123, 124); break; case 146: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 148: if ((0x7e0000007eL & l) != 0L) @@ -3612,7 +3625,7 @@ else if ((0x20000000200L & l) != 0L) break; case 149: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x7e0000007eL & l) != 0L) @@ -3635,7 +3648,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 156: if ((0x7e0000007eL & l) != 0L) @@ -3646,18 +3659,18 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 159: if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); break; case 160: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 162: - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 165: if ((0x200000002L & l) != 0L && kind > 127) @@ -3693,10 +3706,10 @@ else if ((0x20000000200L & l) != 0L) break; case 175: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 177: - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 180: if ((0x2000000020L & l) != 0L && kind > 128) @@ -3736,39 +3749,39 @@ else if ((0x20000000200L & l) != 0L) break; case 199: if ((0x2000000020L & l) != 0L) - { jjAddStates(125, 126); } + jjAddStates(125, 126); break; case 203: if ((0x2000000020L & l) != 0L) - { jjAddStates(127, 128); } + jjAddStates(127, 128); break; case 208: if ((0x2000000020L & l) != 0L) - { jjAddStates(129, 130); } + jjAddStates(129, 130); break; case 218: if ((0x2000000020L & l) != 0L) - { jjAddStates(131, 132); } + jjAddStates(131, 132); break; case 225: if ((0x2000000020L & l) != 0L) - { jjAddStates(133, 134); } + jjAddStates(133, 134); break; case 229: if ((0x2000000020L & l) != 0L) - { jjAddStates(135, 136); } + jjAddStates(135, 136); break; case 239: if ((0x2000000020L & l) != 0L) - { jjAddStates(137, 138); } + jjAddStates(137, 138); break; case 246: if ((0x2000000020L & l) != 0L) - { jjAddStates(139, 140); } + jjAddStates(139, 140); break; case 250: if ((0x2000000020L & l) != 0L) - { jjAddStates(141, 142); } + jjAddStates(141, 142); break; default : break; } @@ -3776,7 +3789,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -3787,29 +3800,29 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(23, 25); } + jjAddStates(23, 25); break; case 19: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -3820,83 +3833,83 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 25: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 28: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 35: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(35, 40); } + jjAddStates(35, 40); break; case 52: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(32, 34); } + jjAddStates(32, 34); break; case 66: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 81: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(44, 47); } + jjAddStates(44, 47); break; case 101: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(50, 53); } + jjAddStates(50, 53); break; case 121: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 129: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(62, 67); } + jjAddStates(62, 67); break; case 136: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -3904,13 +3917,13 @@ else if ((0x20000000200L & l) != 0L) break; case 162: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(81, 86); } + jjAddStates(81, 86); break; case 177: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(90, 95); } + jjAddStates(90, 95); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -3946,48 +3959,6 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, -null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, "\50", -"\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", -"\41\75", "\76", "\74", "\74\75", "\76\75", "\41", "\176", "\72", "\174\174", "\46\46", -"\53", "\55", "\52", "\57", "\136\136", "\100", "\174", "\136", "\55\76", "\74\55", -"\77", null, null, null, null, null, null, null, null, null, null, null, }; -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} static final int[] jjnextStates = { 192, 193, 194, 196, 197, 202, 203, 233, 234, 235, 237, 242, 212, 213, 214, 216, 221, 142, 153, 155, 120, 123, 124, 6, 7, 17, 1, 2, 4, 66, 67, 68, @@ -4060,6 +4031,111 @@ private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, lo } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, "\50", +"\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", +"\41\75", "\76", "\74", "\74\75", "\76\75", "\41", "\176", "\72", "\174\174", "\46\46", +"\53", "\55", "\52", "\57", "\136\136", "\100", "\174", "\136", "\55\76", "\74\55", +"\77", null, null, null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffffffe23feffffL, 0x3fL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[253]; +private final int[] jjstateSet = new int[506]; +protected char curChar; +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 253; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4081,10 +4157,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4142,31 +4217,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4194,97 +4244,4 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } - /** Constructor. */ - public SPARQLParser11TokenManager(JavaCharStream stream){ - - if (JavaCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - - input_stream = stream; - } - - /** Constructor. */ - public SPARQLParser11TokenManager (JavaCharStream stream, int lexState){ - ReInit(stream); - SwitchTo(lexState); - } - - /** Reinitialise parser. */ - - public void ReInit(JavaCharStream stream) - { - - - jjmatchedPos = - jjnewStateCnt = - 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() - { - int i; - jjround = 0x80000001; - for (i = 253; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - /** Reinitialise parser. */ - public void ReInit(JavaCharStream stream, int lexState) - - { - ReInit(stream); - SwitchTo(lexState); - } - - /** Switch to specified lex state. */ - public void SwitchTo(int lexState) - { - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffffffe23feffffL, 0x3fL, -}; -static final long[] jjtoSkip = { - 0x7eL, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x40L, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoMore = { - 0x0L, 0x0L, 0x0L, 0x0L, -}; - protected JavaCharStream input_stream; - - private final int[] jjrounds = new int[253]; - private final int[] jjstateSet = new int[2 * 253]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java index 9c283db5a87..176e379371e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=d168c8aaa91566e8e4a37d907159a9b8 (do not edit this line) */ +/* JavaCC - OriginalChecksum=14a2dd2c56b347f7b769eacf6b50c9b9 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java index baff41ede86..a93cce08be5 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,21 +99,19 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ - protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - char curChar1 = (char)curChar; - return("Lexical error at line " + // - errorLine + ", column " + // - errorColumn + ". Encountered: " + // - (EOFSeen ? "" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + (int)curChar + "),")) + // - (errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + // - (lexState == 0 ? "" : " (in lexical state " + lexState + ")"); + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); } /** @@ -123,7 +123,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -143,8 +142,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } -/* JavaCC - OriginalChecksum=bac6a264c897b52c9c1f67facccb2bde (do not edit this line) */ +/* JavaCC - OriginalChecksum=0c993d195e89c16550efa6afecdeb1ab (do not edit this line) */ From 63eb442d6c371f993f7e5a2ae205485773e6210c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 12:58:05 +0200 Subject: [PATCH 061/323] support for DISTINCT in FOLD --- .../jena/sparql/expr/aggregate/AggFold.java | 56 ++++++++++--------- .../expr/aggregate/AggregatorFactory.java | 6 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index b30a46fe7f0..f25ce45c63a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -11,16 +11,14 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; @@ -30,12 +28,12 @@ public class AggFold extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final Expr expr1 ) { - this(expr1, null); + public AggFold( final boolean isDistinct, final Expr expr1 ) { + this(isDistinct, expr1, null); } - public AggFold( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { + super( "FOLD", isDistinct, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; @@ -63,7 +61,7 @@ public Aggregator copy( final ExprList exprs ) { final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - return new AggFold(_expr1, _expr2); + return new AggFold(isDistinct, _expr1, _expr2); } @Override @@ -79,7 +77,7 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { @Override public Accumulator createAccumulator() { if ( expr2 == null ) - return new ListAccumulator(); + return new ListAccumulator(expr1, isDistinct); else return new MapAccumulator(); } @@ -134,28 +132,38 @@ public String toPrefixString() { return out.asString(); } - protected class ListAccumulator implements Accumulator { + protected class ListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + @Override - public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v; - final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv == null ) { - v = CDTFactory.getNullValue(); - } - else { - v = CDTFactory.createValue( nv.asNode() ); - } + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. @Override public NodeValue getValue() { - final LiteralLabelForList lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return getAccValue(); } } @@ -190,9 +198,7 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final LiteralLabelForMap lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(map); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 6c492069c18..842d65fb273 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,11 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( distinct ) - throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; +// if ( distinct ) +// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(expr1, expr2) ; + return new AggFold(distinct, expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From 99a9ed75dba3804b08c5afdeeb0e3c5d0c499459 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:29:58 +0200 Subject: [PATCH 062/323] split AggFold into AggFoldList and AggFoldMap --- .../sparql/expr/aggregate/AggFoldList.java | 129 ++++++++++++++++++ .../{AggFold.java => AggFoldMap.java} | 100 +++----------- .../sparql/expr/aggregate/AggregatorBase.java | 3 +- .../expr/aggregate/AggregatorFactory.java | 7 +- 4 files changed, 155 insertions(+), 84 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java rename jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/{AggFold.java => AggFoldMap.java} (58%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java new file mode 100644 index 00000000000..49079b4fa1e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -0,0 +1,129 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFoldList extends AggregatorBase +{ + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { + super( "FOLD", isDistinct, expr1 ); + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() != 1 ) + throw new IllegalArgumentException(); + + final Expr _expr1 = exprs.get(0); + + return new AggFoldList(isDistinct, _expr1); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFoldList ) ) + return false; + final AggFoldList fold = (AggFoldList) other; + return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + } + + @Override + public Accumulator createAccumulator() { + return new ListAccumulator( getExpr(), isDistinct ); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + return HC_AggFoldList ^ getExpr().hashCode(); + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + if ( isDistinct ) + out.append("DISTINCT "); + + ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + + out.append(")"); + return out.asString(); + } + + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); + + if ( isDistinct ) + out.append(" distinct"); + + WriterExpr.output(out, getExpr(), null); + + out.decIndent(); + out.append(")"); + return out.asString(); + } + + protected class ListAccumulator extends AccumulatorExpr { + final protected List list = new ArrayList<>(); + + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + + @Override + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); + list.add(v); + } + + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. + @Override + public NodeValue getValue() { + return getAccValue(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java similarity index 58% rename from jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java rename to jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index f25ce45c63a..44eb12aaab1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,11 +1,8 @@ package org.apache.jena.sparql.expr.aggregate; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Locale; +import java.util.Map; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; @@ -23,63 +20,47 @@ import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; -public class AggFold extends AggregatorBase +public class AggFoldMap extends AggregatorBase { protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final boolean isDistinct, final Expr expr1 ) { - this(isDistinct, expr1, null); - } - - public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { - super( "FOLD", isDistinct, createExprList(expr1, expr2) ); + public AggFoldMap( final Expr expr1, final Expr expr2 ) { + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; } protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { - final ExprList l = new ExprList(expr1); - - if ( expr2 != null ) { - l.add(expr2); - } + final ExprList l = new ExprList(); + l.add(expr1); + l.add(expr2); return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 2 ) + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - final Iterator it = exprs.iterator(); - final Expr _expr1 = it.next(); - - Expr lookAhead = it.hasNext() ? it.next() : null; - - final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - - return new AggFold(isDistinct, _expr1, _expr2); + return new AggFoldMap( exprs.get(0), exprs.get(1) ); } @Override public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( other == null ) return false; if ( this == other ) return true; - if ( ! ( other instanceof AggFold ) ) + if ( ! ( other instanceof AggFoldMap ) ) return false; - final AggFold fold = (AggFold) other; + final AggFoldMap fold = (AggFoldMap) other; return exprList.equals(fold.exprList, bySyntax); } @Override public Accumulator createAccumulator() { - if ( expr2 == null ) - return new ListAccumulator(expr1, isDistinct); - else - return new MapAccumulator(); + return new MapAccumulator(); } @Override @@ -89,10 +70,10 @@ public Node getValueEmpty() { @Override public int hashCode() { - int hc = HC_AggFold; - for ( final Expr e : getExprList() ) { - hc ^= e.hashCode(); - } + int hc = HC_AggFoldMap; + hc ^= getExprList().get(0).hashCode(); + hc ^= getExprList().get(1).hashCode(); + return hc; } @@ -103,11 +84,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - - if ( expr2 != null ) { - out.append(", "); - ExprUtils.fmtSPARQL(out, expr2, sCxt); - } + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); out.append(")"); return out.asString(); @@ -121,52 +99,14 @@ public String toPrefixString() { out.incIndent(); WriterExpr.output(out, expr1, null); - - if ( expr2 != null ) { - out.append(", "); - WriterExpr.output(out, expr2, null); - } + out.append(", "); + WriterExpr.output(out, expr2, null); out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { - final protected List list = new ArrayList<>(); - - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { - super(expr, makeDistinct); - } - - @Override - protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.createValue( nv.asNode() ); - list.add(v); - } - - @Override - protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.getNullValue(); - list.add(v); - } - - @Override - protected NodeValue getAccValue() { - return CDTLiteralFunctionUtils.createNodeValue(list); - } - - // Overriding this function because the base class would otherwise not - // call getAccValue() in cases in which there was an error during the - // evaluation of the 'expr' for any of the solution mappings. For FOLD, - // however, errors do not cause an aggregation error but just produce - // null values in the created list. - @Override - public NodeValue getValue() { - return getAccValue(); - } - } - protected class MapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index 4b496f5495d..2fab0b39b5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -186,6 +186,7 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; - protected static final int HC_AggFold = 0x186 ; + protected static final int HC_AggFoldList = 0x186 ; + protected static final int HC_AggFoldMap = 0x187 ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 842d65fb273..b22a95806ff 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,12 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { -// if ( distinct ) -// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(distinct, expr1, expr2) ; + if ( expr2 == null ) + return new AggFoldList(distinct, expr1) ; + else + return new AggFoldMap(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From e46cf19f9b13385cd445b19152001990d771ca85 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:53:34 +0200 Subject: [PATCH 063/323] bug fix: correct creation of empty lists and empty maps in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 3 ++- .../sparql/expr/aggregate/AggFoldMap.java | 3 ++- .../library/cdt/CDTLiteralFunctionUtils.java | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 49079b4fa1e..3b766eb9672 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -51,7 +51,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final List emptyList = new ArrayList<>(); + return CDTLiteralFunctionUtils.createNode(emptyList); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 44eb12aaab1..5b64def36d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -65,7 +65,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final Map emptyMap = new HashMap<>(); + return CDTLiteralFunctionUtils.createNode(emptyMap); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 1fa1b956656..3e4b5b39b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -96,14 +96,30 @@ public static final Map checkAndGetMap( final NodeValue nv ) th return checkAndGetMap( nv.asNode() ); } + /** + * Creates a {@link NodeV} with a cdt:List literal that represents the + * given list. + */ + public static final Node createNode( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeFactory.createLiteral(lit); + } + + /** + * Creates a {@link Node} with a cdt:Map literal that represents the + * given map. + */ + public static final Node createNode( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + return NodeFactory.createLiteral(lit); + } + /** * Creates a {@link NodeValue} with a cdt:List literal that represents the * given list. */ public static final NodeValue createNodeValue( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(list) ); } /** @@ -111,9 +127,7 @@ public static final NodeValue createNodeValue( final List list ) { * given map. */ public static final NodeValue createNodeValue( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(map) ); } } From 1ef4c5b6854abb5c670fe5bdcd56494b316c0682 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 12 Oct 2023 17:31:31 +0200 Subject: [PATCH 064/323] support for ORDER BY in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 197 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 4 +- 2 files changed, 187 insertions(+), 14 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 3b766eb9672..9bc9e6c4904 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,14 +1,26 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; @@ -16,22 +28,77 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldList extends AggregatorBase { + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { - super( "FOLD", isDistinct, expr1 ); + this(isDistinct, expr1, null); + } + + public AggFoldList( final boolean isDistinct, final Expr expr1, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", isDistinct, collectExprs(expr1, orderBy) ); + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } + } + + protected static ExprList collectExprs( final Expr expr1, final List orderBy ) { + final ExprList l = new ExprList(expr1); + + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 1 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 1 ) throw new IllegalArgumentException(); + + _expr1 = exprs.get(0); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+1 ) throw new IllegalArgumentException(); + - final Expr _expr1 = exprs.get(0); + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); - return new AggFoldList(isDistinct, _expr1); + _expr1 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldList(isDistinct, _expr1, _orderBy); } @Override @@ -41,12 +108,17 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldList ) ) return false; final AggFoldList fold = (AggFoldList) other; - return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + return (isDistinct == fold.isDistinct) + && getExprList().get(0).equals(fold.getExprList().get(0), bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new ListAccumulator( getExpr(), isDistinct ); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingListAccumulator(); + else + return new BasicListAccumulator( getExprList().get(0), isDistinct ); } @Override @@ -69,7 +141,16 @@ public String asSparqlExpr( final SerializationContext sCxt ) { if ( isDistinct ) out.append("DISTINCT "); - ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + ExprUtils.fmtSPARQL(out, getExprList().get(0), sCxt); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } out.append(")"); return out.asString(); @@ -85,17 +166,26 @@ public String toPrefixString() { if ( isDistinct ) out.append(" distinct"); - WriterExpr.output(out, getExpr(), null); + WriterExpr.output(out, getExprList().get(0), null); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { + protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); } @@ -127,4 +217,89 @@ public NodeValue getValue() { } } + protected class SortingListAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingListAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it; + if ( isDistinct ) + it = new DuplicateEliminationIterator( sbag.iterator() ); + else + it = sbag.iterator(); + + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + + /** + * Wraps another iterator which is assumed to return its elements in a + * sorted order (that is, all elements that are equal to one another are + * returned by the wrapped iterator directly one after another) and, then, + * returns the elements from that wrapped iterator without duplicates. + */ + protected static class DuplicateEliminationIterator implements Iterator { + protected final Iterator input; + protected E prevReturnedElmt = null; + protected E nextAvailableElmt = null; + + public DuplicateEliminationIterator( final Iterator input ) { + this.input = input; + + if ( input.hasNext() ) { + nextAvailableElmt = input.next(); + } + } + + @Override + public boolean hasNext() { + while ( nextAvailableElmt == null ) { + if ( ! input.hasNext() ) + return false; + + nextAvailableElmt = input.next(); + if ( prevReturnedElmt != null + && prevReturnedElmt.equals(nextAvailableElmt) ) { + // the current next element must not be returned because + // it is a duplicate of the previous returned element + nextAvailableElmt = null; + } + } + return true; + } + + @Override + public E next() { + if ( ! hasNext() ) { + throw new NoSuchElementException(); + } + + prevReturnedElmt = nextAvailableElmt; + nextAvailableElmt = null; + + return prevReturnedElmt; + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index b22a95806ff..2c59b3252c0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,10 +75,8 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( orderBy != null ) - System.out.println( "HERE!! " + orderBy.size() ); if ( expr2 == null ) - return new AggFoldList(distinct, expr1) ; + return new AggFoldList(distinct, expr1, orderBy) ; else return new AggFoldMap(expr1, expr2) ; } From c871d6a60dc50c49bfcd50ad8dfc0aba6b7a273d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 13 Oct 2023 15:45:29 +0200 Subject: [PATCH 065/323] changes the tests of FOLD(DISTINCT ...) to capture the decision that multiple errors collapse into a single null value --- .../expr/aggregate/AccumulatorExpr.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java index d8c5de3f35a..4d59ad2632a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java @@ -35,7 +35,7 @@ public abstract class AccumulatorExpr implements Accumulator private long accCount = 0 ; protected long errorCount = 0 ; private final Expr expr ; - private final boolean makeDistinct; + protected final boolean makeDistinct; protected AccumulatorExpr(Expr expr, boolean makeDistinct) { this.expr = expr; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 9bc9e6c4904..2f679f7a679 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -184,6 +184,7 @@ public String toPrefixString() { protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected boolean nullValueAdded = false; protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); @@ -197,6 +198,15 @@ protected void accumulate( final NodeValue nv, final Binding binding, final Func @Override protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + // By definition of FOLD, evaluation errors result in null values + // for the created list. If FOLD is used with the keyword DISTINCT, + // then all errors collapse to a single null value. + if ( makeDistinct && nullValueAdded ) { + return; + } + + nullValueAdded = true; + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } @@ -237,12 +247,22 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { final Iterator it; - if ( isDistinct ) + final Accumulator acc; + if ( isDistinct ) { it = new DuplicateEliminationIterator( sbag.iterator() ); - else + acc = new BasicListAccumulator( getExprList().get(0), false ) { + @Override + protected void accumulateError( final Binding b, final FunctionEnv e ) { + if ( nullValueAdded ) return; + super.accumulateError(b, e); + } + }; + } + else { it = sbag.iterator(); + acc = new BasicListAccumulator( getExprList().get(0), false ); + } - final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); } From 75d665a77b773b85f8295595f52b321a7925f445 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 14 Oct 2023 15:46:32 +0200 Subject: [PATCH 066/323] support for ORDER BY in FOLD for maps --- .../sparql/expr/aggregate/AggFoldMap.java | 137 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 2 +- 2 files changed, 130 insertions(+), 9 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 5b64def36d6..70eb9c57eac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,15 +1,28 @@ package org.apache.jena.sparql.expr.aggregate; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -18,6 +31,7 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldMap extends AggregatorBase @@ -25,27 +39,80 @@ public class AggFoldMap extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldMap( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + this(expr1, expr2, null); + } + + public AggFoldMap( final Expr expr1, final Expr expr2, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", false, collectExprs(expr1, expr2, orderBy) ); this.expr1 = expr1; this.expr2 = expr2; + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } } - protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { + protected static ExprList collectExprs( final Expr expr1, final Expr expr2, final List orderBy ) { final ExprList l = new ExprList(); l.add(expr1); l.add(expr2); + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 2 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final Expr _expr2; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - return new AggFoldMap( exprs.get(0), exprs.get(1) ); + _expr1 = exprs.get(0); + _expr2 = exprs.get(1); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+2 ) throw new IllegalArgumentException(); + + + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); + + _expr1 = eit.next(); + _expr2 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldMap(_expr1, _expr2, _orderBy); } @Override @@ -55,12 +122,16 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldMap ) ) return false; final AggFoldMap fold = (AggFoldMap) other; - return exprList.equals(fold.exprList, bySyntax); + return exprList.equals(fold.exprList, bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new MapAccumulator(); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingMapAccumulator(); + else + return new BasicMapAccumulator(); } @Override @@ -88,6 +159,15 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } + out.append(")"); return out.asString(); } @@ -103,12 +183,21 @@ public String toPrefixString() { out.append(", "); WriterExpr.output(out, expr2, null); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } + out.decIndent(); out.append(")"); return out.asString(); } - protected class MapAccumulator implements Accumulator { + protected class BasicMapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); @Override @@ -143,4 +232,36 @@ public NodeValue getValue() { } } + protected class SortingMapAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingMapAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicMapAccumulator(); + + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 2c59b3252c0..4d99bdeb9a2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -78,7 +78,7 @@ public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, Li if ( expr2 == null ) return new AggFoldList(distinct, expr1, orderBy) ; else - return new AggFoldMap(expr1, expr2) ; + return new AggFoldMap(expr1, expr2, orderBy) ; } public static Aggregator createCustom(String iri, Args a) { From a3867236b7d07b6e3276c053b144f56f8dc16861 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 16 Oct 2023 13:16:08 +0200 Subject: [PATCH 067/323] bug fix in FOLD with both DISTINCT, as revealed by the 'fold-list-distinct-orderby-02' test --- .../sparql/expr/aggregate/AggFoldList.java | 67 +------------------ 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 2f679f7a679..c02bfd0b5e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -246,22 +246,8 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final Iterator it; - final Accumulator acc; - if ( isDistinct ) { - it = new DuplicateEliminationIterator( sbag.iterator() ); - acc = new BasicListAccumulator( getExprList().get(0), false ) { - @Override - protected void accumulateError( final Binding b, final FunctionEnv e ) { - if ( nullValueAdded ) return; - super.accumulateError(b, e); - } - }; - } - else { - it = sbag.iterator(); - acc = new BasicListAccumulator( getExprList().get(0), false ); - } + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), isDistinct ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); @@ -273,53 +259,4 @@ protected void accumulateError( final Binding b, final FunctionEnv e ) { } } - /** - * Wraps another iterator which is assumed to return its elements in a - * sorted order (that is, all elements that are equal to one another are - * returned by the wrapped iterator directly one after another) and, then, - * returns the elements from that wrapped iterator without duplicates. - */ - protected static class DuplicateEliminationIterator implements Iterator { - protected final Iterator input; - protected E prevReturnedElmt = null; - protected E nextAvailableElmt = null; - - public DuplicateEliminationIterator( final Iterator input ) { - this.input = input; - - if ( input.hasNext() ) { - nextAvailableElmt = input.next(); - } - } - - @Override - public boolean hasNext() { - while ( nextAvailableElmt == null ) { - if ( ! input.hasNext() ) - return false; - - nextAvailableElmt = input.next(); - if ( prevReturnedElmt != null - && prevReturnedElmt.equals(nextAvailableElmt) ) { - // the current next element must not be returned because - // it is a duplicate of the previous returned element - nextAvailableElmt = null; - } - } - return true; - } - - @Override - public E next() { - if ( ! hasNext() ) { - throw new NoSuchElementException(); - } - - prevReturnedElmt = nextAvailableElmt; - nextAvailableElmt = null; - - return prevReturnedElmt; - } - } - } From 76e2d213cc6115749259a9236045a33ecf8cf1bb Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:42:29 +0200 Subject: [PATCH 068/323] support for comparison (<, <=, >, >=) of cdt:Map literals --- .../apache/jena/cdt/CompositeDatatypeMap.java | 119 ++++++++++++++++++ .../apache/jena/sparql/expr/NodeValue.java | 13 ++ 2 files changed, 132 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e79b3bd3835..ca61fea0170 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,12 +1,18 @@ package org.apache.jena.cdt; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; +import java.util.TreeSet; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.xsd.impl.RDFLangString; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -168,6 +174,78 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { return true; } + /** + * Assumes that the datatype of both of the given literals is cdt:Map. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final Map map1; + final Map map2; + try { + map1 = getValue(value1); + map2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; + if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; + if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + + final CDTKeySorter keySorter = new CDTKeySorter(); + final TreeSet sortedKeys1 = new TreeSet<>(keySorter); + final TreeSet sortedKeys2 = new TreeSet<>(keySorter); + sortedKeys1.addAll( map1.keySet() ); + sortedKeys2.addAll( map2.keySet() ); + + final Iterator it1 = sortedKeys1.iterator(); + final Iterator it2 = sortedKeys2.iterator(); + final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTKey k1 = it1.next(); + final CDTKey k2 = it2.next(); + + final int kCmp = keySorter.compare(k1, k2); + if ( kCmp < 0 ) return Expr.CMP_LESS; + if ( kCmp > 0 ) return Expr.CMP_GREATER; + + + final CDTValue v1 = map1.get(k1); + final CDTValue v2 = map2.get(k2); + if ( v1.isNull() || v2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + final boolean nEqCmp; + try { + nEqCmp = n1.sameValueAs(n2); + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( nEqCmp == false ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + try { + final int vCmp = NodeValue.compare(nv1, nv2); + if ( vCmp != Expr.CMP_EQUAL ) + return vCmp; + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + } + } + + final int sizeDiff = map1.size() - map2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } + /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this @@ -205,4 +283,45 @@ public static Map getValue( final LiteralLabel lit ) throws Dat return map; } + protected static class CDTKeySorter implements Comparator { + @Override + public int compare( final CDTKey k1, final CDTKey k2 ) { + final Node n1 = k1.asNode(); + final Node n2 = k2.asNode(); + + if ( n1.isURI() ) { + if ( ! n2.isURI() ) { + return Expr.CMP_LESS; + } + + final String uri1 = n1.getURI(); + final String uri2 = n2.getURI(); + return uri1.compareTo(uri2); + } + else if ( n2.isURI() ) { + return Expr.CMP_GREATER; + } + + // at this point, both RDF terms (n1 and n2) should be literals + final String dt1 = n1.getLiteralDatatypeURI(); + final String dt2 = n2.getLiteralDatatypeURI(); + final int dtCmp = dt1.compareTo(dt2); + if ( dtCmp != 0 ) { + return dtCmp; + } + + final String lex1 = n1.getLiteralLexicalForm(); + final String lex2 = n2.getLiteralLexicalForm(); + final int lexCmp = lex1.compareTo(lex2); + if ( lexCmp != 0 || ! RDFLangString.rdfLangString.getURI().equals(dt1) ) { + return lexCmp; + } + + // at this point, both literals are rdf:LangString literals with the same value + final String lang1 = n1.getLiteralLanguage(); + final String lang2 = n2.getLiteralLanguage(); + return lang1.compareTo(lang2); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 48fd3e792ae..a451546c1ec 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -809,6 +809,19 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom } } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeMap.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN: { // One or two unknown value spaces. From 4218f805025ef8c330e66e77df21500912c4f2e6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:43:11 +0200 Subject: [PATCH 069/323] bug fix in comparison of cdt:List literals --- .../org/apache/jena/cdt/CompositeDatatypeList.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index d73d1314227..922a2b1679f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; @@ -199,9 +200,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( list1.isEmpty() && list2.isEmpty() ) return 0; - if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; - if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; + if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; + if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { @@ -231,11 +232,14 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( c != 0 ) return c; + if ( c != Expr.CMP_EQUAL ) return c; } } - return ( list1.size() - list2.size() ); + final int sizeDiff = list1.size() - list2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; } /** From f0ce3932bf8b983572b0611f1a0b8ec89251048e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 13:27:31 +0200 Subject: [PATCH 070/323] support for ORDER BY for cdt:List literals --- .../jena/cdt/CompositeDatatypeList.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 1 - 3 files changed, 114 insertions(+), 29 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 922a2b1679f..eaf17c59638 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -188,57 +188,143 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { /** * Assumes that the datatype of both of the given literals is cdt:List. + * If 'sortOrderingCompare' is true, the two lists are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the list-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final List list1; - final List list2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + List list1 = null; try { list1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + List list2 = null; + try { list2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( list1 == null || list2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the list-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( list1 != null ) return Expr.CMP_LESS; + if ( list2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; - if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; - if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two lists is empty, we can decide + // without a pair-wise comparison of the list elements. + if ( list1.isEmpty() || list2.isEmpty() ) { + // The literals with the non-empty list is greater + // than the literal with the empty list. + if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! list2.isEmpty() ) return Expr.CMP_LESS; + + // If both lists are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // list-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the list elements. final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { final CDTValue elmt1 = list1.get(i); final CDTValue elmt2 = list2.get(i); - if ( elmt1.isNull() || elmt2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); - - if ( n1.isBlank() && n2.isBlank() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + if ( ! elmt1.isNull() && ! elmt2.isNull() ) { + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } - final int c; - try { - c = NodeValue.compare(nv1, nv2); + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch ( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two list elements is null. + if ( ! sortOrderingCompare ) { + // When comparing as per the list-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - - if ( c != Expr.CMP_EQUAL ) return c; + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both elements are null, we + // don't do anything here and simply advance to the next + // pair of elements. + // However, if only one of the two elements is null, then + // the literal with this element is ordered lower than the + // other literal. + if ( elmt1.isNull() && ! elmt2.isNull() ) + return Expr.CMP_LESS; + + if ( elmt2.isNull() && ! elmt1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of list elements has not + // led to any decision. Now, we decide based on the size of the lists. final int sizeDiff = list1.size() - list2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; return Expr.CMP_EQUAL; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index a451546c1ec..ca3674c101d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -801,7 +801,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index c02bfd0b5e7..e53f8a45263 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.NoSuchElementException; import java.util.Objects; import org.apache.jena.atlas.data.BagFactory; From 42f1dcf0838d677f7be14bcc9c8e03520548236a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 16:23:02 +0200 Subject: [PATCH 071/323] support for ORDER BY for cdt:Map literals --- .../jena/cdt/CompositeDatatypeBase.java | 10 ++ .../jena/cdt/CompositeDatatypeList.java | 9 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 4 files changed, 120 insertions(+), 41 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index 5c1e768a424..ffeff44314d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -20,6 +20,8 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; public abstract class CompositeDatatypeBase implements RDFDatatype { @@ -47,4 +49,12 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; public abstract String unparseValue( final T value ); + + // helper for the compare function in each of the subclasses + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index eaf17c59638..15c950d212c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -231,7 +231,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // If at least one of the two lists is empty, we can decide // without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { - // The literals with the non-empty list is greater + // The literal with the non-empty list is greater // than the literal with the empty list. if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; if ( ! list2.isEmpty() ) return Expr.CMP_LESS; @@ -321,13 +321,6 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, return Expr.CMP_EQUAL; } - protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { - final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); - if ( lexCmp < 0 ) return Expr.CMP_LESS; - if ( lexCmp > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; - } - /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index ca61fea0170..3745596481f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -176,28 +176,73 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { /** * Assumes that the datatype of both of the given literals is cdt:Map. + * + * If 'sortOrderingCompare' is true, the two maps are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the map-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final Map map1; - final Map map2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + Map map1 = null; try { map1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + Map map2 = null; + try { map2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( map1 == null || map2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the map-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( map1 != null ) return Expr.CMP_LESS; + if ( map2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; - if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; - if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two maps is empty, we can decide + // without a pair-wise comparison of the map entries. + if ( map1.isEmpty() || map2.isEmpty() ) { + // The literal with the non-empty map is greater + // than the literal with the empty map. + if ( ! map1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! map2.isEmpty() ) return Expr.CMP_LESS; + + // If both maps are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // map-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the map entries. + // To this end, we first need to sort the map entries. final CDTKeySorter keySorter = new CDTKeySorter(); final TreeSet sortedKeys1 = new TreeSet<>(keySorter); final TreeSet sortedKeys2 = new TreeSet<>(keySorter); sortedKeys1.addAll( map1.keySet() ); sortedKeys2.addAll( map2.keySet() ); + // Now we can perform the pair-wise comparison of the map entries. final Iterator it1 = sortedKeys1.iterator(); final Iterator it2 = sortedKeys2.iterator(); final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); @@ -209,41 +254,72 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 if ( kCmp < 0 ) return Expr.CMP_LESS; if ( kCmp > 0 ) return Expr.CMP_GREATER; - final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); - if ( v1.isNull() || v2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - final boolean nEqCmp; - try { - nEqCmp = n1.sameValueAs(n2); - } - catch( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - if ( nEqCmp == false ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - try { - final int vCmp = NodeValue.compare(nv1, nv2); - if ( vCmp != Expr.CMP_EQUAL ) - return vCmp; + if ( ! v1.isNull() && ! v2.isNull() ) { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! n1.sameValueAs(n2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two map entries has null as its value. + if ( ! sortOrderingCompare ) { + // When comparing as per the map-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both map entries have null + // as their value, we don't do anything here and simply + // advance to the next pair of map entries. + // However, if the map value of only one of the two map + // entries is null, then the literal with this map entry + // is ordered lower than the other literal. + if ( v1.isNull() && ! v2.isNull() ) + return Expr.CMP_LESS; + + if ( v2.isNull() && ! v1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of map entries has not led + // to any decision. Now, we decide based on the size of the maps. final int sizeDiff = map1.size() - map2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; } /** diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index ca3674c101d..a45332186f3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -814,7 +814,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeMap.compare(lit1, lit2) ; + return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; From 9e03d32d40f58e1a4925eb4e16b6d5fba7c91df3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 20 Oct 2023 14:23:54 +0200 Subject: [PATCH 072/323] changed the implementation of ORDER BY for CDT literals such that the relative order is undefined if one of the compared literals is ill-formed --- .../jena/cdt/CompositeDatatypeList.java | 35 +++---------------- .../apache/jena/cdt/CompositeDatatypeMap.java | 35 +++---------------- 2 files changed, 10 insertions(+), 60 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15c950d212c..de29b966b16 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -193,43 +193,18 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - List list1 = null; + final List list1; + final List list2; try { list1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - List list2 = null; - try { list2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( list1 == null || list2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the list-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( list1 != null ) return Expr.CMP_LESS; - if ( list2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two lists is empty, we can decide - // without a pair-wise comparison of the list elements. + // If at least one of the two lists is empty, then we can decide their + // relative order without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { // The literal with the non-empty list is greater // than the literal with the empty list. diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 3745596481f..24a76bbb7b5 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -182,43 +182,18 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - Map map1 = null; + final Map map1; + final Map map2; try { map1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - Map map2 = null; - try { map2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( map1 == null || map2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the map-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( map1 != null ) return Expr.CMP_LESS; - if ( map2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two maps is empty, we can decide - // without a pair-wise comparison of the map entries. + // If at least one of the two maps is empty, then we can decide their + // relative order without a pair-wise comparison of the map entries. if ( map1.isEmpty() || map2.isEmpty() ) { // The literal with the non-empty map is greater // than the literal with the empty map. From 674bd35fc7ef3d3501340ee03628bb3e020a11d4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 Nov 2023 19:03:52 +0100 Subject: [PATCH 073/323] implements the decision that 'null=null' is true rather than an error --- .../jena/cdt/CompositeDatatypeList.java | 91 ++++++++++++------- .../apache/jena/cdt/CompositeDatatypeMap.java | 85 +++++++++++------ 2 files changed, 113 insertions(+), 63 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index de29b966b16..e680a30c99f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -168,18 +168,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final CDTValue v2 = it2.next(); if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); - } + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } - if ( ! n1.sameValueAs(n2) ) { - return false; + if ( ! n1.sameValueAs(n2) ) { + return false; + } } } @@ -227,36 +230,57 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue elmt2 = list2.get(i); if ( ! elmt1.isNull() && ! elmt2.isNull() ) { - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); - if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + if ( ! sortOrderingCompare && nv1.isBlank() && nv2.isBlank() ) { throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - + // Compare the values represented by the two list elements + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // lists. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of list elements. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -264,8 +288,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two list elements is null. if ( ! sortOrderingCompare ) { // When comparing as per the list-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! elmt1.isNull() || ! elmt2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 24a76bbb7b5..e3a2ad317cd 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -158,17 +158,20 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v2 == null ) return false; if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + if ( ! n1.sameValueAs(n2) ) return false; } - - if ( ! n1.sameValueAs(n2) ) return false; } return true; @@ -232,32 +235,53 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); if ( ! v1.isNull() && ! v2.isNull() ) { - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! n1.sameValueAs(n2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + final NodeValue nv1 = NodeValue.makeNode( v1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + // Compare the actual values represented by the two map values + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // maps. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of map entries. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -265,8 +289,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two map entries has null as its value. if ( ! sortOrderingCompare ) { // When comparing as per the map-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! v1.isNull() || ! v2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are From c431fd8785b518820398b3bfe03f646456e8b4e5 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Dec 2023 13:41:20 +0100 Subject: [PATCH 074/323] implements the decision that null is not equal to any RDF term --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index e680a30c99f..b630fc4c864 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -169,7 +169,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + return false; } } else { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e3a2ad317cd..59b52ebed89 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -159,7 +159,7 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + return false; } } else { From 7be56b63e75491ff0984f03f0cbef86e01a1ac7c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 8 Jan 2024 19:29:16 +0100 Subject: [PATCH 075/323] bug fix: map keys cannot be blank nodes --- jena-arq/Grammar/cdt_literals.jj | 2 -- .../java/org/apache/jena/cdt/parser/CDTLiteralParser.java | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 514be16467b..24b3d46524d 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -140,8 +140,6 @@ CDTKey MapKey() : { String iri; Node n; } { iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } | - n = BlankNode() { return CDTFactory.createKey(n); } -| n = RDFLiteral() { return CDTFactory.createKey(n); } | n = NumericLiteral() { return CDTFactory.createKey(n); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 8f0b6cb9404..27a51bed270 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -139,7 +139,6 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case IRIref: - case BLANK_NODE_LABEL: NonEmptyMapContent(m); break; default: @@ -184,10 +183,6 @@ final public CDTKey MapKey() throws ParseException { iri = IRI_REF(); n = createNode(iri); {if (true) return CDTFactory.createKey(n);} break; - case BLANK_NODE_LABEL: - n = BlankNode(); - {if (true) return CDTFactory.createKey(n);} - break; case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: @@ -401,7 +396,7 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x2f0f80,0x80000000,0x2f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; From 3eb42212ff7f6e24e47e1768d1033d723531a2c0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:28:47 +0100 Subject: [PATCH 076/323] changes CDTLiteralParserBase to extend LangParserBase instead of TurtleParserBase because, in later versions of Jena, TurtleParserBase has been removed --- jena-arq/Grammar/cdt_literals.jj | 16 +++++++++------- .../apache/jena/cdt/CDTLiteralParserBase.java | 8 ++++---- .../apache/jena/cdt/ParserForCDTLiterals.java | 3 +++ .../apache/jena/cdt/parser/CDTLiteralParser.java | 16 +++++++++------- .../cdt/parser/CDTLiteralParserTokenManager.java | 1 + 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 24b3d46524d..d2e098b906c 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -58,6 +58,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase { } @@ -85,7 +87,7 @@ void NonEmptyListContent(List l) : { } void ListElement(List l) : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); } | n = BlankNode() { l.add( CDTFactory.createValue(n) ); } | @@ -138,7 +140,7 @@ void MapEntry(Map m) : { CDTKey key; CDTValue value; } CDTKey MapKey() : { String iri; Node n; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createKey(n); } | n = RDFLiteral() { return CDTFactory.createKey(n); } | @@ -149,7 +151,7 @@ CDTKey MapKey() : { String iri; Node n; } CDTValue MapValue() : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createValue(n); } | n = BlankNode() { return CDTFactory.createValue(n); } | @@ -186,9 +188,9 @@ Node BlankNode() : { Token t = null ; } Node NumericLiteral() : { Token t ; } { - t = { return createLiteralInteger(t.image); } -| t = { return createLiteralDecimal(t.image); } -| t = { return createLiteralDouble(t.image); } + t = { return createLiteralInteger(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDecimal(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDouble(t.image, t.beginLine, t.beginColumn); } } Node BooleanLiteral() : {} @@ -210,7 +212,7 @@ Node RDFLiteral() : { String lex = null ; } )? { - return createLiteral(lex, lang, dt); + return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index e42b9c339d0..9d4bac04dd6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -3,12 +3,12 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.ttl.turtle.TurtleParserBase; +import org.apache.jena.riot.lang.extra.LangParserBase; -public class CDTLiteralParserBase extends TurtleParserBase +public class CDTLiteralParserBase extends LangParserBase { @Override - protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); @@ -19,7 +19,7 @@ protected Node createLiteral( final String lex, final String langTag, final Stri return NodeFactory.createLiteral(lit); } - return super.createLiteral(lex, langTag, datatypeURI); + return super.createLiteral(lex, langTag, datatypeURI, line, column); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 4284f6f3c1d..02700094c5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -28,6 +28,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -59,6 +60,7 @@ public static List parseListLiteral( final Reader reader, final boolea final List list; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -117,6 +119,7 @@ public static Map parseMapLiteral( final Reader reader, final b final Map map; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 27a51bed270..febae9906be 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -27,6 +27,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point for cdt:List literals @@ -81,7 +83,7 @@ final public void ListElement(List l) throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); l.add( CDTFactory.createValue(n) ); + n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -181,7 +183,7 @@ final public CDTKey MapKey() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createKey(n);} break; case STRING_LITERAL1: case STRING_LITERAL2: @@ -214,7 +216,7 @@ final public CDTValue MapValue() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createValue(n);} break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -278,15 +280,15 @@ final public Node NumericLiteral() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: t = jj_consume_token(INTEGER); - {if (true) return createLiteralInteger(t.image);} + {if (true) return createLiteralInteger(t.image, t.beginLine, t.beginColumn);} break; case DECIMAL: t = jj_consume_token(DECIMAL); - {if (true) return createLiteralDecimal(t.image);} + {if (true) return createLiteralDecimal(t.image, t.beginLine, t.beginColumn);} break; case DOUBLE: t = jj_consume_token(DOUBLE); - {if (true) return createLiteralDouble(t.image);} + {if (true) return createLiteralDouble(t.image, t.beginLine, t.beginColumn);} break; default: jj_la1[7] = jj_gen; @@ -339,7 +341,7 @@ final public Node RDFLiteral() throws ParseException { jj_la1[10] = jj_gen; ; } - {if (true) return createLiteral(lex, lang, dt);} + {if (true) return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn);} throw new Error("Missing return statement in function"); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index bcf9c3cb8e2..9f7b775c892 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From 1c2c3eea963a60576bf50304ce3bee4ff2ee7187 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:36:58 +0100 Subject: [PATCH 077/323] moves the CDT literals grammar to the subdirectory './jena-arq/Grammar/CDTs/' --- jena-arq/Grammar/{ => CDTs}/cdt_literals.jj | 0 jena-arq/Grammar/{grammarCDTs => CDTs/generate} | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/Grammar/{ => CDTs}/cdt_literals.jj (100%) rename jena-arq/Grammar/{grammarCDTs => CDTs/generate} (90%) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/CDTs/cdt_literals.jj similarity index 100% rename from jena-arq/Grammar/cdt_literals.jj rename to jena-arq/Grammar/CDTs/cdt_literals.jj diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/CDTs/generate similarity index 90% rename from jena-arq/Grammar/grammarCDTs rename to jena-arq/Grammar/CDTs/generate index 8bbaf8685d4..687b81f0532 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/CDTs/generate @@ -17,7 +17,7 @@ # Parser builder -DIR="../src/main/java/org/apache/jena/cdt/parser" +DIR="../../src/main/java/org/apache/jena/cdt/parser" FILE=cdt_literals.jj CLASS=CDTLiteralParser @@ -57,8 +57,8 @@ sed -e 's/@SuppressWarnings("serial")//' \ mv F $F echo "---- Create HTML form ----" -./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html -./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html +../jj2html ${FILE%%.jj}.txt '../tokens.txt' > ${FILE%%.jj}-1.html +../grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html echo "Check X and Y for IRI_REF because \" became '" From 56e8f1613cb710fae9f677823910de5e24dd489c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 13 Jan 2024 11:25:30 +0100 Subject: [PATCH 078/323] extends LiteralLabelForCDTs with a constructor to pass both the lexical form and the value form --- .../org/apache/jena/cdt/LiteralLabelForCDTs.java | 13 +++++++++++++ .../org/apache/jena/cdt/LiteralLabelForList.java | 9 +++++++++ .../org/apache/jena/cdt/LiteralLabelForMap.java | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 6fea1cfee96..e87c39d39cf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -30,6 +30,19 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForCDTs( final String lexicalForm, final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + @Override public abstract CompositeDatatypeBase getDatatype(); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index e84fe915333..32c1331befc 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,15 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForList( final String lexicalForm, final List valueForm ) { + super(lexicalForm , valueForm); + } + @Override public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 18ad753f62c..028fb646c5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,15 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForMap( final String lexicalForm, final Map valueForm ) { + super(lexicalForm, valueForm); + } + @Override public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; From 6e512627e3ac892a664cbd308fde4f41f74f7216 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Mar 2024 14:25:50 +0100 Subject: [PATCH 079/323] adds license comment at the begin oft he files --- .../apache/jena/cdt/CDTLiteralParserBase.java | 18 ++++++++++++++++++ .../apache/jena/cdt/CompositeDatatypeMap.java | 18 ++++++++++++++++++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 18 ++++++++++++++++++ .../sparql/expr/aggregate/AggFoldList.java | 18 ++++++++++++++++++ .../jena/sparql/expr/aggregate/AggFoldMap.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctionUtils.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctions.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ConcatFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsKeyFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsTermFct.java | 18 ++++++++++++++++++ .../library/cdt/FunctionBase1List.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/GetFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/HeadFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/KeysFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ListFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MapFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MergeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/PutFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/RemoveFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ReverseFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SizeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SubSeqFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/TailFct.java | 18 ++++++++++++++++++ 24 files changed, 432 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 9d4bac04dd6..86f89242fe4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import org.apache.jena.graph.Node; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 59b52ebed89..999c087dca6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Comparator; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 6fea1cfee96..b835f619c83 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Objects; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index e53f8a45263..52687ef030c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 70eb9c57eac..923e42934bc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 3e4b5b39b28..d7449b162f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 48f5d4a7465..35b2e78a78b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index fc7ed60734d..6a0dba23500 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index f9751d78ca5..462398e98f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index eca1978ba1e..88a46fd2d08 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index da670a6508e..e5fc0421f49 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index b6f45b33e4b..0b2af548103 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index c83cd9b764f..24bcbfcfb50 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index 1f331c936ac..0eb1348f986 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 6c393370ff1..2c919eb9347 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index ca7c0f92715..dc50559d9f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java index 3dba18232eb..fec5c220524 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java index ddeb872b3ce..344f3117fae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index 0df7dcfdf00..428c000d5bb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index 0a4a5a99b36..b5df5a5a292 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index 3d28e7a76e0..9b918036c72 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 5166f1440d9..e0bb791c076 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 80a99fb32f0..e508185c7dc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index 70805975786..aee058e6586 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; From 5329001f3c2d71f40ce5d26b5c0cd6c7e59cd0d2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 May 2024 10:54:01 +0200 Subject: [PATCH 080/323] permanent URI for the CDT datatypes and functions --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index b630fc4c864..0edfd9b0a63 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -31,7 +31,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/List"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 999c087dca6..23516072ec2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -34,7 +34,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/Map"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index af978795a34..bfc21043092 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -78,7 +78,7 @@ public class ARQConstants public static final String javaClassURIScheme = "java:" ; /** The ARQ function library URI space */ - public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + public static final String CDTFunctionLibraryURI = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/" ; /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; From 2b29e61e79aed18eb65c7edce7337be104d9fc27 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 25 May 2024 18:18:32 +0300 Subject: [PATCH 081/323] removes the InputStream versions of parseListLiteral and parseMapLiteral --- .../apache/jena/cdt/ParserForCDTLiterals.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 02700094c5e..fbaed36de26 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -45,17 +45,6 @@ public static List parseListLiteral( final String lex, final boolean r return result; } - public static List parseListLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final List result = parseListLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static List parseListLiteral( final Reader reader, final boolean recursive ) { final List list; try { @@ -104,17 +93,6 @@ public static Map parseMapLiteral( final String lex, final bool return result; } - public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final Map result = parseMapLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { final Map map; try { From 9476decd15a7996f8c30c86e45852e12c3458575 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:20:09 +0300 Subject: [PATCH 082/323] adds the possibility to create CDT literals that are known to be ill-formed (because their lexical form has already been checked) --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 5 +++++ .../java/org/apache/jena/cdt/CompositeDatatypeMap.java | 5 +++++ .../java/org/apache/jena/cdt/LiteralLabelForCDTs.java | 8 ++++++++ .../java/org/apache/jena/cdt/LiteralLabelForList.java | 4 ++++ .../main/java/org/apache/jena/cdt/LiteralLabelForMap.java | 4 ++++ .../function/library/cdt/CDTLiteralFunctionUtils.java | 6 ++++++ 6 files changed, 32 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 0edfd9b0a63..c250c09dbcf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -196,6 +196,11 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final List list1; final List list2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 23516072ec2..587e30f9805 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -203,6 +203,11 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final Map map1; final Map map2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index cd1df7b2b86..48eb6c0f0fe 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -48,6 +48,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + public LiteralLabelForCDTs( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index 32c1331befc..60f76f02c71 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,10 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForList( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 028fb646c5c..c3a18961075 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,10 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForMap( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed ); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d7449b162f8..37ff826a846 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -63,6 +63,9 @@ public static final void ensureMapLiteral( final Node n ) throws ExprEvalExcepti * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. */ public static final List getList( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeList.getValue( n.getLiteral() ); } @@ -80,6 +83,9 @@ public static final List getList( final Node n ) throws ExprEvalExcept * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. */ public static final Map getMap( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeMap.getValue( n.getLiteral() ); } From 05efa88f65d275082360495e4f734a1ca43c76a6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:41:10 +0300 Subject: [PATCH 083/323] changes the parsing of CDT literals such that the scope of bnode identifiers extends to all CDT literals within a file as well as to the file itself; as per https://github.com/awslabs/SPARQL-CDTs/pull/2 and https://github.com/awslabs/SPARQL-CDTs/pull/4 --- .../apache/jena/cdt/CDTLiteralParserBase.java | 20 ++-- .../apache/jena/cdt/ParserForCDTLiterals.java | 41 ++++++--- .../java/org/apache/jena/riot/RDFParser.java | 2 +- .../riot/system/CDTAwareParserProfile.java | 92 +++++++++++++++++++ .../org/apache/jena/riot/system/RiotLib.java | 4 +- .../jena/sparql/lang/arq/ARQParserBase.java | 59 ++++++++++++ 6 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 86f89242fe4..7e26446c20f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -19,22 +19,30 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.lang.extra.LangParserBase; public class CDTLiteralParserBase extends LangParserBase { + @Override + protected Node createBNode( final String label, final int line, final int column ) { + // We need to cut away the leading '_:' of the given blank node label. + // This is necessary because the Turtle parser does the same. If we + // would not do it here for the blank node labels obtained from the + // lexical forms of CDT literals, then the label-to-bnode mapping of + // the shared parser state fails to map the same blank node identifiers + // inside and outside of CDT literals to the same blank node. + final String lbl = label.startsWith("_:") ? label.substring(2) : label; + return super.createBNode(lbl, line, column); + } + @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForList(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeList.type, 0L, 0L); } if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForMap(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeMap.type, 0L, 0L); } return super.createLiteral(lex, langTag, datatypeURI, line, column); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index fbaed36de26..b4297a8ce91 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -18,7 +18,6 @@ package org.apache.jena.cdt; -import java.io.InputStream; import java.io.IOException; import java.io.Reader; import java.io.StringReader; @@ -28,15 +27,19 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; -import org.apache.jena.util.FileUtils; public class ParserForCDTLiterals { public static List parseListLiteral( final String lex, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final List result = parseListLiteral(reader, recursive); + final List result = parseListLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -46,10 +49,15 @@ public static List parseListLiteral( final String lex, final boolean r } public static List parseListLiteral( final Reader reader, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final List list; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -68,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -83,8 +91,12 @@ else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof } public static Map parseMapLiteral( final String lex, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final Map result = parseMapLiteral(reader, recursive); + final Map result = parseMapLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -94,10 +106,15 @@ public static Map parseMapLiteral( final String lex, final bool } public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final Map map; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { @@ -116,11 +133,11 @@ public static Map parseMapLiteral( final Reader reader, final b if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java index de97e05e7c4..1a6a1d3d5db 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java @@ -518,7 +518,7 @@ private ParserProfile makeParserProfile(Lang lang) { ? resolver : IRIxResolver.create().base(baseStr).resolve(resolve).allowRelative(allowRelative).build(); PrefixMap pmap = ( this.prefixMap != null ) ? this.prefixMap : PrefixMapFactory.create(); - ParserProfileStd parserFactory = new ParserProfileStd(factory, errorHandler, + ParserProfileStd parserFactory = new CDTAwareParserProfile(factory, errorHandler, parserResolver, pmap, context, checking$, strict); return parserFactory; diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java new file mode 100644 index 00000000000..3b904f091b6 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -0,0 +1,92 @@ +package org.apache.jena.riot.system; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.cdt.ParserForCDTLiterals; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.irix.IRIxResolver; +import org.apache.jena.sparql.util.Context; + +/** + * This is a {@link ParserProfile} that supports parsing of CDT literals + * that occur within the parsed file. The main point is to share the + * {@link FactoryRDF} object of this parser profile with the parser of + * these literals in order to get the same blank nodes for the same + * blank node identifiers both within and outside of the literals, as + * well as across multiple CDT literals that occur in the parsed file. + */ +public class CDTAwareParserProfile extends ParserProfileStd { + + public CDTAwareParserProfile( final FactoryRDF factory, + final ErrorHandler errorHandler, + final IRIxResolver resolver, + final PrefixMap prefixMap, + final Context context, + final boolean checking, + final boolean strictMode ) { + super(factory, errorHandler, resolver, prefixMap, context, checking, strictMode); + } + + @Override + public Node createTypedLiteral( final String lex, final RDFDatatype datatype, final long line, final long col ) { + if ( datatype.equals(CompositeDatatypeList.type) ) { + return createListLiteral(lex); + } + + if ( datatype.equals(CompositeDatatypeMap.type) ) { + return createMapLiteral(lex); + } + + return super.createTypedLiteral(lex, datatype, line, col); + } + + protected Node createListLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final List value; + try { + value = ParserForCDTLiterals.parseListLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForList(lex, value); + return NodeFactory.createLiteral(lit); + } + + protected Node createMapLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final Map value; + try { + value = ParserForCDTLiterals.parseMapLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForMap(lex, value); + return NodeFactory.createLiteral(lit); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java index 1e89f77a668..618a71084ce 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java @@ -206,7 +206,7 @@ public static ParserProfile dftProfile() { * Create a {@link ParserProfile} with default settings, and a specific error handler. */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, IRIxResolver.create(IRIs.getSystemBase()).build(), PrefixMapFactory.create(), @@ -220,7 +220,7 @@ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, IRIxResolver resolver, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, resolver, PrefixMapFactory.create(), diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java index 9ee67142138..ce3350e2f0e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java @@ -22,7 +22,17 @@ import org.apache.jena.atlas.json.io.JSONHandler ; import org.apache.jena.atlas.json.io.JSONHandlerBase ; import org.apache.jena.atlas.lib.NotImplemented ; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.system.ParserProfile; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.sparql.core.BasicPattern; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.lang.SPARQLParserBase ; @@ -89,4 +99,53 @@ protected ElementGroup createQueryPattern(Template t){ } return elg; } + + // CDT literals + protected ParserProfile parserProfileForCDTs = null; + + @Override + protected Node createLiteral(String lexicalForm, String langTag, String datatypeURI) { + // CDT literals need to be handled in a special way because their + // lexical forms may contain blank node identifiers, and the same + // blank node identifier in different CDT literals within the same + // query must be mapped to the same blank node. To this end, we are + // reusing the same ParserProfile for parsing all the CDT literals. + final RDFDatatype cdtDatatype; + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeList.type; + else if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeMap.type; + else + cdtDatatype = null; + + if ( cdtDatatype != null ) { + ensureParserProfileForCDTs(); + try { + return parserProfileForCDTs.createTypedLiteral(lexicalForm, cdtDatatype, 0L, 0L); + } + catch ( DatatypeFormatException ex ) { + return createIllformedLiteral(lexicalForm, cdtDatatype); + } + } + + return super.createLiteral(lexicalForm, langTag, datatypeURI); + } + + protected void ensureParserProfileForCDTs() { + if ( parserProfileForCDTs == null ) { + parserProfileForCDTs = RiotLib.dftProfile(); + } + } + + protected Node createIllformedLiteral(String lexicalForm, RDFDatatype cdtDatatype) { + final LiteralLabel lit; + if ( CompositeDatatypeList.type.equals(cdtDatatype) ) + lit = new LiteralLabelForList(lexicalForm, true); + else if ( CompositeDatatypeMap.type.equals(cdtDatatype) ) + lit = new LiteralLabelForMap(lexicalForm, true); + else + throw new IllegalArgumentException( cdtDatatype.toString() ); + + return NodeFactory.createLiteral(lit); + } } From 9cc5647c3cc1f9b1512679c6632345bc78f58f28 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 20:45:50 +0200 Subject: [PATCH 084/323] initial addition of Unfold to the ARQ grammar, including all code changes necessary for the query engine to handle this new operator (but without invoking any actual functionality if it is present in a query) --- jena-arq/Grammar/arq.jj | 14 + jena-arq/Grammar/main.jj | 61 + .../jena/sparql/algebra/AlgebraGenerator.java | 5 + .../apache/jena/sparql/algebra/OpAsQuery.java | 9 + .../apache/jena/sparql/algebra/OpVars.java | 21 + .../apache/jena/sparql/algebra/OpVisitor.java | 1 + .../jena/sparql/algebra/OpVisitorBase.java | 2 + .../jena/sparql/algebra/OpVisitorByType.java | 4 + .../apache/jena/sparql/algebra/Transform.java | 1 + .../jena/sparql/algebra/TransformCopy.java | 2 + .../jena/sparql/algebra/TransformSingle.java | 2 + .../jena/sparql/algebra/TransformWrapper.java | 2 + .../jena/sparql/algebra/op/OpUnfold.java | 102 + .../optimize/VariableUsageVisitor.java | 12 + .../algebra/walker/ApplyTransformVisitor.java | 5 + .../algebra/walker/OpVisitorByType.java | 5 + .../walker/OpVisitorByTypeAndExpr.java | 6 + .../sparql/algebra/walker/WalkerVisitor.java | 9 + .../engine/iterator/QueryIterUnfold.java | 44 + .../sparql/engine/main/ExecutionDispatch.java | 7 + .../jena/sparql/engine/main/OpExecutor.java | 6 + .../jena/sparql/engine/main/VarFinder.java | 14 +- .../jena/sparql/engine/ref/Evaluator.java | 2 + .../sparql/engine/ref/EvaluatorDispatch.java | 7 + .../sparql/engine/ref/EvaluatorSimple.java | 8 + .../jena/sparql/lang/arq/ARQParser.java | 5775 ++++++++--------- .../sparql/lang/arq/ARQParserConstants.java | 374 +- .../lang/arq/ARQParserTokenManager.java | 2514 ++++--- .../jena/sparql/lang/arq/ParseException.java | 48 +- .../sparql/lang/arq/SimpleCharStream.java | 21 +- .../apache/jena/sparql/lang/arq/Token.java | 7 +- .../jena/sparql/lang/arq/TokenMgrError.java | 36 +- .../java/org/apache/jena/sparql/sse/Tags.java | 1 + .../jena/sparql/sse/writers/WriterOp.java | 19 + .../jena/sparql/syntax/ElementUnfold.java | 86 + .../querybuilder/rewriters/OpRewriter.java | 8 +- .../query/rewriter/OpRewriter.java | 13 + 37 files changed, 4810 insertions(+), 4443 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 2432ac5085b..36120747f0c 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -634,6 +634,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() ) { return el ; } } @@ -758,6 +760,17 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} Element MinusGraphPattern() : { Element el ; } { @@ -1790,6 +1803,7 @@ TOKEN [IGNORE_CASE] : | < SUBJECT: "SUBJECT" > | < PREDICATE: "PREDICATE" > | < OBJECT: "OBJECT" > +| < UNFOLD: "unfold" > | < EXISTS: "exists" > | < NOT: "not" > | < AS: "as" > diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 757e0055e5f..9d60ec0173a 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -480,6 +480,27 @@ void OrderCondition() : getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( // These are for clarity in the HTML + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() //{ expr = asExpr(v) ; } + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} + void LimitOffsetClauses() : { } { // SPARQL does not care about the order here. @@ -906,6 +927,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() #endif ) { return el ; } @@ -1051,6 +1074,18 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } + +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} #endif Element MinusGraphPattern() : { Element el ; } @@ -2234,6 +2269,27 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { java.util.List scs = null ; + SortCondition sc = null ; } + + ( { distinct = true ; } )? + expr = Expression() + ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? + + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } + /* Explicit syntax (aggregate even if not registered) */ | t = { String iri ; } @@ -2499,6 +2555,8 @@ TOKEN [IGNORE_CASE] : #ifdef ARQ | < LET: "LET" > | < LATERAL: "LATERAL" > + +| < UNFOLD: "unfold" > #endif | < TRIPLE: "TRIPLE" > @@ -2529,6 +2587,9 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +#ifdef ARQ +| < FOLD: "fold" > +#endif | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index 5174505d0e5..22383d9a7af 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -324,6 +324,11 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { if ( elt instanceof ElementNotExists elt2 ) return compileElementNotExists(current, elt2); + if ( elt instanceof ElementUnfold ) { + ElementUnfold unfold = (ElementUnfold)elt; + return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + } + // Filters were collected together by prepareGroup // This only handles filters left in place by some magic. if ( elt instanceof ElementFilter ef) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java index 1c74499dbdf..4b23ab44aa7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java @@ -828,6 +828,15 @@ public void visit(OpExtend opExtend) { }) ; } + @Override + public void visit(OpUnfold opUnfold) { + Element e = asElement(opUnfold.getSubOp()) ; + // If (unfold ... (table unit)), and first in group, don't add the empty group. + insertIntoGroup(currentGroup(), e) ; + Element elmtUnfold = new ElementUnfold( opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2() ) ; + currentGroup().addElement(elmtUnfold) ; + } + @Override public void visit(OpList opList) { opList.getSubOp().visit(this) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index dcdde83de9a..5ecb30b5095 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -311,6 +311,14 @@ public void visit(OpExtend opExtend) { acc.addAll(opExtend.getVarExprList().getVars()); } + @Override + public void visit(OpUnfold opUnfold) { + acc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + acc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { PropFuncArg.addVars(acc, opPropFunc.getSubjectArgs()); @@ -430,6 +438,14 @@ public void visit(OpExtend opExtend) { unknownAcc.addAll(opExtend.getVarExprList().getVars()); } + @Override + public void visit(OpUnfold opUnfold) { + unknownAcc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + unknownAcc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { addvars(subjAcc, opPropFunc.getSubjectArgs()); @@ -496,6 +512,11 @@ public void visit(OpAssign opAssign) { visitExtendAssign(opAssign); } + @Override + public void visit(OpUnfold opUnfold) { + ExprVars.varsMentioned( acc, opUnfold.getExpr() ); + } + // The expression side of (extend) and (assign) private void visitExtendAssign(OpExtendAssign op) { op.getVarExprList().forEachExpr((v, e) -> ExprVars.varsMentioned(acc, e)); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java index 15a13d5fd44..a7a74c79195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java @@ -42,6 +42,7 @@ public interface OpVisitor public void visit(OpLabel opLabel) ; public void visit(OpAssign opAssign) ; public void visit(OpExtend opExtend) ; + public void visit(OpUnfold opUnfold) ; // Op2 public void visit(OpJoin opJoin) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java index 8eccc40e9d2..89cbe7692de 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java @@ -80,6 +80,8 @@ public OpVisitorBase() {} @Override public void visit(OpExtend opExtend) {} + @Override public void visit(OpUnfold opUnfold) {} + @Override public void visit(OpList opList) {} @Override public void visit(OpOrder opOrder) {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java index b331f817a5f..fd8f0b4b8b6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java @@ -150,6 +150,10 @@ public void visit(OpAssign opAssign) public void visit(OpExtend opExtend) { visit1(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) + { visit1(opUnfold) ; } + @Override public void visit(OpList opList) { visitModifer(opList) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java index 98fbc1b872a..bdebe52b986 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java @@ -44,6 +44,7 @@ public interface Transform public Op transform(OpLabel opLabel, Op subOp) ; public Op transform(OpAssign opAssign, Op subOp) ; public Op transform(OpExtend opExtend, Op subOp) ; + public Op transform(OpUnfold opUnfold, Op subOp) ; // Op2 public Op transform(OpJoin opJoin, Op left, Op right) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java index 32ecd34b178..6c21d89be85 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java @@ -68,6 +68,8 @@ public class TransformCopy implements Transform public Op transform(OpAssign opAssign, Op subOp) { return xform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return xform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return xform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return xform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java index 5515cb85e75..69a525bd769 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java @@ -64,6 +64,8 @@ public class TransformSingle implements Transform public Op transform(OpAssign opAssign, Op subOp) { return opAssign ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return opExtend ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return opUnfold ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return opJoin ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java index 30bff50c707..0be481886f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java @@ -66,6 +66,8 @@ public TransformWrapper(Transform transform) public Op transform(OpAssign opAssign, Op subOp) { return transform.transform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return transform.transform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return transform.transform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return transform.transform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java new file mode 100644 index 00000000000..55a193e1332 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java @@ -0,0 +1,102 @@ +/* + * 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 org.apache.jena.sparql.algebra.op; + +import java.util.Objects; + +import org.apache.jena.sparql.algebra.Op; +import org.apache.jena.sparql.algebra.OpVisitor; +import org.apache.jena.sparql.algebra.Transform; +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.sse.Tags; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class OpUnfold extends Op1 +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public OpUnfold(Op subOp, Expr expr, Var var1, Var var2) { + super(subOp) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public String getName() { + return Tags.tagUnfold ; + } + + @Override + public void visit(OpVisitor opVisitor) { + opVisitor.visit(this) ; + } + + @Override + public Op1 copy(Op subOp) { + OpUnfold op = new OpUnfold(subOp, expr, var1, var2) ; + return op ; + } + + @Override + public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { + if ( !(other instanceof OpUnfold) ) + return false ; + OpUnfold unfold = (OpUnfold)other ; + + if ( !Objects.equals(var1, unfold.var1) ) + return false ; + if ( !Objects.equals(var2, unfold.var2) ) + return false ; + if ( !Objects.equals(expr, unfold.expr) ) + return false ; + return getSubOp().equalTo(unfold.getSubOp(), labelMap) ; + } + + @Override + public Op apply(Transform transform, Op subOp) { + return transform.transform(this, subOp) ; + } + + @Override + public int hashCode() { + if ( var2 == null ) + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ getSubOp().hashCode() ; + else + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ var2.hashCode() ^ getSubOp().hashCode() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java index 9cc3bb14139..747ee97bf5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java @@ -41,6 +41,7 @@ import org.apache.jena.sparql.algebra.op.OpQuadPattern; import org.apache.jena.sparql.algebra.op.OpTable; import org.apache.jena.sparql.algebra.op.OpTopN; +import org.apache.jena.sparql.algebra.op.OpUnfold; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.Vars; @@ -169,6 +170,17 @@ public void visit(OpExtend opExtend) { action(vars); } + @Override + public void visit(OpUnfold opUnfold) { + Collection vars = new ArrayList<>(); + ExprVars.varsMentioned(vars, opUnfold.getExpr()); + vars.add( opUnfold.getVar1() ); + if ( opUnfold.getVar2() != null ) { + vars.add( opUnfold.getVar2() ); + } + action(vars); + } + @Override public void visit(OpOrder opOrder) { Collection vars = new ArrayList<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index 19543334803..e6028996b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -147,6 +147,11 @@ public void visit(OpExtend opExtend) { visit1(opExtend2) ; } + @Override + public void visit(OpUnfold opUnfold) { + visit1(opUnfold) ; + } + // Special test cases for collectors. // Careful about order. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java index 3f373291f0f..2ec2fbb8020 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java @@ -188,6 +188,11 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java index 5387afab57b..bf3d3589646 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java @@ -215,6 +215,12 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visitExpr( new ExprList(opUnfold.getExpr()) ) ; + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java index 6243225afc5..d1fa6e7e9eb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java @@ -215,6 +215,15 @@ public void visit(OpExtend opExtend) { after(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) { + before(opUnfold) ; + ExprList varExpr = new ExprList( opUnfold.getExpr() ) ; + visitExpr(varExpr); + visit1$(opUnfold) ; + after(opUnfold) ; + } + // Transforming to quads needs the graph node handled before doing the sub-algebra ops // so it has to be done as before/after by the Walker. By the time visit(OpGraph) is called, // the sub-tree has already been visited. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java new file mode 100644 index 00000000000..d052da6e075 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -0,0 +1,44 @@ +/* + * 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 org.apache.jena.sparql.engine.iterator; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.QueryIterator; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; + +public class QueryIterUnfold extends QueryIteratorWrapper +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { + super(qIter) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + @Override + protected Binding moveToNextBinding() { +System.out.println("QueryIterUnfold"); + return super.moveToNextBinding() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java index 923836a7bcb..96974249939 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java @@ -272,6 +272,13 @@ public void visit(OpExtend opExtend) { push(qIter); } + @Override + public void visit(OpUnfold opUnfold) { + QueryIterator input = pop(); + QueryIterator qIter = opExecutor.execute(opUnfold, input); + push(qIter); + } + @Override public void visit(OpSlice opSlice) { QueryIterator input = pop(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 93b12bfed61..8dbc562c921 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -450,6 +450,12 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { return qIter; } + protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { + QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + return qIter ; + } + public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { return QueryIterRoot.create(execCxt); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index 882fa9b93dd..a1a5408cdb3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -122,7 +122,7 @@ static VarUsageVisitor apply(Op op) { Set filterMentions = null ; // Used in a filter, before defined Set filterMentionsOnly = null ; - // Used in assign or extend expression + // Used in assign or extend or unfold expression Set assignMentions = null ; VarUsageVisitor() { @@ -376,6 +376,18 @@ private boolean isLikelyToBeDefined(Expr expr) { return result; } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + + defines.add( opUnfold.getVar1() ); + + if ( opUnfold.getVar2() != null ) + defines.add( opUnfold.getVar2() ); + + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + } + @Override public void visit(OpProject opProject) { List vars = opProject.getVars(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java index 5299b5c1f7e..201ce5a8922 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java @@ -29,6 +29,7 @@ import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.engine.ExecutionContext; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.pfunction.PropFuncArg; @@ -46,6 +47,7 @@ public interface Evaluator public Table assign(Table table, VarExprList exprs); public Table extend(Table table, VarExprList exprs); + public Table unfold(Table table, Expr expr, Var var1, Var var2); public Table join(Table tableLeft, Table tableRight); public Table leftJoin(Table tableLeft, Table tableRight, ExprList expr); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java index f1b1de27902..b459ce606ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java @@ -309,6 +309,13 @@ public void visit(OpExtend opExtend) { push(table); } + @Override + public void visit(OpUnfold opUnfold) { + Table table = eval(opUnfold.getSubOp()); + table = evaluator.unfold(table, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()); + push(table); + } + @Override public void visit(OpGroup opGroup) { Table table = eval(opGroup.getSubOp()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index c37b84a7cf0..894dee013c0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -36,6 +36,7 @@ import org.apache.jena.sparql.engine.binding.BindingBuilder; import org.apache.jena.sparql.engine.iterator.*; import org.apache.jena.sparql.engine.main.QC; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.pfunction.PropFuncArg; @@ -250,6 +251,13 @@ public Table extend(Table table, VarExprList exprs) { return new TableN(qIter); } + @Override + public Table unfold(Table table, Expr expr, Var var1, Var var2) { + QueryIterator qIter = table.iterator(getExecContext()); + qIter = new QueryIterUnfold(qIter, expr, var1, var2); + return new TableN(qIter); + } + @Override public Table unit() { return TableFactory.createUnit(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 30e9f835b66..9b6244421d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -1,4 +1,3 @@ -/* ARQParser.java */ /* Generated By:JavaCC: Do not edit this line. ARQParser.java */ package org.apache.jena.sparql.lang.arq ; import org.apache.jena.graph.* ; @@ -12,122 +11,116 @@ import org.apache.jena.update.* ; import org.apache.jena.sparql.modify.request.* ; import org.apache.jena.sparql.core.Quad ; +import java.util.List; +import java.util.ArrayList; @SuppressWarnings("all") public class ARQParser extends ARQParserBase implements ARQParserConstants { final public void QueryUnit() throws ParseException { ByteOrderMark(); -startQuery() ; + startQuery() ; Query(); jj_consume_token(0); -finishQuery() ; -} + finishQuery() ; + } final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: SelectQuery(); break; - } - case CONSTRUCT:{ + case CONSTRUCT: ConstructQuery(); break; - } - case DESCRIBE:{ + case DESCRIBE: DescribeQuery(); break; - } - case ASK:{ + case ASK: AskQuery(); break; - } - case JSON:{ + case JSON: JsonQuery(); break; - } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); -} + } final public void UpdateUnit() throws ParseException { ByteOrderMark(); -startUpdateRequest() ; + startUpdateRequest() ; Update(); jj_consume_token(0); -finishUpdateRequest() ; -} + finishUpdateRequest() ; + } final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOM: jj_consume_token(BOM); break; - } default: jj_la1[1] = jj_gen; ; } -} + } final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BASE: - case PREFIX:{ + case PREFIX: ; break; - } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BASE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BASE: BaseDecl(); break; - } - case PREFIX:{ + case PREFIX: PrefixDecl(); break; - } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -} + } - final public void BaseDecl() throws ParseException {Token t ; String iri ; + final public void BaseDecl() throws ParseException { + Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); -setBase(iri, t.beginLine, t.beginColumn ) ; -} + setBase(iri, t.beginLine, t.beginColumn ) ; + } - final public void PrefixDecl() throws ParseException {Token t ; String iri ; + final public void PrefixDecl() throws ParseException { + Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); -String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); + String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; -} + } final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[4] = jj_gen; break label_2; @@ -136,45 +129,43 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); -} + } - final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException { + Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); -getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DISTINCT: - case REDUCED:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + case REDUCED: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -getQuery().setDistinct(true); + getQuery().setDistinct(true); break; - } - case REDUCED:{ + case REDUCED: jj_consume_token(REDUCED); -getQuery().setReduced(true); + getQuery().setReduced(true); break; - } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[6] = jj_gen; ; } -setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -201,6 +192,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -275,16 +267,15 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addResultVar(v) ; + getQuery().addResultVar(v) ; break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -309,6 +300,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -382,27 +374,25 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: if (jj_2_1(2)) { expr = BuiltInCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -411,17 +401,15 @@ final public void SubSelect() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } default: jj_la1[7] = jj_gen; jj_consume_token(-1); @@ -429,32 +417,29 @@ final public void SubSelect() throws ParseException { } } break; - } - case LPAREN:{ -v = null ; + case LPAREN: + v = null ; jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[8] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addResultVar(v, expr) ; -getQuery().setQueryResultStar(false) ; + getQuery().addResultVar(v, expr) ; + getQuery().setQueryResultStar(false) ; break; - } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -481,6 +466,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -555,45 +541,42 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[10] = jj_gen; break label_3; } } break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void ConstructQuery() throws ParseException {Template t ; + final public void ConstructQuery() throws ParseException { + Template t ; QuadAcc acc = new QuadAcc() ; jj_consume_token(CONSTRUCT); -getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: t = ConstructTemplate(); -getQuery().setConstructTemplate(t) ; + getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[12] = jj_gen; break label_4; @@ -603,16 +586,14 @@ final public void SubSelect() throws ParseException { WhereClause(); SolutionModifier(); break; - } case FROM: - case WHERE:{ + case WHERE: label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[13] = jj_gen; break label_5; @@ -624,54 +605,51 @@ final public void SubSelect() throws ParseException { ConstructQuads(acc); jj_consume_token(RBRACE); SolutionModifier(); -t = new Template(acc) ; + t = new Template(acc) ; getQuery().setConstructTemplate(t) ; ElementGroup elg = createQueryPattern(t); getQuery().setQueryPattern(elg) ; break; - } default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DescribeQuery() throws ParseException {Node n ; + final public void DescribeQuery() throws ParseException { + Node n ; jj_consume_token(DESCRIBE); -getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: label_6: while (true) { n = VarOrIri(); -getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[15] = jj_gen; break label_6; } } -getQuery().setQueryResultStar(false) ; + getQuery().setQueryResultStar(false) ; break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[16] = jj_gen; jj_consume_token(-1); @@ -679,40 +657,37 @@ final public void SubSelect() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[17] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHERE: - case LBRACE:{ + case LBRACE: WhereClause(); break; - } default: jj_la1[18] = jj_gen; ; } SolutionModifier(); -} + } final public void AskQuery() throws ParseException { jj_consume_token(ASK); -getQuery().setQueryAskType() ; + getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[19] = jj_gen; break label_8; @@ -721,17 +696,16 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonQuery() throws ParseException { JsonClause(); label_9: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[20] = jj_gen; break label_9; @@ -740,20 +714,19 @@ final public void JsonQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonClause() throws ParseException { jj_consume_token(JSON); -getQuery().setQueryJsonType() ; + getQuery().setQueryJsonType() ; jj_consume_token(LBRACE); JsonObjectMember(); label_10: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[21] = jj_gen; break label_10; @@ -762,28 +735,27 @@ final public void JsonClause() throws ParseException { JsonObjectMember(); } jj_consume_token(RBRACE); -} + } - final public void JsonObjectMember() throws ParseException {Node o ; String s ; Token t; + final public void JsonObjectMember() throws ParseException { + Node o ; String s ; Token t; s = String(); t = jj_consume_token(PNAME_NS); -if ( ! t.image.equals(":") ) + if ( ! t.image.equals(":") ) throwParseException("Prefix name expression not legal at this point : "+t.image, t.beginLine, t.beginColumn) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: o = Var(); -getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: o = RDFLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -792,116 +764,111 @@ final public void JsonClause() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: o = NumericLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case TRUE: - case FALSE:{ + case FALSE: o = BooleanLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: DefaultGraphClause(); break; - } - case NAMED:{ + case NAMED: NamedGraphClause(); break; - } default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DefaultGraphClause() throws ParseException {String iri ; + final public void DefaultGraphClause() throws ParseException { + String iri ; iri = SourceSelector(); -getQuery().addGraphURI(iri) ; -} + getQuery().addGraphURI(iri) ; + } - final public void NamedGraphClause() throws ParseException {String iri ; + final public void NamedGraphClause() throws ParseException { + String iri ; jj_consume_token(NAMED); iri = SourceSelector(); -getQuery().addNamedGraphURI(iri) ; -} + getQuery().addNamedGraphURI(iri) ; + } - final public String SourceSelector() throws ParseException {String iri ; + final public String SourceSelector() throws ParseException { + String iri ; iri = iri(); -{if ("" != null) return iri ;} + {if (true) return iri ;} throw new Error("Missing return statement in function"); -} + } - final public void WhereClause() throws ParseException {Element el ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WHERE:{ + final public void WhereClause() throws ParseException { + Element el ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: jj_consume_token(WHERE); break; - } default: jj_la1[24] = jj_gen; ; } -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -getQuery().setQueryPattern(el) ; -finishWherePattern() ; -} + getQuery().setQueryPattern(el) ; + finishWherePattern() ; + } final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GROUP:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: GroupClause(); break; - } default: jj_la1[25] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HAVING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: HavingClause(); break; - } default: jj_la1[26] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ORDER:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: OrderClause(); break; - } default: jj_la1[27] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: - case OFFSET:{ + case OFFSET: LimitOffsetClauses(); break; - } default: jj_la1[28] = jj_gen; ; } -} + } final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -909,7 +876,7 @@ final public void GroupClause() throws ParseException { label_11: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -936,6 +903,7 @@ final public void GroupClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -995,19 +963,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[29] = jj_gen; break label_11; } } -} + } - final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void GroupCondition() throws ParseException { + Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -1029,6 +997,7 @@ final public void GroupClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1087,55 +1056,50 @@ final public void GroupClause() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[30] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addGroupBy(v ,expr) ; + getQuery().addGroupBy(v ,expr) ; break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addGroupBy(v) ; + getQuery().addGroupBy(v) ; break; - } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void HavingClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_12: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1160,6 +1124,7 @@ final public void HavingClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1219,31 +1184,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[32] = jj_gen; break label_12; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void HavingCondition() throws ParseException {Expr c ; + final public void HavingCondition() throws ParseException { + Expr c ; c = Constraint(); -getQuery().addHavingCondition(c) ; -} + getQuery().addHavingCondition(c) ; + } final public void OrderClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_13: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1272,6 +1237,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1331,34 +1297,32 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[33] = jj_gen; break label_13; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; -direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void OrderCondition() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASC: - case DESC:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASC:{ + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: jj_consume_token(ASC); -direction = Query.ORDER_ASCENDING ; + direction = Query.ORDER_ASCENDING ; break; - } - case DESC:{ + case DESC: jj_consume_token(DESC); -direction = Query.ORDER_DESCENDING ; + direction = Query.ORDER_DESCENDING ; break; - } default: jj_la1[34] = jj_gen; jj_consume_token(-1); @@ -1366,7 +1330,6 @@ final public void OrderClause() throws ParseException { } expr = BrackettedExpression(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -1393,6 +1356,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1452,8 +1416,8 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1478,6 +1442,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1537,546 +1502,743 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: expr = Constraint(); break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); break; - } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[36] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( v == null ) + if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; -} + } - final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ - LimitClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case OFFSET:{ - OffsetClause(); - break; - } - default: - jj_la1[37] = jj_gen; - ; - } - break; - } - case OFFSET:{ - OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ - LimitClause(); + final public SortCondition OrderConditionForAggregationFunction() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + jj_consume_token(ASC); + direction = Query.ORDER_ASCENDING ; break; - } - default: - jj_la1[38] = jj_gen; - ; - } - break; - } - default: - jj_la1[39] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void LimitClause() throws ParseException {Token t ; - jj_consume_token(LIMIT); - t = jj_consume_token(INTEGER); -getQuery().setLimit(integerValue(t.image)) ; -} - - final public void OffsetClause() throws ParseException {Token t ; - jj_consume_token(OFFSET); - t = jj_consume_token(INTEGER); -getQuery().setOffset(integerValue(t.image)) ; -} - - final public void ValuesClause() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VALUES:{ - t = jj_consume_token(VALUES); -startValuesClause(t.beginLine, t.beginColumn) ; - DataBlock(); -finishValuesClause(t.beginLine, t.beginColumn) ; - break; - } - default: - jj_la1[40] = jj_gen; - ; - } -} - - final public void Update() throws ParseException { - Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT: - case DELETE: - case INSERT_DATA: - case DELETE_DATA: - case DELETE_WHERE: - case LOAD: - case CLEAR: - case CREATE: - case ADD: - case MOVE: - case COPY: - case DROP: - case WITH:{ - Update1(); - label_14: - while (true) { - if (jj_2_2(2147483647)) { - ; - } else { - break label_14; - } - jj_consume_token(SEMICOLON); - Prologue(); - Update1(); - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - jj_consume_token(SEMICOLON); - Prologue(); + case DESC: + jj_consume_token(DESC); + direction = Query.ORDER_DESCENDING ; break; - } default: - jj_la1[41] = jj_gen; - ; - } - break; - } - default: - jj_la1[42] = jj_gen; - ; - } -} - - final public void Update1() throws ParseException {Update up = null ; -startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LOAD:{ - up = Load(); - break; - } - case CLEAR:{ - up = Clear(); - break; - } - case DROP:{ - up = Drop(); - break; - } - case ADD:{ - up = Add(); - break; - } - case MOVE:{ - up = Move(); - break; - } - case COPY:{ - up = Copy(); - break; - } - case CREATE:{ - up = Create(); - break; - } - case DELETE_WHERE:{ - up = DeleteWhere(); - break; - } - case INSERT: - case DELETE: - case WITH:{ - up = Modify(); - break; - } - case INSERT_DATA:{ - InsertData(); - break; - } - case DELETE_DATA:{ - DeleteData(); - break; - } - default: - jj_la1[43] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -if (null != up) emitUpdate(up) ; - finishUpdateOperation() ; -} - - final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; - jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ - jj_consume_token(SILENT); -silent = true ; - break; + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - default: - jj_la1[44] = jj_gen; - ; - } - url = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTO:{ - jj_consume_token(INTO); - dest = GraphRef(); + expr = BrackettedExpression(); break; + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + expr = Constraint(); + break; + case VAR1: + case VAR2: + v = Var(); + break; + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if ( v == null ) + {if (true) return new SortCondition(expr, direction) ;} + else + {if (true) return new SortCondition(v, direction) ;} + throw new Error("Missing return statement in function"); + } + + final public void LimitOffsetClauses() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: + LimitClause(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OFFSET: + OffsetClause(); + break; + default: + jj_la1[40] = jj_gen; + ; } + break; + case OFFSET: + OffsetClause(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: + LimitClause(); + break; + default: + jj_la1[41] = jj_gen; + ; + } + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void LimitClause() throws ParseException { + Token t ; + jj_consume_token(LIMIT); + t = jj_consume_token(INTEGER); + getQuery().setLimit(integerValue(t.image)) ; + } + + final public void OffsetClause() throws ParseException { + Token t ; + jj_consume_token(OFFSET); + t = jj_consume_token(INTEGER); + getQuery().setOffset(integerValue(t.image)) ; + } + + final public void ValuesClause() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VALUES: + t = jj_consume_token(VALUES); + startValuesClause(t.beginLine, t.beginColumn) ; + DataBlock(); + finishValuesClause(t.beginLine, t.beginColumn) ; + break; + default: + jj_la1[43] = jj_gen; + ; + } + } + + final public void Update() throws ParseException { + Prologue(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: + case DELETE: + case INSERT_DATA: + case DELETE_DATA: + case DELETE_WHERE: + case LOAD: + case CLEAR: + case CREATE: + case ADD: + case MOVE: + case COPY: + case DROP: + case WITH: + Update1(); + label_14: + while (true) { + if (jj_2_2(2147483647)) { + ; + } else { + break label_14; + } + jj_consume_token(SEMICOLON); + Prologue(); + Update1(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + Prologue(); + break; + default: + jj_la1[44] = jj_gen; + ; + } + break; default: jj_la1[45] = jj_gen; ; } -{if ("" != null) return new UpdateLoad(url, dest, silent) ;} + } + + final public void Update1() throws ParseException { + Update up = null ; + startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOAD: + up = Load(); + break; + case CLEAR: + up = Clear(); + break; + case DROP: + up = Drop(); + break; + case ADD: + up = Add(); + break; + case MOVE: + up = Move(); + break; + case COPY: + up = Copy(); + break; + case CREATE: + up = Create(); + break; + case DELETE_WHERE: + up = DeleteWhere(); + break; + case INSERT: + case DELETE: + case WITH: + up = Modify(); + break; + case INSERT_DATA: + InsertData(); + break; + case DELETE_DATA: + DeleteData(); + break; + default: + jj_la1[46] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (null != up) emitUpdate(up) ; + finishUpdateOperation() ; + } + + final public Update Load() throws ParseException { + String url ; Node dest = null ; boolean silent = false ; + jj_consume_token(LOAD); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: + jj_consume_token(SILENT); + silent = true ; + break; + default: + jj_la1[47] = jj_gen; + ; + } + url = iri(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTO: + jj_consume_token(INTO); + dest = GraphRef(); + break; + default: + jj_la1[48] = jj_gen; + ; + } + {if (true) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Clear() throws ParseException {boolean silent = false ; Target target ; + final public Update Clear() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: - jj_la1[46] = jj_gen; + jj_la1[49] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateClear(target, silent) ;} + {if (true) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Drop() throws ParseException {boolean silent = false ; Target target ; + final public Update Drop() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: - jj_la1[47] = jj_gen; + jj_la1[50] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateDrop(target, silent) ;} + {if (true) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Create() throws ParseException {Node iri ; boolean silent = false ; + final public Update Create() throws ParseException { + Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[48] = jj_gen; + jj_la1[51] = jj_gen; ; } iri = GraphRef(); -{if ("" != null) return new UpdateCreate(iri, silent) ;} + {if (true) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[49] = jj_gen; + jj_la1[52] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateAdd(src, dest, silent) ;} + {if (true) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[50] = jj_gen; + jj_la1[53] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateMove(src, dest, silent) ;} + {if (true) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[51] = jj_gen; + jj_la1[54] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateCopy(src, dest, silent) ;} + {if (true) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException { + QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataInsert(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataInsert(qd, beginLine, beginColumn) ; + finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException { + QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataDelete(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataDelete(qd, beginLine, beginColumn) ; + finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException { + QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -{if ("" != null) return new UpdateDeleteWhere(qp) ;} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + {if (true) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Modify() throws ParseException {Element el ; String iri = null ; + final public Update Modify() throws ParseException { + Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; -startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WITH:{ + startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WITH: jj_consume_token(WITH); iri = iri(); -Node n = createNode(iri) ; up.setWithIRI(n) ; + Node n = createNode(iri) ; up.setWithIRI(n) ; break; - } default: - jj_la1[52] = jj_gen; + jj_la1[55] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELETE: DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: InsertClause(up); break; - } default: - jj_la1[53] = jj_gen; + jj_la1[56] = jj_gen; ; } break; - } - case INSERT:{ + case INSERT: InsertClause(up); break; - } default: - jj_la1[54] = jj_gen; + jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case USING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case USING: ; break; - } default: - jj_la1[55] = jj_gen; + jj_la1[58] = jj_gen; break label_15; } UsingClause(up); } jj_consume_token(WHERE); -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -up.setElement(el) ; -finishWherePattern() ; -finishModifyUpdate() ; -{if ("" != null) return up ;} + up.setElement(el) ; + finishWherePattern() ; + finishModifyUpdate() ; + {if (true) return up ;} throw new Error("Missing return statement in function"); -} + } - final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -up.setHasDeleteClause(true) ; -} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + up.setHasDeleteClause(true) ; + } - final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startInsertTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishInsertTemplate(qp, beginLine, beginColumn) ; -up.setHasInsertClause(true) ; -} + finishInsertTemplate(qp, beginLine, beginColumn) ; + up.setHasInsertClause(true) ; + } - final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException { + String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; update.addUsing(n) ; + n = createNode(iri) ; update.addUsing(n) ; break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); iri = iri(); -n = createNode(iri) ; update.addUsingNamed(n) ; + n = createNode(iri) ; update.addUsingNamed(n) ; break; - } default: - jj_la1[56] = jj_gen; + jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public Target GraphOrDefault() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DFT:{ + final public Target GraphOrDefault() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + case GRAPH: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); break; - } default: - jj_la1[57] = jj_gen; + jj_la1[60] = jj_gen; ; } iri = iri(); -{if ("" != null) return Target.create(createNode(iri)) ;} + {if (true) return Target.create(createNode(iri)) ;} break; - } default: - jj_la1[58] = jj_gen; + jj_la1[61] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphRef() throws ParseException {String iri ; + final public Node GraphRef() throws ParseException { + String iri ; jj_consume_token(GRAPH); iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} throw new Error("Missing return statement in function"); -} + } - final public Target GraphRefAll() throws ParseException {Node iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + final public Target GraphRefAll() throws ParseException { + Node iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: iri = GraphRef(); -{if ("" != null) return Target.create(iri) ;} + {if (true) return Target.create(iri) ;} break; - } - case DFT:{ + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); -{if ("" != null) return Target.NAMED ;} + {if (true) return Target.NAMED ;} break; - } - case ALL:{ + case ALL: jj_consume_token(ALL); -{if ("" != null) return Target.ALL ;} + {if (true) return Target.ALL ;} break; - } default: - jj_la1[59] = jj_gen; + jj_la1[62] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2102,36 +2264,33 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[60] = jj_gen; + jj_la1[63] = jj_gen; ; } label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: ; break; - } default: - jj_la1[61] = jj_gen; + jj_la1[64] = jj_gen; break label_16; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[62] = jj_gen; + jj_la1[65] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2157,23 +2316,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[63] = jj_gen; + jj_la1[66] = jj_gen; ; } } -} + } - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2199,20 +2358,19 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[64] = jj_gen; + jj_la1[67] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void ConstructQuads(QuadAcc acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2238,37 +2396,34 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[65] = jj_gen; + jj_la1[68] = jj_gen; ; } label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GRAPH: - case LBRACE:{ + case LBRACE: ; break; - } default: - jj_la1[66] = jj_gen; + jj_la1[69] = jj_gen; break label_17; } ConstructQuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[67] = jj_gen; + jj_la1[70] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2294,32 +2449,31 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[68] = jj_gen; + jj_la1[71] = jj_gen; ; } } -} + } - final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn = Quad.defaultGraphNodeGenerated ; + final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn = Quad.defaultGraphNodeGenerated ; Node prev = acc.getGraph() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); break; - } default: - jj_la1[69] = jj_gen; + jj_la1[72] = jj_gen; ; } -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2345,17 +2499,16 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[70] = jj_gen; + jj_la1[73] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -2369,41 +2522,41 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[71] = jj_gen; + jj_la1[74] = jj_gen; ; } -} + } - final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException { + Element el = null ; Token t ; t = jj_consume_token(LBRACE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ -startSubSelect(beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: + startSubSelect(beginLine, beginColumn) ; SubSelect(); -Query q = endSubSelect(beginLine, beginColumn) ; + Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; - } default: - jj_la1[72] = jj_gen; + jj_la1[75] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; -ElementGroup elg = new ElementGroup() ; -startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException { + Element el = null ; + ElementGroup elg = new ElementGroup() ; + startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2429,20 +2582,19 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: - jj_la1[73] = jj_gen; + jj_la1[76] = jj_gen; ; } label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -2451,29 +2603,28 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case SERVICE: case LET: case LATERAL: + case UNFOLD: case EXISTS: case NOT: case FILTER: - case LBRACE:{ + case LBRACE: ; break; - } default: - jj_la1[74] = jj_gen; + jj_la1[77] = jj_gen; break label_19; } el = GraphPatternNotTriples(); -elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[75] = jj_gen; + jj_la1[78] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2499,31 +2650,30 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: - jj_la1[76] = jj_gen; + jj_la1[79] = jj_gen; ; } } -endGroup(elg) ; -{if ("" != null) return elg ;} + endGroup(elg) ; + {if (true) return elg ;} throw new Error("Missing return statement in function"); -} + } final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { -if ( acc == null ) + if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2549,172 +2699,166 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesBlock(acc); break; - } default: - jj_la1[77] = jj_gen; + jj_la1[80] = jj_gen; ; } break; - } default: - jj_la1[78] = jj_gen; + jj_la1[81] = jj_gen; ; } -{if ("" != null) return acc ;} + {if (true) return acc ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + final public Element GraphPatternNotTriples() throws ParseException { + Element el = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: el = GroupOrUnionGraphPattern(); break; - } - case OPTIONAL:{ + case OPTIONAL: el = OptionalGraphPattern(); break; - } - case LATERAL:{ + case LATERAL: el = LateralGraphPattern(); break; - } - case MINUS_P:{ + case MINUS_P: el = MinusGraphPattern(); break; - } - case GRAPH:{ + case GRAPH: el = GraphGraphPattern(); break; - } - case SERVICE:{ + case SERVICE: el = ServiceGraphPattern(); break; - } - case FILTER:{ + case FILTER: el = Filter(); break; - } - case BIND:{ + case BIND: el = Bind(); break; - } - case VALUES:{ + case VALUES: el = InlineData(); break; - } - case LET:{ + case LET: el = Assignment(); break; - } - case EXISTS:{ + case EXISTS: el = ExistsElt(); break; - } - case NOT:{ + case NOT: el = NotExistsElt(); break; - } + case UNFOLD: + el = Unfold(); + break; default: - jj_la1[79] = jj_gen; + jj_la1[82] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element OptionalGraphPattern() throws ParseException {Element el ; + final public Element OptionalGraphPattern() throws ParseException { + Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementOptional(el) ;} + {if (true) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element LateralGraphPattern() throws ParseException {Element el ; + final public Element LateralGraphPattern() throws ParseException { + Element el ; jj_consume_token(LATERAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementLateral(el) ;} + {if (true) return new ElementLateral(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException { + Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementNamedGraph(n, el) ;} + {if (true) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException { + Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true; + silent=true; break; - } default: - jj_la1[80] = jj_gen; + jj_la1[83] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementService(n, el, silent) ;} + {if (true) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Element Bind() throws ParseException {Var v ; Expr expr ; + final public Element Bind() throws ParseException { + Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementBind(v, expr) ;} + {if (true) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element InlineData() throws ParseException {ElementData el ; Token t ; + final public Element InlineData() throws ParseException { + ElementData el ; Token t ; t = jj_consume_token(VALUES); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -el = new ElementData() ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); -finishInlineData(beginLine, beginColumn) ; - {if ("" != null) return el ;} + finishInlineData(beginLine, beginColumn) ; + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: InlineDataOneVar(); break; - } case LPAREN: - case NIL:{ + case NIL: InlineDataFull(); break; - } default: - jj_la1[81] = jj_gen; + jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException { + Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2734,74 +2878,70 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[82] = jj_gen; + jj_la1[85] = jj_gen; break label_20; } n = DataBlockValue(); -startDataBlockValueRow(beginLine, beginColumn) ; + startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); -} + } - final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public void InlineDataFull() throws ParseException { + Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: - jj_la1[83] = jj_gen; + jj_la1[86] = jj_gen; break label_21; } v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[84] = jj_gen; + jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(LBRACE); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: ; break; - } default: - jj_la1[85] = jj_gen; + jj_la1[88] = jj_gen; break label_22; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: t = jj_consume_token(LPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2821,55 +2961,51 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[86] = jj_gen; + jj_la1[89] = jj_gen; break label_23; } n = DataBlockValue(); -emitDataBlockValue(n, beginLine, beginColumn) ; + emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } - case NIL:{ + case NIL: t = jj_consume_token(NIL); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } default: - jj_la1[87] = jj_gen; + jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); -} + } - final public Node DataBlockValue() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataBlockValue() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -2878,107 +3014,130 @@ final public void DataBlock() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case UNDEF:{ + case UNDEF: jj_consume_token(UNDEF); -{if ("" != null) return null ;} + {if (true) return null ;} break; - } - case LT2:{ + case LT2: n = QuotedTripleData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[88] = jj_gen; + jj_la1[91] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Element Assignment() throws ParseException {Var v ; Expr expr ; + final public Element Assignment() throws ParseException { + Var v ; Expr expr ; jj_consume_token(LET); jj_consume_token(LPAREN); v = Var(); jj_consume_token(ASSIGN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementAssign(v, expr) ;} + {if (true) return new ElementAssign(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ExistsElt() throws ParseException {Element el ; + final public Element ExistsElt() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementExists(el) ;} + {if (true) return new ElementExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element NotExistsElt() throws ParseException {Element el ; + final public Element NotExistsElt() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementNotExists(el) ;} + {if (true) return new ElementNotExists(el) ;} + throw new Error("Missing return statement in function"); + } + + final public Element Unfold() throws ParseException { + Var v1 ; Var v2 = null ; Expr expr ; + jj_consume_token(UNFOLD); + jj_consume_token(LPAREN); + expr = Expression(); + jj_consume_token(AS); + v1 = Var(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + v2 = Var(); + ; + break; + default: + jj_la1[92] = jj_gen; + ; + } + jj_consume_token(RPAREN); + {if (true) return new ElementUnfold(expr, v1, v2) ;} throw new Error("Missing return statement in function"); -} + } - final public Element MinusGraphPattern() throws ParseException {Element el ; + final public Element MinusGraphPattern() throws ParseException { + Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); -{if ("" != null) return new ElementMinus(el) ;} + {if (true) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException { + Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case UNION:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNION: ; break; - } default: - jj_la1[89] = jj_gen; + jj_la1[93] = jj_gen; break label_24; } jj_consume_token(UNION); -if ( el2 == null ) + if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); -el2.addElement(el) ; + el2.addElement(el) ; } -{if ("" != null) return (el2==null)? el : el2 ;} + {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); -} + } - final public Element Filter() throws ParseException {Expr c ; + final public Element Filter() throws ParseException { + Expr c ; jj_consume_token(FILTER); c = Constraint(); -{if ("" != null) return new ElementFilter(c) ;} + {if (true) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Constraint() throws ParseException {Expr c ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr Constraint() throws ParseException { + Expr c ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: c = BrackettedExpression(); break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -3000,6 +3159,7 @@ final public void DataBlock() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -3058,137 +3218,132 @@ final public void DataBlock() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: c = BuiltInCall(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: c = FunctionCall(); break; - } default: - jj_la1[90] = jj_gen; + jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return c ;} + {if (true) return c ;} throw new Error("Missing return statement in function"); -} + } - final public Expr FunctionCall() throws ParseException {String fname ; Args a ; + final public Expr FunctionCall() throws ParseException { + String fname ; Args a ; fname = iri(); a = ArgList(); -if ( AggregateRegistry.isRegistered(fname) ) { + if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(fname, a) ;} + {if (true) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public Args ArgList() throws ParseException { + Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -args.distinct = true ; -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -if ( ! getAllowAggregatesInExpressions() ) + args.distinct = true ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; - } default: - jj_la1[91] = jj_gen; + jj_la1[95] = jj_gen; ; } expr = Expression(); -args.add(expr) ; + args.add(expr) ; label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[92] = jj_gen; + jj_la1[96] = jj_gen; break label_25; } jj_consume_token(COMMA); expr = Expression(); -args.add(expr) ; + args.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[93] = jj_gen; + jj_la1[97] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return args ;} + {if (true) return args ;} throw new Error("Missing return statement in function"); -} + } - final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public ExprList ExpressionList() throws ParseException { + Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[94] = jj_gen; + jj_la1[98] = jj_gen; break label_26; } jj_consume_token(COMMA); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[95] = jj_gen; + jj_la1[99] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return exprList ;} + {if (true) return exprList ;} throw new Error("Missing return statement in function"); -} + } - final public Template ConstructTemplate() throws ParseException {QuadAcc acc = new QuadAcc() ; + final public Template ConstructTemplate() throws ParseException { + QuadAcc acc = new QuadAcc() ; Template t = new Template (acc); -setInConstructTemplate(true) ; + setInConstructTemplate(true) ; jj_consume_token(LBRACE); ConstructQuads(acc); jj_consume_token(RBRACE); -setInConstructTemplate(false) ; - {if ("" != null) return t ;} + setInConstructTemplate(false) ; + {if (true) return t ;} throw new Error("Missing return statement in function"); -} + } final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -3202,19 +3357,19 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[96] = jj_gen; + jj_la1[100] = jj_gen; ; } -} + } - final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3238,127 +3393,124 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[97] = jj_gen; + jj_la1[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: PropertyListNotEmpty(s, acc); break; - } default: - jj_la1[98] = jj_gen; + jj_la1[102] = jj_gen; ; } -} + } - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { + Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[99] = jj_gen; + jj_la1[103] = jj_gen; break label_28; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: p = Verb(); ObjectList(s, p, null, acc); break; - } default: - jj_la1[100] = jj_gen; + jj_la1[104] = jj_gen; ; } } -} + } - final public Node Verb() throws ParseException {Node p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node Verb() throws ParseException { + Node p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: p = VarOrIri(); break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[101] = jj_gen; + jj_la1[105] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; Object(s, p, path, acc); label_29: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[102] = jj_gen; + jj_la1[106] = jj_gen; break label_29; } jj_consume_token(COMMA); Object(s, p, path, acc); } -} + } - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; Annotation(acc, s, p, path, o); -} + } - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3382,28 +3534,26 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[103] = jj_gen; + jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3415,18 +3565,18 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: PropertyListPathNotEmpty(s, acc); break; - } default: - jj_la1[104] = jj_gen; + jj_la1[108] = jj_gen; ; } -} + } - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { + Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3436,35 +3586,32 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[105] = jj_gen; + jj_la1[109] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); label_30: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[106] = jj_gen; + jj_la1[110] = jj_gen; break label_30; } jj_consume_token(SEMICOLON); -path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3476,8 +3623,8 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CARAT: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3487,159 +3634,160 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[107] = jj_gen; + jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); break; - } default: - jj_la1[108] = jj_gen; + jj_la1[112] = jj_gen; ; } } -} + } - final public Path VerbPath() throws ParseException {Node p ; Path path ; + final public Path VerbPath() throws ParseException { + Node p ; Path path ; path = Path(); -{if ("" != null) return path ;} + {if (true) return path ;} throw new Error("Missing return statement in function"); -} + } - final public Node VerbSimple() throws ParseException {Node p ; + final public Node VerbSimple() throws ParseException { + Node p ; p = Var(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; ObjectPath(s, p, path, acc); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[109] = jj_gen; + jj_la1[113] = jj_gen; break label_31; } jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } -} + } - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; AnnotationPath(acc, s, p, path, o); -} + } - final public Path PathUnit() throws ParseException {Path p ; + final public Path PathUnit() throws ParseException { + Path p ; ByteOrderMark(); p = Path(); jj_consume_token(0); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path Path() throws ParseException {Path p ; + final public Path Path() throws ParseException { + Path p ; p = PathAlternative(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathAlternative() throws ParseException {Path p1 , p2 ; + final public Path PathAlternative() throws ParseException { + Path p1 , p2 ; p1 = PathSequence(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[110] = jj_gen; + jj_la1[114] = jj_gen; break label_32; } jj_consume_token(VBAR); p2 = PathSequence(); -p1 = PathFactory.pathAlt(p1, p2) ; + p1 = PathFactory.pathAlt(p1, p2) ; } -{if ("" != null) return p1 ;} + {if (true) return p1 ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathSequence() throws ParseException {Path p1 , p2 ; + final public Path PathSequence() throws ParseException { + Path p1 , p2 ; p1 = PathEltOrInverse(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SLASH: - case CARAT:{ + case CARAT: ; break; - } default: - jj_la1[111] = jj_gen; + jj_la1[115] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SLASH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SLASH: jj_consume_token(SLASH); p2 = PathEltOrInverse(); -p1 = PathFactory.pathSeq(p1, p2) ; + p1 = PathFactory.pathSeq(p1, p2) ; break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p2 = PathElt(); -p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; + p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; break; - } default: - jj_la1[112] = jj_gen; + jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return p1;} + {if (true) return p1;} throw new Error("Missing return statement in function"); -} + } - final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException { + String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: case PLUS: case STAR: - case QMARK:{ + case QMARK: p = PathMod(p); break; - } default: - jj_la1[113] = jj_gen; + jj_la1[117] = jj_gen; ; } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException { + String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3648,351 +3796,327 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case MULTI: case SHORTEST: case LPAREN: - case BANG:{ + case BANG: p = PathElt(); break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p = PathElt(); -p = PathFactory.pathInverse(p) ; + p = PathFactory.pathInverse(p) ; break; - } default: - jj_la1[114] = jj_gen; + jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case QMARK:{ + final public Path PathMod(Path p) throws ParseException { + long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QMARK: jj_consume_token(QMARK); -{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} + {if (true) return PathFactory.pathZeroOrOne(p) ;} break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} + {if (true) return PathFactory.pathZeroOrMore1(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); -{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} + {if (true) return PathFactory.pathOneOrMore1(p) ;} break; - } - case LBRACE:{ + case LBRACE: jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathZeroOrMoreN(p) ;} + {if (true) return PathFactory.pathZeroOrMoreN(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathOneOrMoreN(p) ;} + {if (true) return PathFactory.pathOneOrMoreN(p) ;} break; - } - case INTEGER:{ + case INTEGER: i1 = Integer(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case RBRACE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} + {if (true) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} break; - } - case INTEGER:{ + case INTEGER: i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, i2) ;} + {if (true) return PathFactory.pathMod(p, i1, i2) ;} break; - } default: - jj_la1[115] = jj_gen; + jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RBRACE:{ + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathFixedLength(p, i1) ;} + {if (true) return PathFactory.pathFixedLength(p, i1) ;} break; - } default: - jj_la1[116] = jj_gen; + jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case COMMA:{ + case COMMA: jj_consume_token(COMMA); i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} + {if (true) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} break; - } default: - jj_la1[117] = jj_gen; + jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[118] = jj_gen; + jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathPrimary() throws ParseException { + String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; p = PathFactory.pathLink(n) ; + n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = PathFactory.pathLink(nRDFtype) ; + p = PathFactory.pathLink(nRDFtype) ; break; - } - case BANG:{ + case BANG: jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; - } - case DISTINCT:{ + case DISTINCT: jj_consume_token(DISTINCT); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathDistinct(p) ; + p = PathFactory.pathDistinct(p) ; jj_consume_token(RPAREN); break; - } - case SHORTEST:{ + case SHORTEST: jj_consume_token(SHORTEST); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathShortest(p) ; + p = PathFactory.pathShortest(p) ; jj_consume_token(RPAREN); break; - } - case MULTI:{ + case MULTI: jj_consume_token(MULTI); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathMulti(p) ; + p = PathFactory.pathMulti(p) ; jj_consume_token(RPAREN); break; - } default: - jj_la1[119] = jj_gen; + jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; -pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException { + P_Path0 p ; P_NegPropSet pNegSet ; + pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[120] = jj_gen; + jj_la1[124] = jj_gen; break label_34; } jj_consume_token(VBAR); p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; } break; - } default: - jj_la1[121] = jj_gen; + jj_la1[125] = jj_gen; ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[122] = jj_gen; + jj_la1[126] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return pNegSet ;} + {if (true) return pNegSet ;} throw new Error("Missing return statement in function"); -} + } - final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException { + String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} + n = createNode(str) ; {if (true) return new P_Link(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_Link(nRDFtype) ;} + {if (true) return new P_Link(nRDFtype) ;} break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} + n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_ReverseLink(nRDFtype) ;} + {if (true) return new P_ReverseLink(nRDFtype) ;} break; - } default: - jj_la1[123] = jj_gen; + jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[124] = jj_gen; + jj_la1[128] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public long Integer() throws ParseException {Token t ; + final public long Integer() throws ParseException { + Token t ; t = jj_consume_token(INTEGER); -{if ("" != null) return integerValue(t.image) ;} + {if (true) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = Collection(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyList(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[125] = jj_gen; + jj_la1[129] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = CollectionPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyListPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[126] = jj_gen; + jj_la1[130] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_35: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4018,37 +4142,37 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[127] = jj_gen; + jj_la1[131] = jj_gen; break label_35; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_36: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4074,56 +4198,54 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[128] = jj_gen; + jj_la1[132] = jj_gen; break label_36; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } final public void AnnotationPath(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createQuotedTriple(s, pAnn, o, token.beginLine, token.beginColumn); PropertyListPathNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[129] = jj_gen; + jj_la1[133] = jj_gen; ; } -} + } final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createQuotedTriple(s, p, o, token.beginLine, token.beginColumn); PropertyListNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[130] = jj_gen; + jj_la1[134] = jj_gen; ; } -} + } - final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4147,27 +4269,26 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNode(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[131] = jj_gen; + jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4191,47 +4312,43 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNodePath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[132] = jj_gen; + jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrTerm() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrTerm() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4240,97 +4357,91 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return nRDFnil ;} + {if (true) return nRDFnil ;} break; - } - case LT2:{ + case LT2: n = QuotedTriple(); break; - } default: - jj_la1[133] = jj_gen; + jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node QuotedTriple() throws ParseException {Node n = null ; Token t ; Node s , p , o ; + final public Node QuotedTriple() throws ParseException { + Node n = null ; Token t ; Node s , p , o ; t = jj_consume_token(LT2); s = VarOrTerm(); p = Verb(); o = VarOrTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node QuotedTripleData() throws ParseException {Node n = null ; Token t ; String iri ; Node s , p , o ; + final public Node QuotedTripleData() throws ParseException { + Node n = null ; Token t ; String iri ; Node s , p , o ; t = jj_consume_token(LT2); s = DataValueTerm(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -p = createNode(iri) ; + p = createNode(iri) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[134] = jj_gen; + jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } o = DataValueTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node DataValueTerm() throws ParseException {Node n = null ; String iri ; Node s , p , o ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataValueTerm() throws ParseException { + Node n = null ; String iri ; Node s , p , o ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4339,157 +4450,153 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LT2:{ + case LT2: n = QuotedTripleData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[135] = jj_gen; + jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[136] = jj_gen; + jj_la1[140] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[137] = jj_gen; + jj_la1[141] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Var Var() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR1:{ + final public Var Var() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VAR1: t = jj_consume_token(VAR1); break; - } - case VAR2:{ + case VAR2: t = jj_consume_token(VAR2); break; - } default: - jj_la1[138] = jj_gen; + jj_la1[142] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Expression() throws ParseException {Expr expr ; + final public Expr Expression() throws ParseException { + Expr expr ; expr = ConditionalOrExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_37: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: ; break; - } default: - jj_la1[139] = jj_gen; + jj_la1[143] = jj_gen; break label_37; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); -expr1 = new E_LogicalOr(expr1, expr2) ; + expr1 = new E_LogicalOr(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ValueLogical(); label_38: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: ; break; - } default: - jj_la1[140] = jj_gen; + jj_la1[144] = jj_gen; break label_38; } jj_consume_token(SC_AND); expr2 = ValueLogical(); -expr1 = new E_LogicalAnd(expr1, expr2) ; + expr1 = new E_LogicalAnd(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ValueLogical() throws ParseException {Expr expr ; + final public Expr ValueLogical() throws ParseException { + Expr expr ; expr = RelationalExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException { + Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case IN: case EQ: @@ -4497,83 +4604,76 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case GT: case LT: case LE: - case GE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ + case GE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: jj_consume_token(EQ); expr2 = NumericExpression(); -expr1 = new E_Equals(expr1, expr2) ; + expr1 = new E_Equals(expr1, expr2) ; break; - } - case NE:{ + case NE: jj_consume_token(NE); expr2 = NumericExpression(); -expr1 = new E_NotEquals(expr1, expr2) ; + expr1 = new E_NotEquals(expr1, expr2) ; break; - } - case LT:{ + case LT: jj_consume_token(LT); expr2 = NumericExpression(); -expr1 = new E_LessThan(expr1, expr2) ; + expr1 = new E_LessThan(expr1, expr2) ; break; - } - case GT:{ + case GT: jj_consume_token(GT); expr2 = NumericExpression(); -expr1 = new E_GreaterThan(expr1, expr2) ; + expr1 = new E_GreaterThan(expr1, expr2) ; break; - } - case LE:{ + case LE: jj_consume_token(LE); expr2 = NumericExpression(); -expr1 = new E_LessThanOrEqual(expr1, expr2) ; + expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - } - case GE:{ + case GE: jj_consume_token(GE); expr2 = NumericExpression(); -expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; + expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - } - case IN:{ + case IN: jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_OneOf(expr1, a) ; + expr1 = new E_OneOf(expr1, a) ; break; - } - case NOT:{ + case NOT: jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_NotOneOf(expr1, a) ; + expr1 = new E_NotOneOf(expr1, a) ; break; - } default: - jj_la1[141] = jj_gen; + jj_la1[145] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[142] = jj_gen; + jj_la1[146] = jj_gen; ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NumericExpression() throws ParseException {Expr expr ; + final public Expr NumericExpression() throws ParseException { + Expr expr ; expr = AdditiveExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException { + Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_39: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -4581,175 +4681,160 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS:{ + case MINUS: ; break; - } default: - jj_la1[143] = jj_gen; + jj_la1[147] = jj_gen; break label_39; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Add(expr1, expr2) ; + expr1 = new E_Add(expr1, expr2) ; break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Subtract(expr1, expr2) ; + expr1 = new E_Subtract(expr1, expr2) ; break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOUBLE_NEGATIVE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; - } default: - jj_la1[144] = jj_gen; + jj_la1[148] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_40: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[145] = jj_gen; + jj_la1[149] = jj_gen; break label_40; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr3 = UnaryExpression(); -expr2 = new E_Multiply(expr2, expr3) ; + expr2 = new E_Multiply(expr2, expr3) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr3 = UnaryExpression(); -expr2 = new E_Divide(expr2, expr3) ; + expr2 = new E_Divide(expr2, expr3) ; break; - } default: - jj_la1[146] = jj_gen; + jj_la1[150] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -if ( addition ) + if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; - } default: - jj_la1[147] = jj_gen; + jj_la1[151] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = UnaryExpression(); label_41: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MOD: case IDIV: case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[148] = jj_gen; + jj_la1[152] = jj_gen; break label_41; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr2 = UnaryExpression(); -expr1 = new E_Multiply(expr1, expr2) ; + expr1 = new E_Multiply(expr1, expr2) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr2 = UnaryExpression(); -expr1 = new E_Divide(expr1, expr2) ; + expr1 = new E_Divide(expr1, expr2) ; break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); expr2 = UnaryExpression(); -expr1 = new E_OpNumericMod(expr1, expr2) ; + expr1 = new E_OpNumericMod(expr1, expr2) ; break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); expr2 = UnaryExpression(); -expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; + expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; - } default: - jj_la1[149] = jj_gen; + jj_la1[153] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr UnaryExpression() throws ParseException {Expr expr ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BANG:{ + final public Expr UnaryExpression() throws ParseException { + Expr expr ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: jj_consume_token(BANG); expr = PrimaryExpression(); -{if ("" != null) return new E_LogicalNot(expr) ;} + {if (true) return new E_LogicalNot(expr) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryPlus(expr) ;} + {if (true) return new E_UnaryPlus(expr) ;} break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryMinus(expr) ;} + {if (true) return new E_UnaryMinus(expr) ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4776,6 +4861,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4851,26 +4937,25 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case LPAREN: - case LT2:{ + case LT2: expr = PrimaryExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: - jj_la1[150] = jj_gen; + jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr PrimaryExpression() throws ParseException { + Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: expr = BrackettedExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -4892,6 +4977,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4950,26 +5036,23 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = iriOrFunction(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4978,52 +5061,47 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } - case LT2:{ + case LT2: n = ExprQuotedTriple(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } default: - jj_la1[151] = jj_gen; + jj_la1[155] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node ExprVarOrTerm() throws ParseException {Node n; String s; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node ExprVarOrTerm() throws ParseException { + Node n; String s; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: s = iri(); -n = createNode(s); + n = createNode(s); break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -5032,56 +5110,55 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } - case LT2:{ + case LT2: n = ExprQuotedTriple(); break; - } default: - jj_la1[152] = jj_gen; + jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node ExprQuotedTriple() throws ParseException {Token t ; Node s,p,o,n; + final public Node ExprQuotedTriple() throws ParseException { + Token t ; Node s,p,o,n; t = jj_consume_token(LT2); s = ExprVarOrTerm(); p = Verb(); o = ExprVarOrTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Expr BrackettedExpression() throws ParseException {Expr expr ; + final public Expr BrackettedExpression() throws ParseException { + Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr BuiltInCall() throws ParseException {Expr expr ; + final public Expr BuiltInCall() throws ParseException { + Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AGG: case COUNT: case MIN: @@ -5096,446 +5173,393 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: - case GROUP_CONCAT:{ + case GROUP_CONCAT: expr = Aggregate(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STR:{ + case STR: jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Str(expr) ;} + {if (true) return new E_Str(expr) ;} break; - } - case LANG:{ + case LANG: jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Lang(expr) ;} + {if (true) return new E_Lang(expr) ;} break; - } - case LANGMATCHES:{ + case LANGMATCHES: jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_LangMatches(expr1, expr2) ;} + {if (true) return new E_LangMatches(expr1, expr2) ;} break; - } - case DTYPE:{ + case DTYPE: jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Datatype(expr) ;} + {if (true) return new E_Datatype(expr) ;} break; - } - case BOUND:{ + case BOUND: jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} + {if (true) return new E_Bound(new ExprVar(gn)) ;} break; - } - case IRI:{ + case IRI: jj_consume_token(IRI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[153] = jj_gen; + jj_la1[157] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_IRI(expr1, expr2) ;} + {if (true) return makeFunction_IRI(expr1, expr2) ;} break; - } - case URI:{ + case URI: jj_consume_token(URI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[154] = jj_gen; + jj_la1[158] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_URI(expr1, expr2) ;} + {if (true) return makeFunction_URI(expr1, expr2) ;} break; - } - case BNODE:{ + case BNODE: jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_BNode(expr1) ;} + {if (true) return makeFunction_BNode(expr1) ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return makeFunction_BNode() ;} + {if (true) return makeFunction_BNode() ;} break; - } default: - jj_la1[155] = jj_gen; + jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RAND:{ + case RAND: jj_consume_token(RAND); jj_consume_token(NIL); -{if ("" != null) return new E_Random() ;} + {if (true) return new E_Random() ;} break; - } - case ABS:{ + case ABS: jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumAbs(expr1) ;} + {if (true) return new E_NumAbs(expr1) ;} break; - } - case CEIL:{ + case CEIL: jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumCeiling(expr1) ;} + {if (true) return new E_NumCeiling(expr1) ;} break; - } - case FLOOR:{ + case FLOOR: jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumFloor(expr1) ;} + {if (true) return new E_NumFloor(expr1) ;} break; - } - case ROUND:{ + case ROUND: jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumRound(expr1) ;} + {if (true) return new E_NumRound(expr1) ;} break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericMod(expr1, expr2);} + {if (true) return new E_OpNumericMod(expr1, expr2);} break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericIntegerDivide(expr1, expr2);} + {if (true) return new E_OpNumericIntegerDivide(expr1, expr2);} break; - } - case CONCAT:{ + case CONCAT: jj_consume_token(CONCAT); a = ExpressionList(); -{if ("" != null) return new E_StrConcat(a) ;} + {if (true) return new E_StrConcat(a) ;} break; - } - case SUBSTR:{ + case SUBSTR: expr = SubstringExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STRLEN:{ + case STRLEN: jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLength(expr1) ;} + {if (true) return new E_StrLength(expr1) ;} break; - } - case REPLACE:{ + case REPLACE: expr = StrReplaceExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case UCASE:{ + case UCASE: jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrUpperCase(expr1) ;} + {if (true) return new E_StrUpperCase(expr1) ;} break; - } - case LCASE:{ + case LCASE: jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLowerCase(expr1) ;} + {if (true) return new E_StrLowerCase(expr1) ;} break; - } - case ENCODE_FOR_URI:{ + case ENCODE_FOR_URI: jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEncodeForURI(expr1) ;} + {if (true) return new E_StrEncodeForURI(expr1) ;} break; - } - case CONTAINS:{ + case CONTAINS: jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrContains(expr1, expr2) ;} + {if (true) return new E_StrContains(expr1, expr2) ;} break; - } - case STRSTARTS:{ + case STRSTARTS: jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} + {if (true) return new E_StrStartsWith(expr1, expr2) ;} break; - } - case STRENDS:{ + case STRENDS: jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} + {if (true) return new E_StrEndsWith(expr1, expr2) ;} break; - } - case STRBEFORE:{ + case STRBEFORE: jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrBefore(expr1, expr2) ;} + {if (true) return new E_StrBefore(expr1, expr2) ;} break; - } - case STRAFTER:{ + case STRAFTER: jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrAfter(expr1, expr2) ;} + {if (true) return new E_StrAfter(expr1, expr2) ;} break; - } - case YEAR:{ + case YEAR: jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeYear(expr1) ;} + {if (true) return new E_DateTimeYear(expr1) ;} break; - } - case MONTH:{ + case MONTH: jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMonth(expr1) ;} + {if (true) return new E_DateTimeMonth(expr1) ;} break; - } - case DAY:{ + case DAY: jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeDay(expr1) ;} + {if (true) return new E_DateTimeDay(expr1) ;} break; - } - case HOURS:{ + case HOURS: jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeHours(expr1) ;} + {if (true) return new E_DateTimeHours(expr1) ;} break; - } - case MINUTES:{ + case MINUTES: jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMinutes(expr1) ;} + {if (true) return new E_DateTimeMinutes(expr1) ;} break; - } - case SECONDS:{ + case SECONDS: jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeSeconds(expr1) ;} + {if (true) return new E_DateTimeSeconds(expr1) ;} break; - } - case TIMEZONE:{ + case TIMEZONE: jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTimezone(expr1) ;} + {if (true) return new E_DateTimeTimezone(expr1) ;} break; - } - case TZ:{ + case TZ: jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTZ(expr1) ;} + {if (true) return new E_DateTimeTZ(expr1) ;} break; - } - case ADJUST:{ + case ADJUST: jj_consume_token(ADJUST); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[156] = jj_gen; + jj_la1[160] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_AdjustToTimezone(expr1, expr2) ;} + {if (true) return new E_AdjustToTimezone(expr1, expr2) ;} break; - } - case NOW:{ + case NOW: jj_consume_token(NOW); jj_consume_token(NIL); -{if ("" != null) return new E_Now() ;} + {if (true) return new E_Now() ;} break; - } - case UUID:{ + case UUID: jj_consume_token(UUID); jj_consume_token(NIL); -{if ("" != null) return new E_UUID() ;} + {if (true) return new E_UUID() ;} break; - } - case STRUUID:{ + case STRUUID: jj_consume_token(STRUUID); jj_consume_token(NIL); -{if ("" != null) return new E_StrUUID() ;} + {if (true) return new E_StrUUID() ;} break; - } - case MD5:{ + case MD5: jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_MD5(expr1) ;} + {if (true) return new E_MD5(expr1) ;} break; - } - case SHA1:{ + case SHA1: jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA1(expr1) ;} + {if (true) return new E_SHA1(expr1) ;} break; - } - case SHA256:{ + case SHA256: jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA256(expr1) ;} + {if (true) return new E_SHA256(expr1) ;} break; - } - case SHA384:{ + case SHA384: jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA384(expr1) ;} + {if (true) return new E_SHA384(expr1) ;} break; - } - case SHA512:{ + case SHA512: jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA512(expr1) ;} + {if (true) return new E_SHA512(expr1) ;} break; - } - case VERSION:{ + case VERSION: jj_consume_token(VERSION); jj_consume_token(NIL); -{if ("" != null) return new E_Version();} + {if (true) return new E_Version();} break; - } - case COALESCE:{ + case COALESCE: jj_consume_token(COALESCE); a = ExpressionList(); -{if ("" != null) return new E_Coalesce(a) ;} + {if (true) return new E_Coalesce(a) ;} break; - } - case CALL:{ + case CALL: jj_consume_token(CALL); -a = new ExprList() ; + a = new ExprList() ; jj_consume_token(LPAREN); expr = Expression(); -a.add(expr) ; + a.add(expr) ; label_42: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[157] = jj_gen; + jj_la1[161] = jj_gen; break label_42; } jj_consume_token(COMMA); expr = Expression(); -a.add(expr) ; + a.add(expr) ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Call(a) ;} + {if (true) return new E_Call(a) ;} break; - } - case IF:{ + case IF: jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -5544,103 +5568,90 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} + {if (true) return new E_Conditional(expr, expr1, expr2) ;} break; - } - case STRLANG:{ + case STRLANG: jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLang(expr1, expr2) ;} + {if (true) return new E_StrLang(expr1, expr2) ;} break; - } - case STRDT:{ + case STRDT: jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} + {if (true) return new E_StrDatatype(expr1, expr2) ;} break; - } - case SAME_TERM:{ + case SAME_TERM: jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SameTerm(expr1, expr2) ;} + {if (true) return new E_SameTerm(expr1, expr2) ;} break; - } - case IS_IRI:{ + case IS_IRI: jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsIRI(expr) ;} + {if (true) return new E_IsIRI(expr) ;} break; - } - case IS_URI:{ + case IS_URI: jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsURI(expr) ;} + {if (true) return new E_IsURI(expr) ;} break; - } - case IS_BLANK:{ + case IS_BLANK: jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsBlank(expr) ;} + {if (true) return new E_IsBlank(expr) ;} break; - } - case IS_LITERAL:{ + case IS_LITERAL: jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsLiteral(expr) ;} + {if (true) return new E_IsLiteral(expr) ;} break; - } - case IS_NUMERIC:{ + case IS_NUMERIC: jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsNumeric(expr) ;} + {if (true) return new E_IsNumeric(expr) ;} break; - } - case REGEX:{ + case REGEX: expr = RegexExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case EXISTS:{ + case EXISTS: expr = ExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case NOT:{ + case NOT: expr = NotExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case IS_TRIPLE:{ + case IS_TRIPLE: jj_consume_token(IS_TRIPLE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsTriple(expr) ;} + {if (true) return new E_IsTriple(expr) ;} break; - } - case TRIPLE:{ + case TRIPLE: jj_consume_token(TRIPLE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5649,84 +5660,81 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr3 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleFn(expr1, expr2, expr3) ;} + {if (true) return new E_TripleFn(expr1, expr2, expr3) ;} break; - } - case SUBJECT:{ + case SUBJECT: jj_consume_token(SUBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleSubject(expr) ;} + {if (true) return new E_TripleSubject(expr) ;} break; - } - case PREDICATE:{ + case PREDICATE: jj_consume_token(PREDICATE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TriplePredicate(expr) ;} + {if (true) return new E_TriplePredicate(expr) ;} break; - } - case OBJECT:{ + case OBJECT: jj_consume_token(OBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleObject(expr) ;} + {if (true) return new E_TripleObject(expr) ;} break; - } default: - jj_la1[158] = jj_gen; + jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException { + Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); flagsExpr = Expression(); break; - } default: - jj_la1[159] = jj_gen; + jj_la1[163] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} + {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr3 = Expression(); break; - } default: - jj_la1[160] = jj_gen; + jj_la1[164] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} + {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5734,61 +5742,61 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr4 = Expression(); break; - } default: - jj_la1[161] = jj_gen; + jj_la1[165] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} + {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ExistsFunc() throws ParseException {Element el ; + final public Expr ExistsFunc() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprExists(el) ;} + {if (true) return createExprExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NotExistsFunc() throws ParseException {Element el ; + final public Expr NotExistsFunc() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprNotExists(el) ;} + {if (true) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException { + Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; -startAggregate(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COUNT:{ + startAggregate(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[162] = jj_gen; + jj_la1[166] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -5815,6 +5823,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -5893,752 +5902,798 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case LT2: case BANG: case PLUS: - case MINUS:{ + case MINUS: expr = Expression(); break; - } default: - jj_la1[163] = jj_gen; + jj_la1[167] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); -if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } + if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - } - case SUM:{ + case SUM: t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[164] = jj_gen; + jj_la1[168] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSum(distinct, expr) ; + agg = AggregatorFactory.createSum(distinct, expr) ; break; - } - case MIN:{ + case MIN: t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[165] = jj_gen; + jj_la1[169] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMin(distinct, expr) ; + agg = AggregatorFactory.createMin(distinct, expr) ; break; - } - case MAX:{ + case MAX: t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[166] = jj_gen; + jj_la1[170] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMax(distinct, expr) ; + agg = AggregatorFactory.createMax(distinct, expr) ; break; - } - case AVG:{ + case AVG: t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[167] = jj_gen; + jj_la1[171] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createAvg(distinct, expr) ; + agg = AggregatorFactory.createAvg(distinct, expr) ; break; - } - case MEDIAN:{ + case MEDIAN: t = jj_consume_token(MEDIAN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[168] = jj_gen; + jj_la1[172] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMedian(distinct, expr) ; + agg = AggregatorFactory.createMedian(distinct, expr) ; break; - } - case MODE:{ + case MODE: t = jj_consume_token(MODE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[169] = jj_gen; + jj_la1[173] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMode(distinct, expr) ; + agg = AggregatorFactory.createMode(distinct, expr) ; break; - } - case SAMPLE:{ + case SAMPLE: t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[170] = jj_gen; + jj_la1[174] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSample(distinct, expr) ; + agg = AggregatorFactory.createSample(distinct, expr) ; break; - } - case GROUP_CONCAT:{ + case GROUP_CONCAT: t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[171] = jj_gen; + jj_la1[175] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: if (jj_2_5(2)) { jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[172] = jj_gen; + jj_la1[176] = jj_gen; ; } } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[173] = jj_gen; + jj_la1[177] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; - } default: - jj_la1[174] = jj_gen; + jj_la1[178] = jj_gen; ; } jj_consume_token(RPAREN); -agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; + agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; - } - case STDEV:{ + case STDEV: t = jj_consume_token(STDEV); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[175] = jj_gen; + jj_la1[179] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; break; - } - case STDEV_SAMP:{ + case STDEV_SAMP: t = jj_consume_token(STDEV_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[176] = jj_gen; + jj_la1[180] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; break; - } - case STDEV_POP:{ + case STDEV_POP: t = jj_consume_token(STDEV_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[177] = jj_gen; + jj_la1[181] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; break; - } - case VARIANCE:{ + case VARIANCE: t = jj_consume_token(VARIANCE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[178] = jj_gen; + jj_la1[182] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; break; - } - case VAR_SAMP:{ + case VAR_SAMP: t = jj_consume_token(VAR_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[179] = jj_gen; + jj_la1[183] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; break; - } - case VAR_POP:{ + case VAR_POP: t = jj_consume_token(VAR_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[180] = jj_gen; + jj_la1[184] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; break; + case FOLD: + t = jj_consume_token(FOLD); + java.util.List scs = null ; + SortCondition sc = null ; + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: + jj_consume_token(DISTINCT); + distinct = true ; + break; + default: + jj_la1[185] = jj_gen; + ; + } + expr = Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + expr2 = Expression(); + break; + default: + jj_la1[186] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: + jj_consume_token(ORDER); + jj_consume_token(BY); + label_43: + while (true) { + sc = OrderConditionForAggregationFunction(); + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case ASC: + case DESC: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + ; + break; + default: + jj_la1[187] = jj_gen; + break label_43; + } + } + break; + default: + jj_la1[188] = jj_gen; + ; } - case AGG:{ + jj_consume_token(RPAREN); + agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; + break; + case AGG: t = jj_consume_token(AGG); -String iri ; + String iri ; iri = iri(); -Args a = new Args() ; + Args a = new Args() ; a = ArgList(); -agg = AggregatorFactory.createCustom(iri, a) ; + agg = AggregatorFactory.createCustom(iri, a) ; break; - } default: - jj_la1[181] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( ! getAllowAggregatesInExpressions() ) + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: - jj_la1[182] = jj_gen; + jj_la1[190] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: - jj_la1[183] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[184] = jj_gen; + jj_la1[192] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: - jj_la1[185] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[186] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[187] = jj_gen; + jj_la1[195] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[188] = jj_gen; + jj_la1[196] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: - jj_la1[189] = jj_gen; + jj_la1[197] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: - jj_la1[190] = jj_gen; + jj_la1[198] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: - jj_la1[191] = jj_gen; + jj_la1[199] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[192] = jj_gen; + jj_la1[200] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[193] = jj_gen; + jj_la1[201] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - private boolean jj_2_1(int xla) - { + private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_1()); } + try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - private boolean jj_2_2(int xla) - { + private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_2()); } + try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - private boolean jj_2_3(int xla) - { + private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_3()); } + try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - private boolean jj_2_4(int xla) - { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_4()); } + try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - private boolean jj_2_5(int xla) - { + private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_5()); } + try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - private boolean jj_3R_RegexExpression_1516_5_120() - { - if (jj_scan_token(REGEX)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1510_5_110() - { - if (jj_scan_token(OBJECT)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1508_5_109() - { - if (jj_scan_token(PREDICATE)) return true; + private boolean jj_3R_101() { + if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1506_5_108() - { - if (jj_scan_token(SUBJECT)) return true; + private boolean jj_3R_100() { + if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1504_5_107() - { - if (jj_scan_token(TRIPLE)) return true; + private boolean jj_3R_99() { + if (jj_scan_token(IS_IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1501_5_105() - { - if (jj_3R_NotExistsFunc_1557_4_122()) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1502_3_106() - { - if (jj_scan_token(IS_TRIPLE)) return true; + private boolean jj_3R_98() { + if (jj_scan_token(SAME_TERM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1500_5_104() - { - if (jj_3R_ExistsFunc_1551_4_121()) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1499_5_103() - { - if (jj_3R_RegexExpression_1516_5_120()) return true; - return false; - } - - private boolean jj_3_2() - { + private boolean jj_3_2() { if (jj_scan_token(SEMICOLON)) return true; - if (jj_3R_Prologue_72_3_44()) return true; + if (jj_3R_45()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(147)) { - jj_scanpos = xsp; - if (jj_scan_token(148)) { - jj_scanpos = xsp; - if (jj_scan_token(155)) { + if (jj_scan_token(149)) { jj_scanpos = xsp; if (jj_scan_token(150)) { jj_scanpos = xsp; - if (jj_scan_token(151)) { + if (jj_scan_token(157)) { jj_scanpos = xsp; if (jj_scan_token(152)) { jj_scanpos = xsp; - if (jj_scan_token(149)) { + if (jj_scan_token(153)) { jj_scanpos = xsp; - if (jj_scan_token(160)) { + if (jj_scan_token(154)) { jj_scanpos = xsp; - if (jj_scan_token(143)) { + if (jj_scan_token(151)) { jj_scanpos = xsp; - if (jj_scan_token(142)) { + if (jj_scan_token(162)) { jj_scanpos = xsp; - if (jj_scan_token(161)) { + if (jj_scan_token(145)) { jj_scanpos = xsp; if (jj_scan_token(144)) { jj_scanpos = xsp; - if (jj_scan_token(145)) { + if (jj_scan_token(163)) { + jj_scanpos = xsp; + if (jj_scan_token(146)) { + jj_scanpos = xsp; + if (jj_scan_token(147)) { jj_scanpos = xsp; - if (jj_scan_token(146)) return true; + if (jj_scan_token(148)) return true; } } } @@ -6655,587 +6710,481 @@ private boolean jj_3_2() return false; } - private boolean jj_3R_Collection_1115_3_165() - { - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1496_5_102() - { - if (jj_scan_token(IS_NUMERIC)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1494_5_101() - { - if (jj_scan_token(IS_LITERAL)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1492_5_100() - { - if (jj_scan_token(IS_BLANK)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1490_5_99() - { - if (jj_scan_token(IS_URI)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1488_5_98() - { - if (jj_scan_token(IS_IRI)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1486_5_97() - { - if (jj_scan_token(SAME_TERM)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1484_5_96() - { + private boolean jj_3R_97() { if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1482_5_95() - { + private boolean jj_3R_96() { if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1478_5_94() - { + private boolean jj_3R_95() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BlankNodePropertyList_1092_3_166() - { + private boolean jj_3R_168() { if (jj_scan_token(LBRACKET)) return true; return false; } - private boolean jj_3R_BuiltInCall_1471_5_93() - { + private boolean jj_3R_94() { if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_TriplesNode_1088_3_156() - { - if (jj_3R_BlankNodePropertyList_1092_3_166()) return true; + private boolean jj_3R_158() { + if (jj_3R_168()) return true; return false; } - private boolean jj_3R_BuiltInCall_1469_5_92() - { + private boolean jj_3R_93() { if (jj_scan_token(COALESCE)) return true; - if (jj_3R_ExpressionList_833_3_117()) return true; + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_BuiltInCall_1468_5_91() - { + private boolean jj_3R_92() { if (jj_scan_token(VERSION)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_TriplesNode_1086_3_126() - { + private boolean jj_3R_127() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesNode_1086_3_155()) { + if (jj_3R_157()) { jj_scanpos = xsp; - if (jj_3R_TriplesNode_1088_3_156()) return true; + if (jj_3R_158()) return true; } return false; } - private boolean jj_3R_TriplesNode_1086_3_155() - { - if (jj_3R_Collection_1115_3_165()) return true; + private boolean jj_3R_157() { + if (jj_3R_167()) return true; return false; } - private boolean jj_3R_BuiltInCall_1467_5_90() - { + private boolean jj_3R_91() { if (jj_scan_token(SHA512)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1466_5_89() - { + private boolean jj_3R_90() { if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1465_5_88() - { + private boolean jj_3R_89() { if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1464_5_87() - { + private boolean jj_3R_88() { if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1463_5_86() - { + private boolean jj_3R_87() { if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1462_5_85() - { + private boolean jj_3R_86() { if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1461_5_84() - { + private boolean jj_3R_85() { if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1460_5_83() - { + private boolean jj_3R_84() { if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1457_5_82() - { + private boolean jj_3R_83() { if (jj_scan_token(ADJUST)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1456_5_81() - { + private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1455_5_80() - { + private boolean jj_3R_81() { if (jj_scan_token(TIMEZONE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1454_5_79() - { + private boolean jj_3R_80() { if (jj_scan_token(SECONDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1453_5_78() - { + private boolean jj_3R_79() { if (jj_scan_token(MINUTES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1452_5_77() - { + private boolean jj_3R_78() { if (jj_scan_token(HOURS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1451_5_76() - { + private boolean jj_3R_77() { if (jj_scan_token(DAY)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1450_5_75() - { + private boolean jj_3R_76() { if (jj_scan_token(MONTH)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1449_5_74() - { + private boolean jj_3R_75() { if (jj_scan_token(YEAR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1447_5_73() - { + private boolean jj_3R_74() { if (jj_scan_token(STRAFTER)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1445_5_72() - { + private boolean jj_3R_73() { if (jj_scan_token(STRBEFORE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1443_5_71() - { + private boolean jj_3R_72() { if (jj_scan_token(STRENDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1441_5_70() - { + private boolean jj_3R_71() { if (jj_scan_token(STRSTARTS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1439_5_69() - { + private boolean jj_3R_70() { if (jj_scan_token(CONTAINS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1438_5_68() - { + private boolean jj_3R_69() { if (jj_scan_token(ENCODE_FOR_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1437_5_67() - { + private boolean jj_3R_68() { if (jj_scan_token(LCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1436_5_66() - { + private boolean jj_3R_67() { if (jj_scan_token(UCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1435_5_65() - { - if (jj_3R_StrReplaceExpression_1540_3_119()) return true; + private boolean jj_3R_66() { + if (jj_3R_120()) return true; return false; } - private boolean jj_3R_BuiltInCall_1434_5_64() - { + private boolean jj_3R_65() { if (jj_scan_token(STRLEN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1433_5_63() - { - if (jj_3R_SubstringExpression_1528_5_118()) return true; + private boolean jj_3R_64() { + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_BuiltInCall_1432_5_62() - { + private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; - if (jj_3R_ExpressionList_833_3_117()) return true; + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_BuiltInCall_1431_5_61() - { + private boolean jj_3R_62() { if (jj_scan_token(IDIV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1430_5_60() - { + private boolean jj_3R_61() { if (jj_scan_token(MOD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1429_5_59() - { + private boolean jj_3R_60() { if (jj_scan_token(ROUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1428_5_58() - { + private boolean jj_3R_59() { if (jj_scan_token(FLOOR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1427_5_57() - { + private boolean jj_3R_58() { if (jj_scan_token(CEIL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1426_5_56() - { + private boolean jj_3R_57() { if (jj_scan_token(ABS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1425_5_55() - { + private boolean jj_3R_56() { if (jj_scan_token(RAND)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1423_7_116() - { + private boolean jj_3R_117() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1420_7_115() - { + private boolean jj_3R_116() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1419_5_54() - { + private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1420_7_115()) { + if (jj_3R_116()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1423_7_116()) return true; + if (jj_3R_117()) return true; } return false; } - private boolean jj_3R_BuiltInCall_1417_5_53() - { + private boolean jj_3R_54() { if (jj_scan_token(URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1415_5_52() - { + private boolean jj_3R_53() { if (jj_scan_token(IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1413_5_51() - { + private boolean jj_3R_52() { if (jj_scan_token(BOUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1411_5_50() - { + private boolean jj_3R_51() { if (jj_scan_token(DTYPE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1408_5_49() - { + private boolean jj_3R_50() { if (jj_scan_token(LANGMATCHES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1406_5_48() - { + private boolean jj_3R_49() { if (jj_scan_token(LANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1404_5_47() - { + private boolean jj_3R_48() { if (jj_scan_token(STR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1402_5_46() - { - if (jj_3R_Aggregate_1567_3_114()) return true; + private boolean jj_3R_47() { + if (jj_3R_115()) return true; return false; } - private boolean jj_3R_BuiltInCall_1402_5_43() - { + private boolean jj_3R_44() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1402_5_46()) { + if (jj_3R_47()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1404_5_47()) { + if (jj_3R_48()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1406_5_48()) { + if (jj_3R_49()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1408_5_49()) { + if (jj_3R_50()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1411_5_50()) { + if (jj_3R_51()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1413_5_51()) { + if (jj_3R_52()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1415_5_52()) { + if (jj_3R_53()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1417_5_53()) { + if (jj_3R_54()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1419_5_54()) { + if (jj_3R_55()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1425_5_55()) { + if (jj_3R_56()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1426_5_56()) { + if (jj_3R_57()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1427_5_57()) { + if (jj_3R_58()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1428_5_58()) { + if (jj_3R_59()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1429_5_59()) { + if (jj_3R_60()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1430_5_60()) { + if (jj_3R_61()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1431_5_61()) { + if (jj_3R_62()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1432_5_62()) { + if (jj_3R_63()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1433_5_63()) { + if (jj_3R_64()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1434_5_64()) { + if (jj_3R_65()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1435_5_65()) { + if (jj_3R_66()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1436_5_66()) { + if (jj_3R_67()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1437_5_67()) { + if (jj_3R_68()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1438_5_68()) { + if (jj_3R_69()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1439_5_69()) { + if (jj_3R_70()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1441_5_70()) { + if (jj_3R_71()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1443_5_71()) { + if (jj_3R_72()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1445_5_72()) { + if (jj_3R_73()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1447_5_73()) { + if (jj_3R_74()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1449_5_74()) { + if (jj_3R_75()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1450_5_75()) { + if (jj_3R_76()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1451_5_76()) { + if (jj_3R_77()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1452_5_77()) { + if (jj_3R_78()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1453_5_78()) { + if (jj_3R_79()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1454_5_79()) { + if (jj_3R_80()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1455_5_80()) { + if (jj_3R_81()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1456_5_81()) { + if (jj_3R_82()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1457_5_82()) { + if (jj_3R_83()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1460_5_83()) { + if (jj_3R_84()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1461_5_84()) { + if (jj_3R_85()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1462_5_85()) { + if (jj_3R_86()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1463_5_86()) { + if (jj_3R_87()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1464_5_87()) { + if (jj_3R_88()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1465_5_88()) { + if (jj_3R_89()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1466_5_89()) { + if (jj_3R_90()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1467_5_90()) { + if (jj_3R_91()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1468_5_91()) { + if (jj_3R_92()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1469_5_92()) { + if (jj_3R_93()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1471_5_93()) { + if (jj_3R_94()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1478_5_94()) { + if (jj_3R_95()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1482_5_95()) { + if (jj_3R_96()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1484_5_96()) { + if (jj_3R_97()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1486_5_97()) { + if (jj_3R_98()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1488_5_98()) { + if (jj_3R_99()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1490_5_99()) { + if (jj_3R_100()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1492_5_100()) { + if (jj_3R_101()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1494_5_101()) { + if (jj_3R_102()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1496_5_102()) { + if (jj_3R_103()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1499_5_103()) { + if (jj_3R_104()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1500_5_104()) { + if (jj_3R_105()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1501_5_105()) { + if (jj_3R_106()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1502_3_106()) { + if (jj_3R_107()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1504_5_107()) { + if (jj_3R_108()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1506_5_108()) { + if (jj_3R_109()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1508_5_109()) { + if (jj_3R_110()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1510_5_110()) return true; + if (jj_3R_111()) return true; } } } @@ -7303,300 +7252,262 @@ private boolean jj_3R_BuiltInCall_1402_5_43() return false; } - private boolean jj_3R_IRIREF_1727_3_158() - { + private boolean jj_3R_160() { if (jj_scan_token(IRIref)) return true; return false; } - private boolean jj_3R_BlankNode_1723_3_176() - { + private boolean jj_3R_178() { if (jj_scan_token(ANON)) return true; return false; } - private boolean jj_3R_BlankNode_1720_3_163() - { + private boolean jj_3R_165() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BlankNode_1720_3_175()) { + if (jj_3R_177()) { jj_scanpos = xsp; - if (jj_3R_BlankNode_1723_3_176()) return true; + if (jj_3R_178()) return true; } return false; } - private boolean jj_3R_BlankNode_1720_3_175() - { + private boolean jj_3R_177() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; } - private boolean jj_3R_PrefixedName_1714_5_186() - { + private boolean jj_3R_188() { if (jj_scan_token(PNAME_NS)) return true; return false; } - private boolean jj_3R_PrefixedName_1711_5_185() - { + private boolean jj_3R_187() { if (jj_scan_token(PNAME_LN)) return true; return false; } - private boolean jj_3R_GroupGraphPattern_564_3_144() - { - if (jj_scan_token(LBRACE)) return true; - return false; - } - - private boolean jj_3_3() - { - if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_861_3_45()) return true; - return false; - } - - private boolean jj_3R_PrefixedName_1711_3_177() - { + private boolean jj_3R_179() { Token xsp; xsp = jj_scanpos; - if (jj_3R_PrefixedName_1711_5_185()) { + if (jj_3R_187()) { jj_scanpos = xsp; - if (jj_3R_PrefixedName_1714_5_186()) return true; + if (jj_3R_188()) return true; } return false; } - private boolean jj_3R_iri_1707_3_168() - { - if (jj_3R_PrefixedName_1711_3_177()) return true; + private boolean jj_3R_170() { + if (jj_3R_179()) return true; return false; } - private boolean jj_3R_iri_1705_3_157() - { + private boolean jj_3R_159() { Token xsp; xsp = jj_scanpos; - if (jj_3R_iri_1705_3_167()) { + if (jj_3R_169()) { jj_scanpos = xsp; - if (jj_3R_iri_1707_3_168()) return true; + if (jj_3R_170()) return true; } return false; } - private boolean jj_3R_iri_1705_3_167() - { - if (jj_3R_IRIREF_1727_3_158()) return true; + private boolean jj_3R_169() { + if (jj_3R_160()) return true; return false; } - private boolean jj_3R_String_1696_5_181() - { + private boolean jj_3R_183() { if (jj_scan_token(STRING_LITERAL_LONG2)) return true; return false; } - private boolean jj_3R_String_1695_5_180() - { + private boolean jj_3R_182() { if (jj_scan_token(STRING_LITERAL_LONG1)) return true; return false; } - private boolean jj_3R_String_1694_5_179() - { + private boolean jj_3R_181() { if (jj_scan_token(STRING_LITERAL2)) return true; return false; } - private boolean jj_3R_String_1693_5_178() - { + private boolean jj_3R_180() { if (jj_scan_token(STRING_LITERAL1)) return true; return false; } - private boolean jj_3R_String_1693_3_169() - { + private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_String_1693_5_178()) { + if (jj_3R_180()) { jj_scanpos = xsp; - if (jj_3R_String_1694_5_179()) { + if (jj_3R_181()) { jj_scanpos = xsp; - if (jj_3R_String_1695_5_180()) { + if (jj_3R_182()) { jj_scanpos = xsp; - if (jj_3R_String_1696_5_181()) return true; + if (jj_3R_183()) return true; } } } return false; } - private boolean jj_3R_BooleanLiteral_1689_3_174() - { + private boolean jj_3R_176() { if (jj_scan_token(FALSE)) return true; return false; } - private boolean jj_3R_BooleanLiteral_1687_3_162() - { + private boolean jj_3R_164() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BooleanLiteral_1687_3_173()) { + if (jj_3R_175()) { jj_scanpos = xsp; - if (jj_3R_BooleanLiteral_1689_3_174()) return true; + if (jj_3R_176()) return true; } return false; } - private boolean jj_3R_BooleanLiteral_1687_3_173() - { + private boolean jj_3R_175() { if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1683_3_195() - { + private boolean jj_3R_197() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1682_3_194() - { + private boolean jj_3R_196() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1681_3_193() - { + private boolean jj_3R_195() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1681_3_184() - { + private boolean jj_3R_186() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralNegative_1681_3_193()) { + if (jj_3R_195()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1682_3_194()) { + if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1683_3_195()) return true; + if (jj_3R_197()) return true; } } return false; } - private boolean jj_3R_NumericLiteralPositive_1677_3_192() - { + private boolean jj_3R_146() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_194() { if (jj_scan_token(DOUBLE_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1676_3_191() - { + private boolean jj_3R_193() { if (jj_scan_token(DECIMAL_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1675_3_190() - { + private boolean jj_3R_192() { if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1675_3_183() - { + private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralPositive_1675_3_190()) { + if (jj_3R_192()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1676_3_191()) { + if (jj_3R_193()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1677_3_192()) return true; + if (jj_3R_194()) return true; } } return false; } - private boolean jj_3R_NumericLiteralUnsigned_1671_3_189() - { + private boolean jj_3R_191() { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1670_3_188() - { + private boolean jj_3R_190() { if (jj_scan_token(DECIMAL)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1669_3_187() - { + private boolean jj_3R_189() { if (jj_scan_token(INTEGER)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1669_3_182() - { + private boolean jj_3R_184() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralUnsigned_1669_3_187()) { + if (jj_3R_189()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1670_3_188()) { + if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1671_3_189()) return true; + if (jj_3R_191()) return true; } } return false; } - private boolean jj_3R_NumericLiteral_1663_5_172() - { - if (jj_3R_NumericLiteralNegative_1681_3_184()) return true; + private boolean jj_3R_174() { + if (jj_3R_186()) return true; return false; } - private boolean jj_3R_NumericLiteral_1662_5_171() - { - if (jj_3R_NumericLiteralPositive_1675_3_183()) return true; + private boolean jj_3R_173() { + if (jj_3R_185()) return true; return false; } - private boolean jj_3R_NumericLiteral_1661_5_170() - { - if (jj_3R_NumericLiteralUnsigned_1669_3_182()) return true; + private boolean jj_3R_172() { + if (jj_3R_184()) return true; return false; } - private boolean jj_3R_NumericLiteral_1660_3_161() - { + private boolean jj_3R_163() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteral_1661_5_170()) { + if (jj_3R_172()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1662_5_171()) { + if (jj_3R_173()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1663_5_172()) return true; + if (jj_3R_174()) return true; } } return false; } - private boolean jj_3_1() - { - if (jj_3R_BuiltInCall_1402_5_43()) return true; + private boolean jj_3R_162() { + if (jj_3R_171()) return true; return false; } - private boolean jj_3R_RDFLiteral_1649_3_160() - { - if (jj_3R_String_1693_3_169()) return true; + private boolean jj_3R_144() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_159()) return true; return false; } - private boolean jj_3R_Var_1247_5_159() - { + private boolean jj_3R_161() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7606,272 +7517,211 @@ private boolean jj_3R_Var_1247_5_159() return false; } - private boolean jj_3R_TriplesSameSubject_864_3_113() - { - if (jj_3R_TriplesNode_1086_3_126()) return true; + private boolean jj_3R_114() { + if (jj_3R_127()) return true; return false; } - private boolean jj_3R_TriplesSameSubject_861_3_45() - { + private boolean jj_3R_46() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesSameSubject_861_3_112()) { + if (jj_3R_113()) { jj_scanpos = xsp; - if (jj_3R_TriplesSameSubject_864_3_113()) return true; + if (jj_3R_114()) return true; } return false; } - private boolean jj_3R_TriplesSameSubject_861_3_112() - { - if (jj_3R_VarOrTerm_1196_3_125()) return true; + private boolean jj_3R_113() { + if (jj_3R_126()) return true; return false; } - private boolean jj_3_4() - { + private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_861_3_45()) return true; - return false; - } - - private boolean jj_3R_Prologue_72_18_124() - { - if (jj_3R_PrefixDecl_81_5_146()) return true; + if (jj_3R_46()) return true; return false; } - private boolean jj_3R_Aggregate_1614_5_142() - { - if (jj_scan_token(AGG)) return true; - if (jj_3R_iri_1705_3_157()) return true; + private boolean jj_3_1() { + if (jj_3R_44()) return true; return false; } - private boolean jj_3R_PrefixDecl_81_5_146() - { - if (jj_scan_token(PREFIX)) return true; - if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_IRIREF_1727_3_158()) return true; + private boolean jj_3R_143() { + if (jj_scan_token(FOLD)) return true; + if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1612_5_141() - { + private boolean jj_3R_142() { if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1610_5_140() - { + private boolean jj_3R_141() { if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1608_5_139() - { + private boolean jj_3R_140() { if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BaseDecl_76_3_145() - { - if (jj_scan_token(BASE)) return true; - if (jj_3R_IRIREF_1727_3_158()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1606_5_138() - { + private boolean jj_3R_139() { if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_72_5_111() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Prologue_72_5_123()) { - jj_scanpos = xsp; - if (jj_3R_Prologue_72_18_124()) return true; - } - return false; - } - - private boolean jj_3R_Prologue_72_5_123() - { - if (jj_3R_BaseDecl_76_3_145()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1604_5_137() - { + private boolean jj_3R_138() { if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_72_3_44() - { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Prologue_72_5_111()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ExpressionList_836_5_143() - { + private boolean jj_3R_145() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1602_5_136() - { + private boolean jj_3R_137() { if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_ExpressionList_833_3_117() - { + private boolean jj_3R_118() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(185)) { + if (jj_scan_token(187)) { jj_scanpos = xsp; - if (jj_3R_ExpressionList_836_5_143()) return true; + if (jj_3R_145()) return true; } return false; } - private boolean jj_3_5() - { + private boolean jj_3_5() { if (jj_scan_token(SEMICOLON)) return true; if (jj_scan_token(SEPARATOR)) return true; return false; } - private boolean jj_3R_QuotedTriple_1209_3_164() - { + private boolean jj_3R_166() { if (jj_scan_token(LT2)) return true; return false; } - private boolean jj_3R_Aggregate_1589_5_135() - { + private boolean jj_3R_136() { if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1587_5_134() - { + private boolean jj_3R_135() { if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1203_5_154() - { - if (jj_3R_QuotedTriple_1209_3_164()) return true; + private boolean jj_3R_156() { + if (jj_3R_166()) return true; return false; } - private boolean jj_3R_VarOrTerm_1202_5_153() - { + private boolean jj_3R_155() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_Aggregate_1585_5_133() - { + private boolean jj_3R_134() { if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1201_5_152() - { - if (jj_3R_BlankNode_1720_3_163()) return true; + private boolean jj_3R_125() { + if (jj_3R_148()) return true; + return false; + } + + private boolean jj_3R_154() { + if (jj_3R_165()) return true; return false; } - private boolean jj_3R_VarOrTerm_1200_5_151() - { - if (jj_3R_BooleanLiteral_1687_3_162()) return true; + private boolean jj_3R_153() { + if (jj_3R_164()) return true; return false; } - private boolean jj_3R_Aggregate_1583_5_132() - { + private boolean jj_3R_133() { if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1199_5_150() - { - if (jj_3R_NumericLiteral_1660_3_161()) return true; + private boolean jj_3R_152() { + if (jj_3R_163()) return true; return false; } - private boolean jj_3R_VarOrTerm_1198_5_149() - { - if (jj_3R_RDFLiteral_1649_3_160()) return true; + private boolean jj_3R_151() { + if (jj_3R_162()) return true; return false; } - private boolean jj_3R_Aggregate_1581_5_131() - { + private boolean jj_3R_132() { if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1197_5_148() - { - if (jj_3R_iri_1705_3_157()) return true; + private boolean jj_3R_148() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_160()) return true; + return false; + } + + private boolean jj_3R_150() { + if (jj_3R_159()) return true; return false; } - private boolean jj_3R_VarOrTerm_1196_5_147() - { - if (jj_3R_Var_1247_5_159()) return true; + private boolean jj_3R_149() { + if (jj_3R_161()) return true; return false; } - private boolean jj_3R_Aggregate_1579_5_130() - { + private boolean jj_3R_131() { if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1196_3_125() - { + private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; - if (jj_3R_VarOrTerm_1196_5_147()) { + if (jj_3R_149()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1197_5_148()) { + if (jj_3R_150()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1198_5_149()) { + if (jj_3R_151()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1199_5_150()) { + if (jj_3R_152()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1200_5_151()) { + if (jj_3R_153()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1201_5_152()) { + if (jj_3R_154()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1202_5_153()) { + if (jj_3R_155()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1203_5_154()) return true; + if (jj_3R_156()) return true; } } } @@ -7882,62 +7732,91 @@ private boolean jj_3R_VarOrTerm_1196_3_125() return false; } - private boolean jj_3R_Aggregate_1577_5_129() - { + private boolean jj_3R_130() { if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1575_5_128() - { + private boolean jj_3R_129() { if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1568_5_127() - { + private boolean jj_3R_147() { + if (jj_scan_token(BASE)) return true; + if (jj_3R_160()) return true; + return false; + } + + private boolean jj_3R_112() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_124()) { + jj_scanpos = xsp; + if (jj_3R_125()) return true; + } + return false; + } + + private boolean jj_3R_124() { + if (jj_3R_147()) return true; + return false; + } + + private boolean jj_3R_45() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_112()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_128() { if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1567_3_114() - { + private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; - if (jj_3R_Aggregate_1568_5_127()) { + if (jj_3R_128()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1575_5_128()) { + if (jj_3R_129()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1577_5_129()) { + if (jj_3R_130()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1579_5_130()) { + if (jj_3R_131()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1581_5_131()) { + if (jj_3R_132()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1583_5_132()) { + if (jj_3R_133()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1585_5_133()) { + if (jj_3R_134()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1587_5_134()) { + if (jj_3R_135()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1589_5_135()) { + if (jj_3R_136()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1602_5_136()) { + if (jj_3R_137()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1604_5_137()) { + if (jj_3R_138()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1606_5_138()) { + if (jj_3R_139()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1608_5_139()) { + if (jj_3R_140()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1610_5_140()) { + if (jj_3R_141()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1612_5_141()) { + if (jj_3R_142()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1614_5_142()) return true; + if (jj_3R_143()) { + jj_scanpos = xsp; + if (jj_3R_144()) return true; + } } } } @@ -7956,34 +7835,98 @@ private boolean jj_3R_Aggregate_1567_3_114() return false; } - private boolean jj_3R_NotExistsFunc_1557_4_122() - { + private boolean jj_3R_123() { if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } - private boolean jj_3R_ExistsFunc_1551_4_121() - { + private boolean jj_3R_122() { if (jj_scan_token(EXISTS)) return true; - if (jj_3R_GroupGraphPattern_564_3_144()) return true; + if (jj_3R_146()) return true; return false; } - private boolean jj_3R_StrReplaceExpression_1540_3_119() - { + private boolean jj_3R_120() { if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_SubstringExpression_1528_5_118() - { + private boolean jj_3R_119() { if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } + private boolean jj_3R_121() { + if (jj_scan_token(REGEX)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_111() { + if (jj_scan_token(OBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_110() { + if (jj_scan_token(PREDICATE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_scan_token(SUBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_scan_token(TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_106() { + if (jj_3R_123()) return true; + return false; + } + + private boolean jj_3R_107() { + if (jj_scan_token(IS_TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_105() { + if (jj_3R_122()) return true; + return false; + } + + private boolean jj_3R_104() { + if (jj_3R_121()) return true; + return false; + } + + private boolean jj_3R_167() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_103() { + if (jj_scan_token(IS_NUMERIC)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_102() { + if (jj_scan_token(IS_LITERAL)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7995,7 +7938,7 @@ private boolean jj_3R_SubstringExpression_1528_5_118() private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[194]; + final private int[] jj_la1 = new int[202]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -8005,201 +7948,187 @@ private boolean jj_3R_SubstringExpression_1528_5_118() static private int[] jj_la1_6; static private int[] jj_la1_7; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - jj_la1_init_7(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0fe0000,0xf0fe0000,0xf0fe0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0fe0000,0x1000000,0xf0fe0000,0xf0fe0000,0xf0fe0018,0x18,0xf0fe0000,0xf0fe0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xc1f602,0x0,0x0,0x0,0x0,0xc1f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x800,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0fe0000,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0xf0fe0000,0x0,0x0,0x0,0x0,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0xc00000,0x0,0xc00000,0xc00000,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + jj_la1_init_7(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x2000000,0xe1fc0000,0xe1fc0000,0xe1fc0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x4000000,0x8000000,0x0,0x0,0xe1fc0000,0x2000000,0xe1fc0000,0xe1fc0000,0xe1fc0018,0x18,0xe1fc0000,0xe1fc0018,0x18,0xe1fc0000,0xe1fc0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x183f602,0x0,0x0,0x0,0x0,0x183f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0000,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0000,0x0,0x0,0x0,0x0,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0018,0x0,0xe0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000000,0x3000000,0x0,0x3000000,0x3000000,0x0,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x3fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x7dff,0x7dff,0x7dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x1dff,0x1dff,0x1dff,0x0,0x1dff,0x1dff,0x0,0x1dff,0x1dff,0x0,0x0,0x0,0x0,0x0,0x27ff0000,0x27ff0000,0x10000000,0x40000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x10000,0x30000,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x6000,0x6000,0x6000,0x0,0x0,0x6000,0x0,0x6000,0x0,0x0,0x6000,0x0,0x0,0x6000,0x6000,0x0,0x0,0x10000000,0x0,0x6000,0x0,0x0,0x0,0x6000,0x0,0x6000,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x6000,0x0,0x0,0x6000,0x6000,0x6000,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dff,0x7dff,0x6000,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x7dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e03fe0,0x0,0x3e03fe0,0x3e03fe0,0x3e03fe0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x1e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x8,0x0,0x0,0x1,0x3,0x4be03fe0,0x0,0x0,0x4be03fe0,0x4be03fe0,0x4be03fe0,0x10000000,0x0,0x4be03fe0,0x0,0x4be03fe0,0x0,0x0,0x4be03fe0,0x10000000,0x0,0x4be03fe0,0x4be03fe0,0x0,0x10000000,0x0,0xa000000,0x1e03fe0,0x0,0xa000000,0xa000000,0x1e03fe0,0xa000000,0x1e03fe0,0x0,0x0,0x2000000,0x0,0x0,0xa000000,0x0,0xa000000,0x0,0x4be03fe0,0x0,0x0,0x0,0x0,0x0,0x4be03fe0,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x10000000,0x2000000,0x20000020,0x20000000,0x20,0x10000000,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x42000000,0x42000000,0x4be03fe0,0x4be03fe0,0x0,0x0,0x4be03fe0,0x4be03fe0,0x9e03fe0,0x0,0x1e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f00,0x3f00,0x0,0x0,0x3f00,0x0,0x0,0x3e03fe0,0x3e03fe0,0x1e03fe0,0x0,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0xa000000,0x0,0x0,0x3fe0,0xe0,0x700,0x3800,0x0,0x1e00000,0x0,0x0,0x0,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x801,0x0,0x8,0x801,0x801,0x801,0x0,0x8,0x801,0x0,0x801,0x8,0x0,0x801,0x0,0x8,0x801,0x801,0x8,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x800,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x8,0x801,0x0,0x2,0x0,0x0,0x4,0x801,0x8004000,0x8004000,0x2,0x8004000,0x8004000,0x4,0x4000000,0x8400000,0x8400000,0x40280000,0x8004000,0x0,0x4,0x280004,0x40280000,0x4000,0x4000000,0x8000000,0x8000000,0x0,0x8000000,0x0,0x0,0x801,0x801,0x1000,0x1000,0x801,0x801,0x801,0x0,0x800,0x0,0x1,0x0,0x20000,0x40000,0x3f0,0x3f0,0x180000,0x0,0x600000,0x600000,0x180000,0x600000,0x600000,0x184800,0x800,0x800,0x4,0x4,0x0,0x4,0x4,0x0,0x4,0x4,0x4,0x0,0x384800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,}; + } + private static void jj_la1_init_7() { + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with InputStream. */ public ARQParser(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public ARQParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor. */ public ARQParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new ARQParserTokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor with generated Token Manager. */ public ARQParser(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - @Override - public Throwable fillInStackTrace() { - return this; - } - } - static private final LookaheadSuccess jj_ls = new LookaheadSuccess(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -8209,103 +8138,86 @@ private int jj_ntk_f() { private int jj_endpos; private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + exists = true; + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.add(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } } /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[233]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 194; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 202; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - } - } - p = p.next; - } while (p != null); - - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; + jj_rescan = true; + for (int i = 0; i < 5; i++) { + try { + JJCalls p = jj_2_rtns[i]; + do { + if (p.gen > jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; } private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; + int gen; + Token first; + int arg; + JJCalls next; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java index 047bd0d0a0d..d5ef5ce7333 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java @@ -97,373 +97,377 @@ public interface ARQParserConstants { /** RegularExpression Id. */ int LATERAL = 48; /** RegularExpression Id. */ - int TRIPLE = 49; + int UNFOLD = 49; /** RegularExpression Id. */ - int IS_TRIPLE = 50; + int TRIPLE = 50; /** RegularExpression Id. */ - int SUBJECT = 51; + int IS_TRIPLE = 51; /** RegularExpression Id. */ - int PREDICATE = 52; + int SUBJECT = 52; /** RegularExpression Id. */ - int OBJECT = 53; + int PREDICATE = 53; /** RegularExpression Id. */ - int EXISTS = 54; + int OBJECT = 54; /** RegularExpression Id. */ - int NOT = 55; + int EXISTS = 55; /** RegularExpression Id. */ - int AS = 56; + int NOT = 56; /** RegularExpression Id. */ - int GROUP = 57; + int AS = 57; /** RegularExpression Id. */ - int HAVING = 58; + int GROUP = 58; /** RegularExpression Id. */ - int SEPARATOR = 59; + int HAVING = 59; /** RegularExpression Id. */ - int AGG = 60; + int SEPARATOR = 60; /** RegularExpression Id. */ - int COUNT = 61; + int AGG = 61; /** RegularExpression Id. */ - int MIN = 62; + int COUNT = 62; /** RegularExpression Id. */ - int MAX = 63; + int MIN = 63; /** RegularExpression Id. */ - int SUM = 64; + int MAX = 64; /** RegularExpression Id. */ - int AVG = 65; + int SUM = 65; /** RegularExpression Id. */ - int MEDIAN = 66; + int AVG = 66; /** RegularExpression Id. */ - int MODE = 67; + int MEDIAN = 67; /** RegularExpression Id. */ - int STDEV = 68; + int MODE = 68; /** RegularExpression Id. */ - int STDEV_SAMP = 69; + int STDEV = 69; /** RegularExpression Id. */ - int STDEV_POP = 70; + int STDEV_SAMP = 70; /** RegularExpression Id. */ - int VARIANCE = 71; + int STDEV_POP = 71; /** RegularExpression Id. */ - int VAR_SAMP = 72; + int VARIANCE = 72; /** RegularExpression Id. */ - int VAR_POP = 73; + int VAR_SAMP = 73; /** RegularExpression Id. */ - int SAMPLE = 74; + int VAR_POP = 74; /** RegularExpression Id. */ - int GROUP_CONCAT = 75; + int FOLD = 75; /** RegularExpression Id. */ - int FILTER = 76; + int SAMPLE = 76; /** RegularExpression Id. */ - int BOUND = 77; + int GROUP_CONCAT = 77; /** RegularExpression Id. */ - int COALESCE = 78; + int FILTER = 78; /** RegularExpression Id. */ - int IN = 79; + int BOUND = 79; /** RegularExpression Id. */ - int IF = 80; + int COALESCE = 80; /** RegularExpression Id. */ - int BNODE = 81; + int IN = 81; /** RegularExpression Id. */ - int IRI = 82; + int IF = 82; /** RegularExpression Id. */ - int URI = 83; + int BNODE = 83; /** RegularExpression Id. */ - int CAST = 84; + int IRI = 84; /** RegularExpression Id. */ - int CALL = 85; + int URI = 85; /** RegularExpression Id. */ - int MULTI = 86; + int CAST = 86; /** RegularExpression Id. */ - int SHORTEST = 87; + int CALL = 87; /** RegularExpression Id. */ - int STR = 88; + int MULTI = 88; /** RegularExpression Id. */ - int STRLANG = 89; + int SHORTEST = 89; /** RegularExpression Id. */ - int STRDT = 90; + int STR = 90; /** RegularExpression Id. */ - int DTYPE = 91; + int STRLANG = 91; /** RegularExpression Id. */ - int LANG = 92; + int STRDT = 92; /** RegularExpression Id. */ - int LANGMATCHES = 93; + int DTYPE = 93; /** RegularExpression Id. */ - int IS_URI = 94; + int LANG = 94; /** RegularExpression Id. */ - int IS_IRI = 95; + int LANGMATCHES = 95; /** RegularExpression Id. */ - int IS_BLANK = 96; + int IS_URI = 96; /** RegularExpression Id. */ - int IS_LITERAL = 97; + int IS_IRI = 97; /** RegularExpression Id. */ - int IS_NUMERIC = 98; + int IS_BLANK = 98; /** RegularExpression Id. */ - int REGEX = 99; + int IS_LITERAL = 99; /** RegularExpression Id. */ - int SAME_TERM = 100; + int IS_NUMERIC = 100; /** RegularExpression Id. */ - int RAND = 101; + int REGEX = 101; /** RegularExpression Id. */ - int ABS = 102; + int SAME_TERM = 102; /** RegularExpression Id. */ - int CEIL = 103; + int RAND = 103; /** RegularExpression Id. */ - int FLOOR = 104; + int ABS = 104; /** RegularExpression Id. */ - int ROUND = 105; + int CEIL = 105; /** RegularExpression Id. */ - int MOD = 106; + int FLOOR = 106; /** RegularExpression Id. */ - int IDIV = 107; + int ROUND = 107; /** RegularExpression Id. */ - int CONCAT = 108; + int MOD = 108; /** RegularExpression Id. */ - int SUBSTR = 109; + int IDIV = 109; /** RegularExpression Id. */ - int STRLEN = 110; + int CONCAT = 110; /** RegularExpression Id. */ - int REPLACE = 111; + int SUBSTR = 111; /** RegularExpression Id. */ - int UCASE = 112; + int STRLEN = 112; /** RegularExpression Id. */ - int LCASE = 113; + int REPLACE = 113; /** RegularExpression Id. */ - int ENCODE_FOR_URI = 114; + int UCASE = 114; /** RegularExpression Id. */ - int CONTAINS = 115; + int LCASE = 115; /** RegularExpression Id. */ - int STRSTARTS = 116; + int ENCODE_FOR_URI = 116; /** RegularExpression Id. */ - int STRENDS = 117; + int CONTAINS = 117; /** RegularExpression Id. */ - int STRBEFORE = 118; + int STRSTARTS = 118; /** RegularExpression Id. */ - int STRAFTER = 119; + int STRENDS = 119; /** RegularExpression Id. */ - int YEAR = 120; + int STRBEFORE = 120; /** RegularExpression Id. */ - int MONTH = 121; + int STRAFTER = 121; /** RegularExpression Id. */ - int DAY = 122; + int YEAR = 122; /** RegularExpression Id. */ - int HOURS = 123; + int MONTH = 123; /** RegularExpression Id. */ - int MINUTES = 124; + int DAY = 124; /** RegularExpression Id. */ - int SECONDS = 125; + int HOURS = 125; /** RegularExpression Id. */ - int TIMEZONE = 126; + int MINUTES = 126; /** RegularExpression Id. */ - int TZ = 127; + int SECONDS = 127; /** RegularExpression Id. */ - int ADJUST = 128; + int TIMEZONE = 128; /** RegularExpression Id. */ - int NOW = 129; + int TZ = 129; /** RegularExpression Id. */ - int UUID = 130; + int ADJUST = 130; /** RegularExpression Id. */ - int STRUUID = 131; + int NOW = 131; /** RegularExpression Id. */ - int VERSION = 132; + int UUID = 132; /** RegularExpression Id. */ - int MD5 = 133; + int STRUUID = 133; /** RegularExpression Id. */ - int SHA1 = 134; + int VERSION = 134; /** RegularExpression Id. */ - int SHA224 = 135; + int MD5 = 135; /** RegularExpression Id. */ - int SHA256 = 136; + int SHA1 = 136; /** RegularExpression Id. */ - int SHA384 = 137; + int SHA224 = 137; /** RegularExpression Id. */ - int SHA512 = 138; + int SHA256 = 138; /** RegularExpression Id. */ - int TRUE = 139; + int SHA384 = 139; /** RegularExpression Id. */ - int FALSE = 140; + int SHA512 = 140; /** RegularExpression Id. */ - int DATA = 141; + int TRUE = 141; /** RegularExpression Id. */ - int INSERT = 142; + int FALSE = 142; /** RegularExpression Id. */ - int DELETE = 143; + int DATA = 143; /** RegularExpression Id. */ - int INSERT_DATA = 144; + int INSERT = 144; /** RegularExpression Id. */ - int DELETE_DATA = 145; + int DELETE = 145; /** RegularExpression Id. */ - int DELETE_WHERE = 146; + int INSERT_DATA = 146; /** RegularExpression Id. */ - int LOAD = 147; + int DELETE_DATA = 147; /** RegularExpression Id. */ - int CLEAR = 148; + int DELETE_WHERE = 148; /** RegularExpression Id. */ - int CREATE = 149; + int LOAD = 149; /** RegularExpression Id. */ - int ADD = 150; + int CLEAR = 150; /** RegularExpression Id. */ - int MOVE = 151; + int CREATE = 151; /** RegularExpression Id. */ - int COPY = 152; + int ADD = 152; /** RegularExpression Id. */ - int META = 153; + int MOVE = 153; /** RegularExpression Id. */ - int SILENT = 154; + int COPY = 154; /** RegularExpression Id. */ - int DROP = 155; + int META = 155; /** RegularExpression Id. */ - int INTO = 156; + int SILENT = 156; /** RegularExpression Id. */ - int TO = 157; + int DROP = 157; /** RegularExpression Id. */ - int DFT = 158; + int INTO = 158; /** RegularExpression Id. */ - int ALL = 159; + int TO = 159; /** RegularExpression Id. */ - int WITH = 160; + int DFT = 160; /** RegularExpression Id. */ - int USING = 161; + int ALL = 161; /** RegularExpression Id. */ - int DIGITS = 162; + int WITH = 162; /** RegularExpression Id. */ - int INTEGER = 163; + int USING = 163; /** RegularExpression Id. */ - int DECIMAL = 164; + int DIGITS = 164; /** RegularExpression Id. */ - int DOUBLE = 165; + int INTEGER = 165; /** RegularExpression Id. */ - int INTEGER_POSITIVE = 166; + int DECIMAL = 166; /** RegularExpression Id. */ - int DECIMAL_POSITIVE = 167; + int DOUBLE = 167; /** RegularExpression Id. */ - int DOUBLE_POSITIVE = 168; + int INTEGER_POSITIVE = 168; /** RegularExpression Id. */ - int INTEGER_NEGATIVE = 169; + int DECIMAL_POSITIVE = 169; /** RegularExpression Id. */ - int DECIMAL_NEGATIVE = 170; + int DOUBLE_POSITIVE = 170; /** RegularExpression Id. */ - int DOUBLE_NEGATIVE = 171; + int INTEGER_NEGATIVE = 171; /** RegularExpression Id. */ - int EXPONENT = 172; + int DECIMAL_NEGATIVE = 172; /** RegularExpression Id. */ - int QUOTE_3D = 173; + int DOUBLE_NEGATIVE = 173; /** RegularExpression Id. */ - int QUOTE_3S = 174; + int EXPONENT = 174; /** RegularExpression Id. */ - int ECHAR = 175; + int QUOTE_3D = 175; /** RegularExpression Id. */ - int UCHAR = 176; + int QUOTE_3S = 176; /** RegularExpression Id. */ - int UCHAR4 = 177; + int ECHAR = 177; /** RegularExpression Id. */ - int UCHAR8 = 178; + int UCHAR = 178; /** RegularExpression Id. */ - int STRING_LITERAL1 = 179; + int UCHAR4 = 179; /** RegularExpression Id. */ - int STRING_LITERAL2 = 180; + int UCHAR8 = 180; /** RegularExpression Id. */ - int STRING_LITERAL_LONG1 = 181; + int STRING_LITERAL1 = 181; /** RegularExpression Id. */ - int STRING_LITERAL_LONG2 = 182; + int STRING_LITERAL2 = 182; /** RegularExpression Id. */ - int LPAREN = 183; + int STRING_LITERAL_LONG1 = 183; /** RegularExpression Id. */ - int RPAREN = 184; + int STRING_LITERAL_LONG2 = 184; /** RegularExpression Id. */ - int NIL = 185; + int LPAREN = 185; /** RegularExpression Id. */ - int LBRACE = 186; + int RPAREN = 186; /** RegularExpression Id. */ - int RBRACE = 187; + int NIL = 187; /** RegularExpression Id. */ - int LBRACKET = 188; + int LBRACE = 188; /** RegularExpression Id. */ - int RBRACKET = 189; + int RBRACE = 189; /** RegularExpression Id. */ - int ANON = 190; + int LBRACKET = 190; /** RegularExpression Id. */ - int SEMICOLON = 191; + int RBRACKET = 191; /** RegularExpression Id. */ - int COMMA = 192; + int ANON = 192; /** RegularExpression Id. */ - int DOT = 193; + int SEMICOLON = 193; /** RegularExpression Id. */ - int EQ = 194; + int COMMA = 194; /** RegularExpression Id. */ - int NE = 195; + int DOT = 195; /** RegularExpression Id. */ - int GT = 196; + int EQ = 196; /** RegularExpression Id. */ - int LT = 197; + int NE = 197; /** RegularExpression Id. */ - int LE = 198; + int GT = 198; /** RegularExpression Id. */ - int GE = 199; + int LT = 199; /** RegularExpression Id. */ - int GT2 = 200; + int LE = 200; /** RegularExpression Id. */ - int LT2 = 201; + int GE = 201; /** RegularExpression Id. */ - int L_ANN = 202; + int GT2 = 202; /** RegularExpression Id. */ - int R_ANN = 203; + int LT2 = 203; /** RegularExpression Id. */ - int BANG = 204; + int L_ANN = 204; /** RegularExpression Id. */ - int TILDE = 205; + int R_ANN = 205; /** RegularExpression Id. */ - int COLON = 206; + int BANG = 206; /** RegularExpression Id. */ - int SC_OR = 207; + int TILDE = 207; /** RegularExpression Id. */ - int SC_AND = 208; + int COLON = 208; /** RegularExpression Id. */ - int PLUS = 209; + int SC_OR = 209; /** RegularExpression Id. */ - int MINUS = 210; + int SC_AND = 210; /** RegularExpression Id. */ - int STAR = 211; + int PLUS = 211; /** RegularExpression Id. */ - int SLASH = 212; + int MINUS = 212; /** RegularExpression Id. */ - int DATATYPE = 213; + int STAR = 213; /** RegularExpression Id. */ - int AT = 214; + int SLASH = 214; /** RegularExpression Id. */ - int ASSIGN = 215; + int DATATYPE = 215; /** RegularExpression Id. */ - int VBAR = 216; + int AT = 216; /** RegularExpression Id. */ - int CARAT = 217; + int ASSIGN = 217; /** RegularExpression Id. */ - int FPATH = 218; + int VBAR = 218; /** RegularExpression Id. */ - int RPATH = 219; + int CARAT = 219; /** RegularExpression Id. */ - int QMARK = 220; + int FPATH = 220; /** RegularExpression Id. */ - int SURROGATE_PAIR = 221; + int RPATH = 221; /** RegularExpression Id. */ - int PN_CHARS_BASE = 222; + int QMARK = 222; /** RegularExpression Id. */ - int PN_CHARS_U = 223; + int SURROGATE_PAIR = 223; /** RegularExpression Id. */ - int PN_CHARS = 224; + int PN_CHARS_BASE = 224; /** RegularExpression Id. */ - int PN_PREFIX = 225; + int PN_CHARS_U = 225; /** RegularExpression Id. */ - int PN_LOCAL = 226; + int PN_CHARS = 226; /** RegularExpression Id. */ - int VARNAME = 227; + int PN_PREFIX = 227; /** RegularExpression Id. */ - int PN_LOCAL_ESC = 228; + int PN_LOCAL = 228; /** RegularExpression Id. */ - int PLX = 229; + int VARNAME = 229; /** RegularExpression Id. */ - int HEX = 230; + int PN_LOCAL_ESC = 230; /** RegularExpression Id. */ - int PERCENT = 231; + int PLX = 231; /** RegularExpression Id. */ - int UNKNOWN = 232; + int HEX = 232; + /** RegularExpression Id. */ + int PERCENT = 233; + /** RegularExpression Id. */ + int UNKNOWN = 234; /** Lexical state. */ int DEFAULT = 0; @@ -519,6 +523,7 @@ public interface ARQParserConstants { "\"service\"", "\"LET\"", "\"LATERAL\"", + "\"unfold\"", "\"TRIPLE\"", "\"isTRIPLE\"", "\"SUBJECT\"", @@ -544,6 +549,7 @@ public interface ARQParserConstants { "\"variance\"", "\"var_samp\"", "\"var_pop\"", + "\"fold\"", "\"sample\"", "\"group_concat\"", "\"filter\"", diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java index cc1b92ce948..099b959a206 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java @@ -1,9 +1,22 @@ -/* ARQParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ARQParserTokenManager.java */ package org.apache.jena.sparql.lang.arq ; +import org.apache.jena.graph.* ; +import org.apache.jena.query.* ; +import org.apache.jena.sparql.core.Var ; +import org.apache.jena.sparql.syntax.* ; +import org.apache.jena.sparql.expr.* ; +import org.apache.jena.sparql.path.* ; +import org.apache.jena.sparql.expr.aggregate.* ; +import org.apache.jena.sparql.expr.aggregate.lib.* ; +import org.apache.jena.update.* ; +import org.apache.jena.sparql.modify.request.* ; +import org.apache.jena.sparql.core.Quad ; +import java.util.List; +import java.util.ArrayList; /** Token Manager. */ -public class ARQParserTokenManager implements ARQParserConstants { +public class ARQParserTokenManager implements ARQParserConstants +{ /** Debug output. */ public java.io.PrintStream debugStream = System.out; @@ -15,7 +28,8 @@ private int jjStopAtPos(int pos, int kind) jjmatchedPos = pos; return pos + 1; } -private int jjMoveStringLiteralDfa0_0(){ +private int jjMoveStringLiteralDfa0_0() +{ switch(curChar) { case 9: @@ -34,164 +48,164 @@ private int jjMoveStringLiteralDfa0_0(){ jjmatchedKind = 1; return jjMoveNfa_0(0, 0); case 33: - jjmatchedKind = 204; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8L); + jjmatchedKind = 206; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x20L); case 38: - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x10000L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x40000L); case 40: - jjmatchedKind = 183; + jjmatchedKind = 185; return jjMoveNfa_0(0, 0); case 41: - jjmatchedKind = 184; + jjmatchedKind = 186; return jjMoveNfa_0(0, 0); case 42: - jjmatchedKind = 211; + jjmatchedKind = 213; return jjMoveNfa_0(0, 0); case 43: - jjmatchedKind = 209; + jjmatchedKind = 211; return jjMoveNfa_0(0, 0); case 44: - jjmatchedKind = 192; + jjmatchedKind = 194; return jjMoveNfa_0(0, 0); case 45: - jjmatchedKind = 210; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4000000L); + jjmatchedKind = 212; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x10000000L); case 46: - jjmatchedKind = 193; + jjmatchedKind = 195; return jjMoveNfa_0(0, 0); case 47: - jjmatchedKind = 212; + jjmatchedKind = 214; return jjMoveNfa_0(0, 0); case 58: - jjmatchedKind = 206; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x800000L); + jjmatchedKind = 208; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2000000L); case 59: - jjmatchedKind = 191; + jjmatchedKind = 193; return jjMoveNfa_0(0, 0); case 60: - jjmatchedKind = 197; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8000240L); + jjmatchedKind = 199; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x20000900L); case 61: - jjmatchedKind = 194; + jjmatchedKind = 196; return jjMoveNfa_0(0, 0); case 62: - jjmatchedKind = 196; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x180L); + jjmatchedKind = 198; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x600L); case 63: - jjmatchedKind = 220; + jjmatchedKind = 222; return jjMoveNfa_0(0, 0); case 64: - jjmatchedKind = 214; + jjmatchedKind = 216; return jjMoveNfa_0(0, 0); case 65: - return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x80400001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2200010810000000L, 0x10000000004L, 0x201000004L, 0x0L); case 66: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x88000L, 0x0L, 0x0L); case 67: - return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x1300000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000008000000L, 0x20420000c10000L, 0x4c00000L, 0x0L); case 68: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x4800a000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x1000000020000000L, 0x120028000L, 0x0L); case 69: - return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80000000000000L, 0x10000000000000L, 0x0L, 0x0L); case 70: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x1000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x40000004800L, 0x4000L, 0x0L); case 71: - return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400020000000000L, 0x2000L, 0x0L, 0x0L); case 72: - return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x2000000000000000L, 0x0L, 0x0L); case 73: - return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x807c0058000L, 0x10004000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x201f00160000L, 0x40010000L, 0x0L); case 74: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 76: - return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x2000030000000L, 0x80000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x80000c0000000L, 0x200000L, 0x0L); case 77: - return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x2800020L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000100000000000L, 0x4800100001000019L, 0xa000080L, 0x0L); case 78: - return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100002000000000L, 0x0L, 0x8L, 0x0L); case 79: - return jjMoveStringLiteralDfa1_0(0x200400c0000000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400400c0000000L, 0x0L, 0x0L, 0x0L); case 80: - return jjMoveStringLiteralDfa1_0(0x10000000200000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20000000200000L, 0x0L, 0x0L, 0x0L); case 82: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x208a000000000L, 0x0L, 0x0L); case 83: - return jjMoveStringLiteralDfa1_0(0x808400000400000L, 0x20f0601007800471L, 0x40007c8L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1010400000400000L, 0x83c180401e0010e2L, 0x10001f20L, 0x0L); case 84: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0xc000000000000000L, 0x20000800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x0L, 0x80002003L, 0x0L); case 85: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x1000000080000L, 0x200000004L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2080400000000L, 0x4000000200000L, 0x800000010L, 0x0L); case 86: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x10L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x700L, 0x40L, 0x0L); case 87: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x100000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x400000000L, 0x0L); case 89: - return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000000L, 0x0L, 0x0L); case 91: - jjmatchedKind = 188; + jjmatchedKind = 190; return jjMoveNfa_0(0, 0); case 93: - jjmatchedKind = 189; + jjmatchedKind = 191; return jjMoveNfa_0(0, 0); case 94: - jjmatchedKind = 217; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x200000L); + jjmatchedKind = 219; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x800000L); case 97: jjmatchedKind = 19; - return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x80400001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2200010810000000L, 0x10000000004L, 0x201000004L, 0x0L); case 98: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x88000L, 0x0L, 0x0L); case 99: - return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x1300000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000008000000L, 0x20420000c10000L, 0x4c00000L, 0x0L); case 100: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x4800a000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x1000000020000000L, 0x120028000L, 0x0L); case 101: - return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80000000000000L, 0x10000000000000L, 0x0L, 0x0L); case 102: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x1000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x40000004800L, 0x4000L, 0x0L); case 103: - return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400020000000000L, 0x2000L, 0x0L, 0x0L); case 104: - return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x2000000000000000L, 0x0L, 0x0L); case 105: - return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x807c0058000L, 0x10004000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x201f00160000L, 0x40010000L, 0x0L); case 106: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 108: - return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x2000030000000L, 0x80000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x80000c0000000L, 0x200000L, 0x0L); case 109: - return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x2800020L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000100000000000L, 0x4800100001000019L, 0xa000080L, 0x0L); case 110: - return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100002000000000L, 0x0L, 0x8L, 0x0L); case 111: - return jjMoveStringLiteralDfa1_0(0x200400c0000000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400400c0000000L, 0x0L, 0x0L, 0x0L); case 112: - return jjMoveStringLiteralDfa1_0(0x10000000200000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20000000200000L, 0x0L, 0x0L, 0x0L); case 114: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x208a000000000L, 0x0L, 0x0L); case 115: - return jjMoveStringLiteralDfa1_0(0x808400000400000L, 0x20f0601007800471L, 0x40007c8L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1010400000400000L, 0x83c180401e0010e2L, 0x10001f20L, 0x0L); case 116: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0xc000000000000000L, 0x20000800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x0L, 0x80002003L, 0x0L); case 117: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x1000000080000L, 0x200000004L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2080400000000L, 0x4000000200000L, 0x800000010L, 0x0L); case 118: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x10L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x700L, 0x40L, 0x0L); case 119: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x100000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x400000000L, 0x0L); case 121: - return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000000L, 0x0L, 0x0L); case 123: - jjmatchedKind = 186; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x400L); + jjmatchedKind = 188; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x1000L); case 124: - jjmatchedKind = 216; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8800L); + jjmatchedKind = 218; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x22000L); case 125: - jjmatchedKind = 187; + jjmatchedKind = 189; return jjMoveNfa_0(0, 0); case 126: - jjmatchedKind = 205; + jjmatchedKind = 207; return jjMoveNfa_0(0, 0); case 65279: jjmatchedKind = 9; @@ -200,7 +214,8 @@ private int jjMoveStringLiteralDfa0_0(){ return jjMoveNfa_0(0, 0); } } -private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3){ +private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3) +{ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 0); @@ -208,118 +223,118 @@ private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, switch(curChar) { case 38: - if ((active3 & 0x10000L) != 0L) + if ((active3 & 0x40000L) != 0L) { - jjmatchedKind = 208; + jjmatchedKind = 210; jjmatchedPos = 1; } break; case 45: - if ((active3 & 0x8000000L) != 0L) + if ((active3 & 0x20000000L) != 0L) { - jjmatchedKind = 219; + jjmatchedKind = 221; jjmatchedPos = 1; } break; case 60: - if ((active3 & 0x200L) != 0L) + if ((active3 & 0x800L) != 0L) { - jjmatchedKind = 201; + jjmatchedKind = 203; jjmatchedPos = 1; } break; case 61: - if ((active3 & 0x8L) != 0L) + if ((active3 & 0x20L) != 0L) { - jjmatchedKind = 195; + jjmatchedKind = 197; jjmatchedPos = 1; } - else if ((active3 & 0x40L) != 0L) + else if ((active3 & 0x100L) != 0L) { - jjmatchedKind = 198; + jjmatchedKind = 200; jjmatchedPos = 1; } - else if ((active3 & 0x80L) != 0L) + else if ((active3 & 0x200L) != 0L) { - jjmatchedKind = 199; + jjmatchedKind = 201; jjmatchedPos = 1; } - else if ((active3 & 0x800000L) != 0L) + else if ((active3 & 0x2000000L) != 0L) { - jjmatchedKind = 215; + jjmatchedKind = 217; jjmatchedPos = 1; } break; case 62: - if ((active3 & 0x100L) != 0L) + if ((active3 & 0x400L) != 0L) { - jjmatchedKind = 200; + jjmatchedKind = 202; jjmatchedPos = 1; } - else if ((active3 & 0x4000000L) != 0L) + else if ((active3 & 0x10000000L) != 0L) { - jjmatchedKind = 218; + jjmatchedKind = 220; jjmatchedPos = 1; } break; case 65: - return jjMoveStringLiteralDfa2_0(active0, 0x8401002200100000L, active1, 0x400003038300780L, active2, 0x3000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x801002200100000L, active1, 0x100000c0e0c01701L, active2, 0xc000L, active3, 0L); case 66: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0x10000000000L, active2, 0L, active3, 0L); case 67: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc000000000000L, active2, 0L, active3, 0L); case 68: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x400021L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200000000000L, active2, 0x1000084L, active3, 0L); case 69: - return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x42008010L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000c01005400000L, active1, 0x8402022000000008L, active2, 0x108020040L, active3, 0L); case 70: - if ((active1 & 0x10000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 82; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 71: - return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 72: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x7c0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x2000000L, active2, 0x1f00L, active3, 0L); case 73: - return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x104000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000300020800000L, active1, 0x4000000000004000L, active2, 0x410000001L, active3, 0L); case 76: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x80100000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x200400000L, active3, 0L); case 78: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 81; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x4000000020000L, active2, 0x10004000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2090400000000L, active1, 0x10000000080000L, active2, 0x40010000L, active3, 0L); case 79: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 159; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0x1880002L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4100000008000000L, active1, 0x2820580000018810L, active2, 0x6200008L, active3, 0L); case 80: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 82: - return jjMoveStringLiteralDfa2_0(active0, 0x212024080200000L, active1, 0xc0800L, active2, 0x8200800L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x424024080200000L, active1, 0x302000L, active2, 0x20802000L, active3, 0L); case 83: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x4000812000000L, active1, 0x7c0000000L, active2, 0x200000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000812000000L, active1, 0x1f00000000L, active2, 0x800000000L, active3, 0L); case 84: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x8L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3c100001c0000e0L, active2, 0x20L, active3, 0L); case 85: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L, active1, 0x200000400001L, active2, 0x4L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x800001000002L, active2, 0x10L, active3, 0L); case 86: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4L, active2, 0L, active3, 0L); case 88: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L, active2, 0L, active3, 0L); case 89: if ((active0 & 0x100000000L) != 0L) { @@ -328,77 +343,77 @@ else if ((active3 & 0x4000000L) != 0L) } break; case 90: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 129; jjmatchedPos = 1; } break; case 94: - if ((active3 & 0x200000L) != 0L) + if ((active3 & 0x800000L) != 0L) { - jjmatchedKind = 213; + jjmatchedKind = 215; jjmatchedPos = 1; } break; case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x8401002200100000L, active1, 0x400003038300780L, active2, 0x3000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x801002200100000L, active1, 0x100000c0e0c01701L, active2, 0xc000L, active3, 0L); case 98: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0x10000000000L, active2, 0L, active3, 0L); case 99: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc000000000000L, active2, 0L, active3, 0L); case 100: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x400021L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200000000000L, active2, 0x1000084L, active3, 0L); case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x42008010L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000c01005400000L, active1, 0x8402022000000008L, active2, 0x108020040L, active3, 0L); case 102: - if ((active1 & 0x10000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 82; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 103: - return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x7c0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x2000000L, active2, 0x1f00L, active3, 0L); case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x104000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000300020800000L, active1, 0x4000000000004000L, active2, 0x410000001L, active3, 0L); case 108: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x80100000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x200400000L, active3, 0L); case 110: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 81; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x4000000020000L, active2, 0x10004000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2090400000000L, active1, 0x10000000080000L, active2, 0x40010000L, active3, 0L); case 111: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 159; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0x1880002L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4100000008000000L, active1, 0x2820580000018810L, active2, 0x6200008L, active3, 0L); case 112: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x212024080200000L, active1, 0xc0800L, active2, 0x8200800L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x424024080200000L, active1, 0x302000L, active2, 0x20802000L, active3, 0L); case 115: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x4000812000000L, active1, 0x7c0000000L, active2, 0x200000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000812000000L, active1, 0x1f00000000L, active2, 0x800000000L, active3, 0L); case 116: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x8L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3c100001c0000e0L, active2, 0x20L, active3, 0L); case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L, active1, 0x200000400001L, active2, 0x4L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x800001000002L, active2, 0x10L, active3, 0L); case 118: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4L, active2, 0L, active3, 0L); case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L, active2, 0L, active3, 0L); case 121: if ((active0 & 0x100000000L) != 0L) { @@ -407,28 +422,28 @@ else if ((active3 & 0x4000000L) != 0L) } break; case 122: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 129; jjmatchedPos = 1; } break; case 124: - if ((active3 & 0x400L) != 0L) + if ((active3 & 0x1000L) != 0L) { - jjmatchedKind = 202; + jjmatchedKind = 204; jjmatchedPos = 1; } - else if ((active3 & 0x8000L) != 0L) + else if ((active3 & 0x20000L) != 0L) { - jjmatchedKind = 207; + jjmatchedKind = 209; jjmatchedPos = 1; } break; case 125: - if ((active3 & 0x800L) != 0L) + if ((active3 & 0x2000L) != 0L) { - jjmatchedKind = 203; + jjmatchedKind = 205; jjmatchedPos = 1; } break; @@ -437,7 +452,8 @@ else if ((active3 & 0x8000L) != 0L) } return jjMoveNfa_0(0, 1); } -private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3){ +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2) | (active3 &= old3)) == 0L) return jjMoveNfa_0(0, 1); try { curChar = input_stream.readChar(); } @@ -447,70 +463,70 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long a switch(curChar) { case 53: - if ((active2 & 0x20L) != 0L) + if ((active2 & 0x80L) != 0L) { - jjmatchedKind = 133; + jjmatchedKind = 135; jjmatchedPos = 2; } break; case 65: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x807c0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x40c000000010000L, active2, 0x201f00L); case 66: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L, active1, 0x200100000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0x800400000000L, active2, 0L); case 67: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8010000000000000L, active2, 0L); case 68: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x40000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 108; jjmatchedPos = 2; } - else if ((active2 & 0x400000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 152; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0xf8L, active2, 0L); case 69: - return jjMoveStringLiteralDfa3_0(active0, 0x10008000200000L, active1, 0L, active2, 0x300000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20008000200000L, active1, 0L, active2, 0xc00000L); case 70: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000040000000L, active1, 0L, active2, 0x100000000L); case 71: - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 2; } - else if ((active1 & 0x2L) != 0L) + else if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2000000000L, active2, 0L); case 73: - if ((active1 & 0x40000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 84; jjmatchedPos = 2; } - else if ((active1 & 0x80000L) != 0L) + else if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 85; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x42080000000000L, active1, 0x88080000000L, active2, 0x200000004L); + return jjMoveStringLiteralDfa3_0(active0, 0x84080000000000L, active1, 0x220200000000L, active2, 0x800000010L); case 74: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L, active2, 0x1L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0L, active2, 0x4L); case 75: if ((active0 & 0x10000000L) != 0L) { @@ -519,139 +535,139 @@ else if ((active1 & 0x80000L) != 0L) } break; case 76: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x200000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 161; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x4009000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x801804800L, active2, 0x10024000L); case 77: - if ((active1 & 0x1L) != 0L) + if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000L, active2, 0x1L); case 78: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x48204090c0000000L, active2, 0L); case 79: - return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x8000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400004002000000L, active1, 0x40002082000L, active2, 0x20000000L); case 80: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x2000000000000L, active2, 0x4000000L); case 82: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 90; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0x18L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x3c1000018000700L, active2, 0x60L); case 83: - if ((active1 & 0x4000000000L) != 0L) + if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 104; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x4000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x400000L, active2, 0x10000L); case 84: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x80000000000000L) != 0L) + else if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x5040000000000L, active1, 0x8000000L, active2, 0x112002000L); + return jjMoveStringLiteralDfa3_0(active0, 0x9040000000000L, active1, 0x20000000L, active2, 0x448008000L); case 85: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x800L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0x2000080100008000L, active2, 0x2000L); case 86: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x800000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0L, active2, 0x2000000L); case 87: - if ((active2 & 0x2L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 131; jjmatchedPos = 2; } break; case 88: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } break; case 89: - if ((active1 & 0x400000000000000L) != 0L) + if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 124; jjmatchedPos = 2; } break; case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x807c0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x40c000000010000L, active2, 0x201f00L); case 98: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L, active1, 0x200100000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0x800400000000L, active2, 0L); case 99: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8010000000000000L, active2, 0L); case 100: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x40000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 108; jjmatchedPos = 2; } - else if ((active2 & 0x400000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 152; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0xf8L, active2, 0L); case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x10008000200000L, active1, 0L, active2, 0x300000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20008000200000L, active1, 0L, active2, 0xc00000L); case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000040000000L, active1, 0L, active2, 0x100000000L); case 103: - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 2; } - else if ((active1 & 0x2L) != 0L) + else if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2000000000L, active2, 0L); case 105: - if ((active1 & 0x40000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 84; jjmatchedPos = 2; } - else if ((active1 & 0x80000L) != 0L) + else if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 85; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x42080000000000L, active1, 0x88080000000L, active2, 0x200000004L); + return jjMoveStringLiteralDfa3_0(active0, 0x84080000000000L, active1, 0x220200000000L, active2, 0x800000010L); case 106: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L, active2, 0x1L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0L, active2, 0x4L); case 107: if ((active0 & 0x10000000L) != 0L) { @@ -660,78 +676,78 @@ else if ((active1 & 0x80000L) != 0L) } break; case 108: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x200000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 161; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x4009000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x801804800L, active2, 0x10024000L); case 109: - if ((active1 & 0x1L) != 0L) + if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000L, active2, 0x1L); case 110: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x48204090c0000000L, active2, 0L); case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x8000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400004002000000L, active1, 0x40002082000L, active2, 0x20000000L); case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x2000000000000L, active2, 0x4000000L); case 114: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 90; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0x18L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x3c1000018000700L, active2, 0x60L); case 115: - if ((active1 & 0x4000000000L) != 0L) + if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 104; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x4000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x400000L, active2, 0x10000L); case 116: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x80000000000000L) != 0L) + else if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x5040000000000L, active1, 0x8000000L, active2, 0x112002000L); + return jjMoveStringLiteralDfa3_0(active0, 0x9040000000000L, active1, 0x20000000L, active2, 0x448008000L); case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x800L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0x2000080100008000L, active2, 0x2000L); case 118: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x800000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0L, active2, 0x2000000L); case 119: - if ((active2 & 0x2L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 131; jjmatchedPos = 2; } break; case 120: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } break; case 121: - if ((active1 & 0x400000000000000L) != 0L) + if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 124; jjmatchedPos = 2; } break; @@ -740,7 +756,8 @@ else if ((active0 & 0x80000000000000L) != 0L) } return jjMoveNfa_0(0, 2); } -private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 2); try { curChar = input_stream.readChar(); } @@ -750,115 +767,120 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - if ((active2 & 0x40L) != 0L) + if ((active2 & 0x100L) != 0L) { - jjmatchedKind = 134; + jjmatchedKind = 136; jjmatchedPos = 3; } break; case 50: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x180L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x600L); case 51: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x200L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x800L); case 53: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x400L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x1000L); case 65: - if ((active2 & 0x2000L) != 0L) + if ((active2 & 0x8000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 143; jjmatchedPos = 3; } - else if ((active2 & 0x2000000L) != 0L) + else if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x40300000L); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x200000020000000L, active2, 0x100c00000L); case 66: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 67: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x400000000000L, active2, 0L); case 68: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x2000000000L) != 0L) + else if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 75; jjmatchedPos = 3; } - else if ((active2 & 0x4L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 103; + jjmatchedPos = 3; + } + else if ((active2 & 0x10L) != 0L) + { + jjmatchedKind = 132; jjmatchedPos = 3; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x200000L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 149; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0x4020000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0x10080000L, active2, 0L); case 69: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x8L) != 0L) + else if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 3; } - else if ((active2 & 0x800L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 141; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 153; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x21002480400000L, active1, 0x4020001800000070L, active2, 0x400c000L); + return jjMoveStringLiteralDfa4_0(active0, 0x41002480400000L, active1, 0x800060000000e0L, active2, 0x10030001L); case 70: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 71: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 94; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L, active2, 0L); case 72: - if ((active2 & 0x100000000L) != 0L) + if ((active2 & 0x400000000L) != 0L) { - jjmatchedKind = 160; + jjmatchedKind = 162; jjmatchedPos = 3; } break; case 73: - return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800040020000000L, active1, 0x800000108L, active2, 0L); case 74: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 76: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 87; jjmatchedPos = 3; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 105; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x3000408010000L, active2, 0L); case 77: if ((active0 & 0x4000000000L) != 0L) { @@ -872,152 +894,157 @@ else if ((active1 & 0x8000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x200000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0x80000008000L, active2, 0x800000000L); case 79: - if ((active2 & 0x10000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 158; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x2004010000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2080000000000L, active1, 0x8010040000000000L, active2, 0L); case 80: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 157; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2020000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4020000000000L, active1, 0x1000L, active2, 0L); case 82: - if ((active1 & 0x100000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 122; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4008000000000L, active1, 0x8000000c0800000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8008000000000L, active1, 0x2000000302000000L, active2, 0L); case 83: - return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x1010L); + return jjMoveStringLiteralDfa4_0(active0, 0x80000048000000L, active1, 0x4c800000000000L, active2, 0x4040L); case 84: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 86; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x820000001004000L, active2, 0L); case 85: - return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x9L); + return jjMoveStringLiteralDfa4_0(active0, 0x400100201000000L, active1, 0x4000001000002000L, active2, 0x24L); case 86: - if ((active1 & 0x80000000000L) != 0L) + if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 109; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 89: - if ((active2 & 0x1000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 154; jjmatchedPos = 3; } break; case 95: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x300L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x600L, active2, 0L); case 97: - if ((active2 & 0x2000L) != 0L) + if ((active2 & 0x8000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 143; jjmatchedPos = 3; } - else if ((active2 & 0x2000000L) != 0L) + else if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x40300000L); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x200000020000000L, active2, 0x100c00000L); case 98: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 99: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x400000000000L, active2, 0L); case 100: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x2000000000L) != 0L) + else if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 75; jjmatchedPos = 3; } - else if ((active2 & 0x4L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 103; jjmatchedPos = 3; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x10L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 132; + jjmatchedPos = 3; + } + else if ((active2 & 0x200000L) != 0L) + { + jjmatchedKind = 149; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0x4020000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0x10080000L, active2, 0L); case 101: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x8L) != 0L) + else if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 3; } - else if ((active2 & 0x800L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 141; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 153; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x21002480400000L, active1, 0x4020001800000070L, active2, 0x400c000L); + return jjMoveStringLiteralDfa4_0(active0, 0x41002480400000L, active1, 0x800060000000e0L, active2, 0x10030001L); case 102: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 103: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 94; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L, active2, 0L); case 104: - if ((active2 & 0x100000000L) != 0L) + if ((active2 & 0x400000000L) != 0L) { - jjmatchedKind = 160; + jjmatchedKind = 162; jjmatchedPos = 3; } break; case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800040020000000L, active1, 0x800000108L, active2, 0L); case 106: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 108: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 87; jjmatchedPos = 3; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 105; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x3000408010000L, active2, 0L); case 109: if ((active0 & 0x4000000000L) != 0L) { @@ -1031,50 +1058,50 @@ else if ((active1 & 0x8000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x200000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0x80000008000L, active2, 0x800000000L); case 111: - if ((active2 & 0x10000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 158; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x2004010000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2080000000000L, active1, 0x8010040000000000L, active2, 0L); case 112: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 157; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2020000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4020000000000L, active1, 0x1000L, active2, 0L); case 114: - if ((active1 & 0x100000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 122; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4008000000000L, active1, 0x8000000c0800000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8008000000000L, active1, 0x2000000302000000L, active2, 0L); case 115: - return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x1010L); + return jjMoveStringLiteralDfa4_0(active0, 0x80000048000000L, active1, 0x4c800000000000L, active2, 0x4040L); case 116: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 86; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x820000001004000L, active2, 0L); case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x9L); + return jjMoveStringLiteralDfa4_0(active0, 0x400100201000000L, active1, 0x4000001000002000L, active2, 0x24L); case 118: - if ((active1 & 0x80000000000L) != 0L) + if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 109; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 121: - if ((active2 & 0x1000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 154; jjmatchedPos = 3; } break; @@ -1083,7 +1110,8 @@ else if ((active1 & 0x8000000000L) != 0L) } return jjMoveNfa_0(0, 3); } -private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 3); try { curChar = input_stream.readChar(); } @@ -1093,72 +1121,72 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x400L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1000L); case 50: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x80L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x200L); case 53: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x400L); case 56: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x200L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x800L); case 65: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x22400408000108L, active2, 0L); case 67: - return jjMoveStringLiteralDfa5_0(active0, 0x20000001400000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000001400000L, active1, 0L, active2, 0L); case 68: if ((active0 & 0x2000000000L) != 0L) { jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 79; jjmatchedPos = 4; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 107; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 69: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x20000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 83; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 114; jjmatchedPos = 4; } - else if ((active1 & 0x2000000000000L) != 0L) + else if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 115; jjmatchedPos = 4; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 142; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x8000240000000L, active1, 0x40400000005000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x10000240000000L, active1, 0x101000000014000L, active2, 0L); case 70: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 71: - if ((active2 & 0x200000000L) != 0L) + if ((active2 & 0x800000000L) != 0L) { - jjmatchedKind = 161; + jjmatchedKind = 163; jjmatchedPos = 4; } break; @@ -1168,172 +1196,172 @@ else if ((active2 & 0x1000L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x200000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 123; jjmatchedPos = 4; } break; case 73: - if ((active1 & 0x400000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 88; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 96; jjmatchedPos = 4; } - else if ((active1 & 0x80000000L) != 0L) + else if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 97; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x14400000a00000L, active1, 0L, active2, 0x10L); + return jjMoveStringLiteralDfa5_0(active0, 0x28400000a00000L, active1, 0L, active2, 0x40L); case 76: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x6000000000000L, active1, 0x1000L, active2, 0L); case 77: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1080000000L, active2, 0L); case 78: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x4000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0x8080000000000000L, active2, 0x10000000L); case 79: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 80: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2400L, active2, 0L); case 82: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 106; jjmatchedPos = 4; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 150; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x801000004000000L, active1, 0L, active2, 0x4000L); + return jjMoveStringLiteralDfa5_0(active0, 0x1001000004000000L, active1, 0L, active2, 0x10000L); case 83: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 125; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0x1L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200L, active2, 0x4L); case 84: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x2000000000000000L) != 0L) + else if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 4; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 92; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x208000L); + return jjMoveStringLiteralDfa5_0(active0, 0x80000008000000L, active1, 0x4040804822000000L, active2, 0x820000L); case 85: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x40000008L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100000020L); case 86: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xc0L, active2, 0L); case 88: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 101; jjmatchedPos = 4; } break; case 90: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1L); case 97: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x22400408000108L, active2, 0L); case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x20000001400000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000001400000L, active1, 0L, active2, 0L); case 100: if ((active0 & 0x2000000000L) != 0L) { jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 79; jjmatchedPos = 4; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 107; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 101: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x20000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 83; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 114; jjmatchedPos = 4; } - else if ((active1 & 0x2000000000000L) != 0L) + else if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 115; jjmatchedPos = 4; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 142; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x8000240000000L, active1, 0x40400000005000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x10000240000000L, active1, 0x101000000014000L, active2, 0L); case 102: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 103: - if ((active2 & 0x200000000L) != 0L) + if ((active2 & 0x800000000L) != 0L) { - jjmatchedKind = 161; + jjmatchedKind = 163; jjmatchedPos = 4; } break; @@ -1343,119 +1371,120 @@ else if ((active2 & 0x1000L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x200000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 123; jjmatchedPos = 4; } break; case 105: - if ((active1 & 0x400000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 88; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 96; jjmatchedPos = 4; } - else if ((active1 & 0x80000000L) != 0L) + else if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 97; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x14400000a00000L, active1, 0L, active2, 0x10L); + return jjMoveStringLiteralDfa5_0(active0, 0x28400000a00000L, active1, 0L, active2, 0x40L); case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x6000000000000L, active1, 0x1000L, active2, 0L); case 109: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1080000000L, active2, 0L); case 110: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x4000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0x8080000000000000L, active2, 0x10000000L); case 111: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 112: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2400L, active2, 0L); case 114: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 106; jjmatchedPos = 4; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 150; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x801000004000000L, active1, 0L, active2, 0x4000L); + return jjMoveStringLiteralDfa5_0(active0, 0x1001000004000000L, active1, 0L, active2, 0x10000L); case 115: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 125; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0x1L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200L, active2, 0x4L); case 116: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x2000000000000000L) != 0L) + else if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 4; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 92; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x208000L); + return jjMoveStringLiteralDfa5_0(active0, 0x80000008000000L, active1, 0x4040804822000000L, active2, 0x820000L); case 117: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x40000008L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100000020L); case 118: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xc0L, active2, 0L); case 120: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 101; jjmatchedPos = 4; } break; case 122: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1L); default : break; } return jjMoveNfa_0(0, 4); } -private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 4); try { curChar = input_stream.readChar(); } @@ -1465,97 +1494,102 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long a switch(curChar) { case 50: - if ((active2 & 0x400L) != 0L) + if ((active2 & 0x1000L) != 0L) { - jjmatchedKind = 138; + jjmatchedKind = 140; jjmatchedPos = 5; } break; case 52: - if ((active2 & 0x80L) != 0L) + if ((active2 & 0x200L) != 0L) { - jjmatchedKind = 135; + jjmatchedKind = 137; jjmatchedPos = 5; } - else if ((active2 & 0x200L) != 0L) + else if ((active2 & 0x800L) != 0L) { - jjmatchedKind = 137; + jjmatchedKind = 139; jjmatchedPos = 5; } break; case 54: - if ((active2 & 0x100L) != 0L) + if ((active2 & 0x400L) != 0L) { - jjmatchedKind = 136; + jjmatchedKind = 138; jjmatchedPos = 5; } break; case 65: - return jjMoveStringLiteralDfa6_0(active0, 0x801000000000000L, active1, 0x10000020000100L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1001000000000000L, active1, 0x40000080000200L, active2, 0L); case 67: - return jjMoveStringLiteralDfa6_0(active0, 0x18400000000000L, active1, 0x800000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x30400000000000L, active1, 0x2000000000000L, active2, 0L); case 68: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); - case 69: if ((active0 & 0x2000000000000L) != 0L) { jjmatchedKind = 49; jjmatchedPos = 5; } - else if ((active1 & 0x400L) != 0L) + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8080000000000000L, active2, 0L); + case 69: + if ((active0 & 0x4000000000000L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 50; jjmatchedPos = 5; } - else if ((active2 & 0x8000L) != 0L) + else if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 143; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x20000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 145; + jjmatchedPos = 5; + } + else if ((active2 & 0x800000L) != 0L) + { + jjmatchedKind = 151; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x4010005802000000L, active2, 0L); case 70: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 71: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 5; } break; case 73: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x8L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x20000000000000L, active2, 0x20L); case 76: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x100000000L); case 78: - if ((active1 & 0x4L) != 0L) + if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 5; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 112; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x408000100L, active2, 0L); case 79: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x10L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x400L, active2, 0x41L); case 80: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 82: - if ((active1 & 0x1000L) != 0L) + if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 78; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 111; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1565,12 +1599,12 @@ else if ((active1 & 0x200000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x10000L, active2, 0L); case 84: if ((active0 & 0x400000L) != 0L) { @@ -1582,32 +1616,32 @@ else if ((active0 & 0x40000000L) != 0L) jjmatchedKind = 30; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 110; jjmatchedPos = 5; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 130; jjmatchedPos = 5; } - else if ((active2 & 0x4000L) != 0L) + else if ((active2 & 0x10000L) != 0L) { - jjmatchedKind = 142; + jjmatchedKind = 144; jjmatchedPos = 5; } - else if ((active2 & 0x4000000L) != 0L) + else if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 156; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 88: if ((active0 & 0x200000L) != 0L) { @@ -1616,75 +1650,80 @@ else if ((active2 & 0x4000000L) != 0L) } break; case 89: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000L, active2, 0L); case 95: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x860L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20c0L, active2, 0L); case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x801000000000000L, active1, 0x10000020000100L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1001000000000000L, active1, 0x40000080000200L, active2, 0L); case 99: - return jjMoveStringLiteralDfa6_0(active0, 0x18400000000000L, active1, 0x800000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x30400000000000L, active1, 0x2000000000000L, active2, 0L); case 100: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); - case 101: if ((active0 & 0x2000000000000L) != 0L) { jjmatchedKind = 49; jjmatchedPos = 5; } - else if ((active1 & 0x400L) != 0L) + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8080000000000000L, active2, 0L); + case 101: + if ((active0 & 0x4000000000000L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 50; jjmatchedPos = 5; } - else if ((active2 & 0x8000L) != 0L) + else if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 143; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x20000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 145; + jjmatchedPos = 5; + } + else if ((active2 & 0x800000L) != 0L) + { + jjmatchedKind = 151; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x4010005802000000L, active2, 0L); case 102: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 103: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 5; } break; case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x8L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x20000000000000L, active2, 0x20L); case 108: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x100000000L); case 110: - if ((active1 & 0x4L) != 0L) + if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 5; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 112; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x408000100L, active2, 0L); case 111: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x10L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x400L, active2, 0x41L); case 112: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 114: - if ((active1 & 0x1000L) != 0L) + if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 78; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 111; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1694,12 +1733,12 @@ else if ((active1 & 0x200000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x10000L, active2, 0L); case 116: if ((active0 & 0x400000L) != 0L) { @@ -1711,32 +1750,32 @@ else if ((active0 & 0x40000000L) != 0L) jjmatchedKind = 30; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 110; jjmatchedPos = 5; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 130; jjmatchedPos = 5; } - else if ((active2 & 0x4000L) != 0L) + else if ((active2 & 0x10000L) != 0L) { - jjmatchedKind = 142; + jjmatchedKind = 144; jjmatchedPos = 5; } - else if ((active2 & 0x4000000L) != 0L) + else if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 156; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 120: if ((active0 & 0x200000L) != 0L) { @@ -1745,13 +1784,14 @@ else if ((active2 & 0x4000000L) != 0L) } break; case 121: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 5); } -private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 5); try { curChar = input_stream.readChar(); } @@ -1761,20 +1801,20 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long a switch(curChar) { case 65: - return jjMoveStringLiteralDfa7_0(active0, 0x10040000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x20040000000000L, active1, 0L, active2, 0L); case 66: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 67: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x12100L, active2, 0L); case 68: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x8L) != 0L) + else if ((active2 & 0x20L) != 0L) { - jjmatchedKind = 131; + jjmatchedKind = 133; jjmatchedPos = 6; } break; @@ -1784,23 +1824,23 @@ else if ((active2 & 0x8L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 113; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 71: - if ((active1 & 0x2000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 91; jjmatchedPos = 6; } break; case 75: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 98; jjmatchedPos = 6; } break; @@ -1810,75 +1850,75 @@ else if ((active1 & 0x800000000000L) != 0L) jjmatchedKind = 48; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 77: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200L, active2, 0L); case 78: - if ((active2 & 0x10L) != 0L) + if ((active2 & 0x40L) != 0L) { - jjmatchedKind = 132; + jjmatchedKind = 134; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0x1L); case 79: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 80: - if ((active1 & 0x200L) != 0L) + if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000080L, active2, 0L); case 82: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40005800000000L, active2, 0L); case 83: - if ((active1 & 0x20000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 119; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 126; jjmatchedPos = 6; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 127; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000040L, active2, 0L); case 84: - if ((active0 & 0x8000000000000L) != 0L) + if ((active0 & 0x10000000000000L) != 0L) { - jjmatchedKind = 51; + jjmatchedKind = 52; jjmatchedPos = 6; } - else if ((active2 & 0x40000000L) != 0L) + else if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 160; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000000L, active1, 0x80000000L, active2, 0L); case 85: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); case 95: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 97: - return jjMoveStringLiteralDfa7_0(active0, 0x10040000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x20040000000000L, active1, 0L, active2, 0L); case 98: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 99: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x12100L, active2, 0L); case 100: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x8L) != 0L) + else if ((active2 & 0x20L) != 0L) { - jjmatchedKind = 131; + jjmatchedKind = 133; jjmatchedPos = 6; } break; @@ -1888,23 +1928,23 @@ else if ((active2 & 0x8L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 113; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 103: - if ((active1 & 0x2000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 91; jjmatchedPos = 6; } break; case 107: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 98; jjmatchedPos = 6; } break; @@ -1914,56 +1954,56 @@ else if ((active1 & 0x800000000000L) != 0L) jjmatchedKind = 48; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 109: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200L, active2, 0L); case 110: - if ((active2 & 0x10L) != 0L) + if ((active2 & 0x40L) != 0L) { - jjmatchedKind = 132; + jjmatchedKind = 134; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0x1L); case 111: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 112: - if ((active1 & 0x200L) != 0L) + if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000080L, active2, 0L); case 114: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40005800000000L, active2, 0L); case 115: - if ((active1 & 0x20000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 119; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 126; jjmatchedPos = 6; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 127; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000040L, active2, 0L); case 116: - if ((active0 & 0x8000000000000L) != 0L) + if ((active0 & 0x10000000000000L) != 0L) { - jjmatchedKind = 51; + jjmatchedKind = 52; jjmatchedPos = 6; } - else if ((active2 & 0x40000000L) != 0L) + else if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 160; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000000L, active1, 0x80000000L, active2, 0L); case 117: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); default : @@ -1971,7 +2011,8 @@ else if ((active2 & 0x40000000L) != 0L) } return jjMoveNfa_0(0, 6); } -private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 6); try { curChar = input_stream.readChar(); } @@ -1981,45 +2022,45 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long a switch(curChar) { case 65: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x800000040L, active2, 0L); case 67: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x80000000L, active2, 0L); case 69: if ((active0 & 0x4000000L) != 0L) { jjmatchedKind = 26; jjmatchedPos = 7; } - else if ((active0 & 0x4000000000000L) != 0L) + else if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 50; + jjmatchedKind = 51; jjmatchedPos = 7; } - else if ((active1 & 0x80L) != 0L) + else if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } - else if ((active1 & 0x4000L) != 0L) + else if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 80; jjmatchedPos = 7; } - else if ((active1 & 0x8000000L) != 0L) + else if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 93; jjmatchedPos = 7; } - else if ((active1 & 0x4000000000000000L) != 0L) + else if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 128; jjmatchedPos = 7; } break; case 70: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 73: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x1000000000L, active2, 0L); case 76: if ((active0 & 0x40000000000L) != 0L) { @@ -2028,32 +2069,32 @@ else if ((active1 & 0x4000000000000000L) != 0L) } break; case 77: - if ((active1 & 0x1000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 102; jjmatchedPos = 7; } break; case 79: - return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); + return jjMoveStringLiteralDfa8_0(active0, 0x1000000000000000L, active1, 0x2080L, active2, 0L); case 80: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 7; } break; case 82: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 121; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 83: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 117; jjmatchedPos = 7; } break; @@ -2063,52 +2104,52 @@ else if ((active1 & 0x4000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x800000L) != 0L) + else if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 89; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x10000000000000L, active1, 0x10000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x20000000000000L, active1, 0x40000000000000L, active2, 0L); case 97: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x800000040L, active2, 0L); case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x80000000L, active2, 0L); case 101: if ((active0 & 0x4000000L) != 0L) { jjmatchedKind = 26; jjmatchedPos = 7; } - else if ((active0 & 0x4000000000000L) != 0L) + else if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 50; + jjmatchedKind = 51; jjmatchedPos = 7; } - else if ((active1 & 0x80L) != 0L) + else if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } - else if ((active1 & 0x4000L) != 0L) + else if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 80; jjmatchedPos = 7; } - else if ((active1 & 0x8000000L) != 0L) + else if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 93; jjmatchedPos = 7; } - else if ((active1 & 0x4000000000000000L) != 0L) + else if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 128; jjmatchedPos = 7; } break; case 102: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 105: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x1000000000L, active2, 0L); case 108: if ((active0 & 0x40000000000L) != 0L) { @@ -2117,32 +2158,32 @@ else if ((active1 & 0x4000000000000000L) != 0L) } break; case 109: - if ((active1 & 0x1000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 102; jjmatchedPos = 7; } break; case 111: - return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); + return jjMoveStringLiteralDfa8_0(active0, 0x1000000000000000L, active1, 0x2080L, active2, 0L); case 112: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 7; } break; case 114: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 121; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 115: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 117; jjmatchedPos = 7; } break; @@ -2152,19 +2193,20 @@ else if ((active1 & 0x4000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x800000L) != 0L) + else if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 89; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x10000000000000L, active1, 0x10000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x20000000000000L, active1, 0x40000000000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 7); } -private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1){ - if (((active0 &= old0) | (active1 &= old1)) == 0L) +private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ + if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 7); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { @@ -2173,57 +2215,57 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 100; jjmatchedPos = 8; } break; case 69: - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { - jjmatchedKind = 52; + jjmatchedKind = 53; jjmatchedPos = 8; } - else if ((active1 & 0x40000000000000L) != 0L) + else if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 120; jjmatchedPos = 8; } break; case 72: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x80000000L); case 76: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 99; jjmatchedPos = 8; } break; case 77: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x40L); case 78: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000L); case 79: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000000000L); case 80: - if ((active1 & 0x40L) != 0L) + if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 8; } break; case 82: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 8; } break; case 83: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 118; jjmatchedPos = 8; } break; @@ -2235,57 +2277,57 @@ else if ((active1 & 0x40000000000000L) != 0L) } break; case 99: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 100; jjmatchedPos = 8; } break; case 101: - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { - jjmatchedKind = 52; + jjmatchedKind = 53; jjmatchedPos = 8; } - else if ((active1 & 0x40000000000000L) != 0L) + else if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 120; jjmatchedPos = 8; } break; case 104: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x80000000L); case 108: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 99; jjmatchedPos = 8; } break; case 109: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x40L); case 110: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000L); case 111: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000000000L); case 112: - if ((active1 & 0x40L) != 0L) + if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 8; } break; case 114: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 8; } break; case 115: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 118; jjmatchedPos = 8; } break; @@ -2301,7 +2343,8 @@ else if ((active1 & 0x40000000000000L) != 0L) } return jjMoveNfa_0(0, 8); } -private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1){ +private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) +{ if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjMoveNfa_0(0, 8); try { curChar = input_stream.readChar(); } @@ -2311,37 +2354,38 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - return jjMoveStringLiteralDfa10_0(active1, 0x800L); + return jjMoveStringLiteralDfa10_0(active1, 0x2000L); case 69: - return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x80000000L); case 80: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 9; } break; case 82: - return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x10000000000000L); case 99: - return jjMoveStringLiteralDfa10_0(active1, 0x800L); + return jjMoveStringLiteralDfa10_0(active1, 0x2000L); case 101: - return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x80000000L); case 112: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 9; } break; case 114: - return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 9); } -private int jjMoveStringLiteralDfa10_0(long old1, long active1){ +private int jjMoveStringLiteralDfa10_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 9); try { curChar = input_stream.readChar(); } @@ -2351,22 +2395,22 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ switch(curChar) { case 65: - return jjMoveStringLiteralDfa11_0(active1, 0x800L); + return jjMoveStringLiteralDfa11_0(active1, 0x2000L); case 83: - if ((active1 & 0x20000000L) != 0L) + if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 95; jjmatchedPos = 10; } break; case 95: - return jjMoveStringLiteralDfa11_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa11_0(active1, 0x10000000000000L); case 97: - return jjMoveStringLiteralDfa11_0(active1, 0x800L); + return jjMoveStringLiteralDfa11_0(active1, 0x2000L); case 115: - if ((active1 & 0x20000000L) != 0L) + if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 95; jjmatchedPos = 10; } break; @@ -2375,7 +2419,8 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ } return jjMoveNfa_0(0, 10); } -private int jjMoveStringLiteralDfa11_0(long old1, long active1){ +private int jjMoveStringLiteralDfa11_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 10); try { curChar = input_stream.readChar(); } @@ -2385,29 +2430,30 @@ private int jjMoveStringLiteralDfa11_0(long old1, long active1){ switch(curChar) { case 84: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 77; jjmatchedPos = 11; } break; case 85: - return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x10000000000000L); case 116: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 77; jjmatchedPos = 11; } break; case 117: - return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 11); } -private int jjMoveStringLiteralDfa12_0(long old1, long active1){ +private int jjMoveStringLiteralDfa12_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 11); try { curChar = input_stream.readChar(); } @@ -2417,15 +2463,16 @@ private int jjMoveStringLiteralDfa12_0(long old1, long active1){ switch(curChar) { case 82: - return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x10000000000000L); case 114: - return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 12); } -private int jjMoveStringLiteralDfa13_0(long old1, long active1){ +private int jjMoveStringLiteralDfa13_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 12); try { curChar = input_stream.readChar(); } @@ -2435,16 +2482,16 @@ private int jjMoveStringLiteralDfa13_0(long old1, long active1){ switch(curChar) { case 73: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 116; jjmatchedPos = 13; } break; case 105: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 116; jjmatchedPos = 13; } break; @@ -2523,51 +2570,51 @@ private int jjMoveNfa_0(int startState, int curPos) case 0: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 163) - kind = 163; - { jjCheckNAddStates(0, 6); } + if (kind > 165) + kind = 165; + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); } else if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 148; else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 124; else if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); else if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); } else if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); else if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2583,11 +2630,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 7: if (curChar == 62 && kind > 10) @@ -2620,11 +2667,11 @@ else if (curChar == 39) case 16: case 21: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 19: if ((0x3ff000000000000L & l) != 0L) @@ -2636,18 +2683,18 @@ else if (curChar == 39) break; case 22: if (curChar == 58) - { jjAddStates(40, 41); } + jjAddStates(40, 41); break; case 23: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2655,7 +2702,7 @@ else if (curChar == 39) break; case 32: if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); break; case 33: case 34: @@ -2663,11 +2710,11 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 38: if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); break; case 39: case 40: @@ -2675,62 +2722,62 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 46: if (curChar == 45) - { jjCheckNAdd(47); } + jjCheckNAdd(47); break; case 47: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 49: if (curChar == 35) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 50: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 51: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 52: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 57: if (curChar == 10) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 58: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 57; break; case 65: - if ((0x8400000000L & l) != 0L && kind > 175) - kind = 175; + if ((0x8400000000L & l) != 0L && kind > 177) + kind = 177; break; case 66: if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 67: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 68: - if (curChar == 39 && kind > 179) - kind = 179; + if (curChar == 39 && kind > 181) + kind = 181; break; case 70: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 72: if ((0x3ff000000000000L & l) != 0L) @@ -2759,11 +2806,11 @@ else if (curChar == 39) case 78: case 83: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 81: if ((0x3ff000000000000L & l) != 0L) @@ -2775,19 +2822,19 @@ else if (curChar == 39) break; case 84: if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 85: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 86: - if (curChar == 34 && kind > 180) - kind = 180; + if (curChar == 34 && kind > 182) + kind = 182; break; case 88: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 90: if ((0x3ff000000000000L & l) != 0L) @@ -2816,11 +2863,11 @@ else if (curChar == 39) case 96: case 101: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 99: if ((0x3ff000000000000L & l) != 0L) @@ -2832,24 +2879,24 @@ else if (curChar == 39) break; case 102: if (curChar == 39) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 103: case 106: if (curChar == 39) - { jjCheckNAddTwoStates(104, 107); } + jjCheckNAddTwoStates(104, 107); break; case 104: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 105: if (curChar == 39) - { jjAddStates(58, 59); } + jjAddStates(58, 59); break; case 108: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 110: if ((0x3ff000000000000L & l) != 0L) @@ -2878,11 +2925,11 @@ else if (curChar == 39) case 116: case 121: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 119: if ((0x3ff000000000000L & l) != 0L) @@ -2893,8 +2940,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 121; break; case 122: - if (curChar == 39 && kind > 181) - kind = 181; + if (curChar == 39 && kind > 183) + kind = 183; break; case 123: if (curChar == 39) @@ -2910,24 +2957,24 @@ else if (curChar == 39) break; case 126: if (curChar == 34) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 127: case 130: if (curChar == 34) - { jjCheckNAddTwoStates(128, 131); } + jjCheckNAddTwoStates(128, 131); break; case 128: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 129: if (curChar == 34) - { jjAddStates(64, 65); } + jjAddStates(64, 65); break; case 132: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 134: if ((0x3ff000000000000L & l) != 0L) @@ -2956,11 +3003,11 @@ else if (curChar == 39) case 140: case 145: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 143: if ((0x3ff000000000000L & l) != 0L) @@ -2971,8 +3018,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 145; break; case 146: - if (curChar == 34 && kind > 182) - kind = 182; + if (curChar == 34 && kind > 184) + kind = 184; break; case 147: if (curChar == 34) @@ -2988,31 +3035,31 @@ else if (curChar == 39) break; case 150: if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 151: if (curChar == 35) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 152: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 153: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 154: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 155: - if (curChar == 41 && kind > 185) - kind = 185; + if (curChar == 41 && kind > 187) + kind = 187; break; case 156: if (curChar == 10) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 157: if (curChar == 13) @@ -3020,23 +3067,23 @@ else if (curChar == 39) break; case 159: if (curChar == 35) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 160: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 161: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 162: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 164: if (curChar == 10) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 165: if (curChar == 13) @@ -3044,7 +3091,7 @@ else if (curChar == 39) break; case 167: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(81, 83); } + jjAddStates(81, 83); break; case 168: if ((0x3ff200000000000L & l) != 0L) @@ -3056,7 +3103,7 @@ else if (curChar == 39) break; case 173: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(84, 86); } + jjAddStates(84, 86); break; case 174: if ((0x3ff200000000000L & l) != 0L) @@ -3064,18 +3111,18 @@ else if (curChar == 39) break; case 175: if (curChar == 58) - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 176: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -3083,11 +3130,11 @@ else if (curChar == 39) break; case 182: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 183: if (curChar == 37) - { jjAddStates(92, 93); } + jjAddStates(92, 93); break; case 184: if ((0x3ff000000000000L & l) != 0L) @@ -3095,7 +3142,7 @@ else if (curChar == 39) break; case 185: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x3ff000000000000L & l) != 0L) @@ -3114,7 +3161,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 192: if (curChar == 37) @@ -3129,34 +3176,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 203: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 206: if (curChar == 35) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 207: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 208: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 209: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 214: if (curChar == 10) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 215: if (curChar == 13) @@ -3164,23 +3211,23 @@ else if (curChar == 39) break; case 221: if (curChar == 35) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 222: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 223: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 224: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 230: if (curChar == 10) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 231: if (curChar == 13) @@ -3189,262 +3236,262 @@ else if (curChar == 39) case 236: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAddStates(0, 6); } + if (kind > 165) + kind = 165; + jjCheckNAddStates(0, 6); break; case 237: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAdd(237); } + if (kind > 165) + kind = 165; + jjCheckNAdd(237); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 239: if (curChar == 46) - { jjCheckNAdd(240); } + jjCheckNAdd(240); break; case 240: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; - { jjCheckNAdd(240); } + if (kind > 166) + kind = 166; + jjCheckNAdd(240); break; case 241: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(241, 242); } + jjCheckNAddTwoStates(241, 242); break; case 242: if (curChar == 46) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 245: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(246); } + jjCheckNAdd(246); break; case 246: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(246); } + if (kind > 167) + kind = 167; + jjCheckNAdd(246); break; case 247: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(247, 248); } + jjCheckNAddTwoStates(247, 248); break; case 249: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(250); } + jjCheckNAdd(250); break; case 250: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(250); } + if (kind > 167) + kind = 167; + jjCheckNAdd(250); break; case 251: if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); break; case 252: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(252, 253); } + jjCheckNAddTwoStates(252, 253); break; case 254: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(255); } + jjCheckNAdd(255); break; case 255: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(255); } + if (kind > 167) + kind = 167; + jjCheckNAdd(255); break; case 256: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 257: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; - { jjCheckNAdd(257); } + if (kind > 168) + kind = 168; + jjCheckNAdd(257); break; case 258: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(258, 259); } + jjCheckNAddTwoStates(258, 259); break; case 259: if (curChar == 46) - { jjCheckNAdd(260); } + jjCheckNAdd(260); break; case 260: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; - { jjCheckNAdd(260); } + if (kind > 169) + kind = 169; + jjCheckNAdd(260); break; case 261: if (curChar == 46) - { jjCheckNAdd(262); } + jjCheckNAdd(262); break; case 262: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(262, 263); } + jjCheckNAddTwoStates(262, 263); break; case 264: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(265); } + jjCheckNAdd(265); break; case 265: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(265); } + if (kind > 170) + kind = 170; + jjCheckNAdd(265); break; case 266: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(112, 115); } + jjCheckNAddStates(112, 115); break; case 267: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(267, 268); } + jjCheckNAddTwoStates(267, 268); break; case 268: if (curChar == 46) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 269: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 271: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(272); } + jjCheckNAdd(272); break; case 272: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(272); } + if (kind > 170) + kind = 170; + jjCheckNAdd(272); break; case 273: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(273, 274); } + jjCheckNAddTwoStates(273, 274); break; case 275: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(276); } + jjCheckNAdd(276); break; case 276: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(276); } + if (kind > 170) + kind = 170; + jjCheckNAdd(276); break; case 277: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 278: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; - { jjCheckNAdd(278); } + if (kind > 171) + kind = 171; + jjCheckNAdd(278); break; case 279: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(279, 280); } + jjCheckNAddTwoStates(279, 280); break; case 280: if (curChar == 46) - { jjCheckNAdd(281); } + jjCheckNAdd(281); break; case 281: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; - { jjCheckNAdd(281); } + if (kind > 172) + kind = 172; + jjCheckNAdd(281); break; case 282: if (curChar == 46) - { jjCheckNAdd(283); } + jjCheckNAdd(283); break; case 283: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(283, 284); } + jjCheckNAddTwoStates(283, 284); break; case 285: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(286); } + jjCheckNAdd(286); break; case 286: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(286); } + if (kind > 173) + kind = 173; + jjCheckNAdd(286); break; case 287: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(116, 119); } + jjCheckNAddStates(116, 119); break; case 288: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(288, 289); } + jjCheckNAddTwoStates(288, 289); break; case 289: if (curChar == 46) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 290: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 292: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(293); } + jjCheckNAdd(293); break; case 293: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(293); } + if (kind > 173) + kind = 173; + jjCheckNAdd(293); break; case 294: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(294, 295); } + jjCheckNAddTwoStates(294, 295); break; case 296: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(297); } + jjCheckNAdd(297); break; case 297: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(297); } + if (kind > 173) + kind = 173; + jjCheckNAdd(297); break; default : break; } @@ -3459,32 +3506,32 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); else if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 65; else if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 22; if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 62; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 8: if (curChar == 92) - { jjAddStates(130, 131); } + jjAddStates(130, 131); break; case 9: if (curChar == 85) @@ -3517,11 +3564,11 @@ else if ((0x20000000200L & l) != 0L) case 16: case 21: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 18: if (curChar == 117) @@ -3540,11 +3587,11 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3560,7 +3607,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 39: case 40: @@ -3568,36 +3615,36 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 44: if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); break; case 45: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(45, 46); } + jjCheckNAddTwoStates(45, 46); break; case 47: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 48: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 50: - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 53: - if ((0x200000002L & l) != 0L && kind > 144) - kind = 144; + if ((0x200000002L & l) != 0L && kind > 146) + kind = 146; break; case 54: if ((0x10000000100000L & l) != 0L) @@ -3636,20 +3683,20 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 65; break; case 65: - if ((0x14404410000000L & l) != 0L && kind > 175) - kind = 175; + if ((0x14404410000000L & l) != 0L && kind > 177) + kind = 177; break; case 67: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 69: if (curChar == 92) - { jjAddStates(132, 134); } + jjAddStates(132, 134); break; case 70: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 71: if (curChar == 85) @@ -3682,11 +3729,11 @@ else if ((0x20000000200L & l) != 0L) case 78: case 83: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 80: if (curChar == 117) @@ -3702,15 +3749,15 @@ else if ((0x20000000200L & l) != 0L) break; case 85: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 87: if (curChar == 92) - { jjAddStates(135, 137); } + jjAddStates(135, 137); break; case 88: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 89: if (curChar == 85) @@ -3743,11 +3790,11 @@ else if ((0x20000000200L & l) != 0L) case 96: case 101: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 98: if (curChar == 117) @@ -3763,15 +3810,15 @@ else if ((0x20000000200L & l) != 0L) break; case 104: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 107: if (curChar == 92) - { jjAddStates(138, 140); } + jjAddStates(138, 140); break; case 108: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 109: if (curChar == 85) @@ -3804,11 +3851,11 @@ else if ((0x20000000200L & l) != 0L) case 116: case 121: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 118: if (curChar == 117) @@ -3824,15 +3871,15 @@ else if ((0x20000000200L & l) != 0L) break; case 128: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 131: if (curChar == 92) - { jjAddStates(141, 143); } + jjAddStates(141, 143); break; case 132: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 133: if (curChar == 85) @@ -3865,11 +3912,11 @@ else if ((0x20000000200L & l) != 0L) case 140: case 145: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 142: if (curChar == 117) @@ -3884,49 +3931,49 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 145; break; case 152: - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 158: if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 160: - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 163: - if (curChar == 93 && kind > 190) - kind = 190; + if (curChar == 93 && kind > 192) + kind = 192; break; case 166: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3934,11 +3981,11 @@ else if ((0x20000000200L & l) != 0L) break; case 181: if (curChar == 92) - { jjAddStates(144, 145); } + jjAddStates(144, 145); break; case 182: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 184: if ((0x7e0000007eL & l) != 0L) @@ -3946,7 +3993,7 @@ else if ((0x20000000200L & l) != 0L) break; case 185: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x7e0000007eL & l) != 0L) @@ -3969,7 +4016,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 193: if ((0x7e0000007eL & l) != 0L) @@ -3980,22 +4027,22 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 204: if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); break; case 205: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 207: - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 210: - if ((0x200000002L & l) != 0L && kind > 145) - kind = 145; + if ((0x200000002L & l) != 0L && kind > 147) + kind = 147; break; case 211: if ((0x10000000100000L & l) != 0L) @@ -4027,14 +4074,14 @@ else if ((0x20000000200L & l) != 0L) break; case 220: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 222: - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 225: - if ((0x2000000020L & l) != 0L && kind > 146) - kind = 146; + if ((0x2000000020L & l) != 0L && kind > 148) + kind = 148; break; case 226: if ((0x4000000040000L & l) != 0L) @@ -4070,39 +4117,39 @@ else if ((0x20000000200L & l) != 0L) break; case 244: if ((0x2000000020L & l) != 0L) - { jjAddStates(146, 147); } + jjAddStates(146, 147); break; case 248: if ((0x2000000020L & l) != 0L) - { jjAddStates(148, 149); } + jjAddStates(148, 149); break; case 253: if ((0x2000000020L & l) != 0L) - { jjAddStates(150, 151); } + jjAddStates(150, 151); break; case 263: if ((0x2000000020L & l) != 0L) - { jjAddStates(152, 153); } + jjAddStates(152, 153); break; case 270: if ((0x2000000020L & l) != 0L) - { jjAddStates(154, 155); } + jjAddStates(154, 155); break; case 274: if ((0x2000000020L & l) != 0L) - { jjAddStates(156, 157); } + jjAddStates(156, 157); break; case 284: if ((0x2000000020L & l) != 0L) - { jjAddStates(158, 159); } + jjAddStates(158, 159); break; case 291: if ((0x2000000020L & l) != 0L) - { jjAddStates(160, 161); } + jjAddStates(160, 161); break; case 295: if ((0x2000000020L & l) != 0L) - { jjAddStates(162, 163); } + jjAddStates(162, 163); break; default : break; } @@ -4110,7 +4157,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -4121,31 +4168,31 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 23: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4153,11 +4200,11 @@ else if ((0x20000000200L & l) != 0L) break; case 26: if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjAddStates(166, 167); } + jjAddStates(166, 167); break; case 27: if (jjCanMove_4(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 28: if (jjCanMove_5(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4172,136 +4219,136 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 33: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 34: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 35: if (jjCanMove_8(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 36: if (!jjCanMove_9(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 37: if (jjCanMove_10(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 39: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 40: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 41: if (jjCanMove_11(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 42: if (!jjCanMove_12(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 43: if (jjCanMove_13(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 50: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(45, 50); } + jjAddStates(45, 50); break; case 67: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(37, 39); } + jjAddStates(37, 39); break; case 85: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(34, 36); } + jjAddStates(34, 36); break; case 104: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(54, 57); } + jjAddStates(54, 57); break; case 128: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(60, 63); } + jjAddStates(60, 63); break; case 152: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 160: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(72, 77); } + jjAddStates(72, 77); break; case 166: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 170: if (jjCanMove_14(hiByte, i1, i2, l1, l2)) - { jjAddStates(168, 169); } + jjAddStates(168, 169); break; case 171: if (jjCanMove_15(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 172: if (jjCanMove_16(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4309,11 +4356,11 @@ else if ((0x20000000200L & l) != 0L) break; case 179: if (jjCanMove_17(hiByte, i1, i2, l1, l2)) - { jjAddStates(170, 171); } + jjAddStates(170, 171); break; case 180: if (jjCanMove_18(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 189: if (jjCanMove_19(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4328,41 +4375,41 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 197: if (jjCanMove_22(hiByte, i1, i2, l1, l2)) - { jjAddStates(172, 173); } + jjAddStates(172, 173); break; case 198: if (jjCanMove_23(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 199: if (jjCanMove_24(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 200: if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 201: if (jjCanMove_26(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(174, 177); } + jjCheckNAddStates(174, 177); break; case 202: if (jjCanMove_27(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(178, 181); } + jjCheckNAddStates(178, 181); break; case 207: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(94, 99); } + jjAddStates(94, 99); break; case 222: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(103, 108); } + jjAddStates(103, 108); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -4398,63 +4445,19 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, -null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", -"\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", -"\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", -"\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, -null, null, null, null, null, null, null, null, null, null, null, }; -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} static final int[] jjnextStates = { - 237, 238, 239, 241, 242, 247, 248, 278, 279, 280, 282, 287, 257, 258, 259, 261, - 266, 176, 190, 192, 195, 151, 154, 155, 39, 43, 6, 7, 8, 1, 2, 4, - 33, 37, 85, 86, 87, 67, 68, 69, 23, 29, 24, 25, 26, 49, 50, 51, - 58, 52, 56, 49, 52, 56, 103, 104, 105, 107, 106, 123, 127, 128, 129, 131, - 130, 147, 151, 152, 153, 157, 154, 155, 159, 160, 161, 165, 162, 163, 159, 162, - 163, 167, 168, 170, 173, 174, 197, 177, 178, 179, 181, 183, 184, 186, 206, 207, - 208, 215, 209, 213, 206, 209, 213, 221, 222, 223, 231, 224, 229, 221, 224, 229, - 267, 268, 273, 274, 288, 289, 294, 295, 167, 168, 169, 173, 174, 175, 197, 170, - 219, 235, 9, 18, 70, 71, 80, 88, 89, 98, 108, 109, 118, 132, 133, 142, - 182, 188, 245, 246, 249, 250, 254, 255, 264, 265, 271, 272, 275, 276, 285, 286, - 292, 293, 296, 297, 201, 202, 27, 28, 171, 172, 180, 189, 198, 199, 167, 168, - 169, 170, 173, 174, 175, 197, + 237, 238, 239, 241, 242, 247, 248, 278, 279, 280, 282, 287, 257, 258, 259, 261, + 266, 176, 190, 192, 195, 151, 154, 155, 39, 43, 6, 7, 8, 1, 2, 4, + 33, 37, 85, 86, 87, 67, 68, 69, 23, 29, 24, 25, 26, 49, 50, 51, + 58, 52, 56, 49, 52, 56, 103, 104, 105, 107, 106, 123, 127, 128, 129, 131, + 130, 147, 151, 152, 153, 157, 154, 155, 159, 160, 161, 165, 162, 163, 159, 162, + 163, 167, 168, 170, 173, 174, 197, 177, 178, 179, 181, 183, 184, 186, 206, 207, + 208, 215, 209, 213, 206, 209, 213, 221, 222, 223, 231, 224, 229, 221, 224, 229, + 267, 268, 273, 274, 288, 289, 294, 295, 167, 168, 169, 173, 174, 175, 197, 170, + 219, 235, 9, 18, 70, 71, 80, 88, 89, 98, 108, 109, 118, 132, 133, 142, + 182, 188, 245, 246, 249, 250, 254, 255, 264, 265, 271, 272, 275, 276, 285, 286, + 292, 293, 296, 297, 201, 202, 27, 28, 171, 172, 180, 189, 198, 199, 167, 168, + 169, 170, 173, 174, 175, 197, }; private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { @@ -4767,6 +4770,113 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, +"\73", "\54", "\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", +"\74\74", "\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", +"\55", "\52", "\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", +"\74\55", "\77", null, null, null, null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xffe23fefffffffffL, 0x7fffffffL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[298]; +private final int[] jjstateSet = new int[596]; +protected char curChar; +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 298; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4775,7 +4885,7 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l int jjmatchedKind; /** Get the next Token. */ -public Token getNextToken() +public Token getNextToken() { Token specialToken = null; Token matchedToken; @@ -4788,10 +4898,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4849,31 +4958,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4901,98 +4985,4 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } - /** Constructor. */ - public ARQParserTokenManager(SimpleCharStream stream){ - - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - - input_stream = stream; - } - - /** Constructor. */ - public ARQParserTokenManager (SimpleCharStream stream, int lexState){ - ReInit(stream); - SwitchTo(lexState); - } - - /** Reinitialise parser. */ - - public void ReInit(SimpleCharStream stream) - { - - - jjmatchedPos = - jjnewStateCnt = - 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() - { - int i; - jjround = 0x80000001; - for (i = 298; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - /** Reinitialise parser. */ - public void ReInit(SimpleCharStream stream, int lexState) - - { - ReInit(stream); - SwitchTo(lexState); - } - - /** Switch to specified lex state. */ - public void SwitchTo(int lexState) - { - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfff88ffbffffffffL, 0x1fffffffL, -}; -static final long[] jjtoSkip = { - 0x7eL, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x40L, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoMore = { - 0x0L, 0x0L, 0x0L, 0x0L, -}; - protected SimpleCharStream input_stream; - - private final int[] jjrounds = new int[298]; - private final int[] jjstateSet = new int[2 * 298]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java index cb1919325b9..b41e002b02e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ -/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ package org.apache.jena.sparql.lang.arq ; /** @@ -20,11 +20,6 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -65,7 +60,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * following this token will (therefore) be the first error token. + * followng this token will (therefore) be the first error token. */ public Token currentToken; @@ -93,8 +88,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -106,7 +101,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(EOL).append(" "); + expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -122,26 +117,21 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - if (currentToken.next != null) { - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - } - retval += "." + EOL; - - - if (expectedTokenSequences.length == 0) { - // Nothing to add here + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; } else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); + retval += "Was expecting one of:" + eol + " "; } - + retval += expected.toString(); return retval; } + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -149,11 +139,13 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -192,4 +184,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=7f03520468cc43d4f83f09bbb6a97299 (do not edit this line) */ +/* JavaCC - OriginalChecksum=48a48010f2f271416e60bbfb8cf25e4b (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java index d6ffb88916a..37e4f47459a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; @@ -30,12 +30,10 @@ public class SimpleCharStream protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - - public void setTabSize(int i) { tabSize = i; } - public int getTabSize() { return tabSize; } + protected int tabSize = 8; + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) @@ -203,20 +201,22 @@ public char readChar() throws java.io.IOException return c; } + @Deprecated /** * @deprecated * @see #getEndColumn */ - @Deprecated + public int getColumn() { return bufcolumn[bufpos]; } + @Deprecated /** * @deprecated * @see #getEndLine */ - @Deprecated + public int getLine() { return bufline[bufpos]; } @@ -466,7 +466,6 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } + } -/* JavaCC - OriginalChecksum=5f495744c87e77321fd570f94f38cd5d (do not edit this line) */ +/* JavaCC - OriginalChecksum=68955e9beb09d3242a6c5c1ee95dd485 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java index b4da352e69a..892cc587bd7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=0ea2e0bf17ab3b36b824cbe5bb2a103c (do not edit this line) */ +/* JavaCC - OriginalChecksum=d9b4c8c9332fa3054a004615fdb22b89 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java index 7260bb1d483..9731cd9bb79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.arq ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,20 +99,19 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ - protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - return("Lexical error at line " + // - errorLine + ", column " + // - errorColumn + ". Encountered: " + // - (EOFSeen ? "" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + curChar + "),")) + // - (errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + // - (lexState == 0 ? "" : " (in lexical state " + lexState + ")"); + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); } /** @@ -122,7 +123,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -142,8 +142,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } -/* JavaCC - OriginalChecksum=26900e63a554da1bde0d1d6ebd69f6c3 (do not edit this line) */ +/* JavaCC - OriginalChecksum=8f945f6081b6c05a3722e27c60c90cda (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java index 29c22ef1e10..9a2539fd2fe 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java @@ -94,6 +94,7 @@ public class Tags public static final String symAssign = ":="; public static final String tagSlice = "slice"; public static final String tagRename = "rename"; + public static final String tagUnfold = "unfold"; public static final String tagOpTriple = Tags.tagTriple; public static final String tagOpQuad = Tags.tagQuad; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java index d058f331ad5..bc3d84b1628 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java @@ -555,6 +555,25 @@ public void visit(OpExtend opExtend) { finish(opExtend); } + @Override + public void visit(OpUnfold opUnfold) { + start(opUnfold, NoNL); + + start(); + WriterExpr.output(out, opUnfold.getExpr(), sContext); + out.print(" "); + out.print( opUnfold.getVar1().toString() ); + if ( opUnfold.getVar2() != null ) { + out.print(" "); + out.print( opUnfold.getVar2().toString() ); + } + finish(); + + out.println(); + printOp(opUnfold.getSubOp()); + finish(opUnfold); + } + @Override public void visit(OpSlice opSlice) { start(opSlice, NoNL); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java new file mode 100644 index 00000000000..c408eb1ec01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -0,0 +1,86 @@ +/* + * 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 org.apache.jena.sparql.syntax; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class ElementUnfold extends Element +{ + private Expr expr ; + private Var var1 ; + private Var var2 ; + + public ElementUnfold(Expr expr, Var v1, Var v2) + { + this.expr = expr ; + this.var1 = v1 ; + this.var2 = v2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public boolean equalTo(Element el2, NodeIsomorphismMap isoMap) + { + if ( ! ( el2 instanceof ElementUnfold ) ) + return false ; + ElementUnfold f2 = (ElementUnfold)el2 ; + if ( ! this.getVar1().equals(f2.getVar1()) ) + return false ; + if ( this.getVar2() == null && f2.getVar2() != null ) + return false ; + if ( this.getVar2() != null && this.getVar2().equals(f2.getVar2()) ) + return false ; + if ( ! this.getExpr().equals(f2.getExpr()) ) + return false ; + return true ; + } + + @Override + public int hashCode() + { + if ( var2 == null ) + return var1.hashCode()^expr.hashCode(); + else + return var1.hashCode()^var2.hashCode()^expr.hashCode(); + } + + @Override + public void visit(ElementVisitor v) + { +// TODO: extend ElementVisitor +// v.visit(this) ; + } + +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java index 65a80d9fce1..7b236273cd5 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java @@ -203,6 +203,12 @@ public void visit(OpExtend opExtend) { push(OpExtend.extend(pop(), rewrite(opExtend.getVarExprList()))); } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + push( new OpUnfold(pop(), opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ); + } + @Override public void visit(OpJoin opJoin) { opJoin.getRight().visit(this); @@ -331,4 +337,4 @@ public void visit(OpTopN opTop) { expRewriter.rewriteSortConditionList(opTop.getConditions()); push(new OpTopN(pop(), opTop.getLimit(), expRewriter.rewriteSortConditionList(opTop.getConditions()))); } -} \ No newline at end of file +} diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java index d0a55a9c539..15f29e69450 100644 --- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java +++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java @@ -314,6 +314,19 @@ public void visit(final OpExtend opExtend) { addOp(OpExtend.extend(rewriteOp1(opExtend), opExtend.getVarExprList())); } + /** + * rewrites the subop of unfold. + */ + @Override + public void visit(final OpUnfold opUnfold) { + if (LOG.isDebugEnabled()) { + LOG.debug("Starting visiting OpUnfold"); + } + Op subOp = rewriteOp1(opUnfold); + OpUnfold opUnfold2 = new OpUnfold(subOp, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()); + addOp(opUnfold2); + } + /** * rewrites the subop of filter. */ From 920ed9fad0ff4250f00597720028d554690591d0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:20:31 +0200 Subject: [PATCH 085/323] extends ElementTransform to cover ElementUnfold --- .../sparql/syntax/syntaxtransform/ElementTransform.java | 1 + .../syntaxtransform/ElementTransformCleanGroupsOfOne.java | 1 + .../syntax/syntaxtransform/ElementTransformCopyBase.java | 7 +++++++ .../syntax/syntaxtransform/ElementTransformIdentity.java | 2 ++ 4 files changed, 11 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java index 954ced762f1..effab2e5f46 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java @@ -38,6 +38,7 @@ public interface ElementTransform public Element transform(ElementFilter el, Expr expr2); public Element transform(ElementAssign el, Var v, Expr expr2); public Element transform(ElementBind el, Var v, Expr expr2); + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2); public Triple transform(Triple triple); public Quad transform(Quad quad); public Element transform(ElementData el); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java index d6818301c6b..f8bb6251b14 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java @@ -47,6 +47,7 @@ public Element transform(ElementGroup eltGroup, List elts) { ( elt instanceof ElementFilter ) || ( elt instanceof ElementBind ) || ( elt instanceof ElementAssign ) || + ( elt instanceof ElementUnfold ) || ( elt instanceof ElementMinus ) || ( elt instanceof ElementOptional ) ) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java index 360011eed3d..5592001f0c8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java @@ -101,6 +101,13 @@ public Element transform(ElementBind el, Var v, Expr expr2) { return new ElementBind(v, expr2) ; } + @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { + if ( !alwaysCopy && el.getVar1() == v1 && el.getVar2() == v2 && el.getExpr() == expr ) + return el ; + return new ElementUnfold(expr, v1, v2) ; + } + @Override public Element transform(ElementData el) { if( alwaysCopy ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java index 7809f1bef5a..827ae98d382 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java @@ -51,6 +51,8 @@ private ElementTransformIdentity() {} @Override public Element transform(ElementBind el, Var v, Expr expr2) { return el ; } @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { return el ; } + @Override public Triple transform(Triple triple) { return triple; } @Override public Quad transform(Quad quad) { return quad; } From 4e12e3d3b03f8f38f7011fc75e2023a1f7402d6c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:51:58 +0200 Subject: [PATCH 086/323] extends ElementVisitor to cover ElementUnfold --- .../jena/sparql/lang/SyntaxVarScope.java | 17 ++++++++++++++++ .../sparql/serializer/FormatterElement.java | 12 +++++++++++ .../jena/sparql/syntax/ElementVisitor.java | 1 + .../sparql/syntax/ElementVisitorBase.java | 3 +++ .../jena/sparql/syntax/ElementWalker.java | 8 ++++++++ .../sparql/syntax/PatternVarsVisitor.java | 7 +++++++ .../ApplyElementTransformVisitor.java | 12 +++++++++++ .../rewriters/BuildElementVisitor.java | 8 +++++++- .../rewriters/ElementRewriter.java | 20 ++++++++++++++++++- .../updatebuilder/QuadIteratorBuilder.java | 8 +++++++- .../jena/arq/querybuilder/WhereValidator.java | 8 +++++++- 11 files changed, 100 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java index 5e0690ad151..dea4f3b3029 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java @@ -223,6 +223,7 @@ public static class VarScopeChecker extends ElementVisitorBase { @Override public void visit(ElementGroup el) { // BIND scope rules + // UNFOLD scope rules // (and service warning) for ( int i = 0 ; i < el.size() ; i++ ) { @@ -232,6 +233,10 @@ public void visit(ElementGroup el) { Collection accScope = calcScopeAll(el.getElements(), i); checkBIND(accScope, eltBind); } + if ( e instanceof ElementUnfold ) { + Collection accScope = calcScopeAll(el.getElements(), i); + checkUNFOLD(accScope, (ElementUnfold)e); + } if ( e instanceof ElementService eltSvc ) { Collection accScope = calcScopeAll(el.getElements(), i); checkSERVICE(accScope, eltSvc); @@ -264,6 +269,18 @@ private static void checkBIND(Collection scope, ElementBind el) { checkExpr(scope, el.getExpr(), var); } + private static void checkUNFOLD(Collection scope, ElementUnfold el) { + Var var1 = el.getVar1(); + if ( scope.contains(var1) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var1 + " in " + el, -1, -1); + + Var var2 = el.getVar2(); + if ( var2 != null && scope.contains(var2) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var2 + " in " + el, -1, -1); + + checkExpr(scope, el.getExpr(), var1); + } + private static void checkSERVICE(Collection scope, ElementService el) { if ( ARQ.isStrictMode() && el.getServiceNode().isVariable() ) { Var var = Var.alloc(el.getServiceNode()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java index f018e91175e..30fd057b21b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java @@ -236,6 +236,18 @@ public void visit(ElementBind el) { out.print(")"); } + @Override + public void visit(ElementUnfold el) { + out.print("UNFOLD("); + FmtExprSPARQL v = new FmtExprSPARQL(out, context); + v.format(el.getExpr()); + out.print(" AS "); + out.print("?" + el.getVar1().getVarName()); + if ( el.getVar2() != null ) + out.print(", ?" + el.getVar2().getVarName()); + out.print(")"); + } + @Override public void visit(ElementData el) { QuerySerializer.outputDataBlock(out, el.getVars(), el.getRows(), context); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java index 97ffe1c8d19..516f5ac693f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java @@ -25,6 +25,7 @@ public interface ElementVisitor public void visit(ElementFilter el) ; public void visit(ElementAssign el) ; public void visit(ElementBind el) ; + public void visit(ElementUnfold el) ; public void visit(ElementData el) ; public void visit(ElementUnion el) ; public void visit(ElementOptional el) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java index f460529d0c4..83fa6e85d55 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java @@ -36,6 +36,9 @@ public void visit(ElementAssign el) { } @Override public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { } + @Override public void visit(ElementData el) { } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java index 92fcce4e3a7..b94b3df5ac9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java @@ -90,6 +90,14 @@ public void visit(ElementBind el) { after(el); } + @Override + public void visit(ElementUnfold el) + { + before(el) ; + proc.visit(el) ; + after(el) ; + } + @Override public void visit(ElementData el) { before(el); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java index 50818105873..362077bbbcb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java @@ -82,6 +82,13 @@ public void visit(ElementBind el) { acc.add(el.getVar()); } + @Override + public void visit(ElementUnfold el) { + acc.add(el.getVar1()); + if ( el.getVar2() != null ) + acc.add(el.getVar2()); + } + @Override public void visit(ElementData el) { acc.addAll(el.getVars()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java index 43a93006347..cb22c525455 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java @@ -99,6 +99,18 @@ public void visit(ElementBind el) { push(el2) ; } + @Override + public void visit(ElementUnfold el) { + Var v1 = el.getVar1() ; + Var v1T = TransformElementLib.applyVar(v1, exprTransform) ; + Var v2 = el.getVar2() ; + Var v2T = (v2 == null) ? null : TransformElementLib.applyVar(v2, exprTransform) ; + Expr expr = el.getExpr() ; + Expr exprT = ExprTransformer.transform(exprTransform, expr) ; + Element el2 = transform.transform(el, exprT, v1T, v2T) ; + push(el2) ; + } + @Override public void visit(ElementData el) { Element el2 = transform.transform(el) ; diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java index 6e21ddc0564..6976cce240d 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java @@ -68,6 +68,12 @@ public void visit(ElementBind el) { result = el; } + @Override + public void visit(ElementUnfold el) { + // no change + result = el; + } + @Override public void visit(ElementData el) { // no change @@ -205,4 +211,4 @@ public void visit(ElementSubQuery el) { result = el; } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java index 969ebaa63ec..5c29d008580 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.Map; +import java.util.Objects; import org.apache.jena.arq.querybuilder.AbstractQueryBuilder; import org.apache.jena.graph.Node; @@ -100,6 +101,23 @@ public void visit(ElementBind el) { } } + @Override + public void visit(ElementUnfold el) { +// TODO: double check this method; I copied and adapted the method of +// ElementBind (see above) but I am not entirely sure it is correct + Node n1 = changeNode(el.getVar1()); + Node n2 = changeNode(el.getVar2()); + if ( Objects.equals(n1, el.getVar1()) && Objects.equals(n2, el.getVar2()) ) { + ExprRewriter exprRewriter = new ExprRewriter(values); + el.getExpr().visit(exprRewriter); + push( new ElementUnfold(exprRewriter.getResult(), el.getVar1(), el.getVar2()) ); + } else { + // push( new ElementBind( el.getVar(), NodeValue.makeNode( n )) ); + // no op + push(new ElementTriplesBlock()); + } + } + @Override public void visit(ElementData el) { ElementData retval = new ElementData(); @@ -195,4 +213,4 @@ public void visit(ElementSubQuery el) { push(new ElementSubQuery(AbstractQueryBuilder.rewrite(q, values))); } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java index 39be11c8703..3ad11cfdac0 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java @@ -91,6 +91,12 @@ public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { + throw new QueryParseException("unfold not permitted in data quad", -1, -1); + + } + @Override public void visit(ElementData el) { throw new QueryParseException("element data not permitted in data quad", -1, -1); @@ -158,4 +164,4 @@ public void visit(ElementSubQuery el) { q.getQueryPattern().visit(this); } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java index b94c3d8052c..34ff6cf5b1b 100644 --- a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java +++ b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java @@ -90,6 +90,12 @@ public void visit(ElementBind el) { return; } + @Override + public void visit(ElementUnfold el) { + checkMatching(el); + return; + } + @Override public void visit(ElementData el) { checkMatching(el); @@ -195,4 +201,4 @@ public void visit(ElementSubQuery el) { } } -} \ No newline at end of file +} From 08e98d88d38011c48234f7359d3d5b37ce73a88b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Jul 2022 21:01:45 +0200 Subject: [PATCH 087/323] initial functional version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 89 +++++++++++++++++-- .../jena/sparql/engine/main/OpExecutor.java | 2 +- .../sparql/engine/ref/EvaluatorSimple.java | 2 +- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d052da6e075..0ecadc1484f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -18,27 +18,104 @@ package org.apache.jena.sparql.engine.iterator; +import java.util.Iterator; + +import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.NodeFactoryExtra; -public class QueryIterUnfold extends QueryIteratorWrapper +public class QueryIterUnfold extends QueryIterRepeatApply { + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; - public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { - super(qIter) ; + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, ExecutionContext execCxt) { + super(qIter, execCxt) ; this.expr = expr ; this.var1 = var1 ; this.var2 = var2 ; } @Override - protected Binding moveToNextBinding() { -System.out.println("QueryIterUnfold"); - return super.moveToNextBinding() ; + protected QueryIterator nextStage(Binding inputBinding) { + NodeValue nv = expr.eval( inputBinding, getExecContext() ); + Node n = nv.asNode(); + if ( n.isLiteral() ) { + String dtURI = n.getLiteralDatatypeURI(); + if ( datatypeUriUntypedList.equals(dtURI) ) + return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + } + + return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + } + + protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseUntypedList(listAsValue); + return new QueryIteratorBase() { + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("a QueryIterator in QueryIterUnfold"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + }; + } + + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + final String[] listAsArray = listAsValue.split(","); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + return new Iterator<>() { + int i = 0; + + @Override + public boolean hasNext() { + return i < listAsArray.length; + } + + @Override + public Node next() { + String listElmt = listAsArray[i].strip(); + i++; + if ( pmap != null ) + return NodeFactoryExtra.parseNode(listElmt, pmap); + else + return NodeFactoryExtra.parseNode(listElmt); + } + }; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 8dbc562c921..03b9000faf6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -452,7 +452,7 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; return qIter ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index 894dee013c0..a6db3df526d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -254,7 +254,7 @@ public Table extend(Table table, VarExprList exprs) { @Override public Table unfold(Table table, Expr expr, Var var1, Var var2) { QueryIterator qIter = table.iterator(getExecContext()); - qIter = new QueryIterUnfold(qIter, expr, var1, var2); + qIter = new QueryIterUnfold(qIter, expr, var1, var2, getExecContext()); return new TableN(qIter); } From 85a6d6e3799b980a8461b7b87e69207d18cfb757 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 6 Jul 2022 21:05:28 +0200 Subject: [PATCH 088/323] enable visiting of ElementUnfold --- .../main/java/org/apache/jena/sparql/syntax/ElementUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java index c408eb1ec01..0ad02807627 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -79,8 +79,7 @@ public int hashCode() @Override public void visit(ElementVisitor v) { -// TODO: extend ElementVisitor -// v.visit(this) ; + v.visit(this) ; } } From a705c975bfbee13bf11384613912cf6841849f6b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 12:26:09 +0200 Subject: [PATCH 089/323] fully working version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 220 +++++++++++++++--- 1 file changed, 187 insertions(+), 33 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 0ecadc1484f..1f512244564 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,9 +19,14 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -36,6 +41,14 @@ public class QueryIterUnfold extends QueryIterRepeatApply { public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); protected final Expr expr ; protected final Var var1 ; @@ -56,6 +69,12 @@ protected QueryIterator nextStage(Binding inputBinding) { String dtURI = n.getLiteralDatatypeURI(); if ( datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedList.equals(dtURI) ) + return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriUntypedMap.equals(dtURI) ) + return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedMap.equals(dtURI) ) + return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); @@ -63,59 +82,194 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIteratorBase() { - @Override - public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("a QueryIterator in QueryIterUnfold"); - } + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } - @Override - protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); - } + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + + return parseList(listAsValue); + } + + protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseTypedList(listAsValue); + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } + + protected Iterator parseTypedList(String listAsValue) { + listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); + return parseList(listAsValue); + } + + protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + + protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + protected Iterator parseList(String listAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = extractListElements(listAsValue); + return new Iterator<>() { @Override - protected boolean hasNextBinding() { + public boolean hasNext() { return itListElmts.hasNext(); } @Override - protected void requestCancel() { } // nothing to do really - - @Override - protected void closeIterator() { } // nothing to do really + public Node next() { + final String listElmt = itListElmts.next(); + final Node n; + if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + else if ( pmap != null ) + n = NodeFactoryExtra.parseNode(listElmt, pmap); + else + n = NodeFactoryExtra.parseNode(listElmt); + return n; + } }; } - protected Iterator parseUntypedList(String listAsValue) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + protected Iterator extractListElements(String listAsValue) { + listAsValue = listAsValue.strip(); + + if ( listAsValue.isEmpty() ) { + return new Iterator() { + @Override public boolean hasNext() { return false; } + @Override public String next() { throw new NoSuchElementException(); } + }; + } // TODO: this method needs to be improved and, in particular, made more robust in terms // of parsing the given lexical form of the literal; for instance, simply splitting // by commas is an issue if the list contains literals with commas inside -- can we // use existing code for parsing Turtle here? - final String[] listAsArray = listAsValue.split(","); - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - return new Iterator<>() { - int i = 0; + return new ListElementExtractor(listAsValue); + } - @Override - public boolean hasNext() { - return i < listAsArray.length; + + protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected final Binding inputBinding; + protected final Iterator itListElmts; + + public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + this.inputBinding = inputBinding; + this.itListElmts = itListElmts; + } + + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorker"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected static class ListElementExtractor implements Iterator { + protected final String listAsString; + protected int cursor = 0; + protected String nextElmt = null; + + public ListElementExtractor( final String listAsString ) { + this.listAsString = listAsString.strip(); + } + + @Override + public boolean hasNext() { + if ( nextElmt != null ) + return true; + + consumeWhiteSpace(); + if ( cursor >= listAsString.length() ) { + return false; } - @Override - public Node next() { - String listElmt = listAsArray[i].strip(); - i++; - if ( pmap != null ) - return NodeFactoryExtra.parseNode(listElmt, pmap); - else - return NodeFactoryExtra.parseNode(listElmt); + final int nextElmtBegin = cursor; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); } - }; + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + nextElmt = listAsString.substring(nextElmtBegin, cursor); + cursor++; // move cursor to after comma + return true; + } + + @Override + public String next() { + if ( ! hasNext() ) + throw new NoSuchElementException(); + + String r = nextElmt; + nextElmt = null; + return r; + } + + protected void consumeWhiteSpace() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + cursor++; + } + + protected void advanceToEndOfSubList() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToEndOfSubMap() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToNextCommaOrEnd() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + cursor++; + } } } From 78aa795ec264638b4e5e8e261e74b1a3bc4fda1d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:10:46 +0200 Subject: [PATCH 090/323] bug fix: if evaluating the expression of an UNFOLD operator fails, create no assignment --- .../sparql/engine/iterator/QueryIterUnfold.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 1f512244564..e3f14076753 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -34,6 +34,7 @@ import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.util.NodeFactoryExtra; @@ -63,7 +64,18 @@ public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, Execu @Override protected QueryIterator nextStage(Binding inputBinding) { - NodeValue nv = expr.eval( inputBinding, getExecContext() ); + final NodeValue nv; + try { + nv = expr.eval( inputBinding, getExecContext() ); + } + catch ( final ExprEvalException ex ) { + // If the expression failed to evaluate, we create no + // no assignment (exactly as in the case of BIND, see + // the 'accept' method in 'QueryIterAssign') + + return QueryIterSingleton.create( inputBinding, getExecContext() ); + } + Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); From 73ac3a9f7dc9a6421d1309f92319071ad2a0fe80 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:14:50 +0200 Subject: [PATCH 091/323] bug fix: if evaluating the expression of an UNFOLD operator does not result in a relevant literal, create no assignment --- .../apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e3f14076753..bb0a88067c7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,7 +19,6 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; -import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -89,7 +88,7 @@ protected QueryIterator nextStage(Binding inputBinding) { return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } - return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + return QueryIterSingleton.create( inputBinding, getExecContext() ); } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { From ff0fd1fb6d8d6f21de7b4db972d6a26fb5d667e6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 19:09:47 +0200 Subject: [PATCH 092/323] adds support for UNFOLDing of untyped maps --- .../engine/iterator/QueryIterUnfold.java | 251 ++++++++++++++---- 1 file changed, 204 insertions(+), 47 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index bb0a88067c7..571df3b3191 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -93,7 +94,7 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseUntypedList(String listAsValue) { @@ -105,7 +106,7 @@ protected Iterator parseUntypedList(String listAsValue) { protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseTypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseTypedList(String listAsValue) { @@ -114,7 +115,15 @@ protected Iterator parseTypedList(String listAsValue) { } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + Iterator> itMapElmts = parseUntypedMap(mapAsValue); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); + } + + protected Iterator> parseUntypedMap(String mapAsValue) { + if ( mapAsValue.startsWith("{") ) + mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); + + return parseMap(mapAsValue); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { @@ -138,9 +147,9 @@ public Node next() { n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); @@ -169,46 +178,136 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } + protected Iterator> parseMap(String mapAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator> itMapElmts = extractMapElements(mapAsValue); + return new Iterator<>() { + @Override + public boolean hasNext() { + return itMapElmts.hasNext(); + } + + @Override + public Map.Entry next() { + final Map.Entry mapElmt = itMapElmts.next(); + final String keyAsString = mapElmt.getKey(); + final String valueAsString = mapElmt.getValue(); + + final Node keyAsNode; + if ( pmap != null ) + keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); + else + keyAsNode = NodeFactoryExtra.parseNode(keyAsString); + + final Node valueAsNode; + if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + else if ( pmap != null ) + valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); + else + valueAsNode = NodeFactoryExtra.parseNode(valueAsString); + + return new Map.Entry<>() { + @Override public Node getKey() { return keyAsNode; } + @Override public Node getValue() { return valueAsNode; } + @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } + }; + } + }; + } + + protected Iterator> extractMapElements(String mapAsValue) { + mapAsValue = mapAsValue.strip(); + + if ( mapAsValue.isEmpty() ) { + return new Iterator>() { + @Override public boolean hasNext() { return false; } + @Override public Map.Entry next() { throw new NoSuchElementException(); } + }; + } + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + return new MapElementExtractor(mapAsValue); + } + - protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; - protected final Iterator itListElmts; + protected final Iterator itElmts; - public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.inputBinding = inputBinding; - this.itListElmts = itListElmts; + this.itElmts = itElmts; + } + + @Override + protected boolean hasNextBinding() { return itElmts.hasNext(); } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); } @Override public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("QueryIterUnfoldWorker"); + out.write("QueryIterUnfoldWorkerForLists"); } @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + return BindingFactory.binding( inputBinding, var1, itElmts.next() ); } + } - @Override - protected boolean hasNextBinding() { - return itListElmts.hasNext(); + + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); } @Override - protected void requestCancel() { } // nothing to do really + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorkerForMaps"); + } @Override - protected void closeIterator() { } // nothing to do really + protected Binding moveToNextBinding() { + final Map.Entry elmt = itElmts.next(); + if ( var2 == null ) + return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); + else + return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + } } - protected static class ListElementExtractor implements Iterator { - protected final String listAsString; + protected static abstract class ElementExtractorBase implements Iterator { + protected final String str; protected int cursor = 0; - protected String nextElmt = null; + private T nextElmt = null; - public ListElementExtractor( final String listAsString ) { - this.listAsString = listAsString.strip(); + protected ElementExtractorBase( final String str ) { + this.str = str.strip(); } @Override @@ -216,47 +315,35 @@ public boolean hasNext() { if ( nextElmt != null ) return true; - consumeWhiteSpace(); - if ( cursor >= listAsString.length() ) { - return false; - } - - final int nextElmtBegin = cursor; - if ( listAsString.charAt(cursor) == '[' ) { - advanceToEndOfSubList(); - } - else if ( listAsString.charAt(cursor) == '{' ) { - advanceToEndOfSubMap(); - } - advanceToNextCommaOrEnd(); - nextElmt = listAsString.substring(nextElmtBegin, cursor); - cursor++; // move cursor to after comma - return true; + nextElmt = produceNext(); + return ( nextElmt != null ); } @Override - public String next() { + public T next() { if ( ! hasNext() ) throw new NoSuchElementException(); - String r = nextElmt; + final T r = nextElmt; nextElmt = null; return r; } + protected abstract T produceNext(); + protected void consumeWhiteSpace() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + while ( cursor < str.length() && str.charAt(cursor) == ' ' ) cursor++; } protected void advanceToEndOfSubList() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + while ( cursor < str.length() && str.charAt(cursor) != ']' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -264,13 +351,13 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToEndOfSubMap() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + while ( cursor < str.length() && str.charAt(cursor) != '}' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -278,7 +365,77 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToNextCommaOrEnd() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + while ( cursor < str.length() && str.charAt(cursor) != ',' ) + cursor++; + } + } + + + protected static class ListElementExtractor extends ElementExtractorBase { + public ListElementExtractor( final String listAsString ) { + super(listAsString); + } + + @Override + public String produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextElmtBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextElmt = str.substring(nextElmtBegin, cursor).strip(); + cursor++; // move cursor to after comma + return nextElmt; + } + } + + + protected static class MapElementExtractor extends ElementExtractorBase> { + public MapElementExtractor( final String mapAsString ) { + super(mapAsString); + } + + @Override + public Map.Entry produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextKeyBegin = cursor; + advanceToNextColon(); + final String nextKey = str.substring(nextKeyBegin, cursor).strip(); + + cursor++; // move cursor to after colon + consumeWhiteSpace(); + final int nextValueBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextValue = str.substring(nextValueBegin, cursor).strip(); + cursor++; // move cursor to after comma + + return new Map.Entry<>() { + @Override public String getKey() { return nextKey; } + @Override public String getValue() { return nextValue; } + @Override public String setValue(String v) { throw new UnsupportedOperationException(); } + }; + } + + protected void advanceToNextColon() { + while ( cursor < str.length() && str.charAt(cursor) != ':' ) cursor++; } } From 736b4358448513d243b85c89915d875b1bda4c5c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 14:28:32 +0200 Subject: [PATCH 093/323] adds FOLD --- jena-arq/Grammar/arq.jj | 13 + .../jena/sparql/expr/aggregate/AggFold.java | 284 ++++++++++++++++++ .../sparql/expr/aggregate/AggregatorBase.java | 2 + .../expr/aggregate/AggregatorFactory.java | 4 + 4 files changed, 303 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 36120747f0c..622ced68856 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1624,6 +1624,17 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; { agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; } | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { String typeIRI1 = null ; + String typeIRI2 = null ; + Expr orderByExpr = null ; + Var orderByVar = null ; + int orderByDirection = Query.ORDER_DEFAULT ; } + + expr = Expression() ( typeIRI1 = iri() )? + ( expr2 = Expression() ( typeIRI2 = iri() )? )? + + { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } | t = { String iri ; } iri = iri() @@ -1824,6 +1835,8 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +| < FOLD: "fold" > +| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java new file mode 100644 index 00000000000..20d1eb03965 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -0,0 +1,284 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprLib; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.ExprNode; +import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprVisitor; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueString; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.graph.NodeTransform; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFold extends AggregatorBase +{ + protected final Expr expr1; // While the values of these member variables + protected final Expr expr2; // can also be extracted from the ExprList (see + protected final String typeIRI1; // createExprList below), keeping these copies + protected final String typeIRI2; // here makes it easier to access these values. + + public AggFold( final Expr expr1 ) { + this(expr1, null, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1 ) { + this(expr1, typeIRI1, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { + this(expr1, typeIRI1, expr2, null); + } + + public AggFold( final Expr expr1, final Expr expr2 ) { + this(expr1, null, expr2, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { + super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + + this.expr1 = expr1; + this.expr2 = expr2; + this.typeIRI1 = typeIRI1; + this.typeIRI2 = typeIRI2; + } + + protected static ExprList createExprList( final Expr expr1, final String typeIRI1, + final Expr expr2, final String typeIRI2 ) { + final ExprList l = new ExprList(expr1); + + if ( typeIRI1 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI1) ); + } + + if ( expr2 != null ) { + l.add(expr2); + } + + if ( typeIRI2 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI2) ); + } + + return l; + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() < 1 || exprs.size() > 6 ) + throw new IllegalArgumentException(); + + final Iterator it = exprs.iterator(); + final Expr _expr1 = it.next(); + + final Expr _expr2; + final String _typeIRI1; + final String _typeIRI2; + + Expr lookAhead = it.hasNext() ? it.next() : null; + // _typeIRI1 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI1 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI1 = null; + } + + // _expr2 + if ( lookAhead != null ) { + _expr2 = lookAhead; + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _expr2 = null; + } + + // _typeIRI2 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI2 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI2 = null; + } + + if ( lookAhead != null ) { + throw new IllegalArgumentException(); + } + + return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFold ) ) + return false; + final AggFold fold = (AggFold) other; + return exprList.equals(fold.exprList, bySyntax); + } + + @Override + public Accumulator createAccumulator() { + if ( expr2 == null ) + return new ListAccumulator(); + else + return new MapAccumulator(); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + int hc = HC_AggFold; + for ( final Expr e : getExprList() ) { + hc ^= e.hashCode(); + } + return hc; + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + ExprUtils.fmtSPARQL(out, expr1, sCxt); + + if ( typeIRI1 != null ) { + out.append( " TYPE " + typeIRI1 ); + } + + if ( expr2 != null ) { + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); + } + + if ( typeIRI2 != null ) { + out.append( " TYPE " + typeIRI2 ); + } + + out.append(")"); + return out.asString(); + } + + + protected static Expr dummyExprForType = new ExprNode() { + @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } + + @Override public int hashCode() { return -88888; } + + @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + + @Override public Expr copySubstitute(Binding binding) { return this; } + + @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + + @Override public NodeValue eval(Binding binding, FunctionEnv env) { + throw new InternalErrorException("Attempt to eval DummyExprForType"); + } + }; + + protected class ListAccumulator implements Accumulator { + final protected List list = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nv != null ) + list.add( nv.asNode() ); + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + return NodeValue.makeNode(n); + } + } + + protected class MapAccumulator implements Accumulator { + final protected List keys = new ArrayList<>(); + final protected List values = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( key != null && value != null ) { + keys.add( key.asNode() ); + values.add( value.asNode() ); + } + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! keys.isEmpty() ) { + final Iterator it = keys.iterator(); + final Iterator it2 = values.iterator(); + final Node firstKey = it.next(); + final Node firstValue = it2.next(); + final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); + final String firstValueAsString = NodeFmtLib.strTTL(firstValue); + sb.append(firstKeyAsString); + sb.append(" : "); + sb.append(firstValueAsString); + while ( it.hasNext() ) { + final Node nextKey = it.next(); + final Node nextValue = it2.next(); + final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); + final String nextValueAsString = NodeFmtLib.strTTL(nextValue); + sb.append(", "); + sb.append(nextKeyAsString); + sb.append(" : "); + sb.append(nextValueAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + return NodeValue.makeNode(n); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index d60edb1116d..a6869d915b4 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -187,4 +187,6 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; + protected static final int HC_AggFold = 0x186 ; + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index ee99bf43e8c..a7a81aa8729 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,6 +71,10 @@ public static Aggregator createAggNull() { return new AggNull() ; } + public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { + return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + } + public static Aggregator createCustom(String iri, Args a) { return createCustom(iri, a.distinct, ExprList.copy(a)) ; } From 47d0b94d1914b58d591350a7e1dc037b1c9f607d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 17:51:05 +0200 Subject: [PATCH 094/323] extends the implementation of FOLD to actually support the type arguments --- .../jena/sparql/expr/aggregate/AggFold.java | 155 ++++++++++++++---- 1 file changed, 120 insertions(+), 35 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 20d1eb03965..f7ee0f19410 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -3,33 +3,36 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.ExprNode; -import org.apache.jena.sparql.expr.ExprNone; -import org.apache.jena.sparql.expr.ExprVisitor; import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; -import org.apache.jena.sparql.graph.NodeTransform; import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; public class AggFold extends AggregatorBase { + protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); + protected final Expr expr1; // While the values of these member variables protected final Expr expr2; // can also be extracted from the ExprList (see - protected final String typeIRI1; // createExprList below), keeping these copies - protected final String typeIRI2; // here makes it easier to access these values. + protected final Node typeIRI1; // createExprList below), keeping these copies + protected final Node typeIRI2; // here makes it easier to access these values. public AggFold( final Expr expr1 ) { this(expr1, null, null, null); @@ -52,8 +55,8 @@ public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = typeIRI1; - this.typeIRI2 = typeIRI2; + this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; + this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } protected static ExprList createExprList( final Expr expr1, final String typeIRI1, @@ -61,7 +64,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI final ExprList l = new ExprList(expr1); if ( typeIRI1 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI1) ); } @@ -70,7 +73,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI } if ( typeIRI2 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI2) ); } @@ -91,7 +94,7 @@ public Aggregator copy( final ExprList exprs ) { Expr lookAhead = it.hasNext() ? it.next() : null; // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI1 = ((NodeValueString) lookAhead).getString(); @@ -114,7 +117,7 @@ public Aggregator copy( final ExprList exprs ) { } // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI2 = ((NodeValueString) lookAhead).getString(); @@ -168,6 +171,8 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { + final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); + final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); @@ -175,7 +180,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { ExprUtils.fmtSPARQL(out, expr1, sCxt); if ( typeIRI1 != null ) { - out.append( " TYPE " + typeIRI1 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI1, pmap) ); } if ( expr2 != null ) { @@ -184,29 +190,42 @@ public String asSparqlExpr( final SerializationContext sCxt ) { } if ( typeIRI2 != null ) { - out.append( " TYPE " + typeIRI2 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI2, pmap) ); } out.append(")"); return out.asString(); } + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); - protected static Expr dummyExprForType = new ExprNode() { - @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } - - @Override public int hashCode() { return -88888; } - - @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + WriterExpr.output(out, expr1, null); - @Override public Expr copySubstitute(Binding binding) { return this; } + if ( typeIRI1 != null ) { + out.append( " TYPE " ); + out.append( typeIRI1.toString() ); + } - @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + if ( expr2 != null ) { + out.append(", "); + WriterExpr.output(out, expr2, null); + } - @Override public NodeValue eval(Binding binding, FunctionEnv env) { - throw new InternalErrorException("Attempt to eval DummyExprForType"); + if ( typeIRI2 != null ) { + out.append( " TYPE " ); + out.append( typeIRI2.toString() ); } - }; + + out.decIndent(); + out.append(")"); + return out.asString(); + } protected class ListAccumulator implements Accumulator { final protected List list = new ArrayList<>(); @@ -214,13 +233,25 @@ protected class ListAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) - list.add( nv.asNode() ); + if ( nv != null ) { + final Node n = nv.asNode(); + if ( typeIRI1 != null ) { // check the type of the node + final String nTypeIRI; + if ( n.isLiteral() ) + nTypeIRI = n.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the node if it is not of the expected type + } + list.add(n); + } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("["); if ( ! list.isEmpty() ) { final Iterator it = list.iterator(); final Node firstNode = it.next(); @@ -233,7 +264,19 @@ public NodeValue getValue() { sb.append(nextNodeAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + sb.append("]"); + + final RDFDatatype datatype; + if ( typeIRI1 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + datatype = QueryIterUnfold.datatypeTypedList; + } + else { + datatype = QueryIterUnfold.datatypeUntypedList; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } @@ -244,17 +287,41 @@ protected class MapAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( key != null && value != null ) { - keys.add( key.asNode() ); - values.add( value.asNode() ); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvKey != null && nvValue != null ) { + final Node key = nvKey.asNode(); + final Node value = nvValue.asNode(); + + if ( typeIRI1 != null ) { // check the type of the key + final String nTypeIRI; + if ( key.isLiteral() ) + nTypeIRI = key.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the key is not of the expected type + } + + if ( typeIRI2 != null ) { // check the type of the value + final String nTypeIRI; + if ( value.isLiteral() ) + nTypeIRI = value.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI2.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the value is not of the expected type + } + + keys.add(key); + values.add(value); } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("{"); if ( ! keys.isEmpty() ) { final Iterator it = keys.iterator(); final Iterator it2 = values.iterator(); @@ -276,7 +343,25 @@ public NodeValue getValue() { sb.append(nextValueAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + sb.append("}"); + + final RDFDatatype datatype; + if ( typeIRI1 != null || typeIRI2 != null ) { + sb.append("^^"); + if ( typeIRI1 != null ) { + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + } + if ( typeIRI2 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI2) ); + } + datatype = QueryIterUnfold.datatypeTypedMap; + } + else { + datatype = QueryIterUnfold.datatypeUntypedMap; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } From 54a8f2a990a591d25e8757e9b96259c5bc2b73e9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 18:49:06 +0200 Subject: [PATCH 095/323] adds support for collection-related functions --- .../engine/iterator/QueryIterUnfold.java | 40 ++++++----- .../jena/sparql/function/ARQFunctions.java | 2 + .../CollectionLiteralFunctions.java | 10 +++ .../function/library/collection/SizeFct.java | 70 +++++++++++++++++++ 4 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 571df3b3191..e7bda9055a8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -93,45 +93,54 @@ protected QueryIterator nextStage(Binding inputBinding) { } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseUntypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = parseUntypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseUntypedList(String listAsValue) { + public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { if ( listAsValue.startsWith("[") ) listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseTypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator itListElmts = parseTypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseTypedList(String listAsValue) { + public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - Iterator> itMapElmts = parseUntypedMap(mapAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator> parseUntypedMap(String mapAsValue) { + public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { if ( mapAsValue.startsWith("{") ) mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - return parseMap(mapAsValue); + return parseMap(mapAsValue, pmap); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator parseList(String listAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { + mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); + return parseMap(mapAsValue, pmap); + } + + public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { final Iterator itListElmts = extractListElements(listAsValue); return new Iterator<>() { @Override @@ -160,7 +169,7 @@ else if ( pmap != null ) }; } - protected Iterator extractListElements(String listAsValue) { + public static Iterator extractListElements(String listAsValue) { listAsValue = listAsValue.strip(); if ( listAsValue.isEmpty() ) { @@ -178,8 +187,7 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } - protected Iterator> parseMap(String mapAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { final Iterator> itMapElmts = extractMapElements(mapAsValue); return new Iterator<>() { @Override @@ -222,7 +230,7 @@ else if ( pmap != null ) }; } - protected Iterator> extractMapElements(String mapAsValue) { + public static Iterator> extractMapElements(String mapAsValue) { mapAsValue = mapAsValue.strip(); if ( mapAsValue.isEmpty() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index a7452a464ae..2acb95dbf84 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -33,5 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); + CollectionLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java new file mode 100644 index 00000000000..f1bb072c595 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -0,0 +1,10 @@ +package org.apache.jena.sparql.function.library.collection; + +import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.FunctionRegistry; + +public class CollectionLiteralFunctions { + public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java new file mode 100644 index 00000000000..94a3f0748b7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -0,0 +1,70 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; + +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class SizeFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + final String datatypeURI = n.getLiteralDatatypeURI(); + final int size; + if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } + + return NodeValue.makeInteger(size); + } + + protected int determineSizeOfUntypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfUntypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineNumberOfElements( final Iterator it ) { + int i = 0; + while ( it.hasNext() ) { + i++; + it.next(); + } + return i; + } + +} From 48ba8a3a8885634fe0d9c15e06f9e0ec1e61380f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 17 Aug 2022 18:38:31 +0200 Subject: [PATCH 096/323] adds POC of a 'concat' function for lists --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ConcatFct.java | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index f1bb072c595..5beaeec3aa8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,5 +6,6 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java new file mode 100644 index 00000000000..4ccf1688fcb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -0,0 +1,87 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ConcatFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { + final String list1AsString = getInputListAsString(v1); + final String list2AsString = getInputListAsString(v2); +System.out.println("list1AsString " + list1AsString); +System.out.println("list2AsString " + list2AsString); + return createResultList(list1AsString, list2AsString); + } + + protected String getInputListAsString( final NodeValue v ) { + final Node n = v.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + v); + + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + throw new ExprEvalException("Literal with wrong datatype: " + v); + } + + return n.getLiteralLexicalForm(); + } + + protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { + final String resultListAsString = createResultListAsString(list1AsString, list2AsString); + final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + +System.out.println("resultListAsString " + resultListAsString); + final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + return NodeValue.makeNode(n); + } + + protected String createResultListAsString( final String list1AsString, final String list2AsString ) { + final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); + final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); + final Iterator it = new ConcatenatingIterator(it1, it2); + + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( it.hasNext() ) { + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + sb.append("]"); + + return sb.toString(); + } + + protected static class ConcatenatingIterator implements Iterator { + protected final Iterator it1; + protected final Iterator it2; + public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } + @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } + @Override public T next() { + if ( it1.hasNext() ) + return it1.next(); + else if ( it2.hasNext() ) + return it2.next(); + else + throw new NoSuchElementException(); + } + } + +} From bca1338feecc3bfb8bc81ebb7c055f1fc14e3d93 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 Aug 2022 11:57:06 +0200 Subject: [PATCH 097/323] creates Node_LiteralWithList and Node_LiteralWithMap, so far only as placeholders for adding special functionality for such types of literals --- .../engine/iterator/QueryIterUnfold.java | 40 +++++++------------ .../jena/sparql/expr/aggregate/AggFold.java | 11 ++--- .../library/collection/ConcatFct.java | 5 ++- .../function/library/collection/SizeFct.java | 10 +++-- .../jena/graph/Node_LiteralWithList.java | 19 +++++++++ .../jena/graph/Node_LiteralWithMap.java | 18 +++++++++ 6 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e7bda9055a8..e621756f764 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,10 +23,10 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -41,17 +41,7 @@ public class QueryIterUnfold extends QueryIterRepeatApply { - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - protected final Expr expr ; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; @@ -79,13 +69,13 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( datatypeUriUntypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriUntypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } @@ -153,13 +143,13 @@ public Node next() { final String listElmt = itListElmts.next(); final Node n; if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); else @@ -209,13 +199,13 @@ public Map.Entry next() { final Node valueAsNode; if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); else diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index f7ee0f19410..337d034c01f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -9,11 +9,12 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -270,10 +271,10 @@ public NodeValue getValue() { if ( typeIRI1 != null ) { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = QueryIterUnfold.datatypeTypedList; + datatype = Node_LiteralWithList.datatypeTypedList; } else { - datatype = QueryIterUnfold.datatypeUntypedList; + datatype = Node_LiteralWithList.datatypeUntypedList; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); @@ -355,10 +356,10 @@ public NodeValue getValue() { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI2) ); } - datatype = QueryIterUnfold.datatypeTypedMap; + datatype = Node_LiteralWithMap.datatypeTypedMap; } else { - datatype = QueryIterUnfold.datatypeUntypedMap; + datatype = Node_LiteralWithMap.datatypeUntypedMap; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 4ccf1688fcb..b9d1b3a6c79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; @@ -30,7 +31,7 @@ protected String getInputListAsString( final NodeValue v ) { throw new ExprEvalException("Not a literal: " + v); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { throw new ExprEvalException("Literal with wrong datatype: " + v); } @@ -39,7 +40,7 @@ protected String getInputListAsString( final NodeValue v ) { protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; System.out.println("resultListAsString " + resultListAsString); final Node n = NodeFactory.createLiteral(resultListAsString, datatype); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 94a3f0748b7..982d6b8e5a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -3,6 +3,8 @@ import java.util.Iterator; import org.apache.jena.graph.Node; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -19,16 +21,16 @@ public NodeValue exec( final NodeValue nv ) { final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); } else { diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java new file mode 100644 index 00000000000..37cb8ca1f3e --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java @@ -0,0 +1,19 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithList extends Node_Literal +{ + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + + public Node_LiteralWithList( final LiteralLabel label ) { + super(label); + } + + +} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java new file mode 100644 index 00000000000..27d5bef8656 --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java @@ -0,0 +1,18 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithMap extends Node_Literal +{ + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); + + public Node_LiteralWithMap( final LiteralLabel label ) { + super(label); + } + +} From e469c7ceaf6378ad936323d5525f42f20f67cfad Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 10:35:24 +0100 Subject: [PATCH 098/323] adds an actual parser for the lexical form of cdt:List and cdt:Map literals, and proper integration into the Jena Graph API (via special LiteralLabel implementations) --- jena-arq/Grammar/arq.jj | 11 +- jena-arq/Grammar/cdt_literals.jj | 366 ++++++ jena-arq/Grammar/grammarCDTs | 59 + .../java/org/apache/jena/cdt/CDTFactory.java | 68 ++ .../main/java/org/apache/jena/cdt/CDTKey.java | 62 + .../jena/cdt/CDTLiteralParseException.java | 31 + .../java/org/apache/jena/cdt/CDTValue.java | 100 ++ .../jena/cdt/CompositeDatatypeBase.java | 45 + .../jena/cdt/CompositeDatatypeList.java | 181 +++ .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 154 +++ .../apache/jena/cdt/LiteralLabelForList.java | 79 ++ .../apache/jena/cdt/LiteralLabelForMap.java | 79 ++ .../apache/jena/cdt/ParserForCDTLiterals.java | 155 +++ .../jena/cdt/parser/CDTLiteralParser.java | 570 +++++++++ .../cdt/parser/CDTLiteralParserConstants.java | 147 +++ .../parser/CDTLiteralParserTokenManager.java | 1045 +++++++++++++++++ .../jena/cdt/parser/JavaCharStream.java | 703 +++++++++++ .../jena/cdt/parser/ParseException.java | 205 ++++ .../org/apache/jena/cdt/parser/Token.java | 149 +++ .../apache/jena/cdt/parser/TokenMgrError.java | 167 +++ .../engine/iterator/QueryIterUnfold.java | 260 ++-- .../jena/sparql/expr/aggregate/AggFold.java | 266 +---- .../expr/aggregate/AggregatorFactory.java | 4 +- .../library/collection/ConcatFct.java | 96 +- .../function/library/collection/SizeFct.java | 76 +- .../jena/graph/Node_LiteralWithList.java | 19 - .../jena/graph/Node_LiteralWithMap.java | 18 - 28 files changed, 4741 insertions(+), 549 deletions(-) create mode 100644 jena-arq/Grammar/cdt_literals.jj create mode 100755 jena-arq/Grammar/grammarCDTs create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserConstants.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 622ced68856..40445623781 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1625,16 +1625,14 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { String typeIRI1 = null ; - String typeIRI2 = null ; - Expr orderByExpr = null ; + { Expr orderByExpr = null ; Var orderByVar = null ; int orderByDirection = Query.ORDER_DEFAULT ; } - expr = Expression() ( typeIRI1 = iri() )? - ( expr2 = Expression() ( typeIRI2 = iri() )? )? + expr = Expression() + ( expr2 = Expression() )? - { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } + { agg = AggregatorFactory.createFold(expr, expr2) ; } | t = { String iri ; } iri = iri() @@ -1836,7 +1834,6 @@ TOKEN [IGNORE_CASE] : | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > | < FOLD: "fold" > -| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj new file mode 100644 index 00000000000..eac97b2827e --- /dev/null +++ b/jena-arq/Grammar/cdt_literals.jj @@ -0,0 +1,366 @@ +/* + * 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. + */ + +options +{ + // Use \ u escapes in streams AND use a reader for the query + // => get both raw and escaped unicode + + JAVA_UNICODE_ESCAPE = true ; + UNICODE_INPUT = false ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + +PARSER_BEGIN(CDTLiteralParser) +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase +{ +} +PARSER_END(CDTLiteralParser) + +// --- Entry point + +void parse() : {} +{ + ( List() | Map() ) +} + +List List() : { List l = new ArrayList(); } +{ + + + ( ListElement(l) )? + + ( ListElement(l) )* + + // should we permit a trailing comma? + + + + { return l; } +} + +void ListElement(List l) : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } +| + n = BlankNode() { l.add( CDTFactory.createValue(n) ); } +| + n = RDFLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = NumericLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = BooleanLiteral() { l.add( CDTFactory.createValue(n) ); } +| + { l.add( CDTFactory.getNullValue() ); } +| + subList = List() { l.add( CDTFactory.createValue(subList) ); } +| + m = Map() { l.add( CDTFactory.createValue(m) ); } +} + +Map Map() : { Map m = new HashMap(); } +{ + + + ( MapEntry(m) )? + + ( MapEntry(m) )* + + + + { return m; } +} + +void MapEntry(Map m) : { CDTKey key; CDTValue value; } +{ + key = MapKey() + + + + value = MapValue() + + { + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) throw new ParseException("map with non-unique key (" + key.toString() + ")"); + } +} + +CDTKey MapKey() : { String iri; Node n; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } +| + n = BlankNode() { return CDTFactory.createKey(n); } +| + n = RDFLiteral() { return CDTFactory.createKey(n); } +| + n = NumericLiteral() { return CDTFactory.createKey(n); } +| + n = BooleanLiteral() { return CDTFactory.createKey(n); } +} + +CDTValue MapValue() : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } +| + n = BlankNode() { return CDTFactory.createValue(n); } +| + n = RDFLiteral() { return CDTFactory.createValue(n); } +| + n = NumericLiteral() { return CDTFactory.createValue(n); } +| + n = BooleanLiteral() { return CDTFactory.createValue(n); } +| + { return CDTFactory.getNullValue(); } +| + subList = List() { return CDTFactory.createValue(subList); } +| + m = Map() { return CDTFactory.createValue(m); } +} + + +// ---- Basic terms + +String IRI_REF() : { Token t ; } +{ + t = + { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } +} + +Node BlankNode() : { Token t = null ; } +{ + t = + + { + return createBNode(t.image, t.beginLine, t.beginColumn); + } +} + +Node NumericLiteral() : { Token t ; } +{ + t = { return createLiteralInteger(t.image); } +| t = { return createLiteralDecimal(t.image); } +| t = { return createLiteralDouble(t.image); } +} + +Node BooleanLiteral() : {} +{ + { return XSD_TRUE; } + | + { return XSD_FALSE; } +} + +Node RDFLiteral() : { String lex = null ; } +{ + lex = String() + // Optional lang tag and datatype. + { String lang = null ; String dt = null ; } + ( + lang = Langtag() + | + ( dt = IRI_REF() ) // divergence from the Turtle parser here; instead of IRIref(), we only permit IRI_REF() + )? + + { + return createLiteral(lex, lang, dt); + } +} + +String Langtag() : { Token t ; } +{ + t = // divergence from the Turtle parser here, which also permits AnyDirective() at this point + { String lang = stripChars(t.image, 1) ; return lang ; } +} + +String String() : { Token t ; String lex ; } +{ + ( t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + ) + { lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + return lex ; + } +} + + +// ------------------------------------------ +// Tokens + +// Comments and whitespace + +SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + +TOKEN: { <#WS: " " | "\t" | "\n" | "\r" | "\f"> } + + +// ------------------------------------------------- +// Keywords + +TOKEN [IGNORE_CASE] : +{ + < TRUE: "true" > +| < FALSE: "false" > + +// ------------------------------------------------- + +| < INTEGER: (["-","+"])? > +| + < DECIMAL: (["-","+"])? + (()+ "." ()* | "." ()+) + > + // Required exponent. +| < DOUBLE: + (["+","-"])? + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > +| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| < #QUOTE_3D: "\"\"\""> +| < #QUOTE_3S: "'''"> +// "u" done by javacc input stream. +// "U" escapes not supported yet for Java strings +| + +| < STRING_LITERAL1: + // Single quoted string + "'" ( (~["'","\\","\n","\r"]) | )* "'" > + +| < STRING_LITERAL2: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > + +| < STRING_LITERAL_LONG1: + + ( ~["'","\\"] | | ("'" ~["'"]) | ("''" ~["'"]))* + > + +| < STRING_LITERAL_LONG2: + + ( ~["\"","\\"] | | ("\"" ~["\""]) | ("\"\"" ~["\""]))* + > +| < DIGITS: (["0"-"9"])+> +// | +} + +TOKEN: +{ + // Includes # for relative URIs + ","<", "\"", "{", "}", "^", "\\", "|", "`", + "\u0000"-"\u0020"])* ">" > +| > +| ()+("-" ()+)* > +| <#A2Z: ["a"-"z","A"-"Z"]> +| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> +} + + +TOKEN : +{ + < NULL: "null" > + +| < LBRACE: "{" > +| < RBRACE: "}" > + +| < LBRACKET: "[" > +| < RBRACKET: "]" > + +| < COMMA: "," > +| < COLON: ":" > +} + +// Operator + +TOKEN : +{ + < DATATYPE: "^^"> +| < AT: "@"> +} + +TOKEN: +{ + <#PN_CHARS_BASE: + ["A"-"Z"] | ["a"-"z"] | + ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | + ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | + ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | + ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] + > + // [#x10000-#xEFFFF] +| + <#PN_CHARS_U: | "_" > +| +// No DOT + <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > +| + // With a leading "_", no dot at end of local name. + <#PN_LOCAL: ( | ["0"-"9"]) ((|".")* )? > +} + +// Catch-all tokens. Must be last. +// Any non-whitespace. Causes a parser exception, rather than a +// token manager error (with hidden line numbers). +// Only bad IRIs (e.g. spaces) now give unhelpful parse errors. +TOKEN: +{ + <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > +} + +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs new file mode 100755 index 00000000000..fb95f355e44 --- /dev/null +++ b/jena-arq/Grammar/grammarCDTs @@ -0,0 +1,59 @@ +#!/bin/bash +## 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. + +# Parser builder + +DIR="../src/main/java/org/apache/jena/cdt/parser" +FILE=cdt_literals.jj +CLASS=CDTLiteralParser + +(cd "$DIR" ; rm -f *.java ) + +echo "---- Process grammar ----" + +javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" + +RC=$? +[ "$RC" = 0 ] || return + +## echo "---- Create text form ----" +## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" + +echo "---- Fixing Java warnings in TokenMgrError" +F="$DIR/TokenMgrError.java" +if [ -e "$F" ] +then + sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic class TokenMgrError/' < $F > F + mv F $F +fi + +## JavaCharStream -- SimpleCharStream is OK. +echo "---- Fixing Java warnings in JavaCharStream..." +F="$DIR/JavaCharStream.java" +if [ -e "$F" ] +then + sed -e 's/public/\n@SuppressWarnings("all")\npublic/' < $F > F + mv F $F +fi + +echo "---- Fixing Java warnings in ${CLASS} ..." +F="$DIR/${CLASS}.java" +sed -e 's/@SuppressWarnings("serial")//' \ + < $F > F +mv F $F + +echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java new file mode 100644 index 00000000000..1c96d41b629 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -0,0 +1,68 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.graph.Node; + +public class CDTFactory +{ + public static CDTKey createKey( final Node n ) { + return new CDTKey() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final Node n ) { + return new CDTValue() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final List l ) { + return new CDTValue() { + @Override public boolean isList() { return true; } + @Override public List asList() { return l; } + }; + } + + public static CDTValue createValue( final Map m ) { + return new CDTValue() { + @Override public boolean isMap() { return true; } + @Override public Map asMap() { return m; } + }; + } + + public static CDTValue getNullValue() { + if ( nullValue == null ) { + return new CDTValue() { + @Override public boolean isNull() { return true; } + }; + } + + return nullValue; + } + + private static CDTValue nullValue = null; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java new file mode 100644 index 00000000000..32c455d1810 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.graph.Node; + +public abstract class CDTKey +{ + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public boolean equals( final Object other ) { + if ( !(other instanceof CDTKey) ) { + return false; + } + + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + + @Override + public String toString() { + if ( isNode() ) { + return asNode().toString(); + } + else { + return super.toString(); + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java new file mode 100644 index 00000000000..01325265fc1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.shared.JenaException; + +public class CDTLiteralParseException extends JenaException +{ + private static final long serialVersionUID = -6244204787118953600L; + + public CDTLiteralParseException() { super(); } + public CDTLiteralParseException(Throwable cause) { super(cause); } + public CDTLiteralParseException(String msg) { super(msg); } + public CDTLiteralParseException(String msg, Throwable cause) { super(msg, cause); } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java new file mode 100644 index 00000000000..e0bd1443def --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +public abstract class CDTValue extends CDTKey +{ + /** + * Returns true if this object is a list. In that case, {@link #asList()} + * can be used to get it as an actual {@link List} object. + */ + public boolean isList() { + return false; + } + + /** + * Returns true if this object is a map. In that case, {@link #asMap()} + * can be used to get it as an actual {@link Map} object. + */ + public boolean isMap() { + return false; + } + + /** + * Returns true if this is a null value. + */ + public boolean isNull() { + return false; + } + + /** + * Returns this object as a list, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public List asList() { + throw new UnsupportedOperationException( this + " is not a list" ); + } + + /** + * Returns this object as a map, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public Map asMap() { + throw new UnsupportedOperationException( this + " is not a map" ); + } + + @Override + public final boolean equals( final Object other ) { + if ( !(other instanceof CDTValue) ) { + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + else { + return false; + } + } + + if ( isNull() ) { + return false; + } + + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) { + return false; + } + + if ( isNode() && otherValue.isNode() ) { + return asNode().equals( otherValue.asNode() ); + } + else if ( isList() && otherValue.isList() ) { + return asList().equals( otherValue.asList() ); + } + else if ( isMap() && otherValue.isMap() ) { + return asMap().equals( otherValue.asMap() ); + } + else { + return false; + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java new file mode 100644 index 00000000000..ca5e1878c18 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -0,0 +1,45 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.datatypes.RDFDatatype; + +public abstract class CompositeDatatypeBase implements RDFDatatype +{ + @Override + public Class getJavaClass() { + return null; + } + + @Override + public Object cannonicalise( final Object value ) { + return value; + } + + @Override + public Object extendedTypeDefinition() { + return null; + } + + @Override + public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) { + return this; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java new file mode 100644 index 00000000000..9c43f8978c9 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -0,0 +1,181 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeList extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static CompositeDatatypeList type = new CompositeDatatypeList(); + + protected CompositeDatatypeList() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseList(list); + } + + public static String unparseList( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + public static String unparseListElement( final CDTValue elmt ) { + if ( elmt.isNode() ) + return NodeFmtLib.strTTL( elmt.asNode() ); + else if ( elmt.isList() ) + return unparseList( elmt.asList() ); + else if ( elmt.isMap() ) + return CompositeDatatypeMap.unparseMap( elmt.asMap() ); + else if ( elmt.isNull() ) + return "null"; + else + throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + } + + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + return parseList(lexicalForm); + } + + public static List parseList( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof List) ) { + return false; + } + + final List l = (List) value; + for ( final Object e : l ) { + if ( !(e instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForList objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForList makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForList ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final List list1 = getValue(value1); + final List list2 = getValue(value2); + + return list1.equals(list2); + } + + public static List getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseList(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java new file mode 100644 index 00000000000..4c71bd18569 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -0,0 +1,175 @@ +package org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeMap extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); + + protected CompositeDatatypeMap() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof Map) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + + return unparseMap(map); + } + + public static String unparseMap( final Map map ) { + final StringBuilder sb = new StringBuilder(); + sb.append("{"); + if ( ! map.isEmpty() ) { + final Iterator> it = map.entrySet().iterator(); + + final Map.Entry firstEntry = it.next(); + unparseMapEntry(firstEntry, sb); + + while ( it.hasNext() ) { + sb.append(", "); + + final Map.Entry nextEntry = it.next(); + unparseMapEntry(nextEntry, sb); + } + } + + sb.append("}"); + return sb.toString(); + } + + public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + if ( entry.getKey().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); + else + throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); + + sb.append(" : "); + + if ( entry.getValue().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); + else if ( entry.getValue().isList() ) + sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); + else if ( entry.getValue().isMap() ) + sb.append( unparseMap( entry.getValue().asMap() ) ); + else if ( entry.getValue().isNull() ) + sb.append( "null" ); + else + throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + return parseMap(lexicalForm); + } + + public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); + + return map1.equals(map2); + } + + public static Map getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return ( (LiteralLabelForMap) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseMap(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java new file mode 100644 index 00000000000..c5215fccdc2 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -0,0 +1,154 @@ +package org.apache.jena.cdt; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.rdf.model.impl.Util; + +public abstract class LiteralLabelForCDTs implements LiteralLabel +{ + protected final int hash; + + private T valueForm; + private String lexicalForm; + private boolean lexicalFormTested; + + public LiteralLabelForCDTs( final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = null; + + this.lexicalFormTested = true; + this.hash = valueForm.hashCode(); + } + + public LiteralLabelForCDTs( final String lexicalForm ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = false; + this.hash = lexicalForm.hashCode(); + } + + @Override + public boolean isXML() { + return false; + } + + @Override + public boolean isWellFormed() { + if ( lexicalFormTested ) { + return valueForm != null; + } + + try { + getValue(); + } + catch ( final DatatypeFormatException ex ) { + return false; + } + + return true; + } + + @Override + public boolean isWellFormedRaw() { + return isWellFormed(); + } + + @Override + public String toString( final boolean quoting ) { + final StringBuilder b = new StringBuilder(); + + if ( quoting ) b.append('"'); + + String lex = getLexicalForm(); + lex = Util.replace(lex, "\"", "\\\""); + b.append(lex); + + if ( quoting ) b.append('"'); + + b.append("^^").append( getDatatypeURI() ); + + return b.toString(); + } + + @Override + public String toString() { + return toString(false); + } + + @Override + public String getLexicalForm() { + if ( lexicalForm == null ) { + lexicalForm = unparseValueForm(valueForm); + } + + return lexicalForm; + } + + protected abstract String unparseValueForm( T valueForm ); + + protected boolean isLexicalFormSet() { + return lexicalForm != null; + } + + protected boolean isValueFormSet() { + return valueForm != null; + } + + @Override + public Object getIndexingValue() { + return getLexicalForm(); + } + + @Override + public String language() { + return ""; + } + + @Override + public T getValue() throws DatatypeFormatException { + if ( valueForm == null && ! lexicalFormTested ) { + lexicalFormTested = true; + + // The following function may fail with a DatatypeFormatException, + // in which case 'valueForm' will remain being 'null' but we won't + // try again at the next call of 'getValue()' because now we have + // set 'lexicalFormTested'. + + valueForm = parseLexicalForm(lexicalForm); + } + + return valueForm; + } + + protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { + return false; + } + + if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { + return true; + } + + return getValue().equals( other.getValue() ); + } + + @Override + public int getDefaultHashcode() { + return hash; + } + + @Override + public int hashCode() { + return hash; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java new file mode 100644 index 00000000000..bc626e0fd01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForList extends LiteralLabelForCDTs> +{ + public LiteralLabelForList( final List valueForm ) { + super(valueForm); + } + + public LiteralLabelForList( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( List valueForm ) { + return CompositeDatatypeList.unparseList(valueForm); + } + + @Override + protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeList.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForList ) { + final LiteralLabelForList otherListLiteral = (LiteralLabelForList) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherListLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherListLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherListLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java new file mode 100644 index 00000000000..1d5093e1da7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForMap extends LiteralLabelForCDTs> +{ + public LiteralLabelForMap( final Map valueForm ) { + super(valueForm); + } + + public LiteralLabelForMap( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( Map valueForm ) { + return CompositeDatatypeMap.unparseMap(valueForm); + } + + @Override + protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeMap.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForMap ) { + final LiteralLabelForMap otherMapLiteral = (LiteralLabelForMap) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherMapLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherMapLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherMapLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java new file mode 100644 index 00000000000..844bca2ed49 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -0,0 +1,155 @@ +/* + * 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 org.apache.jena.cdt; + +import java.io.InputStream; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.parser.CDTLiteralParser; +import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.ttl.turtle.parser.TokenMgrError; +import org.apache.jena.util.FileUtils; + +public class ParserForCDTLiterals +{ + public static List parseListLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static List parseListLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static List parseListLiteral( final Reader reader, final boolean recursive ) { + final List list; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + list = parser.List(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! list.isEmpty() ) { + for ( int i = 0; i < list.size(); i++ ) { + final CDTValue v = list.get(i); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subList) ); + } + else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subMap) ); + } + } + } + } + + return list; + } + + public static Map parseMapLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + final Map map; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + map = parser.Map(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! map.isEmpty() ) { + for ( final CDTKey key : map.keySet() ) { + final CDTValue v = map.get(key); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } + else if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subList) ); + } + } + } + } + + return map; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java new file mode 100644 index 00000000000..a41a068d605 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -0,0 +1,570 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParser.java */ +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { + +// --- Entry point + final public void parse() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACKET: + List(); + break; + case LBRACE: + Map(); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public List List() throws ParseException { + List l = new ArrayList(); + jj_consume_token(LBRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + case NULL: + case LBRACE: + case LBRACKET: + ListElement(l); + break; + default: + jj_la1[1] = jj_gen; + ; + } + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + jj_consume_token(COMMA); + ListElement(l); + } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void ListElement(List l) throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); l.add( CDTFactory.createValue(n) ); + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + l.add( CDTFactory.createValue(n) ); + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case NULL: + jj_consume_token(NULL); + l.add( CDTFactory.getNullValue() ); + break; + case LBRACKET: + subList = List(); + l.add( CDTFactory.createValue(subList) ); + break; + case LBRACE: + m = Map(); + l.add( CDTFactory.createValue(m) ); + break; + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public Map Map() throws ParseException { + Map m = new HashMap(); + jj_consume_token(LBRACE); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + MapEntry(m); + break; + default: + jj_la1[4] = jj_gen; + ; + } + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[5] = jj_gen; + break label_2; + } + jj_consume_token(COMMA); + MapEntry(m); + } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void MapEntry(Map m) throws ParseException { + CDTKey key; CDTValue value; + key = MapKey(); + jj_consume_token(COLON); + value = MapValue(); + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) {if (true) throw new ParseException("map with non-unique key (" + key.toString() + ")");} + } + + final public CDTKey MapKey() throws ParseException { + String iri; Node n; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createKey(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public CDTValue MapValue() throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createValue(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case NULL: + jj_consume_token(NULL); + {if (true) return CDTFactory.getNullValue();} + break; + case LBRACKET: + subList = List(); + {if (true) return CDTFactory.createValue(subList);} + break; + case LBRACE: + m = Map(); + {if (true) return CDTFactory.createValue(m);} + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + +// ---- Basic terms + final public String IRI_REF() throws ParseException { + Token t ; + t = jj_consume_token(IRIref); + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + throw new Error("Missing return statement in function"); + } + + final public Node BlankNode() throws ParseException { + Token t = null ; + t = jj_consume_token(BLANK_NODE_LABEL); + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn);} + throw new Error("Missing return statement in function"); + } + + final public Node NumericLiteral() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: + t = jj_consume_token(INTEGER); + {if (true) return createLiteralInteger(t.image);} + break; + case DECIMAL: + t = jj_consume_token(DECIMAL); + {if (true) return createLiteralDecimal(t.image);} + break; + case DOUBLE: + t = jj_consume_token(DOUBLE); + {if (true) return createLiteralDouble(t.image);} + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node BooleanLiteral() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + jj_consume_token(TRUE); + {if (true) return XSD_TRUE;} + break; + case FALSE: + jj_consume_token(FALSE); + {if (true) return XSD_FALSE;} + break; + default: + jj_la1[9] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node RDFLiteral() throws ParseException { + String lex = null ; + lex = String(); + String lang = null ; String dt = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + lang = Langtag(); + break; + case DATATYPE: + jj_consume_token(DATATYPE); + dt = IRI_REF(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[11] = jj_gen; + ; + } + {if (true) return createLiteral(lex, lang, dt);} + throw new Error("Missing return statement in function"); + } + + final public String Langtag() throws ParseException { + Token t ; + t = jj_consume_token(LANGTAG); + String lang = stripChars(t.image, 1) ; {if (true) return lang ;} + throw new Error("Missing return statement in function"); + } + + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: + t = jj_consume_token(STRING_LITERAL1); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL2: + t = jj_consume_token(STRING_LITERAL2); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL_LONG1: + t = jj_consume_token(STRING_LITERAL_LONG1); + lex = stripQuotes3(t.image) ; + break; + case STRING_LITERAL_LONG2: + t = jj_consume_token(STRING_LITERAL_LONG2); + lex = stripQuotes3(t.image) ; + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + {if (true) return lex ;} + throw new Error("Missing return statement in function"); + } + + /** Generated Token Manager. */ + public CDTLiteralParserTokenManager token_source; + JavaCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private int jj_gen; + final private int[] jj_la1 = new int[13]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static { + jj_la1_init_0(); + jj_la1_init_1(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + } + + /** Constructor with InputStream. */ + public CDTLiteralParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public CDTLiteralParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor. */ + public CDTLiteralParser(java.io.Reader stream) { + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor with generated Token Manager. */ + public CDTLiteralParser(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[40]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 13; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1<", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "\"\\f\"", + "", + "\"true\"", + "\"false\"", + "", + "", + "", + "", + "\"\\\"\\\"\\\"\"", + "\"\\\'\\\'\\\'\"", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\"null\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\",\"", + "\":\"", + "\"^^\"", + "\"@\"", + "", + "", + "", + "", + "", + }; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java new file mode 100644 index 00000000000..c7c080e9454 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -0,0 +1,1045 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParserTokenManager.java */ +/* + * 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 org.apache.jena.cdt.parser; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +/** Token Manager. */ +public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 9: + jjmatchedKind = 2; + return jjMoveNfa_0(0, 0); + case 10: + jjmatchedKind = 3; + return jjMoveNfa_0(0, 0); + case 12: + jjmatchedKind = 5; + return jjMoveNfa_0(0, 0); + case 13: + jjmatchedKind = 4; + return jjMoveNfa_0(0, 0); + case 32: + jjmatchedKind = 1; + return jjMoveNfa_0(0, 0); + case 44: + jjmatchedKind = 31; + return jjMoveNfa_0(0, 0); + case 58: + jjmatchedKind = 32; + return jjMoveNfa_0(0, 0); + case 64: + jjmatchedKind = 34; + return jjMoveNfa_0(0, 0); + case 70: + return jjMoveStringLiteralDfa1_0(0x100L); + case 84: + return jjMoveStringLiteralDfa1_0(0x80L); + case 91: + jjmatchedKind = 29; + return jjMoveNfa_0(0, 0); + case 93: + jjmatchedKind = 30; + return jjMoveNfa_0(0, 0); + case 94: + return jjMoveStringLiteralDfa1_0(0x200000000L); + case 102: + return jjMoveStringLiteralDfa1_0(0x100L); + case 110: + return jjMoveStringLiteralDfa1_0(0x4000000L); + case 116: + return jjMoveStringLiteralDfa1_0(0x80L); + case 123: + jjmatchedKind = 27; + return jjMoveNfa_0(0, 0); + case 125: + jjmatchedKind = 28; + return jjMoveNfa_0(0, 0); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 0); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 82: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 94: + if ((active0 & 0x200000000L) != 0L) + { + jjmatchedKind = 33; + jjmatchedPos = 1; + } + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 114: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); + default : + break; + } + return jjMoveNfa_0(0, 1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 1); + } + switch(curChar) + { + case 76: + return jjMoveStringLiteralDfa3_0(active0, 0x100L); + case 85: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x4000100L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + default : + break; + } + return jjMoveNfa_0(0, 2); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 2); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 2); + } + switch(curChar) + { + case 69: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 83: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + case 101: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 108: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 3; + } + break; + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + default : + break; + } + return jjMoveNfa_0(0, 3); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 3); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 3); + } + switch(curChar) + { + case 69: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + case 101: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 4); +} +static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { + 0xfffe7000fffffff6L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x7e00000000ffffffL +}; +static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec5 = { + 0x0L, 0xbfff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec6 = { + 0x3000L, 0xffff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec7 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L +}; +static final long[] jjbitVec8 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffL +}; +static final long[] jjbitVec9 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffffL +}; +static final long[] jjbitVec10 = { + 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec11 = { + 0xffffffffffffffffL, 0xbfffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec12 = { + 0x8000000000003000L, 0xffff000000000001L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int strKind = jjmatchedKind; + int strPos = jjmatchedPos; + int seenUpto; + input_stream.backup(seenUpto = curPos + 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error"); } + curPos = 0; + int startsAt = 0; + jjnewStateCnt = 74; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + } + else if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + else if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + else if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + else if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + else if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + if (curChar == 34) + jjCheckNAddStates(13, 15); + else if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 1: + if ((0x8400000000L & l) != 0L && kind > 15) + kind = 15; + break; + case 2: + if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 3: + if ((0xffffff7fffffdbffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 5: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 6: + if (curChar == 39 && kind > 16) + kind = 16; + break; + case 7: + if (curChar == 34) + jjCheckNAddStates(13, 15); + break; + case 8: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 10: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 11: + if (curChar == 34 && kind > 17) + kind = 17; + break; + case 12: + if (curChar == 39) + jjCheckNAddStates(19, 22); + break; + case 13: + case 17: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 15: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 16: + case 19: + if (curChar == 39) + jjCheckNAdd(17); + break; + case 18: + if (curChar == 39) + jjAddStates(23, 24); + break; + case 20: + if (curChar == 39 && kind > 18) + kind = 18; + break; + case 21: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 23: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 34) + jjCheckNAddStates(25, 28); + break; + case 25: + case 29: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 27: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 28: + case 31: + if (curChar == 34) + jjCheckNAdd(29); + break; + case 30: + if (curChar == 34) + jjAddStates(29, 30); + break; + case 32: + if (curChar == 34 && kind > 19) + kind = 19; + break; + case 33: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 34: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 35: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + break; + case 36: + if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + break; + case 37: + if ((0xaffffffa00000000L & l) != 0L) + jjCheckNAddTwoStates(37, 38); + break; + case 38: + if (curChar == 62 && kind > 21) + kind = 21; + break; + case 39: + if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 40: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x3ff200000000000L & l) != 0L && kind > 22) + kind = 22; + break; + case 46: + if (curChar == 45) + jjCheckNAdd(47); + break; + case 47: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 48: + if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + break; + case 49: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(49); + break; + case 50: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(50, 51); + break; + case 51: + if (curChar != 46) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 52: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 53: + if (curChar == 46) + jjCheckNAdd(54); + break; + case 54: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(54); + break; + case 55: + if (curChar == 46) + jjCheckNAdd(56); + break; + case 56: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(56, 57); + break; + case 58: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(59); + break; + case 59: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(59); + break; + case 60: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(31, 34); + break; + case 61: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(61, 62); + break; + case 62: + if (curChar == 46) + jjCheckNAddTwoStates(63, 64); + break; + case 63: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(63, 64); + break; + case 65: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(66); + break; + case 66: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(66); + break; + case 67: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(67, 68); + break; + case 69: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(70); + break; + case 70: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(70); + break; + case 71: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + break; + case 72: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 20) + kind = 20; + jjCheckNAdd(72); + break; + case 73: + if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + if (curChar == 64) + jjCheckNAdd(45); + else if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + else if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 1: + if ((0x14404410144044L & l) != 0L && kind > 15) + kind = 15; + break; + case 3: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 4: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 5: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 8: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 9: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 13: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 14: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 15: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 17: + jjCheckNAddStates(19, 22); + break; + case 25: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 26: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 27: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 29: + jjCheckNAddStates(25, 28); + break; + case 37: + if ((0xc7fffffeafffffffL & l) != 0L) + jjAddStates(35, 36); + break; + case 40: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x7fffffe87fffffeL & l) != 0L && kind > 22) + kind = 22; + break; + case 43: + if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 44: + if (curChar == 64) + jjCheckNAdd(45); + break; + case 45: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(45, 46); + break; + case 47: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 57: + if ((0x2000000020L & l) != 0L) + jjAddStates(37, 38); + break; + case 64: + if ((0x2000000020L & l) != 0L) + jjAddStates(39, 40); + break; + case 68: + if ((0x2000000020L & l) != 0L) + jjAddStates(41, 42); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 3: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(16, 18); + break; + case 8: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(13, 15); + break; + case 13: + case 17: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(19, 22); + break; + case 25: + case 29: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(25, 28); + break; + case 37: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(35, 36); + break; + case 40: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 22) + kind = 22; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 74 - (jjnewStateCnt = startsAt))) + break; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { break; } + } + if (jjmatchedPos > strPos) + return curPos; + + int toRet = Math.max(curPos, seenUpto); + + if (curPos < toRet) + for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; ) + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); } + + if (jjmatchedPos < strPos) + { + jjmatchedKind = strKind; + jjmatchedPos = strPos; + } + else if (jjmatchedPos == strPos && jjmatchedKind > strKind) + jjmatchedKind = strKind; + + return toRet; +} +static final int[] jjnextStates = { + 49, 50, 51, 61, 62, 67, 68, 72, 49, 50, 53, 55, 60, 8, 9, 11, + 3, 4, 6, 13, 14, 16, 18, 19, 21, 25, 26, 28, 30, 31, 33, 61, + 62, 67, 68, 37, 38, 58, 59, 65, 66, 69, 70, +}; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 3: + return ((jjbitVec5[i2] & l2) != 0L); + case 32: + return ((jjbitVec6[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec10[i2] & l2) != 0L); + case 3: + return ((jjbitVec11[i2] & l2) != 0L); + case 32: + return ((jjbitVec12[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +"\156\165\154\154", "\173", "\175", "\133", "\135", "\54", "\72", "\136\136", "\100", null, null, +null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0x7fcff8f81L, +}; +static final long[] jjtoSkip = { + 0x3eL, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[74]; +private final int[] jjstateSet = new int[148]; +protected char curChar; +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 74; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java new file mode 100644 index 00000000000..0db07c051d1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java @@ -0,0 +1,703 @@ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (with java-like unicode escape processing). + */ + + +@SuppressWarnings("all") +public +class JavaCharStream +{ + /** Whether parser is static. */ + +@SuppressWarnings("all") +public static final boolean staticFlag = false; + + static final int hexval(char c) throws java.io.IOException { + switch(c) + { + case '0' : + return 0; + case '1' : + return 1; + case '2' : + return 2; + case '3' : + return 3; + case '4' : + return 4; + case '5' : + return 5; + case '6' : + return 6; + case '7' : + return 7; + case '8' : + return 8; + case '9' : + return 9; + + case 'a' : + case 'A' : + return 10; + case 'b' : + case 'B' : + return 11; + case 'c' : + case 'C' : + return 12; + case 'd' : + case 'D' : + return 13; + case 'e' : + case 'E' : + return 14; + case 'f' : + case 'F' : + return 15; + } + + throw new java.io.IOException(); // Should never come here + } + +/** Position in buffer. */ + +@SuppressWarnings("all") +public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] nextCharBuf; + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int nextCharInd = -1; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, + 4096 - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + if (bufpos != 0) + { + --bufpos; + backup(0); + } + else + { + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + } + + protected char ReadByte() throws java.io.IOException + { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + +/** @return starting character for token. */ + +@SuppressWarnings("all") +public char BeginToken() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + tokenBegin = bufpos; + return buffer[bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + protected void AdjustBuffSize() + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = 0; + available = tokenBegin; + } + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + +@SuppressWarnings("all") +public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + char c; + + if (++bufpos == available) + AdjustBuffSize(); + + if ((buffer[bufpos] = c = ReadByte()) == '\\') + { + UpdateLineColumn(c); + + int backSlashCnt = 1; + + for (;;) // Read all the backslashes + { + if (++bufpos == available) + AdjustBuffSize(); + + try + { + if ((buffer[bufpos] = c = ReadByte()) != '\\') + { + UpdateLineColumn(c); + // found a non-backslash char. + if ((c == 'u') && ((backSlashCnt & 1) == 1)) + { + if (--bufpos < 0) + bufpos = bufsize - 1; + + break; + } + + backup(backSlashCnt); + return '\\'; + } + } + catch(java.io.IOException e) + { + // We are returning one backslash so we should only backup (count-1) + if (backSlashCnt > 1) + backup(backSlashCnt-1); + + return '\\'; + } + + UpdateLineColumn(c); + backSlashCnt++; + } + + // Here, we have seen an odd number of backslash's followed by a 'u' + try + { + while ((c = ReadByte()) == 'u') + ++column; + + buffer[bufpos] = c = (char)(hexval(c) << 12 | + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); + + column += 4; + } + catch(java.io.IOException e) + { + throw new Error("Invalid escape character at line " + line + + " column " + column + "."); + } + + if (backSlashCnt == 1) + return c; + else + { + backup(backSlashCnt - 1); + return '\\'; + } + } + else + { + UpdateLineColumn(c); + return c; + } + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + +@SuppressWarnings("all") +public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + +@SuppressWarnings("all") +public int getLine() { + return bufline[bufpos]; + } + +/** Get end column. */ + +@SuppressWarnings("all") +public int getEndColumn() { + return bufcolumn[bufpos]; + } + +/** Get end line. */ + +@SuppressWarnings("all") +public int getEndLine() { + return bufline[bufpos]; + } + +/** @return column of token start */ + +@SuppressWarnings("all") +public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + +/** @return line number of token start */ + +@SuppressWarnings("all") +public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Retreat. */ + +@SuppressWarnings("all") +public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + + /** @return token image as String */ + +@SuppressWarnings("all") +public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** @return suffix */ + +@SuppressWarnings("all") +public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Set buffers back to null when finished. */ + +@SuppressWarnings("all") +public void Done() + { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + +@SuppressWarnings("all") +public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=2ebc561fdb294979325bb97dfcdf1b61 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java new file mode 100644 index 00000000000..9fff7e2c63a --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java @@ -0,0 +1,205 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=0bd53902852438cd5670da2f50328753 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java new file mode 100644 index 00000000000..3e7793689f3 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java @@ -0,0 +1,149 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=0bb1e7330fe557a4194caa87be20ae38 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java new file mode 100644 index 00000000000..307f2e7efde --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java @@ -0,0 +1,167 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +/* + * 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 org.apache.jena.cdt.parser; + +/** Token Manager Error. */ + +@SuppressWarnings("all") +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=8d2f5d5473ff1b03e240576a846cb262 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e621756f764..d376b2ea921 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,11 +23,15 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; @@ -37,7 +41,6 @@ import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; -import org.apache.jena.sparql.util.NodeFactoryExtra; public class QueryIterUnfold extends QueryIterRepeatApply { @@ -69,174 +72,25 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) - return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) - return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) - return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) - return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( CompositeDatatypeList.uri.equals(dtURI) ) + return unfoldList( n.getLiteral(), inputBinding ); + if ( CompositeDatatypeMap.uri.equals(dtURI) ) + return unfoldMap( n.getLiteral(), inputBinding ); } return QueryIterSingleton.create( inputBinding, getExecContext() ); } - protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - final Iterator itListElmts = parseUntypedList(listAsValue, pmap); + protected QueryIterator unfoldList( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable itListElmts = CompositeDatatypeList.getValue(lit); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - - return parseList(listAsValue, pmap); + protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable> itMapEntries = CompositeDatatypeMap.getValue(lit).entrySet(); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } - protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator itListElmts = parseTypedList(listAsValue, pmap); - return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); - } - - public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { - listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue, pmap); - } - - protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { - if ( mapAsValue.startsWith("{") ) - mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - - return parseMap(mapAsValue, pmap); - } - - protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { - mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); - return parseMap(mapAsValue, pmap); - } - - public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { - final Iterator itListElmts = extractListElements(listAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itListElmts.hasNext(); - } - - @Override - public Node next() { - final String listElmt = itListElmts.next(); - final Node n; - if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); - else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - n = NodeFactoryExtra.parseNode(listElmt, pmap); - else - n = NodeFactoryExtra.parseNode(listElmt); - return n; - } - }; - } - - public static Iterator extractListElements(String listAsValue) { - listAsValue = listAsValue.strip(); - - if ( listAsValue.isEmpty() ) { - return new Iterator() { - @Override public boolean hasNext() { return false; } - @Override public String next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new ListElementExtractor(listAsValue); - } - - public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { - final Iterator> itMapElmts = extractMapElements(mapAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itMapElmts.hasNext(); - } - - @Override - public Map.Entry next() { - final Map.Entry mapElmt = itMapElmts.next(); - final String keyAsString = mapElmt.getKey(); - final String valueAsString = mapElmt.getValue(); - - final Node keyAsNode; - if ( pmap != null ) - keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); - else - keyAsNode = NodeFactoryExtra.parseNode(keyAsString); - - final Node valueAsNode; - if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); - else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); - else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); - else - valueAsNode = NodeFactoryExtra.parseNode(valueAsString); - - return new Map.Entry<>() { - @Override public Node getKey() { return keyAsNode; } - @Override public Node getValue() { return valueAsNode; } - @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } - }; - } - }; - } - - public static Iterator> extractMapElements(String mapAsValue) { - mapAsValue = mapAsValue.strip(); - - if ( mapAsValue.isEmpty() ) { - return new Iterator>() { - @Override public boolean hasNext() { return false; } - @Override public Map.Entry next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new MapElementExtractor(mapAsValue); - } protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { @@ -248,6 +102,10 @@ protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.itElmts = itElmts; } + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterable itElmts) { + this( inputBinding, itElmts.iterator() ); + } + @Override protected boolean hasNextBinding() { return itElmts.hasNext(); } @@ -259,9 +117,13 @@ protected void closeIterator() { } // nothing to do really } - protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); + } - public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterable itListElmts) { super(inputBinding, itListElmts); } @@ -272,14 +134,40 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itElmts.next() ); + final CDTValue nextElmt = itElmts.next(); + + if ( nextElmt.isNull() ) { + return inputBinding; + } + + final Node value; + if ( nextElmt.isNode() ) { + value = nextElmt.asNode(); + } + else if ( nextElmt.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); + value = NodeFactory.createLiteral(lit); + } + else if ( nextElmt.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); + value = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, value); } } - protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); + } - public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterable> itMapElmts) { super(inputBinding, itMapElmts); } @@ -290,11 +178,39 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - final Map.Entry elmt = itElmts.next(); - if ( var2 == null ) - return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); - else - return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + final Map.Entry elmt = itElmts.next(); + final CDTKey key = elmt.getKey(); + final CDTValue value = elmt.getValue(); + + final Node keyNode; + if ( key.isNode() ) { + keyNode = key.asNode(); + } + else { + throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); + } + + if ( value.isNull() ) { + return BindingFactory.binding( inputBinding, var1, keyNode ); + } + + final Node valueNode; + if ( value.isNode() ) { + valueNode = value.asNode(); + } + else if ( value.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( value.asList() ); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( value.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); + valueNode = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 337d034c01f..93f9a3fb87e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -1,26 +1,25 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.riot.system.PrefixMap; -import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; -import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; @@ -28,114 +27,43 @@ public class AggFold extends AggregatorBase { - protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); - - protected final Expr expr1; // While the values of these member variables - protected final Expr expr2; // can also be extracted from the ExprList (see - protected final Node typeIRI1; // createExprList below), keeping these copies - protected final Node typeIRI2; // here makes it easier to access these values. + protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see + protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. public AggFold( final Expr expr1 ) { - this(expr1, null, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1 ) { - this(expr1, typeIRI1, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { - this(expr1, typeIRI1, expr2, null); + this(expr1, null); } public AggFold( final Expr expr1, final Expr expr2 ) { - this(expr1, null, expr2, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { - super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; - this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } - protected static ExprList createExprList( final Expr expr1, final String typeIRI1, - final Expr expr2, final String typeIRI2 ) { + protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { final ExprList l = new ExprList(expr1); - if ( typeIRI1 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI1) ); - } - if ( expr2 != null ) { l.add(expr2); } - if ( typeIRI2 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI2) ); - } - return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 6 ) + if ( exprs.size() < 1 || exprs.size() > 2 ) throw new IllegalArgumentException(); final Iterator it = exprs.iterator(); final Expr _expr1 = it.next(); - final Expr _expr2; - final String _typeIRI1; - final String _typeIRI2; - Expr lookAhead = it.hasNext() ? it.next() : null; - // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI1 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI1 = null; - } - // _expr2 - if ( lookAhead != null ) { - _expr2 = lookAhead; - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _expr2 = null; - } + final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI2 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI2 = null; - } - - if ( lookAhead != null ) { - throw new IllegalArgumentException(); - } - - return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + return new AggFold(_expr1, _expr2); } @Override @@ -172,29 +100,17 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { - final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); - final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI1, pmap) ); - } - if ( expr2 != null ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI2, pmap) ); - } - out.append(")"); return out.asString(); } @@ -208,161 +124,71 @@ public String toPrefixString() { WriterExpr.output(out, expr1, null); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( typeIRI1.toString() ); - } - if ( expr2 != null ) { out.append(", "); WriterExpr.output(out, expr2, null); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( typeIRI2.toString() ); - } - out.decIndent(); out.append(")"); return out.asString(); } protected class ListAccumulator implements Accumulator { - final protected List list = new ArrayList<>(); + final protected List list = new ArrayList<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v; final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) { - final Node n = nv.asNode(); - if ( typeIRI1 != null ) { // check the type of the node - final String nTypeIRI; - if ( n.isLiteral() ) - nTypeIRI = n.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the node if it is not of the expected type - } - list.add(n); + if ( nv == null ) { + v = CDTFactory.getNullValue(); + } + else { + v = CDTFactory.createValue( nv.asNode() ); } + + list.add(v); } @Override public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); - } - } - sb.append("]"); - - final RDFDatatype datatype; - if ( typeIRI1 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = Node_LiteralWithList.datatypeTypedList; - } - else { - datatype = Node_LiteralWithList.datatypeUntypedList; - } - - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + final LiteralLabelForList lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } protected class MapAccumulator implements Accumulator { - final protected List keys = new ArrayList<>(); - final protected List values = new ArrayList<>(); + final protected Map map = new HashMap<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( nvKey != null && nvValue != null ) { - final Node key = nvKey.asNode(); - final Node value = nvValue.asNode(); - - if ( typeIRI1 != null ) { // check the type of the key - final String nTypeIRI; - if ( key.isLiteral() ) - nTypeIRI = key.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the key is not of the expected type - } - - if ( typeIRI2 != null ) { // check the type of the value - final String nTypeIRI; - if ( value.isLiteral() ) - nTypeIRI = value.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI2.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the value is not of the expected type - } - - keys.add(key); - values.add(value); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nvKey == null ) { + return; // ignore if creating the key using the given binding failed } - } - @Override - public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("{"); - if ( ! keys.isEmpty() ) { - final Iterator it = keys.iterator(); - final Iterator it2 = values.iterator(); - final Node firstKey = it.next(); - final Node firstValue = it2.next(); - final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); - final String firstValueAsString = NodeFmtLib.strTTL(firstValue); - sb.append(firstKeyAsString); - sb.append(" : "); - sb.append(firstValueAsString); - while ( it.hasNext() ) { - final Node nextKey = it.next(); - final Node nextValue = it2.next(); - final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); - final String nextValueAsString = NodeFmtLib.strTTL(nextValue); - sb.append(", "); - sb.append(nextKeyAsString); - sb.append(" : "); - sb.append(nextValueAsString); - } - } - sb.append("}"); - - final RDFDatatype datatype; - if ( typeIRI1 != null || typeIRI2 != null ) { - sb.append("^^"); - if ( typeIRI1 != null ) { - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - } - if ( typeIRI2 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI2) ); - } - datatype = Node_LiteralWithMap.datatypeTypedMap; + final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); + + // TODO: what do we do if the map already contains an entry with the same key? + + final CDTValue value; + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvValue == null ) { + value = CDTFactory.getNullValue(); } else { - datatype = Node_LiteralWithMap.datatypeUntypedMap; + value = CDTFactory.createValue( nvValue.asNode() ); } - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + map.put(key, value); + } + + @Override + public NodeValue getValue() { + final LiteralLabelForMap lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index a7a81aa8729..d11f16dfde9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,8 +71,8 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { - return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + public static Aggregator createFold(Expr expr1, Expr expr2) { + return new AggFold(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index b9d1b3a6c79..c950980ac3c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,14 +1,15 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; -import java.util.NoSuchElementException; +import java.util.ArrayList; +import java.util.List; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -17,71 +18,40 @@ public class ConcatFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final String list1AsString = getInputListAsString(v1); - final String list2AsString = getInputListAsString(v2); -System.out.println("list1AsString " + list1AsString); -System.out.println("list2AsString " + list2AsString); - return createResultList(list1AsString, list2AsString); - } - - protected String getInputListAsString( final NodeValue v ) { - final Node n = v.asNode(); - - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + v); - - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - throw new ExprEvalException("Literal with wrong datatype: " + v); - } - - return n.getLiteralLexicalForm(); - } + final List list1 = getInputList(v1); + final List list2 = getInputList(v2); - protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { - final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; + final List result = new ArrayList<>(); + result.addAll(list1); + result.addAll(list2); -System.out.println("resultListAsString " + resultListAsString); - final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } - protected String createResultListAsString( final String list1AsString, final String list2AsString ) { - final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); - final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); - final Iterator it = new ConcatenatingIterator(it1, it2); + protected List getInputList( final NodeValue nv ) { + final Node n = nv.asNode(); - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( it.hasNext() ) { - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + return CompositeDatatypeList.parseList(lex); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); } } - sb.append("]"); - - return sb.toString(); - } - - protected static class ConcatenatingIterator implements Iterator { - protected final Iterator it1; - protected final Iterator it2; - public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } - @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } - @Override public T next() { - if ( it1.hasNext() ) - return it1.next(); - else if ( it2.hasNext() ) - return it2.next(); - else - throw new NoSuchElementException(); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 982d6b8e5a6..b4f76e2565f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -1,11 +1,12 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; - +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -19,54 +20,33 @@ public NodeValue exec( final NodeValue nv ) { if ( ! n.isLiteral() ) throw new ExprEvalException("Not a literal: " + nv); - final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { - size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { - size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { - size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + size = ( (LiteralLabelForList) lit ).getValue().size(); + } + else if ( lit instanceof LiteralLabelForMap ) { + size = ( (LiteralLabelForMap) lit ).getValue().size(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeList.parseList(lex).size(); + } + else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeMap.parseMap(lex).size(); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } return NodeValue.makeInteger(size); } - protected int determineSizeOfUntypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfUntypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineNumberOfElements( final Iterator it ) { - int i = 0; - while ( it.hasNext() ) { - i++; - it.next(); - } - return i; - } - } diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java deleted file mode 100644 index 37cb8ca1f3e..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithList extends Node_Literal -{ - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - - public Node_LiteralWithList( final LiteralLabel label ) { - super(label); - } - - -} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java deleted file mode 100644 index 27d5bef8656..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithMap extends Node_Literal -{ - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - public Node_LiteralWithMap( final LiteralLabel label ) { - super(label); - } - -} From 4613165907423577353dccd90674331197aabbeb Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 11:14:29 +0100 Subject: [PATCH 099/323] updating the URI prefix 'cdt:' --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- .../src/main/java/org/apache/jena/sparql/ARQConstants.java | 3 +++ .../library/collection/CollectionLiteralFunctions.java | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 9c43f8978c9..8c1ac8b74de 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -27,7 +27,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 4c71bd18569..a148cc166e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -9,7 +9,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index 8f6ac06a24c..4428b80c65d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -80,6 +80,9 @@ public class ARQConstants /** URI scheme that triggers the loader to load a java class */ public static final String javaClassURIScheme = "java:" ; + /** The ARQ function library URI space */ + public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 5beaeec3aa8..fe5f8956bf8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,7 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } } From 4b887b9529fe19edf156889e42541b3b60d6e108 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 13:09:21 +0100 Subject: [PATCH 100/323] adds the constructor function cdt:List --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/ListFct.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index fe5f8956bf8..98a1e89e37c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,6 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java new file mode 100644 index 00000000000..420ab788576 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -0,0 +1,37 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class ListFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + // nothing to do here + } + + @Override + public NodeValue exec( final List args ) { + final List list = new ArrayList<>( args.size() ); + + for ( final NodeValue nv : args ) { + final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From d5d1f5d783b23d2bd1508866f08acb6ee41c3892 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 16:16:18 +0100 Subject: [PATCH 101/323] adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL --- .../apache/jena/sparql/expr/NodeValue.java | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 8296676f73e..e87b8f3b727 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -32,6 +32,8 @@ import org.apache.jena.atlas.lib.DateTimeUtils ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.cdt.CompositeDatatypeList ; +import org.apache.jena.cdt.CompositeDatatypeMap ; import org.apache.jena.datatypes.DatatypeFormatException ; import org.apache.jena.datatypes.RDFDatatype ; import org.apache.jena.datatypes.TypeMapper ; @@ -429,8 +431,128 @@ public boolean isTripleTerm() { return node.isNodeTriple() ; } +<<<<<<< HEAD public ValueSpace getValueSpace() { return classifyValueSpace(this); +======= + // ---------------------------------------------------------------- + // ---- sameValueAs + + // Disjoint value spaces : dateTime and dates are not comparable + // Every langtag implies another value space as well. + + /** Return true if the two NodeValues are known to be the same value + * return false if known to be different values, + * throw ExprEvalException otherwise + */ + public static boolean sameAs(NodeValue nv1, NodeValue nv2) + { + if ( nv1 == null || nv2 == null ) + throw new ARQInternalErrorException("Attempt to sameValueAs on a null") ; + + ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; + + // Special case - date/dateTime comparison is affected by timezones and may be + // indeterminate based on the value of the dateTime/date. + + switch (compType) + { + case VSPACE_NUM: + return XSDFuncOp.compareNumeric(nv1, nv2) == Expr.CMP_EQUAL ; + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_DAY : + { + int x = XSDFuncOp.compareDateTime(nv1, nv2) ; + if ( x == Expr.CMP_INDETERMINATE ) + throw new ExprNotComparableException("Indeterminate dateTime comparison") ; + return x == Expr.CMP_EQUAL ; + } + case VSPACE_DURATION: + { + int x = XSDFuncOp.compareDuration(nv1, nv2) ; + if ( x == Expr.CMP_INDETERMINATE ) + throw new ExprNotComparableException("Indeterminate duration comparison") ; + return x == Expr.CMP_EQUAL ; + } + + case VSPACE_STRING: return XSDFuncOp.compareString(nv1, nv2) == Expr.CMP_EQUAL ; + case VSPACE_BOOLEAN: return XSDFuncOp.compareBoolean(nv1, nv2) == Expr.CMP_EQUAL ; + + case VSPACE_TRIPLE_TERM: { + Triple t1 = nv1.getNode().getTriple(); + Triple t2 = nv2.getNode().getTriple(); + return nSameAs(t1.getSubject(), t2.getSubject()) + && nSameAs(t1.getPredicate(), t2.getPredicate()) + && nSameAs(t1.getObject(), t2.getObject()); + } + + case VSPACE_LANG: + case VSPACE_NODE: + // Two non-literals + return NodeFunctions.sameTerm(nv1.getNode(), nv2.getNode()) ; + + case VSPACE_UNKNOWN: + { + // One or two unknown value spaces, or one has a lang tag (but not both). + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + + if ( ! SystemARQ.ValueExtensions ) + // No value extensions => raw rdfTermEquals + return NodeFunctions.rdfTermEquals(node1, node2) ; + + // Some "value spaces" are know to be not equal (no overlap). + // Like one literal with a language tag, and one without can't be sameAs. + + if ( ! node1.isLiteral() || ! node2.isLiteral() ) + // Can't both be non-literals - that's VSPACE_NODE + // One or other not a literal => not sameAs + return false ; + + // Two literals at this point. + + if ( NodeFunctions.sameTerm(node1, node2) ) + return true ; + + if ( ! node1.getLiteralLanguage().equals("") || + ! node2.getLiteralLanguage().equals("") ) + // One had lang tag but weren't sameNode => not equals + return false ; + + raise(new ExprEvalException("Unknown equality test: "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("raise returned (sameValueAs)") ; + } + case VSPACE_SORTKEY: + return nv1.getSortKey().compareTo(nv2.getSortKey()) == 0 ; + + case VSPACE_DIFFERENT: + // Known to be incompatible. + if ( ! SystemARQ.ValueExtensions && ( nv1.isLiteral() && nv2.isLiteral() ) ) + raise(new ExprEvalException("Incompatible: "+nv1+" and "+nv2)) ; + return false ; + + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeList.type.isEqual(lit1, lit2) ; + } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; + } + } + + throw new ARQInternalErrorException("sameValueAs failure "+nv1+" and "+nv2) ; +>>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { @@ -478,6 +600,7 @@ public static boolean notSameValueAs(NodeValue nv1, NodeValue nv2) { return NodeValueCmp.notSameValueAs(nv1, nv2); } +<<<<<<< HEAD // ---------------------------------------------------------------- // compare @@ -507,6 +630,17 @@ public static int compare(NodeValue nv1, NodeValue nv2) { public static int compareAlways(NodeValue nv1, NodeValue nv2) { //return NodeValueCompare.compareAlways(nv1, nv2); return NodeValueCmp.compareAlways(nv1, nv2); +======= + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; + if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; + } + + if ( NodeUtils.hasLang(nv.asNode()) ) + return VSPACE_LANG ; + return VSPACE_UNKNOWN ; +>>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } // ---------------------------------------------------------------- From 5c55d9e91d7ee12308be1051ce788bbfa23168b1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 21:19:37 +0100 Subject: [PATCH 102/323] correct recursive implementation of 'equals' in 'CDTValue' --- .../main/java/org/apache/jena/cdt/CDTKey.java | 8 +- .../java/org/apache/jena/cdt/CDTValue.java | 83 ++++++++++++++++--- .../jena/cdt/CompositeDatatypeList.java | 25 +++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 20 +++++ 4 files changed, 120 insertions(+), 16 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 32c455d1810..53f4246c1a1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -42,12 +42,12 @@ public Node asNode() { @Override public boolean equals( final Object other ) { - if ( !(other instanceof CDTKey) ) { - return false; + if ( other instanceof CDTKey ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); } - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + return false; } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index e0bd1443def..5d2dcd70394 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -21,6 +21,9 @@ import java.util.List; import java.util.Map; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; + public abstract class CDTValue extends CDTKey { /** @@ -64,6 +67,10 @@ public Map asMap() { @Override public final boolean equals( final Object other ) { + if ( isNull() ) { + return false; + } + if ( !(other instanceof CDTValue) ) { if ( other instanceof CDTKey && isNode() ) { final CDTKey otherKey = (CDTKey) other; @@ -74,27 +81,81 @@ public final boolean equals( final Object other ) { } } - if ( isNull() ) { + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) return false; + + if ( isNode() ) return isEqual( asNode(), otherValue ); + + if ( isList() ) return isEqual( asList(), otherValue ); + + if ( isMap() ) return isEqual( asMap(), otherValue ); + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + + public static boolean isEqual( final Node n1, final CDTValue v2 ) { + if ( CompositeDatatypeList.isListLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isList() ) { + return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); + } + return false; } - final CDTValue otherValue = (CDTValue) other; + if ( CompositeDatatypeMap.isMapLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isMap() ) { + return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + } - if ( otherValue.isNull() ) { return false; } - if ( isNode() && otherValue.isNode() ) { - return asNode().equals( otherValue.asNode() ); + if ( v2.isNode() ) { + return v2.asNode().equals(n1); } - else if ( isList() && otherValue.isList() ) { - return asList().equals( otherValue.asList() ); + + return false; + } + + public static boolean isEqual( final List list1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.getValue(lit2).equals(list1); } - else if ( isMap() && otherValue.isMap() ) { - return asMap().equals( otherValue.asMap() ); + + if ( v2.isList() ) { + return v2.asList().equals(list1); } - else { - return false; + + return false; + } + + public static boolean isEqual( final Map map1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeMap.getValue(lit2).equals(map1); } + + if ( v2.isMap() ) { + return v2.asMap().equals(map1); + } + + return false; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 8c1ac8b74de..15ff18434f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -150,11 +151,33 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - +System.out.println("list1"); +System.out.println(list1); +System.out.println("list2"); +System.out.println(list2); return list1.equals(list2); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index a148cc166e2..784cf6bfaf4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -4,6 +4,7 @@ import java.util.Map; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -144,6 +145,25 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Map map1 = getValue(value1); From 61d51088e06e14c6d6ad27854c6dc12ba9a3922c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 09:46:50 +0100 Subject: [PATCH 103/323] adds the cdt:contains function --- .../main/java/org/apache/jena/cdt/CDTKey.java | 6 +- .../java/org/apache/jena/cdt/CDTValue.java | 5 +- .../apache/jena/cdt/ParserForCDTLiterals.java | 33 ++--- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsFct.java | 130 ++++++++++++++++++ 5 files changed, 155 insertions(+), 20 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 53f4246c1a1..d42794c877b 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -44,7 +45,10 @@ public Node asNode() { public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + + final NodeValue thisNV = NodeValue.makeNode( asNode() ); + final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); + return NodeValue.sameAs(thisNV, otherNV); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5d2dcd70394..5dd74a0bce6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -23,6 +23,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTValue extends CDTKey { @@ -126,7 +127,9 @@ public static boolean isEqual( final Node n1, final CDTValue v2 ) { } if ( v2.isNode() ) { - return v2.asNode().equals(n1); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + return NodeValue.sameAs(nv1, nv2); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 844bca2ed49..645cfa15a38 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -27,6 +27,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.graph.Node; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -73,16 +74,14 @@ public static List parseListLiteral( final Reader reader, final boolea if ( recursive && ! list.isEmpty() ) { for ( int i = 0; i < list.size(); i++ ) { final CDTValue v = list.get(i); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -133,18 +132,16 @@ public static Map parseMapLiteral( final Reader reader, final b if ( recursive && ! map.isEmpty() ) { for ( final CDTKey key : map.keySet() ) { final CDTValue v = map.get(key); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); - map.put( key, CDTFactory.createValue(subMap) ); - } - else if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } } } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 98a1e89e37c..afa7c7e2f77 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -8,5 +8,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java new file mode 100644 index 00000000000..a940b91bf33 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -0,0 +1,130 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + final Node n2 = nv2.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + final boolean result; + if ( CompositeDatatypeList.isListLiteral(n2) ) { + result = containsList( list, n2.getLiteral() ); + } + else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { + result = containsMap( list, n2.getLiteral() ); + } + else { + result = containsNode( list, nv2 ); + } + + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term, assuming + * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + */ + protected boolean containsNode( final List list, final NodeValue n ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + final NodeValue vv = NodeValue.makeNode( v.asNode() ); + if ( NodeValue.sameAs(vv,n) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the list represented by + * the given cdt:List literal (i.e., assumes that the given literal + * is a cdt:List literal). + */ + protected boolean containsList( final List list, final LiteralLabel lit ) { + // get the list for the literal only if needed + List otherList = null; + + for ( final CDTValue v : list ) { + final List vList; + if ( v.isList() ) { + vList = v.asList(); + } + else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { + vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); + } + else { + vList = null; + } + + if ( vList != null ) { + // now we need to get the list + if ( otherList == null ) { + otherList = CompositeDatatypeList.getValue(lit); + } + + if ( vList.equals(otherList) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the map represented by + * the given cdt:Map literal (i.e., assumes that the given literal + * is a cdt:Map literal). + */ + protected boolean containsMap( final List list, final LiteralLabel lit) { + // get the map for the literal only if needed + Map otherMap = null; + + for ( final CDTValue v : list ) { + final Map vMap; + if ( v.isMap() ) { + vMap = v.asMap(); + } + else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { + vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); + } + else { + vMap = null; + } + + if ( vMap != null ) { + // now we need to get the map + if ( otherMap == null ) { + otherMap = CompositeDatatypeMap.getValue(lit); + } + + if ( vMap.equals(otherMap) ) { + return true; + } + } + } + + return false; + } +} From ec226f9759dba41e4c95a0bd7439e578d80d745b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:03:55 +0100 Subject: [PATCH 104/323] remove debug printing --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15ff18434f2..3a9b0b9cad8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -174,10 +174,6 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); -System.out.println("list1"); -System.out.println(list1); -System.out.println("list2"); -System.out.println(list2); return list1.equals(list2); } From e2afad335ded0cd79bf667431bdd44eec583310c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:05:01 +0100 Subject: [PATCH 105/323] adds CDTLiteralParserBase to create special Node objects for cdt:List literals and cdt:Map literals --- jena-arq/Grammar/cdt_literals.jj | 3 +-- .../apache/jena/cdt/CDTLiteralParserBase.java | 25 +++++++++++++++++++ .../jena/cdt/parser/CDTLiteralParser.java | 3 +-- .../parser/CDTLiteralParserTokenManager.java | 1 - 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index eac97b2827e..5ee872ef62e 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -57,9 +57,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase +public class CDTLiteralParser extends CDTLiteralParserBase { } PARSER_END(CDTLiteralParser) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java new file mode 100644 index 00000000000..737aaf509eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -0,0 +1,25 @@ +package org.apache.jena.cdt; + +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParserBase extends TurtleParserBase +{ + @Override + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final LiteralLabel lit = new LiteralLabelForList(lex); + return NodeFactory.createLiteral(lit); + } + + if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final LiteralLabel lit = new LiteralLabelForMap(lex); + return NodeFactory.createLiteral(lit); + } + + return super.createLiteral(lex, langTag, datatypeURI); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index a41a068d605..832cc84b276 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -26,9 +26,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { +public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point final public void parse() throws ParseException { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index c7c080e9454..bcf9c3cb8e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From bd68c993e0b8596fb650cdb5986972e66ee15c85 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:12:07 +0100 Subject: [PATCH 106/323] bug fix: avoid NPE --- .../main/java/org/apache/jena/cdt/CDTLiteralParserBase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 737aaf509eb..e42b9c339d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -9,12 +9,12 @@ public class CDTLiteralParserBase extends TurtleParserBase { @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); } - if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForMap(lex); return NodeFactory.createLiteral(lit); } From 8522b3dc473c216bbf67537e762023baa7f314d3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 19 Nov 2022 16:32:34 +0100 Subject: [PATCH 107/323] bug fix in the CDT grammar (it was possible to have lists that begin with a comma) --- jena-arq/Grammar/cdt_literals.jj | 33 ++++--- jena-arq/Grammar/grammarCDTs | 10 ++- .../jena/cdt/parser/CDTLiteralParser.java | 86 +++++++++---------- 3 files changed, 67 insertions(+), 62 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 5ee872ef62e..514be16467b 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -63,28 +63,26 @@ public class CDTLiteralParser extends CDTLiteralParserBase } PARSER_END(CDTLiteralParser) -// --- Entry point - -void parse() : {} -{ - ( List() | Map() ) -} +// --- Entry point for cdt:List literals List List() : { List l = new ArrayList(); } { - ( ListElement(l) )? - - ( ListElement(l) )* - - // should we permit a trailing comma? + ( NonEmptyListContent(l) )? { return l; } } +void NonEmptyListContent(List l) : { } +{ + ListElement(l) + + ( ListElement(l) )* +} + void ListElement(List l) : { String iri; Node n; List subList; Map m; } { iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } @@ -104,19 +102,26 @@ void ListElement(List l) : { String iri; Node n; List subLis m = Map() { l.add( CDTFactory.createValue(m) ); } } +// --- Entry point for cdt:Map literals + Map Map() : { Map m = new HashMap(); } { - ( MapEntry(m) )? - - ( MapEntry(m) )* + ( NonEmptyMapContent(m) )? { return m; } } +void NonEmptyMapContent(Map m) : { } +{ + MapEntry(m) + + ( MapEntry(m) )* +} + void MapEntry(Map m) : { CDTKey key; CDTValue value; } { key = MapKey() diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs index fb95f355e44..8bbaf8685d4 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/grammarCDTs @@ -30,8 +30,8 @@ javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" RC=$? [ "$RC" = 0 ] || return -## echo "---- Create text form ----" -## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" +echo "---- Create text form ----" +jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" echo "---- Fixing Java warnings in TokenMgrError" F="$DIR/TokenMgrError.java" @@ -56,4 +56,10 @@ sed -e 's/@SuppressWarnings("serial")//' \ < $F > F mv F $F +echo "---- Create HTML form ----" +./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html +./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html + +echo "Check X and Y for IRI_REF because \" became '" + echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 832cc84b276..8f0b6cb9404 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -29,22 +29,7 @@ public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { -// --- Entry point - final public void parse() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACKET: - List(); - break; - case LBRACE: - Map(); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - +// --- Entry point for cdt:List literals final public List List() throws ParseException { List l = new ArrayList(); jj_consume_token(LBRACKET); @@ -63,12 +48,19 @@ final public List List() throws ParseException { case NULL: case LBRACE: case LBRACKET: - ListElement(l); + NonEmptyListContent(l); break; default: - jj_la1[1] = jj_gen; + jj_la1[0] = jj_gen; ; } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyListContent(List l) throws ParseException { + ListElement(l); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -76,15 +68,12 @@ final public List List() throws ParseException { ; break; default: - jj_la1[2] = jj_gen; + jj_la1[1] = jj_gen; break label_1; } jj_consume_token(COMMA); ListElement(l); } - jj_consume_token(RBRACKET); - {if (true) return l;} - throw new Error("Missing return statement in function"); } final public void ListElement(List l) throws ParseException { @@ -129,12 +118,13 @@ final public void ListElement(List l) throws ParseException { l.add( CDTFactory.createValue(m) ); break; default: - jj_la1[3] = jj_gen; + jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } +// --- Entry point for cdt:Map literals final public Map Map() throws ParseException { Map m = new HashMap(); jj_consume_token(LBRACE); @@ -150,12 +140,19 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG2: case IRIref: case BLANK_NODE_LABEL: - MapEntry(m); + NonEmptyMapContent(m); break; default: - jj_la1[4] = jj_gen; + jj_la1[3] = jj_gen; ; } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyMapContent(Map m) throws ParseException { + MapEntry(m); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -163,15 +160,12 @@ final public Map Map() throws ParseException { ; break; default: - jj_la1[5] = jj_gen; + jj_la1[4] = jj_gen; break label_2; } jj_consume_token(COMMA); MapEntry(m); } - jj_consume_token(RBRACE); - {if (true) return m;} - throw new Error("Missing return statement in function"); } final public void MapEntry(Map m) throws ParseException { @@ -213,7 +207,7 @@ final public CDTKey MapKey() throws ParseException { {if (true) return CDTFactory.createKey(n);} break; default: - jj_la1[6] = jj_gen; + jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -262,7 +256,7 @@ final public CDTValue MapValue() throws ParseException { {if (true) return CDTFactory.createValue(m);} break; default: - jj_la1[7] = jj_gen; + jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -300,7 +294,7 @@ final public Node NumericLiteral() throws ParseException { {if (true) return createLiteralDouble(t.image);} break; default: - jj_la1[8] = jj_gen; + jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -318,7 +312,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE;} break; default: - jj_la1[9] = jj_gen; + jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -341,13 +335,13 @@ final public Node RDFLiteral() throws ParseException { dt = IRI_REF(); break; default: - jj_la1[10] = jj_gen; + jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[11] = jj_gen; + jj_la1[10] = jj_gen; ; } {if (true) return createLiteral(lex, lang, dt);} @@ -381,7 +375,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[12] = jj_gen; + jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -399,7 +393,7 @@ final public String String() throws ParseException { public Token jj_nt; private int jj_ntk; private int jj_gen; - final private int[] jj_la1 = new int[13]; + final private int[] jj_la1 = new int[12]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { @@ -407,10 +401,10 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; } /** Constructor with InputStream. */ @@ -424,7 +418,7 @@ public CDTLiteralParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -438,7 +432,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor. */ @@ -448,7 +442,7 @@ public CDTLiteralParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -458,7 +452,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ @@ -467,7 +461,7 @@ public CDTLiteralParser(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -476,7 +470,7 @@ public void ReInit(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { @@ -532,7 +526,7 @@ public ParseException generateParseException() { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 13; i++) { + for (int i = 0; i < 12; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< Date: Sun, 20 Nov 2022 20:56:26 +0100 Subject: [PATCH 108/323] changes CDTValue such that it can be only null or an RDF term --- .../java/org/apache/jena/cdt/CDTFactory.java | 16 +- .../main/java/org/apache/jena/cdt/CDTKey.java | 10 ++ .../java/org/apache/jena/cdt/CDTValue.java | 138 ++++-------------- .../jena/cdt/CompositeDatatypeList.java | 14 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 21 +-- .../apache/jena/cdt/ParserForCDTLiterals.java | 8 +- .../engine/iterator/QueryIterUnfold.java | 67 +++++---- .../library/collection/ConcatFct.java | 25 ++-- .../library/collection/ContainsFct.java | 96 +----------- .../function/library/collection/SizeFct.java | 19 +-- 10 files changed, 115 insertions(+), 299 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index 1c96d41b629..dddd36a52d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -22,6 +22,8 @@ import java.util.Map; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; public class CDTFactory { @@ -40,17 +42,15 @@ public static CDTValue createValue( final Node n ) { } public static CDTValue createValue( final List l ) { - return new CDTValue() { - @Override public boolean isList() { return true; } - @Override public List asList() { return l; } - }; + final LiteralLabel lit = new LiteralLabelForList(l); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue createValue( final Map m ) { - return new CDTValue() { - @Override public boolean isMap() { return true; } - @Override public Map asMap() { return m; } - }; + final LiteralLabel lit = new LiteralLabelForMap(m); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue getNullValue() { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index d42794c877b..1b2dd152155 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey @@ -63,4 +64,13 @@ public String toString() { return super.toString(); } } + + /** + * Returns a string representation of this element + * to be included in the lexical form of literals. + */ + public String asLexicalForm() { + return NodeFmtLib.strTTL( asNode() ); + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5dd74a0bce6..b252a7082f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -18,147 +18,67 @@ package org.apache.jena.cdt; -import java.util.List; -import java.util.Map; - import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.riot.out.NodeFmtLib; public abstract class CDTValue extends CDTKey { /** - * Returns true if this object is a list. In that case, {@link #asList()} - * can be used to get it as an actual {@link List} object. - */ - public boolean isList() { - return false; - } - - /** - * Returns true if this object is a map. In that case, {@link #asMap()} - * can be used to get it as an actual {@link Map} object. - */ - public boolean isMap() { - return false; - } - - /** - * Returns true if this is a null value. + * Returns true if this is a null value (in which + * case {@link #isNode()} must return false). */ public boolean isNull() { return false; } - /** - * Returns this object as a list, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public List asList() { - throw new UnsupportedOperationException( this + " is not a list" ); - } - - /** - * Returns this object as a map, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public Map asMap() { - throw new UnsupportedOperationException( this + " is not a map" ); - } - @Override public final boolean equals( final Object other ) { if ( isNull() ) { return false; } - if ( !(other instanceof CDTValue) ) { - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); - } - else { - return false; - } - } - - final CDTValue otherValue = (CDTValue) other; - - if ( otherValue.isNull() ) return false; - - if ( isNode() ) return isEqual( asNode(), otherValue ); - - if ( isList() ) return isEqual( asList(), otherValue ); - - if ( isMap() ) return isEqual( asMap(), otherValue ); - - throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); - } - - public static boolean isEqual( final Node n1, final CDTValue v2 ) { - if ( CompositeDatatypeList.isListLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); - - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); - } - - if ( v2.isList() ) { - return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); - } - - return false; - } - - if ( CompositeDatatypeMap.isMapLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); + if ( other instanceof CDTValue ) { + final CDTValue otherValue = (CDTValue) other; - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); + if ( otherValue.isNull() ) { + return false; } - if ( v2.isMap() ) { - return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( v2.isNode() ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); - return NodeValue.sameAs(nv1, nv2); + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().sameValueAs( otherKey.asNode() ); } return false; } - public static boolean isEqual( final List list1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.getValue(lit2).equals(list1); - } - - if ( v2.isList() ) { - return v2.asList().equals(list1); - } - - return false; - } - - public static boolean isEqual( final Map map1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeMap.getValue(lit2).equals(map1); + @Override + public String asLexicalForm() { + if ( isNull() ) { + return "null"; } - if ( v2.isMap() ) { - return v2.asMap().equals(map1); + if ( isNode() ) { + final Node n = asNode(); + if ( CompositeDatatypeList.isListLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else { + return NodeFmtLib.strTTL(n); + } } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 3a9b0b9cad8..5a778f6c772 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,7 +24,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -70,16 +69,7 @@ public static String unparseList( final List list ) { } public static String unparseListElement( final CDTValue elmt ) { - if ( elmt.isNode() ) - return NodeFmtLib.strTTL( elmt.asNode() ); - else if ( elmt.isList() ) - return unparseList( elmt.asList() ); - else if ( elmt.isMap() ) - return CompositeDatatypeMap.unparseMap( elmt.asMap() ); - else if ( elmt.isNull() ) - return "null"; - else - throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + return elmt.asLexicalForm(); } @Override @@ -177,7 +167,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return list1.equals(list2); } - public static List getValue( final LiteralLabel lit ) { + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 784cf6bfaf4..6dec66e9920 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,7 +6,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeMap extends CompositeDatatypeBase { @@ -54,23 +53,9 @@ public static String unparseMap( final Map map ) { } public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { - if ( entry.getKey().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); - else - throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); - + sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); - - if ( entry.getValue().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); - else if ( entry.getValue().isList() ) - sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); - else if ( entry.getValue().isMap() ) - sb.append( unparseMap( entry.getValue().asMap() ) ); - else if ( entry.getValue().isNull() ) - sb.append( "null" ); - else - throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + sb.append( entry.getValue().asLexicalForm() ); } @Override @@ -172,7 +157,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return map1.equals(map2); } - public static Map getValue( final LiteralLabel lit ) { + public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 645cfa15a38..4284f6f3c1d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -76,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea final CDTValue v = list.get(i); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } @@ -134,11 +134,11 @@ public static Map parseMapLiteral( final Reader reader, final b final CDTValue v = map.get(key); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d376b2ea921..90fa39330b6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -140,23 +141,28 @@ protected Binding moveToNextBinding() { return inputBinding; } - final Node value; if ( nextElmt.isNode() ) { - value = nextElmt.asNode(); - } - else if ( nextElmt.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); - value = NodeFactory.createLiteral(lit); - } - else if ( nextElmt.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); - value = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + final Node n = nextElmt.asNode(); + + final Node value; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + value = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + value = NodeFactory.createLiteral(lit); + } + else { + value = n; + } + + return BindingFactory.binding(inputBinding, var1, value); } - return BindingFactory.binding(inputBinding, var1, value); + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); } } @@ -194,23 +200,28 @@ protected Binding moveToNextBinding() { return BindingFactory.binding( inputBinding, var1, keyNode ); } - final Node valueNode; if ( value.isNode() ) { - valueNode = value.asNode(); - } - else if ( value.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( value.asList() ); - valueNode = NodeFactory.createLiteral(lit); - } - else if ( value.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); - valueNode = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + final Node n = value.asNode(); + + final Node valueNode; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + valueNode = NodeFactory.createLiteral(lit); + } + else { + valueNode = n; + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } - return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index c950980ac3c..3b4a2dfa52e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -21,6 +21,14 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { final List list1 = getInputList(v1); final List list2 = getInputList(v2); + if ( list1.isEmpty() ) { + return v2; + } + + if ( list2.isEmpty() ) { + return v1; + } + final List result = new ArrayList<>(); result.addAll(list1); result.addAll(list2); @@ -33,22 +41,11 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { protected List getInputList( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + nv); try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - return CompositeDatatypeList.parseList(lex); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); - } + return CompositeDatatypeList.getValue( n.getLiteral() ); } catch ( final DatatypeFormatException ex ) { throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index a940b91bf33..b0a323e2e4c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -1,14 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; -import java.util.Map; -import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -18,72 +14,23 @@ public class ContainsFct extends FunctionBase2 @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - final Node n2 = nv2.asNode(); if ( ! CompositeDatatypeList.isListLiteral(n1) ) throw new ExprEvalException("Not a list literal: " + nv1); final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); - - final boolean result; - if ( CompositeDatatypeList.isListLiteral(n2) ) { - result = containsList( list, n2.getLiteral() ); - } - else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { - result = containsMap( list, n2.getLiteral() ); - } - else { - result = containsNode( list, nv2 ); - } - + final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } /** - * Returns true if the given list contains the given RDF term, assuming - * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + * Returns true if the given list contains the given RDF term. */ - protected boolean containsNode( final List list, final NodeValue n ) { + protected boolean containsNode( final List list, final NodeValue nv ) { for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv,n) ) { - return true; - } - } - } - - return false; - } - - /** - * Returns true if the given list contains the list represented by - * the given cdt:List literal (i.e., assumes that the given literal - * is a cdt:List literal). - */ - protected boolean containsList( final List list, final LiteralLabel lit ) { - // get the list for the literal only if needed - List otherList = null; - - for ( final CDTValue v : list ) { - final List vList; - if ( v.isList() ) { - vList = v.asList(); - } - else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { - vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); - } - else { - vList = null; - } - - if ( vList != null ) { - // now we need to get the list - if ( otherList == null ) { - otherList = CompositeDatatypeList.getValue(lit); - } - - if ( vList.equals(otherList) ) { + if ( NodeValue.sameAs(vv, nv) ) { return true; } } @@ -92,39 +39,4 @@ else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { return false; } - /** - * Returns true if the given list contains the map represented by - * the given cdt:Map literal (i.e., assumes that the given literal - * is a cdt:Map literal). - */ - protected boolean containsMap( final List list, final LiteralLabel lit) { - // get the map for the literal only if needed - Map otherMap = null; - - for ( final CDTValue v : list ) { - final Map vMap; - if ( v.isMap() ) { - vMap = v.asMap(); - } - else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { - vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); - } - else { - vMap = null; - } - - if ( vMap != null ) { - // now we need to get the map - if ( otherMap == null ) { - otherMap = CompositeDatatypeMap.getValue(lit); - } - - if ( vMap.equals(otherMap) ) { - return true; - } - } - } - - return false; - } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index b4f76e2565f..4121ba8db3b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,8 +2,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; @@ -24,22 +22,15 @@ public NodeValue exec( final NodeValue nv ) { try { final LiteralLabel lit = n.getLiteral(); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - size = ( (LiteralLabelForList) lit ).getValue().size(); - } - else if ( lit instanceof LiteralLabelForMap ) { - size = ( (LiteralLabelForMap) lit ).getValue().size(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeList.parseList(lex).size(); + + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + size = CompositeDatatypeList.getValue(lit).size(); } else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeMap.parseMap(lex).size(); + size = CompositeDatatypeMap.getValue(lit).size(); } else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); } } catch ( final DatatypeFormatException ex ) { From 37d2ce0beee16ddc56cd5fd96d09e4a7d7485170 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 22:17:37 +0100 Subject: [PATCH 109/323] adds cdt:containsTerm function --- .../apache/jena/cdt/LiteralLabelForCDTs.java | 19 +++++++++ .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsTermFct.java | 42 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index c5215fccdc2..0f87a5ea33f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,5 +1,7 @@ package org.apache.jena.cdt; +import java.util.Objects; + import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.rdf.model.impl.Util; @@ -141,6 +143,23 @@ public boolean sameValueAs( final LiteralLabel other ) { return getValue().equals( other.getValue() ); } + @Override + public boolean equals( final Object other ) { + if ( this == other ) return true; + + if ( other == null || !(other instanceof LiteralLabel) ) return false; + + final LiteralLabel otherLiteral = (LiteralLabel) other; + + final String otherLang = otherLiteral.language(); + if ( otherLang != null && ! otherLang.isEmpty() ) return false; + + final String otherDTypeURI = otherLiteral.getDatatypeURI(); + if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; + + return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); + } + @Override public int getDefaultHashcode() { return hash; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index afa7c7e2f77..7796fef6e8d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -9,5 +9,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java new file mode 100644 index 00000000000..6951d89992e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsTermFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final boolean result = containsTerm( list, nv2 ); + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term. + */ + protected boolean containsTerm( final List list, final NodeValue nv ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + if ( NodeFunctions.sameTerm(v.asNode(), nv.asNode()) ) { + return true; + } + } + } + + return false; + } + +} From 6af6013fe252396ca822d27aa0ecc947ef9d936c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 23:04:23 +0100 Subject: [PATCH 110/323] adds cdt:get function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/GetFct.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 7796fef6e8d..4f3959b7342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -10,5 +10,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java new file mode 100644 index 00000000000..41227a7bb10 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -0,0 +1,46 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class GetFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + if ( index > list.size() ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final CDTValue value = list.get( index-1 ); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From cb93163320bd2acd8c38f2265e24c09d6341f24b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:27:38 +0100 Subject: [PATCH 111/323] adds cdt:head function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/HeadFct.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 4f3959b7342..9a521880665 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,5 +11,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java new file mode 100644 index 00000000000..5fcaf302c84 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -0,0 +1,38 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class HeadFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final CDTValue value = list.get(0); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From 2032c75e1836757fccc9e7120d5ab3fe0ec97906 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:37 +0100 Subject: [PATCH 112/323] adds base class FunctionBase1List --- .../library/collection/FunctionBase1List.java | 27 +++++++++++++++++++ .../function/library/collection/HeadFct.java | 14 ++-------- 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java new file mode 100644 index 00000000000..0f49e6b61fd --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -0,0 +1,27 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public abstract class FunctionBase1List extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + return _exec(list); + } + + protected abstract NodeValue _exec( List list ); +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 5fcaf302c84..4deed24468e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -3,23 +3,13 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; -public class HeadFct extends FunctionBase1 +public class HeadFct extends FunctionBase1List { @Override - public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + protected NodeValue _exec( final List list ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From 98e0a033c05b0c7a85ae21a6fed1a6dc964d7d70 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:57 +0100 Subject: [PATCH 113/323] adds cdt:tail function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/TailFct.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 9a521880665..8f203ffe4ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -12,5 +12,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java new file mode 100644 index 00000000000..15abce441fa --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -0,0 +1,26 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class TailFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list ) { + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final List sublist = list.subList( 1, list.size() ); + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 306294ecc01d294ac7f099f91288a76a9602b510 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:02:27 +0100 Subject: [PATCH 114/323] changes arguments of '_exec' in FunctionBase1List --- .../sparql/function/library/collection/FunctionBase1List.java | 4 ++-- .../jena/sparql/function/library/collection/HeadFct.java | 2 +- .../jena/sparql/function/library/collection/TailFct.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 0f49e6b61fd..99210c10f0d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -20,8 +20,8 @@ public NodeValue exec( final NodeValue nv ) { final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - return _exec(list); + return _exec(list, nv); } - protected abstract NodeValue _exec( List list ); + protected abstract NodeValue _exec( List list, NodeValue nvList ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 4deed24468e..aebd5f39611 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -9,7 +9,7 @@ public class HeadFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index 15abce441fa..a56581d3195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -13,7 +13,7 @@ public class TailFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From 7e5f3eb50f8e9ac0ae970ff1ac82d9aff61c2602 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:28:07 +0100 Subject: [PATCH 115/323] adds cdt:reverse function --- .../CollectionLiteralFunctions.java | 5 +-- .../library/collection/ReverseFct.java | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 8f203ffe4ba..31451f73fbb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,13 +5,14 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java new file mode 100644 index 00000000000..e2d2d3fd4ed --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -0,0 +1,33 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Arrays; +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; + +public class ReverseFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list, final NodeValue nvList ) { + if ( list.size() < 2 ) + return nvList; + + final CDTValue[] reverseArray = new CDTValue[ list.size() ]; + int i = list.size() - 1; + for ( final CDTValue v : list ) { + reverseArray[i] = v; + i--; + } + + final List reverseList = Arrays.asList(reverseArray); + final LiteralLabel lit = new LiteralLabelForList(reverseList); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From e83f12737dc96de52c93dbc425e4abd3a3cd57f7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 11:33:32 +0100 Subject: [PATCH 116/323] adds cdt:subseq function --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/SubSeqFct.java | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 31451f73fbb..1e16821a71e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java new file mode 100644 index 00000000000..d5e8f7b736b --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -0,0 +1,90 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Collections; +import java.util.List; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class SubSeqFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 && args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec( final List args ) { + final NodeValue nv1 = args.get(0); + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final NodeValue nv2 = args.get(1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final int length; + final List list; + if ( args.size() == 3 ) { + final NodeValue nv3 = args.get(2); + + if ( ! nv3.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv3); + + length = nv3.getInteger().intValue(); + + if ( length < 0 ) + throw new ExprEvalException("Illegal length value: " + nv3); + + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + } + else { + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + length = list.size() - index + 1; + } + + if ( index > list.size() + 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + if ( index + length > list.size() + 1 ) + throw new ExprEvalException("Beyond list length (index: " + index + ", length: " + length + ")"); + + final List sublist; + if ( index == list.size() + 1 ) { + if ( length != 0 ) + throw new ExprEvalException("Illegal arguments (index: " + index + ", length: " + length + ")"); + + if ( list.isEmpty() ) + return nv1; + + sublist = Collections.emptyList(); + } + else { + sublist = list.subList( index - 1, index - 1 + length ); + } + + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From f79e9b4814a49913cc9730124c03ee4822906387 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 22:10:18 +0100 Subject: [PATCH 117/323] bugfix in 'isEqual' of CompositeDatatypeList (needs to throw ExprEvalException if null values are there) --- .../java/org/apache/jena/cdt/CDTValue.java | 32 +++++++++++++++++-- .../jena/cdt/CompositeDatatypeList.java | 16 +++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index b252a7082f8..9ac6500d668 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -20,6 +20,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.expr.ExprEvalException; public abstract class CDTValue extends CDTKey { @@ -32,16 +33,25 @@ public boolean isNull() { } @Override - public final boolean equals( final Object other ) { - if ( isNull() ) { + public boolean equals( final Object other ) { + try { + return sameAs(other); + } + catch ( final ExprEvalException ex ) { return false; } + } + + public boolean sameAs( final Object other ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - return false; + throw new ExprEvalException(); } if ( isNode() ) { @@ -59,6 +69,22 @@ public final boolean equals( final Object other ) { return false; } + public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } + + if ( otherValue.isNull() ) { + throw new ExprEvalException(); + } + + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); + } + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + @Override public String asLexicalForm() { if ( isNull() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 5a778f6c772..78178ba8ce1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -164,7 +164,21 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - return list1.equals(list2); + + if ( list1.size() != list2.size() ) return false; + if ( list1.isEmpty() ) return true; + + final Iterator it1 = list1.iterator(); + final Iterator it2 = list2.iterator(); + while ( it1.hasNext() ) { + final CDTValue v1 = it1.next(); + final CDTValue v2 = it2.next(); + if ( ! v1.sameAs(v2) ) { + return false; + } + } + + return true; } public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { From 28c72a3c1c71f3a03ec401bd47c451e5f52faf94 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 1 Dec 2022 09:26:45 +0100 Subject: [PATCH 118/323] fix: comparing two cdt:List literals using the = operator may still return false even if the lists contain null (but are clearly different in other parts) --- .../src/main/java/org/apache/jena/cdt/CDTValue.java | 8 ++++---- .../org/apache/jena/cdt/CompositeDatatypeList.java | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 9ac6500d668..7347d694adf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -44,14 +44,14 @@ public boolean equals( final Object other ) { public boolean sameAs( final Object other ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { @@ -71,11 +71,11 @@ public boolean sameAs( final Object other ) throws ExprEvalException { public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 78178ba8ce1..4d0888915f4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -170,14 +171,20 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); + boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - if ( ! v1.sameAs(v2) ) { - return false; + try { + if ( ! v1.sameAs(v2) ) return false; + } + catch ( final ExprEvalException ex ) { + errorCaught = true; } } + if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); + return true; } From 61a1f4c8115f9f0133f7797816d8b8840e29816a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 13 Dec 2022 15:42:49 +0100 Subject: [PATCH 119/323] changes the implementation of the cdt:List constructor to be a functional form (rather than a function) which can be used to have null values in the constructed lists --- .../function/library/collection/ListFct.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index 420ab788576..a8820ed567a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -9,9 +9,13 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; public class ListFct extends FunctionBase { @@ -21,11 +25,18 @@ public void checkBuild( final String uri, final ExprList args ) { } @Override - public NodeValue exec( final List args ) { + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { final List list = new ArrayList<>( args.size() ); - for ( final NodeValue nv : args ) { - final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + for ( final Expr e : args ) { + CDTValue v; + try { + final NodeValue nv = e.eval(binding, env); + v = CDTFactory.createValue( nv.asNode() ); + } catch ( final ExprException ex ) { + v = CDTFactory.getNullValue(); + } + list.add(v); } @@ -34,4 +45,9 @@ public NodeValue exec( final List args ) { return NodeValue.makeNode(n); } + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + } From c658014e191299af31ace02fa886cb8c5fc827bd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 4 Jan 2023 19:49:36 +0100 Subject: [PATCH 120/323] makes cdt:concat an n-ary function --- .../library/collection/ConcatFct.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 3b4a2dfa52e..89526d9215d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -11,27 +11,38 @@ import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; +import org.apache.jena.sparql.function.FunctionBase; -public class ConcatFct extends FunctionBase2 +public class ConcatFct extends FunctionBase { @Override - public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final List list1 = getInputList(v1); - final List list2 = getInputList(v2); + public void checkBuild( final String uri, final ExprList args ) { + // nothing to check + } - if ( list1.isEmpty() ) { - return v2; + @Override + public NodeValue exec( final List args ) { + if ( args.isEmpty() ) { + final List result = new ArrayList<>(); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); } - if ( list2.isEmpty() ) { - return v1; + if ( args.size() == 1 ) { + final NodeValue nv = args.get(0); + // make sure that the argument is a well-formed cdt:List literal + getInputList(nv); + + return nv; } final List result = new ArrayList<>(); - result.addAll(list1); - result.addAll(list2); + for ( final NodeValue nv : args ) { + result.addAll( getInputList(nv) ); + } final LiteralLabel lit = new LiteralLabelForList(result); final Node n = NodeFactory.createLiteral(lit); From ac457eea4299944eca77331f49226400657b4461 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 13:30:26 +0100 Subject: [PATCH 121/323] support for the two-variables version of UNFOLD for cdt:List literals --- .../engine/iterator/QueryIterUnfold.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 90fa39330b6..05c83f0ba10 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -30,6 +30,7 @@ import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; @@ -120,6 +121,8 @@ protected void closeIterator() { } // nothing to do really protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected int nextIndex = 0; + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { super(inputBinding, itListElmts); } @@ -136,9 +139,22 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { final CDTValue nextElmt = itElmts.next(); + nextIndex++; // index values to be assigned to the second variable start at 1 + + final Node indexNode; + if ( var2 != null ) { + final String indexStr = Integer.toString(nextIndex); + indexNode = NodeFactory.createLiteral(indexStr, XSDDatatype.XSDinteger); + } + else { + indexNode = null; + } if ( nextElmt.isNull() ) { - return inputBinding; + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var2, indexNode); + else + return inputBinding; } if ( nextElmt.isNode() ) { @@ -159,7 +175,10 @@ else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof Li value = n; } - return BindingFactory.binding(inputBinding, var1, value); + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var1, value, var2, indexNode); + else + return BindingFactory.binding(inputBinding, var1, value); } throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); From f022f134a57cfca04b5ad96199175a20e4a63b8a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 14:17:18 +0100 Subject: [PATCH 122/323] support for the one-variable version of UNFOLD for cdt:Map literals --- .../org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 05c83f0ba10..fa1e3c7c570 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -215,7 +215,7 @@ protected Binding moveToNextBinding() { throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); } - if ( value.isNull() ) { + if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); } From 2bde79231c797302bcaaef294c7aa4cc38857abc Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 May 2023 11:02:31 +0200 Subject: [PATCH 123/323] support for comparison of cdt:List literals (i.e., < and >) --- .../jena/cdt/CompositeDatatypeList.java | 50 ++- .../apache/jena/sparql/expr/NodeValue.java | 299 ++++++++++++++++++ 2 files changed, 345 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 4d0888915f4..2c59bad884d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -25,6 +25,8 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -171,7 +173,6 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); - boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); @@ -179,15 +180,56 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( ! v1.sameAs(v2) ) return false; } catch ( final ExprEvalException ex ) { - errorCaught = true; + throw new ExprEvalException("nulls in lists cannot be compared"); } } - if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); - return true; } + public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final List list1; + final List list2; + try { + list1 = getValue(value1); + list2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( list1.isEmpty() && list2.isEmpty() ) return 0; + if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; + if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + + final int n = Math.min( list1.size(), list2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTValue elmt1 = list1.get(i); + final CDTValue elmt2 = list2.get(i); + + if ( elmt1.isNull() || elmt2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + + final int c; + try { + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c != 0 ) return c; + } + } + + return ( list1.size() - list2.size() ); + } + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index e87b8f3b727..5a054044bd6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -555,9 +555,308 @@ && nSameAs(t1.getPredicate(), t2.getPredicate()) >>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } +<<<<<<< HEAD public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { ValueSpace c1 = classifyValueSpace(nv1); ValueSpace c2 = classifyValueSpace(nv2); +======= + /** Worker for sameAs. */ + private static boolean nSameAs(Node n1, Node n2) { + NodeValue nv1 = NodeValue.makeNode(n1); + NodeValue nv2 = NodeValue.makeNode(n2); + return sameAs(nv1, nv2); + } + + /** Return true if the two Nodes are known to be different, + * return false if the two Nodes are known to be the same, + * else throw ExprEvalException + */ + public static boolean notSameAs(Node n1, Node n2) + { + return notSameAs(NodeValue.makeNode(n1), NodeValue.makeNode(n2)) ; + } + + /** Return true if the two NodeValues are known to be different, + * return false if the two NodeValues are known to be the same, + * else throw ExprEvalException + */ + public static boolean notSameAs(NodeValue nv1, NodeValue nv2) + { + return ! sameAs(nv1, nv2) ; + } + + // ---------------------------------------------------------------- + // compare + + // Compare by value code is here + // NodeUtils.compareRDFTerms for syntactic comparison + + /** Compare by value if possible else compare by kind/type/lexical form + * Only use when you want an ordering regardless of form of NodeValue, + * for example in ORDER BY + * + * @param nv1 + * @param nv2 + * @return negative, 0, or positive for less than, equal, greater than. + */ + + public static int compareAlways(NodeValue nv1, NodeValue nv2) + { + try { + int x = compare(nv1, nv2, true) ; + // Same? + if ( x != Expr.CMP_EQUAL ) + return x ; + } catch (ExprNotComparableException ex) + { /* Drop through */ } + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + } + + /** Compare by value (and only value) if possible. + * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) + * @param nv1 + * @param nv2 + * @return Expr.CMP_INDETERMINATE(+2), Expr.CMP_LESS(-1), Expr.CMP_EQUAL(0) or Expr.CMP_GREATER(+1) + * @throws ExprNotComparableException + */ + public static int compare(NodeValue nv1, NodeValue nv2) + { + if ( nv1 == null || nv2 == null ) + //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; + throw new ARQInternalErrorException("Attempt to compare on null") ; + int x = compare(nv1, nv2, false) ; + return x ; + } + + // E_GreaterThan/E_LessThan/E_GreaterThanOrEqual/E_LessThanOrEqual + // ==> compare(nv1, nv2) => compare (nv1, nv2, false) + + // BindingComparator => compareAlways(nv1, nv2) => compare (nv1, nv2, true) + + // E_Equals calls NodeValue.sameAs() ==> + + // sortOrderingCompare means that the comparison should do something with normally unlike things, + // and split plain strings from xsd:strings. + + private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCompare) + { + if ( nv1 == null && nv2 == null ) + return Expr.CMP_EQUAL ; + + if ( nv1 == null ) + return Expr.CMP_LESS ; + if ( nv2 == null ) + return Expr.CMP_GREATER ; + + ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; + + // Special case - date/dateTime comparison is affected by timezones and may be + // indeterminate based on the value of the dateTime/date. + // Do this first, + + switch (compType) + { + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_DAY : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + { + int x = XSDFuncOp.compareDateTime(nv1, nv2) ; + if ( x != Expr.CMP_INDETERMINATE ) + return x ; + // Indeterminate => can't compare as strict values. + compType = ValueSpaceClassification.VSPACE_DIFFERENT ; + break ; + } + case VSPACE_DURATION: + { + int x = XSDFuncOp.compareDuration(nv1, nv2) ; + // Fix up - Java (Oracle java7 at least) returns "equals" for + // "P1Y"/"P365D" and "P1M"/"P28D", and others split over + // YearMonth/DayTime. + + // OR return Expr.CMP_INDETERMINATE ?? + if ( x == Expr.CMP_EQUAL ) { + Duration d1 = nv1.getDuration() ; + Duration d2 = nv2.getDuration() ; + if ( ( XSDFuncOp.isDayTime(d1) && XSDFuncOp.isYearMonth(d2) ) || + ( XSDFuncOp.isDayTime(d2) && XSDFuncOp.isYearMonth(d1) ) ) + x = Expr.CMP_INDETERMINATE ; + } + if ( x != Expr.CMP_INDETERMINATE ) + return x ; + compType = ValueSpaceClassification.VSPACE_DIFFERENT ; + break ; + } + + // No special cases. + case VSPACE_BOOLEAN : + case VSPACE_DIFFERENT : + case VSPACE_LANG : + case VSPACE_TRIPLE_TERM: + case VSPACE_NODE : + case VSPACE_NUM : + case VSPACE_STRING : + case VSPACE_SORTKEY : + case VSPACE_UNKNOWN : + // Drop through. + } + + switch (compType) + { + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_DAY : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + case VSPACE_DURATION: + throw new ARQInternalErrorException("Still seeing date/dateTime/time/duration compare type") ; + + case VSPACE_NUM: return XSDFuncOp.compareNumeric(nv1, nv2) ; + case VSPACE_STRING: + { + int cmp = XSDFuncOp.compareString(nv1, nv2) ; + + if ( ! sortOrderingCompare ) + return cmp ; + if ( cmp != Expr.CMP_EQUAL ) + return cmp ; + + // Equality. + if ( JenaRuntime.isRDF11 ) + // RDF 1.1 : No literals without datatype. + return cmp ; + + // RDF 1.0 + // Split plain literals and xsd:strings for sorting purposes. + // Same by string value. + String dt1 = nv1.asNode().getLiteralDatatypeURI() ; + String dt2 = nv2.asNode().getLiteralDatatypeURI() ; + if ( dt1 == null && dt2 != null ) + return Expr.CMP_LESS ; + if ( dt2 == null && dt1 != null ) + return Expr.CMP_GREATER ; + return Expr.CMP_EQUAL; // Both plain or both xsd:string. + } + case VSPACE_SORTKEY : + return nv1.getSortKey().compareTo(nv2.getSortKey()); + + case VSPACE_BOOLEAN: + return XSDFuncOp.compareBoolean(nv1, nv2) ; + + case VSPACE_LANG: + { + // Two literals, both with language tags. + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + int x = StrUtils.strCompareIgnoreCase(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; + + if ( x != Expr.CMP_EQUAL ) + { + // Different lang tags + if ( ! sortOrderingCompare ) + raise(new ExprNotComparableException("Can't compare (different languages) "+nv1+" and "+nv2)) ; + // Different lang tags - sorting + return x ; + } + + // same lang tag (case insensitive) + x = StrUtils.strCompare(node1.getLiteralLexicalForm(), node2.getLiteralLexicalForm()) ; + if ( x != Expr.CMP_EQUAL ) + return x ; + // Same lexical forms, same lang tag by value + // Try to split by syntactic lang tags. + x = StrUtils.strCompare(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; + // Maybe they are the same after all! + // Should be node.equals by now. + if ( x == Expr.CMP_EQUAL && ! NodeFunctions.sameTerm(node1, node2) ) + throw new ARQInternalErrorException("Looks like the same (lang tags) but not node equals") ; + return x ; + } + + case VSPACE_TRIPLE_TERM: { + Triple t1 = nv1.getNode().getTriple(); + Triple t2 = nv2.getNode().getTriple(); + int x = nCompare(t1.getSubject(), t2.getSubject(), sortOrderingCompare); + if ( x != CMP_EQUAL ) + return x; + x = nCompare(t1.getPredicate(), t2.getPredicate(), sortOrderingCompare); + if ( x != CMP_EQUAL ) + return x; + return nCompare(t1.getObject(), t2.getObject(), sortOrderingCompare); + } + + case VSPACE_NODE: + // Two non-literals don't compare except for sorting. + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + else + { + raise(new ExprNotComparableException("Can't compare (nodes) "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeList.type.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + + case VSPACE_UNKNOWN: + { + // One or two unknown value spaces. + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + // Two unknown literals can be equal. + if ( NodeFunctions.sameTerm(node1, node2) ) + return Expr.CMP_EQUAL ; + + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(node1, node2) ; + + raise(new ExprNotComparableException("Can't compare "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + + case VSPACE_DIFFERENT: + // Two literals, from different known value spaces + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + + raise(new ExprNotComparableException("Can't compare (incompatible value spaces)"+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + throw new ARQInternalErrorException("Compare failure "+nv1+" and "+nv2) ; + } + + /** Worker for compare. */ + private static int nCompare(Node n1, Node n2, boolean sortOrderingCompare) { + if ( n1.equals(n2) ) + return CMP_EQUAL; + NodeValue nv1 = NodeValue.makeNode(n1); + NodeValue nv2 = NodeValue.makeNode(n2); + return compare(nv1, nv2, sortOrderingCompare); + } + + public static ValueSpaceClassification classifyValueOp(NodeValue nv1, NodeValue nv2) + { + ValueSpaceClassification c1 = nv1.getValueSpace() ; + ValueSpaceClassification c2 = nv2.getValueSpace() ; +>>>>>>> ed504e0cc8 (support for comparison of cdt:List literals (i.e., < and >)) if ( c1 == c2 ) return c1 ; if ( c1 == VSPACE_UNKNOWN || c2 == VSPACE_UNKNOWN ) return VSPACE_UNKNOWN ; From 47c00cb09da75c21d0fe5d4b79543c94e6e23e86 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 May 2023 09:11:55 +0200 Subject: [PATCH 124/323] bug fix: visit(OpUnfold) must pop the current expression from the stack --- .../jena/sparql/algebra/walker/ApplyTransformVisitor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index e6028996b28..0e9ae51129c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -149,6 +149,10 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { + final Expr e2 = pop(exprStack); + if ( ! opUnfold.getExpr().equals(e2) ) + throw new IllegalArgumentException("Expression on stack differs from expression of UNFOLD."); + visit1(opUnfold) ; } From 6716bf752976f31c76d46ecfd9bfe7f4eee394e6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 8 Jun 2023 22:50:18 +0200 Subject: [PATCH 125/323] changes implementation of 'list-equal' and 'list-less-than' such that comparing blank nodes (as list elements) raises an error --- .../jena/cdt/CompositeDatatypeList.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2c59bad884d..13cb5ee8d01 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -176,12 +176,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - try { - if ( ! v1.sameAs(v2) ) return false; - } - catch ( final ExprEvalException ex ) { + + if ( v1.isNull() || v2.isNull() ) { throw new ExprEvalException("nulls in lists cannot be compared"); } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) { + return false; + } } return true; @@ -211,9 +220,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); + + if ( n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); - final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); final int c; try { From aefcb3497f6939b96f66ec9b35a82ea089132a24 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 15 Jun 2023 17:43:33 +0200 Subject: [PATCH 126/323] FOLD must not accept blank nodes as keys for maps --- .../java/org/apache/jena/sparql/expr/aggregate/AggFold.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 93f9a3fb87e..b30a46fe7f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -168,6 +168,9 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { if ( nvKey == null ) { return; // ignore if creating the key using the given binding failed } + if ( nvKey.isBlank() ) { + return; // ignore if the key would be a blank node + } final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); From 0e9885c6dac7fb15c71703cb01922d40d817f6e4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 16:49:32 +0200 Subject: [PATCH 127/323] adds the map version of cdt:get, in this context also changes 'equals' of CDTKey (it must be true only for same terms not for same values) --- .../main/java/org/apache/jena/cdt/CDTKey.java | 12 +++-- .../function/library/collection/GetFct.java | 45 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 1b2dd152155..532ac98b10d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -20,7 +20,6 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -47,14 +46,19 @@ public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - final NodeValue thisNV = NodeValue.makeNode( asNode() ); - final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); - return NodeValue.sameAs(thisNV, otherNV); + final Node n1 = asNode(); + final Node n2 = otherKey.asNode(); + return n1.equals(n2); } return false; } + @Override + public int hashCode() { + return asNode().hashCode(); + } + @Override public String toString() { if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index 41227a7bb10..ae11240dc47 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -1,10 +1,15 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,9 +20,16 @@ public class GetFct extends FunctionBase2 public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + if ( CompositeDatatypeList.isListLiteral(n1) ) + return getFromList( n1.getLiteral(), nv2 ); + if ( CompositeDatatypeMap.isMapLiteral(n1) ) + return getFromMap( n1.getLiteral(), nv2 ); + + throw new ExprEvalException("Neither a list nor a map literal: " + nv1); + } + + protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -26,7 +38,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CompositeDatatypeList.getValue(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -43,4 +55,31 @@ else if ( value.isNode() ) { } } + protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + final Map map = CompositeDatatypeMap.getValue(n1); + + if ( map.isEmpty() ) + throw new ExprEvalException("empty map"); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + if ( value == null ) { + throw new ExprEvalException("key is not in the map"); + } + else if ( value.isNull() ) { + throw new ExprEvalException("value for key is in null"); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + } From eeff4451dce1d76f11052938d5436135f9e79a54 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:21:41 +0200 Subject: [PATCH 128/323] adds support for cdt:containsKey --- .../CollectionLiteralFunctions.java | 6 ++- .../library/collection/ContainsKeyFct.java | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 1e16821a71e..86b9f93d0e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,11 +6,13 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsKey", ContainsKeyFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java new file mode 100644 index 00000000000..f3a54dbe3c7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsKeyFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + final Node n2 = nv2.asNode(); + + // If the second argument is not an IRI or a literal, then it cannot be + // a map key in the given map and, by definition of cdt:containsKey, we + // have to return false. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return NodeValue.booleanReturn(false); + + if ( map.isEmpty() ) + return NodeValue.booleanReturn(false); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + return NodeValue.booleanReturn( value != null ); + } + +} From 23797e441e774247322ce60cd24d403c35ccc347 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:37:56 +0200 Subject: [PATCH 129/323] adds support for cdt:keys --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/KeysFct.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 86b9f93d0e7..36ddc929809 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,6 +11,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java new file mode 100644 index 00000000000..a2f4cb7a8c8 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -0,0 +1,40 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class KeysFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a map literal: " + nv); + + final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + + final List list = new ArrayList<>( map.size() ); + for ( final CDTKey key : map.keySet() ) { + final CDTValue value = CDTFactory.createValue( key.asNode() ); + list.add(value); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From 6058d9dbddb97517cb2f32b23cd5f7a45c6933a0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 19:31:07 +0200 Subject: [PATCH 130/323] adds support for cdt:remove --- .../library/collection/RemoveFct.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java new file mode 100644 index 00000000000..fd298d94010 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -0,0 +1,51 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class RemoveFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + if ( map.isEmpty() ) + return nv1; + + final Node n2 = nv2.asNode(); + + // If the second term is not a map key (and the first term is a well- + // formed cdt:Map literal), the first term needs to be returned as is. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return nv1; + + final CDTKey key = CDTFactory.createKey(n2); + + if ( ! map.containsKey(key) ) + return nv1; + + final Map newMap = new HashMap<>(map); + newMap.remove(key); + + final LiteralLabel lit = new LiteralLabelForMap(newMap); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From 4ee22c48d15e6fa78695c24b391ca955abb69d04 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 14:57:25 +0200 Subject: [PATCH 131/323] bug fix: CDTValue needs to override toString() and hashCode() and cannot rely on CDTKey for that; now it is not a subclass of CDTKey anymore --- .../java/org/apache/jena/cdt/CDTFactory.java | 1 - .../main/java/org/apache/jena/cdt/CDTKey.java | 16 +------ .../java/org/apache/jena/cdt/CDTValue.java | 48 ++++++++++++++++--- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index dddd36a52d0..912f32a47cf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -29,7 +29,6 @@ public class CDTFactory { public static CDTKey createKey( final Node n ) { return new CDTKey() { - @Override public boolean isNode() { return true; } @Override public Node asNode() { return n; } }; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 532ac98b10d..7631565e88c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -23,15 +23,6 @@ public abstract class CDTKey { - /** - * Returns true if this object is an RDF term (i.e., an IRI, a literal, - * or a blank node). In that case, {@link #asNode()} can be used to get - * a corresponding {@link Node} representation of this RDF term. - */ - public boolean isNode() { - return false; - } - /** * Returns this object as an RDF term (i.e., an IRI, a literal, * or a blank node), assuming it is one. If it is not, then an @@ -61,12 +52,7 @@ public int hashCode() { @Override public String toString() { - if ( isNode() ) { - return asNode().toString(); - } - else { - return super.toString(); - } + return asNode().toString(); } /** diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 7347d694adf..3baed568f3e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -22,7 +22,7 @@ import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.ExprEvalException; -public abstract class CDTValue extends CDTKey +public abstract class CDTValue { /** * Returns true if this is a null value (in which @@ -32,6 +32,46 @@ public boolean isNull() { return false; } + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public String toString() { + if ( isNode() ) + return asNode().toString(); + + if ( isNull() ) + return "null"; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + + @Override + public int hashCode() { + if ( isNode() ) + return asNode().hashCode();; + + if ( isNull() ) + return 1; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + @Override public boolean equals( final Object other ) { try { @@ -61,11 +101,6 @@ public boolean sameAs( final Object other ) throws ExprEvalException { throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().sameValueAs( otherKey.asNode() ); - } - return false; } @@ -85,7 +120,6 @@ public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalExceptio throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - @Override public String asLexicalForm() { if ( isNull() ) { return "null"; From ab6e4893bdf24589ae1df5dab880cceed3d96300 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:31:56 +0200 Subject: [PATCH 132/323] adds CDTLiteralFunctionUtils --- .../collection/CDTLiteralFunctionUtils.java | 119 ++++++++++++++++++ .../library/collection/ConcatFct.java | 37 ++---- .../library/collection/ContainsFct.java | 10 +- .../library/collection/ContainsKeyFct.java | 9 +- .../library/collection/ContainsTermFct.java | 10 +- .../library/collection/FunctionBase1List.java | 11 +- .../function/library/collection/GetFct.java | 13 +- .../function/library/collection/KeysFct.java | 16 +-- .../function/library/collection/ListFct.java | 8 +- .../library/collection/RemoveFct.java | 15 +-- .../library/collection/ReverseFct.java | 8 +- .../function/library/collection/SizeFct.java | 27 ++-- .../library/collection/SubSeqFct.java | 17 +-- .../function/library/collection/TailFct.java | 8 +- 14 files changed, 155 insertions(+), 153 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java new file mode 100644 index 00000000000..d1d3f90c69e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java @@ -0,0 +1,119 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class CDTLiteralFunctionUtils +{ + /** + * Uses {@link CompositeDatatypeList#isListLiteral(Node)} to check whether + * the given node is a cdt:List literal and throws an exception if not. + */ + public static final void ensureListLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + n); + } + + /** + * Uses {@link CompositeDatatypeMap#isMapLiteral(Node)} to check whether + * the given node is a cdt:Map literal and throws an exception if not. + */ + public static final void ensureMapLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a cdt:Map literal: " + n); + } + + /** + * Assumes that the given node is a cdt:List literal and uses + * {@link CompositeDatatypeList#getValue(LiteralLabel)} to get + * the list. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. + */ + public static final List getList( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeList.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:List literal: " + n, ex); + } + } + + /** + * Assumes that the given node is a cdt:Map literal and uses + * {@link CompositeDatatypeMap#getValue(LiteralLabel)} to get + * the map. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. + */ + public static final Map getMap( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeMap.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n, ex); + } + } + + /** + * Calls {@link #ensureListLiteral(Node)} first, and {@link #getList(Node)} + * afterwards. + */ + public static final List checkAndGetList( final Node n ) throws ExprEvalException { + ensureListLiteral(n); + return getList(n); + } + + /** + * Calls {@link #ensureMapLiteral(Node)} first, and {@link #getMap(Node)} + * afterwards. + */ + public static final Map checkAndGetMap( final Node n ) throws ExprEvalException { + ensureMapLiteral(n); + return getMap(n); + } + + public static final List checkAndGetList( final NodeValue nv ) throws ExprEvalException { + return checkAndGetList( nv.asNode() ); + } + + public static final Map checkAndGetMap( final NodeValue nv ) throws ExprEvalException { + return checkAndGetMap( nv.asNode() ); + } + + /** + * Creates a {@link NodeValue} with a cdt:List literal that represents the + * given list. + */ + public static final NodeValue createNodeValue( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + + /** + * Creates a {@link NodeValue} with a cdt:Map literal that represents the + * given map. + */ + public static final NodeValue createNodeValue( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 89526d9215d..2867a64ccae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,16 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; @@ -25,42 +19,25 @@ public void checkBuild( final String uri, final ExprList args ) { @Override public NodeValue exec( final List args ) { if ( args.isEmpty() ) { - final List result = new ArrayList<>(); - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + final List result = Collections.emptyList(); + return CDTLiteralFunctionUtils.createNodeValue(result); } if ( args.size() == 1 ) { final NodeValue nv = args.get(0); // make sure that the argument is a well-formed cdt:List literal - getInputList(nv); + CDTLiteralFunctionUtils.checkAndGetList(nv); return nv; } final List result = new ArrayList<>(); for ( final NodeValue nv : args ) { - result.addAll( getInputList(nv) ); + final List l = CDTLiteralFunctionUtils.checkAndGetList(nv); + result.addAll(l); } - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - - protected List getInputList( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a cdt:List literal: " + nv); - - try { - return CompositeDatatypeList.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); - } + return CDTLiteralFunctionUtils.createNodeValue(result); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index b0a323e2e4c..6784dff603f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -13,12 +10,7 @@ public class ContainsFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java index f3a54dbe3c7..6cfcb050dc3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -5,9 +5,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,12 +13,7 @@ public class ContainsKeyFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); final Node n2 = nv2.asNode(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java index 6951d89992e..3ce25c92108 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; import org.apache.jena.sparql.function.FunctionBase2; @@ -14,12 +11,7 @@ public class ContainsTermFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsTerm( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 99210c10f0d..77491640be0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -13,13 +10,7 @@ public abstract class FunctionBase1List extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv); return _exec(list, nv); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index ae11240dc47..7a2a4e48ae6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -9,7 +9,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -21,15 +20,15 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); if ( CompositeDatatypeList.isListLiteral(n1) ) - return getFromList( n1.getLiteral(), nv2 ); + return getFromList(n1, nv2); if ( CompositeDatatypeMap.isMapLiteral(n1) ) - return getFromMap( n1.getLiteral(), nv2 ); + return getFromMap(n1, nv2); throw new ExprEvalException("Neither a list nor a map literal: " + nv1); } - protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromList( final Node n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -38,7 +37,7 @@ protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue(n1); + final List list = CDTLiteralFunctionUtils.getList(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -55,12 +54,12 @@ else if ( value.isNode() ) { } } - protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromMap( final Node n1, final NodeValue nv2 ) { final Node n2 = nv2.asNode(); if ( ! n2.isURI() && ! n2.isLiteral() ) throw new ExprEvalException("Not a valid map key: " + nv2); - final Map map = CompositeDatatypeMap.getValue(n1); + final Map map = CDTLiteralFunctionUtils.getMap(n1); if ( map.isEmpty() ) throw new ExprEvalException("empty map"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java index a2f4cb7a8c8..507c041fa2a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -7,12 +7,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -20,12 +14,7 @@ public class KeysFct extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n) ) - throw new ExprEvalException("Not a map literal: " + nv); - - final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv); final List list = new ArrayList<>( map.size() ); for ( final CDTKey key : map.keySet() ) { @@ -33,8 +22,7 @@ public NodeValue exec( final NodeValue nv ) { list.add(value); } - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(list); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index a8820ed567a..d151df0132e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -5,10 +5,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprException; @@ -40,9 +36,7 @@ public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv en list.add(v); } - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(list); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java index fd298d94010..f226ed1163d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -6,12 +6,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -19,12 +14,7 @@ public class RemoveFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); if ( map.isEmpty() ) return nv1; @@ -44,8 +34,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Map newMap = new HashMap<>(map); newMap.remove(key); - final LiteralLabel lit = new LiteralLabelForMap(newMap); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(newMap); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java index e2d2d3fd4ed..ffcb70bd1fa 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -4,10 +4,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.NodeValue; public class ReverseFct extends FunctionBase1List @@ -25,9 +21,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { } final List reverseList = Arrays.asList(reverseArray); - final LiteralLabel lit = new LiteralLabelForList(reverseList); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(reverseList); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 4121ba8db3b..4958369b0f3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,9 +2,7 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -15,26 +13,15 @@ public class SizeFct extends FunctionBase1 public NodeValue exec( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); - final int size; - try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - size = CompositeDatatypeList.getValue(lit).size(); - } - else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - size = CompositeDatatypeMap.getValue(lit).size(); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); - } + if ( CompositeDatatypeList.isListLiteral(n) ) { + size = CDTLiteralFunctionUtils.getList(n).size(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + size = CDTLiteralFunctionUtils.getMap(n).size(); } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); + else { + throw new ExprEvalException("Neither a list nor a map literal: " + nv); } return NodeValue.makeInteger(size); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java index d5e8f7b736b..3c0d200eabb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -5,11 +5,7 @@ import org.apache.jena.atlas.lib.Lib; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.query.QueryBuildException; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; @@ -20,7 +16,7 @@ public class SubSeqFct extends FunctionBase { @Override public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 && args.size() > 3 ) + if ( args.size() < 2 || args.size() > 3 ) throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); } @@ -29,8 +25,7 @@ public NodeValue exec( final List args ) { final NodeValue nv1 = args.get(0); final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + CDTLiteralFunctionUtils.ensureListLiteral(n1); final NodeValue nv2 = args.get(1); @@ -55,10 +50,10 @@ public NodeValue exec( final List args ) { if ( length < 0 ) throw new ExprEvalException("Illegal length value: " + nv3); - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); } else { - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); length = list.size() - index + 1; } @@ -82,9 +77,7 @@ public NodeValue exec( final List args ) { sublist = list.subList( index - 1, index - 1 + length ); } - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index a56581d3195..a8c38a88cc1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -3,10 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -18,9 +14,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { throw new ExprEvalException("Empty list"); final List sublist = list.subList( 1, list.size() ); - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } From af74bacffb74c672b42fba19e3363c934369051f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:32:48 +0200 Subject: [PATCH 133/323] adds support for cdt:put --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/PutFct.java | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 36ddc929809..fa97a88d342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java new file mode 100644 index 00000000000..dfb34b5b4ea --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java @@ -0,0 +1,94 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class PutFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 || args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() < 2 || args.size() > 3 ) + throw new ExprException("wrong number of arguments (" + args.size() + "), must be 2 or 3"); + + // check the second argument first because that's less expensive + final NodeValue nv2 = args.get(1).eval(binding, env); + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + // now check the first argument + final NodeValue nv1 = args.get(0).eval(binding, env); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + + final CDTKey key = CDTFactory.createKey(n2); + + // produce a map value from the third argument (if any) + final CDTValue newValue; + if ( args.size() == 2 ) { + newValue = CDTFactory.getNullValue(); + } + else { // in this case, we have that args.size() == 3 + NodeValue nv3 = null; + try { + nv3 = args.get(2).eval(binding, env); + } + catch ( final ExprException ex ) { + // nothing to do here + } + + if ( nv3 != null ) { + newValue = CDTFactory.createValue( nv3.asNode() ); + } + else { + newValue = CDTFactory.getNullValue(); + } + } + + // check if the given map already contains the exact same map entry + // if so, simply return the given cdt:Map literal + final CDTValue oldValue = map.get(key); + if ( oldValue != null ) { + if ( oldValue.isNull() && newValue.isNull() ) + return nv1; + + if ( ! oldValue.isNull() && ! newValue.isNull() ) { + final Node on = oldValue.asNode(); + final Node nn = newValue.asNode(); + if ( on.equals(nn) ) + return nv1; + } + } + + final Map newMap = new HashMap<>(map); + newMap.put(key, newValue); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From e92b6a4135e2670cad65499c284bf5f2c8143a49 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:34:57 +0200 Subject: [PATCH 134/323] renames CollectionLiteralFunctions to CDTLiteralFunctions --- .../java/org/apache/jena/sparql/function/ARQFunctions.java | 4 ++-- ...llectionLiteralFunctions.java => CDTLiteralFunctions.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/{CollectionLiteralFunctions.java => CDTLiteralFunctions.java} (97%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 2acb95dbf84..7694f96276a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; +import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -34,6 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); - CollectionLiteralFunctions.register(reg); + CDTLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java index fa97a88d342..b388733831c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java @@ -3,7 +3,7 @@ import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; -public class CollectionLiteralFunctions { +public class CDTLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); From 76fc2ba7ce4fb880e50cb89139a09525e3b9d54d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:36:46 +0200 Subject: [PATCH 135/323] renames 'org.apache.jena.sparql.function.library.collections' package to 'org.apache.jena.sparql.function.library.cdt' --- .../main/java/org/apache/jena/sparql/function/ARQFunctions.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctionUtils.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctions.java | 2 +- .../sparql/function/library/{collection => cdt}/ConcatFct.java | 2 +- .../function/library/{collection => cdt}/ContainsFct.java | 2 +- .../function/library/{collection => cdt}/ContainsKeyFct.java | 2 +- .../function/library/{collection => cdt}/ContainsTermFct.java | 2 +- .../function/library/{collection => cdt}/FunctionBase1List.java | 2 +- .../sparql/function/library/{collection => cdt}/GetFct.java | 2 +- .../sparql/function/library/{collection => cdt}/HeadFct.java | 2 +- .../sparql/function/library/{collection => cdt}/KeysFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ListFct.java | 2 +- .../sparql/function/library/{collection => cdt}/PutFct.java | 2 +- .../sparql/function/library/{collection => cdt}/RemoveFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ReverseFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SizeFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SubSeqFct.java | 2 +- .../sparql/function/library/{collection => cdt}/TailFct.java | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctionUtils.java (98%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctions.java (96%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ConcatFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsKeyFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsTermFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/FunctionBase1List.java (88%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/GetFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/HeadFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/KeysFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ListFct.java (95%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/PutFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/RemoveFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ReverseFct.java (91%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SizeFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SubSeqFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/TailFct.java (89%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 7694f96276a..9c76c037231 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java similarity index 98% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d1d3f90c69e..1fa1b956656 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java similarity index 96% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index b388733831c..94c3a8af018 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index 2867a64ccae..fc7ed60734d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index 6784dff603f..f9751d78ca5 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index 6cfcb050dc3..eca1978ba1e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index 3ce25c92108..da670a6508e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java similarity index 88% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index 77491640be0..b6f45b33e4b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index 7a2a4e48ae6..c83cd9b764f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index aebd5f39611..1f331c936ac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 507c041fa2a..6c393370ff1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java similarity index 95% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index d151df0132e..ca7c0f92715 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index dfb34b5b4ea..0df7dcfdf00 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index f226ed1163d..0a4a5a99b36 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java similarity index 91% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index ffcb70bd1fa..3d28e7a76e0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 4958369b0f3..5166f1440d9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 3c0d200eabb..80a99fb32f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Collections; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java similarity index 89% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index a8c38a88cc1..70805975786 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; From 71c9da15ae0048727e38cbdf23db9f6bc42602e2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 19:06:28 +0200 Subject: [PATCH 136/323] adds support for cdt:Map constructor --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MapFct.java | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 94c3a8af018..36d36c7fc95 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java new file mode 100644 index 00000000000..3dba18232eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -0,0 +1,84 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class MapFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() % 2 == 1 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() % 2 == 1 ) + throw new ExprException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + + final Map map = new HashMap<>(); + + final Iterator it = args.iterator(); + while ( it.hasNext() ) { + final Expr exprKey = it.next(); + final Expr exprValue = it.next(); + + final CDTKey key = getKey(exprKey, binding, env); + if ( key != null ) { + final CDTValue value = getValue(exprValue, binding, env); + map.put(key, value); + } + } + + return CDTLiteralFunctionUtils.createNodeValue(map); + } + + protected CDTKey getKey( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return null; + } + + final Node n = nv.asNode(); + if ( ! n.isURI() && ! n.isLiteral() ) + return null; + + return CDTFactory.createKey(n); + } + + protected CDTValue getValue( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return CDTFactory.getNullValue(); + } + + return CDTFactory.createValue( nv.asNode() ); + } + + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From c0029948aa4b398534c927848a4a423241a5f350 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 21 Aug 2023 12:56:33 +0200 Subject: [PATCH 137/323] big fix: CDTKey does not have a 'isNode()' function anymore --- .../jena/sparql/engine/iterator/QueryIterUnfold.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index fa1e3c7c570..2b518efc68c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -207,13 +207,7 @@ protected Binding moveToNextBinding() { final CDTKey key = elmt.getKey(); final CDTValue value = elmt.getValue(); - final Node keyNode; - if ( key.isNode() ) { - keyNode = key.asNode(); - } - else { - throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); - } + final Node keyNode = key.asNode(); if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); From ef651462c00b36ca2b1a3c82af6261f62dbdd11f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 14:16:31 +0200 Subject: [PATCH 138/323] the datatypes for the CDT literals need to be registered --- jena-arq/src/main/java/org/apache/jena/query/ARQ.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java index a104dcf8ca7..941f90f6c89 100644 --- a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java +++ b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java @@ -22,6 +22,9 @@ import java.util.concurrent.TimeUnit; import org.apache.jena.atlas.lib.Version; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.datatypes.TypeMapper; import org.apache.jena.http.sys.HttpRequestModifier; import org.apache.jena.http.sys.RegistryRequestModifier; import org.apache.jena.riot.RIOT; @@ -664,6 +667,10 @@ public static void init() { AggregateRegistry.init(); PropertyFunctionRegistry.init(); + // Register the datatypes for the CDT literals + TypeMapper.getInstance().registerDatatype(CompositeDatatypeList.type) ; + TypeMapper.getInstance().registerDatatype(CompositeDatatypeMap.type) ; + JenaSystem.logLifecycle("ARQ.init - finish"); } } From de715ebaa282f45385b6866d8b05b3c04aae018d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 17:32:00 +0200 Subject: [PATCH 139/323] changes the implementation of LiteralLabelForCDTs to use the corresponding CompositeDatatypeBase implementation more directly --- .../jena/cdt/CompositeDatatypeBase.java | 7 ++++- .../jena/cdt/CompositeDatatypeList.java | 12 ++++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 7 ++++- .../apache/jena/cdt/LiteralLabelForCDTs.java | 31 +++++++------------ .../apache/jena/cdt/LiteralLabelForList.java | 20 +----------- .../apache/jena/cdt/LiteralLabelForMap.java | 20 +----------- 6 files changed, 36 insertions(+), 61 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index ca5e1878c18..5c1e768a424 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -18,9 +18,10 @@ package org.apache.jena.cdt; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; -public abstract class CompositeDatatypeBase implements RDFDatatype +public abstract class CompositeDatatypeBase implements RDFDatatype { @Override public Class getJavaClass() { @@ -42,4 +43,8 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) return this; } + @Override + public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; + + public abstract String unparseValue( final T value ); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 13cb5ee8d01..2b4aa0a30c6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -28,7 +28,7 @@ import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; -public class CompositeDatatypeList extends CompositeDatatypeBase +public class CompositeDatatypeList extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); @@ -49,6 +49,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final List list = (List) value; + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { return unparseList(list); } @@ -246,11 +251,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } + @SuppressWarnings("unchecked") public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } else { + final Object value = lit.getValue(); + //if ( value != null && value instanceof List ) + //return (List) value; + final String lex = lit.getLexicalForm(); return parseList(lex); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 6dec66e9920..9853c41fb18 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -7,7 +7,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -public class CompositeDatatypeMap extends CompositeDatatypeBase +public class CompositeDatatypeMap extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); @@ -28,6 +28,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final Map map = (Map) value; + return unparseValue(map); + } + + @Override + public String unparseValue( final Map map ) { return unparseMap(map); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 0f87a5ea33f..6fea1cfee96 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -30,6 +30,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + @Override + public abstract CompositeDatatypeBase getDatatype(); + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + @Override public boolean isXML() { return false; @@ -81,14 +89,12 @@ public String toString() { @Override public String getLexicalForm() { if ( lexicalForm == null ) { - lexicalForm = unparseValueForm(valueForm); + lexicalForm = getDatatype().unparseValue(valueForm); } return lexicalForm; } - protected abstract String unparseValueForm( T valueForm ); - protected boolean isLexicalFormSet() { return lexicalForm != null; } @@ -117,30 +123,15 @@ public T getValue() throws DatatypeFormatException { // try again at the next call of 'getValue()' because now we have // set 'lexicalFormTested'. - valueForm = parseLexicalForm(lexicalForm); + valueForm = getDatatype().parse(lexicalForm); } return valueForm; } - protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - @Override public boolean sameValueAs( final LiteralLabel other ) { - if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { - return false; - } - - if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { - return true; - } - - return getValue().equals( other.getValue() ); + return getDatatype().isEqual(this, other); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index bc626e0fd01..e84fe915333 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -20,8 +20,6 @@ import java.util.List; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForList extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForList( final String lexicalForm ) { } @Override - protected String unparseValueForm( List valueForm ) { - return CompositeDatatypeList.unparseList(valueForm); - } - - @Override - protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 1d5093e1da7..18ad753f62c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -20,8 +20,6 @@ import java.util.Map; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForMap extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForMap( final String lexicalForm ) { } @Override - protected String unparseValueForm( Map valueForm ) { - return CompositeDatatypeMap.unparseMap(valueForm); - } - - @Override - protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; } From fd445d4a3e381e8ed570d5bc51f51600bfd131d5 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 15 Sep 2023 09:52:19 +0200 Subject: [PATCH 140/323] some clean up in CompositeDatatypeList and in CompositeDatatypeMap --- .../jena/cdt/CompositeDatatypeList.java | 199 +++++++++--------- .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++++++-------- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 3 files changed, 188 insertions(+), 188 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2b4aa0a30c6..d73d1314227 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -40,73 +40,6 @@ public String getURI() { return uri; } - @Override - public String unparse( final Object value ) { - if ( !(value instanceof List) ) { - throw new IllegalArgumentException(); - } - - @SuppressWarnings("unchecked") - final List list = (List) value; - - return unparseValue(list); - } - - @Override - public String unparseValue( final List list ) { - return unparseList(list); - } - - public static String unparseList( final List list ) { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final CDTValue firstElmt = it.next(); - final String firstElmtAsString = unparseListElement(firstElmt); - sb.append(firstElmtAsString); - while ( it.hasNext() ) { - final CDTValue nextElmt = it.next(); - final String nextElmtAsString = unparseListElement(nextElmt); - sb.append(", "); - sb.append(nextElmtAsString); - } - } - sb.append("]"); - return sb.toString(); - } - - public static String unparseListElement( final CDTValue elmt ) { - return elmt.asLexicalForm(); - } - - @Override - public List parse( final String lexicalForm ) throws DatatypeFormatException { - return parseList(lexicalForm); - } - - public static List parseList( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - @Override public boolean isValidValue( final Object value ) { if ( !(value instanceof List) ) { @@ -129,7 +62,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { // datatype and the implementation of LiteralLabelForList makes // sure that these are valid. if ( lit instanceof LiteralLabelForList ) { - return true; + return lit.isWellFormed(); } // However, the given LiteralLabel may come from somewhere else, @@ -149,27 +82,78 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } - /** - * Returns true if the given node is a literal with {@link #uri} - * as its datatype URI. Notice that this does not mean that this - * literal is actually valid; for checking validity, use - * {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final Node n ) { - return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } } - /** - * Returns true if the datatype URI of the given {@link LiteralLabel} is - * {@link #uri}. Notice that this does not mean that this LiteralLabel is - * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final LiteralLabel lit ) { - return lit.getDatatypeURI().equals(uri); + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + protected String unparseListElement( final CDTValue elmt ) { + return elmt.asLexicalForm(); + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isListLiteral(value1) || ! isListLiteral(value2) ) { + return false; + } + final List list1 = getValue(value1); final List list2 = getValue(value2); @@ -201,7 +185,10 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return true; } - public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + /** + * Assumes that the datatype of both of the given literals is cdt:List. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { final List list1; final List list2; try { @@ -251,29 +238,41 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } - @SuppressWarnings("unchecked") + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given literal is {@link #uri}. + * Notice that this does not mean that this literal is actually valid; + * for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + + /** + * Assumes that the datatype of the given literal is cdt:List. + */ public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } - else { - final Object value = lit.getValue(); - //if ( value != null && value instanceof List ) - //return (List) value; - final String lex = lit.getLexicalForm(); - return parseList(lex); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof List) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForList ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); - } + @SuppressWarnings("unchecked") + final List list = (List) value; + return list; } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 9853c41fb18..c80adb4bce9 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -19,6 +19,76 @@ public String getURI() { return uri; } + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return lit.isWellFormed(); + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive ' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + @Override public String unparse( final Object value ) { if ( !(value instanceof Map) ) { @@ -33,10 +103,6 @@ public String unparse( final Object value ) { @Override public String unparseValue( final Map map ) { - return unparseMap(map); - } - - public static String unparseMap( final Map map ) { final StringBuilder sb = new StringBuilder(); sb.append("{"); if ( ! map.isEmpty() ) { @@ -57,82 +123,27 @@ public static String unparseMap( final Map map ) { return sb.toString(); } - public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + protected void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); sb.append( entry.getValue().asLexicalForm() ); } @Override - public Map parse( final String lexicalForm ) throws DatatypeFormatException { - return parseMap(lexicalForm); - } - - public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - - @Override - public boolean isValidValue( final Object value ) { - if ( !(value instanceof Map) ) { - return false; - } - - final Map m = (Map) value; - for ( final Map.Entry e : m.entrySet() ) { - if ( !(e.getKey() instanceof CDTKey) ) { - return false; - } - if ( !(e.getValue() instanceof CDTValue) ) { - return false; - } - } - - return true; + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override - public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForMap objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForMap makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForMap ) { - return true; - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - - final String dtURI = lit.getDatatypeURI(); - if ( dtURI == null || ! dtURI.equals(uri) ) { + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { return false; } - final String lang = lit.language(); - if ( lang != null && ! lang.isEmpty() ) { - return false; - } + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); - final String lex = lit.getLexicalForm(); - return isValid(lex); + return map1.equals(map2); } /** @@ -154,32 +165,22 @@ public static boolean isMapLiteral( final LiteralLabel lit ) { return lit.getDatatypeURI().equals(uri); } - @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); - - return map1.equals(map2); - } - + /** + * Assumes that the datatype of the given literal is cdt:Map. + */ public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } - else { - final String lex = lit.getLexicalForm(); - return parseMap(lex); - } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForMap ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof Map) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + return map; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 5a054044bd6..3ae359062de 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -808,7 +808,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.type.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2) ; } catch( final ExprNotComparableException e ) { raise(e) ; From 4f71f6f73a2f465dfaa48dce820ad3db564577c8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 18 Sep 2023 10:54:46 +0200 Subject: [PATCH 141/323] fixes implementation of 'map-equal' --- .../apache/jena/cdt/CompositeDatatypeMap.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index c80adb4bce9..e79b3bd3835 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -135,15 +136,36 @@ public int getHashCode( final LiteralLabel lit ) { } @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { + public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { + if ( ! isMapLiteral(lit1) || ! isMapLiteral(lit2) ) { return false; } - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); + final Map map1 = getValue(lit1); + final Map map2 = getValue(lit2); - return map1.equals(map2); + if ( map1.size() != map2.size() ) return false; + + for ( final Map.Entry entry1 : map1.entrySet() ) { + final CDTValue v1 = entry1.getValue(); + final CDTValue v2 = map2.get( entry1.getKey() ); + if ( v2 == null ) return false; + + if ( v1.isNull() || v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared"); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) return false; + } + + return true; } /** From 51cdf5aa8d17efbfe623fa8b4cb827a7b7bb1288 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Sep 2023 17:21:20 +0200 Subject: [PATCH 142/323] adds support for cdt:merge --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MergeFct.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 36d36c7fc95..48f5d4a7465 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -14,6 +14,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "merge", MergeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java new file mode 100644 index 00000000000..ddeb872b3ce --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -0,0 +1,30 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class MergeFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Map map1 = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + final Map map2 = CDTLiteralFunctionUtils.checkAndGetMap(nv2); + + if ( map1.isEmpty() ) + return nv2; + + if ( map2.isEmpty() ) + return nv1; + + final Map newMap = new HashMap<>(map2); + newMap.putAll(map1); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + +} From bcdc0c6a998e8bf33a118489e59ed04f4466ead6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 11:26:24 +0200 Subject: [PATCH 143/323] extends SPARQL parser to recognize ORDER BY for FOLD --- jena-arq/Grammar/arq.jj | 39 +- jena-arq/Grammar/main.jj | 8 +- .../expr/aggregate/AggregatorFactory.java | 9 +- .../jena/sparql/lang/arq/ARQParser.java | 819 ++++- .../sparql/lang/sparql_11/JavaCharStream.java | 128 +- .../sparql/lang/sparql_11/ParseException.java | 48 +- .../sparql/lang/sparql_11/SPARQLParser11.java | 3044 ++++++++--------- .../sparql_11/SPARQLParser11TokenManager.java | 616 ++-- .../jena/sparql/lang/sparql_11/Token.java | 7 +- .../sparql/lang/sparql_11/TokenMgrError.java | 21 +- 10 files changed, 2759 insertions(+), 1980 deletions(-) diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 40445623781..0629207d816 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -300,6 +300,26 @@ void OrderCondition() : else getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} void LimitOffsetClauses() : { } { ( @@ -1625,14 +1645,25 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { Expr orderByExpr = null ; - Var orderByVar = null ; - int orderByDirection = Query.ORDER_DEFAULT ; } + { java.util.List scs = null ; + SortCondition sc = null ; } + ( { distinct = true ; } )? expr = Expression() ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? - { agg = AggregatorFactory.createFold(expr, expr2) ; } + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } | t = { String iri ; } iri = iri() diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 9d60ec0173a..7cb8d7b9a3b 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -487,13 +487,13 @@ SortCondition OrderConditionForAggregationFunction() : ( ( // These are for clarity in the HTML ( { direction = Query.ORDER_ASCENDING ; } - | { direction = Query.ORDER_DESCENDING ; } ) - expr = BrackettedExpression() + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() ) | ( expr = Constraint() - | v = Var() //{ expr = asExpr(v) ; } - ) + | v = Var() //{ expr = asExpr(v) ; } + ) ) { if ( v == null ) return new SortCondition(expr, direction) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index d11f16dfde9..6c492069c18 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -18,8 +18,11 @@ package org.apache.jena.sparql.expr.aggregate ; +import java.util.List; + import org.apache.jena.atlas.lib.NotImplemented ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.expr.Expr ; import org.apache.jena.sparql.expr.ExprList ; @@ -71,7 +74,11 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, Expr expr2) { + public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { + if ( distinct ) + throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; + if ( orderBy != null ) + System.out.println( "HERE!! " + orderBy.size() ); return new AggFold(expr1, expr2) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 9b6244421d6..5f3968f7497 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -4537,6 +4537,59 @@ final public Var Var() throws ParseException { throw new Error("Missing return statement in function"); } +<<<<<<< HEAD +======= + final public Node GraphTerm() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + iri = iri(); + {if (true) return createNode(iri) ;} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return n ;} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + case INTEGER_POSITIVE: + case DECIMAL_POSITIVE: + case DOUBLE_POSITIVE: + case INTEGER_NEGATIVE: + case DECIMAL_NEGATIVE: + case DOUBLE_NEGATIVE: + n = NumericLiteral(); + {if (true) return n ;} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return n ;} + break; + case BLANK_NODE_LABEL: + case ANON: + n = BlankNode(); + {if (true) return n ;} + break; + case NIL: + jj_consume_token(NIL); + {if (true) return nRDFnil ;} + break; + default: + jj_la1[143] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) final public Expr Expression() throws ParseException { Expr expr ; expr = ConditionalOrExpression(); @@ -4554,7 +4607,11 @@ final public Expr ConditionalOrExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[143] = jj_gen; +======= + jj_la1[144] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_37; } jj_consume_token(SC_OR); @@ -4575,7 +4632,11 @@ final public Expr ConditionalAndExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[144] = jj_gen; +======= + jj_la1[145] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_38; } jj_consume_token(SC_AND); @@ -4648,13 +4709,21 @@ final public Expr RelationalExpression() throws ParseException { expr1 = new E_NotOneOf(expr1, a) ; break; default: +<<<<<<< HEAD jj_la1[145] = jj_gen; +======= + jj_la1[146] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } break; default: +<<<<<<< HEAD jj_la1[146] = jj_gen; +======= + jj_la1[147] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } {if (true) return expr1 ;} @@ -4685,7 +4754,11 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[147] = jj_gen; +======= + jj_la1[148] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_39; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4723,7 +4796,11 @@ final public Expr AdditiveExpression() throws ParseException { addition = false ; break; default: +<<<<<<< HEAD jj_la1[148] = jj_gen; +======= + jj_la1[149] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4735,7 +4812,11 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[149] = jj_gen; +======= + jj_la1[150] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_40; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4750,7 +4831,11 @@ final public Expr AdditiveExpression() throws ParseException { expr2 = new E_Divide(expr2, expr3) ; break; default: +<<<<<<< HEAD jj_la1[150] = jj_gen; +======= + jj_la1[151] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4761,7 +4846,11 @@ final public Expr AdditiveExpression() throws ParseException { expr1 = new E_Subtract(expr1, expr2) ; break; default: +<<<<<<< HEAD jj_la1[151] = jj_gen; +======= + jj_la1[152] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4783,7 +4872,11 @@ final public Expr MultiplicativeExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[152] = jj_gen; +======= + jj_la1[153] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_41; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4808,7 +4901,11 @@ final public Expr MultiplicativeExpression() throws ParseException { expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; default: +<<<<<<< HEAD jj_la1[153] = jj_gen; +======= + jj_la1[154] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4942,7 +5039,11 @@ final public Expr UnaryExpression() throws ParseException { {if (true) return expr ;} break; default: +<<<<<<< HEAD jj_la1[154] = jj_gen; +======= + jj_la1[155] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5080,7 +5181,11 @@ final public Expr PrimaryExpression() throws ParseException { {if (true) return asExpr(n) ;} break; default: +<<<<<<< HEAD jj_la1[155] = jj_gen; +======= + jj_la1[156] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5125,7 +5230,11 @@ final public Node ExprVarOrTerm() throws ParseException { n = ExprQuotedTriple(); break; default: +<<<<<<< HEAD jj_la1[156] = jj_gen; +======= + jj_la1[157] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5226,7 +5335,11 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: +<<<<<<< HEAD jj_la1[157] = jj_gen; +======= + jj_la1[158] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5242,7 +5355,11 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: +<<<<<<< HEAD jj_la1[158] = jj_gen; +======= + jj_la1[159] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5262,7 +5379,11 @@ final public Expr BuiltInCall() throws ParseException { {if (true) return makeFunction_BNode() ;} break; default: +<<<<<<< HEAD jj_la1[159] = jj_gen; +======= + jj_la1[160] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -6290,7 +6411,10 @@ final public Expr Aggregate() throws ParseException { case SECONDS: case TIMEZONE: case TZ: +<<<<<<< HEAD case ADJUST: +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) case NOW: case UUID: case STRUUID: @@ -6638,13 +6762,43 @@ private boolean jj_2_5(int xla) { finally { jj_save(4, xla); } } +<<<<<<< HEAD private boolean jj_3R_101() { +======= + private boolean jj_3R_103() { + if (jj_3R_120()) return true; + return false; + } + + private boolean jj_3R_102() { + if (jj_scan_token(IS_NUMERIC)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_158() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_101() { + if (jj_scan_token(IS_LITERAL)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_100() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_100() { +======= + private boolean jj_3R_99() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -6710,35 +6864,68 @@ private boolean jj_3_2() { return false; } +<<<<<<< HEAD private boolean jj_3R_97() { +======= + private boolean jj_3R_98() { + if (jj_scan_token(IS_IRI)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_97() { + if (jj_scan_token(SAME_TERM)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_96() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_96() { +======= + private boolean jj_3R_95() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_95() { +======= + private boolean jj_3R_94() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_168() { +======= + private boolean jj_3R_159() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LBRACKET)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_94() { +======= + private boolean jj_3R_93() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_158() { if (jj_3R_168()) return true; return false; @@ -6778,53 +6965,121 @@ private boolean jj_3R_91() { } private boolean jj_3R_90() { +======= + private boolean jj_3R_92() { + if (jj_scan_token(COALESCE)) return true; + if (jj_3R_117()) return true; + return false; + } + + private boolean jj_3R_152() { + if (jj_3R_159()) return true; + return false; + } + + private boolean jj_3R_91() { + if (jj_scan_token(VERSION)) return true; + if (jj_scan_token(NIL)) return true; + return false; + } + + private boolean jj_3R_90() { + if (jj_scan_token(SHA512)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_126() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_151()) { + jj_scanpos = xsp; + if (jj_3R_152()) return true; + } + return false; + } + + private boolean jj_3R_151() { + if (jj_3R_158()) return true; + return false; + } + + private boolean jj_3R_89() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_89() { +======= + private boolean jj_3R_88() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_88() { +======= + private boolean jj_3R_87() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_87() { +======= + private boolean jj_3R_86() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_86() { +======= + private boolean jj_3R_85() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_85() { +======= + private boolean jj_3R_84() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_84() { +======= + private boolean jj_3R_83() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_83() { if (jj_scan_token(ADJUST)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; @@ -6922,7 +7177,11 @@ private boolean jj_3R_67() { } private boolean jj_3R_66() { +<<<<<<< HEAD if (jj_3R_120()) return true; +======= + if (jj_3R_119()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -6933,13 +7192,21 @@ private boolean jj_3R_65() { } private boolean jj_3R_64() { +<<<<<<< HEAD if (jj_3R_119()) return true; +======= + if (jj_3R_118()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; +<<<<<<< HEAD if (jj_3R_118()) return true; +======= + if (jj_3R_117()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -6985,12 +7252,20 @@ private boolean jj_3R_56() { return false; } +<<<<<<< HEAD private boolean jj_3R_117() { +======= + private boolean jj_3R_116() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_116() { +======= + private boolean jj_3R_115() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LPAREN)) return true; return false; } @@ -6999,9 +7274,15 @@ private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_116()) { jj_scanpos = xsp; if (jj_3R_117()) return true; +======= + if (jj_3R_115()) { + jj_scanpos = xsp; + if (jj_3R_116()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -7049,7 +7330,11 @@ private boolean jj_3R_48() { } private boolean jj_3R_47() { +<<<<<<< HEAD if (jj_3R_115()) return true; +======= + if (jj_3R_114()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7182,10 +7467,14 @@ private boolean jj_3R_44() { jj_scanpos = xsp; if (jj_3R_109()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) return true; } +======= + if (jj_3R_110()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -7252,26 +7541,44 @@ private boolean jj_3R_44() { return false; } +<<<<<<< HEAD private boolean jj_3R_160() { +======= + private boolean jj_3R_154() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IRIref)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_178() { +======= + private boolean jj_3R_182() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(ANON)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_165() { Token xsp; xsp = jj_scanpos; if (jj_3R_177()) { jj_scanpos = xsp; if (jj_3R_178()) return true; +======= + private boolean jj_3R_172() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_181()) { + jj_scanpos = xsp; + if (jj_3R_182()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_177() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; @@ -7328,20 +7635,107 @@ private boolean jj_3R_182() { } private boolean jj_3R_181() { +======= + private boolean jj_3R_181() { + if (jj_scan_token(BLANK_NODE_LABEL)) return true; + return false; + } + + private boolean jj_3R_174() { + if (jj_scan_token(PNAME_NS)) return true; + return false; + } + + private boolean jj_3R_173() { + if (jj_scan_token(PNAME_LN)) return true; + return false; + } + + private boolean jj_3R_168() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_173()) { + jj_scanpos = xsp; + if (jj_3R_174()) return true; + } + return false; + } + + private boolean jj_3R_161() { + if (jj_3R_168()) return true; + return false; + } + + private boolean jj_3R_153() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_160()) { + jj_scanpos = xsp; + if (jj_3R_161()) return true; + } + return false; + } + + private boolean jj_3R_160() { + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_186() { + if (jj_scan_token(STRING_LITERAL_LONG2)) return true; + return false; + } + + private boolean jj_3R_185() { + if (jj_scan_token(STRING_LITERAL_LONG1)) return true; + return false; + } + + private boolean jj_3R_184() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL2)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_180() { +======= + private boolean jj_3R_183() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL1)) return true; return false; } +<<<<<<< HEAD +======= + private boolean jj_3R_175() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_183()) { + jj_scanpos = xsp; + if (jj_3R_184()) { + jj_scanpos = xsp; + if (jj_3R_185()) { + jj_scanpos = xsp; + if (jj_3R_186()) return true; + } + } + } + return false; + } + + private boolean jj_3R_180() { + if (jj_scan_token(FALSE)) return true; + return false; + } + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_180()) { + if (jj_3R_179()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_181()) { jj_scanpos = xsp; if (jj_3R_182()) { @@ -7349,10 +7743,14 @@ private boolean jj_3R_171() { if (jj_3R_183()) return true; } } +======= + if (jj_3R_180()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_176() { if (jj_scan_token(FALSE)) return true; return false; @@ -7369,38 +7767,85 @@ private boolean jj_3R_164() { } private boolean jj_3R_175() { +======= + private boolean jj_3R_179() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_197() { + private boolean jj_3R_145() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3R_198() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_196() { + private boolean jj_3R_197() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_195() { + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_196() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_186() { +======= + private boolean jj_3R_189() { Token xsp; xsp = jj_scanpos; - if (jj_3R_195()) { - jj_scanpos = xsp; if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_197()) return true; + if (jj_3R_197()) { + jj_scanpos = xsp; + if (jj_3R_198()) return true; } } return false; } + private boolean jj_3R_195() { + if (jj_scan_token(DOUBLE_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_194() { + if (jj_scan_token(DECIMAL_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_193() { + if (jj_scan_token(INTEGER_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_188() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) + Token xsp; + xsp = jj_scanpos; + if (jj_3R_193()) { + jj_scanpos = xsp; + if (jj_3R_194()) { + jj_scanpos = xsp; + if (jj_3R_195()) return true; + } + } + return false; + } + +<<<<<<< HEAD private boolean jj_3R_146() { if (jj_scan_token(LBRACE)) return true; return false; @@ -7422,14 +7867,27 @@ private boolean jj_3R_193() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_192() { - if (jj_scan_token(INTEGER_POSITIVE)) return true; + if (jj_scan_token(DOUBLE)) return true; + return false; + } + + private boolean jj_3R_191() { + if (jj_scan_token(DECIMAL)) return true; + return false; + } + + private boolean jj_3R_190() { + if (jj_scan_token(INTEGER)) return true; return false; } private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_192()) { jj_scanpos = xsp; if (jj_3R_193()) { @@ -7460,14 +7918,19 @@ private boolean jj_3R_184() { xsp = jj_scanpos; if (jj_3R_189()) { jj_scanpos = xsp; +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_191()) return true; + if (jj_3R_191()) { + jj_scanpos = xsp; + if (jj_3R_192()) return true; } } return false; } +<<<<<<< HEAD private boolean jj_3R_174() { if (jj_3R_186()) return true; return false; @@ -7480,6 +7943,64 @@ private boolean jj_3R_173() { private boolean jj_3R_172() { if (jj_3R_184()) return true; +======= + private boolean jj_3R_178() { + if (jj_3R_189()) return true; + return false; + } + + private boolean jj_3R_177() { + if (jj_3R_188()) return true; + return false; + } + + private boolean jj_3R_176() { + if (jj_3R_187()) return true; + return false; + } + + private boolean jj_3R_170() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_176()) { + jj_scanpos = xsp; + if (jj_3R_177()) { + jj_scanpos = xsp; + if (jj_3R_178()) return true; + } + } + return false; + } + + private boolean jj_3R_169() { + if (jj_3R_175()) return true; + return false; + } + + private boolean jj_3R_143() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_153()) return true; + return false; + } + + private boolean jj_3R_167() { + if (jj_scan_token(NIL)) return true; + return false; + } + + private boolean jj_3R_166() { + if (jj_3R_172()) return true; + return false; + } + + private boolean jj_3R_165() { + if (jj_3R_171()) return true; + return false; + } + + private boolean jj_3R_164() { + if (jj_3R_170()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7496,7 +8017,35 @@ private boolean jj_3R_163() { return false; } + private boolean jj_3R_113() { + if (jj_3R_126()) return true; + return false; + } + + private boolean jj_3R_157() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_162()) { + jj_scanpos = xsp; + if (jj_3R_163()) { + jj_scanpos = xsp; + if (jj_3R_164()) { + jj_scanpos = xsp; + if (jj_3R_165()) { + jj_scanpos = xsp; + if (jj_3R_166()) { + jj_scanpos = xsp; + if (jj_3R_167()) return true; + } + } + } + } + } + return false; + } + private boolean jj_3R_162() { +<<<<<<< HEAD if (jj_3R_171()) return true; return false; } @@ -7508,6 +8057,28 @@ private boolean jj_3R_144() { } private boolean jj_3R_161() { +======= + if (jj_3R_153()) return true; + return false; + } + + private boolean jj_3R_46() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_112()) { + jj_scanpos = xsp; + if (jj_3R_113()) return true; + } + return false; + } + + private boolean jj_3R_112() { + if (jj_3R_125()) return true; + return false; + } + + private boolean jj_3R_156() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7517,6 +8088,7 @@ private boolean jj_3R_161() { return false; } +<<<<<<< HEAD private boolean jj_3R_114() { if (jj_3R_127()) return true; return false; @@ -7537,6 +8109,8 @@ private boolean jj_3R_113() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; if (jj_3R_46()) return true; @@ -7548,59 +8122,100 @@ private boolean jj_3_1() { return false; } +<<<<<<< HEAD private boolean jj_3R_143() { +======= + private boolean jj_3R_142() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(FOLD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_142() { +======= + private boolean jj_3R_141() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_141() { +======= + private boolean jj_3R_140() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_140() { +======= + private boolean jj_3R_139() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_139() { +======= + private boolean jj_3R_138() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_138() { +======= + private boolean jj_3R_137() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_145() { if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_137() { +======= + private boolean jj_3R_136() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_118() { +======= + private boolean jj_3R_144() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_117() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(187)) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_145()) return true; +======= + if (jj_3R_144()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -7611,23 +8226,37 @@ private boolean jj_3_5() { return false; } +<<<<<<< HEAD private boolean jj_3R_166() { if (jj_scan_token(LT2)) return true; return false; } private boolean jj_3R_136() { +======= + private boolean jj_3R_135() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_135() { +======= + private boolean jj_3R_124() { + if (jj_3R_147()) return true; + return false; + } + + private boolean jj_3R_134() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_156() { if (jj_3R_166()) return true; return false; @@ -7639,11 +8268,15 @@ private boolean jj_3R_155() { } private boolean jj_3R_134() { +======= + private boolean jj_3R_133() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_125() { if (jj_3R_148()) return true; return false; @@ -7660,11 +8293,27 @@ private boolean jj_3R_153() { } private boolean jj_3R_133() { +======= + private boolean jj_3R_147() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_155() { + if (jj_scan_token(LT2)) return true; + return false; + } + + private boolean jj_3R_132() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_152() { if (jj_3R_163()) return true; return false; @@ -7676,11 +8325,15 @@ private boolean jj_3R_151() { } private boolean jj_3R_132() { +======= + private boolean jj_3R_131() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_148() { if (jj_scan_token(PREFIX)) return true; if (jj_scan_token(PNAME_NS)) return true; @@ -7690,20 +8343,33 @@ private boolean jj_3R_148() { private boolean jj_3R_150() { if (jj_3R_159()) return true; +======= + private boolean jj_3R_150() { + if (jj_3R_157()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_149() { +<<<<<<< HEAD if (jj_3R_161()) return true; return false; } private boolean jj_3R_131() { +======= + if (jj_3R_156()) return true; + return false; + } + + private boolean jj_3R_130() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; @@ -7733,17 +8399,64 @@ private boolean jj_3R_126() { } private boolean jj_3R_130() { +======= + private boolean jj_3R_148() { + if (jj_3R_155()) return true; + return false; + } + + private boolean jj_3R_146() { + if (jj_scan_token(BASE)) return true; + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_129() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_129() { +======= + private boolean jj_3R_125() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_148()) { + jj_scanpos = xsp; + if (jj_3R_149()) { + jj_scanpos = xsp; + if (jj_3R_150()) return true; + } + } + return false; + } + + private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) { + jj_scanpos = xsp; + if (jj_3R_124()) return true; + } + return false; + } + + private boolean jj_3R_123() { + if (jj_3R_146()) return true; + return false; + } + + private boolean jj_3R_128() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_147() { if (jj_scan_token(BASE)) return true; if (jj_3R_160()) return true; @@ -7765,24 +8478,42 @@ private boolean jj_3R_124() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_45() { Token xsp; while (true) { xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_112()) { jj_scanpos = xsp; break; } +======= + if (jj_3R_111()) { jj_scanpos = xsp; break; } +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_128() { +======= + private boolean jj_3R_127() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; +======= + private boolean jj_3R_114() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_127()) { + jj_scanpos = xsp; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_128()) { jj_scanpos = xsp; if (jj_3R_129()) { @@ -7813,9 +8544,13 @@ private boolean jj_3R_115() { jj_scanpos = xsp; if (jj_3R_142()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_143()) { jj_scanpos = xsp; if (jj_3R_144()) return true; +======= + if (jj_3R_143()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -7835,12 +8570,17 @@ private boolean jj_3R_115() { return false; } +<<<<<<< HEAD private boolean jj_3R_123() { +======= + private boolean jj_3R_122() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_122() { if (jj_scan_token(EXISTS)) return true; if (jj_3R_146()) return true; @@ -7848,53 +8588,89 @@ private boolean jj_3R_122() { } private boolean jj_3R_120() { +======= + private boolean jj_3R_121() { + if (jj_scan_token(EXISTS)) return true; + if (jj_3R_145()) return true; + return false; + } + + private boolean jj_3R_119() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_119() { +======= + private boolean jj_3R_118() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_121() { +======= + private boolean jj_3R_120() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REGEX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_111() { +======= + private boolean jj_3R_110() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(OBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_110() { +======= + private boolean jj_3R_109() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(PREDICATE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_109() { +======= + private boolean jj_3R_108() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_108() { +======= + private boolean jj_3R_107() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_106() { +<<<<<<< HEAD if (jj_3R_123()) return true; return false; } private boolean jj_3R_107() { +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -7910,6 +8686,7 @@ private boolean jj_3R_104() { return false; } +<<<<<<< HEAD private boolean jj_3R_167() { if (jj_scan_token(LPAREN)) return true; return false; @@ -7927,6 +8704,8 @@ private boolean jj_3R_102() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7958,6 +8737,7 @@ private boolean jj_3R_102() { jj_la1_init_7(); } private static void jj_la1_init_0() { +<<<<<<< HEAD jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { @@ -7977,6 +8757,27 @@ private static void jj_la1_init_5() { } private static void jj_la1_init_6() { jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x801,0x0,0x8,0x801,0x801,0x801,0x0,0x8,0x801,0x0,0x801,0x8,0x0,0x801,0x0,0x8,0x801,0x801,0x8,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x800,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x8,0x801,0x0,0x2,0x0,0x0,0x4,0x801,0x8004000,0x8004000,0x2,0x8004000,0x8004000,0x4,0x4000000,0x8400000,0x8400000,0x40280000,0x8004000,0x0,0x4,0x280004,0x40280000,0x4000,0x4000000,0x8000000,0x8000000,0x0,0x8000000,0x0,0x0,0x801,0x801,0x1000,0x1000,0x801,0x801,0x801,0x0,0x800,0x0,0x1,0x0,0x20000,0x40000,0x3f0,0x3f0,0x180000,0x0,0x600000,0x600000,0x180000,0x600000,0x600000,0x184800,0x800,0x800,0x4,0x4,0x0,0x4,0x4,0x0,0x4,0x4,0x4,0x0,0x384800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,}; +======= + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0018,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } private static void jj_la1_init_7() { jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java index 073cf097d1e..69a6e501578 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -87,9 +87,7 @@ static final int hexval(char c) throws java.io.IOException { protected int maxNextCharInd = 0; protected int nextCharInd = -1; protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - + protected int tabSize = 8; @SuppressWarnings("all") public void setTabSize(int i) { tabSize = i; } @@ -288,7 +286,7 @@ public char readChar() throws java.io.IOException if ((buffer[bufpos] = c = ReadByte()) == '\\') { - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); int backSlashCnt = 1; @@ -301,7 +299,7 @@ public char readChar() throws java.io.IOException { if ((buffer[bufpos] = c = ReadByte()) != '\\') { - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { @@ -324,7 +322,7 @@ public char readChar() throws java.io.IOException return '\\'; } - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); backSlashCnt++; } @@ -362,7 +360,8 @@ public char readChar() throws java.io.IOException } } - /* + @Deprecated + /** * @deprecated * @see #getEndColumn */ @@ -373,10 +372,10 @@ public int getColumn() { return bufcolumn[bufpos]; } - /* + @Deprecated + /** * @deprecated * @see #getEndLine - * @return the line number. */ @Deprecated @@ -403,9 +402,14 @@ public int getEndLine() { return bufline[bufpos]; } +<<<<<<< HEAD /** Get the beginning column. * @return column of token start */ +======= +/** @return column of token start */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getBeginColumn() { return bufcolumn[tokenBegin]; @@ -428,6 +432,7 @@ public void backup(int amount) { bufpos += bufsize; } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -435,6 +440,10 @@ public void backup(int amount) { * @param buffersize size of the buffer */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -450,12 +459,17 @@ public JavaCharStream(java.io.Reader dstream, nextCharBuf = new char[4096]; } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) @@ -463,17 +477,27 @@ public JavaCharStream(java.io.Reader dstream, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -495,8 +519,13 @@ public void ReInit(java.io.Reader dstream, nextCharInd = bufpos = -1; } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn) @@ -504,8 +533,13 @@ public void ReInit(java.io.Reader dstream, ReInit(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream) { @@ -520,6 +554,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -527,13 +562,18 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin * @param buffersize size of the buffer */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -542,6 +582,10 @@ public JavaCharStream(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException @@ -549,12 +593,17 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(dstream, encoding, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn) @@ -562,28 +611,39 @@ public JavaCharStream(java.io.InputStream dstream, int startline, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -592,6 +652,10 @@ public JavaCharStream(java.io.InputStream dstream) * @param buffersize size of the buffer */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException @@ -599,6 +663,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -606,12 +671,17 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, * @param buffersize size of the buffer */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -620,49 +690,73 @@ public void ReInit(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } +<<<<<<< HEAD /** Get the token timage. * @return token image as String */ +======= + /** @return token image as String */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public String GetImage() { @@ -673,10 +767,15 @@ public String GetImage() new String(buffer, 0, bufpos + 1); } +<<<<<<< HEAD /** Get the suffix as an array of characters. * @param len the length of the array to return. * @return suffix */ +======= + /** @return suffix */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char[] GetSuffix(int len) { @@ -707,9 +806,6 @@ public void Done() /** * Method to adjust line and column numbers for the start of a token. - * - * @param newLine the new line number. - * @param newCol the new column number. */ @SuppressWarnings("all") @@ -756,8 +852,6 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } } -/* JavaCC - OriginalChecksum=9698f3eb5988f4ff314d1b8207763eb1 (do not edit this line) */ +/* JavaCC - OriginalChecksum=d63a793bd614cb11b1bb35c273b7864c (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java index da8e2a3c81f..2c32e0affd0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ -/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -20,11 +20,6 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -65,7 +60,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * following this token will (therefore) be the first error token. + * followng this token will (therefore) be the first error token. */ public Token currentToken; @@ -93,8 +88,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -106,7 +101,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(EOL).append(" "); + expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -122,26 +117,21 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - if (currentToken.next != null) { - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - } - retval += "." + EOL; - - - if (expectedTokenSequences.length == 0) { - // Nothing to add here + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; } else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); + retval += "Was expecting one of:" + eol + " "; } - + retval += expected.toString(); return retval; } + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -149,11 +139,13 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -192,4 +184,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=4221abc4e598fc22c5ec0c1f20bcec78 (do not edit this line) */ +/* JavaCC - OriginalChecksum=25807f74c6efb1bcbd3321a6af1d8604 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java index b44b9e57649..922d77ffdf1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java @@ -1,4 +1,3 @@ -/* SPARQLParser11.java */ /* Generated By:JavaCC: Do not edit this line. SPARQLParser11.java */ package org.apache.jena.sparql.lang.sparql_11 ; import org.apache.jena.graph.* ; @@ -16,112 +15,105 @@ public class SPARQLParser11 extends SPARQLParser11Base implements SPARQLParser11 final public void QueryUnit() throws ParseException { ByteOrderMark(); -startQuery() ; + startQuery() ; Query(); jj_consume_token(0); -finishQuery() ; -} + finishQuery() ; + } final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: SelectQuery(); break; - } - case CONSTRUCT:{ + case CONSTRUCT: ConstructQuery(); break; - } - case DESCRIBE:{ + case DESCRIBE: DescribeQuery(); break; - } - case ASK:{ + case ASK: AskQuery(); break; - } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); -} + } final public void UpdateUnit() throws ParseException { ByteOrderMark(); -startUpdateRequest() ; + startUpdateRequest() ; Update(); jj_consume_token(0); -finishUpdateRequest() ; -} + finishUpdateRequest() ; + } final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOM: jj_consume_token(BOM); break; - } default: jj_la1[1] = jj_gen; ; } -} + } final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BASE: - case PREFIX:{ + case PREFIX: ; break; - } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BASE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BASE: BaseDecl(); break; - } - case PREFIX:{ + case PREFIX: PrefixDecl(); break; - } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -} + } - final public void BaseDecl() throws ParseException {Token t ; String iri ; + final public void BaseDecl() throws ParseException { + Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); -setBase(iri, t.beginLine, t.beginColumn ) ; -} + setBase(iri, t.beginLine, t.beginColumn ) ; + } - final public void PrefixDecl() throws ParseException {Token t ; String iri ; + final public void PrefixDecl() throws ParseException { + Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); -String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); + String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; -} + } final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[4] = jj_gen; break label_2; @@ -130,115 +122,108 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); -} + } - final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException { + Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); -getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DISTINCT: - case REDUCED:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + case REDUCED: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -getQuery().setDistinct(true); + getQuery().setDistinct(true); break; - } - case REDUCED:{ + case REDUCED: jj_consume_token(REDUCED); -getQuery().setReduced(true); + getQuery().setReduced(true); break; - } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[6] = jj_gen; ; } -setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: case VAR2: - case LPAREN:{ + case LPAREN: label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addResultVar(v) ; + getQuery().addResultVar(v) ; break; - } - case LPAREN:{ -v = null ; + case LPAREN: + v = null ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -getQuery().addResultVar(v, expr) ; -getQuery().setQueryResultStar(false) ; + getQuery().addResultVar(v, expr) ; + getQuery().setQueryResultStar(false) ; break; - } default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: case VAR2: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[8] = jj_gen; break label_3; } } break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void ConstructQuery() throws ParseException {Template t ; + final public void ConstructQuery() throws ParseException { + Template t ; TripleCollectorBGP acc = new TripleCollectorBGP() ; jj_consume_token(CONSTRUCT); -getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: t = ConstructTemplate(); -getQuery().setConstructTemplate(t) ; + getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[10] = jj_gen; break label_4; @@ -248,16 +233,14 @@ final public void SubSelect() throws ParseException { WhereClause(); SolutionModifier(); break; - } case FROM: - case WHERE:{ + case WHERE: label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[11] = jj_gen; break label_5; @@ -266,7 +249,7 @@ final public void SubSelect() throws ParseException { } jj_consume_token(WHERE); jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -291,66 +274,62 @@ final public void SubSelect() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[12] = jj_gen; ; } jj_consume_token(RBRACE); SolutionModifier(); -t = new Template(acc.getBGP()) ; + t = new Template(acc.getBGP()) ; getQuery().setConstructTemplate(t) ; ElementPathBlock epb = new ElementPathBlock(acc.getBGP()) ; ElementGroup elg = new ElementGroup() ; elg.addElement(epb) ; getQuery().setQueryPattern(elg) ; break; - } default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DescribeQuery() throws ParseException {Node n ; + final public void DescribeQuery() throws ParseException { + Node n ; jj_consume_token(DESCRIBE); -getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: label_6: while (true) { n = VarOrIri(); -getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[14] = jj_gen; break label_6; } } -getQuery().setQueryResultStar(false) ; + getQuery().setQueryResultStar(false) ; break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[15] = jj_gen; jj_consume_token(-1); @@ -358,40 +337,37 @@ final public void SubSelect() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[16] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHERE: - case LBRACE:{ + case LBRACE: WhereClause(); break; - } default: jj_la1[17] = jj_gen; ; } SolutionModifier(); -} + } final public void AskQuery() throws ParseException { jj_consume_token(ASK); -getQuery().setQueryAskType() ; + getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[18] = jj_gen; break label_8; @@ -400,100 +376,97 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: DefaultGraphClause(); break; - } - case NAMED:{ + case NAMED: NamedGraphClause(); break; - } default: jj_la1[19] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DefaultGraphClause() throws ParseException {String iri ; + final public void DefaultGraphClause() throws ParseException { + String iri ; iri = SourceSelector(); -getQuery().addGraphURI(iri) ; -} + getQuery().addGraphURI(iri) ; + } - final public void NamedGraphClause() throws ParseException {String iri ; + final public void NamedGraphClause() throws ParseException { + String iri ; jj_consume_token(NAMED); iri = SourceSelector(); -getQuery().addNamedGraphURI(iri) ; -} + getQuery().addNamedGraphURI(iri) ; + } - final public String SourceSelector() throws ParseException {String iri ; + final public String SourceSelector() throws ParseException { + String iri ; iri = iri(); -{if ("" != null) return iri ;} + {if (true) return iri ;} throw new Error("Missing return statement in function"); -} + } - final public void WhereClause() throws ParseException {Element el ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WHERE:{ + final public void WhereClause() throws ParseException { + Element el ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: jj_consume_token(WHERE); break; - } default: jj_la1[20] = jj_gen; ; } -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -getQuery().setQueryPattern(el) ; -finishWherePattern() ; -} + getQuery().setQueryPattern(el) ; + finishWherePattern() ; + } final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GROUP:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: GroupClause(); break; - } default: jj_la1[21] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HAVING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: HavingClause(); break; - } default: jj_la1[22] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ORDER:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: OrderClause(); break; - } default: jj_la1[23] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: - case OFFSET:{ + case OFFSET: LimitOffsetClauses(); break; - } default: jj_la1[24] = jj_gen; ; } -} + } final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -501,7 +474,7 @@ final public void GroupClause() throws ParseException { label_9: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -568,19 +541,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[25] = jj_gen; break label_9; } } -} + } - final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void GroupCondition() throws ParseException { + Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXISTS: case NOT: case COUNT: @@ -641,55 +614,50 @@ final public void GroupClause() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[26] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addGroupBy(v ,expr) ; + getQuery().addGroupBy(v ,expr) ; break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addGroupBy(v) ; + getQuery().addGroupBy(v) ; break; - } default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void HavingClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_10: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -754,31 +722,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[28] = jj_gen; break label_10; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void HavingCondition() throws ParseException {Expr c ; + final public void HavingCondition() throws ParseException { + Expr c ; c = Constraint(); -getQuery().addHavingCondition(c) ; -} + getQuery().addHavingCondition(c) ; + } final public void OrderClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_11: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -847,34 +815,32 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[29] = jj_gen; break label_11; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; -direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void OrderCondition() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASC: - case DESC:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASC:{ + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: jj_consume_token(ASC); -direction = Query.ORDER_ASCENDING ; + direction = Query.ORDER_ASCENDING ; break; - } - case DESC:{ + case DESC: jj_consume_token(DESC); -direction = Query.ORDER_DESCENDING ; + direction = Query.ORDER_DESCENDING ; break; - } default: jj_la1[30] = jj_gen; jj_consume_token(-1); @@ -882,7 +848,6 @@ final public void OrderClause() throws ParseException { } expr = BrackettedExpression(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -949,8 +914,8 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1015,98 +980,93 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: expr = Constraint(); break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); break; - } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[32] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( v == null ) + if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; -} + } final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case OFFSET:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OFFSET: OffsetClause(); break; - } default: jj_la1[33] = jj_gen; ; } break; - } - case OFFSET:{ + case OFFSET: OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); break; - } default: jj_la1[34] = jj_gen; ; } break; - } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void LimitClause() throws ParseException {Token t ; + final public void LimitClause() throws ParseException { + Token t ; jj_consume_token(LIMIT); t = jj_consume_token(INTEGER); -getQuery().setLimit(integerValue(t.image)) ; -} + getQuery().setLimit(integerValue(t.image)) ; + } - final public void OffsetClause() throws ParseException {Token t ; + final public void OffsetClause() throws ParseException { + Token t ; jj_consume_token(OFFSET); t = jj_consume_token(INTEGER); -getQuery().setOffset(integerValue(t.image)) ; -} + getQuery().setOffset(integerValue(t.image)) ; + } - final public void ValuesClause() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VALUES:{ + final public void ValuesClause() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VALUES: t = jj_consume_token(VALUES); -startValuesClause(t.beginLine, t.beginColumn) ; + startValuesClause(t.beginLine, t.beginColumn) ; DataBlock(); -finishValuesClause(t.beginLine, t.beginColumn) ; + finishValuesClause(t.beginLine, t.beginColumn) ; break; - } default: jj_la1[36] = jj_gen; ; } -} + } final public void Update() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INSERT: case DELETE: case INSERT_DATA: @@ -1119,170 +1079,157 @@ final public void Update() throws ParseException { case MOVE: case COPY: case DROP: - case WITH:{ + case WITH: Update1(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); Update(); break; - } default: jj_la1[37] = jj_gen; ; } break; - } default: jj_la1[38] = jj_gen; ; } -} + } - final public void Update1() throws ParseException {Update up = null ; -startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LOAD:{ + final public void Update1() throws ParseException { + Update up = null ; + startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOAD: up = Load(); break; - } - case CLEAR:{ + case CLEAR: up = Clear(); break; - } - case DROP:{ + case DROP: up = Drop(); break; - } - case ADD:{ + case ADD: up = Add(); break; - } - case MOVE:{ + case MOVE: up = Move(); break; - } - case COPY:{ + case COPY: up = Copy(); break; - } - case CREATE:{ + case CREATE: up = Create(); break; - } - case DELETE_WHERE:{ + case DELETE_WHERE: up = DeleteWhere(); break; - } case INSERT: case DELETE: - case WITH:{ + case WITH: up = Modify(); break; - } - case INSERT_DATA:{ + case INSERT_DATA: InsertData(); break; - } - case DELETE_DATA:{ + case DELETE_DATA: DeleteData(); break; - } default: jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if (null != up) emitUpdate(up) ; + if (null != up) emitUpdate(up) ; finishUpdateOperation() ; -} + } - final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; + final public Update Load() throws ParseException { + String url ; Node dest = null ; boolean silent = false ; jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[40] = jj_gen; ; } url = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTO:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTO: jj_consume_token(INTO); dest = GraphRef(); break; - } default: jj_la1[41] = jj_gen; ; } -{if ("" != null) return new UpdateLoad(url, dest, silent) ;} + {if (true) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Clear() throws ParseException {boolean silent = false ; Target target ; + final public Update Clear() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[42] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateClear(target, silent) ;} + {if (true) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Drop() throws ParseException {boolean silent = false ; Target target ; + final public Update Drop() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[43] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateDrop(target, silent) ;} + {if (true) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Create() throws ParseException {Node iri ; boolean silent = false ; + final public Update Create() throws ParseException { + Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[44] = jj_gen; ; } iri = GraphRef(); -{if ("" != null) return new UpdateCreate(iri, silent) ;} + {if (true) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[45] = jj_gen; ; @@ -1290,18 +1237,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateAdd(src, dest, silent) ;} + {if (true) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[46] = jj_gen; ; @@ -1309,18 +1256,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateMove(src, dest, silent) ;} + {if (true) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[47] = jj_gen; ; @@ -1328,70 +1275,70 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateCopy(src, dest, silent) ;} + {if (true) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException { + QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataInsert(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataInsert(qd, beginLine, beginColumn) ; + finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException { + QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataDelete(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataDelete(qd, beginLine, beginColumn) ; + finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException { + QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -{if ("" != null) return new UpdateDeleteWhere(qp) ;} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + {if (true) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Modify() throws ParseException {Element el ; String iri = null ; + final public Update Modify() throws ParseException { + Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; -startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WITH:{ + startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WITH: jj_consume_token(WITH); iri = iri(); -Node n = createNode(iri) ; up.setWithIRI(n) ; + Node n = createNode(iri) ; up.setWithIRI(n) ; break; - } default: jj_la1[48] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELETE: DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: InsertClause(up); break; - } default: jj_la1[49] = jj_gen; ; } break; - } - case INSERT:{ + case INSERT: InsertClause(up); break; - } default: jj_la1[50] = jj_gen; jj_consume_token(-1); @@ -1399,11 +1346,10 @@ final public void Update() throws ParseException { } label_12: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case USING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case USING: ; break; - } default: jj_la1[51] = jj_gen; break label_12; @@ -1411,139 +1357,136 @@ final public void Update() throws ParseException { UsingClause(up); } jj_consume_token(WHERE); -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -up.setElement(el) ; -finishWherePattern() ; -finishModifyUpdate() ; -{if ("" != null) return up ;} + up.setElement(el) ; + finishWherePattern() ; + finishModifyUpdate() ; + {if (true) return up ;} throw new Error("Missing return statement in function"); -} + } - final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -up.setHasDeleteClause(true) ; -} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + up.setHasDeleteClause(true) ; + } - final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startInsertTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishInsertTemplate(qp, beginLine, beginColumn) ; -up.setHasInsertClause(true) ; -} + finishInsertTemplate(qp, beginLine, beginColumn) ; + up.setHasInsertClause(true) ; + } - final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException { + String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; update.addUsing(n) ; + n = createNode(iri) ; update.addUsing(n) ; break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); iri = iri(); -n = createNode(iri) ; update.addUsingNamed(n) ; + n = createNode(iri) ; update.addUsingNamed(n) ; break; - } default: jj_la1[52] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public Target GraphOrDefault() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DFT:{ + final public Target GraphOrDefault() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + case GRAPH: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); break; - } default: jj_la1[53] = jj_gen; ; } iri = iri(); -{if ("" != null) return Target.create(createNode(iri)) ;} + {if (true) return Target.create(createNode(iri)) ;} break; - } default: jj_la1[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphRef() throws ParseException {String iri ; + final public Node GraphRef() throws ParseException { + String iri ; jj_consume_token(GRAPH); iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} throw new Error("Missing return statement in function"); -} + } - final public Target GraphRefAll() throws ParseException {Node iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + final public Target GraphRefAll() throws ParseException { + Node iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: iri = GraphRef(); -{if ("" != null) return Target.create(iri) ;} + {if (true) return Target.create(iri) ;} break; - } - case DFT:{ + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); -{if ("" != null) return Target.NAMED ;} + {if (true) return Target.NAMED ;} break; - } - case ALL:{ + case ALL: jj_consume_token(ALL); -{if ("" != null) return Target.ALL ;} + {if (true) return Target.ALL ;} break; - } default: jj_la1[55] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1568,36 +1511,33 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[56] = jj_gen; ; } label_13: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: ; break; - } default: jj_la1[57] = jj_gen; break label_13; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[58] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1622,23 +1562,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[59] = jj_gen; ; } } -} + } - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrIri(); -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1663,24 +1603,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[60] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1705,46 +1644,45 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[61] = jj_gen; ; } break; - } default: jj_la1[62] = jj_gen; ; } -} + } - final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException { + Element el = null ; Token t ; t = jj_consume_token(LBRACE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ -startSubSelect(beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: + startSubSelect(beginLine, beginColumn) ; SubSelect(); -Query q = endSubSelect(beginLine, beginColumn) ; + Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; - } default: jj_la1[63] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; -ElementGroup elg = new ElementGroup() ; -startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException { + Element el = null ; + ElementGroup elg = new ElementGroup() ; + startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1769,20 +1707,19 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ -startTriplesBlock() ; + case ANON: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[64] = jj_gen; ; } label_14: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -1790,26 +1727,24 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case BIND: case SERVICE: case FILTER: - case LBRACE:{ + case LBRACE: ; break; - } default: jj_la1[65] = jj_gen; break label_14; } el = GraphPatternNotTriples(); -elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[66] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1834,31 +1769,30 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ -startTriplesBlock() ; + case ANON: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[67] = jj_gen; ; } } -endGroup(elg) ; -{if ("" != null) return elg ;} + endGroup(elg) ; + {if (true) return elg ;} throw new Error("Missing return statement in function"); -} + } final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { -if ( acc == null ) + if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1883,149 +1817,143 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesBlock(acc); break; - } default: jj_la1[68] = jj_gen; ; } break; - } default: jj_la1[69] = jj_gen; ; } -{if ("" != null) return acc ;} + {if (true) return acc ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + final public Element GraphPatternNotTriples() throws ParseException { + Element el = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: el = GroupOrUnionGraphPattern(); break; - } - case OPTIONAL:{ + case OPTIONAL: el = OptionalGraphPattern(); break; - } - case MINUS_P:{ + case MINUS_P: el = MinusGraphPattern(); break; - } - case GRAPH:{ + case GRAPH: el = GraphGraphPattern(); break; - } - case SERVICE:{ + case SERVICE: el = ServiceGraphPattern(); break; - } - case FILTER:{ + case FILTER: el = Filter(); break; - } - case BIND:{ + case BIND: el = Bind(); break; - } - case VALUES:{ + case VALUES: el = InlineData(); break; - } default: jj_la1[70] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element OptionalGraphPattern() throws ParseException {Element el ; + final public Element OptionalGraphPattern() throws ParseException { + Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementOptional(el) ;} + {if (true) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException { + Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementNamedGraph(n, el) ;} + {if (true) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException { + Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true; + silent=true; break; - } default: jj_la1[71] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementService(n, el, silent) ;} + {if (true) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Element Bind() throws ParseException {Var v ; Expr expr ; + final public Element Bind() throws ParseException { + Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementBind(v, expr) ;} + {if (true) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element InlineData() throws ParseException {ElementData el ; Token t ; + final public Element InlineData() throws ParseException { + ElementData el ; Token t ; t = jj_consume_token(VALUES); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -el = new ElementData() ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); -finishInlineData(beginLine, beginColumn) ; - {if ("" != null) return el ;} + finishInlineData(beginLine, beginColumn) ; + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: InlineDataOneVar(); break; - } case LPAREN: - case NIL:{ + case NIL: InlineDataFull(); break; - } default: jj_la1[72] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException { + Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2044,48 +1972,45 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: ; break; - } default: jj_la1[73] = jj_gen; break label_15; } n = DataBlockValue(); -startDataBlockValueRow(beginLine, beginColumn) ; + startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); -} + } - final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public void InlineDataFull() throws ParseException { + Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[74] = jj_gen; break label_16; } v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[75] = jj_gen; jj_consume_token(-1); @@ -2094,24 +2019,23 @@ final public void DataBlock() throws ParseException { jj_consume_token(LBRACE); label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: ; break; - } default: jj_la1[76] = jj_gen; break label_17; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: t = jj_consume_token(LPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; label_18: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2130,29 +2054,26 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: ; break; - } default: jj_la1[77] = jj_gen; break label_18; } n = DataBlockValue(); -emitDataBlockValue(n, beginLine, beginColumn) ; + emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } - case NIL:{ + case NIL: t = jj_consume_token(NIL); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } default: jj_la1[78] = jj_gen; jj_consume_token(-1); @@ -2160,25 +2081,24 @@ final public void DataBlock() throws ParseException { } } jj_consume_token(RBRACE); -} + } - final public Node DataBlockValue() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataBlockValue() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -2187,76 +2107,75 @@ final public void DataBlock() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case UNDEF:{ + case UNDEF: jj_consume_token(UNDEF); -{if ("" != null) return null ;} + {if (true) return null ;} break; - } default: jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Element MinusGraphPattern() throws ParseException {Element el ; + final public Element MinusGraphPattern() throws ParseException { + Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); -{if ("" != null) return new ElementMinus(el) ;} + {if (true) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException { + Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case UNION:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNION: ; break; - } default: jj_la1[80] = jj_gen; break label_19; } jj_consume_token(UNION); -if ( el2 == null ) + if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); -el2.addElement(el) ; + el2.addElement(el) ; } -{if ("" != null) return (el2==null)? el : el2 ;} + {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); -} + } - final public Element Filter() throws ParseException {Expr c ; + final public Element Filter() throws ParseException { + Expr c ; jj_consume_token(FILTER); c = Constraint(); -{if ("" != null) return new ElementFilter(c) ;} + {if (true) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Constraint() throws ParseException {Expr c ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr Constraint() throws ParseException { + Expr c ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: c = BrackettedExpression(); break; - } case EXISTS: case NOT: case COUNT: @@ -2317,132 +2236,127 @@ final public void DataBlock() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: c = BuiltInCall(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: c = FunctionCall(); break; - } default: jj_la1[81] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return c ;} + {if (true) return c ;} throw new Error("Missing return statement in function"); -} + } - final public Expr FunctionCall() throws ParseException {String fname ; Args a ; + final public Expr FunctionCall() throws ParseException { + String fname ; Args a ; fname = iri(); a = ArgList(); -if ( AggregateRegistry.isRegistered(fname) ) { + if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(fname, a) ;} + {if (true) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public Args ArgList() throws ParseException { + Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -args.distinct = true ; -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -if ( ! getAllowAggregatesInExpressions() ) + args.distinct = true ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; - } default: jj_la1[82] = jj_gen; ; } expr = Expression(); -args.add(expr) ; + args.add(expr) ; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[83] = jj_gen; break label_20; } jj_consume_token(COMMA); expr = Expression(); -args.add(expr) ; + args.add(expr) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return args ;} + {if (true) return args ;} throw new Error("Missing return statement in function"); -} + } - final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public ExprList ExpressionList() throws ParseException { + Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[85] = jj_gen; break label_21; } jj_consume_token(COMMA); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[86] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return exprList ;} + {if (true) return exprList ;} throw new Error("Missing return statement in function"); -} + } - final public Template ConstructTemplate() throws ParseException {TripleCollectorBGP acc = new TripleCollectorBGP(); + final public Template ConstructTemplate() throws ParseException { + TripleCollectorBGP acc = new TripleCollectorBGP(); Template t = new Template(acc.getBGP()) ; -setInConstructTemplate(true) ; + setInConstructTemplate(true) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2467,26 +2381,25 @@ final public void DataBlock() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ConstructTriples(acc); break; - } default: jj_la1[87] = jj_gen; ; } jj_consume_token(RBRACE); -setInConstructTemplate(false) ; - {if ("" != null) return t ;} + setInConstructTemplate(false) ; + {if (true) return t ;} throw new Error("Missing return statement in function"); -} + } final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2511,24 +2424,23 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ConstructTriples(acc); break; - } default: jj_la1[88] = jj_gen; ; } break; - } default: jj_la1[89] = jj_gen; ; } -} + } - final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2551,109 +2463,104 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: PropertyListNotEmpty(s, acc); break; - } default: jj_la1[91] = jj_gen; ; } -} + } - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { + Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: jj_la1[92] = jj_gen; break label_22; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: p = Verb(); ObjectList(s, p, null, acc); break; - } default: jj_la1[93] = jj_gen; ; } } -} + } - final public Node Verb() throws ParseException {Node p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node Verb() throws ParseException { + Node p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: p = VarOrIri(); break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; Object(s, p, path, acc); label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[95] = jj_gen; break label_23; @@ -2661,16 +2568,18 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio jj_consume_token(COMMA); Object(s, p, path, acc); } -} + } - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; -} + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + } - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2693,28 +2602,26 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: jj_la1[96] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2723,33 +2630,31 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: PropertyListPathNotEmpty(s, acc); break; - } default: jj_la1[97] = jj_gen; ; } -} + } - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { + Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: jj_la1[98] = jj_gen; jj_consume_token(-1); @@ -2758,18 +2663,17 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce ObjectListPath(s, p, path, acc); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: jj_la1[99] = jj_gen; break label_24; } jj_consume_token(SEMICOLON); -path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2778,23 +2682,21 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case KW_A: case LPAREN: case BANG: - case CARAT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CARAT: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: jj_la1[100] = jj_gen; jj_consume_token(-1); @@ -2802,35 +2704,36 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce } ObjectListPath(s, p, path, acc); break; - } default: jj_la1[101] = jj_gen; ; } } -} + } - final public Path VerbPath() throws ParseException {Node p ; Path path ; + final public Path VerbPath() throws ParseException { + Node p ; Path path ; path = Path(); -{if ("" != null) return path ;} + {if (true) return path ;} throw new Error("Missing return statement in function"); -} + } - final public Node VerbSimple() throws ParseException {Node p ; + final public Node VerbSimple() throws ParseException { + Node p ; p = Var(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; ObjectPath(s, p, path, acc); label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[102] = jj_gen; break label_25; @@ -2838,342 +2741,333 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } -} + } - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; -} + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + } - final public Path Path() throws ParseException {Path p ; + final public Path Path() throws ParseException { + Path p ; p = PathAlternative(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathAlternative() throws ParseException {Path p1 , p2 ; + final public Path PathAlternative() throws ParseException { + Path p1 , p2 ; p1 = PathSequence(); label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: jj_la1[103] = jj_gen; break label_26; } jj_consume_token(VBAR); p2 = PathSequence(); -p1 = PathFactory.pathAlt(p1, p2) ; + p1 = PathFactory.pathAlt(p1, p2) ; } -{if ("" != null) return p1 ;} + {if (true) return p1 ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathSequence() throws ParseException {Path p1 , p2 ; + final public Path PathSequence() throws ParseException { + Path p1 , p2 ; p1 = PathEltOrInverse(); label_27: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SLASH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SLASH: ; break; - } default: jj_la1[104] = jj_gen; break label_27; } jj_consume_token(SLASH); p2 = PathEltOrInverse(); -p1 = PathFactory.pathSeq(p1, p2) ; + p1 = PathFactory.pathSeq(p1, p2) ; } -{if ("" != null) return p1;} + {if (true) return p1;} throw new Error("Missing return statement in function"); -} + } - final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException { + String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case STAR: - case QMARK:{ + case QMARK: p = PathMod(p); break; - } default: jj_la1[105] = jj_gen; ; } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException { + String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: - case BANG:{ + case BANG: p = PathElt(); break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p = PathElt(); -p = PathFactory.pathInverse(p) ; + p = PathFactory.pathInverse(p) ; break; - } default: jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case QMARK:{ + final public Path PathMod(Path p) throws ParseException { + long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QMARK: jj_consume_token(QMARK); -{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} + {if (true) return PathFactory.pathZeroOrOne(p) ;} break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} + {if (true) return PathFactory.pathZeroOrMore1(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); -{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} + {if (true) return PathFactory.pathOneOrMore1(p) ;} break; - } default: jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathPrimary() throws ParseException { + String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; p = PathFactory.pathLink(n) ; + n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = PathFactory.pathLink(nRDFtype) ; + p = PathFactory.pathLink(nRDFtype) ; break; - } - case BANG:{ + case BANG: jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; - } default: jj_la1[108] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; -pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException { + P_Path0 p ; P_NegPropSet pNegSet ; + pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: jj_la1[109] = jj_gen; break label_28; } jj_consume_token(VBAR); p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; } break; - } default: jj_la1[110] = jj_gen; ; } jj_consume_token(RPAREN); break; - } default: jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return pNegSet ;} + {if (true) return pNegSet ;} throw new Error("Missing return statement in function"); -} + } - final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException { + String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} + n = createNode(str) ; {if (true) return new P_Link(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_Link(nRDFtype) ;} + {if (true) return new P_Link(nRDFtype) ;} break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} + n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_ReverseLink(nRDFtype) ;} + {if (true) return new P_ReverseLink(nRDFtype) ;} break; - } default: jj_la1[112] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[113] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public long Integer() throws ParseException {Token t ; + final public long Integer() throws ParseException { + Token t ; t = jj_consume_token(INTEGER); -{if ("" != null) return integerValue(t.image) ;} + {if (true) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = Collection(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyList(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[114] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = CollectionPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyListPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[115] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_29: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3198,37 +3092,37 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ; break; - } default: jj_la1[116] = jj_gen; break label_29; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_30: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3253,24 +3147,24 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ; break; - } default: jj_la1[117] = jj_gen; break label_30; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3293,27 +3187,26 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNode(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3336,32 +3229,30 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNodePath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrTerm() throws ParseException {Node n = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrTerm() throws ParseException { + Node n = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3382,106 +3273,100 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = GraphTerm(); break; - } default: jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Var Var() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR1:{ + final public Var Var() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VAR1: t = jj_consume_token(VAR1); break; - } - case VAR2:{ + case VAR2: t = jj_consume_token(VAR2); break; - } default: jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - final public Node GraphTerm() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphTerm() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -3490,93 +3375,92 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return nRDFnil ;} + {if (true) return nRDFnil ;} break; - } default: jj_la1[124] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr Expression() throws ParseException {Expr expr ; + final public Expr Expression() throws ParseException { + Expr expr ; expr = ConditionalOrExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: ; break; - } default: jj_la1[125] = jj_gen; break label_31; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); -expr1 = new E_LogicalOr(expr1, expr2) ; + expr1 = new E_LogicalOr(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ValueLogical(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: ; break; - } default: jj_la1[126] = jj_gen; break label_32; } jj_consume_token(SC_AND); expr2 = ValueLogical(); -expr1 = new E_LogicalAnd(expr1, expr2) ; + expr1 = new E_LogicalAnd(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ValueLogical() throws ParseException {Expr expr ; + final public Expr ValueLogical() throws ParseException { + Expr expr ; expr = RelationalExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException { + Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case IN: case EQ: @@ -3584,83 +3468,76 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case GT: case LT: case LE: - case GE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ + case GE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: jj_consume_token(EQ); expr2 = NumericExpression(); -expr1 = new E_Equals(expr1, expr2) ; + expr1 = new E_Equals(expr1, expr2) ; break; - } - case NE:{ + case NE: jj_consume_token(NE); expr2 = NumericExpression(); -expr1 = new E_NotEquals(expr1, expr2) ; + expr1 = new E_NotEquals(expr1, expr2) ; break; - } - case LT:{ + case LT: jj_consume_token(LT); expr2 = NumericExpression(); -expr1 = new E_LessThan(expr1, expr2) ; + expr1 = new E_LessThan(expr1, expr2) ; break; - } - case GT:{ + case GT: jj_consume_token(GT); expr2 = NumericExpression(); -expr1 = new E_GreaterThan(expr1, expr2) ; + expr1 = new E_GreaterThan(expr1, expr2) ; break; - } - case LE:{ + case LE: jj_consume_token(LE); expr2 = NumericExpression(); -expr1 = new E_LessThanOrEqual(expr1, expr2) ; + expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - } - case GE:{ + case GE: jj_consume_token(GE); expr2 = NumericExpression(); -expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; + expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - } - case IN:{ + case IN: jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_OneOf(expr1, a) ; + expr1 = new E_OneOf(expr1, a) ; break; - } - case NOT:{ + case NOT: jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_NotOneOf(expr1, a) ; + expr1 = new E_NotOneOf(expr1, a) ; break; - } default: jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[128] = jj_gen; ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NumericExpression() throws ParseException {Expr expr ; + final public Expr NumericExpression() throws ParseException { + Expr expr ; expr = AdditiveExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException { + Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -3668,52 +3545,47 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS:{ + case MINUS: ; break; - } default: jj_la1[129] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Add(expr1, expr2) ; + expr1 = new E_Add(expr1, expr2) ; break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Subtract(expr1, expr2) ; + expr1 = new E_Subtract(expr1, expr2) ; break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOUBLE_NEGATIVE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; - } default: jj_la1[130] = jj_gen; jj_consume_token(-1); @@ -3721,108 +3593,100 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce } label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: jj_la1[131] = jj_gen; break label_34; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr3 = UnaryExpression(); -expr2 = new E_Multiply(expr2, expr3) ; + expr2 = new E_Multiply(expr2, expr3) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr3 = UnaryExpression(); -expr2 = new E_Divide(expr2, expr3) ; + expr2 = new E_Divide(expr2, expr3) ; break; - } default: jj_la1[132] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -if ( addition ) + if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; - } default: jj_la1[133] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = UnaryExpression(); label_35: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: jj_la1[134] = jj_gen; break label_35; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr2 = UnaryExpression(); -expr1 = new E_Multiply(expr1, expr2) ; + expr1 = new E_Multiply(expr1, expr2) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr2 = UnaryExpression(); -expr1 = new E_Divide(expr1, expr2) ; + expr1 = new E_Divide(expr1, expr2) ; break; - } default: jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr UnaryExpression() throws ParseException {Expr expr ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BANG:{ + final public Expr UnaryExpression() throws ParseException { + Expr expr ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: jj_consume_token(BANG); expr = PrimaryExpression(); -{if ("" != null) return new E_LogicalNot(expr) ;} + {if (true) return new E_LogicalNot(expr) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryPlus(expr) ;} + {if (true) return new E_UnaryPlus(expr) ;} break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryMinus(expr) ;} + {if (true) return new E_UnaryMinus(expr) ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3904,26 +3768,25 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: expr = PrimaryExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr PrimaryExpression() throws ParseException { + Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: expr = BrackettedExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case EXISTS: case NOT: case COUNT: @@ -3984,26 +3847,23 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = iriOrFunction(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4012,399 +3872,353 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } default: jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr BrackettedExpression() throws ParseException {Expr expr ; + final public Expr BrackettedExpression() throws ParseException { + Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr BuiltInCall() throws ParseException {Expr expr ; + final public Expr BuiltInCall() throws ParseException { + Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COUNT: case MIN: case MAX: case SUM: case AVG: case SAMPLE: - case GROUP_CONCAT:{ + case GROUP_CONCAT: expr = Aggregate(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STR:{ + case STR: jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Str(expr) ;} + {if (true) return new E_Str(expr) ;} break; - } - case LANG:{ + case LANG: jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Lang(expr) ;} + {if (true) return new E_Lang(expr) ;} break; - } - case LANGMATCHES:{ + case LANGMATCHES: jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_LangMatches(expr1, expr2) ;} + {if (true) return new E_LangMatches(expr1, expr2) ;} break; - } - case DTYPE:{ + case DTYPE: jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Datatype(expr) ;} + {if (true) return new E_Datatype(expr) ;} break; - } - case BOUND:{ + case BOUND: jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} + {if (true) return new E_Bound(new ExprVar(gn)) ;} break; - } - case IRI:{ + case IRI: jj_consume_token(IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_IRI(expr) ;} + {if (true) return makeFunction_IRI(expr) ;} break; - } - case URI:{ + case URI: jj_consume_token(URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_URI(expr) ;} + {if (true) return makeFunction_URI(expr) ;} break; - } - case BNODE:{ + case BNODE: jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); {if ("" != null) return makeFunction_BNode(expr1) ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); {if ("" != null) return makeFunction_BNode() ;} break; - } default: jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RAND:{ + case RAND: jj_consume_token(RAND); jj_consume_token(NIL); -{if ("" != null) return new E_Random() ;} + {if (true) return new E_Random() ;} break; - } - case ABS:{ + case ABS: jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumAbs(expr1) ;} + {if (true) return new E_NumAbs(expr1) ;} break; - } - case CEIL:{ + case CEIL: jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumCeiling(expr1) ;} + {if (true) return new E_NumCeiling(expr1) ;} break; - } - case FLOOR:{ + case FLOOR: jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumFloor(expr1) ;} + {if (true) return new E_NumFloor(expr1) ;} break; - } - case ROUND:{ + case ROUND: jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumRound(expr1) ;} + {if (true) return new E_NumRound(expr1) ;} break; - } - case CONCAT:{ + case CONCAT: jj_consume_token(CONCAT); a = ExpressionList(); -{if ("" != null) return new E_StrConcat(a) ;} + {if (true) return new E_StrConcat(a) ;} break; - } - case SUBSTR:{ + case SUBSTR: expr = SubstringExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STRLEN:{ + case STRLEN: jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLength(expr1) ;} + {if (true) return new E_StrLength(expr1) ;} break; - } - case REPLACE:{ + case REPLACE: expr = StrReplaceExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case UCASE:{ + case UCASE: jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrUpperCase(expr1) ;} + {if (true) return new E_StrUpperCase(expr1) ;} break; - } - case LCASE:{ + case LCASE: jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLowerCase(expr1) ;} + {if (true) return new E_StrLowerCase(expr1) ;} break; - } - case ENCODE_FOR_URI:{ + case ENCODE_FOR_URI: jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEncodeForURI(expr1) ;} + {if (true) return new E_StrEncodeForURI(expr1) ;} break; - } - case CONTAINS:{ + case CONTAINS: jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrContains(expr1, expr2) ;} + {if (true) return new E_StrContains(expr1, expr2) ;} break; - } - case STRSTARTS:{ + case STRSTARTS: jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} + {if (true) return new E_StrStartsWith(expr1, expr2) ;} break; - } - case STRENDS:{ + case STRENDS: jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} + {if (true) return new E_StrEndsWith(expr1, expr2) ;} break; - } - case STRBEFORE:{ + case STRBEFORE: jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrBefore(expr1, expr2) ;} + {if (true) return new E_StrBefore(expr1, expr2) ;} break; - } - case STRAFTER:{ + case STRAFTER: jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrAfter(expr1, expr2) ;} + {if (true) return new E_StrAfter(expr1, expr2) ;} break; - } - case YEAR:{ + case YEAR: jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeYear(expr1) ;} + {if (true) return new E_DateTimeYear(expr1) ;} break; - } - case MONTH:{ + case MONTH: jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMonth(expr1) ;} + {if (true) return new E_DateTimeMonth(expr1) ;} break; - } - case DAY:{ + case DAY: jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeDay(expr1) ;} + {if (true) return new E_DateTimeDay(expr1) ;} break; - } - case HOURS:{ + case HOURS: jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeHours(expr1) ;} + {if (true) return new E_DateTimeHours(expr1) ;} break; - } - case MINUTES:{ + case MINUTES: jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMinutes(expr1) ;} + {if (true) return new E_DateTimeMinutes(expr1) ;} break; - } - case SECONDS:{ + case SECONDS: jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeSeconds(expr1) ;} + {if (true) return new E_DateTimeSeconds(expr1) ;} break; - } - case TIMEZONE:{ + case TIMEZONE: jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTimezone(expr1) ;} + {if (true) return new E_DateTimeTimezone(expr1) ;} break; - } - case TZ:{ + case TZ: jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTZ(expr1) ;} + {if (true) return new E_DateTimeTZ(expr1) ;} break; - } - case NOW:{ + case NOW: jj_consume_token(NOW); jj_consume_token(NIL); -{if ("" != null) return new E_Now() ;} + {if (true) return new E_Now() ;} break; - } - case UUID:{ + case UUID: jj_consume_token(UUID); jj_consume_token(NIL); -{if ("" != null) return new E_UUID() ;} + {if (true) return new E_UUID() ;} break; - } - case STRUUID:{ + case STRUUID: jj_consume_token(STRUUID); jj_consume_token(NIL); -{if ("" != null) return new E_StrUUID() ;} + {if (true) return new E_StrUUID() ;} break; - } - case MD5:{ + case MD5: jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_MD5(expr1) ;} + {if (true) return new E_MD5(expr1) ;} break; - } - case SHA1:{ + case SHA1: jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA1(expr1) ;} + {if (true) return new E_SHA1(expr1) ;} break; - } - case SHA256:{ + case SHA256: jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA256(expr1) ;} + {if (true) return new E_SHA256(expr1) ;} break; - } - case SHA384:{ + case SHA384: jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA384(expr1) ;} + {if (true) return new E_SHA384(expr1) ;} break; - } - case SHA512:{ + case SHA512: jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA512(expr1) ;} + {if (true) return new E_SHA512(expr1) ;} break; - } - case COALESCE:{ + case COALESCE: jj_consume_token(COALESCE); a = ExpressionList(); -{if ("" != null) return new E_Coalesce(a) ;} + {if (true) return new E_Coalesce(a) ;} break; - } - case IF:{ + case IF: jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -4413,145 +4227,134 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} + {if (true) return new E_Conditional(expr, expr1, expr2) ;} break; - } - case STRLANG:{ + case STRLANG: jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLang(expr1, expr2) ;} + {if (true) return new E_StrLang(expr1, expr2) ;} break; - } - case STRDT:{ + case STRDT: jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} + {if (true) return new E_StrDatatype(expr1, expr2) ;} break; - } - case SAME_TERM:{ + case SAME_TERM: jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SameTerm(expr1, expr2) ;} + {if (true) return new E_SameTerm(expr1, expr2) ;} break; - } - case IS_IRI:{ + case IS_IRI: jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsIRI(expr) ;} + {if (true) return new E_IsIRI(expr) ;} break; - } - case IS_URI:{ + case IS_URI: jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsURI(expr) ;} + {if (true) return new E_IsURI(expr) ;} break; - } - case IS_BLANK:{ + case IS_BLANK: jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsBlank(expr) ;} + {if (true) return new E_IsBlank(expr) ;} break; - } - case IS_LITERAL:{ + case IS_LITERAL: jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsLiteral(expr) ;} + {if (true) return new E_IsLiteral(expr) ;} break; - } - case IS_NUMERIC:{ + case IS_NUMERIC: jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsNumeric(expr) ;} + {if (true) return new E_IsNumeric(expr) ;} break; - } - case REGEX:{ + case REGEX: expr = RegexExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case EXISTS:{ + case EXISTS: expr = ExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case NOT:{ + case NOT: expr = NotExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException { + Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); flagsExpr = Expression(); break; - } default: jj_la1[140] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} + {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr3 = Expression(); break; - } default: jj_la1[141] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} + {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -4559,61 +4362,61 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr4 = Expression(); break; - } default: jj_la1[142] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} + {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ExistsFunc() throws ParseException {Element el ; + final public Expr ExistsFunc() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprExists(el) ;} + {if (true) return createExprExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NotExistsFunc() throws ParseException {Element el ; + final public Expr NotExistsFunc() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprNotExists(el) ;} + {if (true) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException { + Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; -startAggregate(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COUNT:{ + startAggregate(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[143] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4698,435 +4501,403 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case BANG: case PLUS: - case MINUS:{ + case MINUS: expr = Expression(); break; - } default: jj_la1[144] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); -if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } + if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - } - case SUM:{ + case SUM: t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[145] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSum(distinct, expr) ; + agg = AggregatorFactory.createSum(distinct, expr) ; break; - } - case MIN:{ + case MIN: t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[146] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMin(distinct, expr) ; + agg = AggregatorFactory.createMin(distinct, expr) ; break; - } - case MAX:{ + case MAX: t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[147] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMax(distinct, expr) ; + agg = AggregatorFactory.createMax(distinct, expr) ; break; - } - case AVG:{ + case AVG: t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[148] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createAvg(distinct, expr) ; + agg = AggregatorFactory.createAvg(distinct, expr) ; break; - } - case SAMPLE:{ + case SAMPLE: t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[149] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSample(distinct, expr) ; + agg = AggregatorFactory.createSample(distinct, expr) ; break; - } - case GROUP_CONCAT:{ + case GROUP_CONCAT: t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[150] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); break; - } default: jj_la1[151] = jj_gen; ; } jj_consume_token(RPAREN); -agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; + agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; - } default: jj_la1[152] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( ! getAllowAggregatesInExpressions() ) + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: jj_la1[153] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[155] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[158] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: jj_la1[160] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: jj_la1[161] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[163] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[164] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } /** Generated Token Manager. */ public SPARQLParser11TokenManager token_source; @@ -5146,149 +4917,141 @@ final public Node BooleanLiteral() throws ParseException { static private int[] jj_la1_5; static private int[] jj_la1_6; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } /** Constructor with InputStream. */ public SPARQLParser11(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public SPARQLParser11(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor. */ public SPARQLParser11(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new SPARQLParser11TokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public SPARQLParser11(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -5297,58 +5060,51 @@ private int jj_ntk_f() { /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[209]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 165; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 165; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); } else if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 117; else if (curChar == 39) @@ -2313,26 +2326,26 @@ else if (curChar == 39) else if (curChar == 36) jjstateSet[jjnewStateCnt++] = 27; else if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); } else if (curChar == 63) jjstateSet[jjnewStateCnt++] = 24; if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); else if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2348,11 +2361,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 9: if ((0x3ff000000000000L & l) != 0L) @@ -2384,7 +2397,7 @@ else if (curChar == 39) break; case 16: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 17: if (curChar == 62 && kind > 10) @@ -2399,11 +2412,11 @@ else if (curChar == 39) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2419,7 +2432,7 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 26: if (curChar == 36) @@ -2431,38 +2444,38 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 31: if (curChar == 45) - { jjCheckNAdd(32); } + jjCheckNAdd(32); break; case 32: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 34: if (curChar == 35) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 35: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 36: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 37: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 42: if (curChar == 10) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 43: if (curChar == 13) @@ -2474,11 +2487,11 @@ else if (curChar == 39) break; case 51: if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 52: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 53: if (curChar == 39 && kind > 161) @@ -2486,7 +2499,7 @@ else if (curChar == 39) break; case 55: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 57: if ((0x3ff000000000000L & l) != 0L) @@ -2518,15 +2531,15 @@ else if (curChar == 39) break; case 64: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 65: if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 66: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 67: if (curChar == 34 && kind > 162) @@ -2534,7 +2547,7 @@ else if (curChar == 39) break; case 69: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 71: if ((0x3ff000000000000L & l) != 0L) @@ -2566,28 +2579,28 @@ else if (curChar == 39) break; case 78: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 79: if (curChar == 39) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 80: case 83: if (curChar == 39) - { jjCheckNAddTwoStates(81, 84); } + jjCheckNAddTwoStates(81, 84); break; case 81: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 82: if (curChar == 39) - { jjAddStates(48, 49); } + jjAddStates(48, 49); break; case 85: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 87: if ((0x3ff000000000000L & l) != 0L) @@ -2619,7 +2632,7 @@ else if (curChar == 39) break; case 94: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 95: if (curChar == 39 && kind > 163) @@ -2639,24 +2652,24 @@ else if (curChar == 39) break; case 99: if (curChar == 34) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 100: case 103: if (curChar == 34) - { jjCheckNAddTwoStates(101, 104); } + jjCheckNAddTwoStates(101, 104); break; case 101: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 102: if (curChar == 34) - { jjAddStates(54, 55); } + jjAddStates(54, 55); break; case 105: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 107: if ((0x3ff000000000000L & l) != 0L) @@ -2688,7 +2701,7 @@ else if (curChar == 39) break; case 114: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 115: if (curChar == 34 && kind > 164) @@ -2708,23 +2721,23 @@ else if (curChar == 39) break; case 119: if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 120: if (curChar == 35) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 121: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 122: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 123: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 124: if (curChar == 41 && kind > 167) @@ -2732,7 +2745,7 @@ else if (curChar == 39) break; case 125: if (curChar == 10) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 126: if (curChar == 13) @@ -2740,23 +2753,23 @@ else if (curChar == 39) break; case 128: if (curChar == 35) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 129: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 130: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 131: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 133: if (curChar == 10) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 134: if (curChar == 13) @@ -2764,7 +2777,7 @@ else if (curChar == 39) break; case 136: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(71, 72); } + jjAddStates(71, 72); break; case 137: if ((0x3ff200000000000L & l) != 0L) @@ -2776,7 +2789,7 @@ else if (curChar == 39) break; case 139: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(73, 74); } + jjAddStates(73, 74); break; case 140: if ((0x3ff200000000000L & l) != 0L) @@ -2784,18 +2797,18 @@ else if (curChar == 39) break; case 141: if (curChar == 58) - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 142: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -2803,11 +2816,11 @@ else if (curChar == 39) break; case 146: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 147: if (curChar == 37) - { jjAddStates(79, 80); } + jjAddStates(79, 80); break; case 148: if ((0x3ff000000000000L & l) != 0L) @@ -2815,7 +2828,7 @@ else if (curChar == 39) break; case 149: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x3ff000000000000L & l) != 0L) @@ -2834,7 +2847,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 155: if (curChar == 37) @@ -2849,34 +2862,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 158: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 161: if (curChar == 35) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 162: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 163: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 164: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 169: if (curChar == 10) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 170: if (curChar == 13) @@ -2884,23 +2897,23 @@ else if (curChar == 39) break; case 176: if (curChar == 35) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 177: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 178: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 179: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 185: if (curChar == 10) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 186: if (curChar == 13) @@ -2911,260 +2924,260 @@ else if (curChar == 39) break; if (kind > 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); break; case 192: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 145) kind = 145; - { jjCheckNAdd(192); } + jjCheckNAdd(192); break; case 193: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(193, 194); } + jjCheckNAddTwoStates(193, 194); break; case 194: if (curChar == 46) - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 195: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 146) kind = 146; - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 196: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(196, 197); } + jjCheckNAddTwoStates(196, 197); break; case 197: if (curChar == 46) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 198: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 200: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 201: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 202: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(202, 203); } + jjCheckNAddTwoStates(202, 203); break; case 204: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 205: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 206: if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); break; case 207: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(207, 208); } + jjCheckNAddTwoStates(207, 208); break; case 209: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 210: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 211: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 212: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 148) kind = 148; - { jjCheckNAdd(212); } + jjCheckNAdd(212); break; case 213: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(213, 214); } + jjCheckNAddTwoStates(213, 214); break; case 214: if (curChar == 46) - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 215: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 149) kind = 149; - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 216: if (curChar == 46) - { jjCheckNAdd(217); } + jjCheckNAdd(217); break; case 217: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(217, 218); } + jjCheckNAddTwoStates(217, 218); break; case 219: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 220: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 221: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(99, 102); } + jjCheckNAddStates(99, 102); break; case 222: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(222, 223); } + jjCheckNAddTwoStates(222, 223); break; case 223: if (curChar == 46) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 224: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 226: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 227: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 228: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(228, 229); } + jjCheckNAddTwoStates(228, 229); break; case 230: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 231: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 232: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 233: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 151) kind = 151; - { jjCheckNAdd(233); } + jjCheckNAdd(233); break; case 234: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(234, 235); } + jjCheckNAddTwoStates(234, 235); break; case 235: if (curChar == 46) - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 236: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 152) kind = 152; - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 237: if (curChar == 46) - { jjCheckNAdd(238); } + jjCheckNAdd(238); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 240: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 241: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 242: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(103, 106); } + jjCheckNAddStates(103, 106); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 244: if (curChar == 46) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 245: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 247: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 248: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 249: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(249, 250); } + jjCheckNAddTwoStates(249, 250); break; case 251: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; case 252: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; default : break; } @@ -3179,28 +3192,28 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); else if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 50; else if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 18; if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 47; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 7: if (curChar == 92) @@ -3240,18 +3253,18 @@ else if ((0x20000000200L & l) != 0L) break; case 16: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 19: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3267,7 +3280,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: case 28: @@ -3275,32 +3288,32 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 29: if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); break; case 30: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(30, 31); } + jjCheckNAddTwoStates(30, 31); break; case 32: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 33: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 35: - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 38: if ((0x200000002L & l) != 0L && kind > 126) @@ -3348,15 +3361,15 @@ else if ((0x20000000200L & l) != 0L) break; case 52: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 54: if (curChar == 92) - { jjAddStates(115, 116); } + jjAddStates(115, 116); break; case 55: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 56: if (curChar == 85) @@ -3392,19 +3405,19 @@ else if ((0x20000000200L & l) != 0L) break; case 64: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 66: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 68: if (curChar == 92) - { jjAddStates(117, 118); } + jjAddStates(117, 118); break; case 69: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 70: if (curChar == 85) @@ -3440,19 +3453,19 @@ else if ((0x20000000200L & l) != 0L) break; case 78: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 81: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 84: if (curChar == 92) - { jjAddStates(119, 120); } + jjAddStates(119, 120); break; case 85: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 86: if (curChar == 85) @@ -3488,19 +3501,19 @@ else if ((0x20000000200L & l) != 0L) break; case 94: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 101: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 104: if (curChar == 92) - { jjAddStates(121, 122); } + jjAddStates(121, 122); break; case 105: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 106: if (curChar == 85) @@ -3536,17 +3549,17 @@ else if ((0x20000000200L & l) != 0L) break; case 114: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 121: - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 127: if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 129: - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 132: if (curChar == 93 && kind > 172) @@ -3554,34 +3567,34 @@ else if ((0x20000000200L & l) != 0L) break; case 135: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 136: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3589,11 +3602,11 @@ else if ((0x20000000200L & l) != 0L) break; case 145: if (curChar == 92) - { jjAddStates(123, 124); } + jjAddStates(123, 124); break; case 146: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 148: if ((0x7e0000007eL & l) != 0L) @@ -3601,7 +3614,7 @@ else if ((0x20000000200L & l) != 0L) break; case 149: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x7e0000007eL & l) != 0L) @@ -3624,7 +3637,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 156: if ((0x7e0000007eL & l) != 0L) @@ -3635,18 +3648,18 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 159: if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); break; case 160: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 162: - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 165: if ((0x200000002L & l) != 0L && kind > 127) @@ -3682,10 +3695,10 @@ else if ((0x20000000200L & l) != 0L) break; case 175: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 177: - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 180: if ((0x2000000020L & l) != 0L && kind > 128) @@ -3725,39 +3738,39 @@ else if ((0x20000000200L & l) != 0L) break; case 199: if ((0x2000000020L & l) != 0L) - { jjAddStates(125, 126); } + jjAddStates(125, 126); break; case 203: if ((0x2000000020L & l) != 0L) - { jjAddStates(127, 128); } + jjAddStates(127, 128); break; case 208: if ((0x2000000020L & l) != 0L) - { jjAddStates(129, 130); } + jjAddStates(129, 130); break; case 218: if ((0x2000000020L & l) != 0L) - { jjAddStates(131, 132); } + jjAddStates(131, 132); break; case 225: if ((0x2000000020L & l) != 0L) - { jjAddStates(133, 134); } + jjAddStates(133, 134); break; case 229: if ((0x2000000020L & l) != 0L) - { jjAddStates(135, 136); } + jjAddStates(135, 136); break; case 239: if ((0x2000000020L & l) != 0L) - { jjAddStates(137, 138); } + jjAddStates(137, 138); break; case 246: if ((0x2000000020L & l) != 0L) - { jjAddStates(139, 140); } + jjAddStates(139, 140); break; case 250: if ((0x2000000020L & l) != 0L) - { jjAddStates(141, 142); } + jjAddStates(141, 142); break; default : break; } @@ -3765,7 +3778,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -3776,29 +3789,29 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(23, 25); } + jjAddStates(23, 25); break; case 19: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -3809,83 +3822,83 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 25: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 28: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 35: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(35, 40); } + jjAddStates(35, 40); break; case 52: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(32, 34); } + jjAddStates(32, 34); break; case 66: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 81: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(44, 47); } + jjAddStates(44, 47); break; case 101: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(50, 53); } + jjAddStates(50, 53); break; case 121: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 129: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(62, 67); } + jjAddStates(62, 67); break; case 136: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -3893,13 +3906,13 @@ else if ((0x20000000200L & l) != 0L) break; case 162: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(81, 86); } + jjAddStates(81, 86); break; case 177: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(90, 95); } + jjAddStates(90, 95); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -3935,6 +3948,7 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } +<<<<<<< HEAD /** Token literal values. */ public static final String[] jjstrLiteralImages = { @@ -3977,6 +3991,8 @@ protected Token jjFillToken() return t; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) static final int[] jjnextStates = { 192, 193, 194, 196, 197, 202, 203, 233, 234, 235, 237, 242, 212, 213, 214, 216, 221, 142, 153, 155, 120, 123, 124, 6, 7, 17, 1, 2, 4, 66, 67, 68, @@ -4049,6 +4065,111 @@ private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, lo } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, "\50", +"\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", +"\41\75", "\76", "\74", "\74\75", "\76\75", "\41", "\176", "\72", "\174\174", "\46\46", +"\53", "\55", "\52", "\57", "\136\136", "\100", "\174", "\136", "\55\76", "\74\55", +"\77", null, null, null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffffffe23feffffL, 0x3fL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[253]; +private final int[] jjstateSet = new int[506]; +protected char curChar; +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 253; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4070,10 +4191,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4131,31 +4251,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4183,6 +4278,7 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } +<<<<<<< HEAD /** Constructor. */ public SPARQLParser11TokenManager(JavaCharStream stream){ @@ -4276,4 +4372,6 @@ public void SwitchTo(int lexState) private int jjimageLen; private int lengthOfMatch; protected int curChar; +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java index 9c283db5a87..176e379371e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=d168c8aaa91566e8e4a37d907159a9b8 (do not edit this line) */ +/* JavaCC - OriginalChecksum=14a2dd2c56b347f7b769eacf6b50c9b9 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java index a7d04ca9323..a50f6cdf9fd 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,7 +99,7 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred @@ -122,7 +124,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -142,8 +143,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=b8503915d6e2e75526fb396931f35aa6 (do not edit this line) */ From c9094b2abd0e5750912329ce63978dba22e19476 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 12:58:05 +0200 Subject: [PATCH 144/323] support for DISTINCT in FOLD --- .../jena/sparql/expr/aggregate/AggFold.java | 56 ++++++++++--------- .../expr/aggregate/AggregatorFactory.java | 6 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index b30a46fe7f0..f25ce45c63a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -11,16 +11,14 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; @@ -30,12 +28,12 @@ public class AggFold extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final Expr expr1 ) { - this(expr1, null); + public AggFold( final boolean isDistinct, final Expr expr1 ) { + this(isDistinct, expr1, null); } - public AggFold( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { + super( "FOLD", isDistinct, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; @@ -63,7 +61,7 @@ public Aggregator copy( final ExprList exprs ) { final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - return new AggFold(_expr1, _expr2); + return new AggFold(isDistinct, _expr1, _expr2); } @Override @@ -79,7 +77,7 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { @Override public Accumulator createAccumulator() { if ( expr2 == null ) - return new ListAccumulator(); + return new ListAccumulator(expr1, isDistinct); else return new MapAccumulator(); } @@ -134,28 +132,38 @@ public String toPrefixString() { return out.asString(); } - protected class ListAccumulator implements Accumulator { + protected class ListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + @Override - public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v; - final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv == null ) { - v = CDTFactory.getNullValue(); - } - else { - v = CDTFactory.createValue( nv.asNode() ); - } + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. @Override public NodeValue getValue() { - final LiteralLabelForList lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return getAccValue(); } } @@ -190,9 +198,7 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final LiteralLabelForMap lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(map); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 6c492069c18..842d65fb273 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,11 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( distinct ) - throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; +// if ( distinct ) +// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(expr1, expr2) ; + return new AggFold(distinct, expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From 46ef9ffaf93e3c26b58ff52d7a945be10350c285 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:29:58 +0200 Subject: [PATCH 145/323] split AggFold into AggFoldList and AggFoldMap --- .../sparql/expr/aggregate/AggFoldList.java | 129 ++++++++++++++++++ .../{AggFold.java => AggFoldMap.java} | 100 +++----------- .../sparql/expr/aggregate/AggregatorBase.java | 3 +- .../expr/aggregate/AggregatorFactory.java | 7 +- 4 files changed, 155 insertions(+), 84 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java rename jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/{AggFold.java => AggFoldMap.java} (58%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java new file mode 100644 index 00000000000..49079b4fa1e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -0,0 +1,129 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFoldList extends AggregatorBase +{ + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { + super( "FOLD", isDistinct, expr1 ); + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() != 1 ) + throw new IllegalArgumentException(); + + final Expr _expr1 = exprs.get(0); + + return new AggFoldList(isDistinct, _expr1); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFoldList ) ) + return false; + final AggFoldList fold = (AggFoldList) other; + return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + } + + @Override + public Accumulator createAccumulator() { + return new ListAccumulator( getExpr(), isDistinct ); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + return HC_AggFoldList ^ getExpr().hashCode(); + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + if ( isDistinct ) + out.append("DISTINCT "); + + ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + + out.append(")"); + return out.asString(); + } + + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); + + if ( isDistinct ) + out.append(" distinct"); + + WriterExpr.output(out, getExpr(), null); + + out.decIndent(); + out.append(")"); + return out.asString(); + } + + protected class ListAccumulator extends AccumulatorExpr { + final protected List list = new ArrayList<>(); + + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + + @Override + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); + list.add(v); + } + + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. + @Override + public NodeValue getValue() { + return getAccValue(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java similarity index 58% rename from jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java rename to jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index f25ce45c63a..44eb12aaab1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,11 +1,8 @@ package org.apache.jena.sparql.expr.aggregate; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Locale; +import java.util.Map; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; @@ -23,63 +20,47 @@ import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; -public class AggFold extends AggregatorBase +public class AggFoldMap extends AggregatorBase { protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final boolean isDistinct, final Expr expr1 ) { - this(isDistinct, expr1, null); - } - - public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { - super( "FOLD", isDistinct, createExprList(expr1, expr2) ); + public AggFoldMap( final Expr expr1, final Expr expr2 ) { + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; } protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { - final ExprList l = new ExprList(expr1); - - if ( expr2 != null ) { - l.add(expr2); - } + final ExprList l = new ExprList(); + l.add(expr1); + l.add(expr2); return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 2 ) + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - final Iterator it = exprs.iterator(); - final Expr _expr1 = it.next(); - - Expr lookAhead = it.hasNext() ? it.next() : null; - - final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - - return new AggFold(isDistinct, _expr1, _expr2); + return new AggFoldMap( exprs.get(0), exprs.get(1) ); } @Override public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( other == null ) return false; if ( this == other ) return true; - if ( ! ( other instanceof AggFold ) ) + if ( ! ( other instanceof AggFoldMap ) ) return false; - final AggFold fold = (AggFold) other; + final AggFoldMap fold = (AggFoldMap) other; return exprList.equals(fold.exprList, bySyntax); } @Override public Accumulator createAccumulator() { - if ( expr2 == null ) - return new ListAccumulator(expr1, isDistinct); - else - return new MapAccumulator(); + return new MapAccumulator(); } @Override @@ -89,10 +70,10 @@ public Node getValueEmpty() { @Override public int hashCode() { - int hc = HC_AggFold; - for ( final Expr e : getExprList() ) { - hc ^= e.hashCode(); - } + int hc = HC_AggFoldMap; + hc ^= getExprList().get(0).hashCode(); + hc ^= getExprList().get(1).hashCode(); + return hc; } @@ -103,11 +84,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - - if ( expr2 != null ) { - out.append(", "); - ExprUtils.fmtSPARQL(out, expr2, sCxt); - } + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); out.append(")"); return out.asString(); @@ -121,52 +99,14 @@ public String toPrefixString() { out.incIndent(); WriterExpr.output(out, expr1, null); - - if ( expr2 != null ) { - out.append(", "); - WriterExpr.output(out, expr2, null); - } + out.append(", "); + WriterExpr.output(out, expr2, null); out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { - final protected List list = new ArrayList<>(); - - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { - super(expr, makeDistinct); - } - - @Override - protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.createValue( nv.asNode() ); - list.add(v); - } - - @Override - protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.getNullValue(); - list.add(v); - } - - @Override - protected NodeValue getAccValue() { - return CDTLiteralFunctionUtils.createNodeValue(list); - } - - // Overriding this function because the base class would otherwise not - // call getAccValue() in cases in which there was an error during the - // evaluation of the 'expr' for any of the solution mappings. For FOLD, - // however, errors do not cause an aggregation error but just produce - // null values in the created list. - @Override - public NodeValue getValue() { - return getAccValue(); - } - } - protected class MapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index a6869d915b4..4942b842f48 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -187,6 +187,7 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; - protected static final int HC_AggFold = 0x186 ; + protected static final int HC_AggFoldList = 0x186 ; + protected static final int HC_AggFoldMap = 0x187 ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 842d65fb273..b22a95806ff 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,12 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { -// if ( distinct ) -// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(distinct, expr1, expr2) ; + if ( expr2 == null ) + return new AggFoldList(distinct, expr1) ; + else + return new AggFoldMap(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From 66891a88faa9b09a65d14928826598a72d851301 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:53:34 +0200 Subject: [PATCH 146/323] bug fix: correct creation of empty lists and empty maps in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 3 ++- .../sparql/expr/aggregate/AggFoldMap.java | 3 ++- .../library/cdt/CDTLiteralFunctionUtils.java | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 49079b4fa1e..3b766eb9672 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -51,7 +51,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final List emptyList = new ArrayList<>(); + return CDTLiteralFunctionUtils.createNode(emptyList); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 44eb12aaab1..5b64def36d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -65,7 +65,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final Map emptyMap = new HashMap<>(); + return CDTLiteralFunctionUtils.createNode(emptyMap); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 1fa1b956656..3e4b5b39b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -96,14 +96,30 @@ public static final Map checkAndGetMap( final NodeValue nv ) th return checkAndGetMap( nv.asNode() ); } + /** + * Creates a {@link NodeV} with a cdt:List literal that represents the + * given list. + */ + public static final Node createNode( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeFactory.createLiteral(lit); + } + + /** + * Creates a {@link Node} with a cdt:Map literal that represents the + * given map. + */ + public static final Node createNode( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + return NodeFactory.createLiteral(lit); + } + /** * Creates a {@link NodeValue} with a cdt:List literal that represents the * given list. */ public static final NodeValue createNodeValue( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(list) ); } /** @@ -111,9 +127,7 @@ public static final NodeValue createNodeValue( final List list ) { * given map. */ public static final NodeValue createNodeValue( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(map) ); } } From 943eb2e2999072f160c91098b00266cff0655bfd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 12 Oct 2023 17:31:31 +0200 Subject: [PATCH 147/323] support for ORDER BY in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 197 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 4 +- 2 files changed, 187 insertions(+), 14 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 3b766eb9672..9bc9e6c4904 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,14 +1,26 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; @@ -16,22 +28,77 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldList extends AggregatorBase { + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { - super( "FOLD", isDistinct, expr1 ); + this(isDistinct, expr1, null); + } + + public AggFoldList( final boolean isDistinct, final Expr expr1, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", isDistinct, collectExprs(expr1, orderBy) ); + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } + } + + protected static ExprList collectExprs( final Expr expr1, final List orderBy ) { + final ExprList l = new ExprList(expr1); + + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 1 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 1 ) throw new IllegalArgumentException(); + + _expr1 = exprs.get(0); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+1 ) throw new IllegalArgumentException(); + - final Expr _expr1 = exprs.get(0); + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); - return new AggFoldList(isDistinct, _expr1); + _expr1 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldList(isDistinct, _expr1, _orderBy); } @Override @@ -41,12 +108,17 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldList ) ) return false; final AggFoldList fold = (AggFoldList) other; - return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + return (isDistinct == fold.isDistinct) + && getExprList().get(0).equals(fold.getExprList().get(0), bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new ListAccumulator( getExpr(), isDistinct ); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingListAccumulator(); + else + return new BasicListAccumulator( getExprList().get(0), isDistinct ); } @Override @@ -69,7 +141,16 @@ public String asSparqlExpr( final SerializationContext sCxt ) { if ( isDistinct ) out.append("DISTINCT "); - ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + ExprUtils.fmtSPARQL(out, getExprList().get(0), sCxt); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } out.append(")"); return out.asString(); @@ -85,17 +166,26 @@ public String toPrefixString() { if ( isDistinct ) out.append(" distinct"); - WriterExpr.output(out, getExpr(), null); + WriterExpr.output(out, getExprList().get(0), null); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { + protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); } @@ -127,4 +217,89 @@ public NodeValue getValue() { } } + protected class SortingListAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingListAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it; + if ( isDistinct ) + it = new DuplicateEliminationIterator( sbag.iterator() ); + else + it = sbag.iterator(); + + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + + /** + * Wraps another iterator which is assumed to return its elements in a + * sorted order (that is, all elements that are equal to one another are + * returned by the wrapped iterator directly one after another) and, then, + * returns the elements from that wrapped iterator without duplicates. + */ + protected static class DuplicateEliminationIterator implements Iterator { + protected final Iterator input; + protected E prevReturnedElmt = null; + protected E nextAvailableElmt = null; + + public DuplicateEliminationIterator( final Iterator input ) { + this.input = input; + + if ( input.hasNext() ) { + nextAvailableElmt = input.next(); + } + } + + @Override + public boolean hasNext() { + while ( nextAvailableElmt == null ) { + if ( ! input.hasNext() ) + return false; + + nextAvailableElmt = input.next(); + if ( prevReturnedElmt != null + && prevReturnedElmt.equals(nextAvailableElmt) ) { + // the current next element must not be returned because + // it is a duplicate of the previous returned element + nextAvailableElmt = null; + } + } + return true; + } + + @Override + public E next() { + if ( ! hasNext() ) { + throw new NoSuchElementException(); + } + + prevReturnedElmt = nextAvailableElmt; + nextAvailableElmt = null; + + return prevReturnedElmt; + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index b22a95806ff..2c59b3252c0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,10 +75,8 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( orderBy != null ) - System.out.println( "HERE!! " + orderBy.size() ); if ( expr2 == null ) - return new AggFoldList(distinct, expr1) ; + return new AggFoldList(distinct, expr1, orderBy) ; else return new AggFoldMap(expr1, expr2) ; } From 16afd0c31c64118f8a9d6caab5fdb3c5adc88b76 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 13 Oct 2023 15:45:29 +0200 Subject: [PATCH 148/323] changes the tests of FOLD(DISTINCT ...) to capture the decision that multiple errors collapse into a single null value --- .../expr/aggregate/AccumulatorExpr.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java index d8c5de3f35a..4d59ad2632a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java @@ -35,7 +35,7 @@ public abstract class AccumulatorExpr implements Accumulator private long accCount = 0 ; protected long errorCount = 0 ; private final Expr expr ; - private final boolean makeDistinct; + protected final boolean makeDistinct; protected AccumulatorExpr(Expr expr, boolean makeDistinct) { this.expr = expr; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 9bc9e6c4904..2f679f7a679 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -184,6 +184,7 @@ public String toPrefixString() { protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected boolean nullValueAdded = false; protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); @@ -197,6 +198,15 @@ protected void accumulate( final NodeValue nv, final Binding binding, final Func @Override protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + // By definition of FOLD, evaluation errors result in null values + // for the created list. If FOLD is used with the keyword DISTINCT, + // then all errors collapse to a single null value. + if ( makeDistinct && nullValueAdded ) { + return; + } + + nullValueAdded = true; + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } @@ -237,12 +247,22 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { final Iterator it; - if ( isDistinct ) + final Accumulator acc; + if ( isDistinct ) { it = new DuplicateEliminationIterator( sbag.iterator() ); - else + acc = new BasicListAccumulator( getExprList().get(0), false ) { + @Override + protected void accumulateError( final Binding b, final FunctionEnv e ) { + if ( nullValueAdded ) return; + super.accumulateError(b, e); + } + }; + } + else { it = sbag.iterator(); + acc = new BasicListAccumulator( getExprList().get(0), false ); + } - final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); } From db2f7f984ecb240fb90bdfdd70fa41103cf1d177 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 14 Oct 2023 15:46:32 +0200 Subject: [PATCH 149/323] support for ORDER BY in FOLD for maps --- .../sparql/expr/aggregate/AggFoldMap.java | 137 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 2 +- 2 files changed, 130 insertions(+), 9 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 5b64def36d6..70eb9c57eac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,15 +1,28 @@ package org.apache.jena.sparql.expr.aggregate; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -18,6 +31,7 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldMap extends AggregatorBase @@ -25,27 +39,80 @@ public class AggFoldMap extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldMap( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + this(expr1, expr2, null); + } + + public AggFoldMap( final Expr expr1, final Expr expr2, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", false, collectExprs(expr1, expr2, orderBy) ); this.expr1 = expr1; this.expr2 = expr2; + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } } - protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { + protected static ExprList collectExprs( final Expr expr1, final Expr expr2, final List orderBy ) { final ExprList l = new ExprList(); l.add(expr1); l.add(expr2); + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 2 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final Expr _expr2; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - return new AggFoldMap( exprs.get(0), exprs.get(1) ); + _expr1 = exprs.get(0); + _expr2 = exprs.get(1); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+2 ) throw new IllegalArgumentException(); + + + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); + + _expr1 = eit.next(); + _expr2 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldMap(_expr1, _expr2, _orderBy); } @Override @@ -55,12 +122,16 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldMap ) ) return false; final AggFoldMap fold = (AggFoldMap) other; - return exprList.equals(fold.exprList, bySyntax); + return exprList.equals(fold.exprList, bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new MapAccumulator(); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingMapAccumulator(); + else + return new BasicMapAccumulator(); } @Override @@ -88,6 +159,15 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } + out.append(")"); return out.asString(); } @@ -103,12 +183,21 @@ public String toPrefixString() { out.append(", "); WriterExpr.output(out, expr2, null); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } + out.decIndent(); out.append(")"); return out.asString(); } - protected class MapAccumulator implements Accumulator { + protected class BasicMapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); @Override @@ -143,4 +232,36 @@ public NodeValue getValue() { } } + protected class SortingMapAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingMapAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicMapAccumulator(); + + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 2c59b3252c0..4d99bdeb9a2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -78,7 +78,7 @@ public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, Li if ( expr2 == null ) return new AggFoldList(distinct, expr1, orderBy) ; else - return new AggFoldMap(expr1, expr2) ; + return new AggFoldMap(expr1, expr2, orderBy) ; } public static Aggregator createCustom(String iri, Args a) { From 510a252065aff27423421dce3d01e2f7f976059b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:42:29 +0200 Subject: [PATCH 150/323] support for comparison (<, <=, >, >=) of cdt:Map literals --- .../apache/jena/cdt/CompositeDatatypeMap.java | 119 ++++++++++++++++++ .../apache/jena/sparql/expr/NodeValue.java | 13 ++ 2 files changed, 132 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e79b3bd3835..ca61fea0170 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,12 +1,18 @@ package org.apache.jena.cdt; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; +import java.util.TreeSet; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.xsd.impl.RDFLangString; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -168,6 +174,78 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { return true; } + /** + * Assumes that the datatype of both of the given literals is cdt:Map. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final Map map1; + final Map map2; + try { + map1 = getValue(value1); + map2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; + if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; + if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + + final CDTKeySorter keySorter = new CDTKeySorter(); + final TreeSet sortedKeys1 = new TreeSet<>(keySorter); + final TreeSet sortedKeys2 = new TreeSet<>(keySorter); + sortedKeys1.addAll( map1.keySet() ); + sortedKeys2.addAll( map2.keySet() ); + + final Iterator it1 = sortedKeys1.iterator(); + final Iterator it2 = sortedKeys2.iterator(); + final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTKey k1 = it1.next(); + final CDTKey k2 = it2.next(); + + final int kCmp = keySorter.compare(k1, k2); + if ( kCmp < 0 ) return Expr.CMP_LESS; + if ( kCmp > 0 ) return Expr.CMP_GREATER; + + + final CDTValue v1 = map1.get(k1); + final CDTValue v2 = map2.get(k2); + if ( v1.isNull() || v2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + final boolean nEqCmp; + try { + nEqCmp = n1.sameValueAs(n2); + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( nEqCmp == false ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + try { + final int vCmp = NodeValue.compare(nv1, nv2); + if ( vCmp != Expr.CMP_EQUAL ) + return vCmp; + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + } + } + + final int sizeDiff = map1.size() - map2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } + /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this @@ -205,4 +283,45 @@ public static Map getValue( final LiteralLabel lit ) throws Dat return map; } + protected static class CDTKeySorter implements Comparator { + @Override + public int compare( final CDTKey k1, final CDTKey k2 ) { + final Node n1 = k1.asNode(); + final Node n2 = k2.asNode(); + + if ( n1.isURI() ) { + if ( ! n2.isURI() ) { + return Expr.CMP_LESS; + } + + final String uri1 = n1.getURI(); + final String uri2 = n2.getURI(); + return uri1.compareTo(uri2); + } + else if ( n2.isURI() ) { + return Expr.CMP_GREATER; + } + + // at this point, both RDF terms (n1 and n2) should be literals + final String dt1 = n1.getLiteralDatatypeURI(); + final String dt2 = n2.getLiteralDatatypeURI(); + final int dtCmp = dt1.compareTo(dt2); + if ( dtCmp != 0 ) { + return dtCmp; + } + + final String lex1 = n1.getLiteralLexicalForm(); + final String lex2 = n2.getLiteralLexicalForm(); + final int lexCmp = lex1.compareTo(lex2); + if ( lexCmp != 0 || ! RDFLangString.rdfLangString.getURI().equals(dt1) ) { + return lexCmp; + } + + // at this point, both literals are rdf:LangString literals with the same value + final String lang1 = n1.getLiteralLanguage(); + final String lang2 = n2.getLiteralLanguage(); + return lang1.compareTo(lang2); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 3ae359062de..194b4a9e178 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -816,6 +816,19 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom } } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeMap.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN: { // One or two unknown value spaces. From 1d576253a78213b796dca31dc8a8cde695118ad9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:43:11 +0200 Subject: [PATCH 151/323] bug fix in comparison of cdt:List literals --- .../org/apache/jena/cdt/CompositeDatatypeList.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index d73d1314227..922a2b1679f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; @@ -199,9 +200,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( list1.isEmpty() && list2.isEmpty() ) return 0; - if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; - if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; + if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; + if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { @@ -231,11 +232,14 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( c != 0 ) return c; + if ( c != Expr.CMP_EQUAL ) return c; } } - return ( list1.size() - list2.size() ); + final int sizeDiff = list1.size() - list2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; } /** From c7136d979080353dc6ed396ec9e44e3a5d7d1764 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 16 Oct 2023 13:16:08 +0200 Subject: [PATCH 152/323] bug fix in FOLD with both DISTINCT, as revealed by the 'fold-list-distinct-orderby-02' test --- .../sparql/expr/aggregate/AggFoldList.java | 67 +------------------ 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 2f679f7a679..c02bfd0b5e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -246,22 +246,8 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final Iterator it; - final Accumulator acc; - if ( isDistinct ) { - it = new DuplicateEliminationIterator( sbag.iterator() ); - acc = new BasicListAccumulator( getExprList().get(0), false ) { - @Override - protected void accumulateError( final Binding b, final FunctionEnv e ) { - if ( nullValueAdded ) return; - super.accumulateError(b, e); - } - }; - } - else { - it = sbag.iterator(); - acc = new BasicListAccumulator( getExprList().get(0), false ); - } + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), isDistinct ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); @@ -273,53 +259,4 @@ protected void accumulateError( final Binding b, final FunctionEnv e ) { } } - /** - * Wraps another iterator which is assumed to return its elements in a - * sorted order (that is, all elements that are equal to one another are - * returned by the wrapped iterator directly one after another) and, then, - * returns the elements from that wrapped iterator without duplicates. - */ - protected static class DuplicateEliminationIterator implements Iterator { - protected final Iterator input; - protected E prevReturnedElmt = null; - protected E nextAvailableElmt = null; - - public DuplicateEliminationIterator( final Iterator input ) { - this.input = input; - - if ( input.hasNext() ) { - nextAvailableElmt = input.next(); - } - } - - @Override - public boolean hasNext() { - while ( nextAvailableElmt == null ) { - if ( ! input.hasNext() ) - return false; - - nextAvailableElmt = input.next(); - if ( prevReturnedElmt != null - && prevReturnedElmt.equals(nextAvailableElmt) ) { - // the current next element must not be returned because - // it is a duplicate of the previous returned element - nextAvailableElmt = null; - } - } - return true; - } - - @Override - public E next() { - if ( ! hasNext() ) { - throw new NoSuchElementException(); - } - - prevReturnedElmt = nextAvailableElmt; - nextAvailableElmt = null; - - return prevReturnedElmt; - } - } - } From 1e0df203962b2e2889ce56ae591396497eb6828a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 13:27:31 +0200 Subject: [PATCH 153/323] support for ORDER BY for cdt:List literals --- .../jena/cdt/CompositeDatatypeList.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 1 - 3 files changed, 114 insertions(+), 29 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 922a2b1679f..eaf17c59638 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -188,57 +188,143 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { /** * Assumes that the datatype of both of the given literals is cdt:List. + * If 'sortOrderingCompare' is true, the two lists are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the list-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final List list1; - final List list2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + List list1 = null; try { list1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + List list2 = null; + try { list2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( list1 == null || list2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the list-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( list1 != null ) return Expr.CMP_LESS; + if ( list2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; - if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; - if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two lists is empty, we can decide + // without a pair-wise comparison of the list elements. + if ( list1.isEmpty() || list2.isEmpty() ) { + // The literals with the non-empty list is greater + // than the literal with the empty list. + if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! list2.isEmpty() ) return Expr.CMP_LESS; + + // If both lists are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // list-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the list elements. final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { final CDTValue elmt1 = list1.get(i); final CDTValue elmt2 = list2.get(i); - if ( elmt1.isNull() || elmt2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); - - if ( n1.isBlank() && n2.isBlank() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + if ( ! elmt1.isNull() && ! elmt2.isNull() ) { + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } - final int c; - try { - c = NodeValue.compare(nv1, nv2); + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch ( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two list elements is null. + if ( ! sortOrderingCompare ) { + // When comparing as per the list-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - - if ( c != Expr.CMP_EQUAL ) return c; + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both elements are null, we + // don't do anything here and simply advance to the next + // pair of elements. + // However, if only one of the two elements is null, then + // the literal with this element is ordered lower than the + // other literal. + if ( elmt1.isNull() && ! elmt2.isNull() ) + return Expr.CMP_LESS; + + if ( elmt2.isNull() && ! elmt1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of list elements has not + // led to any decision. Now, we decide based on the size of the lists. final int sizeDiff = list1.size() - list2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; return Expr.CMP_EQUAL; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 194b4a9e178..945dc10bb76 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -808,7 +808,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index c02bfd0b5e7..e53f8a45263 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.NoSuchElementException; import java.util.Objects; import org.apache.jena.atlas.data.BagFactory; From fe2d313580c0f71ef74418aa435fc65e4c68fbd4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 16:23:02 +0200 Subject: [PATCH 154/323] support for ORDER BY for cdt:Map literals --- .../jena/cdt/CompositeDatatypeBase.java | 10 ++ .../jena/cdt/CompositeDatatypeList.java | 9 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 4 files changed, 120 insertions(+), 41 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index 5c1e768a424..ffeff44314d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -20,6 +20,8 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; public abstract class CompositeDatatypeBase implements RDFDatatype { @@ -47,4 +49,12 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; public abstract String unparseValue( final T value ); + + // helper for the compare function in each of the subclasses + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index eaf17c59638..15c950d212c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -231,7 +231,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // If at least one of the two lists is empty, we can decide // without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { - // The literals with the non-empty list is greater + // The literal with the non-empty list is greater // than the literal with the empty list. if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; if ( ! list2.isEmpty() ) return Expr.CMP_LESS; @@ -321,13 +321,6 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, return Expr.CMP_EQUAL; } - protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { - final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); - if ( lexCmp < 0 ) return Expr.CMP_LESS; - if ( lexCmp > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; - } - /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index ca61fea0170..3745596481f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -176,28 +176,73 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { /** * Assumes that the datatype of both of the given literals is cdt:Map. + * + * If 'sortOrderingCompare' is true, the two maps are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the map-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final Map map1; - final Map map2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + Map map1 = null; try { map1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + Map map2 = null; + try { map2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( map1 == null || map2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the map-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( map1 != null ) return Expr.CMP_LESS; + if ( map2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; - if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; - if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two maps is empty, we can decide + // without a pair-wise comparison of the map entries. + if ( map1.isEmpty() || map2.isEmpty() ) { + // The literal with the non-empty map is greater + // than the literal with the empty map. + if ( ! map1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! map2.isEmpty() ) return Expr.CMP_LESS; + + // If both maps are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // map-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the map entries. + // To this end, we first need to sort the map entries. final CDTKeySorter keySorter = new CDTKeySorter(); final TreeSet sortedKeys1 = new TreeSet<>(keySorter); final TreeSet sortedKeys2 = new TreeSet<>(keySorter); sortedKeys1.addAll( map1.keySet() ); sortedKeys2.addAll( map2.keySet() ); + // Now we can perform the pair-wise comparison of the map entries. final Iterator it1 = sortedKeys1.iterator(); final Iterator it2 = sortedKeys2.iterator(); final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); @@ -209,41 +254,72 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 if ( kCmp < 0 ) return Expr.CMP_LESS; if ( kCmp > 0 ) return Expr.CMP_GREATER; - final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); - if ( v1.isNull() || v2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - final boolean nEqCmp; - try { - nEqCmp = n1.sameValueAs(n2); - } - catch( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - if ( nEqCmp == false ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - try { - final int vCmp = NodeValue.compare(nv1, nv2); - if ( vCmp != Expr.CMP_EQUAL ) - return vCmp; + if ( ! v1.isNull() && ! v2.isNull() ) { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! n1.sameValueAs(n2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two map entries has null as its value. + if ( ! sortOrderingCompare ) { + // When comparing as per the map-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both map entries have null + // as their value, we don't do anything here and simply + // advance to the next pair of map entries. + // However, if the map value of only one of the two map + // entries is null, then the literal with this map entry + // is ordered lower than the other literal. + if ( v1.isNull() && ! v2.isNull() ) + return Expr.CMP_LESS; + + if ( v2.isNull() && ! v1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of map entries has not led + // to any decision. Now, we decide based on the size of the maps. final int sizeDiff = map1.size() - map2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; } /** diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 945dc10bb76..82275d4b24f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -821,7 +821,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeMap.compare(lit1, lit2) ; + return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; From 55d1132cef891c676e2d97528a141de059183107 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 20 Oct 2023 14:23:54 +0200 Subject: [PATCH 155/323] changed the implementation of ORDER BY for CDT literals such that the relative order is undefined if one of the compared literals is ill-formed --- .../jena/cdt/CompositeDatatypeList.java | 35 +++---------------- .../apache/jena/cdt/CompositeDatatypeMap.java | 35 +++---------------- 2 files changed, 10 insertions(+), 60 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15c950d212c..de29b966b16 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -193,43 +193,18 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - List list1 = null; + final List list1; + final List list2; try { list1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - List list2 = null; - try { list2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( list1 == null || list2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the list-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( list1 != null ) return Expr.CMP_LESS; - if ( list2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two lists is empty, we can decide - // without a pair-wise comparison of the list elements. + // If at least one of the two lists is empty, then we can decide their + // relative order without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { // The literal with the non-empty list is greater // than the literal with the empty list. diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 3745596481f..24a76bbb7b5 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -182,43 +182,18 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - Map map1 = null; + final Map map1; + final Map map2; try { map1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - Map map2 = null; - try { map2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( map1 == null || map2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the map-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( map1 != null ) return Expr.CMP_LESS; - if ( map2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two maps is empty, we can decide - // without a pair-wise comparison of the map entries. + // If at least one of the two maps is empty, then we can decide their + // relative order without a pair-wise comparison of the map entries. if ( map1.isEmpty() || map2.isEmpty() ) { // The literal with the non-empty map is greater // than the literal with the empty map. From 04f6e1ae38f097248107f8e78b4edff6fc92b3e2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 Nov 2023 19:03:52 +0100 Subject: [PATCH 156/323] implements the decision that 'null=null' is true rather than an error --- .../jena/cdt/CompositeDatatypeList.java | 91 ++++++++++++------- .../apache/jena/cdt/CompositeDatatypeMap.java | 85 +++++++++++------ 2 files changed, 113 insertions(+), 63 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index de29b966b16..e680a30c99f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -168,18 +168,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final CDTValue v2 = it2.next(); if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); - } + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } - if ( ! n1.sameValueAs(n2) ) { - return false; + if ( ! n1.sameValueAs(n2) ) { + return false; + } } } @@ -227,36 +230,57 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue elmt2 = list2.get(i); if ( ! elmt1.isNull() && ! elmt2.isNull() ) { - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); - if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + if ( ! sortOrderingCompare && nv1.isBlank() && nv2.isBlank() ) { throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - + // Compare the values represented by the two list elements + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // lists. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of list elements. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -264,8 +288,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two list elements is null. if ( ! sortOrderingCompare ) { // When comparing as per the list-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! elmt1.isNull() || ! elmt2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 24a76bbb7b5..e3a2ad317cd 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -158,17 +158,20 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v2 == null ) return false; if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + if ( ! n1.sameValueAs(n2) ) return false; } - - if ( ! n1.sameValueAs(n2) ) return false; } return true; @@ -232,32 +235,53 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); if ( ! v1.isNull() && ! v2.isNull() ) { - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! n1.sameValueAs(n2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + final NodeValue nv1 = NodeValue.makeNode( v1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + // Compare the actual values represented by the two map values + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // maps. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of map entries. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -265,8 +289,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two map entries has null as its value. if ( ! sortOrderingCompare ) { // When comparing as per the map-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! v1.isNull() || ! v2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are From c3d0d6046d515d3c901c419ededa6f32aaea0030 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Dec 2023 13:41:20 +0100 Subject: [PATCH 157/323] implements the decision that null is not equal to any RDF term --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index e680a30c99f..b630fc4c864 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -169,7 +169,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + return false; } } else { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e3a2ad317cd..59b52ebed89 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -159,7 +159,7 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + return false; } } else { From c9e0d7f9c20a08968565c51091136e0e0b18cbce Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 8 Jan 2024 19:29:16 +0100 Subject: [PATCH 158/323] bug fix: map keys cannot be blank nodes --- jena-arq/Grammar/cdt_literals.jj | 2 -- .../java/org/apache/jena/cdt/parser/CDTLiteralParser.java | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 514be16467b..24b3d46524d 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -140,8 +140,6 @@ CDTKey MapKey() : { String iri; Node n; } { iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } | - n = BlankNode() { return CDTFactory.createKey(n); } -| n = RDFLiteral() { return CDTFactory.createKey(n); } | n = NumericLiteral() { return CDTFactory.createKey(n); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 8f0b6cb9404..27a51bed270 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -139,7 +139,6 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case IRIref: - case BLANK_NODE_LABEL: NonEmptyMapContent(m); break; default: @@ -184,10 +183,6 @@ final public CDTKey MapKey() throws ParseException { iri = IRI_REF(); n = createNode(iri); {if (true) return CDTFactory.createKey(n);} break; - case BLANK_NODE_LABEL: - n = BlankNode(); - {if (true) return CDTFactory.createKey(n);} - break; case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: @@ -401,7 +396,7 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x2f0f80,0x80000000,0x2f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; From b601bcc3a1ab83a82b789dcb23c09f38b4194f3d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:28:47 +0100 Subject: [PATCH 159/323] changes CDTLiteralParserBase to extend LangParserBase instead of TurtleParserBase because, in later versions of Jena, TurtleParserBase has been removed --- jena-arq/Grammar/cdt_literals.jj | 16 +++++++++------- .../apache/jena/cdt/CDTLiteralParserBase.java | 8 ++++---- .../apache/jena/cdt/ParserForCDTLiterals.java | 3 +++ .../apache/jena/cdt/parser/CDTLiteralParser.java | 16 +++++++++------- .../cdt/parser/CDTLiteralParserTokenManager.java | 1 + 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 24b3d46524d..d2e098b906c 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -58,6 +58,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase { } @@ -85,7 +87,7 @@ void NonEmptyListContent(List l) : { } void ListElement(List l) : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); } | n = BlankNode() { l.add( CDTFactory.createValue(n) ); } | @@ -138,7 +140,7 @@ void MapEntry(Map m) : { CDTKey key; CDTValue value; } CDTKey MapKey() : { String iri; Node n; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createKey(n); } | n = RDFLiteral() { return CDTFactory.createKey(n); } | @@ -149,7 +151,7 @@ CDTKey MapKey() : { String iri; Node n; } CDTValue MapValue() : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createValue(n); } | n = BlankNode() { return CDTFactory.createValue(n); } | @@ -186,9 +188,9 @@ Node BlankNode() : { Token t = null ; } Node NumericLiteral() : { Token t ; } { - t = { return createLiteralInteger(t.image); } -| t = { return createLiteralDecimal(t.image); } -| t = { return createLiteralDouble(t.image); } + t = { return createLiteralInteger(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDecimal(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDouble(t.image, t.beginLine, t.beginColumn); } } Node BooleanLiteral() : {} @@ -210,7 +212,7 @@ Node RDFLiteral() : { String lex = null ; } )? { - return createLiteral(lex, lang, dt); + return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index e42b9c339d0..9d4bac04dd6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -3,12 +3,12 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.ttl.turtle.TurtleParserBase; +import org.apache.jena.riot.lang.extra.LangParserBase; -public class CDTLiteralParserBase extends TurtleParserBase +public class CDTLiteralParserBase extends LangParserBase { @Override - protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); @@ -19,7 +19,7 @@ protected Node createLiteral( final String lex, final String langTag, final Stri return NodeFactory.createLiteral(lit); } - return super.createLiteral(lex, langTag, datatypeURI); + return super.createLiteral(lex, langTag, datatypeURI, line, column); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 4284f6f3c1d..02700094c5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -28,6 +28,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -59,6 +60,7 @@ public static List parseListLiteral( final Reader reader, final boolea final List list; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -117,6 +119,7 @@ public static Map parseMapLiteral( final Reader reader, final b final Map map; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 27a51bed270..febae9906be 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -27,6 +27,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point for cdt:List literals @@ -81,7 +83,7 @@ final public void ListElement(List l) throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); l.add( CDTFactory.createValue(n) ); + n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -181,7 +183,7 @@ final public CDTKey MapKey() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createKey(n);} break; case STRING_LITERAL1: case STRING_LITERAL2: @@ -214,7 +216,7 @@ final public CDTValue MapValue() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createValue(n);} break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -278,15 +280,15 @@ final public Node NumericLiteral() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: t = jj_consume_token(INTEGER); - {if (true) return createLiteralInteger(t.image);} + {if (true) return createLiteralInteger(t.image, t.beginLine, t.beginColumn);} break; case DECIMAL: t = jj_consume_token(DECIMAL); - {if (true) return createLiteralDecimal(t.image);} + {if (true) return createLiteralDecimal(t.image, t.beginLine, t.beginColumn);} break; case DOUBLE: t = jj_consume_token(DOUBLE); - {if (true) return createLiteralDouble(t.image);} + {if (true) return createLiteralDouble(t.image, t.beginLine, t.beginColumn);} break; default: jj_la1[7] = jj_gen; @@ -339,7 +341,7 @@ final public Node RDFLiteral() throws ParseException { jj_la1[10] = jj_gen; ; } - {if (true) return createLiteral(lex, lang, dt);} + {if (true) return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn);} throw new Error("Missing return statement in function"); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index bcf9c3cb8e2..9f7b775c892 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From 0f051bd1a98d339e720aaea5bb947c5c99608d31 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:36:58 +0100 Subject: [PATCH 160/323] moves the CDT literals grammar to the subdirectory './jena-arq/Grammar/CDTs/' --- jena-arq/Grammar/{ => CDTs}/cdt_literals.jj | 0 jena-arq/Grammar/{grammarCDTs => CDTs/generate} | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/Grammar/{ => CDTs}/cdt_literals.jj (100%) rename jena-arq/Grammar/{grammarCDTs => CDTs/generate} (90%) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/CDTs/cdt_literals.jj similarity index 100% rename from jena-arq/Grammar/cdt_literals.jj rename to jena-arq/Grammar/CDTs/cdt_literals.jj diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/CDTs/generate similarity index 90% rename from jena-arq/Grammar/grammarCDTs rename to jena-arq/Grammar/CDTs/generate index 8bbaf8685d4..687b81f0532 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/CDTs/generate @@ -17,7 +17,7 @@ # Parser builder -DIR="../src/main/java/org/apache/jena/cdt/parser" +DIR="../../src/main/java/org/apache/jena/cdt/parser" FILE=cdt_literals.jj CLASS=CDTLiteralParser @@ -57,8 +57,8 @@ sed -e 's/@SuppressWarnings("serial")//' \ mv F $F echo "---- Create HTML form ----" -./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html -./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html +../jj2html ${FILE%%.jj}.txt '../tokens.txt' > ${FILE%%.jj}-1.html +../grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html echo "Check X and Y for IRI_REF because \" became '" From e904dc992ee64bee479a97212f481d5a590ed843 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Mar 2024 14:25:50 +0100 Subject: [PATCH 161/323] adds license comment at the begin oft he files --- .../apache/jena/cdt/CDTLiteralParserBase.java | 18 ++++++++++++++++++ .../apache/jena/cdt/CompositeDatatypeMap.java | 18 ++++++++++++++++++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 18 ++++++++++++++++++ .../sparql/expr/aggregate/AggFoldList.java | 18 ++++++++++++++++++ .../jena/sparql/expr/aggregate/AggFoldMap.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctionUtils.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctions.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ConcatFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsKeyFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsTermFct.java | 18 ++++++++++++++++++ .../library/cdt/FunctionBase1List.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/GetFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/HeadFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/KeysFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ListFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MapFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MergeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/PutFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/RemoveFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ReverseFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SizeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SubSeqFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/TailFct.java | 18 ++++++++++++++++++ 24 files changed, 432 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 9d4bac04dd6..86f89242fe4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import org.apache.jena.graph.Node; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 59b52ebed89..999c087dca6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Comparator; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 6fea1cfee96..b835f619c83 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Objects; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index e53f8a45263..52687ef030c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 70eb9c57eac..923e42934bc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 3e4b5b39b28..d7449b162f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 48f5d4a7465..35b2e78a78b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index fc7ed60734d..6a0dba23500 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index f9751d78ca5..462398e98f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index eca1978ba1e..88a46fd2d08 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index da670a6508e..e5fc0421f49 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index b6f45b33e4b..0b2af548103 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index c83cd9b764f..24bcbfcfb50 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index 1f331c936ac..0eb1348f986 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 6c393370ff1..2c919eb9347 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index ca7c0f92715..dc50559d9f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java index 3dba18232eb..fec5c220524 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java index ddeb872b3ce..344f3117fae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index 0df7dcfdf00..428c000d5bb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index 0a4a5a99b36..b5df5a5a292 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index 3d28e7a76e0..9b918036c72 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 5166f1440d9..e0bb791c076 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 80a99fb32f0..e508185c7dc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index 70805975786..aee058e6586 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; From c75f0ccdcf127fe80d478ce5be6d79714510c2c8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 13 Jan 2024 11:25:30 +0100 Subject: [PATCH 162/323] extends LiteralLabelForCDTs with a constructor to pass both the lexical form and the value form --- .../org/apache/jena/cdt/LiteralLabelForCDTs.java | 13 +++++++++++++ .../org/apache/jena/cdt/LiteralLabelForList.java | 9 +++++++++ .../org/apache/jena/cdt/LiteralLabelForMap.java | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index b835f619c83..cd1df7b2b86 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -48,6 +48,19 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForCDTs( final String lexicalForm, final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + @Override public abstract CompositeDatatypeBase getDatatype(); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index e84fe915333..32c1331befc 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,15 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForList( final String lexicalForm, final List valueForm ) { + super(lexicalForm , valueForm); + } + @Override public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 18ad753f62c..028fb646c5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,15 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForMap( final String lexicalForm, final Map valueForm ) { + super(lexicalForm, valueForm); + } + @Override public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; From 7445c4fca7e8790527a4fd37699c5d4e00939974 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 May 2024 10:54:01 +0200 Subject: [PATCH 163/323] permanent URI for the CDT datatypes and functions --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index b630fc4c864..0edfd9b0a63 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -31,7 +31,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/List"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 999c087dca6..23516072ec2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -34,7 +34,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/Map"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index 4428b80c65d..d18420b3f6d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -81,7 +81,7 @@ public class ARQConstants public static final String javaClassURIScheme = "java:" ; /** The ARQ function library URI space */ - public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + public static final String CDTFunctionLibraryURI = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/" ; /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; From 18e781c06989629a884a2af149a769e6ee8be35d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 25 May 2024 18:18:32 +0300 Subject: [PATCH 164/323] removes the InputStream versions of parseListLiteral and parseMapLiteral --- .../apache/jena/cdt/ParserForCDTLiterals.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 02700094c5e..fbaed36de26 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -45,17 +45,6 @@ public static List parseListLiteral( final String lex, final boolean r return result; } - public static List parseListLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final List result = parseListLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static List parseListLiteral( final Reader reader, final boolean recursive ) { final List list; try { @@ -104,17 +93,6 @@ public static Map parseMapLiteral( final String lex, final bool return result; } - public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final Map result = parseMapLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { final Map map; try { From c5ab8dfd7cb8dd4f1dc0752b10b9f1f18c0835c2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:20:09 +0300 Subject: [PATCH 165/323] adds the possibility to create CDT literals that are known to be ill-formed (because their lexical form has already been checked) --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 5 +++++ .../java/org/apache/jena/cdt/CompositeDatatypeMap.java | 5 +++++ .../java/org/apache/jena/cdt/LiteralLabelForCDTs.java | 8 ++++++++ .../java/org/apache/jena/cdt/LiteralLabelForList.java | 4 ++++ .../main/java/org/apache/jena/cdt/LiteralLabelForMap.java | 4 ++++ .../function/library/cdt/CDTLiteralFunctionUtils.java | 6 ++++++ 6 files changed, 32 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 0edfd9b0a63..c250c09dbcf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -196,6 +196,11 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final List list1; final List list2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 23516072ec2..587e30f9805 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -203,6 +203,11 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final Map map1; final Map map2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index cd1df7b2b86..48eb6c0f0fe 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -48,6 +48,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + public LiteralLabelForCDTs( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index 32c1331befc..60f76f02c71 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,10 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForList( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 028fb646c5c..c3a18961075 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,10 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForMap( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed ); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d7449b162f8..37ff826a846 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -63,6 +63,9 @@ public static final void ensureMapLiteral( final Node n ) throws ExprEvalExcepti * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. */ public static final List getList( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeList.getValue( n.getLiteral() ); } @@ -80,6 +83,9 @@ public static final List getList( final Node n ) throws ExprEvalExcept * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. */ public static final Map getMap( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeMap.getValue( n.getLiteral() ); } From 00ae9e59caa93e8e01ae703e27ecc4792f55e82e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:41:10 +0300 Subject: [PATCH 166/323] changes the parsing of CDT literals such that the scope of bnode identifiers extends to all CDT literals within a file as well as to the file itself; as per https://github.com/awslabs/SPARQL-CDTs/pull/2 and https://github.com/awslabs/SPARQL-CDTs/pull/4 --- .../apache/jena/cdt/CDTLiteralParserBase.java | 20 ++-- .../apache/jena/cdt/ParserForCDTLiterals.java | 41 ++++++--- .../java/org/apache/jena/riot/RDFParser.java | 2 +- .../riot/system/CDTAwareParserProfile.java | 92 +++++++++++++++++++ .../org/apache/jena/riot/system/RiotLib.java | 4 +- .../jena/sparql/lang/arq/ARQParserBase.java | 59 ++++++++++++ 6 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 86f89242fe4..7e26446c20f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -19,22 +19,30 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.lang.extra.LangParserBase; public class CDTLiteralParserBase extends LangParserBase { + @Override + protected Node createBNode( final String label, final int line, final int column ) { + // We need to cut away the leading '_:' of the given blank node label. + // This is necessary because the Turtle parser does the same. If we + // would not do it here for the blank node labels obtained from the + // lexical forms of CDT literals, then the label-to-bnode mapping of + // the shared parser state fails to map the same blank node identifiers + // inside and outside of CDT literals to the same blank node. + final String lbl = label.startsWith("_:") ? label.substring(2) : label; + return super.createBNode(lbl, line, column); + } + @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForList(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeList.type, 0L, 0L); } if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForMap(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeMap.type, 0L, 0L); } return super.createLiteral(lex, langTag, datatypeURI, line, column); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index fbaed36de26..b4297a8ce91 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -18,7 +18,6 @@ package org.apache.jena.cdt; -import java.io.InputStream; import java.io.IOException; import java.io.Reader; import java.io.StringReader; @@ -28,15 +27,19 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; -import org.apache.jena.util.FileUtils; public class ParserForCDTLiterals { public static List parseListLiteral( final String lex, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final List result = parseListLiteral(reader, recursive); + final List result = parseListLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -46,10 +49,15 @@ public static List parseListLiteral( final String lex, final boolean r } public static List parseListLiteral( final Reader reader, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final List list; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -68,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -83,8 +91,12 @@ else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof } public static Map parseMapLiteral( final String lex, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final Map result = parseMapLiteral(reader, recursive); + final Map result = parseMapLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -94,10 +106,15 @@ public static Map parseMapLiteral( final String lex, final bool } public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final Map map; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { @@ -116,11 +133,11 @@ public static Map parseMapLiteral( final Reader reader, final b if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java index 35c451d004c..f9e04c747c6 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java @@ -553,7 +553,7 @@ private ParserProfile makeParserProfile(Lang lang) { ? resolver : IRIxResolver.create().base(baseStr).resolve(resolve).allowRelative(allowRelative).build(); PrefixMap pmap = ( this.prefixMap != null ) ? this.prefixMap : PrefixMapFactory.create(); - ParserProfileStd parserFactory = new ParserProfileStd(factory, errorHandler, + ParserProfileStd parserFactory = new CDTAwareParserProfile(factory, errorHandler, parserResolver, pmap, context, checking$, strict); return parserFactory; diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java new file mode 100644 index 00000000000..3b904f091b6 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -0,0 +1,92 @@ +package org.apache.jena.riot.system; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.cdt.ParserForCDTLiterals; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.irix.IRIxResolver; +import org.apache.jena.sparql.util.Context; + +/** + * This is a {@link ParserProfile} that supports parsing of CDT literals + * that occur within the parsed file. The main point is to share the + * {@link FactoryRDF} object of this parser profile with the parser of + * these literals in order to get the same blank nodes for the same + * blank node identifiers both within and outside of the literals, as + * well as across multiple CDT literals that occur in the parsed file. + */ +public class CDTAwareParserProfile extends ParserProfileStd { + + public CDTAwareParserProfile( final FactoryRDF factory, + final ErrorHandler errorHandler, + final IRIxResolver resolver, + final PrefixMap prefixMap, + final Context context, + final boolean checking, + final boolean strictMode ) { + super(factory, errorHandler, resolver, prefixMap, context, checking, strictMode); + } + + @Override + public Node createTypedLiteral( final String lex, final RDFDatatype datatype, final long line, final long col ) { + if ( datatype.equals(CompositeDatatypeList.type) ) { + return createListLiteral(lex); + } + + if ( datatype.equals(CompositeDatatypeMap.type) ) { + return createMapLiteral(lex); + } + + return super.createTypedLiteral(lex, datatype, line, col); + } + + protected Node createListLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final List value; + try { + value = ParserForCDTLiterals.parseListLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForList(lex, value); + return NodeFactory.createLiteral(lit); + } + + protected Node createMapLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final Map value; + try { + value = ParserForCDTLiterals.parseMapLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForMap(lex, value); + return NodeFactory.createLiteral(lit); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java index b81691b2891..11e3568a3e3 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java @@ -224,7 +224,7 @@ public static ParserProfile dftProfile() { * Create a {@link ParserProfile} with default settings, and a specific error handler. */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, IRIxResolver.create(IRIs.getSystemBase()).build(), PrefixMapFactory.create(), @@ -238,7 +238,7 @@ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, IRIxResolver resolver, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, resolver, PrefixMapFactory.create(), diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java index 9ee67142138..ce3350e2f0e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java @@ -22,7 +22,17 @@ import org.apache.jena.atlas.json.io.JSONHandler ; import org.apache.jena.atlas.json.io.JSONHandlerBase ; import org.apache.jena.atlas.lib.NotImplemented ; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.system.ParserProfile; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.sparql.core.BasicPattern; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.lang.SPARQLParserBase ; @@ -89,4 +99,53 @@ protected ElementGroup createQueryPattern(Template t){ } return elg; } + + // CDT literals + protected ParserProfile parserProfileForCDTs = null; + + @Override + protected Node createLiteral(String lexicalForm, String langTag, String datatypeURI) { + // CDT literals need to be handled in a special way because their + // lexical forms may contain blank node identifiers, and the same + // blank node identifier in different CDT literals within the same + // query must be mapped to the same blank node. To this end, we are + // reusing the same ParserProfile for parsing all the CDT literals. + final RDFDatatype cdtDatatype; + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeList.type; + else if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeMap.type; + else + cdtDatatype = null; + + if ( cdtDatatype != null ) { + ensureParserProfileForCDTs(); + try { + return parserProfileForCDTs.createTypedLiteral(lexicalForm, cdtDatatype, 0L, 0L); + } + catch ( DatatypeFormatException ex ) { + return createIllformedLiteral(lexicalForm, cdtDatatype); + } + } + + return super.createLiteral(lexicalForm, langTag, datatypeURI); + } + + protected void ensureParserProfileForCDTs() { + if ( parserProfileForCDTs == null ) { + parserProfileForCDTs = RiotLib.dftProfile(); + } + } + + protected Node createIllformedLiteral(String lexicalForm, RDFDatatype cdtDatatype) { + final LiteralLabel lit; + if ( CompositeDatatypeList.type.equals(cdtDatatype) ) + lit = new LiteralLabelForList(lexicalForm, true); + else if ( CompositeDatatypeMap.type.equals(cdtDatatype) ) + lit = new LiteralLabelForMap(lexicalForm, true); + else + throw new IllegalArgumentException( cdtDatatype.toString() ); + + return NodeFactory.createLiteral(lit); + } } From 3ead259df3388fab130f711f7657083da60b2c28 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 19:52:47 +0300 Subject: [PATCH 167/323] adaption to the reorganized NodeValue class after rebasing --- .../apache/jena/sparql/expr/NodeValue.java | 452 ------------------ .../apache/jena/sparql/expr/NodeValueCmp.java | 38 ++ .../apache/jena/sparql/expr/ValueSpace.java | 11 + 3 files changed, 49 insertions(+), 452 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index edf95175591..8296676f73e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -32,8 +32,6 @@ import org.apache.jena.atlas.lib.DateTimeUtils ; import org.apache.jena.atlas.logging.Log ; -import org.apache.jena.cdt.CompositeDatatypeList ; -import org.apache.jena.cdt.CompositeDatatypeMap ; import org.apache.jena.datatypes.DatatypeFormatException ; import org.apache.jena.datatypes.RDFDatatype ; import org.apache.jena.datatypes.TypeMapper ; @@ -431,445 +429,13 @@ public boolean isTripleTerm() { return node.isNodeTriple() ; } -<<<<<<< HEAD public ValueSpace getValueSpace() { return classifyValueSpace(this); -======= - // ---------------------------------------------------------------- - // ---- sameValueAs - - // Disjoint value spaces : dateTime and dates are not comparable - // Every langtag implies another value space as well. - - /** Return true if the two NodeValues are known to be the same value - * return false if known to be different values, - * throw ExprEvalException otherwise - */ - public static boolean sameAs(NodeValue nv1, NodeValue nv2) - { - if ( nv1 == null || nv2 == null ) - throw new ARQInternalErrorException("Attempt to sameValueAs on a null") ; - - ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; - - // Special case - date/dateTime comparison is affected by timezones and may be - // indeterminate based on the value of the dateTime/date. - - switch (compType) - { - case VSPACE_NUM: - return XSDFuncOp.compareNumeric(nv1, nv2) == Expr.CMP_EQUAL ; - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_DAY : - { - int x = XSDFuncOp.compareDateTime(nv1, nv2) ; - if ( x == Expr.CMP_INDETERMINATE ) - throw new ExprNotComparableException("Indeterminate dateTime comparison") ; - return x == Expr.CMP_EQUAL ; - } - case VSPACE_DURATION: - { - int x = XSDFuncOp.compareDuration(nv1, nv2) ; - if ( x == Expr.CMP_INDETERMINATE ) - throw new ExprNotComparableException("Indeterminate duration comparison") ; - return x == Expr.CMP_EQUAL ; - } - - case VSPACE_STRING: return XSDFuncOp.compareString(nv1, nv2) == Expr.CMP_EQUAL ; - case VSPACE_BOOLEAN: return XSDFuncOp.compareBoolean(nv1, nv2) == Expr.CMP_EQUAL ; - - case VSPACE_TRIPLE_TERM: { - Triple t1 = nv1.getNode().getTriple(); - Triple t2 = nv2.getNode().getTriple(); - return nSameAs(t1.getSubject(), t2.getSubject()) - && nSameAs(t1.getPredicate(), t2.getPredicate()) - && nSameAs(t1.getObject(), t2.getObject()); - } - - case VSPACE_LANG: - case VSPACE_NODE: - // Two non-literals - return NodeFunctions.sameTerm(nv1.getNode(), nv2.getNode()) ; - - case VSPACE_UNKNOWN: - { - // One or two unknown value spaces, or one has a lang tag (but not both). - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - - if ( ! SystemARQ.ValueExtensions ) - // No value extensions => raw rdfTermEquals - return NodeFunctions.rdfTermEquals(node1, node2) ; - - // Some "value spaces" are know to be not equal (no overlap). - // Like one literal with a language tag, and one without can't be sameAs. - - if ( ! node1.isLiteral() || ! node2.isLiteral() ) - // Can't both be non-literals - that's VSPACE_NODE - // One or other not a literal => not sameAs - return false ; - - // Two literals at this point. - - if ( NodeFunctions.sameTerm(node1, node2) ) - return true ; - - if ( ! node1.getLiteralLanguage().equals("") || - ! node2.getLiteralLanguage().equals("") ) - // One had lang tag but weren't sameNode => not equals - return false ; - - raise(new ExprEvalException("Unknown equality test: "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("raise returned (sameValueAs)") ; - } - case VSPACE_SORTKEY: - return nv1.getSortKey().compareTo(nv2.getSortKey()) == 0 ; - - case VSPACE_DIFFERENT: - // Known to be incompatible. - if ( ! SystemARQ.ValueExtensions && ( nv1.isLiteral() && nv2.isLiteral() ) ) - raise(new ExprEvalException("Incompatible: "+nv1+" and "+nv2)) ; - return false ; - - case VSPACE_CDT_LIST: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - return CompositeDatatypeList.type.isEqual(lit1, lit2) ; - } - case VSPACE_CDT_MAP: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; - } - } - - throw new ARQInternalErrorException("sameValueAs failure "+nv1+" and "+nv2) ; ->>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } -<<<<<<< HEAD public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { ValueSpace c1 = classifyValueSpace(nv1); ValueSpace c2 = classifyValueSpace(nv2); -======= - /** Worker for sameAs. */ - private static boolean nSameAs(Node n1, Node n2) { - NodeValue nv1 = NodeValue.makeNode(n1); - NodeValue nv2 = NodeValue.makeNode(n2); - return sameAs(nv1, nv2); - } - - /** Return true if the two Nodes are known to be different, - * return false if the two Nodes are known to be the same, - * else throw ExprEvalException - */ - public static boolean notSameAs(Node n1, Node n2) - { - return notSameAs(NodeValue.makeNode(n1), NodeValue.makeNode(n2)) ; - } - - /** Return true if the two NodeValues are known to be different, - * return false if the two NodeValues are known to be the same, - * else throw ExprEvalException - */ - public static boolean notSameAs(NodeValue nv1, NodeValue nv2) - { - return ! sameAs(nv1, nv2) ; - } - - // ---------------------------------------------------------------- - // compare - - // Compare by value code is here - // NodeUtils.compareRDFTerms for syntactic comparison - - /** Compare by value if possible else compare by kind/type/lexical form - * Only use when you want an ordering regardless of form of NodeValue, - * for example in ORDER BY - * - * @param nv1 - * @param nv2 - * @return negative, 0, or positive for less than, equal, greater than. - */ - - public static int compareAlways(NodeValue nv1, NodeValue nv2) - { - try { - int x = compare(nv1, nv2, true) ; - // Same? - if ( x != Expr.CMP_EQUAL ) - return x ; - } catch (ExprNotComparableException ex) - { /* Drop through */ } - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - } - - /** Compare by value (and only value) if possible. - * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) - * @param nv1 - * @param nv2 - * @return Expr.CMP_INDETERMINATE(+2), Expr.CMP_LESS(-1), Expr.CMP_EQUAL(0) or Expr.CMP_GREATER(+1) - * @throws ExprNotComparableException - */ - public static int compare(NodeValue nv1, NodeValue nv2) - { - if ( nv1 == null || nv2 == null ) - //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; - throw new ARQInternalErrorException("Attempt to compare on null") ; - int x = compare(nv1, nv2, false) ; - return x ; - } - - // E_GreaterThan/E_LessThan/E_GreaterThanOrEqual/E_LessThanOrEqual - // ==> compare(nv1, nv2) => compare (nv1, nv2, false) - - // BindingComparator => compareAlways(nv1, nv2) => compare (nv1, nv2, true) - - // E_Equals calls NodeValue.sameAs() ==> - - // sortOrderingCompare means that the comparison should do something with normally unlike things, - // and split plain strings from xsd:strings. - - private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCompare) - { - if ( nv1 == null && nv2 == null ) - return Expr.CMP_EQUAL ; - - if ( nv1 == null ) - return Expr.CMP_LESS ; - if ( nv2 == null ) - return Expr.CMP_GREATER ; - - ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; - - // Special case - date/dateTime comparison is affected by timezones and may be - // indeterminate based on the value of the dateTime/date. - // Do this first, - - switch (compType) - { - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_DAY : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - { - int x = XSDFuncOp.compareDateTime(nv1, nv2) ; - if ( x != Expr.CMP_INDETERMINATE ) - return x ; - // Indeterminate => can't compare as strict values. - compType = ValueSpaceClassification.VSPACE_DIFFERENT ; - break ; - } - case VSPACE_DURATION: - { - int x = XSDFuncOp.compareDuration(nv1, nv2) ; - // Fix up - Java (Oracle java7 at least) returns "equals" for - // "P1Y"/"P365D" and "P1M"/"P28D", and others split over - // YearMonth/DayTime. - - // OR return Expr.CMP_INDETERMINATE ?? - if ( x == Expr.CMP_EQUAL ) { - Duration d1 = nv1.getDuration() ; - Duration d2 = nv2.getDuration() ; - if ( ( XSDFuncOp.isDayTime(d1) && XSDFuncOp.isYearMonth(d2) ) || - ( XSDFuncOp.isDayTime(d2) && XSDFuncOp.isYearMonth(d1) ) ) - x = Expr.CMP_INDETERMINATE ; - } - if ( x != Expr.CMP_INDETERMINATE ) - return x ; - compType = ValueSpaceClassification.VSPACE_DIFFERENT ; - break ; - } - - // No special cases. - case VSPACE_BOOLEAN : - case VSPACE_DIFFERENT : - case VSPACE_LANG : - case VSPACE_TRIPLE_TERM: - case VSPACE_NODE : - case VSPACE_NUM : - case VSPACE_STRING : - case VSPACE_SORTKEY : - case VSPACE_UNKNOWN : - // Drop through. - } - - switch (compType) - { - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_DAY : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - case VSPACE_DURATION: - throw new ARQInternalErrorException("Still seeing date/dateTime/time/duration compare type") ; - - case VSPACE_NUM: return XSDFuncOp.compareNumeric(nv1, nv2) ; - case VSPACE_STRING: - { - int cmp = XSDFuncOp.compareString(nv1, nv2) ; - - if ( ! sortOrderingCompare ) - return cmp ; - if ( cmp != Expr.CMP_EQUAL ) - return cmp ; - - // Equality. - if ( JenaRuntime.isRDF11 ) - // RDF 1.1 : No literals without datatype. - return cmp ; - - // RDF 1.0 - // Split plain literals and xsd:strings for sorting purposes. - // Same by string value. - String dt1 = nv1.asNode().getLiteralDatatypeURI() ; - String dt2 = nv2.asNode().getLiteralDatatypeURI() ; - if ( dt1 == null && dt2 != null ) - return Expr.CMP_LESS ; - if ( dt2 == null && dt1 != null ) - return Expr.CMP_GREATER ; - return Expr.CMP_EQUAL; // Both plain or both xsd:string. - } - case VSPACE_SORTKEY : - return nv1.getSortKey().compareTo(nv2.getSortKey()); - - case VSPACE_BOOLEAN: - return XSDFuncOp.compareBoolean(nv1, nv2) ; - - case VSPACE_LANG: - { - // Two literals, both with language tags. - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - int x = StrUtils.strCompareIgnoreCase(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; - - if ( x != Expr.CMP_EQUAL ) - { - // Different lang tags - if ( ! sortOrderingCompare ) - raise(new ExprNotComparableException("Can't compare (different languages) "+nv1+" and "+nv2)) ; - // Different lang tags - sorting - return x ; - } - - // same lang tag (case insensitive) - x = StrUtils.strCompare(node1.getLiteralLexicalForm(), node2.getLiteralLexicalForm()) ; - if ( x != Expr.CMP_EQUAL ) - return x ; - // Same lexical forms, same lang tag by value - // Try to split by syntactic lang tags. - x = StrUtils.strCompare(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; - // Maybe they are the same after all! - // Should be node.equals by now. - if ( x == Expr.CMP_EQUAL && ! NodeFunctions.sameTerm(node1, node2) ) - throw new ARQInternalErrorException("Looks like the same (lang tags) but not node equals") ; - return x ; - } - - case VSPACE_TRIPLE_TERM: { - Triple t1 = nv1.getNode().getTriple(); - Triple t2 = nv2.getNode().getTriple(); - int x = nCompare(t1.getSubject(), t2.getSubject(), sortOrderingCompare); - if ( x != CMP_EQUAL ) - return x; - x = nCompare(t1.getPredicate(), t2.getPredicate(), sortOrderingCompare); - if ( x != CMP_EQUAL ) - return x; - return nCompare(t1.getObject(), t2.getObject(), sortOrderingCompare); - } - - case VSPACE_NODE: - // Two non-literals don't compare except for sorting. - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - else - { - raise(new ExprNotComparableException("Can't compare (nodes) "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - - case VSPACE_CDT_LIST: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - try { - return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; - } - catch( final ExprNotComparableException e ) { - raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - } - - case VSPACE_CDT_MAP: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - try { - return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; - } - catch( final ExprNotComparableException e ) { - raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - } - - case VSPACE_UNKNOWN: - { - // One or two unknown value spaces. - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - // Two unknown literals can be equal. - if ( NodeFunctions.sameTerm(node1, node2) ) - return Expr.CMP_EQUAL ; - - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(node1, node2) ; - - raise(new ExprNotComparableException("Can't compare "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - - case VSPACE_DIFFERENT: - // Two literals, from different known value spaces - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - - raise(new ExprNotComparableException("Can't compare (incompatible value spaces)"+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - throw new ARQInternalErrorException("Compare failure "+nv1+" and "+nv2) ; - } - - /** Worker for compare. */ - private static int nCompare(Node n1, Node n2, boolean sortOrderingCompare) { - if ( n1.equals(n2) ) - return CMP_EQUAL; - NodeValue nv1 = NodeValue.makeNode(n1); - NodeValue nv2 = NodeValue.makeNode(n2); - return compare(nv1, nv2, sortOrderingCompare); - } - - public static ValueSpaceClassification classifyValueOp(NodeValue nv1, NodeValue nv2) - { - ValueSpaceClassification c1 = nv1.getValueSpace() ; - ValueSpaceClassification c2 = nv2.getValueSpace() ; ->>>>>>> ed504e0cc8 (support for comparison of cdt:List literals (i.e., < and >)) if ( c1 == c2 ) return c1 ; if ( c1 == VSPACE_UNKNOWN || c2 == VSPACE_UNKNOWN ) return VSPACE_UNKNOWN ; @@ -912,7 +478,6 @@ public static boolean notSameValueAs(NodeValue nv1, NodeValue nv2) { return NodeValueCmp.notSameValueAs(nv1, nv2); } -<<<<<<< HEAD // ---------------------------------------------------------------- // compare @@ -942,23 +507,6 @@ public static int compare(NodeValue nv1, NodeValue nv2) { public static int compareAlways(NodeValue nv1, NodeValue nv2) { //return NodeValueCompare.compareAlways(nv1, nv2); return NodeValueCmp.compareAlways(nv1, nv2); -======= - if ( nv.isLiteral() ) { - final String dtURI = nv.getDatatypeURI() ; - if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; - if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; - } - - if ( nv.isLiteral() ) { - final String dtURI = nv.getDatatypeURI() ; - if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; - if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; - } - - if ( NodeUtils.hasLang(nv.asNode()) ) - return VSPACE_LANG ; - return VSPACE_UNKNOWN ; ->>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } // ---------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index 23fc679298c..f57e7315715 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -28,8 +28,11 @@ import javax.xml.datatype.Duration; import org.apache.jena.atlas.lib.StrUtils; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.ARQInternalErrorException; import org.apache.jena.sparql.SystemARQ; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; @@ -144,6 +147,17 @@ public static boolean sameValueAs(NodeValue nv1, NodeValue nv2) { raise(new ExprEvalException("Incompatible: " + nv1 + " and " + nv2)); // Not same node. return false; + + case VSPACE_CDT_LIST : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeList.type.isEqual(lit1, lit2) ; + } + case VSPACE_CDT_MAP : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; + } } throw new ARQInternalErrorException("sameValueAs failure " + nv1 + " and " + nv2); @@ -349,6 +363,30 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { raise(new ExprNotComparableException("Can't compare valiables as values "+nv1+" and "+nv2)) ; } + case VSPACE_CDT_LIST : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + + case VSPACE_CDT_MAP : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN : { // One or two unknown value spaces. Node node1 = nv1.asNode() ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java index 4ac00d4dab0..8440eff14ca 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java @@ -18,6 +18,8 @@ package org.apache.jena.sparql.expr; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.sparql.SystemARQ; import org.apache.jena.sparql.util.NodeUtils; @@ -95,6 +97,9 @@ public enum ValueSpace { // VSPACE_G_MONTH(230), // VSPACE_G_DAY(240), + VSPACE_CDT_LIST(300), + VSPACE_CDT_MAP(301), + VSPACE_SORTKEY(900), VSPACE_QUOTED_TRIPLE(999), // RDF-star : Last recognized value space. @@ -188,6 +193,12 @@ public static ValueSpace valueSpace(NodeValue nv) { if ( nv.isSortKey() ) return VSPACE_SORTKEY ; + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( CompositeDatatypeList.uri.equals(dtURI) ) return VSPACE_CDT_LIST ; + if ( CompositeDatatypeMap.uri.equals(dtURI) ) return VSPACE_CDT_MAP ; + } + //if ( nv.isLiteral() ) return VSPACE_UNKNOWN ; if ( nv.isBlank() ) return VSPACE_BLANKNODE; From 02cddf4432f66a8890bb338a60cb4d934c63d9b3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 20:59:30 +0300 Subject: [PATCH 168/323] a few more fixes of issues that resulted from rebasing --- .../apache/jena/sparql/algebra/OpVars.java | 24 ++++--------------- .../jena/sparql/engine/main/OpExecutor.java | 12 +++------- .../jena/sparql/engine/main/VarFinder.java | 14 +---------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index b0796b30c5b..96c4b287bb7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -313,17 +313,9 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { - acc.add( opUnfold.getVar1() ) ; + acc.add( opUnfold.getVar1() ); if ( opUnfold.getVar2() != null ) { - acc.add( opUnfold.getVar2() ) ; - } - } - - @Override - public void visit(OpUnfold opUnfold) { - acc.add( opUnfold.getVar1() ) ; - if ( opUnfold.getVar2() != null ) { - acc.add( opUnfold.getVar2() ) ; + acc.add( opUnfold.getVar2() ); } } @@ -448,17 +440,9 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { - unknownAcc.add( opUnfold.getVar1() ) ; - if ( opUnfold.getVar2() != null ) { - unknownAcc.add( opUnfold.getVar2() ) ; - } - } - - @Override - public void visit(OpUnfold opUnfold) { - unknownAcc.add( opUnfold.getVar1() ) ; + unknownAcc.add( opUnfold.getVar1() ); if ( opUnfold.getVar2() != null ) { - unknownAcc.add( opUnfold.getVar2() ) ; + unknownAcc.add( opUnfold.getVar2() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 233ecb6bdc4..e7293e21ee3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -451,15 +451,9 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { } protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { - QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; - return qIter ; - } - - protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { - QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; - return qIter ; + QueryIterator qIter = exec(opUnfold.getSubOp(), input); + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt); + return qIter; } public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index 77d7f4448c9..46d0f6dbc85 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -385,19 +385,7 @@ public void visit(OpUnfold opUnfold) { if ( opUnfold.getVar2() != null ) defines.add( opUnfold.getVar2() ); - ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); - } - - @Override - public void visit(OpUnfold opUnfold) { - opUnfold.getSubOp().visit(this); - - defines.add( opUnfold.getVar1() ); - - if ( opUnfold.getVar2() != null ) - defines.add( opUnfold.getVar2() ); - - ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr() ); } @Override From 26e1d5e3e5c5adfc517981eeb15649527bb3b69d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 21:11:15 +0300 Subject: [PATCH 169/323] after rebasing, changes the CDT implementation to adapt to the fact that LiteralLabel is not anymore an interface but a *final* class --- .../java/org/apache/jena/cdt/CDTFactory.java | 7 +- .../jena/cdt/CompositeDatatypeList.java | 26 +-- .../apache/jena/cdt/CompositeDatatypeMap.java | 26 +-- .../apache/jena/cdt/LiteralLabelForCDTs.java | 203 ------------------ .../apache/jena/cdt/LiteralLabelForList.java | 74 ------- .../apache/jena/cdt/LiteralLabelForMap.java | 74 ------- .../apache/jena/cdt/ParserForCDTLiterals.java | 65 ++---- .../riot/system/CDTAwareParserProfile.java | 15 +- .../engine/iterator/QueryIterUnfold.java | 42 +--- .../library/cdt/CDTLiteralFunctionUtils.java | 8 +- .../function/library/cdt/ContainsFct.java | 2 +- .../jena/sparql/lang/arq/ARQParserBase.java | 17 +- 12 files changed, 41 insertions(+), 518 deletions(-) delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index 912f32a47cf..9af154467a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -23,7 +23,6 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; public class CDTFactory { @@ -41,14 +40,12 @@ public static CDTValue createValue( final Node n ) { } public static CDTValue createValue( final List l ) { - final LiteralLabel lit = new LiteralLabelForList(l); - final Node n = NodeFactory.createLiteral(lit); + final Node n = NodeFactory.createLiteralByValue(l, CompositeDatatypeList.type); return createValue(n); } public static CDTValue createValue( final Map m ) { - final LiteralLabel lit = new LiteralLabelForMap(m); - final Node n = NodeFactory.createLiteral(lit); + final Node n = NodeFactory.createLiteralByValue(m, CompositeDatatypeMap.type); return createValue(n); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index c250c09dbcf..4f4c7f4805b 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -59,16 +59,6 @@ public boolean isValidValue( final Object value ) { @Override public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForList objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForList makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForList ) { - return lit.isWellFormed(); - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - final String dtURI = lit.getDatatypeURI(); if ( dtURI == null || ! dtURI.equals(uri) ) { return false; @@ -86,10 +76,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { @Override public boolean isValid( final String lexicalForm ) { try { - // 'recursive' must be false here because the validity check - // is only for the literal with the given lexical form and not - // for any possible CDT literals inside it - ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + ParserForCDTLiterals.parseListLiteral(lexicalForm); return true; } catch ( final Exception ex ) { @@ -99,9 +86,8 @@ public boolean isValid( final String lexicalForm ) { @Override public List parse( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; try { - return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + return ParserForCDTLiterals.parseListLiteral(lexicalForm); } catch ( final Exception ex ) { throw new DatatypeFormatException(lexicalForm, type, ex); @@ -146,7 +132,7 @@ protected String unparseListElement( final CDTValue elmt ) { @Override public int getHashCode( final LiteralLabel lit ) { - return lit.getDefaultHashcode(); + return lit.hashCode(); } @Override @@ -269,7 +255,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, boolean sameValueTestResult = false; boolean sameValueTestFailed = false; try { - sameValueTestResult = NodeValue.sameAs(nv1, nv2); + sameValueTestResult = NodeValue.sameValueAs(nv1, nv2); } catch ( final Exception e ) { sameValueTestFailed = true; @@ -349,10 +335,6 @@ public static boolean isListLiteral( final LiteralLabel lit ) { * Assumes that the datatype of the given literal is cdt:List. */ public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - final Object value = lit.getValue(); if ( value == null || ! (value instanceof List) ) { throw new IllegalArgumentException( lit.toString() + " - " + value ); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 587e30f9805..aca38e3a862 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -65,16 +65,6 @@ public boolean isValidValue( final Object value ) { @Override public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForMap objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForMap makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForMap ) { - return lit.isWellFormed(); - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - final String dtURI = lit.getDatatypeURI(); if ( dtURI == null || ! dtURI.equals(uri) ) { return false; @@ -92,10 +82,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { @Override public boolean isValid( final String lexicalForm ) { try { - // 'recursive ' must be false here because the validity check - // is only for the literal with the given lexical form and not - // for any possible CDT literals inside it - ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + ParserForCDTLiterals.parseMapLiteral(lexicalForm); return true; } catch ( final Exception ex ) { @@ -105,9 +92,8 @@ public boolean isValid( final String lexicalForm ) { @Override public Map parse( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; try { - return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + return ParserForCDTLiterals.parseMapLiteral(lexicalForm); } catch ( final Exception ex ) { throw new DatatypeFormatException(lexicalForm, type, ex); @@ -156,7 +142,7 @@ protected void unparseMapEntry( final Map.Entry entry, final St @Override public int getHashCode( final LiteralLabel lit ) { - return lit.getDefaultHashcode(); + return lit.hashCode(); } @Override @@ -288,7 +274,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, boolean sameValueTestResult = false; boolean sameValueTestFailed = false; try { - sameValueTestResult = NodeValue.sameAs(nv1, nv2); + sameValueTestResult = NodeValue.sameValueAs(nv1, nv2); } catch ( final Exception e ) { sameValueTestFailed = true; @@ -368,10 +354,6 @@ public static boolean isMapLiteral( final LiteralLabel lit ) { * Assumes that the datatype of the given literal is cdt:Map. */ public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { - if ( lit instanceof LiteralLabelForMap ) { - return ( (LiteralLabelForMap) lit ).getValue(); - } - final Object value = lit.getValue(); if ( value == null || ! (value instanceof Map) ) { throw new IllegalArgumentException( lit.toString() + " - " + value ); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java deleted file mode 100644 index 48eb6c0f0fe..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.Objects; - -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.rdf.model.impl.Util; - -public abstract class LiteralLabelForCDTs implements LiteralLabel -{ - protected final int hash; - - private T valueForm; - private String lexicalForm; - private boolean lexicalFormTested; - - public LiteralLabelForCDTs( final T valueForm ) { - this.valueForm = valueForm; - this.lexicalForm = null; - - this.lexicalFormTested = true; - this.hash = valueForm.hashCode(); - } - - public LiteralLabelForCDTs( final String lexicalForm ) { - this.valueForm = null; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = false; - this.hash = lexicalForm.hashCode(); - } - - public LiteralLabelForCDTs( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - this.valueForm = null; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = true; - this.hash = lexicalForm.hashCode(); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForCDTs( final String lexicalForm, final T valueForm ) { - this.valueForm = valueForm; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = true; - this.hash = lexicalForm.hashCode(); - } - - @Override - public abstract CompositeDatatypeBase getDatatype(); - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - - @Override - public boolean isXML() { - return false; - } - - @Override - public boolean isWellFormed() { - if ( lexicalFormTested ) { - return valueForm != null; - } - - try { - getValue(); - } - catch ( final DatatypeFormatException ex ) { - return false; - } - - return true; - } - - @Override - public boolean isWellFormedRaw() { - return isWellFormed(); - } - - @Override - public String toString( final boolean quoting ) { - final StringBuilder b = new StringBuilder(); - - if ( quoting ) b.append('"'); - - String lex = getLexicalForm(); - lex = Util.replace(lex, "\"", "\\\""); - b.append(lex); - - if ( quoting ) b.append('"'); - - b.append("^^").append( getDatatypeURI() ); - - return b.toString(); - } - - @Override - public String toString() { - return toString(false); - } - - @Override - public String getLexicalForm() { - if ( lexicalForm == null ) { - lexicalForm = getDatatype().unparseValue(valueForm); - } - - return lexicalForm; - } - - protected boolean isLexicalFormSet() { - return lexicalForm != null; - } - - protected boolean isValueFormSet() { - return valueForm != null; - } - - @Override - public Object getIndexingValue() { - return getLexicalForm(); - } - - @Override - public String language() { - return ""; - } - - @Override - public T getValue() throws DatatypeFormatException { - if ( valueForm == null && ! lexicalFormTested ) { - lexicalFormTested = true; - - // The following function may fail with a DatatypeFormatException, - // in which case 'valueForm' will remain being 'null' but we won't - // try again at the next call of 'getValue()' because now we have - // set 'lexicalFormTested'. - - valueForm = getDatatype().parse(lexicalForm); - } - - return valueForm; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - return getDatatype().isEqual(this, other); - } - - @Override - public boolean equals( final Object other ) { - if ( this == other ) return true; - - if ( other == null || !(other instanceof LiteralLabel) ) return false; - - final LiteralLabel otherLiteral = (LiteralLabel) other; - - final String otherLang = otherLiteral.language(); - if ( otherLang != null && ! otherLang.isEmpty() ) return false; - - final String otherDTypeURI = otherLiteral.getDatatypeURI(); - if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; - - return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); - } - - @Override - public int getDefaultHashcode() { - return hash; - } - - @Override - public int hashCode() { - return hash; - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java deleted file mode 100644 index 60f76f02c71..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.List; - -import org.apache.jena.graph.impl.LiteralLabel; - -public class LiteralLabelForList extends LiteralLabelForCDTs> -{ - public LiteralLabelForList( final List valueForm ) { - super(valueForm); - } - - public LiteralLabelForList( final String lexicalForm ) { - super(lexicalForm); - } - - public LiteralLabelForList( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - super(lexicalForm, checkedAndIdentifiedAsIllformed); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForList( final String lexicalForm, final List valueForm ) { - super(lexicalForm , valueForm); - } - - @Override - public CompositeDatatypeList getDatatype() { - return CompositeDatatypeList.type; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - if ( other instanceof LiteralLabelForList ) { - final LiteralLabelForList otherListLiteral = (LiteralLabelForList) other; - // If the lexical forms of both are equivalent (and we - // actually have the lexical forms of both; i.e., we do - // not need to materialize them just for this check), then - // the values are trivially equivalent. - if ( isLexicalFormSet() - && otherListLiteral.isLexicalFormSet() - && getLexicalForm().equals(otherListLiteral.getLexicalForm()) ) { - return true; - } - - // Otherwise, we compare the actual lists that they represent. - return getValue().equals( otherListLiteral.getValue() ); - } - - return super.sameValueAs(other); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java deleted file mode 100644 index c3a18961075..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.Map; - -import org.apache.jena.graph.impl.LiteralLabel; - -public class LiteralLabelForMap extends LiteralLabelForCDTs> -{ - public LiteralLabelForMap( final Map valueForm ) { - super(valueForm); - } - - public LiteralLabelForMap( final String lexicalForm ) { - super(lexicalForm); - } - - public LiteralLabelForMap( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - super(lexicalForm, checkedAndIdentifiedAsIllformed ); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForMap( final String lexicalForm, final Map valueForm ) { - super(lexicalForm, valueForm); - } - - @Override - public CompositeDatatypeMap getDatatype() { - return CompositeDatatypeMap.type; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - if ( other instanceof LiteralLabelForMap ) { - final LiteralLabelForMap otherMapLiteral = (LiteralLabelForMap) other; - // If the lexical forms of both are equivalent (and we - // actually have the lexical forms of both; i.e., we do - // not need to materialize them just for this check), then - // the values are trivially equivalent. - if ( isLexicalFormSet() - && otherMapLiteral.isLexicalFormSet() - && getLexicalForm().equals(otherMapLiteral.getLexicalForm()) ) { - return true; - } - - // Otherwise, we compare the actual lists that they represent. - return getValue().equals( otherMapLiteral.getValue() ); - } - - return super.sameValueAs(other); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index b4297a8ce91..28b376f7f44 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -26,20 +26,19 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; -import org.apache.jena.graph.Node; +import org.apache.jena.cdt.parser.TokenMgrError; import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; -import org.apache.jena.ttl.turtle.parser.TokenMgrError; public class ParserForCDTLiterals { - public static List parseListLiteral( final String lex, final boolean recursive ) { - return parseListLiteral( RiotLib.dftProfile(), lex, recursive ); + public static List parseListLiteral( final String lex ) { + return parseListLiteral( RiotLib.dftProfile(), lex ); } - public static List parseListLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { + public static List parseListLiteral( final ParserProfile pp, final String lex ) { final Reader reader = new StringReader(lex); - final List result = parseListLiteral(pp, reader, recursive); + final List result = parseListLiteral(pp, reader); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -48,11 +47,11 @@ public static List parseListLiteral( final ParserProfile pp, final Str return result; } - public static List parseListLiteral( final Reader reader, final boolean recursive ) { - return parseListLiteral( RiotLib.dftProfile(), reader, recursive ); + public static List parseListLiteral( final Reader reader ) { + return parseListLiteral( RiotLib.dftProfile(), reader ); } - public static List parseListLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + public static List parseListLiteral( final ParserProfile pp, final Reader reader ) { final CDTLiteralParser parser = new CDTLiteralParser(reader); parser.setProfile(pp); @@ -70,33 +69,16 @@ public static List parseListLiteral( final ParserProfile pp, final Rea throw new CDTLiteralParseException( th.getMessage(), th ); } - if ( recursive && ! list.isEmpty() ) { - for ( int i = 0; i < list.size(); i++ ) { - final CDTValue v = list.get(i); - if ( v.isNode() ) { - final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); - list.set( i, CDTFactory.createValue(subList) ); - } - else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); - list.set( i, CDTFactory.createValue(subMap) ); - } - } - } - } - return list; } - public static Map parseMapLiteral( final String lex, final boolean recursive ) { - return parseMapLiteral( RiotLib.dftProfile(), lex, recursive ); + public static Map parseMapLiteral( final String lex ) { + return parseMapLiteral( RiotLib.dftProfile(), lex ); } - public static Map parseMapLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { + public static Map parseMapLiteral( final ParserProfile pp, final String lex ) { final Reader reader = new StringReader(lex); - final Map result = parseMapLiteral(pp, reader, recursive); + final Map result = parseMapLiteral(pp, reader); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -105,11 +87,11 @@ public static Map parseMapLiteral( final ParserProfile pp, fina return result; } - public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { - return parseMapLiteral( RiotLib.dftProfile(), reader, recursive ); + public static Map parseMapLiteral( final Reader reader ) { + return parseMapLiteral( RiotLib.dftProfile(), reader ); } - public static Map parseMapLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + public static Map parseMapLiteral( final ParserProfile pp, final Reader reader ) { final CDTLiteralParser parser = new CDTLiteralParser(reader); parser.setProfile(pp); @@ -127,23 +109,6 @@ public static Map parseMapLiteral( final ParserProfile pp, fina throw new CDTLiteralParseException( th.getMessage(), th ); } - if ( recursive && ! map.isEmpty() ) { - for ( final CDTKey key : map.keySet() ) { - final CDTValue v = map.get(key); - if ( v.isNode() ) { - final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); - map.put( key, CDTFactory.createValue(subList) ); - } - else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); - map.put( key, CDTFactory.createValue(subMap) ); - } - } - } - } - return map; } diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java index 3b904f091b6..5cc008edb7f 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -7,14 +7,11 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.cdt.ParserForCDTLiterals; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.irix.IRIxResolver; import org.apache.jena.sparql.util.Context; @@ -57,17 +54,15 @@ protected Node createListLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. - final boolean recursive = false; final List value; try { - value = ParserForCDTLiterals.parseListLiteral(this, lex, recursive); + value = ParserForCDTLiterals.parseListLiteral(this, lex); } catch ( final Exception ex ) { throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); } - final LiteralLabel lit = new LiteralLabelForList(lex, value); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(value, CompositeDatatypeList.type); } protected Node createMapLiteral( final String lex ) { @@ -76,17 +71,15 @@ protected Node createMapLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. - final boolean recursive = false; final Map value; try { - value = ParserForCDTLiterals.parseMapLiteral(this, lex, recursive); + value = ParserForCDTLiterals.parseMapLiteral(this, lex); } catch ( final Exception ex ) { throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); } - final LiteralLabel lit = new LiteralLabelForMap(lex, value); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(value, CompositeDatatypeMap.type); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 2b518efc68c..57a70d5a0c8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,7 +19,6 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -28,8 +27,6 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; @@ -158,27 +155,12 @@ protected Binding moveToNextBinding() { } if ( nextElmt.isNode() ) { - final Node n = nextElmt.asNode(); - - final Node value; - if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { - final List l = CompositeDatatypeList.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForList(l); - value = NodeFactory.createLiteral(lit); - } - else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { - final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForMap(m); - value = NodeFactory.createLiteral(lit); - } - else { - value = n; - } + final Node elmtNode = nextElmt.asNode(); if ( var2 != null ) - return BindingFactory.binding(inputBinding, var1, value, var2, indexNode); + return BindingFactory.binding(inputBinding, var1, elmtNode, var2, indexNode); else - return BindingFactory.binding(inputBinding, var1, value); + return BindingFactory.binding(inputBinding, var1, elmtNode); } throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); @@ -214,23 +196,7 @@ protected Binding moveToNextBinding() { } if ( value.isNode() ) { - final Node n = value.asNode(); - - final Node valueNode; - if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { - final List l = CompositeDatatypeList.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForList(l); - valueNode = NodeFactory.createLiteral(lit); - } - else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { - final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForMap(m); - valueNode = NodeFactory.createLiteral(lit); - } - else { - valueNode = n; - } - + final Node valueNode = value.asNode(); return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 37ff826a846..d7d5f146744 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -25,8 +25,6 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; @@ -125,8 +123,7 @@ public static final Map checkAndGetMap( final NodeValue nv ) th * given list. */ public static final Node createNode( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(list, CompositeDatatypeList.type); } /** @@ -134,8 +131,7 @@ public static final Node createNode( final List list ) { * given map. */ public static final Node createNode( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(map, CompositeDatatypeMap.type); } /** diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index 462398e98f8..90aa9217a8c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -40,7 +40,7 @@ protected boolean containsNode( final List list, final NodeValue nv ) for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv, nv) ) { + if ( NodeValue.sameValueAs(vv, nv) ) { return true; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java index ce3350e2f0e..c25e12a4f7e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java @@ -24,13 +24,10 @@ import org.apache.jena.atlas.lib.NotImplemented ; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; import org.apache.jena.sparql.core.BasicPattern; @@ -138,14 +135,10 @@ protected void ensureParserProfileForCDTs() { } protected Node createIllformedLiteral(String lexicalForm, RDFDatatype cdtDatatype) { - final LiteralLabel lit; - if ( CompositeDatatypeList.type.equals(cdtDatatype) ) - lit = new LiteralLabelForList(lexicalForm, true); - else if ( CompositeDatatypeMap.type.equals(cdtDatatype) ) - lit = new LiteralLabelForMap(lexicalForm, true); - else - throw new IllegalArgumentException( cdtDatatype.toString() ); - - return NodeFactory.createLiteral(lit); + // Attention: This implementation is inefficient because, internally, + // the following function checks whether the given lexical form is + // well formed but, in the current case, we already know that it is + // not well formed. + return NodeFactory.createLiteral(lexicalForm, cdtDatatype); } } From a072d92f6dee7e9f9477f2dda0568761bb1df468 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 22:20:32 +0300 Subject: [PATCH 170/323] further adaption to the reorganized NodeValue class after rebasing (ORDER BY of CDT literals didn't work correctly anymore) --- .../org/apache/jena/sparql/expr/NodeValueCmp.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index f57e7315715..ba2e1477d5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -371,7 +371,6 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { } catch( final ExprNotComparableException e ) { raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; } } @@ -465,6 +464,18 @@ public static int compareWithOrdering(NodeValue nv1, NodeValue nv2) { return NodeCmp$compareRDFTerms(nv1, nv2); } + if ( vs1 == ValueSpace.VSPACE_CDT_LIST && vs2 == ValueSpace.VSPACE_CDT_LIST ) { + LiteralLabel l1 = nv1.asNode().getLiteral(); + LiteralLabel l2 = nv2.asNode().getLiteral(); + return CompositeDatatypeList.compare(l1, l2, true); + } + + if ( vs1 == ValueSpace.VSPACE_CDT_MAP && vs2 == ValueSpace.VSPACE_CDT_MAP ) { + LiteralLabel l1 = nv1.asNode().getLiteral(); + LiteralLabel l2 = nv2.asNode().getLiteral(); + return CompositeDatatypeMap.compare(l1, l2, true); + } + // XXX G and Date cases. int vsOrder = ValueSpace.comparisonOrder(vs1, vs2); From b6dfaf8313f91c7b6ca400c9cdbd7c6bbb1ab396 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 22:47:55 +0300 Subject: [PATCH 171/323] a bit more cleaning up after rebasing --- .../apache/jena/sparql/algebra/AlgebraGenerator.java | 10 ++-------- .../java/org/apache/jena/sparql/expr/NodeValueCmp.java | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index fdffca3fe87..016a0240c9d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -324,14 +324,8 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { if ( elt instanceof ElementNotExists elt2 ) return compileElementNotExists(current, elt2); - if ( elt instanceof ElementUnfold ) { - ElementUnfold unfold = (ElementUnfold)elt; - return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); - } - - if ( elt instanceof ElementUnfold ) { - ElementUnfold unfold = (ElementUnfold)elt; - return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + if ( elt instanceof ElementUnfold eltUnfold ) { + return new OpUnfold(current, eltUnfold.getExpr(), eltUnfold.getVar1(), eltUnfold.getVar2()); } // Filters were collected together by prepareGroup diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index ba2e1477d5c..0ed94b9f530 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -382,7 +382,6 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { } catch( final ExprNotComparableException e ) { raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; } } From eab675fe81554a114f80c79e0676d659b8e64121 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 28 May 2024 17:53:18 +0300 Subject: [PATCH 172/323] corrects the handling of = and < for CDT literals after rebasing, also related to https://github.com/awslabs/SPARQL-CDTs/pull/5 --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 7 ++++++- .../java/org/apache/jena/cdt/CompositeDatatypeMap.java | 7 ++++++- .../java/org/apache/jena/sparql/expr/NodeValueCmp.java | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 4f4c7f4805b..c377b607d4a 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -163,7 +163,12 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Node n2 = v2.asNode(); if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); + // If at least one of the two elements is a blank node, + // throw an error unless both elements are *the same* + // blank node. + if ( ! n1.equals(n2) ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } } if ( ! n1.sameValueAs(n2) ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index aca38e3a862..d3070127f98 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -171,7 +171,12 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { final Node n2 = v2.asNode(); if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + // If at least one of the two elements is a blank node, + // throw an error unless both elements are *the same* + // blank node. + if ( ! n1.equals(n2) ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } } if ( ! n1.sameValueAs(n2) ) return false; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index 0ed94b9f530..280f37506d2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -218,14 +218,17 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { if ( nv2 == null ) return CMP_GREATER; - if ( nv1.hasNode() && nv2.hasNode() ) { + ValueSpace compType = classifyValueOp(nv1, nv2) ; + + if ( nv1.hasNode() + && nv2.hasNode() + && compType != ValueSpace.VSPACE_CDT_LIST + && compType != ValueSpace.VSPACE_CDT_MAP ) { // Fast path - same RDF term => CMP_EQUAL if ( nv1.getNode().equals(nv2.getNode()) ) return CMP_EQUAL; } - ValueSpace compType = classifyValueOp(nv1, nv2) ; - // Special case - date/dateTime comparison is affected by timezones and may be // indeterminate based on the value of the dateTime/date. // Do this first, so that indeterminate can drop through to a general ordering. From 6de9f470bdf29708085f42452a8e6b01752190fa Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 4 Jun 2024 14:59:29 +0200 Subject: [PATCH 173/323] adds license header to CDTAwareParserProfile --- .../riot/system/CDTAwareParserProfile.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java index 5cc008edb7f..802362236c2 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.riot.system; import java.util.List; From 6b63dd7c86e35cc9fd36fcf7aa6018ea3f8a1df3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 20:45:50 +0200 Subject: [PATCH 174/323] initial addition of Unfold to the ARQ grammar, including all code changes necessary for the query engine to handle this new operator (but without invoking any actual functionality if it is present in a query) --- jena-arq/Grammar/arq.jj | 14 + jena-arq/Grammar/main.jj | 61 + .../jena/sparql/algebra/AlgebraGenerator.java | 5 + .../apache/jena/sparql/algebra/OpAsQuery.java | 9 + .../apache/jena/sparql/algebra/OpVars.java | 21 + .../apache/jena/sparql/algebra/OpVisitor.java | 1 + .../jena/sparql/algebra/OpVisitorBase.java | 2 + .../jena/sparql/algebra/OpVisitorByType.java | 4 + .../apache/jena/sparql/algebra/Transform.java | 1 + .../jena/sparql/algebra/TransformCopy.java | 2 + .../jena/sparql/algebra/TransformSingle.java | 2 + .../jena/sparql/algebra/TransformWrapper.java | 2 + .../jena/sparql/algebra/op/OpUnfold.java | 102 + .../optimize/VariableUsageVisitor.java | 12 + .../algebra/walker/ApplyTransformVisitor.java | 5 + .../algebra/walker/OpVisitorByType.java | 5 + .../walker/OpVisitorByTypeAndExpr.java | 6 + .../sparql/algebra/walker/WalkerVisitor.java | 9 + .../engine/iterator/QueryIterUnfold.java | 44 + .../sparql/engine/main/ExecutionDispatch.java | 7 + .../jena/sparql/engine/main/OpExecutor.java | 6 + .../jena/sparql/engine/main/VarFinder.java | 14 +- .../jena/sparql/engine/ref/Evaluator.java | 2 + .../sparql/engine/ref/EvaluatorDispatch.java | 7 + .../sparql/engine/ref/EvaluatorSimple.java | 8 + .../jena/sparql/lang/arq/ARQParser.java | 5775 ++++++++--------- .../sparql/lang/arq/ARQParserConstants.java | 374 +- .../lang/arq/ARQParserTokenManager.java | 2514 ++++--- .../jena/sparql/lang/arq/ParseException.java | 48 +- .../sparql/lang/arq/SimpleCharStream.java | 21 +- .../apache/jena/sparql/lang/arq/Token.java | 7 +- .../jena/sparql/lang/arq/TokenMgrError.java | 36 +- .../java/org/apache/jena/sparql/sse/Tags.java | 1 + .../jena/sparql/sse/writers/WriterOp.java | 19 + .../jena/sparql/syntax/ElementUnfold.java | 86 + .../querybuilder/rewriters/OpRewriter.java | 8 +- .../query/rewriter/OpRewriter.java | 13 + 37 files changed, 4810 insertions(+), 4443 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 2432ac5085b..36120747f0c 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -634,6 +634,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() ) { return el ; } } @@ -758,6 +760,17 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} Element MinusGraphPattern() : { Element el ; } { @@ -1790,6 +1803,7 @@ TOKEN [IGNORE_CASE] : | < SUBJECT: "SUBJECT" > | < PREDICATE: "PREDICATE" > | < OBJECT: "OBJECT" > +| < UNFOLD: "unfold" > | < EXISTS: "exists" > | < NOT: "not" > | < AS: "as" > diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 757e0055e5f..9d60ec0173a 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -480,6 +480,27 @@ void OrderCondition() : getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( // These are for clarity in the HTML + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() //{ expr = asExpr(v) ; } + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} + void LimitOffsetClauses() : { } { // SPARQL does not care about the order here. @@ -906,6 +927,8 @@ Element GraphPatternNotTriples() : { Element el = null ; } el = ExistsElt() | el = NotExistsElt() + | + el = Unfold() #endif ) { return el ; } @@ -1051,6 +1074,18 @@ Element NotExistsElt() : { Element el ; } el = GroupGraphPattern() { return new ElementNotExists(el) ; } } + +Element Unfold() : { Var v1 ; Var v2 = null ; Expr expr ; } +{ + + + expr = Expression() + + v1 = Var() + ( v2 = Var() { ; } )? + + { return new ElementUnfold(expr, v1, v2) ; } +} #endif Element MinusGraphPattern() : { Element el ; } @@ -2234,6 +2269,27 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { java.util.List scs = null ; + SortCondition sc = null ; } + + ( { distinct = true ; } )? + expr = Expression() + ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? + + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } + /* Explicit syntax (aggregate even if not registered) */ | t = { String iri ; } @@ -2499,6 +2555,8 @@ TOKEN [IGNORE_CASE] : #ifdef ARQ | < LET: "LET" > | < LATERAL: "LATERAL" > + +| < UNFOLD: "unfold" > #endif | < TRIPLE: "TRIPLE" > @@ -2529,6 +2587,9 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +#ifdef ARQ +| < FOLD: "fold" > +#endif | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index 5174505d0e5..22383d9a7af 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -324,6 +324,11 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { if ( elt instanceof ElementNotExists elt2 ) return compileElementNotExists(current, elt2); + if ( elt instanceof ElementUnfold ) { + ElementUnfold unfold = (ElementUnfold)elt; + return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + } + // Filters were collected together by prepareGroup // This only handles filters left in place by some magic. if ( elt instanceof ElementFilter ef) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java index 1c74499dbdf..4b23ab44aa7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java @@ -828,6 +828,15 @@ public void visit(OpExtend opExtend) { }) ; } + @Override + public void visit(OpUnfold opUnfold) { + Element e = asElement(opUnfold.getSubOp()) ; + // If (unfold ... (table unit)), and first in group, don't add the empty group. + insertIntoGroup(currentGroup(), e) ; + Element elmtUnfold = new ElementUnfold( opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2() ) ; + currentGroup().addElement(elmtUnfold) ; + } + @Override public void visit(OpList opList) { opList.getSubOp().visit(this) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index dcdde83de9a..5ecb30b5095 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -311,6 +311,14 @@ public void visit(OpExtend opExtend) { acc.addAll(opExtend.getVarExprList().getVars()); } + @Override + public void visit(OpUnfold opUnfold) { + acc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + acc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { PropFuncArg.addVars(acc, opPropFunc.getSubjectArgs()); @@ -430,6 +438,14 @@ public void visit(OpExtend opExtend) { unknownAcc.addAll(opExtend.getVarExprList().getVars()); } + @Override + public void visit(OpUnfold opUnfold) { + unknownAcc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + unknownAcc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { addvars(subjAcc, opPropFunc.getSubjectArgs()); @@ -496,6 +512,11 @@ public void visit(OpAssign opAssign) { visitExtendAssign(opAssign); } + @Override + public void visit(OpUnfold opUnfold) { + ExprVars.varsMentioned( acc, opUnfold.getExpr() ); + } + // The expression side of (extend) and (assign) private void visitExtendAssign(OpExtendAssign op) { op.getVarExprList().forEachExpr((v, e) -> ExprVars.varsMentioned(acc, e)); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java index 15a13d5fd44..a7a74c79195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitor.java @@ -42,6 +42,7 @@ public interface OpVisitor public void visit(OpLabel opLabel) ; public void visit(OpAssign opAssign) ; public void visit(OpExtend opExtend) ; + public void visit(OpUnfold opUnfold) ; // Op2 public void visit(OpJoin opJoin) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java index 8eccc40e9d2..89cbe7692de 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorBase.java @@ -80,6 +80,8 @@ public OpVisitorBase() {} @Override public void visit(OpExtend opExtend) {} + @Override public void visit(OpUnfold opUnfold) {} + @Override public void visit(OpList opList) {} @Override public void visit(OpOrder opOrder) {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java index b331f817a5f..fd8f0b4b8b6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVisitorByType.java @@ -150,6 +150,10 @@ public void visit(OpAssign opAssign) public void visit(OpExtend opExtend) { visit1(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) + { visit1(opUnfold) ; } + @Override public void visit(OpList opList) { visitModifer(opList) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java index 98fbc1b872a..bdebe52b986 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Transform.java @@ -44,6 +44,7 @@ public interface Transform public Op transform(OpLabel opLabel, Op subOp) ; public Op transform(OpAssign opAssign, Op subOp) ; public Op transform(OpExtend opExtend, Op subOp) ; + public Op transform(OpUnfold opUnfold, Op subOp) ; // Op2 public Op transform(OpJoin opJoin, Op left, Op right) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java index 32ecd34b178..6c21d89be85 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformCopy.java @@ -68,6 +68,8 @@ public class TransformCopy implements Transform public Op transform(OpAssign opAssign, Op subOp) { return xform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return xform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return xform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return xform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java index 5515cb85e75..69a525bd769 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformSingle.java @@ -64,6 +64,8 @@ public class TransformSingle implements Transform public Op transform(OpAssign opAssign, Op subOp) { return opAssign ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return opExtend ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return opUnfold ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return opJoin ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java index 30bff50c707..0be481886f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformWrapper.java @@ -66,6 +66,8 @@ public TransformWrapper(Transform transform) public Op transform(OpAssign opAssign, Op subOp) { return transform.transform(opAssign, subOp) ; } @Override public Op transform(OpExtend opExtend, Op subOp) { return transform.transform(opExtend, subOp) ; } + @Override + public Op transform(OpUnfold opUnfold, Op subOp) { return transform.transform(opUnfold, subOp) ; } @Override public Op transform(OpJoin opJoin, Op left, Op right) { return transform.transform(opJoin, left, right) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java new file mode 100644 index 00000000000..55a193e1332 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/op/OpUnfold.java @@ -0,0 +1,102 @@ +/* + * 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 org.apache.jena.sparql.algebra.op; + +import java.util.Objects; + +import org.apache.jena.sparql.algebra.Op; +import org.apache.jena.sparql.algebra.OpVisitor; +import org.apache.jena.sparql.algebra.Transform; +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.sse.Tags; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class OpUnfold extends Op1 +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public OpUnfold(Op subOp, Expr expr, Var var1, Var var2) { + super(subOp) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public String getName() { + return Tags.tagUnfold ; + } + + @Override + public void visit(OpVisitor opVisitor) { + opVisitor.visit(this) ; + } + + @Override + public Op1 copy(Op subOp) { + OpUnfold op = new OpUnfold(subOp, expr, var1, var2) ; + return op ; + } + + @Override + public boolean equalTo(Op other, NodeIsomorphismMap labelMap) { + if ( !(other instanceof OpUnfold) ) + return false ; + OpUnfold unfold = (OpUnfold)other ; + + if ( !Objects.equals(var1, unfold.var1) ) + return false ; + if ( !Objects.equals(var2, unfold.var2) ) + return false ; + if ( !Objects.equals(expr, unfold.expr) ) + return false ; + return getSubOp().equalTo(unfold.getSubOp(), labelMap) ; + } + + @Override + public Op apply(Transform transform, Op subOp) { + return transform.transform(this, subOp) ; + } + + @Override + public int hashCode() { + if ( var2 == null ) + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ getSubOp().hashCode() ; + else + return getName().hashCode() ^ expr.hashCode() ^ var1.hashCode() ^ var2.hashCode() ^ getSubOp().hashCode() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java index 9cc3bb14139..747ee97bf5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/VariableUsageVisitor.java @@ -41,6 +41,7 @@ import org.apache.jena.sparql.algebra.op.OpQuadPattern; import org.apache.jena.sparql.algebra.op.OpTable; import org.apache.jena.sparql.algebra.op.OpTopN; +import org.apache.jena.sparql.algebra.op.OpUnfold; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.Vars; @@ -169,6 +170,17 @@ public void visit(OpExtend opExtend) { action(vars); } + @Override + public void visit(OpUnfold opUnfold) { + Collection vars = new ArrayList<>(); + ExprVars.varsMentioned(vars, opUnfold.getExpr()); + vars.add( opUnfold.getVar1() ); + if ( opUnfold.getVar2() != null ) { + vars.add( opUnfold.getVar2() ); + } + action(vars); + } + @Override public void visit(OpOrder opOrder) { Collection vars = new ArrayList<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index 19543334803..e6028996b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -147,6 +147,11 @@ public void visit(OpExtend opExtend) { visit1(opExtend2) ; } + @Override + public void visit(OpUnfold opUnfold) { + visit1(opUnfold) ; + } + // Special test cases for collectors. // Careful about order. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java index 3f373291f0f..2ec2fbb8020 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByType.java @@ -188,6 +188,11 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java index 5387afab57b..bf3d3589646 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/OpVisitorByTypeAndExpr.java @@ -215,6 +215,12 @@ public default void visit(OpExtend opExtend) { visit1(opExtend); } + @Override + public default void visit(OpUnfold opUnfold) { + visitExpr( new ExprList(opUnfold.getExpr()) ) ; + visit1(opUnfold); + } + @Override public default void visit(OpList opList) { visitModifer(opList); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java index 6243225afc5..d1fa6e7e9eb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/WalkerVisitor.java @@ -215,6 +215,15 @@ public void visit(OpExtend opExtend) { after(opExtend) ; } + @Override + public void visit(OpUnfold opUnfold) { + before(opUnfold) ; + ExprList varExpr = new ExprList( opUnfold.getExpr() ) ; + visitExpr(varExpr); + visit1$(opUnfold) ; + after(opUnfold) ; + } + // Transforming to quads needs the graph node handled before doing the sub-algebra ops // so it has to be done as before/after by the Walker. By the time visit(OpGraph) is called, // the sub-tree has already been visited. diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java new file mode 100644 index 00000000000..d052da6e075 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -0,0 +1,44 @@ +/* + * 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 org.apache.jena.sparql.engine.iterator; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.QueryIterator; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; + +public class QueryIterUnfold extends QueryIteratorWrapper +{ + protected final Expr expr ; + protected final Var var1 ; + protected final Var var2 ; + + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { + super(qIter) ; + this.expr = expr ; + this.var1 = var1 ; + this.var2 = var2 ; + } + + @Override + protected Binding moveToNextBinding() { +System.out.println("QueryIterUnfold"); + return super.moveToNextBinding() ; + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java index 923836a7bcb..96974249939 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/ExecutionDispatch.java @@ -272,6 +272,13 @@ public void visit(OpExtend opExtend) { push(qIter); } + @Override + public void visit(OpUnfold opUnfold) { + QueryIterator input = pop(); + QueryIterator qIter = opExecutor.execute(opUnfold, input); + push(qIter); + } + @Override public void visit(OpSlice opSlice) { QueryIterator input = pop(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 93b12bfed61..8dbc562c921 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -450,6 +450,12 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { return qIter; } + protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { + QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + return qIter ; + } + public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { return QueryIterRoot.create(execCxt); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index 882fa9b93dd..a1a5408cdb3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -122,7 +122,7 @@ static VarUsageVisitor apply(Op op) { Set filterMentions = null ; // Used in a filter, before defined Set filterMentionsOnly = null ; - // Used in assign or extend expression + // Used in assign or extend or unfold expression Set assignMentions = null ; VarUsageVisitor() { @@ -376,6 +376,18 @@ private boolean isLikelyToBeDefined(Expr expr) { return result; } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + + defines.add( opUnfold.getVar1() ); + + if ( opUnfold.getVar2() != null ) + defines.add( opUnfold.getVar2() ); + + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + } + @Override public void visit(OpProject opProject) { List vars = opProject.getVars(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java index 5299b5c1f7e..201ce5a8922 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/Evaluator.java @@ -29,6 +29,7 @@ import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.core.VarExprList; import org.apache.jena.sparql.engine.ExecutionContext; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.pfunction.PropFuncArg; @@ -46,6 +47,7 @@ public interface Evaluator public Table assign(Table table, VarExprList exprs); public Table extend(Table table, VarExprList exprs); + public Table unfold(Table table, Expr expr, Var var1, Var var2); public Table join(Table tableLeft, Table tableRight); public Table leftJoin(Table tableLeft, Table tableRight, ExprList expr); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java index f1b1de27902..b459ce606ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorDispatch.java @@ -309,6 +309,13 @@ public void visit(OpExtend opExtend) { push(table); } + @Override + public void visit(OpUnfold opUnfold) { + Table table = eval(opUnfold.getSubOp()); + table = evaluator.unfold(table, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()); + push(table); + } + @Override public void visit(OpGroup opGroup) { Table table = eval(opGroup.getSubOp()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index c37b84a7cf0..894dee013c0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -36,6 +36,7 @@ import org.apache.jena.sparql.engine.binding.BindingBuilder; import org.apache.jena.sparql.engine.iterator.*; import org.apache.jena.sparql.engine.main.QC; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprAggregator; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.pfunction.PropFuncArg; @@ -250,6 +251,13 @@ public Table extend(Table table, VarExprList exprs) { return new TableN(qIter); } + @Override + public Table unfold(Table table, Expr expr, Var var1, Var var2) { + QueryIterator qIter = table.iterator(getExecContext()); + qIter = new QueryIterUnfold(qIter, expr, var1, var2); + return new TableN(qIter); + } + @Override public Table unit() { return TableFactory.createUnit(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 30e9f835b66..9b6244421d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -1,4 +1,3 @@ -/* ARQParser.java */ /* Generated By:JavaCC: Do not edit this line. ARQParser.java */ package org.apache.jena.sparql.lang.arq ; import org.apache.jena.graph.* ; @@ -12,122 +11,116 @@ import org.apache.jena.update.* ; import org.apache.jena.sparql.modify.request.* ; import org.apache.jena.sparql.core.Quad ; +import java.util.List; +import java.util.ArrayList; @SuppressWarnings("all") public class ARQParser extends ARQParserBase implements ARQParserConstants { final public void QueryUnit() throws ParseException { ByteOrderMark(); -startQuery() ; + startQuery() ; Query(); jj_consume_token(0); -finishQuery() ; -} + finishQuery() ; + } final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: SelectQuery(); break; - } - case CONSTRUCT:{ + case CONSTRUCT: ConstructQuery(); break; - } - case DESCRIBE:{ + case DESCRIBE: DescribeQuery(); break; - } - case ASK:{ + case ASK: AskQuery(); break; - } - case JSON:{ + case JSON: JsonQuery(); break; - } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); -} + } final public void UpdateUnit() throws ParseException { ByteOrderMark(); -startUpdateRequest() ; + startUpdateRequest() ; Update(); jj_consume_token(0); -finishUpdateRequest() ; -} + finishUpdateRequest() ; + } final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOM: jj_consume_token(BOM); break; - } default: jj_la1[1] = jj_gen; ; } -} + } final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BASE: - case PREFIX:{ + case PREFIX: ; break; - } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BASE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BASE: BaseDecl(); break; - } - case PREFIX:{ + case PREFIX: PrefixDecl(); break; - } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -} + } - final public void BaseDecl() throws ParseException {Token t ; String iri ; + final public void BaseDecl() throws ParseException { + Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); -setBase(iri, t.beginLine, t.beginColumn ) ; -} + setBase(iri, t.beginLine, t.beginColumn ) ; + } - final public void PrefixDecl() throws ParseException {Token t ; String iri ; + final public void PrefixDecl() throws ParseException { + Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); -String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); + String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; -} + } final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[4] = jj_gen; break label_2; @@ -136,45 +129,43 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); -} + } - final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException { + Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); -getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DISTINCT: - case REDUCED:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + case REDUCED: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -getQuery().setDistinct(true); + getQuery().setDistinct(true); break; - } - case REDUCED:{ + case REDUCED: jj_consume_token(REDUCED); -getQuery().setReduced(true); + getQuery().setReduced(true); break; - } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[6] = jj_gen; ; } -setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -201,6 +192,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -275,16 +267,15 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addResultVar(v) ; + getQuery().addResultVar(v) ; break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -309,6 +300,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -382,27 +374,25 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: if (jj_2_1(2)) { expr = BuiltInCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addResultVar((Var)null, expr) ; + getQuery().addResultVar((Var)null, expr) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -411,17 +401,15 @@ final public void SubSelect() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; + getQuery().addResultVar((Var)null, NodeValue.makeNode(n)) ; break; - } default: jj_la1[7] = jj_gen; jj_consume_token(-1); @@ -429,32 +417,29 @@ final public void SubSelect() throws ParseException { } } break; - } - case LPAREN:{ -v = null ; + case LPAREN: + v = null ; jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[8] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addResultVar(v, expr) ; -getQuery().setQueryResultStar(false) ; + getQuery().addResultVar(v, expr) ; + getQuery().setQueryResultStar(false) ; break; - } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -481,6 +466,7 @@ final public void SubSelect() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -555,45 +541,42 @@ final public void SubSelect() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[10] = jj_gen; break label_3; } } break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void ConstructQuery() throws ParseException {Template t ; + final public void ConstructQuery() throws ParseException { + Template t ; QuadAcc acc = new QuadAcc() ; jj_consume_token(CONSTRUCT); -getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: t = ConstructTemplate(); -getQuery().setConstructTemplate(t) ; + getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[12] = jj_gen; break label_4; @@ -603,16 +586,14 @@ final public void SubSelect() throws ParseException { WhereClause(); SolutionModifier(); break; - } case FROM: - case WHERE:{ + case WHERE: label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[13] = jj_gen; break label_5; @@ -624,54 +605,51 @@ final public void SubSelect() throws ParseException { ConstructQuads(acc); jj_consume_token(RBRACE); SolutionModifier(); -t = new Template(acc) ; + t = new Template(acc) ; getQuery().setConstructTemplate(t) ; ElementGroup elg = createQueryPattern(t); getQuery().setQueryPattern(elg) ; break; - } default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DescribeQuery() throws ParseException {Node n ; + final public void DescribeQuery() throws ParseException { + Node n ; jj_consume_token(DESCRIBE); -getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: label_6: while (true) { n = VarOrIri(); -getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[15] = jj_gen; break label_6; } } -getQuery().setQueryResultStar(false) ; + getQuery().setQueryResultStar(false) ; break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[16] = jj_gen; jj_consume_token(-1); @@ -679,40 +657,37 @@ final public void SubSelect() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[17] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHERE: - case LBRACE:{ + case LBRACE: WhereClause(); break; - } default: jj_la1[18] = jj_gen; ; } SolutionModifier(); -} + } final public void AskQuery() throws ParseException { jj_consume_token(ASK); -getQuery().setQueryAskType() ; + getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[19] = jj_gen; break label_8; @@ -721,17 +696,16 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonQuery() throws ParseException { JsonClause(); label_9: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[20] = jj_gen; break label_9; @@ -740,20 +714,19 @@ final public void JsonQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void JsonClause() throws ParseException { jj_consume_token(JSON); -getQuery().setQueryJsonType() ; + getQuery().setQueryJsonType() ; jj_consume_token(LBRACE); JsonObjectMember(); label_10: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[21] = jj_gen; break label_10; @@ -762,28 +735,27 @@ final public void JsonClause() throws ParseException { JsonObjectMember(); } jj_consume_token(RBRACE); -} + } - final public void JsonObjectMember() throws ParseException {Node o ; String s ; Token t; + final public void JsonObjectMember() throws ParseException { + Node o ; String s ; Token t; s = String(); t = jj_consume_token(PNAME_NS); -if ( ! t.image.equals(":") ) + if ( ! t.image.equals(":") ) throwParseException("Prefix name expression not legal at this point : "+t.image, t.beginLine, t.beginColumn) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: o = Var(); -getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar((Var)o) ; getQuery().addJsonMapping(s, o) ; break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: o = RDFLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -792,116 +764,111 @@ final public void JsonClause() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: o = NumericLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } case TRUE: - case FALSE:{ + case FALSE: o = BooleanLiteral(); -getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; + getQuery().addResultVar(s, NodeValue.makeNode(o)) ; getQuery().addJsonMapping(s, o) ; break; - } default: jj_la1[22] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: DefaultGraphClause(); break; - } - case NAMED:{ + case NAMED: NamedGraphClause(); break; - } default: jj_la1[23] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DefaultGraphClause() throws ParseException {String iri ; + final public void DefaultGraphClause() throws ParseException { + String iri ; iri = SourceSelector(); -getQuery().addGraphURI(iri) ; -} + getQuery().addGraphURI(iri) ; + } - final public void NamedGraphClause() throws ParseException {String iri ; + final public void NamedGraphClause() throws ParseException { + String iri ; jj_consume_token(NAMED); iri = SourceSelector(); -getQuery().addNamedGraphURI(iri) ; -} + getQuery().addNamedGraphURI(iri) ; + } - final public String SourceSelector() throws ParseException {String iri ; + final public String SourceSelector() throws ParseException { + String iri ; iri = iri(); -{if ("" != null) return iri ;} + {if (true) return iri ;} throw new Error("Missing return statement in function"); -} + } - final public void WhereClause() throws ParseException {Element el ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WHERE:{ + final public void WhereClause() throws ParseException { + Element el ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: jj_consume_token(WHERE); break; - } default: jj_la1[24] = jj_gen; ; } -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -getQuery().setQueryPattern(el) ; -finishWherePattern() ; -} + getQuery().setQueryPattern(el) ; + finishWherePattern() ; + } final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GROUP:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: GroupClause(); break; - } default: jj_la1[25] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HAVING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: HavingClause(); break; - } default: jj_la1[26] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ORDER:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: OrderClause(); break; - } default: jj_la1[27] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: - case OFFSET:{ + case OFFSET: LimitOffsetClauses(); break; - } default: jj_la1[28] = jj_gen; ; } -} + } final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -909,7 +876,7 @@ final public void GroupClause() throws ParseException { label_11: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -936,6 +903,7 @@ final public void GroupClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -995,19 +963,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[29] = jj_gen; break label_11; } } -} + } - final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void GroupCondition() throws ParseException { + Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -1029,6 +997,7 @@ final public void GroupClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1087,55 +1056,50 @@ final public void GroupClause() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[30] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addGroupBy(v ,expr) ; + getQuery().addGroupBy(v ,expr) ; break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addGroupBy(v) ; + getQuery().addGroupBy(v) ; break; - } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void HavingClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_12: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1160,6 +1124,7 @@ final public void HavingClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1219,31 +1184,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[32] = jj_gen; break label_12; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void HavingCondition() throws ParseException {Expr c ; + final public void HavingCondition() throws ParseException { + Expr c ; c = Constraint(); -getQuery().addHavingCondition(c) ; -} + getQuery().addHavingCondition(c) ; + } final public void OrderClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_13: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1272,6 +1237,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1331,34 +1297,32 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[33] = jj_gen; break label_13; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; -direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void OrderCondition() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASC: - case DESC:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASC:{ + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: jj_consume_token(ASC); -direction = Query.ORDER_ASCENDING ; + direction = Query.ORDER_ASCENDING ; break; - } - case DESC:{ + case DESC: jj_consume_token(DESC); -direction = Query.ORDER_DESCENDING ; + direction = Query.ORDER_DESCENDING ; break; - } default: jj_la1[34] = jj_gen; jj_consume_token(-1); @@ -1366,7 +1330,6 @@ final public void OrderClause() throws ParseException { } expr = BrackettedExpression(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -1393,6 +1356,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1452,8 +1416,8 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1478,6 +1442,7 @@ final public void OrderClause() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -1537,546 +1502,743 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: expr = Constraint(); break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); break; - } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[36] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( v == null ) + if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; -} + } - final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ - LimitClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case OFFSET:{ - OffsetClause(); - break; - } - default: - jj_la1[37] = jj_gen; - ; - } - break; - } - case OFFSET:{ - OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ - LimitClause(); + final public SortCondition OrderConditionForAggregationFunction() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: + jj_consume_token(ASC); + direction = Query.ORDER_ASCENDING ; break; - } - default: - jj_la1[38] = jj_gen; - ; - } - break; - } - default: - jj_la1[39] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -} - - final public void LimitClause() throws ParseException {Token t ; - jj_consume_token(LIMIT); - t = jj_consume_token(INTEGER); -getQuery().setLimit(integerValue(t.image)) ; -} - - final public void OffsetClause() throws ParseException {Token t ; - jj_consume_token(OFFSET); - t = jj_consume_token(INTEGER); -getQuery().setOffset(integerValue(t.image)) ; -} - - final public void ValuesClause() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VALUES:{ - t = jj_consume_token(VALUES); -startValuesClause(t.beginLine, t.beginColumn) ; - DataBlock(); -finishValuesClause(t.beginLine, t.beginColumn) ; - break; - } - default: - jj_la1[40] = jj_gen; - ; - } -} - - final public void Update() throws ParseException { - Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT: - case DELETE: - case INSERT_DATA: - case DELETE_DATA: - case DELETE_WHERE: - case LOAD: - case CLEAR: - case CREATE: - case ADD: - case MOVE: - case COPY: - case DROP: - case WITH:{ - Update1(); - label_14: - while (true) { - if (jj_2_2(2147483647)) { - ; - } else { - break label_14; - } - jj_consume_token(SEMICOLON); - Prologue(); - Update1(); - } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ - jj_consume_token(SEMICOLON); - Prologue(); + case DESC: + jj_consume_token(DESC); + direction = Query.ORDER_DESCENDING ; break; - } default: - jj_la1[41] = jj_gen; - ; - } - break; - } - default: - jj_la1[42] = jj_gen; - ; - } -} - - final public void Update1() throws ParseException {Update up = null ; -startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LOAD:{ - up = Load(); - break; - } - case CLEAR:{ - up = Clear(); - break; - } - case DROP:{ - up = Drop(); - break; - } - case ADD:{ - up = Add(); - break; - } - case MOVE:{ - up = Move(); - break; - } - case COPY:{ - up = Copy(); - break; - } - case CREATE:{ - up = Create(); - break; - } - case DELETE_WHERE:{ - up = DeleteWhere(); - break; - } - case INSERT: - case DELETE: - case WITH:{ - up = Modify(); - break; - } - case INSERT_DATA:{ - InsertData(); - break; - } - case DELETE_DATA:{ - DeleteData(); - break; - } - default: - jj_la1[43] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } -if (null != up) emitUpdate(up) ; - finishUpdateOperation() ; -} - - final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; - jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ - jj_consume_token(SILENT); -silent = true ; - break; + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - default: - jj_la1[44] = jj_gen; - ; - } - url = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTO:{ - jj_consume_token(INTO); - dest = GraphRef(); + expr = BrackettedExpression(); break; + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + expr = Constraint(); + break; + case VAR1: + case VAR2: + v = Var(); + break; + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if ( v == null ) + {if (true) return new SortCondition(expr, direction) ;} + else + {if (true) return new SortCondition(v, direction) ;} + throw new Error("Missing return statement in function"); + } + + final public void LimitOffsetClauses() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: + LimitClause(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OFFSET: + OffsetClause(); + break; + default: + jj_la1[40] = jj_gen; + ; } + break; + case OFFSET: + OffsetClause(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: + LimitClause(); + break; + default: + jj_la1[41] = jj_gen; + ; + } + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void LimitClause() throws ParseException { + Token t ; + jj_consume_token(LIMIT); + t = jj_consume_token(INTEGER); + getQuery().setLimit(integerValue(t.image)) ; + } + + final public void OffsetClause() throws ParseException { + Token t ; + jj_consume_token(OFFSET); + t = jj_consume_token(INTEGER); + getQuery().setOffset(integerValue(t.image)) ; + } + + final public void ValuesClause() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VALUES: + t = jj_consume_token(VALUES); + startValuesClause(t.beginLine, t.beginColumn) ; + DataBlock(); + finishValuesClause(t.beginLine, t.beginColumn) ; + break; + default: + jj_la1[43] = jj_gen; + ; + } + } + + final public void Update() throws ParseException { + Prologue(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: + case DELETE: + case INSERT_DATA: + case DELETE_DATA: + case DELETE_WHERE: + case LOAD: + case CLEAR: + case CREATE: + case ADD: + case MOVE: + case COPY: + case DROP: + case WITH: + Update1(); + label_14: + while (true) { + if (jj_2_2(2147483647)) { + ; + } else { + break label_14; + } + jj_consume_token(SEMICOLON); + Prologue(); + Update1(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + Prologue(); + break; + default: + jj_la1[44] = jj_gen; + ; + } + break; default: jj_la1[45] = jj_gen; ; } -{if ("" != null) return new UpdateLoad(url, dest, silent) ;} + } + + final public void Update1() throws ParseException { + Update up = null ; + startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOAD: + up = Load(); + break; + case CLEAR: + up = Clear(); + break; + case DROP: + up = Drop(); + break; + case ADD: + up = Add(); + break; + case MOVE: + up = Move(); + break; + case COPY: + up = Copy(); + break; + case CREATE: + up = Create(); + break; + case DELETE_WHERE: + up = DeleteWhere(); + break; + case INSERT: + case DELETE: + case WITH: + up = Modify(); + break; + case INSERT_DATA: + InsertData(); + break; + case DELETE_DATA: + DeleteData(); + break; + default: + jj_la1[46] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + if (null != up) emitUpdate(up) ; + finishUpdateOperation() ; + } + + final public Update Load() throws ParseException { + String url ; Node dest = null ; boolean silent = false ; + jj_consume_token(LOAD); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: + jj_consume_token(SILENT); + silent = true ; + break; + default: + jj_la1[47] = jj_gen; + ; + } + url = iri(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTO: + jj_consume_token(INTO); + dest = GraphRef(); + break; + default: + jj_la1[48] = jj_gen; + ; + } + {if (true) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Clear() throws ParseException {boolean silent = false ; Target target ; + final public Update Clear() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: - jj_la1[46] = jj_gen; + jj_la1[49] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateClear(target, silent) ;} + {if (true) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Drop() throws ParseException {boolean silent = false ; Target target ; + final public Update Drop() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: - jj_la1[47] = jj_gen; + jj_la1[50] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateDrop(target, silent) ;} + {if (true) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Create() throws ParseException {Node iri ; boolean silent = false ; + final public Update Create() throws ParseException { + Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[48] = jj_gen; + jj_la1[51] = jj_gen; ; } iri = GraphRef(); -{if ("" != null) return new UpdateCreate(iri, silent) ;} + {if (true) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[49] = jj_gen; + jj_la1[52] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateAdd(src, dest, silent) ;} + {if (true) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[50] = jj_gen; + jj_la1[53] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateMove(src, dest, silent) ;} + {if (true) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: - jj_la1[51] = jj_gen; + jj_la1[54] = jj_gen; ; } src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateCopy(src, dest, silent) ;} + {if (true) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException { + QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataInsert(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataInsert(qd, beginLine, beginColumn) ; + finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException { + QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataDelete(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataDelete(qd, beginLine, beginColumn) ; + finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException { + QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -{if ("" != null) return new UpdateDeleteWhere(qp) ;} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + {if (true) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Modify() throws ParseException {Element el ; String iri = null ; + final public Update Modify() throws ParseException { + Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; -startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WITH:{ + startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WITH: jj_consume_token(WITH); iri = iri(); -Node n = createNode(iri) ; up.setWithIRI(n) ; + Node n = createNode(iri) ; up.setWithIRI(n) ; break; - } default: - jj_la1[52] = jj_gen; + jj_la1[55] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELETE: DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: InsertClause(up); break; - } default: - jj_la1[53] = jj_gen; + jj_la1[56] = jj_gen; ; } break; - } - case INSERT:{ + case INSERT: InsertClause(up); break; - } default: - jj_la1[54] = jj_gen; + jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case USING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case USING: ; break; - } default: - jj_la1[55] = jj_gen; + jj_la1[58] = jj_gen; break label_15; } UsingClause(up); } jj_consume_token(WHERE); -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -up.setElement(el) ; -finishWherePattern() ; -finishModifyUpdate() ; -{if ("" != null) return up ;} + up.setElement(el) ; + finishWherePattern() ; + finishModifyUpdate() ; + {if (true) return up ;} throw new Error("Missing return statement in function"); -} + } - final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -up.setHasDeleteClause(true) ; -} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + up.setHasDeleteClause(true) ; + } - final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startInsertTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishInsertTemplate(qp, beginLine, beginColumn) ; -up.setHasInsertClause(true) ; -} + finishInsertTemplate(qp, beginLine, beginColumn) ; + up.setHasInsertClause(true) ; + } - final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException { + String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; update.addUsing(n) ; + n = createNode(iri) ; update.addUsing(n) ; break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); iri = iri(); -n = createNode(iri) ; update.addUsingNamed(n) ; + n = createNode(iri) ; update.addUsingNamed(n) ; break; - } default: - jj_la1[56] = jj_gen; + jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public Target GraphOrDefault() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DFT:{ + final public Target GraphOrDefault() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + case GRAPH: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); break; - } default: - jj_la1[57] = jj_gen; + jj_la1[60] = jj_gen; ; } iri = iri(); -{if ("" != null) return Target.create(createNode(iri)) ;} + {if (true) return Target.create(createNode(iri)) ;} break; - } default: - jj_la1[58] = jj_gen; + jj_la1[61] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphRef() throws ParseException {String iri ; + final public Node GraphRef() throws ParseException { + String iri ; jj_consume_token(GRAPH); iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} throw new Error("Missing return statement in function"); -} + } - final public Target GraphRefAll() throws ParseException {Node iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + final public Target GraphRefAll() throws ParseException { + Node iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: iri = GraphRef(); -{if ("" != null) return Target.create(iri) ;} + {if (true) return Target.create(iri) ;} break; - } - case DFT:{ + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); -{if ("" != null) return Target.NAMED ;} + {if (true) return Target.NAMED ;} break; - } - case ALL:{ + case ALL: jj_consume_token(ALL); -{if ("" != null) return Target.ALL ;} + {if (true) return Target.ALL ;} break; - } default: - jj_la1[59] = jj_gen; + jj_la1[62] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2102,36 +2264,33 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[60] = jj_gen; + jj_la1[63] = jj_gen; ; } label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: ; break; - } default: - jj_la1[61] = jj_gen; + jj_la1[64] = jj_gen; break label_16; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[62] = jj_gen; + jj_la1[65] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2157,23 +2316,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[63] = jj_gen; + jj_la1[66] = jj_gen; ; } } -} + } - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2199,20 +2358,19 @@ final public void Quads(QuadAccSink acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[64] = jj_gen; + jj_la1[67] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void ConstructQuads(QuadAcc acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2238,37 +2396,34 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[65] = jj_gen; + jj_la1[68] = jj_gen; ; } label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case GRAPH: - case LBRACE:{ + case LBRACE: ; break; - } default: - jj_la1[66] = jj_gen; + jj_la1[69] = jj_gen; break label_17; } ConstructQuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[67] = jj_gen; + jj_la1[70] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2294,32 +2449,31 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[68] = jj_gen; + jj_la1[71] = jj_gen; ; } } -} + } - final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn = Quad.defaultGraphNodeGenerated ; + final public void ConstructQuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn = Quad.defaultGraphNodeGenerated ; Node prev = acc.getGraph() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); gn = VarOrBlankNodeOrIri(); break; - } default: - jj_la1[69] = jj_gen; + jj_la1[72] = jj_gen; ; } -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2345,17 +2499,16 @@ final public void ConstructQuads(QuadAcc acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesTemplate(acc); break; - } default: - jj_la1[70] = jj_gen; + jj_la1[73] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -2369,41 +2522,41 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[71] = jj_gen; + jj_la1[74] = jj_gen; ; } -} + } - final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException { + Element el = null ; Token t ; t = jj_consume_token(LBRACE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ -startSubSelect(beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: + startSubSelect(beginLine, beginColumn) ; SubSelect(); -Query q = endSubSelect(beginLine, beginColumn) ; + Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; - } default: - jj_la1[72] = jj_gen; + jj_la1[75] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; -ElementGroup elg = new ElementGroup() ; -startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException { + Element el = null ; + ElementGroup elg = new ElementGroup() ; + startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2429,20 +2582,19 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: - jj_la1[73] = jj_gen; + jj_la1[76] = jj_gen; ; } label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -2451,29 +2603,28 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case SERVICE: case LET: case LATERAL: + case UNFOLD: case EXISTS: case NOT: case FILTER: - case LBRACE:{ + case LBRACE: ; break; - } default: - jj_la1[74] = jj_gen; + jj_la1[77] = jj_gen; break label_19; } el = GraphPatternNotTriples(); -elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[75] = jj_gen; + jj_la1[78] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2499,31 +2650,30 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ -startTriplesBlock() ; + case LT2: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: - jj_la1[76] = jj_gen; + jj_la1[79] = jj_gen; ; } } -endGroup(elg) ; -{if ("" != null) return elg ;} + endGroup(elg) ; + {if (true) return elg ;} throw new Error("Missing return statement in function"); -} + } final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { -if ( acc == null ) + if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2549,172 +2699,166 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: TriplesBlock(acc); break; - } default: - jj_la1[77] = jj_gen; + jj_la1[80] = jj_gen; ; } break; - } default: - jj_la1[78] = jj_gen; + jj_la1[81] = jj_gen; ; } -{if ("" != null) return acc ;} + {if (true) return acc ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + final public Element GraphPatternNotTriples() throws ParseException { + Element el = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: el = GroupOrUnionGraphPattern(); break; - } - case OPTIONAL:{ + case OPTIONAL: el = OptionalGraphPattern(); break; - } - case LATERAL:{ + case LATERAL: el = LateralGraphPattern(); break; - } - case MINUS_P:{ + case MINUS_P: el = MinusGraphPattern(); break; - } - case GRAPH:{ + case GRAPH: el = GraphGraphPattern(); break; - } - case SERVICE:{ + case SERVICE: el = ServiceGraphPattern(); break; - } - case FILTER:{ + case FILTER: el = Filter(); break; - } - case BIND:{ + case BIND: el = Bind(); break; - } - case VALUES:{ + case VALUES: el = InlineData(); break; - } - case LET:{ + case LET: el = Assignment(); break; - } - case EXISTS:{ + case EXISTS: el = ExistsElt(); break; - } - case NOT:{ + case NOT: el = NotExistsElt(); break; - } + case UNFOLD: + el = Unfold(); + break; default: - jj_la1[79] = jj_gen; + jj_la1[82] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element OptionalGraphPattern() throws ParseException {Element el ; + final public Element OptionalGraphPattern() throws ParseException { + Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementOptional(el) ;} + {if (true) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element LateralGraphPattern() throws ParseException {Element el ; + final public Element LateralGraphPattern() throws ParseException { + Element el ; jj_consume_token(LATERAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementLateral(el) ;} + {if (true) return new ElementLateral(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException { + Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementNamedGraph(n, el) ;} + {if (true) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException { + Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true; + silent=true; break; - } default: - jj_la1[80] = jj_gen; + jj_la1[83] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementService(n, el, silent) ;} + {if (true) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Element Bind() throws ParseException {Var v ; Expr expr ; + final public Element Bind() throws ParseException { + Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementBind(v, expr) ;} + {if (true) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element InlineData() throws ParseException {ElementData el ; Token t ; + final public Element InlineData() throws ParseException { + ElementData el ; Token t ; t = jj_consume_token(VALUES); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -el = new ElementData() ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); -finishInlineData(beginLine, beginColumn) ; - {if ("" != null) return el ;} + finishInlineData(beginLine, beginColumn) ; + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: InlineDataOneVar(); break; - } case LPAREN: - case NIL:{ + case NIL: InlineDataFull(); break; - } default: - jj_la1[81] = jj_gen; + jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException { + Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2734,74 +2878,70 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[82] = jj_gen; + jj_la1[85] = jj_gen; break label_20; } n = DataBlockValue(); -startDataBlockValueRow(beginLine, beginColumn) ; + startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); -} + } - final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public void InlineDataFull() throws ParseException { + Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: - jj_la1[83] = jj_gen; + jj_la1[86] = jj_gen; break label_21; } v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[84] = jj_gen; + jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(LBRACE); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: ; break; - } default: - jj_la1[85] = jj_gen; + jj_la1[88] = jj_gen; break label_22; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: t = jj_consume_token(LPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2821,55 +2961,51 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[86] = jj_gen; + jj_la1[89] = jj_gen; break label_23; } n = DataBlockValue(); -emitDataBlockValue(n, beginLine, beginColumn) ; + emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } - case NIL:{ + case NIL: t = jj_consume_token(NIL); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } default: - jj_la1[87] = jj_gen; + jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); -} + } - final public Node DataBlockValue() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataBlockValue() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -2878,107 +3014,130 @@ final public void DataBlock() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case UNDEF:{ + case UNDEF: jj_consume_token(UNDEF); -{if ("" != null) return null ;} + {if (true) return null ;} break; - } - case LT2:{ + case LT2: n = QuotedTripleData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[88] = jj_gen; + jj_la1[91] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Element Assignment() throws ParseException {Var v ; Expr expr ; + final public Element Assignment() throws ParseException { + Var v ; Expr expr ; jj_consume_token(LET); jj_consume_token(LPAREN); v = Var(); jj_consume_token(ASSIGN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementAssign(v, expr) ;} + {if (true) return new ElementAssign(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ExistsElt() throws ParseException {Element el ; + final public Element ExistsElt() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementExists(el) ;} + {if (true) return new ElementExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element NotExistsElt() throws ParseException {Element el ; + final public Element NotExistsElt() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return new ElementNotExists(el) ;} + {if (true) return new ElementNotExists(el) ;} + throw new Error("Missing return statement in function"); + } + + final public Element Unfold() throws ParseException { + Var v1 ; Var v2 = null ; Expr expr ; + jj_consume_token(UNFOLD); + jj_consume_token(LPAREN); + expr = Expression(); + jj_consume_token(AS); + v1 = Var(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + v2 = Var(); + ; + break; + default: + jj_la1[92] = jj_gen; + ; + } + jj_consume_token(RPAREN); + {if (true) return new ElementUnfold(expr, v1, v2) ;} throw new Error("Missing return statement in function"); -} + } - final public Element MinusGraphPattern() throws ParseException {Element el ; + final public Element MinusGraphPattern() throws ParseException { + Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); -{if ("" != null) return new ElementMinus(el) ;} + {if (true) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException { + Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case UNION:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNION: ; break; - } default: - jj_la1[89] = jj_gen; + jj_la1[93] = jj_gen; break label_24; } jj_consume_token(UNION); -if ( el2 == null ) + if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); -el2.addElement(el) ; + el2.addElement(el) ; } -{if ("" != null) return (el2==null)? el : el2 ;} + {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); -} + } - final public Element Filter() throws ParseException {Expr c ; + final public Element Filter() throws ParseException { + Expr c ; jj_consume_token(FILTER); c = Constraint(); -{if ("" != null) return new ElementFilter(c) ;} + {if (true) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Constraint() throws ParseException {Expr c ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr Constraint() throws ParseException { + Expr c ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: c = BrackettedExpression(); break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -3000,6 +3159,7 @@ final public void DataBlock() throws ParseException { case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -3058,137 +3218,132 @@ final public void DataBlock() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: c = BuiltInCall(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: c = FunctionCall(); break; - } default: - jj_la1[90] = jj_gen; + jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return c ;} + {if (true) return c ;} throw new Error("Missing return statement in function"); -} + } - final public Expr FunctionCall() throws ParseException {String fname ; Args a ; + final public Expr FunctionCall() throws ParseException { + String fname ; Args a ; fname = iri(); a = ArgList(); -if ( AggregateRegistry.isRegistered(fname) ) { + if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(fname, a) ;} + {if (true) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public Args ArgList() throws ParseException { + Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -args.distinct = true ; -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -if ( ! getAllowAggregatesInExpressions() ) + args.distinct = true ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; - } default: - jj_la1[91] = jj_gen; + jj_la1[95] = jj_gen; ; } expr = Expression(); -args.add(expr) ; + args.add(expr) ; label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[92] = jj_gen; + jj_la1[96] = jj_gen; break label_25; } jj_consume_token(COMMA); expr = Expression(); -args.add(expr) ; + args.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[93] = jj_gen; + jj_la1[97] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return args ;} + {if (true) return args ;} throw new Error("Missing return statement in function"); -} + } - final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public ExprList ExpressionList() throws ParseException { + Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[94] = jj_gen; + jj_la1[98] = jj_gen; break label_26; } jj_consume_token(COMMA); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[95] = jj_gen; + jj_la1[99] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return exprList ;} + {if (true) return exprList ;} throw new Error("Missing return statement in function"); -} + } - final public Template ConstructTemplate() throws ParseException {QuadAcc acc = new QuadAcc() ; + final public Template ConstructTemplate() throws ParseException { + QuadAcc acc = new QuadAcc() ; Template t = new Template (acc); -setInConstructTemplate(true) ; + setInConstructTemplate(true) ; jj_consume_token(LBRACE); ConstructQuads(acc); jj_consume_token(RBRACE); -setInConstructTemplate(false) ; - {if ("" != null) return t ;} + setInConstructTemplate(false) ; + {if (true) return t ;} throw new Error("Missing return statement in function"); -} + } final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); @@ -3202,19 +3357,19 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { jj_consume_token(DOT); TriplesSameSubject(acc); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: - jj_la1[96] = jj_gen; + jj_la1[100] = jj_gen; ; } -} + } - final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3238,127 +3393,124 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[97] = jj_gen; + jj_la1[101] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: PropertyListNotEmpty(s, acc); break; - } default: - jj_la1[98] = jj_gen; + jj_la1[102] = jj_gen; ; } -} + } - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { + Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[99] = jj_gen; + jj_la1[103] = jj_gen; break label_28; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: p = Verb(); ObjectList(s, p, null, acc); break; - } default: - jj_la1[100] = jj_gen; + jj_la1[104] = jj_gen; ; } } -} + } - final public Node Verb() throws ParseException {Node p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node Verb() throws ParseException { + Node p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: p = VarOrIri(); break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[101] = jj_gen; + jj_la1[105] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; Object(s, p, path, acc); label_29: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[102] = jj_gen; + jj_la1[106] = jj_gen; break label_29; } jj_consume_token(COMMA); Object(s, p, path, acc); } -} + } - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; Annotation(acc, s, p, path, o); -} + } - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3382,28 +3534,26 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: - jj_la1[103] = jj_gen; + jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3415,18 +3565,18 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: PropertyListPathNotEmpty(s, acc); break; - } default: - jj_la1[104] = jj_gen; + jj_la1[108] = jj_gen; ; } -} + } - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { + Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3436,35 +3586,32 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[105] = jj_gen; + jj_la1[109] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); label_30: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: - jj_la1[106] = jj_gen; + jj_la1[110] = jj_gen; break label_30; } jj_consume_token(SEMICOLON); -path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3476,8 +3623,8 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CARAT: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3487,159 +3634,160 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHORTEST: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: - jj_la1[107] = jj_gen; + jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ObjectListPath(s, p, path, acc); break; - } default: - jj_la1[108] = jj_gen; + jj_la1[112] = jj_gen; ; } } -} + } - final public Path VerbPath() throws ParseException {Node p ; Path path ; + final public Path VerbPath() throws ParseException { + Node p ; Path path ; path = Path(); -{if ("" != null) return path ;} + {if (true) return path ;} throw new Error("Missing return statement in function"); -} + } - final public Node VerbSimple() throws ParseException {Node p ; + final public Node VerbSimple() throws ParseException { + Node p ; p = Var(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; ObjectPath(s, p, path, acc); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[109] = jj_gen; + jj_la1[113] = jj_gen; break label_31; } jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } -} + } - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; AnnotationPath(acc, s, p, path, o); -} + } - final public Path PathUnit() throws ParseException {Path p ; + final public Path PathUnit() throws ParseException { + Path p ; ByteOrderMark(); p = Path(); jj_consume_token(0); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path Path() throws ParseException {Path p ; + final public Path Path() throws ParseException { + Path p ; p = PathAlternative(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathAlternative() throws ParseException {Path p1 , p2 ; + final public Path PathAlternative() throws ParseException { + Path p1 , p2 ; p1 = PathSequence(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[110] = jj_gen; + jj_la1[114] = jj_gen; break label_32; } jj_consume_token(VBAR); p2 = PathSequence(); -p1 = PathFactory.pathAlt(p1, p2) ; + p1 = PathFactory.pathAlt(p1, p2) ; } -{if ("" != null) return p1 ;} + {if (true) return p1 ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathSequence() throws ParseException {Path p1 , p2 ; + final public Path PathSequence() throws ParseException { + Path p1 , p2 ; p1 = PathEltOrInverse(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SLASH: - case CARAT:{ + case CARAT: ; break; - } default: - jj_la1[111] = jj_gen; + jj_la1[115] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SLASH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SLASH: jj_consume_token(SLASH); p2 = PathEltOrInverse(); -p1 = PathFactory.pathSeq(p1, p2) ; + p1 = PathFactory.pathSeq(p1, p2) ; break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p2 = PathElt(); -p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; + p1 = PathFactory.pathSeq(p1, new P_Inverse(p2)) ; break; - } default: - jj_la1[112] = jj_gen; + jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return p1;} + {if (true) return p1;} throw new Error("Missing return statement in function"); -} + } - final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException { + String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: case PLUS: case STAR: - case QMARK:{ + case QMARK: p = PathMod(p); break; - } default: - jj_la1[113] = jj_gen; + jj_la1[117] = jj_gen; ; } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException { + String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3648,351 +3796,327 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case MULTI: case SHORTEST: case LPAREN: - case BANG:{ + case BANG: p = PathElt(); break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p = PathElt(); -p = PathFactory.pathInverse(p) ; + p = PathFactory.pathInverse(p) ; break; - } default: - jj_la1[114] = jj_gen; + jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case QMARK:{ + final public Path PathMod(Path p) throws ParseException { + long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QMARK: jj_consume_token(QMARK); -{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} + {if (true) return PathFactory.pathZeroOrOne(p) ;} break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} + {if (true) return PathFactory.pathZeroOrMore1(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); -{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} + {if (true) return PathFactory.pathOneOrMore1(p) ;} break; - } - case LBRACE:{ + case LBRACE: jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathZeroOrMoreN(p) ;} + {if (true) return PathFactory.pathZeroOrMoreN(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathOneOrMoreN(p) ;} + {if (true) return PathFactory.pathOneOrMoreN(p) ;} break; - } - case INTEGER:{ + case INTEGER: i1 = Integer(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case RBRACE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} + {if (true) return PathFactory.pathMod(p, i1, PathFactory.UNSET) ;} break; - } - case INTEGER:{ + case INTEGER: i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, i1, i2) ;} + {if (true) return PathFactory.pathMod(p, i1, i2) ;} break; - } default: - jj_la1[115] = jj_gen; + jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RBRACE:{ + case RBRACE: jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathFixedLength(p, i1) ;} + {if (true) return PathFactory.pathFixedLength(p, i1) ;} break; - } default: - jj_la1[116] = jj_gen; + jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case COMMA:{ + case COMMA: jj_consume_token(COMMA); i2 = Integer(); jj_consume_token(RBRACE); -{if ("" != null) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} + {if (true) return PathFactory.pathMod(p, PathFactory.UNSET, i2) ;} break; - } default: - jj_la1[117] = jj_gen; + jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[118] = jj_gen; + jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathPrimary() throws ParseException { + String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; p = PathFactory.pathLink(n) ; + n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = PathFactory.pathLink(nRDFtype) ; + p = PathFactory.pathLink(nRDFtype) ; break; - } - case BANG:{ + case BANG: jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; - } - case DISTINCT:{ + case DISTINCT: jj_consume_token(DISTINCT); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathDistinct(p) ; + p = PathFactory.pathDistinct(p) ; jj_consume_token(RPAREN); break; - } - case SHORTEST:{ + case SHORTEST: jj_consume_token(SHORTEST); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathShortest(p) ; + p = PathFactory.pathShortest(p) ; jj_consume_token(RPAREN); break; - } - case MULTI:{ + case MULTI: jj_consume_token(MULTI); jj_consume_token(LPAREN); p = Path(); -p = PathFactory.pathMulti(p) ; + p = PathFactory.pathMulti(p) ; jj_consume_token(RPAREN); break; - } default: - jj_la1[119] = jj_gen; + jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; -pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException { + P_Path0 p ; P_NegPropSet pNegSet ; + pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: - jj_la1[120] = jj_gen; + jj_la1[124] = jj_gen; break label_34; } jj_consume_token(VBAR); p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; } break; - } default: - jj_la1[121] = jj_gen; + jj_la1[125] = jj_gen; ; } jj_consume_token(RPAREN); break; - } default: - jj_la1[122] = jj_gen; + jj_la1[126] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return pNegSet ;} + {if (true) return pNegSet ;} throw new Error("Missing return statement in function"); -} + } - final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException { + String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} + n = createNode(str) ; {if (true) return new P_Link(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_Link(nRDFtype) ;} + {if (true) return new P_Link(nRDFtype) ;} break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} + n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_ReverseLink(nRDFtype) ;} + {if (true) return new P_ReverseLink(nRDFtype) ;} break; - } default: - jj_la1[123] = jj_gen; + jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[124] = jj_gen; + jj_la1[128] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public long Integer() throws ParseException {Token t ; + final public long Integer() throws ParseException { + Token t ; t = jj_consume_token(INTEGER); -{if ("" != null) return integerValue(t.image) ;} + {if (true) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = Collection(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyList(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[125] = jj_gen; + jj_la1[129] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = CollectionPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyListPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[126] = jj_gen; + jj_la1[130] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_35: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4018,37 +4142,37 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[127] = jj_gen; + jj_la1[131] = jj_gen; break label_35; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_36: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4074,56 +4198,54 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case NIL: case LBRACKET: case ANON: - case LT2:{ + case LT2: ; break; - } default: - jj_la1[128] = jj_gen; + jj_la1[132] = jj_gen; break label_36; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } final public void AnnotationPath(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createQuotedTriple(s, pAnn, o, token.beginLine, token.beginColumn); PropertyListPathNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[129] = jj_gen; + jj_la1[133] = jj_gen; ; } -} + } final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Node o) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case L_ANN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case L_ANN: jj_consume_token(L_ANN); -Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; + Node pAnn = preConditionAnnotation(s, p, path, o, token.beginLine, token.beginColumn) ; Node x = createQuotedTriple(s, p, o, token.beginLine, token.beginColumn); PropertyListNotEmpty(x, acc); jj_consume_token(R_ANN); break; - } default: - jj_la1[130] = jj_gen; + jj_la1[134] = jj_gen; ; } -} + } - final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4147,27 +4269,26 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNode(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[131] = jj_gen; + jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -4191,47 +4312,43 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG2: case NIL: case ANON: - case LT2:{ + case LT2: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNodePath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[132] = jj_gen; + jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrTerm() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrTerm() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4240,97 +4357,91 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return nRDFnil ;} + {if (true) return nRDFnil ;} break; - } - case LT2:{ + case LT2: n = QuotedTriple(); break; - } default: - jj_la1[133] = jj_gen; + jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node QuotedTriple() throws ParseException {Node n = null ; Token t ; Node s , p , o ; + final public Node QuotedTriple() throws ParseException { + Node n = null ; Token t ; Node s , p , o ; t = jj_consume_token(LT2); s = VarOrTerm(); p = Verb(); o = VarOrTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node QuotedTripleData() throws ParseException {Node n = null ; Token t ; String iri ; Node s , p , o ; + final public Node QuotedTripleData() throws ParseException { + Node n = null ; Token t ; String iri ; Node s , p , o ; t = jj_consume_token(LT2); s = DataValueTerm(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -p = createNode(iri) ; + p = createNode(iri) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: - jj_la1[134] = jj_gen; + jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } o = DataValueTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node DataValueTerm() throws ParseException {Node n = null ; String iri ; Node s , p , o ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataValueTerm() throws ParseException { + Node n = null ; String iri ; Node s , p , o ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4339,157 +4450,153 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LT2:{ + case LT2: n = QuotedTripleData(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: - jj_la1[135] = jj_gen; + jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[136] = jj_gen; + jj_la1[140] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: - jj_la1[137] = jj_gen; + jj_la1[141] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Var Var() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR1:{ + final public Var Var() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VAR1: t = jj_consume_token(VAR1); break; - } - case VAR2:{ + case VAR2: t = jj_consume_token(VAR2); break; - } default: - jj_la1[138] = jj_gen; + jj_la1[142] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Expression() throws ParseException {Expr expr ; + final public Expr Expression() throws ParseException { + Expr expr ; expr = ConditionalOrExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_37: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: ; break; - } default: - jj_la1[139] = jj_gen; + jj_la1[143] = jj_gen; break label_37; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); -expr1 = new E_LogicalOr(expr1, expr2) ; + expr1 = new E_LogicalOr(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ValueLogical(); label_38: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: ; break; - } default: - jj_la1[140] = jj_gen; + jj_la1[144] = jj_gen; break label_38; } jj_consume_token(SC_AND); expr2 = ValueLogical(); -expr1 = new E_LogicalAnd(expr1, expr2) ; + expr1 = new E_LogicalAnd(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ValueLogical() throws ParseException {Expr expr ; + final public Expr ValueLogical() throws ParseException { + Expr expr ; expr = RelationalExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException { + Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case IN: case EQ: @@ -4497,83 +4604,76 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case GT: case LT: case LE: - case GE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ + case GE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: jj_consume_token(EQ); expr2 = NumericExpression(); -expr1 = new E_Equals(expr1, expr2) ; + expr1 = new E_Equals(expr1, expr2) ; break; - } - case NE:{ + case NE: jj_consume_token(NE); expr2 = NumericExpression(); -expr1 = new E_NotEquals(expr1, expr2) ; + expr1 = new E_NotEquals(expr1, expr2) ; break; - } - case LT:{ + case LT: jj_consume_token(LT); expr2 = NumericExpression(); -expr1 = new E_LessThan(expr1, expr2) ; + expr1 = new E_LessThan(expr1, expr2) ; break; - } - case GT:{ + case GT: jj_consume_token(GT); expr2 = NumericExpression(); -expr1 = new E_GreaterThan(expr1, expr2) ; + expr1 = new E_GreaterThan(expr1, expr2) ; break; - } - case LE:{ + case LE: jj_consume_token(LE); expr2 = NumericExpression(); -expr1 = new E_LessThanOrEqual(expr1, expr2) ; + expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - } - case GE:{ + case GE: jj_consume_token(GE); expr2 = NumericExpression(); -expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; + expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - } - case IN:{ + case IN: jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_OneOf(expr1, a) ; + expr1 = new E_OneOf(expr1, a) ; break; - } - case NOT:{ + case NOT: jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_NotOneOf(expr1, a) ; + expr1 = new E_NotOneOf(expr1, a) ; break; - } default: - jj_la1[141] = jj_gen; + jj_la1[145] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[142] = jj_gen; + jj_la1[146] = jj_gen; ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NumericExpression() throws ParseException {Expr expr ; + final public Expr NumericExpression() throws ParseException { + Expr expr ; expr = AdditiveExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException { + Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_39: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -4581,175 +4681,160 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS:{ + case MINUS: ; break; - } default: - jj_la1[143] = jj_gen; + jj_la1[147] = jj_gen; break label_39; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Add(expr1, expr2) ; + expr1 = new E_Add(expr1, expr2) ; break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Subtract(expr1, expr2) ; + expr1 = new E_Subtract(expr1, expr2) ; break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOUBLE_NEGATIVE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; - } default: - jj_la1[144] = jj_gen; + jj_la1[148] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_40: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[145] = jj_gen; + jj_la1[149] = jj_gen; break label_40; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr3 = UnaryExpression(); -expr2 = new E_Multiply(expr2, expr3) ; + expr2 = new E_Multiply(expr2, expr3) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr3 = UnaryExpression(); -expr2 = new E_Divide(expr2, expr3) ; + expr2 = new E_Divide(expr2, expr3) ; break; - } default: - jj_la1[146] = jj_gen; + jj_la1[150] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -if ( addition ) + if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; - } default: - jj_la1[147] = jj_gen; + jj_la1[151] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = UnaryExpression(); label_41: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MOD: case IDIV: case STAR: - case SLASH:{ + case SLASH: ; break; - } default: - jj_la1[148] = jj_gen; + jj_la1[152] = jj_gen; break label_41; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr2 = UnaryExpression(); -expr1 = new E_Multiply(expr1, expr2) ; + expr1 = new E_Multiply(expr1, expr2) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr2 = UnaryExpression(); -expr1 = new E_Divide(expr1, expr2) ; + expr1 = new E_Divide(expr1, expr2) ; break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); expr2 = UnaryExpression(); -expr1 = new E_OpNumericMod(expr1, expr2) ; + expr1 = new E_OpNumericMod(expr1, expr2) ; break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); expr2 = UnaryExpression(); -expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; + expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; - } default: - jj_la1[149] = jj_gen; + jj_la1[153] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr UnaryExpression() throws ParseException {Expr expr ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BANG:{ + final public Expr UnaryExpression() throws ParseException { + Expr expr ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: jj_consume_token(BANG); expr = PrimaryExpression(); -{if ("" != null) return new E_LogicalNot(expr) ;} + {if (true) return new E_LogicalNot(expr) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryPlus(expr) ;} + {if (true) return new E_UnaryPlus(expr) ;} break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryMinus(expr) ;} + {if (true) return new E_UnaryMinus(expr) ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4776,6 +4861,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4851,26 +4937,25 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case LPAREN: - case LT2:{ + case LT2: expr = PrimaryExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: - jj_la1[150] = jj_gen; + jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr PrimaryExpression() throws ParseException { + Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: expr = BrackettedExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case TRIPLE: case IS_TRIPLE: case SUBJECT: @@ -4892,6 +4977,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -4950,26 +5036,23 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = iriOrFunction(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4978,52 +5061,47 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } - case LT2:{ + case LT2: n = ExprQuotedTriple(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } default: - jj_la1[151] = jj_gen; + jj_la1[155] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node ExprVarOrTerm() throws ParseException {Node n; String s; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node ExprVarOrTerm() throws ParseException { + Node n; String s; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: s = iri(); -n = createNode(s); + n = createNode(s); break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -5032,56 +5110,55 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } - case LT2:{ + case LT2: n = ExprQuotedTriple(); break; - } default: - jj_la1[152] = jj_gen; + jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Node ExprQuotedTriple() throws ParseException {Token t ; Node s,p,o,n; + final public Node ExprQuotedTriple() throws ParseException { + Token t ; Node s,p,o,n; t = jj_consume_token(LT2); s = ExprVarOrTerm(); p = Verb(); o = ExprVarOrTerm(); -n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); + n = createQuotedTriple(s, p, o, t.beginLine, t.beginColumn); jj_consume_token(GT2); -{if ("" != null) return n;} + {if (true) return n;} throw new Error("Missing return statement in function"); -} + } - final public Expr BrackettedExpression() throws ParseException {Expr expr ; + final public Expr BrackettedExpression() throws ParseException { + Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr BuiltInCall() throws ParseException {Expr expr ; + final public Expr BuiltInCall() throws ParseException { + Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case AGG: case COUNT: case MIN: @@ -5096,446 +5173,393 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: - case GROUP_CONCAT:{ + case GROUP_CONCAT: expr = Aggregate(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STR:{ + case STR: jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Str(expr) ;} + {if (true) return new E_Str(expr) ;} break; - } - case LANG:{ + case LANG: jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Lang(expr) ;} + {if (true) return new E_Lang(expr) ;} break; - } - case LANGMATCHES:{ + case LANGMATCHES: jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_LangMatches(expr1, expr2) ;} + {if (true) return new E_LangMatches(expr1, expr2) ;} break; - } - case DTYPE:{ + case DTYPE: jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Datatype(expr) ;} + {if (true) return new E_Datatype(expr) ;} break; - } - case BOUND:{ + case BOUND: jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} + {if (true) return new E_Bound(new ExprVar(gn)) ;} break; - } - case IRI:{ + case IRI: jj_consume_token(IRI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[153] = jj_gen; + jj_la1[157] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_IRI(expr1, expr2) ;} + {if (true) return makeFunction_IRI(expr1, expr2) ;} break; - } - case URI:{ + case URI: jj_consume_token(URI); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[154] = jj_gen; + jj_la1[158] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_URI(expr1, expr2) ;} + {if (true) return makeFunction_URI(expr1, expr2) ;} break; - } - case BNODE:{ + case BNODE: jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_BNode(expr1) ;} + {if (true) return makeFunction_BNode(expr1) ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return makeFunction_BNode() ;} + {if (true) return makeFunction_BNode() ;} break; - } default: - jj_la1[155] = jj_gen; + jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RAND:{ + case RAND: jj_consume_token(RAND); jj_consume_token(NIL); -{if ("" != null) return new E_Random() ;} + {if (true) return new E_Random() ;} break; - } - case ABS:{ + case ABS: jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumAbs(expr1) ;} + {if (true) return new E_NumAbs(expr1) ;} break; - } - case CEIL:{ + case CEIL: jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumCeiling(expr1) ;} + {if (true) return new E_NumCeiling(expr1) ;} break; - } - case FLOOR:{ + case FLOOR: jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumFloor(expr1) ;} + {if (true) return new E_NumFloor(expr1) ;} break; - } - case ROUND:{ + case ROUND: jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumRound(expr1) ;} + {if (true) return new E_NumRound(expr1) ;} break; - } - case MOD:{ + case MOD: jj_consume_token(MOD); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericMod(expr1, expr2);} + {if (true) return new E_OpNumericMod(expr1, expr2);} break; - } - case IDIV:{ + case IDIV: jj_consume_token(IDIV); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_OpNumericIntegerDivide(expr1, expr2);} + {if (true) return new E_OpNumericIntegerDivide(expr1, expr2);} break; - } - case CONCAT:{ + case CONCAT: jj_consume_token(CONCAT); a = ExpressionList(); -{if ("" != null) return new E_StrConcat(a) ;} + {if (true) return new E_StrConcat(a) ;} break; - } - case SUBSTR:{ + case SUBSTR: expr = SubstringExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STRLEN:{ + case STRLEN: jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLength(expr1) ;} + {if (true) return new E_StrLength(expr1) ;} break; - } - case REPLACE:{ + case REPLACE: expr = StrReplaceExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case UCASE:{ + case UCASE: jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrUpperCase(expr1) ;} + {if (true) return new E_StrUpperCase(expr1) ;} break; - } - case LCASE:{ + case LCASE: jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLowerCase(expr1) ;} + {if (true) return new E_StrLowerCase(expr1) ;} break; - } - case ENCODE_FOR_URI:{ + case ENCODE_FOR_URI: jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEncodeForURI(expr1) ;} + {if (true) return new E_StrEncodeForURI(expr1) ;} break; - } - case CONTAINS:{ + case CONTAINS: jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrContains(expr1, expr2) ;} + {if (true) return new E_StrContains(expr1, expr2) ;} break; - } - case STRSTARTS:{ + case STRSTARTS: jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} + {if (true) return new E_StrStartsWith(expr1, expr2) ;} break; - } - case STRENDS:{ + case STRENDS: jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} + {if (true) return new E_StrEndsWith(expr1, expr2) ;} break; - } - case STRBEFORE:{ + case STRBEFORE: jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrBefore(expr1, expr2) ;} + {if (true) return new E_StrBefore(expr1, expr2) ;} break; - } - case STRAFTER:{ + case STRAFTER: jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrAfter(expr1, expr2) ;} + {if (true) return new E_StrAfter(expr1, expr2) ;} break; - } - case YEAR:{ + case YEAR: jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeYear(expr1) ;} + {if (true) return new E_DateTimeYear(expr1) ;} break; - } - case MONTH:{ + case MONTH: jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMonth(expr1) ;} + {if (true) return new E_DateTimeMonth(expr1) ;} break; - } - case DAY:{ + case DAY: jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeDay(expr1) ;} + {if (true) return new E_DateTimeDay(expr1) ;} break; - } - case HOURS:{ + case HOURS: jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeHours(expr1) ;} + {if (true) return new E_DateTimeHours(expr1) ;} break; - } - case MINUTES:{ + case MINUTES: jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMinutes(expr1) ;} + {if (true) return new E_DateTimeMinutes(expr1) ;} break; - } - case SECONDS:{ + case SECONDS: jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeSeconds(expr1) ;} + {if (true) return new E_DateTimeSeconds(expr1) ;} break; - } - case TIMEZONE:{ + case TIMEZONE: jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTimezone(expr1) ;} + {if (true) return new E_DateTimeTimezone(expr1) ;} break; - } - case TZ:{ + case TZ: jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTZ(expr1) ;} + {if (true) return new E_DateTimeTZ(expr1) ;} break; - } - case ADJUST:{ + case ADJUST: jj_consume_token(ADJUST); jj_consume_token(LPAREN); expr1 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr2 = Expression(); break; - } default: - jj_la1[156] = jj_gen; + jj_la1[160] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_AdjustToTimezone(expr1, expr2) ;} + {if (true) return new E_AdjustToTimezone(expr1, expr2) ;} break; - } - case NOW:{ + case NOW: jj_consume_token(NOW); jj_consume_token(NIL); -{if ("" != null) return new E_Now() ;} + {if (true) return new E_Now() ;} break; - } - case UUID:{ + case UUID: jj_consume_token(UUID); jj_consume_token(NIL); -{if ("" != null) return new E_UUID() ;} + {if (true) return new E_UUID() ;} break; - } - case STRUUID:{ + case STRUUID: jj_consume_token(STRUUID); jj_consume_token(NIL); -{if ("" != null) return new E_StrUUID() ;} + {if (true) return new E_StrUUID() ;} break; - } - case MD5:{ + case MD5: jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_MD5(expr1) ;} + {if (true) return new E_MD5(expr1) ;} break; - } - case SHA1:{ + case SHA1: jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA1(expr1) ;} + {if (true) return new E_SHA1(expr1) ;} break; - } - case SHA256:{ + case SHA256: jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA256(expr1) ;} + {if (true) return new E_SHA256(expr1) ;} break; - } - case SHA384:{ + case SHA384: jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA384(expr1) ;} + {if (true) return new E_SHA384(expr1) ;} break; - } - case SHA512:{ + case SHA512: jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA512(expr1) ;} + {if (true) return new E_SHA512(expr1) ;} break; - } - case VERSION:{ + case VERSION: jj_consume_token(VERSION); jj_consume_token(NIL); -{if ("" != null) return new E_Version();} + {if (true) return new E_Version();} break; - } - case COALESCE:{ + case COALESCE: jj_consume_token(COALESCE); a = ExpressionList(); -{if ("" != null) return new E_Coalesce(a) ;} + {if (true) return new E_Coalesce(a) ;} break; - } - case CALL:{ + case CALL: jj_consume_token(CALL); -a = new ExprList() ; + a = new ExprList() ; jj_consume_token(LPAREN); expr = Expression(); -a.add(expr) ; + a.add(expr) ; label_42: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: - jj_la1[157] = jj_gen; + jj_la1[161] = jj_gen; break label_42; } jj_consume_token(COMMA); expr = Expression(); -a.add(expr) ; + a.add(expr) ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Call(a) ;} + {if (true) return new E_Call(a) ;} break; - } - case IF:{ + case IF: jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -5544,103 +5568,90 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} + {if (true) return new E_Conditional(expr, expr1, expr2) ;} break; - } - case STRLANG:{ + case STRLANG: jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLang(expr1, expr2) ;} + {if (true) return new E_StrLang(expr1, expr2) ;} break; - } - case STRDT:{ + case STRDT: jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} + {if (true) return new E_StrDatatype(expr1, expr2) ;} break; - } - case SAME_TERM:{ + case SAME_TERM: jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SameTerm(expr1, expr2) ;} + {if (true) return new E_SameTerm(expr1, expr2) ;} break; - } - case IS_IRI:{ + case IS_IRI: jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsIRI(expr) ;} + {if (true) return new E_IsIRI(expr) ;} break; - } - case IS_URI:{ + case IS_URI: jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsURI(expr) ;} + {if (true) return new E_IsURI(expr) ;} break; - } - case IS_BLANK:{ + case IS_BLANK: jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsBlank(expr) ;} + {if (true) return new E_IsBlank(expr) ;} break; - } - case IS_LITERAL:{ + case IS_LITERAL: jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsLiteral(expr) ;} + {if (true) return new E_IsLiteral(expr) ;} break; - } - case IS_NUMERIC:{ + case IS_NUMERIC: jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsNumeric(expr) ;} + {if (true) return new E_IsNumeric(expr) ;} break; - } - case REGEX:{ + case REGEX: expr = RegexExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case EXISTS:{ + case EXISTS: expr = ExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case NOT:{ + case NOT: expr = NotExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case IS_TRIPLE:{ + case IS_TRIPLE: jj_consume_token(IS_TRIPLE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsTriple(expr) ;} + {if (true) return new E_IsTriple(expr) ;} break; - } - case TRIPLE:{ + case TRIPLE: jj_consume_token(TRIPLE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5649,84 +5660,81 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod jj_consume_token(COMMA); expr3 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleFn(expr1, expr2, expr3) ;} + {if (true) return new E_TripleFn(expr1, expr2, expr3) ;} break; - } - case SUBJECT:{ + case SUBJECT: jj_consume_token(SUBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleSubject(expr) ;} + {if (true) return new E_TripleSubject(expr) ;} break; - } - case PREDICATE:{ + case PREDICATE: jj_consume_token(PREDICATE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TriplePredicate(expr) ;} + {if (true) return new E_TriplePredicate(expr) ;} break; - } - case OBJECT:{ + case OBJECT: jj_consume_token(OBJECT); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_TripleObject(expr) ;} + {if (true) return new E_TripleObject(expr) ;} break; - } default: - jj_la1[158] = jj_gen; + jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException { + Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); flagsExpr = Expression(); break; - } default: - jj_la1[159] = jj_gen; + jj_la1[163] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} + {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr3 = Expression(); break; - } default: - jj_la1[160] = jj_gen; + jj_la1[164] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} + {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -5734,61 +5742,61 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr4 = Expression(); break; - } default: - jj_la1[161] = jj_gen; + jj_la1[165] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} + {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ExistsFunc() throws ParseException {Element el ; + final public Expr ExistsFunc() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprExists(el) ;} + {if (true) return createExprExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NotExistsFunc() throws ParseException {Element el ; + final public Expr NotExistsFunc() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprNotExists(el) ;} + {if (true) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException { + Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; -startAggregate(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COUNT:{ + startAggregate(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[162] = jj_gen; + jj_la1[166] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -5815,6 +5823,7 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case VARIANCE: case VAR_SAMP: case VAR_POP: + case FOLD: case SAMPLE: case GROUP_CONCAT: case BOUND: @@ -5893,752 +5902,798 @@ final public void Annotation(TripleCollector acc, Node s, Node p, Path path, Nod case LT2: case BANG: case PLUS: - case MINUS:{ + case MINUS: expr = Expression(); break; - } default: - jj_la1[163] = jj_gen; + jj_la1[167] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); -if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } + if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - } - case SUM:{ + case SUM: t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[164] = jj_gen; + jj_la1[168] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSum(distinct, expr) ; + agg = AggregatorFactory.createSum(distinct, expr) ; break; - } - case MIN:{ + case MIN: t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[165] = jj_gen; + jj_la1[169] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMin(distinct, expr) ; + agg = AggregatorFactory.createMin(distinct, expr) ; break; - } - case MAX:{ + case MAX: t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[166] = jj_gen; + jj_la1[170] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMax(distinct, expr) ; + agg = AggregatorFactory.createMax(distinct, expr) ; break; - } - case AVG:{ + case AVG: t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[167] = jj_gen; + jj_la1[171] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createAvg(distinct, expr) ; + agg = AggregatorFactory.createAvg(distinct, expr) ; break; - } - case MEDIAN:{ + case MEDIAN: t = jj_consume_token(MEDIAN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[168] = jj_gen; + jj_la1[172] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMedian(distinct, expr) ; + agg = AggregatorFactory.createMedian(distinct, expr) ; break; - } - case MODE:{ + case MODE: t = jj_consume_token(MODE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[169] = jj_gen; + jj_la1[173] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMode(distinct, expr) ; + agg = AggregatorFactory.createMode(distinct, expr) ; break; - } - case SAMPLE:{ + case SAMPLE: t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[170] = jj_gen; + jj_la1[174] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSample(distinct, expr) ; + agg = AggregatorFactory.createSample(distinct, expr) ; break; - } - case GROUP_CONCAT:{ + case GROUP_CONCAT: t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[171] = jj_gen; + jj_la1[175] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: if (jj_2_5(2)) { jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[172] = jj_gen; + jj_la1[176] = jj_gen; ; } } else { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(ORDER); jj_consume_token(BY); expr2 = Expression(); -ordered.add(expr2) ; + ordered.add(expr2) ; break; - } default: - jj_la1[173] = jj_gen; + jj_la1[177] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } break; - } default: - jj_la1[174] = jj_gen; + jj_la1[178] = jj_gen; ; } jj_consume_token(RPAREN); -agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; + agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; - } - case STDEV:{ + case STDEV: t = jj_consume_token(STDEV); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[175] = jj_gen; + jj_la1[179] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev, distinct, expr) ; break; - } - case STDEV_SAMP:{ + case STDEV_SAMP: t = jj_consume_token(STDEV_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[176] = jj_gen; + jj_la1[180] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_samp, distinct, expr) ; break; - } - case STDEV_POP:{ + case STDEV_POP: t = jj_consume_token(STDEV_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[177] = jj_gen; + jj_la1[181] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.stdev_pop, distinct, expr) ; break; - } - case VARIANCE:{ + case VARIANCE: t = jj_consume_token(VARIANCE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[178] = jj_gen; + jj_la1[182] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.variance, distinct, expr) ; break; - } - case VAR_SAMP:{ + case VAR_SAMP: t = jj_consume_token(VAR_SAMP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[179] = jj_gen; + jj_la1[183] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; break; - } - case VAR_POP:{ + case VAR_POP: t = jj_consume_token(VAR_POP); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: - jj_la1[180] = jj_gen; + jj_la1[184] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; + agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; break; + case FOLD: + t = jj_consume_token(FOLD); + java.util.List scs = null ; + SortCondition sc = null ; + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: + jj_consume_token(DISTINCT); + distinct = true ; + break; + default: + jj_la1[185] = jj_gen; + ; + } + expr = Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + expr2 = Expression(); + break; + default: + jj_la1[186] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: + jj_consume_token(ORDER); + jj_consume_token(BY); + label_43: + while (true) { + sc = OrderConditionForAggregationFunction(); + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + case VAR1: + case VAR2: + case ASC: + case DESC: + case TRIPLE: + case IS_TRIPLE: + case SUBJECT: + case PREDICATE: + case OBJECT: + case EXISTS: + case NOT: + case AGG: + case COUNT: + case MIN: + case MAX: + case SUM: + case AVG: + case MEDIAN: + case MODE: + case STDEV: + case STDEV_SAMP: + case STDEV_POP: + case VARIANCE: + case VAR_SAMP: + case VAR_POP: + case FOLD: + case SAMPLE: + case GROUP_CONCAT: + case BOUND: + case COALESCE: + case IF: + case BNODE: + case IRI: + case URI: + case CALL: + case STR: + case STRLANG: + case STRDT: + case DTYPE: + case LANG: + case LANGMATCHES: + case IS_URI: + case IS_IRI: + case IS_BLANK: + case IS_LITERAL: + case IS_NUMERIC: + case REGEX: + case SAME_TERM: + case RAND: + case ABS: + case CEIL: + case FLOOR: + case ROUND: + case MOD: + case IDIV: + case CONCAT: + case SUBSTR: + case STRLEN: + case REPLACE: + case UCASE: + case LCASE: + case ENCODE_FOR_URI: + case CONTAINS: + case STRSTARTS: + case STRENDS: + case STRBEFORE: + case STRAFTER: + case YEAR: + case MONTH: + case DAY: + case HOURS: + case MINUTES: + case SECONDS: + case TIMEZONE: + case TZ: + case ADJUST: + case NOW: + case UUID: + case STRUUID: + case VERSION: + case MD5: + case SHA1: + case SHA256: + case SHA384: + case SHA512: + case LPAREN: + ; + break; + default: + jj_la1[187] = jj_gen; + break label_43; + } + } + break; + default: + jj_la1[188] = jj_gen; + ; } - case AGG:{ + jj_consume_token(RPAREN); + agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; + break; + case AGG: t = jj_consume_token(AGG); -String iri ; + String iri ; iri = iri(); -Args a = new Args() ; + Args a = new Args() ; a = ArgList(); -agg = AggregatorFactory.createCustom(iri, a) ; + agg = AggregatorFactory.createCustom(iri, a) ; break; - } default: - jj_la1[181] = jj_gen; + jj_la1[189] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( ! getAllowAggregatesInExpressions() ) + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: - jj_la1[182] = jj_gen; + jj_la1[190] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: - jj_la1[183] = jj_gen; + jj_la1[191] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: - jj_la1[184] = jj_gen; + jj_la1[192] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: - jj_la1[185] = jj_gen; + jj_la1[193] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[186] = jj_gen; + jj_la1[194] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[187] = jj_gen; + jj_la1[195] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: - jj_la1[188] = jj_gen; + jj_la1[196] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: - jj_la1[189] = jj_gen; + jj_la1[197] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: - jj_la1[190] = jj_gen; + jj_la1[198] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: - jj_la1[191] = jj_gen; + jj_la1[199] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[192] = jj_gen; + jj_la1[200] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: - jj_la1[193] = jj_gen; + jj_la1[201] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - private boolean jj_2_1(int xla) - { + private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_1()); } + try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - private boolean jj_2_2(int xla) - { + private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_2()); } + try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - private boolean jj_2_3(int xla) - { + private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_3()); } + try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - private boolean jj_2_4(int xla) - { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_4()); } + try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - private boolean jj_2_5(int xla) - { + private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return (!jj_3_5()); } + try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - private boolean jj_3R_RegexExpression_1516_5_120() - { - if (jj_scan_token(REGEX)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1510_5_110() - { - if (jj_scan_token(OBJECT)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1508_5_109() - { - if (jj_scan_token(PREDICATE)) return true; + private boolean jj_3R_101() { + if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1506_5_108() - { - if (jj_scan_token(SUBJECT)) return true; + private boolean jj_3R_100() { + if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1504_5_107() - { - if (jj_scan_token(TRIPLE)) return true; + private boolean jj_3R_99() { + if (jj_scan_token(IS_IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1501_5_105() - { - if (jj_3R_NotExistsFunc_1557_4_122()) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1502_3_106() - { - if (jj_scan_token(IS_TRIPLE)) return true; + private boolean jj_3R_98() { + if (jj_scan_token(SAME_TERM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1500_5_104() - { - if (jj_3R_ExistsFunc_1551_4_121()) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1499_5_103() - { - if (jj_3R_RegexExpression_1516_5_120()) return true; - return false; - } - - private boolean jj_3_2() - { + private boolean jj_3_2() { if (jj_scan_token(SEMICOLON)) return true; - if (jj_3R_Prologue_72_3_44()) return true; + if (jj_3R_45()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(147)) { - jj_scanpos = xsp; - if (jj_scan_token(148)) { - jj_scanpos = xsp; - if (jj_scan_token(155)) { + if (jj_scan_token(149)) { jj_scanpos = xsp; if (jj_scan_token(150)) { jj_scanpos = xsp; - if (jj_scan_token(151)) { + if (jj_scan_token(157)) { jj_scanpos = xsp; if (jj_scan_token(152)) { jj_scanpos = xsp; - if (jj_scan_token(149)) { + if (jj_scan_token(153)) { jj_scanpos = xsp; - if (jj_scan_token(160)) { + if (jj_scan_token(154)) { jj_scanpos = xsp; - if (jj_scan_token(143)) { + if (jj_scan_token(151)) { jj_scanpos = xsp; - if (jj_scan_token(142)) { + if (jj_scan_token(162)) { jj_scanpos = xsp; - if (jj_scan_token(161)) { + if (jj_scan_token(145)) { jj_scanpos = xsp; if (jj_scan_token(144)) { jj_scanpos = xsp; - if (jj_scan_token(145)) { + if (jj_scan_token(163)) { + jj_scanpos = xsp; + if (jj_scan_token(146)) { + jj_scanpos = xsp; + if (jj_scan_token(147)) { jj_scanpos = xsp; - if (jj_scan_token(146)) return true; + if (jj_scan_token(148)) return true; } } } @@ -6655,587 +6710,481 @@ private boolean jj_3_2() return false; } - private boolean jj_3R_Collection_1115_3_165() - { - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1496_5_102() - { - if (jj_scan_token(IS_NUMERIC)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1494_5_101() - { - if (jj_scan_token(IS_LITERAL)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1492_5_100() - { - if (jj_scan_token(IS_BLANK)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1490_5_99() - { - if (jj_scan_token(IS_URI)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1488_5_98() - { - if (jj_scan_token(IS_IRI)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1486_5_97() - { - if (jj_scan_token(SAME_TERM)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_BuiltInCall_1484_5_96() - { + private boolean jj_3R_97() { if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1482_5_95() - { + private boolean jj_3R_96() { if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1478_5_94() - { + private boolean jj_3R_95() { if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BlankNodePropertyList_1092_3_166() - { + private boolean jj_3R_168() { if (jj_scan_token(LBRACKET)) return true; return false; } - private boolean jj_3R_BuiltInCall_1471_5_93() - { + private boolean jj_3R_94() { if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_TriplesNode_1088_3_156() - { - if (jj_3R_BlankNodePropertyList_1092_3_166()) return true; + private boolean jj_3R_158() { + if (jj_3R_168()) return true; return false; } - private boolean jj_3R_BuiltInCall_1469_5_92() - { + private boolean jj_3R_93() { if (jj_scan_token(COALESCE)) return true; - if (jj_3R_ExpressionList_833_3_117()) return true; + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_BuiltInCall_1468_5_91() - { + private boolean jj_3R_92() { if (jj_scan_token(VERSION)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_TriplesNode_1086_3_126() - { + private boolean jj_3R_127() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesNode_1086_3_155()) { + if (jj_3R_157()) { jj_scanpos = xsp; - if (jj_3R_TriplesNode_1088_3_156()) return true; + if (jj_3R_158()) return true; } return false; } - private boolean jj_3R_TriplesNode_1086_3_155() - { - if (jj_3R_Collection_1115_3_165()) return true; + private boolean jj_3R_157() { + if (jj_3R_167()) return true; return false; } - private boolean jj_3R_BuiltInCall_1467_5_90() - { + private boolean jj_3R_91() { if (jj_scan_token(SHA512)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1466_5_89() - { + private boolean jj_3R_90() { if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1465_5_88() - { + private boolean jj_3R_89() { if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1464_5_87() - { + private boolean jj_3R_88() { if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1463_5_86() - { + private boolean jj_3R_87() { if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1462_5_85() - { + private boolean jj_3R_86() { if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1461_5_84() - { + private boolean jj_3R_85() { if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1460_5_83() - { + private boolean jj_3R_84() { if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1457_5_82() - { + private boolean jj_3R_83() { if (jj_scan_token(ADJUST)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1456_5_81() - { + private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1455_5_80() - { + private boolean jj_3R_81() { if (jj_scan_token(TIMEZONE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1454_5_79() - { + private boolean jj_3R_80() { if (jj_scan_token(SECONDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1453_5_78() - { + private boolean jj_3R_79() { if (jj_scan_token(MINUTES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1452_5_77() - { + private boolean jj_3R_78() { if (jj_scan_token(HOURS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1451_5_76() - { + private boolean jj_3R_77() { if (jj_scan_token(DAY)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1450_5_75() - { + private boolean jj_3R_76() { if (jj_scan_token(MONTH)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1449_5_74() - { + private boolean jj_3R_75() { if (jj_scan_token(YEAR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1447_5_73() - { + private boolean jj_3R_74() { if (jj_scan_token(STRAFTER)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1445_5_72() - { + private boolean jj_3R_73() { if (jj_scan_token(STRBEFORE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1443_5_71() - { + private boolean jj_3R_72() { if (jj_scan_token(STRENDS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1441_5_70() - { + private boolean jj_3R_71() { if (jj_scan_token(STRSTARTS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1439_5_69() - { + private boolean jj_3R_70() { if (jj_scan_token(CONTAINS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1438_5_68() - { + private boolean jj_3R_69() { if (jj_scan_token(ENCODE_FOR_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1437_5_67() - { + private boolean jj_3R_68() { if (jj_scan_token(LCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1436_5_66() - { + private boolean jj_3R_67() { if (jj_scan_token(UCASE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1435_5_65() - { - if (jj_3R_StrReplaceExpression_1540_3_119()) return true; + private boolean jj_3R_66() { + if (jj_3R_120()) return true; return false; } - private boolean jj_3R_BuiltInCall_1434_5_64() - { + private boolean jj_3R_65() { if (jj_scan_token(STRLEN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1433_5_63() - { - if (jj_3R_SubstringExpression_1528_5_118()) return true; + private boolean jj_3R_64() { + if (jj_3R_119()) return true; return false; } - private boolean jj_3R_BuiltInCall_1432_5_62() - { + private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; - if (jj_3R_ExpressionList_833_3_117()) return true; + if (jj_3R_118()) return true; return false; } - private boolean jj_3R_BuiltInCall_1431_5_61() - { + private boolean jj_3R_62() { if (jj_scan_token(IDIV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1430_5_60() - { + private boolean jj_3R_61() { if (jj_scan_token(MOD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1429_5_59() - { + private boolean jj_3R_60() { if (jj_scan_token(ROUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1428_5_58() - { + private boolean jj_3R_59() { if (jj_scan_token(FLOOR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1427_5_57() - { + private boolean jj_3R_58() { if (jj_scan_token(CEIL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1426_5_56() - { + private boolean jj_3R_57() { if (jj_scan_token(ABS)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1425_5_55() - { + private boolean jj_3R_56() { if (jj_scan_token(RAND)) return true; if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1423_7_116() - { + private boolean jj_3R_117() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_BuiltInCall_1420_7_115() - { + private boolean jj_3R_116() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1419_5_54() - { + private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1420_7_115()) { + if (jj_3R_116()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1423_7_116()) return true; + if (jj_3R_117()) return true; } return false; } - private boolean jj_3R_BuiltInCall_1417_5_53() - { + private boolean jj_3R_54() { if (jj_scan_token(URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1415_5_52() - { + private boolean jj_3R_53() { if (jj_scan_token(IRI)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1413_5_51() - { + private boolean jj_3R_52() { if (jj_scan_token(BOUND)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1411_5_50() - { + private boolean jj_3R_51() { if (jj_scan_token(DTYPE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1408_5_49() - { + private boolean jj_3R_50() { if (jj_scan_token(LANGMATCHES)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1406_5_48() - { + private boolean jj_3R_49() { if (jj_scan_token(LANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1404_5_47() - { + private boolean jj_3R_48() { if (jj_scan_token(STR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BuiltInCall_1402_5_46() - { - if (jj_3R_Aggregate_1567_3_114()) return true; + private boolean jj_3R_47() { + if (jj_3R_115()) return true; return false; } - private boolean jj_3R_BuiltInCall_1402_5_43() - { + private boolean jj_3R_44() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BuiltInCall_1402_5_46()) { + if (jj_3R_47()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1404_5_47()) { + if (jj_3R_48()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1406_5_48()) { + if (jj_3R_49()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1408_5_49()) { + if (jj_3R_50()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1411_5_50()) { + if (jj_3R_51()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1413_5_51()) { + if (jj_3R_52()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1415_5_52()) { + if (jj_3R_53()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1417_5_53()) { + if (jj_3R_54()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1419_5_54()) { + if (jj_3R_55()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1425_5_55()) { + if (jj_3R_56()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1426_5_56()) { + if (jj_3R_57()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1427_5_57()) { + if (jj_3R_58()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1428_5_58()) { + if (jj_3R_59()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1429_5_59()) { + if (jj_3R_60()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1430_5_60()) { + if (jj_3R_61()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1431_5_61()) { + if (jj_3R_62()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1432_5_62()) { + if (jj_3R_63()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1433_5_63()) { + if (jj_3R_64()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1434_5_64()) { + if (jj_3R_65()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1435_5_65()) { + if (jj_3R_66()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1436_5_66()) { + if (jj_3R_67()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1437_5_67()) { + if (jj_3R_68()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1438_5_68()) { + if (jj_3R_69()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1439_5_69()) { + if (jj_3R_70()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1441_5_70()) { + if (jj_3R_71()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1443_5_71()) { + if (jj_3R_72()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1445_5_72()) { + if (jj_3R_73()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1447_5_73()) { + if (jj_3R_74()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1449_5_74()) { + if (jj_3R_75()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1450_5_75()) { + if (jj_3R_76()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1451_5_76()) { + if (jj_3R_77()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1452_5_77()) { + if (jj_3R_78()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1453_5_78()) { + if (jj_3R_79()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1454_5_79()) { + if (jj_3R_80()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1455_5_80()) { + if (jj_3R_81()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1456_5_81()) { + if (jj_3R_82()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1457_5_82()) { + if (jj_3R_83()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1460_5_83()) { + if (jj_3R_84()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1461_5_84()) { + if (jj_3R_85()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1462_5_85()) { + if (jj_3R_86()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1463_5_86()) { + if (jj_3R_87()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1464_5_87()) { + if (jj_3R_88()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1465_5_88()) { + if (jj_3R_89()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1466_5_89()) { + if (jj_3R_90()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1467_5_90()) { + if (jj_3R_91()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1468_5_91()) { + if (jj_3R_92()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1469_5_92()) { + if (jj_3R_93()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1471_5_93()) { + if (jj_3R_94()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1478_5_94()) { + if (jj_3R_95()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1482_5_95()) { + if (jj_3R_96()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1484_5_96()) { + if (jj_3R_97()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1486_5_97()) { + if (jj_3R_98()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1488_5_98()) { + if (jj_3R_99()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1490_5_99()) { + if (jj_3R_100()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1492_5_100()) { + if (jj_3R_101()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1494_5_101()) { + if (jj_3R_102()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1496_5_102()) { + if (jj_3R_103()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1499_5_103()) { + if (jj_3R_104()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1500_5_104()) { + if (jj_3R_105()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1501_5_105()) { + if (jj_3R_106()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1502_3_106()) { + if (jj_3R_107()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1504_5_107()) { + if (jj_3R_108()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1506_5_108()) { + if (jj_3R_109()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1508_5_109()) { + if (jj_3R_110()) { jj_scanpos = xsp; - if (jj_3R_BuiltInCall_1510_5_110()) return true; + if (jj_3R_111()) return true; } } } @@ -7303,300 +7252,262 @@ private boolean jj_3R_BuiltInCall_1402_5_43() return false; } - private boolean jj_3R_IRIREF_1727_3_158() - { + private boolean jj_3R_160() { if (jj_scan_token(IRIref)) return true; return false; } - private boolean jj_3R_BlankNode_1723_3_176() - { + private boolean jj_3R_178() { if (jj_scan_token(ANON)) return true; return false; } - private boolean jj_3R_BlankNode_1720_3_163() - { + private boolean jj_3R_165() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BlankNode_1720_3_175()) { + if (jj_3R_177()) { jj_scanpos = xsp; - if (jj_3R_BlankNode_1723_3_176()) return true; + if (jj_3R_178()) return true; } return false; } - private boolean jj_3R_BlankNode_1720_3_175() - { + private boolean jj_3R_177() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; } - private boolean jj_3R_PrefixedName_1714_5_186() - { + private boolean jj_3R_188() { if (jj_scan_token(PNAME_NS)) return true; return false; } - private boolean jj_3R_PrefixedName_1711_5_185() - { + private boolean jj_3R_187() { if (jj_scan_token(PNAME_LN)) return true; return false; } - private boolean jj_3R_GroupGraphPattern_564_3_144() - { - if (jj_scan_token(LBRACE)) return true; - return false; - } - - private boolean jj_3_3() - { - if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_861_3_45()) return true; - return false; - } - - private boolean jj_3R_PrefixedName_1711_3_177() - { + private boolean jj_3R_179() { Token xsp; xsp = jj_scanpos; - if (jj_3R_PrefixedName_1711_5_185()) { + if (jj_3R_187()) { jj_scanpos = xsp; - if (jj_3R_PrefixedName_1714_5_186()) return true; + if (jj_3R_188()) return true; } return false; } - private boolean jj_3R_iri_1707_3_168() - { - if (jj_3R_PrefixedName_1711_3_177()) return true; + private boolean jj_3R_170() { + if (jj_3R_179()) return true; return false; } - private boolean jj_3R_iri_1705_3_157() - { + private boolean jj_3R_159() { Token xsp; xsp = jj_scanpos; - if (jj_3R_iri_1705_3_167()) { + if (jj_3R_169()) { jj_scanpos = xsp; - if (jj_3R_iri_1707_3_168()) return true; + if (jj_3R_170()) return true; } return false; } - private boolean jj_3R_iri_1705_3_167() - { - if (jj_3R_IRIREF_1727_3_158()) return true; + private boolean jj_3R_169() { + if (jj_3R_160()) return true; return false; } - private boolean jj_3R_String_1696_5_181() - { + private boolean jj_3R_183() { if (jj_scan_token(STRING_LITERAL_LONG2)) return true; return false; } - private boolean jj_3R_String_1695_5_180() - { + private boolean jj_3R_182() { if (jj_scan_token(STRING_LITERAL_LONG1)) return true; return false; } - private boolean jj_3R_String_1694_5_179() - { + private boolean jj_3R_181() { if (jj_scan_token(STRING_LITERAL2)) return true; return false; } - private boolean jj_3R_String_1693_5_178() - { + private boolean jj_3R_180() { if (jj_scan_token(STRING_LITERAL1)) return true; return false; } - private boolean jj_3R_String_1693_3_169() - { + private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_String_1693_5_178()) { + if (jj_3R_180()) { jj_scanpos = xsp; - if (jj_3R_String_1694_5_179()) { + if (jj_3R_181()) { jj_scanpos = xsp; - if (jj_3R_String_1695_5_180()) { + if (jj_3R_182()) { jj_scanpos = xsp; - if (jj_3R_String_1696_5_181()) return true; + if (jj_3R_183()) return true; } } } return false; } - private boolean jj_3R_BooleanLiteral_1689_3_174() - { + private boolean jj_3R_176() { if (jj_scan_token(FALSE)) return true; return false; } - private boolean jj_3R_BooleanLiteral_1687_3_162() - { + private boolean jj_3R_164() { Token xsp; xsp = jj_scanpos; - if (jj_3R_BooleanLiteral_1687_3_173()) { + if (jj_3R_175()) { jj_scanpos = xsp; - if (jj_3R_BooleanLiteral_1689_3_174()) return true; + if (jj_3R_176()) return true; } return false; } - private boolean jj_3R_BooleanLiteral_1687_3_173() - { + private boolean jj_3R_175() { if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1683_3_195() - { + private boolean jj_3R_197() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1682_3_194() - { + private boolean jj_3R_196() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1681_3_193() - { + private boolean jj_3R_195() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralNegative_1681_3_184() - { + private boolean jj_3R_186() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralNegative_1681_3_193()) { + if (jj_3R_195()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1682_3_194()) { + if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralNegative_1683_3_195()) return true; + if (jj_3R_197()) return true; } } return false; } - private boolean jj_3R_NumericLiteralPositive_1677_3_192() - { + private boolean jj_3R_146() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_194() { if (jj_scan_token(DOUBLE_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1676_3_191() - { + private boolean jj_3R_193() { if (jj_scan_token(DECIMAL_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1675_3_190() - { + private boolean jj_3R_192() { if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } - private boolean jj_3R_NumericLiteralPositive_1675_3_183() - { + private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralPositive_1675_3_190()) { + if (jj_3R_192()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1676_3_191()) { + if (jj_3R_193()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralPositive_1677_3_192()) return true; + if (jj_3R_194()) return true; } } return false; } - private boolean jj_3R_NumericLiteralUnsigned_1671_3_189() - { + private boolean jj_3R_191() { if (jj_scan_token(DOUBLE)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1670_3_188() - { + private boolean jj_3R_190() { if (jj_scan_token(DECIMAL)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1669_3_187() - { + private boolean jj_3R_189() { if (jj_scan_token(INTEGER)) return true; return false; } - private boolean jj_3R_NumericLiteralUnsigned_1669_3_182() - { + private boolean jj_3R_184() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteralUnsigned_1669_3_187()) { + if (jj_3R_189()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1670_3_188()) { + if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteralUnsigned_1671_3_189()) return true; + if (jj_3R_191()) return true; } } return false; } - private boolean jj_3R_NumericLiteral_1663_5_172() - { - if (jj_3R_NumericLiteralNegative_1681_3_184()) return true; + private boolean jj_3R_174() { + if (jj_3R_186()) return true; return false; } - private boolean jj_3R_NumericLiteral_1662_5_171() - { - if (jj_3R_NumericLiteralPositive_1675_3_183()) return true; + private boolean jj_3R_173() { + if (jj_3R_185()) return true; return false; } - private boolean jj_3R_NumericLiteral_1661_5_170() - { - if (jj_3R_NumericLiteralUnsigned_1669_3_182()) return true; + private boolean jj_3R_172() { + if (jj_3R_184()) return true; return false; } - private boolean jj_3R_NumericLiteral_1660_3_161() - { + private boolean jj_3R_163() { Token xsp; xsp = jj_scanpos; - if (jj_3R_NumericLiteral_1661_5_170()) { + if (jj_3R_172()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1662_5_171()) { + if (jj_3R_173()) { jj_scanpos = xsp; - if (jj_3R_NumericLiteral_1663_5_172()) return true; + if (jj_3R_174()) return true; } } return false; } - private boolean jj_3_1() - { - if (jj_3R_BuiltInCall_1402_5_43()) return true; + private boolean jj_3R_162() { + if (jj_3R_171()) return true; return false; } - private boolean jj_3R_RDFLiteral_1649_3_160() - { - if (jj_3R_String_1693_3_169()) return true; + private boolean jj_3R_144() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_159()) return true; return false; } - private boolean jj_3R_Var_1247_5_159() - { + private boolean jj_3R_161() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7606,272 +7517,211 @@ private boolean jj_3R_Var_1247_5_159() return false; } - private boolean jj_3R_TriplesSameSubject_864_3_113() - { - if (jj_3R_TriplesNode_1086_3_126()) return true; + private boolean jj_3R_114() { + if (jj_3R_127()) return true; return false; } - private boolean jj_3R_TriplesSameSubject_861_3_45() - { + private boolean jj_3R_46() { Token xsp; xsp = jj_scanpos; - if (jj_3R_TriplesSameSubject_861_3_112()) { + if (jj_3R_113()) { jj_scanpos = xsp; - if (jj_3R_TriplesSameSubject_864_3_113()) return true; + if (jj_3R_114()) return true; } return false; } - private boolean jj_3R_TriplesSameSubject_861_3_112() - { - if (jj_3R_VarOrTerm_1196_3_125()) return true; + private boolean jj_3R_113() { + if (jj_3R_126()) return true; return false; } - private boolean jj_3_4() - { + private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; - if (jj_3R_TriplesSameSubject_861_3_45()) return true; - return false; - } - - private boolean jj_3R_Prologue_72_18_124() - { - if (jj_3R_PrefixDecl_81_5_146()) return true; + if (jj_3R_46()) return true; return false; } - private boolean jj_3R_Aggregate_1614_5_142() - { - if (jj_scan_token(AGG)) return true; - if (jj_3R_iri_1705_3_157()) return true; + private boolean jj_3_1() { + if (jj_3R_44()) return true; return false; } - private boolean jj_3R_PrefixDecl_81_5_146() - { - if (jj_scan_token(PREFIX)) return true; - if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_IRIREF_1727_3_158()) return true; + private boolean jj_3R_143() { + if (jj_scan_token(FOLD)) return true; + if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1612_5_141() - { + private boolean jj_3R_142() { if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1610_5_140() - { + private boolean jj_3R_141() { if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1608_5_139() - { + private boolean jj_3R_140() { if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_BaseDecl_76_3_145() - { - if (jj_scan_token(BASE)) return true; - if (jj_3R_IRIREF_1727_3_158()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1606_5_138() - { + private boolean jj_3R_139() { if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_72_5_111() - { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_Prologue_72_5_123()) { - jj_scanpos = xsp; - if (jj_3R_Prologue_72_18_124()) return true; - } - return false; - } - - private boolean jj_3R_Prologue_72_5_123() - { - if (jj_3R_BaseDecl_76_3_145()) return true; - return false; - } - - private boolean jj_3R_Aggregate_1604_5_137() - { + private boolean jj_3R_138() { if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Prologue_72_3_44() - { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_Prologue_72_5_111()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_ExpressionList_836_5_143() - { + private boolean jj_3R_145() { if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1602_5_136() - { + private boolean jj_3R_137() { if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_ExpressionList_833_3_117() - { + private boolean jj_3R_118() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(185)) { + if (jj_scan_token(187)) { jj_scanpos = xsp; - if (jj_3R_ExpressionList_836_5_143()) return true; + if (jj_3R_145()) return true; } return false; } - private boolean jj_3_5() - { + private boolean jj_3_5() { if (jj_scan_token(SEMICOLON)) return true; if (jj_scan_token(SEPARATOR)) return true; return false; } - private boolean jj_3R_QuotedTriple_1209_3_164() - { + private boolean jj_3R_166() { if (jj_scan_token(LT2)) return true; return false; } - private boolean jj_3R_Aggregate_1589_5_135() - { + private boolean jj_3R_136() { if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1587_5_134() - { + private boolean jj_3R_135() { if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1203_5_154() - { - if (jj_3R_QuotedTriple_1209_3_164()) return true; + private boolean jj_3R_156() { + if (jj_3R_166()) return true; return false; } - private boolean jj_3R_VarOrTerm_1202_5_153() - { + private boolean jj_3R_155() { if (jj_scan_token(NIL)) return true; return false; } - private boolean jj_3R_Aggregate_1585_5_133() - { + private boolean jj_3R_134() { if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1201_5_152() - { - if (jj_3R_BlankNode_1720_3_163()) return true; + private boolean jj_3R_125() { + if (jj_3R_148()) return true; + return false; + } + + private boolean jj_3R_154() { + if (jj_3R_165()) return true; return false; } - private boolean jj_3R_VarOrTerm_1200_5_151() - { - if (jj_3R_BooleanLiteral_1687_3_162()) return true; + private boolean jj_3R_153() { + if (jj_3R_164()) return true; return false; } - private boolean jj_3R_Aggregate_1583_5_132() - { + private boolean jj_3R_133() { if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1199_5_150() - { - if (jj_3R_NumericLiteral_1660_3_161()) return true; + private boolean jj_3R_152() { + if (jj_3R_163()) return true; return false; } - private boolean jj_3R_VarOrTerm_1198_5_149() - { - if (jj_3R_RDFLiteral_1649_3_160()) return true; + private boolean jj_3R_151() { + if (jj_3R_162()) return true; return false; } - private boolean jj_3R_Aggregate_1581_5_131() - { + private boolean jj_3R_132() { if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1197_5_148() - { - if (jj_3R_iri_1705_3_157()) return true; + private boolean jj_3R_148() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_160()) return true; + return false; + } + + private boolean jj_3R_150() { + if (jj_3R_159()) return true; return false; } - private boolean jj_3R_VarOrTerm_1196_5_147() - { - if (jj_3R_Var_1247_5_159()) return true; + private boolean jj_3R_149() { + if (jj_3R_161()) return true; return false; } - private boolean jj_3R_Aggregate_1579_5_130() - { + private boolean jj_3R_131() { if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_VarOrTerm_1196_3_125() - { + private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; - if (jj_3R_VarOrTerm_1196_5_147()) { + if (jj_3R_149()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1197_5_148()) { + if (jj_3R_150()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1198_5_149()) { + if (jj_3R_151()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1199_5_150()) { + if (jj_3R_152()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1200_5_151()) { + if (jj_3R_153()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1201_5_152()) { + if (jj_3R_154()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1202_5_153()) { + if (jj_3R_155()) { jj_scanpos = xsp; - if (jj_3R_VarOrTerm_1203_5_154()) return true; + if (jj_3R_156()) return true; } } } @@ -7882,62 +7732,91 @@ private boolean jj_3R_VarOrTerm_1196_3_125() return false; } - private boolean jj_3R_Aggregate_1577_5_129() - { + private boolean jj_3R_130() { if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1575_5_128() - { + private boolean jj_3R_129() { if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1568_5_127() - { + private boolean jj_3R_147() { + if (jj_scan_token(BASE)) return true; + if (jj_3R_160()) return true; + return false; + } + + private boolean jj_3R_112() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_124()) { + jj_scanpos = xsp; + if (jj_3R_125()) return true; + } + return false; + } + + private boolean jj_3R_124() { + if (jj_3R_147()) return true; + return false; + } + + private boolean jj_3R_45() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_112()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_128() { if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_Aggregate_1567_3_114() - { + private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; - if (jj_3R_Aggregate_1568_5_127()) { + if (jj_3R_128()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1575_5_128()) { + if (jj_3R_129()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1577_5_129()) { + if (jj_3R_130()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1579_5_130()) { + if (jj_3R_131()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1581_5_131()) { + if (jj_3R_132()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1583_5_132()) { + if (jj_3R_133()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1585_5_133()) { + if (jj_3R_134()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1587_5_134()) { + if (jj_3R_135()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1589_5_135()) { + if (jj_3R_136()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1602_5_136()) { + if (jj_3R_137()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1604_5_137()) { + if (jj_3R_138()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1606_5_138()) { + if (jj_3R_139()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1608_5_139()) { + if (jj_3R_140()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1610_5_140()) { + if (jj_3R_141()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1612_5_141()) { + if (jj_3R_142()) { jj_scanpos = xsp; - if (jj_3R_Aggregate_1614_5_142()) return true; + if (jj_3R_143()) { + jj_scanpos = xsp; + if (jj_3R_144()) return true; + } } } } @@ -7956,34 +7835,98 @@ private boolean jj_3R_Aggregate_1567_3_114() return false; } - private boolean jj_3R_NotExistsFunc_1557_4_122() - { + private boolean jj_3R_123() { if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } - private boolean jj_3R_ExistsFunc_1551_4_121() - { + private boolean jj_3R_122() { if (jj_scan_token(EXISTS)) return true; - if (jj_3R_GroupGraphPattern_564_3_144()) return true; + if (jj_3R_146()) return true; return false; } - private boolean jj_3R_StrReplaceExpression_1540_3_119() - { + private boolean jj_3R_120() { if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } - private boolean jj_3R_SubstringExpression_1528_5_118() - { + private boolean jj_3R_119() { if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } + private boolean jj_3R_121() { + if (jj_scan_token(REGEX)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_111() { + if (jj_scan_token(OBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_110() { + if (jj_scan_token(PREDICATE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_scan_token(SUBJECT)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_scan_token(TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_106() { + if (jj_3R_123()) return true; + return false; + } + + private boolean jj_3R_107() { + if (jj_scan_token(IS_TRIPLE)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_105() { + if (jj_3R_122()) return true; + return false; + } + + private boolean jj_3R_104() { + if (jj_3R_121()) return true; + return false; + } + + private boolean jj_3R_167() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_103() { + if (jj_scan_token(IS_NUMERIC)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_102() { + if (jj_scan_token(IS_LITERAL)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7995,7 +7938,7 @@ private boolean jj_3R_SubstringExpression_1528_5_118() private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[194]; + final private int[] jj_la1 = new int[202]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -8005,201 +7948,187 @@ private boolean jj_3R_SubstringExpression_1528_5_118() static private int[] jj_la1_6; static private int[] jj_la1_7; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - jj_la1_init_7(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0fe0000,0xf0fe0000,0xf0fe0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0fe0000,0x1000000,0xf0fe0000,0xf0fe0000,0xf0fe0018,0x18,0xf0fe0000,0xf0fe0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xc1f602,0x0,0x0,0x0,0x0,0xc1f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x800,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0fe0000,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0xf0fe0000,0x0,0x0,0x0,0x0,0xf0fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0xff2f6fff,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0xc00000,0x0,0xc00000,0xc00000,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0xff2f6fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xc00,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_7() { - jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + jj_la1_init_7(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x2000000,0xe1fc0000,0xe1fc0000,0xe1fc0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x4000000,0x8000000,0x0,0x0,0xe1fc0000,0x2000000,0xe1fc0000,0xe1fc0000,0xe1fc0018,0x18,0xe1fc0000,0xe1fc0018,0x18,0xe1fc0000,0xe1fc0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x183f602,0x0,0x0,0x0,0x0,0x183f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0000,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0000,0x0,0x0,0x0,0x0,0xe1fc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe1fc0018,0x0,0xe0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000000,0x3000000,0x0,0x3000000,0x3000000,0x0,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x3000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfcbdbfff,0x0,0x3fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3000,0x3000,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x7dff,0x7dff,0x7dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x1dff,0x1dff,0x1dff,0x0,0x1dff,0x1dff,0x0,0x1dff,0x1dff,0x0,0x0,0x0,0x0,0x0,0x27ff0000,0x27ff0000,0x10000000,0x40000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x10000,0x30000,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x6000,0x6000,0x6000,0x0,0x0,0x6000,0x0,0x6000,0x0,0x0,0x6000,0x0,0x0,0x6000,0x6000,0x0,0x0,0x10000000,0x0,0x6000,0x0,0x0,0x0,0x6000,0x0,0x6000,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x6000,0x0,0x0,0x6000,0x6000,0x6000,0x0,0x6000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dff,0x7dff,0x6000,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x7dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e03fe0,0x0,0x3e03fe0,0x3e03fe0,0x3e03fe0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x1e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x8,0x0,0x0,0x1,0x3,0x4be03fe0,0x0,0x0,0x4be03fe0,0x4be03fe0,0x4be03fe0,0x10000000,0x0,0x4be03fe0,0x0,0x4be03fe0,0x0,0x0,0x4be03fe0,0x10000000,0x0,0x4be03fe0,0x4be03fe0,0x0,0x10000000,0x0,0xa000000,0x1e03fe0,0x0,0xa000000,0xa000000,0x1e03fe0,0xa000000,0x1e03fe0,0x0,0x0,0x2000000,0x0,0x0,0xa000000,0x0,0xa000000,0x0,0x4be03fe0,0x0,0x0,0x0,0x0,0x0,0x4be03fe0,0x2000000,0x2000000,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x10000000,0x2000000,0x20000020,0x20000000,0x20,0x10000000,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x42000000,0x42000000,0x4be03fe0,0x4be03fe0,0x0,0x0,0x4be03fe0,0x4be03fe0,0x9e03fe0,0x0,0x1e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f00,0x3f00,0x0,0x0,0x3f00,0x0,0x0,0x3e03fe0,0x3e03fe0,0x1e03fe0,0x0,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e03fe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0xa000000,0x0,0x0,0x3fe0,0xe0,0x700,0x3800,0x0,0x1e00000,0x0,0x0,0x0,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x801,0x0,0x8,0x801,0x801,0x801,0x0,0x8,0x801,0x0,0x801,0x8,0x0,0x801,0x0,0x8,0x801,0x801,0x8,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x800,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x8,0x801,0x0,0x2,0x0,0x0,0x4,0x801,0x8004000,0x8004000,0x2,0x8004000,0x8004000,0x4,0x4000000,0x8400000,0x8400000,0x40280000,0x8004000,0x0,0x4,0x280004,0x40280000,0x4000,0x4000000,0x8000000,0x8000000,0x0,0x8000000,0x0,0x0,0x801,0x801,0x1000,0x1000,0x801,0x801,0x801,0x0,0x800,0x0,0x1,0x0,0x20000,0x40000,0x3f0,0x3f0,0x180000,0x0,0x600000,0x600000,0x180000,0x600000,0x600000,0x184800,0x800,0x800,0x4,0x4,0x0,0x4,0x4,0x0,0x4,0x4,0x4,0x0,0x384800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,}; + } + private static void jj_la1_init_7() { + jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } final private JJCalls[] jj_2_rtns = new JJCalls[5]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with InputStream. */ public ARQParser(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public ARQParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor. */ public ARQParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ARQParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ARQParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new ARQParserTokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor with generated Token Manager. */ public ARQParser(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(ARQParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 194; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 202; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - @SuppressWarnings("serial") - static private final class LookaheadSuccess extends java.lang.Error { - @Override - public Throwable fillInStackTrace() { - return this; - } - } - static private final LookaheadSuccess jj_ls = new LookaheadSuccess(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -8209,103 +8138,86 @@ private int jj_ntk_f() { private int jj_endpos; private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) { - return; - } - - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - - for (int[] oldentry : jj_expentries) { - if (oldentry.length == jj_expentry.length) { - boolean isMatched = true; - - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - isMatched = false; - break; - } - - } - if (isMatched) { - jj_expentries.add(jj_expentry); - break; - } - } - } - - if (pos != 0) { - jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + exists = true; + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.add(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } } /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[233]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 194; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 202; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - } - } - p = p.next; - } while (p != null); - - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; + jj_rescan = true; + for (int i = 0; i < 5; i++) { + try { + JJCalls p = jj_2_rtns[i]; + do { + if (p.gen > jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; } private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - - p.gen = jj_gen + xla - jj_la; - p.first = token; - p.arg = xla; + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; + int gen; + Token first; + int arg; + JJCalls next; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java index 047bd0d0a0d..d5ef5ce7333 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserConstants.java @@ -97,373 +97,377 @@ public interface ARQParserConstants { /** RegularExpression Id. */ int LATERAL = 48; /** RegularExpression Id. */ - int TRIPLE = 49; + int UNFOLD = 49; /** RegularExpression Id. */ - int IS_TRIPLE = 50; + int TRIPLE = 50; /** RegularExpression Id. */ - int SUBJECT = 51; + int IS_TRIPLE = 51; /** RegularExpression Id. */ - int PREDICATE = 52; + int SUBJECT = 52; /** RegularExpression Id. */ - int OBJECT = 53; + int PREDICATE = 53; /** RegularExpression Id. */ - int EXISTS = 54; + int OBJECT = 54; /** RegularExpression Id. */ - int NOT = 55; + int EXISTS = 55; /** RegularExpression Id. */ - int AS = 56; + int NOT = 56; /** RegularExpression Id. */ - int GROUP = 57; + int AS = 57; /** RegularExpression Id. */ - int HAVING = 58; + int GROUP = 58; /** RegularExpression Id. */ - int SEPARATOR = 59; + int HAVING = 59; /** RegularExpression Id. */ - int AGG = 60; + int SEPARATOR = 60; /** RegularExpression Id. */ - int COUNT = 61; + int AGG = 61; /** RegularExpression Id. */ - int MIN = 62; + int COUNT = 62; /** RegularExpression Id. */ - int MAX = 63; + int MIN = 63; /** RegularExpression Id. */ - int SUM = 64; + int MAX = 64; /** RegularExpression Id. */ - int AVG = 65; + int SUM = 65; /** RegularExpression Id. */ - int MEDIAN = 66; + int AVG = 66; /** RegularExpression Id. */ - int MODE = 67; + int MEDIAN = 67; /** RegularExpression Id. */ - int STDEV = 68; + int MODE = 68; /** RegularExpression Id. */ - int STDEV_SAMP = 69; + int STDEV = 69; /** RegularExpression Id. */ - int STDEV_POP = 70; + int STDEV_SAMP = 70; /** RegularExpression Id. */ - int VARIANCE = 71; + int STDEV_POP = 71; /** RegularExpression Id. */ - int VAR_SAMP = 72; + int VARIANCE = 72; /** RegularExpression Id. */ - int VAR_POP = 73; + int VAR_SAMP = 73; /** RegularExpression Id. */ - int SAMPLE = 74; + int VAR_POP = 74; /** RegularExpression Id. */ - int GROUP_CONCAT = 75; + int FOLD = 75; /** RegularExpression Id. */ - int FILTER = 76; + int SAMPLE = 76; /** RegularExpression Id. */ - int BOUND = 77; + int GROUP_CONCAT = 77; /** RegularExpression Id. */ - int COALESCE = 78; + int FILTER = 78; /** RegularExpression Id. */ - int IN = 79; + int BOUND = 79; /** RegularExpression Id. */ - int IF = 80; + int COALESCE = 80; /** RegularExpression Id. */ - int BNODE = 81; + int IN = 81; /** RegularExpression Id. */ - int IRI = 82; + int IF = 82; /** RegularExpression Id. */ - int URI = 83; + int BNODE = 83; /** RegularExpression Id. */ - int CAST = 84; + int IRI = 84; /** RegularExpression Id. */ - int CALL = 85; + int URI = 85; /** RegularExpression Id. */ - int MULTI = 86; + int CAST = 86; /** RegularExpression Id. */ - int SHORTEST = 87; + int CALL = 87; /** RegularExpression Id. */ - int STR = 88; + int MULTI = 88; /** RegularExpression Id. */ - int STRLANG = 89; + int SHORTEST = 89; /** RegularExpression Id. */ - int STRDT = 90; + int STR = 90; /** RegularExpression Id. */ - int DTYPE = 91; + int STRLANG = 91; /** RegularExpression Id. */ - int LANG = 92; + int STRDT = 92; /** RegularExpression Id. */ - int LANGMATCHES = 93; + int DTYPE = 93; /** RegularExpression Id. */ - int IS_URI = 94; + int LANG = 94; /** RegularExpression Id. */ - int IS_IRI = 95; + int LANGMATCHES = 95; /** RegularExpression Id. */ - int IS_BLANK = 96; + int IS_URI = 96; /** RegularExpression Id. */ - int IS_LITERAL = 97; + int IS_IRI = 97; /** RegularExpression Id. */ - int IS_NUMERIC = 98; + int IS_BLANK = 98; /** RegularExpression Id. */ - int REGEX = 99; + int IS_LITERAL = 99; /** RegularExpression Id. */ - int SAME_TERM = 100; + int IS_NUMERIC = 100; /** RegularExpression Id. */ - int RAND = 101; + int REGEX = 101; /** RegularExpression Id. */ - int ABS = 102; + int SAME_TERM = 102; /** RegularExpression Id. */ - int CEIL = 103; + int RAND = 103; /** RegularExpression Id. */ - int FLOOR = 104; + int ABS = 104; /** RegularExpression Id. */ - int ROUND = 105; + int CEIL = 105; /** RegularExpression Id. */ - int MOD = 106; + int FLOOR = 106; /** RegularExpression Id. */ - int IDIV = 107; + int ROUND = 107; /** RegularExpression Id. */ - int CONCAT = 108; + int MOD = 108; /** RegularExpression Id. */ - int SUBSTR = 109; + int IDIV = 109; /** RegularExpression Id. */ - int STRLEN = 110; + int CONCAT = 110; /** RegularExpression Id. */ - int REPLACE = 111; + int SUBSTR = 111; /** RegularExpression Id. */ - int UCASE = 112; + int STRLEN = 112; /** RegularExpression Id. */ - int LCASE = 113; + int REPLACE = 113; /** RegularExpression Id. */ - int ENCODE_FOR_URI = 114; + int UCASE = 114; /** RegularExpression Id. */ - int CONTAINS = 115; + int LCASE = 115; /** RegularExpression Id. */ - int STRSTARTS = 116; + int ENCODE_FOR_URI = 116; /** RegularExpression Id. */ - int STRENDS = 117; + int CONTAINS = 117; /** RegularExpression Id. */ - int STRBEFORE = 118; + int STRSTARTS = 118; /** RegularExpression Id. */ - int STRAFTER = 119; + int STRENDS = 119; /** RegularExpression Id. */ - int YEAR = 120; + int STRBEFORE = 120; /** RegularExpression Id. */ - int MONTH = 121; + int STRAFTER = 121; /** RegularExpression Id. */ - int DAY = 122; + int YEAR = 122; /** RegularExpression Id. */ - int HOURS = 123; + int MONTH = 123; /** RegularExpression Id. */ - int MINUTES = 124; + int DAY = 124; /** RegularExpression Id. */ - int SECONDS = 125; + int HOURS = 125; /** RegularExpression Id. */ - int TIMEZONE = 126; + int MINUTES = 126; /** RegularExpression Id. */ - int TZ = 127; + int SECONDS = 127; /** RegularExpression Id. */ - int ADJUST = 128; + int TIMEZONE = 128; /** RegularExpression Id. */ - int NOW = 129; + int TZ = 129; /** RegularExpression Id. */ - int UUID = 130; + int ADJUST = 130; /** RegularExpression Id. */ - int STRUUID = 131; + int NOW = 131; /** RegularExpression Id. */ - int VERSION = 132; + int UUID = 132; /** RegularExpression Id. */ - int MD5 = 133; + int STRUUID = 133; /** RegularExpression Id. */ - int SHA1 = 134; + int VERSION = 134; /** RegularExpression Id. */ - int SHA224 = 135; + int MD5 = 135; /** RegularExpression Id. */ - int SHA256 = 136; + int SHA1 = 136; /** RegularExpression Id. */ - int SHA384 = 137; + int SHA224 = 137; /** RegularExpression Id. */ - int SHA512 = 138; + int SHA256 = 138; /** RegularExpression Id. */ - int TRUE = 139; + int SHA384 = 139; /** RegularExpression Id. */ - int FALSE = 140; + int SHA512 = 140; /** RegularExpression Id. */ - int DATA = 141; + int TRUE = 141; /** RegularExpression Id. */ - int INSERT = 142; + int FALSE = 142; /** RegularExpression Id. */ - int DELETE = 143; + int DATA = 143; /** RegularExpression Id. */ - int INSERT_DATA = 144; + int INSERT = 144; /** RegularExpression Id. */ - int DELETE_DATA = 145; + int DELETE = 145; /** RegularExpression Id. */ - int DELETE_WHERE = 146; + int INSERT_DATA = 146; /** RegularExpression Id. */ - int LOAD = 147; + int DELETE_DATA = 147; /** RegularExpression Id. */ - int CLEAR = 148; + int DELETE_WHERE = 148; /** RegularExpression Id. */ - int CREATE = 149; + int LOAD = 149; /** RegularExpression Id. */ - int ADD = 150; + int CLEAR = 150; /** RegularExpression Id. */ - int MOVE = 151; + int CREATE = 151; /** RegularExpression Id. */ - int COPY = 152; + int ADD = 152; /** RegularExpression Id. */ - int META = 153; + int MOVE = 153; /** RegularExpression Id. */ - int SILENT = 154; + int COPY = 154; /** RegularExpression Id. */ - int DROP = 155; + int META = 155; /** RegularExpression Id. */ - int INTO = 156; + int SILENT = 156; /** RegularExpression Id. */ - int TO = 157; + int DROP = 157; /** RegularExpression Id. */ - int DFT = 158; + int INTO = 158; /** RegularExpression Id. */ - int ALL = 159; + int TO = 159; /** RegularExpression Id. */ - int WITH = 160; + int DFT = 160; /** RegularExpression Id. */ - int USING = 161; + int ALL = 161; /** RegularExpression Id. */ - int DIGITS = 162; + int WITH = 162; /** RegularExpression Id. */ - int INTEGER = 163; + int USING = 163; /** RegularExpression Id. */ - int DECIMAL = 164; + int DIGITS = 164; /** RegularExpression Id. */ - int DOUBLE = 165; + int INTEGER = 165; /** RegularExpression Id. */ - int INTEGER_POSITIVE = 166; + int DECIMAL = 166; /** RegularExpression Id. */ - int DECIMAL_POSITIVE = 167; + int DOUBLE = 167; /** RegularExpression Id. */ - int DOUBLE_POSITIVE = 168; + int INTEGER_POSITIVE = 168; /** RegularExpression Id. */ - int INTEGER_NEGATIVE = 169; + int DECIMAL_POSITIVE = 169; /** RegularExpression Id. */ - int DECIMAL_NEGATIVE = 170; + int DOUBLE_POSITIVE = 170; /** RegularExpression Id. */ - int DOUBLE_NEGATIVE = 171; + int INTEGER_NEGATIVE = 171; /** RegularExpression Id. */ - int EXPONENT = 172; + int DECIMAL_NEGATIVE = 172; /** RegularExpression Id. */ - int QUOTE_3D = 173; + int DOUBLE_NEGATIVE = 173; /** RegularExpression Id. */ - int QUOTE_3S = 174; + int EXPONENT = 174; /** RegularExpression Id. */ - int ECHAR = 175; + int QUOTE_3D = 175; /** RegularExpression Id. */ - int UCHAR = 176; + int QUOTE_3S = 176; /** RegularExpression Id. */ - int UCHAR4 = 177; + int ECHAR = 177; /** RegularExpression Id. */ - int UCHAR8 = 178; + int UCHAR = 178; /** RegularExpression Id. */ - int STRING_LITERAL1 = 179; + int UCHAR4 = 179; /** RegularExpression Id. */ - int STRING_LITERAL2 = 180; + int UCHAR8 = 180; /** RegularExpression Id. */ - int STRING_LITERAL_LONG1 = 181; + int STRING_LITERAL1 = 181; /** RegularExpression Id. */ - int STRING_LITERAL_LONG2 = 182; + int STRING_LITERAL2 = 182; /** RegularExpression Id. */ - int LPAREN = 183; + int STRING_LITERAL_LONG1 = 183; /** RegularExpression Id. */ - int RPAREN = 184; + int STRING_LITERAL_LONG2 = 184; /** RegularExpression Id. */ - int NIL = 185; + int LPAREN = 185; /** RegularExpression Id. */ - int LBRACE = 186; + int RPAREN = 186; /** RegularExpression Id. */ - int RBRACE = 187; + int NIL = 187; /** RegularExpression Id. */ - int LBRACKET = 188; + int LBRACE = 188; /** RegularExpression Id. */ - int RBRACKET = 189; + int RBRACE = 189; /** RegularExpression Id. */ - int ANON = 190; + int LBRACKET = 190; /** RegularExpression Id. */ - int SEMICOLON = 191; + int RBRACKET = 191; /** RegularExpression Id. */ - int COMMA = 192; + int ANON = 192; /** RegularExpression Id. */ - int DOT = 193; + int SEMICOLON = 193; /** RegularExpression Id. */ - int EQ = 194; + int COMMA = 194; /** RegularExpression Id. */ - int NE = 195; + int DOT = 195; /** RegularExpression Id. */ - int GT = 196; + int EQ = 196; /** RegularExpression Id. */ - int LT = 197; + int NE = 197; /** RegularExpression Id. */ - int LE = 198; + int GT = 198; /** RegularExpression Id. */ - int GE = 199; + int LT = 199; /** RegularExpression Id. */ - int GT2 = 200; + int LE = 200; /** RegularExpression Id. */ - int LT2 = 201; + int GE = 201; /** RegularExpression Id. */ - int L_ANN = 202; + int GT2 = 202; /** RegularExpression Id. */ - int R_ANN = 203; + int LT2 = 203; /** RegularExpression Id. */ - int BANG = 204; + int L_ANN = 204; /** RegularExpression Id. */ - int TILDE = 205; + int R_ANN = 205; /** RegularExpression Id. */ - int COLON = 206; + int BANG = 206; /** RegularExpression Id. */ - int SC_OR = 207; + int TILDE = 207; /** RegularExpression Id. */ - int SC_AND = 208; + int COLON = 208; /** RegularExpression Id. */ - int PLUS = 209; + int SC_OR = 209; /** RegularExpression Id. */ - int MINUS = 210; + int SC_AND = 210; /** RegularExpression Id. */ - int STAR = 211; + int PLUS = 211; /** RegularExpression Id. */ - int SLASH = 212; + int MINUS = 212; /** RegularExpression Id. */ - int DATATYPE = 213; + int STAR = 213; /** RegularExpression Id. */ - int AT = 214; + int SLASH = 214; /** RegularExpression Id. */ - int ASSIGN = 215; + int DATATYPE = 215; /** RegularExpression Id. */ - int VBAR = 216; + int AT = 216; /** RegularExpression Id. */ - int CARAT = 217; + int ASSIGN = 217; /** RegularExpression Id. */ - int FPATH = 218; + int VBAR = 218; /** RegularExpression Id. */ - int RPATH = 219; + int CARAT = 219; /** RegularExpression Id. */ - int QMARK = 220; + int FPATH = 220; /** RegularExpression Id. */ - int SURROGATE_PAIR = 221; + int RPATH = 221; /** RegularExpression Id. */ - int PN_CHARS_BASE = 222; + int QMARK = 222; /** RegularExpression Id. */ - int PN_CHARS_U = 223; + int SURROGATE_PAIR = 223; /** RegularExpression Id. */ - int PN_CHARS = 224; + int PN_CHARS_BASE = 224; /** RegularExpression Id. */ - int PN_PREFIX = 225; + int PN_CHARS_U = 225; /** RegularExpression Id. */ - int PN_LOCAL = 226; + int PN_CHARS = 226; /** RegularExpression Id. */ - int VARNAME = 227; + int PN_PREFIX = 227; /** RegularExpression Id. */ - int PN_LOCAL_ESC = 228; + int PN_LOCAL = 228; /** RegularExpression Id. */ - int PLX = 229; + int VARNAME = 229; /** RegularExpression Id. */ - int HEX = 230; + int PN_LOCAL_ESC = 230; /** RegularExpression Id. */ - int PERCENT = 231; + int PLX = 231; /** RegularExpression Id. */ - int UNKNOWN = 232; + int HEX = 232; + /** RegularExpression Id. */ + int PERCENT = 233; + /** RegularExpression Id. */ + int UNKNOWN = 234; /** Lexical state. */ int DEFAULT = 0; @@ -519,6 +523,7 @@ public interface ARQParserConstants { "\"service\"", "\"LET\"", "\"LATERAL\"", + "\"unfold\"", "\"TRIPLE\"", "\"isTRIPLE\"", "\"SUBJECT\"", @@ -544,6 +549,7 @@ public interface ARQParserConstants { "\"variance\"", "\"var_samp\"", "\"var_pop\"", + "\"fold\"", "\"sample\"", "\"group_concat\"", "\"filter\"", diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java index cc1b92ce948..099b959a206 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserTokenManager.java @@ -1,9 +1,22 @@ -/* ARQParserTokenManager.java */ /* Generated By:JavaCC: Do not edit this line. ARQParserTokenManager.java */ package org.apache.jena.sparql.lang.arq ; +import org.apache.jena.graph.* ; +import org.apache.jena.query.* ; +import org.apache.jena.sparql.core.Var ; +import org.apache.jena.sparql.syntax.* ; +import org.apache.jena.sparql.expr.* ; +import org.apache.jena.sparql.path.* ; +import org.apache.jena.sparql.expr.aggregate.* ; +import org.apache.jena.sparql.expr.aggregate.lib.* ; +import org.apache.jena.update.* ; +import org.apache.jena.sparql.modify.request.* ; +import org.apache.jena.sparql.core.Quad ; +import java.util.List; +import java.util.ArrayList; /** Token Manager. */ -public class ARQParserTokenManager implements ARQParserConstants { +public class ARQParserTokenManager implements ARQParserConstants +{ /** Debug output. */ public java.io.PrintStream debugStream = System.out; @@ -15,7 +28,8 @@ private int jjStopAtPos(int pos, int kind) jjmatchedPos = pos; return pos + 1; } -private int jjMoveStringLiteralDfa0_0(){ +private int jjMoveStringLiteralDfa0_0() +{ switch(curChar) { case 9: @@ -34,164 +48,164 @@ private int jjMoveStringLiteralDfa0_0(){ jjmatchedKind = 1; return jjMoveNfa_0(0, 0); case 33: - jjmatchedKind = 204; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8L); + jjmatchedKind = 206; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x20L); case 38: - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x10000L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x40000L); case 40: - jjmatchedKind = 183; + jjmatchedKind = 185; return jjMoveNfa_0(0, 0); case 41: - jjmatchedKind = 184; + jjmatchedKind = 186; return jjMoveNfa_0(0, 0); case 42: - jjmatchedKind = 211; + jjmatchedKind = 213; return jjMoveNfa_0(0, 0); case 43: - jjmatchedKind = 209; + jjmatchedKind = 211; return jjMoveNfa_0(0, 0); case 44: - jjmatchedKind = 192; + jjmatchedKind = 194; return jjMoveNfa_0(0, 0); case 45: - jjmatchedKind = 210; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x4000000L); + jjmatchedKind = 212; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x10000000L); case 46: - jjmatchedKind = 193; + jjmatchedKind = 195; return jjMoveNfa_0(0, 0); case 47: - jjmatchedKind = 212; + jjmatchedKind = 214; return jjMoveNfa_0(0, 0); case 58: - jjmatchedKind = 206; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x800000L); + jjmatchedKind = 208; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x2000000L); case 59: - jjmatchedKind = 191; + jjmatchedKind = 193; return jjMoveNfa_0(0, 0); case 60: - jjmatchedKind = 197; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8000240L); + jjmatchedKind = 199; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x20000900L); case 61: - jjmatchedKind = 194; + jjmatchedKind = 196; return jjMoveNfa_0(0, 0); case 62: - jjmatchedKind = 196; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x180L); + jjmatchedKind = 198; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x600L); case 63: - jjmatchedKind = 220; + jjmatchedKind = 222; return jjMoveNfa_0(0, 0); case 64: - jjmatchedKind = 214; + jjmatchedKind = 216; return jjMoveNfa_0(0, 0); case 65: - return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x80400001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2200010810000000L, 0x10000000004L, 0x201000004L, 0x0L); case 66: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x88000L, 0x0L, 0x0L); case 67: - return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x1300000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000008000000L, 0x20420000c10000L, 0x4c00000L, 0x0L); case 68: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x4800a000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x1000000020000000L, 0x120028000L, 0x0L); case 69: - return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80000000000000L, 0x10000000000000L, 0x0L, 0x0L); case 70: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x1000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x40000004800L, 0x4000L, 0x0L); case 71: - return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400020000000000L, 0x2000L, 0x0L, 0x0L); case 72: - return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x2000000000000000L, 0x0L, 0x0L); case 73: - return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x807c0058000L, 0x10004000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x201f00160000L, 0x40010000L, 0x0L); case 74: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 76: - return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x2000030000000L, 0x80000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x80000c0000000L, 0x200000L, 0x0L); case 77: - return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x2800020L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000100000000000L, 0x4800100001000019L, 0xa000080L, 0x0L); case 78: - return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100002000000000L, 0x0L, 0x8L, 0x0L); case 79: - return jjMoveStringLiteralDfa1_0(0x200400c0000000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400400c0000000L, 0x0L, 0x0L, 0x0L); case 80: - return jjMoveStringLiteralDfa1_0(0x10000000200000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20000000200000L, 0x0L, 0x0L, 0x0L); case 82: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x208a000000000L, 0x0L, 0x0L); case 83: - return jjMoveStringLiteralDfa1_0(0x808400000400000L, 0x20f0601007800471L, 0x40007c8L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1010400000400000L, 0x83c180401e0010e2L, 0x10001f20L, 0x0L); case 84: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0xc000000000000000L, 0x20000800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x0L, 0x80002003L, 0x0L); case 85: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x1000000080000L, 0x200000004L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2080400000000L, 0x4000000200000L, 0x800000010L, 0x0L); case 86: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x10L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x700L, 0x40L, 0x0L); case 87: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x100000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x400000000L, 0x0L); case 89: - return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000000L, 0x0L, 0x0L); case 91: - jjmatchedKind = 188; + jjmatchedKind = 190; return jjMoveNfa_0(0, 0); case 93: - jjmatchedKind = 189; + jjmatchedKind = 191; return jjMoveNfa_0(0, 0); case 94: - jjmatchedKind = 217; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x200000L); + jjmatchedKind = 219; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x800000L); case 97: jjmatchedKind = 19; - return jjMoveStringLiteralDfa1_0(0x1100010810000000L, 0x4000000002L, 0x80400001L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2200010810000000L, 0x10000000004L, 0x201000004L, 0x0L); case 98: - return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x22000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200100100000L, 0x88000L, 0x0L, 0x0L); case 99: - return jjMoveStringLiteralDfa1_0(0x2000000008000000L, 0x8108000304000L, 0x1300000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000008000000L, 0x20420000c10000L, 0x4c00000L, 0x0L); case 100: - return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x400000008000000L, 0x4800a000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1004800000L, 0x1000000020000000L, 0x120028000L, 0x0L); case 101: - return jjMoveStringLiteralDfa1_0(0x40000000000000L, 0x4000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x80000000000000L, 0x10000000000000L, 0x0L, 0x0L); case 102: - return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x10000001000L, 0x1000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000L, 0x40000004800L, 0x4000L, 0x0L); case 103: - return jjMoveStringLiteralDfa1_0(0x200020000000000L, 0x800L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400020000000000L, 0x2000L, 0x0L, 0x0L); case 104: - return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x800000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x2000000000000000L, 0x0L, 0x0L); case 105: - return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x807c0058000L, 0x10004000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000000L, 0x201f00160000L, 0x40010000L, 0x0L); case 106: return jjMoveStringLiteralDfa1_0(0x2000000L, 0x0L, 0x0L, 0x0L); case 108: - return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x2000030000000L, 0x80000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1800020000000L, 0x80000c0000000L, 0x200000L, 0x0L); case 109: - return jjMoveStringLiteralDfa1_0(0xc000100000000000L, 0x120004000040000cL, 0x2800020L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000100000000000L, 0x4800100001000019L, 0xa000080L, 0x0L); case 110: - return jjMoveStringLiteralDfa1_0(0x80002000000000L, 0x0L, 0x2L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x100002000000000L, 0x0L, 0x8L, 0x0L); case 111: - return jjMoveStringLiteralDfa1_0(0x200400c0000000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x400400c0000000L, 0x0L, 0x0L, 0x0L); case 112: - return jjMoveStringLiteralDfa1_0(0x10000000200000L, 0x0L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x20000000200000L, 0x0L, 0x0L, 0x0L); case 114: - return jjMoveStringLiteralDfa1_0(0x1000000L, 0x822800000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1000000L, 0x208a000000000L, 0x0L, 0x0L); case 115: - return jjMoveStringLiteralDfa1_0(0x808400000400000L, 0x20f0601007800471L, 0x40007c8L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x1010400000400000L, 0x83c180401e0010e2L, 0x10001f20L, 0x0L); case 116: - return jjMoveStringLiteralDfa1_0(0x2000000000000L, 0xc000000000000000L, 0x20000800L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x4000000000000L, 0x0L, 0x80002003L, 0x0L); case 117: - return jjMoveStringLiteralDfa1_0(0x80400000000L, 0x1000000080000L, 0x200000004L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x2080400000000L, 0x4000000200000L, 0x800000010L, 0x0L); case 118: - return jjMoveStringLiteralDfa1_0(0x200000000L, 0x380L, 0x10L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x200000000L, 0x700L, 0x40L, 0x0L); case 119: - return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x100000000L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x8000000000L, 0x0L, 0x400000000L, 0x0L); case 121: - return jjMoveStringLiteralDfa1_0(0x0L, 0x100000000000000L, 0x0L, 0x0L); + return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000000L, 0x0L, 0x0L); case 123: - jjmatchedKind = 186; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x400L); + jjmatchedKind = 188; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x1000L); case 124: - jjmatchedKind = 216; - return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x8800L); + jjmatchedKind = 218; + return jjMoveStringLiteralDfa1_0(0x0L, 0x0L, 0x0L, 0x22000L); case 125: - jjmatchedKind = 187; + jjmatchedKind = 189; return jjMoveNfa_0(0, 0); case 126: - jjmatchedKind = 205; + jjmatchedKind = 207; return jjMoveNfa_0(0, 0); case 65279: jjmatchedKind = 9; @@ -200,7 +214,8 @@ private int jjMoveStringLiteralDfa0_0(){ return jjMoveNfa_0(0, 0); } } -private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3){ +private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, long active3) +{ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 0); @@ -208,118 +223,118 @@ private int jjMoveStringLiteralDfa1_0(long active0, long active1, long active2, switch(curChar) { case 38: - if ((active3 & 0x10000L) != 0L) + if ((active3 & 0x40000L) != 0L) { - jjmatchedKind = 208; + jjmatchedKind = 210; jjmatchedPos = 1; } break; case 45: - if ((active3 & 0x8000000L) != 0L) + if ((active3 & 0x20000000L) != 0L) { - jjmatchedKind = 219; + jjmatchedKind = 221; jjmatchedPos = 1; } break; case 60: - if ((active3 & 0x200L) != 0L) + if ((active3 & 0x800L) != 0L) { - jjmatchedKind = 201; + jjmatchedKind = 203; jjmatchedPos = 1; } break; case 61: - if ((active3 & 0x8L) != 0L) + if ((active3 & 0x20L) != 0L) { - jjmatchedKind = 195; + jjmatchedKind = 197; jjmatchedPos = 1; } - else if ((active3 & 0x40L) != 0L) + else if ((active3 & 0x100L) != 0L) { - jjmatchedKind = 198; + jjmatchedKind = 200; jjmatchedPos = 1; } - else if ((active3 & 0x80L) != 0L) + else if ((active3 & 0x200L) != 0L) { - jjmatchedKind = 199; + jjmatchedKind = 201; jjmatchedPos = 1; } - else if ((active3 & 0x800000L) != 0L) + else if ((active3 & 0x2000000L) != 0L) { - jjmatchedKind = 215; + jjmatchedKind = 217; jjmatchedPos = 1; } break; case 62: - if ((active3 & 0x100L) != 0L) + if ((active3 & 0x400L) != 0L) { - jjmatchedKind = 200; + jjmatchedKind = 202; jjmatchedPos = 1; } - else if ((active3 & 0x4000000L) != 0L) + else if ((active3 & 0x10000000L) != 0L) { - jjmatchedKind = 218; + jjmatchedKind = 220; jjmatchedPos = 1; } break; case 65: - return jjMoveStringLiteralDfa2_0(active0, 0x8401002200100000L, active1, 0x400003038300780L, active2, 0x3000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x801002200100000L, active1, 0x100000c0e0c01701L, active2, 0xc000L, active3, 0L); case 66: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0x10000000000L, active2, 0L, active3, 0L); case 67: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc000000000000L, active2, 0L, active3, 0L); case 68: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x400021L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200000000000L, active2, 0x1000084L, active3, 0L); case 69: - return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x42008010L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000c01005400000L, active1, 0x8402022000000008L, active2, 0x108020040L, active3, 0L); case 70: - if ((active1 & 0x10000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 82; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 71: - return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 72: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x7c0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x2000000L, active2, 0x1f00L, active3, 0L); case 73: - return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x104000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000300020800000L, active1, 0x4000000000004000L, active2, 0x410000001L, active3, 0L); case 76: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x80100000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x200400000L, active3, 0L); case 78: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 81; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x4000000020000L, active2, 0x10004000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2090400000000L, active1, 0x10000000080000L, active2, 0x40010000L, active3, 0L); case 79: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 159; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0x1880002L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4100000008000000L, active1, 0x2820580000018810L, active2, 0x6200008L, active3, 0L); case 80: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 82: - return jjMoveStringLiteralDfa2_0(active0, 0x212024080200000L, active1, 0xc0800L, active2, 0x8200800L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x424024080200000L, active1, 0x302000L, active2, 0x20802000L, active3, 0L); case 83: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x4000812000000L, active1, 0x7c0000000L, active2, 0x200000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000812000000L, active1, 0x1f00000000L, active2, 0x800000000L, active3, 0L); case 84: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x8L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3c100001c0000e0L, active2, 0x20L, active3, 0L); case 85: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L, active1, 0x200000400001L, active2, 0x4L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x800001000002L, active2, 0x10L, active3, 0L); case 86: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4L, active2, 0L, active3, 0L); case 88: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L, active2, 0L, active3, 0L); case 89: if ((active0 & 0x100000000L) != 0L) { @@ -328,77 +343,77 @@ else if ((active3 & 0x4000000L) != 0L) } break; case 90: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 129; jjmatchedPos = 1; } break; case 94: - if ((active3 & 0x200000L) != 0L) + if ((active3 & 0x800000L) != 0L) { - jjmatchedKind = 213; + jjmatchedKind = 215; jjmatchedPos = 1; } break; case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x8401002200100000L, active1, 0x400003038300780L, active2, 0x3000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x801002200100000L, active1, 0x100000c0e0c01701L, active2, 0xc000L, active3, 0L); case 98: - return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L, active1, 0x4000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0x10000000000L, active2, 0L, active3, 0L); case 99: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3000000000000L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xc000000000000L, active2, 0L, active3, 0L); case 100: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000L, active2, 0x400021L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x200000000000L, active2, 0x1000084L, active3, 0L); case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x800c01005400000L, active1, 0x2100808800000004L, active2, 0x42008010L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x1000c01005400000L, active1, 0x8402022000000008L, active2, 0x108020040L, active3, 0L); case 102: - if ((active1 & 0x10000L) != 0L) + if ((active1 & 0x40000L) != 0L) { - jjmatchedKind = 80; + jjmatchedKind = 82; jjmatchedPos = 1; } return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L, active2, 0L, active3, 0L); case 103: - return jjMoveStringLiteralDfa2_0(active0, 0x1000000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2000000000000000L, active1, 0L, active2, 0L, active3, 0L); case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x800000L, active2, 0x7c0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000000000L, active1, 0x2000000L, active2, 0x1f00L, active3, 0L); case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x4000300020800000L, active1, 0x5000000000001000L, active2, 0x104000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000300020800000L, active1, 0x4000000000004000L, active2, 0x410000001L, active3, 0L); case 108: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000L, active2, 0x80100000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x40000000000L, active2, 0x200400000L, active3, 0L); case 110: - if ((active1 & 0x8000L) != 0L) + if ((active1 & 0x20000L) != 0L) { - jjmatchedKind = 79; + jjmatchedKind = 81; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x90400000000L, active1, 0x4000000020000L, active2, 0x10004000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x2090400000000L, active1, 0x10000000080000L, active2, 0x40010000L, active3, 0L); case 111: - if ((active2 & 0x20000000L) != 0L) + if ((active2 & 0x80000000L) != 0L) { - jjmatchedKind = 157; + jjmatchedKind = 159; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x2080000008000000L, active1, 0xa08160000006008L, active2, 0x1880002L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x4100000008000000L, active1, 0x2820580000018810L, active2, 0x6200008L, active3, 0L); case 112: return jjMoveStringLiteralDfa2_0(active0, 0x40000000000L, active1, 0L, active2, 0L, active3, 0L); case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x212024080200000L, active1, 0xc0800L, active2, 0x8200800L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x424024080200000L, active1, 0x302000L, active2, 0x20802000L, active3, 0L); case 115: - if ((active0 & 0x100000000000000L) != 0L) + if ((active0 & 0x200000000000000L) != 0L) { - jjmatchedKind = 56; + jjmatchedKind = 57; jjmatchedPos = 1; } - return jjMoveStringLiteralDfa2_0(active0, 0x4000812000000L, active1, 0x7c0000000L, active2, 0x200000000L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x8000812000000L, active1, 0x1f00000000L, active2, 0x800000000L, active3, 0L); case 116: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0xf0400007000070L, active2, 0x8L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x3c100001c0000e0L, active2, 0x20L, active3, 0L); case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L, active1, 0x200000400001L, active2, 0x4L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000000L, active1, 0x800001000002L, active2, 0x10L, active3, 0L); case 118: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x2L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x4L, active2, 0L, active3, 0L); case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L, active1, 0L, active2, 0L, active3, 0L); + return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L, active1, 0L, active2, 0L, active3, 0L); case 121: if ((active0 & 0x100000000L) != 0L) { @@ -407,28 +422,28 @@ else if ((active3 & 0x4000000L) != 0L) } break; case 122: - if ((active1 & 0x8000000000000000L) != 0L) + if ((active2 & 0x2L) != 0L) { - jjmatchedKind = 127; + jjmatchedKind = 129; jjmatchedPos = 1; } break; case 124: - if ((active3 & 0x400L) != 0L) + if ((active3 & 0x1000L) != 0L) { - jjmatchedKind = 202; + jjmatchedKind = 204; jjmatchedPos = 1; } - else if ((active3 & 0x8000L) != 0L) + else if ((active3 & 0x20000L) != 0L) { - jjmatchedKind = 207; + jjmatchedKind = 209; jjmatchedPos = 1; } break; case 125: - if ((active3 & 0x800L) != 0L) + if ((active3 & 0x2000L) != 0L) { - jjmatchedKind = 203; + jjmatchedKind = 205; jjmatchedPos = 1; } break; @@ -437,7 +452,8 @@ else if ((active3 & 0x8000L) != 0L) } return jjMoveNfa_0(0, 1); } -private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3){ +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1, long old2, long active2, long old3, long active3) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2) | (active3 &= old3)) == 0L) return jjMoveNfa_0(0, 1); try { curChar = input_stream.readChar(); } @@ -447,70 +463,70 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long a switch(curChar) { case 53: - if ((active2 & 0x20L) != 0L) + if ((active2 & 0x80L) != 0L) { - jjmatchedKind = 133; + jjmatchedKind = 135; jjmatchedPos = 2; } break; case 65: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x807c0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x40c000000010000L, active2, 0x201f00L); case 66: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L, active1, 0x200100000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0x800400000000L, active2, 0L); case 67: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8010000000000000L, active2, 0L); case 68: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x40000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 108; jjmatchedPos = 2; } - else if ((active2 & 0x400000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 152; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0xf8L, active2, 0L); case 69: - return jjMoveStringLiteralDfa3_0(active0, 0x10008000200000L, active1, 0L, active2, 0x300000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20008000200000L, active1, 0L, active2, 0xc00000L); case 70: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000040000000L, active1, 0L, active2, 0x100000000L); case 71: - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 2; } - else if ((active1 & 0x2L) != 0L) + else if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2000000000L, active2, 0L); case 73: - if ((active1 & 0x40000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 84; jjmatchedPos = 2; } - else if ((active1 & 0x80000L) != 0L) + else if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 85; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x42080000000000L, active1, 0x88080000000L, active2, 0x200000004L); + return jjMoveStringLiteralDfa3_0(active0, 0x84080000000000L, active1, 0x220200000000L, active2, 0x800000010L); case 74: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L, active2, 0x1L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0L, active2, 0x4L); case 75: if ((active0 & 0x10000000L) != 0L) { @@ -519,139 +535,139 @@ else if ((active1 & 0x80000L) != 0L) } break; case 76: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x200000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 161; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x4009000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x801804800L, active2, 0x10024000L); case 77: - if ((active1 & 0x1L) != 0L) + if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000L, active2, 0x1L); case 78: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x48204090c0000000L, active2, 0L); case 79: - return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x8000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400004002000000L, active1, 0x40002082000L, active2, 0x20000000L); case 80: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x2000000000000L, active2, 0x4000000L); case 82: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 90; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0x18L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x3c1000018000700L, active2, 0x60L); case 83: - if ((active1 & 0x4000000000L) != 0L) + if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 104; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x4000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x400000L, active2, 0x10000L); case 84: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x80000000000000L) != 0L) + else if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x5040000000000L, active1, 0x8000000L, active2, 0x112002000L); + return jjMoveStringLiteralDfa3_0(active0, 0x9040000000000L, active1, 0x20000000L, active2, 0x448008000L); case 85: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x800L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0x2000080100008000L, active2, 0x2000L); case 86: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x800000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0L, active2, 0x2000000L); case 87: - if ((active2 & 0x2L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 131; jjmatchedPos = 2; } break; case 88: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } break; case 89: - if ((active1 & 0x400000000000000L) != 0L) + if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 124; jjmatchedPos = 2; } break; case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x103000000004000L, active2, 0x807c0L); + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0x40c000000010000L, active2, 0x201f00L); case 98: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L, active1, 0x200100000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L, active1, 0x800400000000L, active2, 0L); case 99: if ((active0 & 0x800000000L) != 0L) { jjmatchedKind = 35; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2004000000000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x8010000000000000L, active2, 0L); case 100: if ((active0 & 0x10000000000L) != 0L) { jjmatchedKind = 40; jjmatchedPos = 2; } - else if ((active1 & 0x40000000000L) != 0L) + else if ((active1 & 0x100000000000L) != 0L) { - jjmatchedKind = 106; + jjmatchedKind = 108; jjmatchedPos = 2; } - else if ((active2 & 0x400000L) != 0L) + else if ((active2 & 0x1000000L) != 0L) { - jjmatchedKind = 150; + jjmatchedKind = 152; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0x7cL, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x481000000L, active1, 0xf8L, active2, 0L); case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x10008000200000L, active1, 0L, active2, 0x300000L); + return jjMoveStringLiteralDfa3_0(active0, 0x20008000200000L, active1, 0L, active2, 0xc00000L); case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x40000000L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x2000040000000L, active1, 0L, active2, 0x100000000L); case 103: - if ((active0 & 0x1000000000000000L) != 0L) + if ((active0 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 60; + jjmatchedKind = 61; jjmatchedPos = 2; } - else if ((active1 & 0x2L) != 0L) + else if ((active1 & 0x4L) != 0L) { - jjmatchedKind = 65; + jjmatchedKind = 66; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x800000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x2000000000L, active2, 0L); case 105: - if ((active1 & 0x40000L) != 0L) + if ((active1 & 0x100000L) != 0L) { - jjmatchedKind = 82; + jjmatchedKind = 84; jjmatchedPos = 2; } - else if ((active1 & 0x80000L) != 0L) + else if ((active1 & 0x200000L) != 0L) { - jjmatchedKind = 83; + jjmatchedKind = 85; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x42080000000000L, active1, 0x88080000000L, active2, 0x200000004L); + return jjMoveStringLiteralDfa3_0(active0, 0x84080000000000L, active1, 0x220200000000L, active2, 0x800000010L); case 106: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L, active1, 0L, active2, 0x1L); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L, active1, 0L, active2, 0x4L); case 107: if ((active0 & 0x10000000L) != 0L) { @@ -660,78 +676,78 @@ else if ((active1 & 0x80000L) != 0L) } break; case 108: - if ((active2 & 0x80000000L) != 0L) + if ((active2 & 0x200000000L) != 0L) { - jjmatchedKind = 159; + jjmatchedKind = 161; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x200601000L, active2, 0x4009000L); + return jjMoveStringLiteralDfa3_0(active0, 0x200400000L, active1, 0x801804800L, active2, 0x10024000L); case 109: - if ((active1 & 0x1L) != 0L) + if ((active1 & 0x2L) != 0L) { - jjmatchedKind = 64; + jjmatchedKind = 65; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000000400L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x2020000000L, active1, 0x4000001000L, active2, 0x1L); case 110: - if ((active0 & 0x4000000000000000L) != 0L) + if ((active0 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 62; + jjmatchedKind = 63; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x1208102430000000L, active2, 0L); + return jjMoveStringLiteralDfa3_0(active0, 0x300008000000L, active1, 0x48204090c0000000L, active2, 0L); case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x200004002000000L, active1, 0x10000820800L, active2, 0x8000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x400004002000000L, active1, 0x40002082000L, active2, 0x20000000L); case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0x800000000000L, active2, 0x1000000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L, active1, 0x2000000000000L, active2, 0x4000000L); case 114: - if ((active1 & 0x1000000L) != 0L) + if ((active1 & 0x4000000L) != 0L) { - jjmatchedKind = 88; + jjmatchedKind = 90; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0xf0400006000380L, active2, 0x18L); + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L, active1, 0x3c1000018000700L, active2, 0x60L); case 115: - if ((active1 & 0x4000000000L) != 0L) + if ((active1 & 0x10000000000L) != 0L) { - jjmatchedKind = 102; + jjmatchedKind = 104; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x100000L, active2, 0x4000L); + return jjMoveStringLiteralDfa3_0(active0, 0x1004900000L, active1, 0x400000L, active2, 0x10000L); case 116: if ((active0 & 0x800000000000L) != 0L) { jjmatchedKind = 47; jjmatchedPos = 2; } - else if ((active0 & 0x80000000000000L) != 0L) + else if ((active0 & 0x100000000000000L) != 0L) { - jjmatchedKind = 55; + jjmatchedKind = 56; jjmatchedPos = 2; } - return jjMoveStringLiteralDfa3_0(active0, 0x5040000000000L, active1, 0x8000000L, active2, 0x112002000L); + return jjMoveStringLiteralDfa3_0(active0, 0x9040000000000L, active1, 0x20000000L, active2, 0x448008000L); case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000000L, active1, 0x800020040002000L, active2, 0x800L); + return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000000L, active1, 0x2000080100008000L, active2, 0x2000L); case 118: - return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L, active1, 0L, active2, 0x800000L); + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L, active1, 0L, active2, 0x2000000L); case 119: - if ((active2 & 0x2L) != 0L) + if ((active2 & 0x8L) != 0L) { - jjmatchedKind = 129; + jjmatchedKind = 131; jjmatchedPos = 2; } break; case 120: - if ((active0 & 0x8000000000000000L) != 0L) + if ((active1 & 0x1L) != 0L) { - jjmatchedKind = 63; + jjmatchedKind = 64; jjmatchedPos = 2; } break; case 121: - if ((active1 & 0x400000000000000L) != 0L) + if ((active1 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 122; + jjmatchedKind = 124; jjmatchedPos = 2; } break; @@ -740,7 +756,8 @@ else if ((active0 & 0x80000000000000L) != 0L) } return jjMoveNfa_0(0, 2); } -private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 2); try { curChar = input_stream.readChar(); } @@ -750,115 +767,120 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - if ((active2 & 0x40L) != 0L) + if ((active2 & 0x100L) != 0L) { - jjmatchedKind = 134; + jjmatchedKind = 136; jjmatchedPos = 3; } break; case 50: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x180L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x600L); case 51: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x200L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x800L); case 53: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x400L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0L, active2, 0x1000L); case 65: - if ((active2 & 0x2000L) != 0L) + if ((active2 & 0x8000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 143; jjmatchedPos = 3; } - else if ((active2 & 0x2000000L) != 0L) + else if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x40300000L); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x200000020000000L, active2, 0x100c00000L); case 66: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 67: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x400000000000L, active2, 0L); case 68: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x2000000000L) != 0L) + else if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 75; jjmatchedPos = 3; } - else if ((active2 & 0x4L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 103; + jjmatchedPos = 3; + } + else if ((active2 & 0x10L) != 0L) + { + jjmatchedKind = 132; jjmatchedPos = 3; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x200000L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 149; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0x4020000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0x10080000L, active2, 0L); case 69: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x8L) != 0L) + else if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 3; } - else if ((active2 & 0x800L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 141; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 153; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x21002480400000L, active1, 0x4020001800000070L, active2, 0x400c000L); + return jjMoveStringLiteralDfa4_0(active0, 0x41002480400000L, active1, 0x800060000000e0L, active2, 0x10030001L); case 70: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 71: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 94; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L, active2, 0L); case 72: - if ((active2 & 0x100000000L) != 0L) + if ((active2 & 0x400000000L) != 0L) { - jjmatchedKind = 160; + jjmatchedKind = 162; jjmatchedPos = 3; } break; case 73: - return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800040020000000L, active1, 0x800000108L, active2, 0L); case 74: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 76: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 87; jjmatchedPos = 3; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 105; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x3000408010000L, active2, 0L); case 77: if ((active0 & 0x4000000000L) != 0L) { @@ -872,152 +894,157 @@ else if ((active1 & 0x8000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x200000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0x80000008000L, active2, 0x800000000L); case 79: - if ((active2 & 0x10000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 158; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x2004010000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2080000000000L, active1, 0x8010040000000000L, active2, 0L); case 80: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 157; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2020000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4020000000000L, active1, 0x1000L, active2, 0L); case 82: - if ((active1 & 0x100000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 122; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4008000000000L, active1, 0x8000000c0800000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8008000000000L, active1, 0x2000000302000000L, active2, 0L); case 83: - return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x1010L); + return jjMoveStringLiteralDfa4_0(active0, 0x80000048000000L, active1, 0x4c800000000000L, active2, 0x4040L); case 84: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 86; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x820000001004000L, active2, 0L); case 85: - return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x9L); + return jjMoveStringLiteralDfa4_0(active0, 0x400100201000000L, active1, 0x4000001000002000L, active2, 0x24L); case 86: - if ((active1 & 0x80000000000L) != 0L) + if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 109; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 89: - if ((active2 & 0x1000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 154; jjmatchedPos = 3; } break; case 95: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x300L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x600L, active2, 0L); case 97: - if ((active2 & 0x2000L) != 0L) + if ((active2 & 0x8000L) != 0L) { - jjmatchedKind = 141; + jjmatchedKind = 143; jjmatchedPos = 3; } - else if ((active2 & 0x2000000L) != 0L) + else if ((active2 & 0x8000000L) != 0L) { - jjmatchedKind = 153; + jjmatchedKind = 155; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L, active1, 0x80000008000000L, active2, 0x40300000L); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L, active1, 0x200000020000000L, active2, 0x100c00000L); case 98: - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 99: if ((active0 & 0x1000000000L) != 0L) { jjmatchedKind = 36; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x100000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000L, active1, 0x400000000000L, active2, 0L); case 100: if ((active0 & 0x200000000000L) != 0L) { jjmatchedKind = 45; jjmatchedPos = 3; } - else if ((active1 & 0x2000000000L) != 0L) + else if ((active1 & 0x800L) != 0L) { - jjmatchedKind = 101; + jjmatchedKind = 75; jjmatchedPos = 3; } - else if ((active2 & 0x4L) != 0L) + else if ((active1 & 0x8000000000L) != 0L) { - jjmatchedKind = 130; + jjmatchedKind = 103; jjmatchedPos = 3; } - else if ((active2 & 0x80000L) != 0L) + else if ((active2 & 0x10L) != 0L) { - jjmatchedKind = 147; + jjmatchedKind = 132; + jjmatchedPos = 3; + } + else if ((active2 & 0x200000L) != 0L) + { + jjmatchedKind = 149; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0x4020000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0x10080000L, active2, 0L); case 101: if ((active0 & 0x100000L) != 0L) { jjmatchedKind = 20; jjmatchedPos = 3; } - else if ((active1 & 0x8L) != 0L) + else if ((active1 & 0x10L) != 0L) { - jjmatchedKind = 67; + jjmatchedKind = 68; jjmatchedPos = 3; } - else if ((active2 & 0x800L) != 0L) + else if ((active2 & 0x2000L) != 0L) { - jjmatchedKind = 139; + jjmatchedKind = 141; jjmatchedPos = 3; } - else if ((active2 & 0x800000L) != 0L) + else if ((active2 & 0x2000000L) != 0L) { - jjmatchedKind = 151; + jjmatchedKind = 153; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x21002480400000L, active1, 0x4020001800000070L, active2, 0x400c000L); + return jjMoveStringLiteralDfa4_0(active0, 0x41002480400000L, active1, 0x800060000000e0L, active2, 0x10030001L); case 102: return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L, active2, 0L); case 103: - if ((active1 & 0x10000000L) != 0L) + if ((active1 & 0x40000000L) != 0L) { - jjmatchedKind = 92; + jjmatchedKind = 94; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x80000000L, active2, 0L); case 104: - if ((active2 & 0x100000000L) != 0L) + if ((active2 & 0x400000000L) != 0L) { - jjmatchedKind = 160; + jjmatchedKind = 162; jjmatchedPos = 3; } break; case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x400040020000000L, active1, 0x200000084L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800040020000000L, active1, 0x800000108L, active2, 0L); case 106: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L, active1, 0L, active2, 0L); case 108: - if ((active1 & 0x200000L) != 0L) + if ((active1 & 0x800000L) != 0L) { - jjmatchedKind = 85; + jjmatchedKind = 87; jjmatchedPos = 3; } - else if ((active1 & 0x8000000000L) != 0L) + else if ((active1 & 0x20000000000L) != 0L) { - jjmatchedKind = 103; + jjmatchedKind = 105; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0xc00102004000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0L, active1, 0x3000408010000L, active2, 0L); case 109: if ((active0 & 0x4000000000L) != 0L) { @@ -1031,50 +1058,50 @@ else if ((active1 & 0x8000000000L) != 0L) jjmatchedKind = 25; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000000L, active1, 0x20000002000L, active2, 0x200000000L); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000000L, active1, 0x80000008000L, active2, 0x800000000L); case 111: - if ((active2 & 0x10000000L) != 0L) + if ((active2 & 0x40000000L) != 0L) { - jjmatchedKind = 156; + jjmatchedKind = 158; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L, active1, 0x2004010000000000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x2080000000000L, active1, 0x8010040000000000L, active2, 0L); case 112: - if ((active2 & 0x8000000L) != 0L) + if ((active2 & 0x20000000L) != 0L) { - jjmatchedKind = 155; + jjmatchedKind = 157; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x2020000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x4020000000000L, active1, 0x1000L, active2, 0L); case 114: - if ((active1 & 0x100000000000000L) != 0L) + if ((active1 & 0x400000000000000L) != 0L) { - jjmatchedKind = 120; + jjmatchedKind = 122; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x4008000000000L, active1, 0x8000000c0800000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x8008000000000L, active1, 0x2000000302000000L, active2, 0L); case 115: - return jjMoveStringLiteralDfa4_0(active0, 0x40000048000000L, active1, 0x13200000000000L, active2, 0x1010L); + return jjMoveStringLiteralDfa4_0(active0, 0x80000048000000L, active1, 0x4c800000000000L, active2, 0x4040L); case 116: - if ((active1 & 0x100000L) != 0L) + if ((active1 & 0x400000L) != 0L) { - jjmatchedKind = 84; + jjmatchedKind = 86; jjmatchedPos = 3; } - return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x208000000401000L, active2, 0L); + return jjMoveStringLiteralDfa4_0(active0, 0x800000L, active1, 0x820000001004000L, active2, 0L); case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x200100201000000L, active1, 0x1000000400000800L, active2, 0x9L); + return jjMoveStringLiteralDfa4_0(active0, 0x400100201000000L, active1, 0x4000001000002000L, active2, 0x24L); case 118: - if ((active1 & 0x80000000000L) != 0L) + if ((active1 & 0x200000000000L) != 0L) { - jjmatchedKind = 107; + jjmatchedKind = 109; jjmatchedPos = 3; } return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L, active2, 0L); case 121: - if ((active2 & 0x1000000L) != 0L) + if ((active2 & 0x4000000L) != 0L) { - jjmatchedKind = 152; + jjmatchedKind = 154; jjmatchedPos = 3; } break; @@ -1083,7 +1110,8 @@ else if ((active1 & 0x8000000000L) != 0L) } return jjMoveNfa_0(0, 3); } -private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 3); try { curChar = input_stream.readChar(); } @@ -1093,72 +1121,72 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a switch(curChar) { case 49: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x400L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1000L); case 50: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x80L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x200L); case 53: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x400L); case 56: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x200L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x800L); case 65: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x22400408000108L, active2, 0L); case 67: - return jjMoveStringLiteralDfa5_0(active0, 0x20000001400000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000001400000L, active1, 0L, active2, 0L); case 68: if ((active0 & 0x2000000000L) != 0L) { jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 79; jjmatchedPos = 4; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 107; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 69: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x20000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 83; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 114; jjmatchedPos = 4; } - else if ((active1 & 0x2000000000000L) != 0L) + else if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 115; jjmatchedPos = 4; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 142; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x8000240000000L, active1, 0x40400000005000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x10000240000000L, active1, 0x101000000014000L, active2, 0L); case 70: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 71: - if ((active2 & 0x200000000L) != 0L) + if ((active2 & 0x800000000L) != 0L) { - jjmatchedKind = 161; + jjmatchedKind = 163; jjmatchedPos = 4; } break; @@ -1168,172 +1196,172 @@ else if ((active2 & 0x1000L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x200000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 123; jjmatchedPos = 4; } break; case 73: - if ((active1 & 0x400000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 88; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 96; jjmatchedPos = 4; } - else if ((active1 & 0x80000000L) != 0L) + else if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 97; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x14400000a00000L, active1, 0L, active2, 0x10L); + return jjMoveStringLiteralDfa5_0(active0, 0x28400000a00000L, active1, 0L, active2, 0x40L); case 76: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x6000000000000L, active1, 0x1000L, active2, 0L); case 77: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1080000000L, active2, 0L); case 78: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x4000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0x8080000000000000L, active2, 0x10000000L); case 79: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 80: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2400L, active2, 0L); case 82: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 106; jjmatchedPos = 4; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 150; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x801000004000000L, active1, 0L, active2, 0x4000L); + return jjMoveStringLiteralDfa5_0(active0, 0x1001000004000000L, active1, 0L, active2, 0x10000L); case 83: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 125; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0x1L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200L, active2, 0x4L); case 84: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x2000000000000000L) != 0L) + else if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 4; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 92; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x208000L); + return jjMoveStringLiteralDfa5_0(active0, 0x80000008000000L, active1, 0x4040804822000000L, active2, 0x820000L); case 85: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x40000008L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100000020L); case 86: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xc0L, active2, 0L); case 88: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 101; jjmatchedPos = 4; } break; case 90: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1L); case 97: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x8900102000084L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x22400408000108L, active2, 0L); case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x20000001400000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x40000001400000L, active1, 0L, active2, 0L); case 100: if ((active0 & 0x2000000000L) != 0L) { jjmatchedKind = 37; jjmatchedPos = 4; } - else if ((active1 & 0x2000L) != 0L) + else if ((active1 & 0x8000L) != 0L) { - jjmatchedKind = 77; + jjmatchedKind = 79; jjmatchedPos = 4; } - else if ((active1 & 0x20000000000L) != 0L) + else if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 105; + jjmatchedKind = 107; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 101: if ((active0 & 0x8000000000L) != 0L) { jjmatchedKind = 39; jjmatchedPos = 4; } - else if ((active1 & 0x20000L) != 0L) + else if ((active1 & 0x80000L) != 0L) { - jjmatchedKind = 81; + jjmatchedKind = 83; jjmatchedPos = 4; } - else if ((active1 & 0x1000000000000L) != 0L) + else if ((active1 & 0x4000000000000L) != 0L) { - jjmatchedKind = 112; + jjmatchedKind = 114; jjmatchedPos = 4; } - else if ((active1 & 0x2000000000000L) != 0L) + else if ((active1 & 0x8000000000000L) != 0L) { - jjmatchedKind = 113; + jjmatchedKind = 115; jjmatchedPos = 4; } - else if ((active2 & 0x1000L) != 0L) + else if ((active2 & 0x4000L) != 0L) { - jjmatchedKind = 140; + jjmatchedKind = 142; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x8000240000000L, active1, 0x40400000005000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x10000240000000L, active1, 0x101000000014000L, active2, 0L); case 102: if ((active0 & 0x400000000L) != 0L) { jjmatchedKind = 34; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 103: - if ((active2 & 0x200000000L) != 0L) + if ((active2 & 0x800000000L) != 0L) { - jjmatchedKind = 161; + jjmatchedKind = 163; jjmatchedPos = 4; } break; @@ -1343,119 +1371,120 @@ else if ((active2 & 0x1000L) != 0L) jjmatchedKind = 41; jjmatchedPos = 4; } - else if ((active1 & 0x200000000000000L) != 0L) + else if ((active1 & 0x800000000000000L) != 0L) { - jjmatchedKind = 121; + jjmatchedKind = 123; jjmatchedPos = 4; } break; case 105: - if ((active1 & 0x400000L) != 0L) + if ((active1 & 0x1000000L) != 0L) { - jjmatchedKind = 86; + jjmatchedKind = 88; jjmatchedPos = 4; } - else if ((active1 & 0x40000000L) != 0L) + else if ((active1 & 0x100000000L) != 0L) { - jjmatchedKind = 94; + jjmatchedKind = 96; jjmatchedPos = 4; } - else if ((active1 & 0x80000000L) != 0L) + else if ((active1 & 0x200000000L) != 0L) { - jjmatchedKind = 95; + jjmatchedKind = 97; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x14400000a00000L, active1, 0L, active2, 0x10L); + return jjMoveStringLiteralDfa5_0(active0, 0x28400000a00000L, active1, 0L, active2, 0x40L); case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L, active1, 0x400L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0x6000000000000L, active1, 0x1000L, active2, 0L); case 109: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x420000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x1080000000L, active2, 0L); case 110: if ((active0 & 0x80000000000L) != 0L) { jjmatchedKind = 43; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x400000000000000L, active1, 0x2020000000000000L, active2, 0x4000000L); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L, active1, 0x8080000000000000L, active2, 0x10000000L); case 111: return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L, active2, 0L); case 112: - if ((active0 & 0x200000000000000L) != 0L) + if ((active0 & 0x400000000000000L) != 0L) { - jjmatchedKind = 57; + jjmatchedKind = 58; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xa00L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x2400L, active2, 0L); case 114: if ((active0 & 0x80000000L) != 0L) { jjmatchedKind = 31; jjmatchedPos = 4; } - else if ((active1 & 0x10000000000L) != 0L) + else if ((active1 & 0x40000000000L) != 0L) { - jjmatchedKind = 104; + jjmatchedKind = 106; jjmatchedPos = 4; } - else if ((active2 & 0x100000L) != 0L) + else if ((active2 & 0x400000L) != 0L) { - jjmatchedKind = 148; + jjmatchedKind = 150; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x801000004000000L, active1, 0L, active2, 0x4000L); + return jjMoveStringLiteralDfa5_0(active0, 0x1001000004000000L, active1, 0L, active2, 0x10000L); case 115: if ((active0 & 0x100000000000L) != 0L) { jjmatchedKind = 44; jjmatchedPos = 4; } - else if ((active1 & 0x800000000000000L) != 0L) + else if ((active1 & 0x2000000000000000L) != 0L) { - jjmatchedKind = 123; + jjmatchedKind = 125; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x100L, active2, 0x1L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x200L, active2, 0x4L); case 116: if ((active0 & 0x20000000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; } - else if ((active0 & 0x2000000000000000L) != 0L) + else if ((active0 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 61; + jjmatchedKind = 62; jjmatchedPos = 4; } - else if ((active1 & 0x4000000L) != 0L) + else if ((active1 & 0x10000000L) != 0L) { - jjmatchedKind = 90; + jjmatchedKind = 92; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0x40000008000000L, active1, 0x1010201208800000L, active2, 0x208000L); + return jjMoveStringLiteralDfa5_0(active0, 0x80000008000000L, active1, 0x4040804822000000L, active2, 0x820000L); case 117: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x40000008L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x100000020L); case 118: - if ((active1 & 0x10L) != 0L) + if ((active1 & 0x20L) != 0L) { - jjmatchedKind = 68; + jjmatchedKind = 69; jjmatchedPos = 4; } - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x60L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0xc0L, active2, 0L); case 120: - if ((active1 & 0x800000000L) != 0L) + if ((active1 & 0x2000000000L) != 0L) { - jjmatchedKind = 99; + jjmatchedKind = 101; jjmatchedPos = 4; } break; case 122: - return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0x4000000000000000L, active2, 0L); + return jjMoveStringLiteralDfa5_0(active0, 0L, active1, 0L, active2, 0x1L); default : break; } return jjMoveNfa_0(0, 4); } -private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 4); try { curChar = input_stream.readChar(); } @@ -1465,97 +1494,102 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long a switch(curChar) { case 50: - if ((active2 & 0x400L) != 0L) + if ((active2 & 0x1000L) != 0L) { - jjmatchedKind = 138; + jjmatchedKind = 140; jjmatchedPos = 5; } break; case 52: - if ((active2 & 0x80L) != 0L) + if ((active2 & 0x200L) != 0L) { - jjmatchedKind = 135; + jjmatchedKind = 137; jjmatchedPos = 5; } - else if ((active2 & 0x200L) != 0L) + else if ((active2 & 0x800L) != 0L) { - jjmatchedKind = 137; + jjmatchedKind = 139; jjmatchedPos = 5; } break; case 54: - if ((active2 & 0x100L) != 0L) + if ((active2 & 0x400L) != 0L) { - jjmatchedKind = 136; + jjmatchedKind = 138; jjmatchedPos = 5; } break; case 65: - return jjMoveStringLiteralDfa6_0(active0, 0x801000000000000L, active1, 0x10000020000100L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1001000000000000L, active1, 0x40000080000200L, active2, 0L); case 67: - return jjMoveStringLiteralDfa6_0(active0, 0x18400000000000L, active1, 0x800000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x30400000000000L, active1, 0x2000000000000L, active2, 0L); case 68: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); - case 69: if ((active0 & 0x2000000000000L) != 0L) { jjmatchedKind = 49; jjmatchedPos = 5; } - else if ((active1 & 0x400L) != 0L) + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8080000000000000L, active2, 0L); + case 69: + if ((active0 & 0x4000000000000L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 50; jjmatchedPos = 5; } - else if ((active2 & 0x8000L) != 0L) + else if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 143; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x20000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 145; + jjmatchedPos = 5; + } + else if ((active2 & 0x800000L) != 0L) + { + jjmatchedKind = 151; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x4010005802000000L, active2, 0L); case 70: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 71: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 5; } break; case 73: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x8L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x20000000000000L, active2, 0x20L); case 76: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x100000000L); case 78: - if ((active1 & 0x4L) != 0L) + if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 5; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 112; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x408000100L, active2, 0L); case 79: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x10L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x400L, active2, 0x41L); case 80: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 82: - if ((active1 & 0x1000L) != 0L) + if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 78; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 111; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1565,12 +1599,12 @@ else if ((active1 & 0x200000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x10000L, active2, 0L); case 84: if ((active0 & 0x400000L) != 0L) { @@ -1582,32 +1616,32 @@ else if ((active0 & 0x40000000L) != 0L) jjmatchedKind = 30; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 110; jjmatchedPos = 5; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 130; jjmatchedPos = 5; } - else if ((active2 & 0x4000L) != 0L) + else if ((active2 & 0x10000L) != 0L) { - jjmatchedKind = 142; + jjmatchedKind = 144; jjmatchedPos = 5; } - else if ((active2 & 0x4000000L) != 0L) + else if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 156; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 88: if ((active0 & 0x200000L) != 0L) { @@ -1616,75 +1650,80 @@ else if ((active2 & 0x4000000L) != 0L) } break; case 89: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000L, active2, 0L); case 95: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x860L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20c0L, active2, 0L); case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x801000000000000L, active1, 0x10000020000100L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1001000000000000L, active1, 0x40000080000200L, active2, 0L); case 99: - return jjMoveStringLiteralDfa6_0(active0, 0x18400000000000L, active1, 0x800000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x30400000000000L, active1, 0x2000000000000L, active2, 0L); case 100: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x2020000000000000L, active2, 0L); - case 101: if ((active0 & 0x2000000000000L) != 0L) { jjmatchedKind = 49; jjmatchedPos = 5; } - else if ((active1 & 0x400L) != 0L) + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8080000000000000L, active2, 0L); + case 101: + if ((active0 & 0x4000000000000L) != 0L) { - jjmatchedKind = 74; + jjmatchedKind = 50; jjmatchedPos = 5; } - else if ((active2 & 0x8000L) != 0L) + else if ((active1 & 0x1000L) != 0L) { - jjmatchedKind = 143; + jjmatchedKind = 76; jjmatchedPos = 5; } - else if ((active2 & 0x200000L) != 0L) + else if ((active2 & 0x20000L) != 0L) { - jjmatchedKind = 149; + jjmatchedKind = 145; + jjmatchedPos = 5; + } + else if ((active2 & 0x800000L) != 0L) + { + jjmatchedKind = 151; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x1004001600800000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L, active1, 0x4010005802000000L, active2, 0L); case 102: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 103: - if ((active0 & 0x400000000000000L) != 0L) + if ((active0 & 0x800000000000000L) != 0L) { - jjmatchedKind = 58; + jjmatchedKind = 59; jjmatchedPos = 5; } break; case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x8000000000000L, active2, 0x8L); + return jjMoveStringLiteralDfa6_0(active0, 0x4000000L, active1, 0x20000000000000L, active2, 0x20L); case 108: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x40000000L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0L, active2, 0x100000000L); case 110: - if ((active1 & 0x4L) != 0L) + if ((active1 & 0x8L) != 0L) { - jjmatchedKind = 66; + jjmatchedKind = 67; jjmatchedPos = 5; } - else if ((active1 & 0x400000000000L) != 0L) + else if ((active1 & 0x1000000000000L) != 0L) { - jjmatchedKind = 110; + jjmatchedKind = 112; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x102000080L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x40000800000L, active1, 0x408000100L, active2, 0L); case 111: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000000000000200L, active2, 0x10L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x400L, active2, 0x41L); case 112: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 114: - if ((active1 & 0x1000L) != 0L) + if ((active1 & 0x4000L) != 0L) { - jjmatchedKind = 76; + jjmatchedKind = 78; jjmatchedPos = 5; } - else if ((active1 & 0x200000000000L) != 0L) + else if ((active1 & 0x800000000000L) != 0L) { - jjmatchedKind = 109; + jjmatchedKind = 111; jjmatchedPos = 5; } return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L, active2, 0L); @@ -1694,12 +1733,12 @@ else if ((active1 & 0x200000000000L) != 0L) jjmatchedKind = 33; jjmatchedPos = 5; } - else if ((active0 & 0x40000000000000L) != 0L) + else if ((active0 & 0x80000000000000L) != 0L) { - jjmatchedKind = 54; + jjmatchedKind = 55; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x4000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x10000L, active2, 0L); case 116: if ((active0 & 0x400000L) != 0L) { @@ -1711,32 +1750,32 @@ else if ((active0 & 0x40000000L) != 0L) jjmatchedKind = 30; jjmatchedPos = 5; } - else if ((active0 & 0x20000000000000L) != 0L) + else if ((active0 & 0x40000000000000L) != 0L) { - jjmatchedKind = 53; + jjmatchedKind = 54; jjmatchedPos = 5; } - else if ((active1 & 0x100000000000L) != 0L) + else if ((active1 & 0x400000000000L) != 0L) { - jjmatchedKind = 108; + jjmatchedKind = 110; jjmatchedPos = 5; } - else if ((active2 & 0x1L) != 0L) + else if ((active2 & 0x4L) != 0L) { - jjmatchedKind = 128; + jjmatchedKind = 130; jjmatchedPos = 5; } - else if ((active2 & 0x4000L) != 0L) + else if ((active2 & 0x10000L) != 0L) { - jjmatchedKind = 142; + jjmatchedKind = 144; jjmatchedPos = 5; } - else if ((active2 & 0x4000000L) != 0L) + else if ((active2 & 0x10000000L) != 0L) { - jjmatchedKind = 154; + jjmatchedKind = 156; jjmatchedPos = 5; } - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 120: if ((active0 & 0x200000L) != 0L) { @@ -1745,13 +1784,14 @@ else if ((active2 & 0x4000000L) != 0L) } break; case 121: - return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x8000000L, active2, 0L); + return jjMoveStringLiteralDfa6_0(active0, 0L, active1, 0x20000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 5); } -private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 5); try { curChar = input_stream.readChar(); } @@ -1761,20 +1801,20 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long a switch(curChar) { case 65: - return jjMoveStringLiteralDfa7_0(active0, 0x10040000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x20040000000000L, active1, 0L, active2, 0L); case 66: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 67: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x12100L, active2, 0L); case 68: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x8L) != 0L) + else if ((active2 & 0x20L) != 0L) { - jjmatchedKind = 131; + jjmatchedKind = 133; jjmatchedPos = 6; } break; @@ -1784,23 +1824,23 @@ else if ((active2 & 0x8L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 113; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 71: - if ((active1 & 0x2000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 91; jjmatchedPos = 6; } break; case 75: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 98; jjmatchedPos = 6; } break; @@ -1810,75 +1850,75 @@ else if ((active1 & 0x800000000000L) != 0L) jjmatchedKind = 48; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 77: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200L, active2, 0L); case 78: - if ((active2 & 0x10L) != 0L) + if ((active2 & 0x40L) != 0L) { - jjmatchedKind = 132; + jjmatchedKind = 134; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0x1L); case 79: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 80: - if ((active1 & 0x200L) != 0L) + if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000080L, active2, 0L); case 82: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40005800000000L, active2, 0L); case 83: - if ((active1 & 0x20000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 119; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 126; jjmatchedPos = 6; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 127; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000040L, active2, 0L); case 84: - if ((active0 & 0x8000000000000L) != 0L) + if ((active0 & 0x10000000000000L) != 0L) { - jjmatchedKind = 51; + jjmatchedKind = 52; jjmatchedPos = 6; } - else if ((active2 & 0x40000000L) != 0L) + else if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 160; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000000L, active1, 0x80000000L, active2, 0L); case 85: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); case 95: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 97: - return jjMoveStringLiteralDfa7_0(active0, 0x10040000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x20040000000000L, active1, 0L, active2, 0L); case 98: return jjMoveStringLiteralDfa7_0(active0, 0x4000000L, active1, 0L, active2, 0L); case 99: - return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x4880L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x800000L, active1, 0x12100L, active2, 0L); case 100: if ((active0 & 0x1000000L) != 0L) { jjmatchedKind = 24; jjmatchedPos = 6; } - else if ((active2 & 0x8L) != 0L) + else if ((active2 & 0x20L) != 0L) { - jjmatchedKind = 131; + jjmatchedKind = 133; jjmatchedPos = 6; } break; @@ -1888,23 +1928,23 @@ else if ((active2 & 0x8L) != 0L) jjmatchedKind = 46; jjmatchedPos = 6; } - else if ((active1 & 0x800000000000L) != 0L) + else if ((active1 & 0x2000000000000L) != 0L) { - jjmatchedKind = 111; + jjmatchedKind = 113; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x80000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200000000000000L, active2, 0L); case 103: - if ((active1 & 0x2000000L) != 0L) + if ((active1 & 0x8000000L) != 0L) { - jjmatchedKind = 89; + jjmatchedKind = 91; jjmatchedPos = 6; } break; case 107: - if ((active1 & 0x100000000L) != 0L) + if ((active1 & 0x400000000L) != 0L) { - jjmatchedKind = 96; + jjmatchedKind = 98; jjmatchedPos = 6; } break; @@ -1914,56 +1954,56 @@ else if ((active1 & 0x800000000000L) != 0L) jjmatchedKind = 48; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L, active1, 0L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L, active1, 0L, active2, 0L); case 109: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x200L, active2, 0L); case 110: - if ((active2 & 0x10L) != 0L) + if ((active2 & 0x40L) != 0L) { - jjmatchedKind = 132; + jjmatchedKind = 134; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x4008000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000000000000L, active2, 0x1L); case 111: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40000000000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 112: - if ((active1 & 0x200L) != 0L) + if ((active1 & 0x400L) != 0L) { - jjmatchedKind = 73; + jjmatchedKind = 74; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x8000040L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x20000080L, active2, 0L); case 114: - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x10001600000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x40005800000000L, active2, 0L); case 115: - if ((active1 & 0x20000000000000L) != 0L) + if ((active1 & 0x80000000000000L) != 0L) { - jjmatchedKind = 117; + jjmatchedKind = 119; jjmatchedPos = 6; } - else if ((active1 & 0x1000000000000000L) != 0L) + else if ((active1 & 0x4000000000000000L) != 0L) { - jjmatchedKind = 124; + jjmatchedKind = 126; jjmatchedPos = 6; } - else if ((active1 & 0x2000000000000000L) != 0L) + else if ((active1 & 0x8000000000000000L) != 0L) { - jjmatchedKind = 125; + jjmatchedKind = 127; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x800020L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000040L, active2, 0L); case 116: - if ((active0 & 0x8000000000000L) != 0L) + if ((active0 & 0x10000000000000L) != 0L) { - jjmatchedKind = 51; + jjmatchedKind = 52; jjmatchedPos = 6; } - else if ((active2 & 0x40000000L) != 0L) + else if ((active2 & 0x100000000L) != 0L) { - jjmatchedKind = 158; + jjmatchedKind = 160; jjmatchedPos = 6; } - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L, active1, 0x20000000L, active2, 0L); + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000000L, active1, 0x80000000L, active2, 0L); case 117: return jjMoveStringLiteralDfa7_0(active0, 0x8000000L, active1, 0L, active2, 0L); default : @@ -1971,7 +2011,8 @@ else if ((active2 & 0x40000000L) != 0L) } return jjMoveNfa_0(0, 6); } -private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2){ +private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 6); try { curChar = input_stream.readChar(); } @@ -1981,45 +2022,45 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long a switch(curChar) { case 65: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x800000040L, active2, 0L); case 67: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x80000000L, active2, 0L); case 69: if ((active0 & 0x4000000L) != 0L) { jjmatchedKind = 26; jjmatchedPos = 7; } - else if ((active0 & 0x4000000000000L) != 0L) + else if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 50; + jjmatchedKind = 51; jjmatchedPos = 7; } - else if ((active1 & 0x80L) != 0L) + else if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } - else if ((active1 & 0x4000L) != 0L) + else if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 80; jjmatchedPos = 7; } - else if ((active1 & 0x8000000L) != 0L) + else if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 93; jjmatchedPos = 7; } - else if ((active1 & 0x4000000000000000L) != 0L) + else if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 128; jjmatchedPos = 7; } break; case 70: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 73: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x1000000000L, active2, 0L); case 76: if ((active0 & 0x40000000000L) != 0L) { @@ -2028,32 +2069,32 @@ else if ((active1 & 0x4000000000000000L) != 0L) } break; case 77: - if ((active1 & 0x1000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 102; jjmatchedPos = 7; } break; case 79: - return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); + return jjMoveStringLiteralDfa8_0(active0, 0x1000000000000000L, active1, 0x2080L, active2, 0L); case 80: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 7; } break; case 82: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 121; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 83: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 117; jjmatchedPos = 7; } break; @@ -2063,52 +2104,52 @@ else if ((active1 & 0x4000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x800000L) != 0L) + else if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 89; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x10000000000000L, active1, 0x10000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x20000000000000L, active1, 0x40000000000000L, active2, 0L); case 97: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x200000020L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x800000040L, active2, 0L); case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x20000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L, active1, 0x80000000L, active2, 0L); case 101: if ((active0 & 0x4000000L) != 0L) { jjmatchedKind = 26; jjmatchedPos = 7; } - else if ((active0 & 0x4000000000000L) != 0L) + else if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 50; + jjmatchedKind = 51; jjmatchedPos = 7; } - else if ((active1 & 0x80L) != 0L) + else if ((active1 & 0x100L) != 0L) { - jjmatchedKind = 71; + jjmatchedKind = 72; jjmatchedPos = 7; } - else if ((active1 & 0x4000L) != 0L) + else if ((active1 & 0x10000L) != 0L) { - jjmatchedKind = 78; + jjmatchedKind = 80; jjmatchedPos = 7; } - else if ((active1 & 0x8000000L) != 0L) + else if ((active1 & 0x20000000L) != 0L) { - jjmatchedKind = 91; + jjmatchedKind = 93; jjmatchedPos = 7; } - else if ((active1 & 0x4000000000000000L) != 0L) + else if ((active2 & 0x1L) != 0L) { - jjmatchedKind = 126; + jjmatchedKind = 128; jjmatchedPos = 7; } break; case 102: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x10000000000000L, active2, 0L); case 105: - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x400000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x1000000000L, active2, 0L); case 108: if ((active0 & 0x40000000000L) != 0L) { @@ -2117,32 +2158,32 @@ else if ((active1 & 0x4000000000000000L) != 0L) } break; case 109: - if ((active1 & 0x1000000000L) != 0L) + if ((active1 & 0x4000000000L) != 0L) { - jjmatchedKind = 100; + jjmatchedKind = 102; jjmatchedPos = 7; } break; case 111: - return jjMoveStringLiteralDfa8_0(active0, 0x800000000000000L, active1, 0x840L); + return jjMoveStringLiteralDfa8_0(active0, 0x1000000000000000L, active1, 0x2080L, active2, 0L); case 112: - if ((active1 & 0x100L) != 0L) + if ((active1 & 0x200L) != 0L) { - jjmatchedKind = 72; + jjmatchedKind = 73; jjmatchedPos = 7; } break; case 114: - if ((active1 & 0x80000000000000L) != 0L) + if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 119; + jjmatchedKind = 121; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x40000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x100000000000000L, active2, 0L); case 115: - if ((active1 & 0x8000000000000L) != 0L) + if ((active1 & 0x20000000000000L) != 0L) { - jjmatchedKind = 115; + jjmatchedKind = 117; jjmatchedPos = 7; } break; @@ -2152,19 +2193,20 @@ else if ((active1 & 0x4000000000000000L) != 0L) jjmatchedKind = 23; jjmatchedPos = 7; } - else if ((active1 & 0x800000L) != 0L) + else if ((active1 & 0x2000000L) != 0L) { - jjmatchedKind = 87; + jjmatchedKind = 89; jjmatchedPos = 7; } - return jjMoveStringLiteralDfa8_0(active0, 0x10000000000000L, active1, 0x10000000000000L); + return jjMoveStringLiteralDfa8_0(active0, 0x20000000000000L, active1, 0x40000000000000L, active2, 0L); default : break; } return jjMoveNfa_0(0, 7); } -private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1){ - if (((active0 &= old0) | (active1 &= old1)) == 0L) +private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1, long old2, long active2) +{ + if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L) return jjMoveNfa_0(0, 7); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { @@ -2173,57 +2215,57 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 100; jjmatchedPos = 8; } break; case 69: - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { - jjmatchedKind = 52; + jjmatchedKind = 53; jjmatchedPos = 8; } - else if ((active1 & 0x40000000000000L) != 0L) + else if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 120; jjmatchedPos = 8; } break; case 72: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x80000000L); case 76: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 99; jjmatchedPos = 8; } break; case 77: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x40L); case 78: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000L); case 79: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000000000L); case 80: - if ((active1 & 0x40L) != 0L) + if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 8; } break; case 82: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 8; } break; case 83: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 118; jjmatchedPos = 8; } break; @@ -2235,57 +2277,57 @@ else if ((active1 & 0x40000000000000L) != 0L) } break; case 99: - if ((active1 & 0x400000000L) != 0L) + if ((active1 & 0x1000000000L) != 0L) { - jjmatchedKind = 98; + jjmatchedKind = 100; jjmatchedPos = 8; } break; case 101: - if ((active0 & 0x10000000000000L) != 0L) + if ((active0 & 0x20000000000000L) != 0L) { - jjmatchedKind = 52; + jjmatchedKind = 53; jjmatchedPos = 8; } - else if ((active1 & 0x40000000000000L) != 0L) + else if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 118; + jjmatchedKind = 120; jjmatchedPos = 8; } break; case 104: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x80000000L); case 108: - if ((active1 & 0x200000000L) != 0L) + if ((active1 & 0x800000000L) != 0L) { - jjmatchedKind = 97; + jjmatchedKind = 99; jjmatchedPos = 8; } break; case 109: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x20L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x40L); case 110: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x800L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000L); case 111: - return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x4000000000000L); + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x10000000000000L); case 112: - if ((active1 & 0x40L) != 0L) + if ((active1 & 0x80L) != 0L) { - jjmatchedKind = 70; + jjmatchedKind = 71; jjmatchedPos = 8; } break; case 114: - if ((active0 & 0x800000000000000L) != 0L) + if ((active0 & 0x1000000000000000L) != 0L) { - jjmatchedKind = 59; + jjmatchedKind = 60; jjmatchedPos = 8; } break; case 115: - if ((active1 & 0x10000000000000L) != 0L) + if ((active1 & 0x40000000000000L) != 0L) { - jjmatchedKind = 116; + jjmatchedKind = 118; jjmatchedPos = 8; } break; @@ -2301,7 +2343,8 @@ else if ((active1 & 0x40000000000000L) != 0L) } return jjMoveNfa_0(0, 8); } -private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1){ +private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) +{ if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjMoveNfa_0(0, 8); try { curChar = input_stream.readChar(); } @@ -2311,37 +2354,38 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long a switch(curChar) { case 67: - return jjMoveStringLiteralDfa10_0(active1, 0x800L); + return jjMoveStringLiteralDfa10_0(active1, 0x2000L); case 69: - return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x80000000L); case 80: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 9; } break; case 82: - return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x10000000000000L); case 99: - return jjMoveStringLiteralDfa10_0(active1, 0x800L); + return jjMoveStringLiteralDfa10_0(active1, 0x2000L); case 101: - return jjMoveStringLiteralDfa10_0(active1, 0x20000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x80000000L); case 112: - if ((active1 & 0x20L) != 0L) + if ((active1 & 0x40L) != 0L) { - jjmatchedKind = 69; + jjmatchedKind = 70; jjmatchedPos = 9; } break; case 114: - return jjMoveStringLiteralDfa10_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa10_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 9); } -private int jjMoveStringLiteralDfa10_0(long old1, long active1){ +private int jjMoveStringLiteralDfa10_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 9); try { curChar = input_stream.readChar(); } @@ -2351,22 +2395,22 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ switch(curChar) { case 65: - return jjMoveStringLiteralDfa11_0(active1, 0x800L); + return jjMoveStringLiteralDfa11_0(active1, 0x2000L); case 83: - if ((active1 & 0x20000000L) != 0L) + if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 95; jjmatchedPos = 10; } break; case 95: - return jjMoveStringLiteralDfa11_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa11_0(active1, 0x10000000000000L); case 97: - return jjMoveStringLiteralDfa11_0(active1, 0x800L); + return jjMoveStringLiteralDfa11_0(active1, 0x2000L); case 115: - if ((active1 & 0x20000000L) != 0L) + if ((active1 & 0x80000000L) != 0L) { - jjmatchedKind = 93; + jjmatchedKind = 95; jjmatchedPos = 10; } break; @@ -2375,7 +2419,8 @@ private int jjMoveStringLiteralDfa10_0(long old1, long active1){ } return jjMoveNfa_0(0, 10); } -private int jjMoveStringLiteralDfa11_0(long old1, long active1){ +private int jjMoveStringLiteralDfa11_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 10); try { curChar = input_stream.readChar(); } @@ -2385,29 +2430,30 @@ private int jjMoveStringLiteralDfa11_0(long old1, long active1){ switch(curChar) { case 84: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 77; jjmatchedPos = 11; } break; case 85: - return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x10000000000000L); case 116: - if ((active1 & 0x800L) != 0L) + if ((active1 & 0x2000L) != 0L) { - jjmatchedKind = 75; + jjmatchedKind = 77; jjmatchedPos = 11; } break; case 117: - return jjMoveStringLiteralDfa12_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa12_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 11); } -private int jjMoveStringLiteralDfa12_0(long old1, long active1){ +private int jjMoveStringLiteralDfa12_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 11); try { curChar = input_stream.readChar(); } @@ -2417,15 +2463,16 @@ private int jjMoveStringLiteralDfa12_0(long old1, long active1){ switch(curChar) { case 82: - return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x10000000000000L); case 114: - return jjMoveStringLiteralDfa13_0(active1, 0x4000000000000L); + return jjMoveStringLiteralDfa13_0(active1, 0x10000000000000L); default : break; } return jjMoveNfa_0(0, 12); } -private int jjMoveStringLiteralDfa13_0(long old1, long active1){ +private int jjMoveStringLiteralDfa13_0(long old1, long active1) +{ if (((active1 &= old1)) == 0L) return jjMoveNfa_0(0, 12); try { curChar = input_stream.readChar(); } @@ -2435,16 +2482,16 @@ private int jjMoveStringLiteralDfa13_0(long old1, long active1){ switch(curChar) { case 73: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 116; jjmatchedPos = 13; } break; case 105: - if ((active1 & 0x4000000000000L) != 0L) + if ((active1 & 0x10000000000000L) != 0L) { - jjmatchedKind = 114; + jjmatchedKind = 116; jjmatchedPos = 13; } break; @@ -2523,51 +2570,51 @@ private int jjMoveNfa_0(int startState, int curPos) case 0: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 163) - kind = 163; - { jjCheckNAddStates(0, 6); } + if (kind > 165) + kind = 165; + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); } else if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 148; else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 124; else if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); else if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); } else if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); else if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2583,11 +2630,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 7: if (curChar == 62 && kind > 10) @@ -2620,11 +2667,11 @@ else if (curChar == 39) case 16: case 21: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 19: if ((0x3ff000000000000L & l) != 0L) @@ -2636,18 +2683,18 @@ else if (curChar == 39) break; case 22: if (curChar == 58) - { jjAddStates(40, 41); } + jjAddStates(40, 41); break; case 23: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2655,7 +2702,7 @@ else if (curChar == 39) break; case 32: if (curChar == 63) - { jjAddStates(32, 33); } + jjAddStates(32, 33); break; case 33: case 34: @@ -2663,11 +2710,11 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 38: if (curChar == 36) - { jjAddStates(24, 25); } + jjAddStates(24, 25); break; case 39: case 40: @@ -2675,62 +2722,62 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 46: if (curChar == 45) - { jjCheckNAdd(47); } + jjCheckNAdd(47); break; case 47: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 49: if (curChar == 35) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 50: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 51: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 52: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 57: if (curChar == 10) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 58: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 57; break; case 65: - if ((0x8400000000L & l) != 0L && kind > 175) - kind = 175; + if ((0x8400000000L & l) != 0L && kind > 177) + kind = 177; break; case 66: if (curChar == 39) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 67: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 68: - if (curChar == 39 && kind > 179) - kind = 179; + if (curChar == 39 && kind > 181) + kind = 181; break; case 70: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 72: if ((0x3ff000000000000L & l) != 0L) @@ -2759,11 +2806,11 @@ else if (curChar == 39) case 78: case 83: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 81: if ((0x3ff000000000000L & l) != 0L) @@ -2775,19 +2822,19 @@ else if (curChar == 39) break; case 84: if (curChar == 34) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 85: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 86: - if (curChar == 34 && kind > 180) - kind = 180; + if (curChar == 34 && kind > 182) + kind = 182; break; case 88: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 90: if ((0x3ff000000000000L & l) != 0L) @@ -2816,11 +2863,11 @@ else if (curChar == 39) case 96: case 101: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 99: if ((0x3ff000000000000L & l) != 0L) @@ -2832,24 +2879,24 @@ else if (curChar == 39) break; case 102: if (curChar == 39) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 103: case 106: if (curChar == 39) - { jjCheckNAddTwoStates(104, 107); } + jjCheckNAddTwoStates(104, 107); break; case 104: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 105: if (curChar == 39) - { jjAddStates(58, 59); } + jjAddStates(58, 59); break; case 108: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 110: if ((0x3ff000000000000L & l) != 0L) @@ -2878,11 +2925,11 @@ else if (curChar == 39) case 116: case 121: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 119: if ((0x3ff000000000000L & l) != 0L) @@ -2893,8 +2940,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 121; break; case 122: - if (curChar == 39 && kind > 181) - kind = 181; + if (curChar == 39 && kind > 183) + kind = 183; break; case 123: if (curChar == 39) @@ -2910,24 +2957,24 @@ else if (curChar == 39) break; case 126: if (curChar == 34) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 127: case 130: if (curChar == 34) - { jjCheckNAddTwoStates(128, 131); } + jjCheckNAddTwoStates(128, 131); break; case 128: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 129: if (curChar == 34) - { jjAddStates(64, 65); } + jjAddStates(64, 65); break; case 132: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 134: if ((0x3ff000000000000L & l) != 0L) @@ -2956,11 +3003,11 @@ else if (curChar == 39) case 140: case 145: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 143: if ((0x3ff000000000000L & l) != 0L) @@ -2971,8 +3018,8 @@ else if (curChar == 39) jjstateSet[jjnewStateCnt++] = 145; break; case 146: - if (curChar == 34 && kind > 182) - kind = 182; + if (curChar == 34 && kind > 184) + kind = 184; break; case 147: if (curChar == 34) @@ -2988,31 +3035,31 @@ else if (curChar == 39) break; case 150: if (curChar == 40) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 151: if (curChar == 35) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 152: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(66, 71); } + jjCheckNAddStates(66, 71); break; case 153: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 154: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 155: - if (curChar == 41 && kind > 185) - kind = 185; + if (curChar == 41 && kind > 187) + kind = 187; break; case 156: if (curChar == 10) - { jjCheckNAddStates(21, 23); } + jjCheckNAddStates(21, 23); break; case 157: if (curChar == 13) @@ -3020,23 +3067,23 @@ else if (curChar == 39) break; case 159: if (curChar == 35) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 160: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 161: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 162: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 164: if (curChar == 10) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 165: if (curChar == 13) @@ -3044,7 +3091,7 @@ else if (curChar == 39) break; case 167: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(81, 83); } + jjAddStates(81, 83); break; case 168: if ((0x3ff200000000000L & l) != 0L) @@ -3056,7 +3103,7 @@ else if (curChar == 39) break; case 173: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(84, 86); } + jjAddStates(84, 86); break; case 174: if ((0x3ff200000000000L & l) != 0L) @@ -3064,18 +3111,18 @@ else if (curChar == 39) break; case 175: if (curChar == 58) - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 176: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -3083,11 +3130,11 @@ else if (curChar == 39) break; case 182: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 183: if (curChar == 37) - { jjAddStates(92, 93); } + jjAddStates(92, 93); break; case 184: if ((0x3ff000000000000L & l) != 0L) @@ -3095,7 +3142,7 @@ else if (curChar == 39) break; case 185: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x3ff000000000000L & l) != 0L) @@ -3114,7 +3161,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 192: if (curChar == 37) @@ -3129,34 +3176,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 203: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 20); } + jjCheckNAddStates(17, 20); break; case 206: if (curChar == 35) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 207: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 208: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 209: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 214: if (curChar == 10) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 215: if (curChar == 13) @@ -3164,23 +3211,23 @@ else if (curChar == 39) break; case 221: if (curChar == 35) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 222: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 223: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 224: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 230: if (curChar == 10) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 231: if (curChar == 13) @@ -3189,262 +3236,262 @@ else if (curChar == 39) case 236: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAddStates(0, 6); } + if (kind > 165) + kind = 165; + jjCheckNAddStates(0, 6); break; case 237: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 163) - kind = 163; - { jjCheckNAdd(237); } + if (kind > 165) + kind = 165; + jjCheckNAdd(237); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 239: if (curChar == 46) - { jjCheckNAdd(240); } + jjCheckNAdd(240); break; case 240: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 164) - kind = 164; - { jjCheckNAdd(240); } + if (kind > 166) + kind = 166; + jjCheckNAdd(240); break; case 241: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(241, 242); } + jjCheckNAddTwoStates(241, 242); break; case 242: if (curChar == 46) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 245: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(246); } + jjCheckNAdd(246); break; case 246: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(246); } + if (kind > 167) + kind = 167; + jjCheckNAdd(246); break; case 247: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(247, 248); } + jjCheckNAddTwoStates(247, 248); break; case 249: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(250); } + jjCheckNAdd(250); break; case 250: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(250); } + if (kind > 167) + kind = 167; + jjCheckNAdd(250); break; case 251: if (curChar == 46) - { jjCheckNAddTwoStates(240, 252); } + jjCheckNAddTwoStates(240, 252); break; case 252: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(252, 253); } + jjCheckNAddTwoStates(252, 253); break; case 254: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(255); } + jjCheckNAdd(255); break; case 255: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 165) - kind = 165; - { jjCheckNAdd(255); } + if (kind > 167) + kind = 167; + jjCheckNAdd(255); break; case 256: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 257: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 166) - kind = 166; - { jjCheckNAdd(257); } + if (kind > 168) + kind = 168; + jjCheckNAdd(257); break; case 258: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(258, 259); } + jjCheckNAddTwoStates(258, 259); break; case 259: if (curChar == 46) - { jjCheckNAdd(260); } + jjCheckNAdd(260); break; case 260: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 167) - kind = 167; - { jjCheckNAdd(260); } + if (kind > 169) + kind = 169; + jjCheckNAdd(260); break; case 261: if (curChar == 46) - { jjCheckNAdd(262); } + jjCheckNAdd(262); break; case 262: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(262, 263); } + jjCheckNAddTwoStates(262, 263); break; case 264: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(265); } + jjCheckNAdd(265); break; case 265: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(265); } + if (kind > 170) + kind = 170; + jjCheckNAdd(265); break; case 266: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(112, 115); } + jjCheckNAddStates(112, 115); break; case 267: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(267, 268); } + jjCheckNAddTwoStates(267, 268); break; case 268: if (curChar == 46) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 269: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(269, 270); } + jjCheckNAddTwoStates(269, 270); break; case 271: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(272); } + jjCheckNAdd(272); break; case 272: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(272); } + if (kind > 170) + kind = 170; + jjCheckNAdd(272); break; case 273: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(273, 274); } + jjCheckNAddTwoStates(273, 274); break; case 275: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(276); } + jjCheckNAdd(276); break; case 276: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 168) - kind = 168; - { jjCheckNAdd(276); } + if (kind > 170) + kind = 170; + jjCheckNAdd(276); break; case 277: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 278: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 169) - kind = 169; - { jjCheckNAdd(278); } + if (kind > 171) + kind = 171; + jjCheckNAdd(278); break; case 279: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(279, 280); } + jjCheckNAddTwoStates(279, 280); break; case 280: if (curChar == 46) - { jjCheckNAdd(281); } + jjCheckNAdd(281); break; case 281: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 170) - kind = 170; - { jjCheckNAdd(281); } + if (kind > 172) + kind = 172; + jjCheckNAdd(281); break; case 282: if (curChar == 46) - { jjCheckNAdd(283); } + jjCheckNAdd(283); break; case 283: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(283, 284); } + jjCheckNAddTwoStates(283, 284); break; case 285: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(286); } + jjCheckNAdd(286); break; case 286: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(286); } + if (kind > 173) + kind = 173; + jjCheckNAdd(286); break; case 287: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(116, 119); } + jjCheckNAddStates(116, 119); break; case 288: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(288, 289); } + jjCheckNAddTwoStates(288, 289); break; case 289: if (curChar == 46) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 290: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(290, 291); } + jjCheckNAddTwoStates(290, 291); break; case 292: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(293); } + jjCheckNAdd(293); break; case 293: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(293); } + if (kind > 173) + kind = 173; + jjCheckNAdd(293); break; case 294: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(294, 295); } + jjCheckNAddTwoStates(294, 295); break; case 296: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(297); } + jjCheckNAdd(297); break; case 297: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 171) - kind = 171; - { jjCheckNAdd(297); } + if (kind > 173) + kind = 173; + jjCheckNAdd(297); break; default : break; } @@ -3459,32 +3506,32 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); else if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 65; else if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 22; if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 62; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 8: if (curChar == 92) - { jjAddStates(130, 131); } + jjAddStates(130, 131); break; case 9: if (curChar == 85) @@ -3517,11 +3564,11 @@ else if ((0x20000000200L & l) != 0L) case 16: case 21: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(17); } + jjCheckNAdd(17); break; case 17: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 18: if (curChar == 117) @@ -3540,11 +3587,11 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3560,7 +3607,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 39: case 40: @@ -3568,36 +3615,36 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 44: if (curChar == 64) - { jjCheckNAdd(45); } + jjCheckNAdd(45); break; case 45: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(45, 46); } + jjCheckNAddTwoStates(45, 46); break; case 47: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(46, 47); } + jjCheckNAddTwoStates(46, 47); break; case 48: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(51, 53); } + jjCheckNAddStates(51, 53); break; case 50: - { jjCheckNAddStates(45, 50); } + jjCheckNAddStates(45, 50); break; case 53: - if ((0x200000002L & l) != 0L && kind > 144) - kind = 144; + if ((0x200000002L & l) != 0L && kind > 146) + kind = 146; break; case 54: if ((0x10000000100000L & l) != 0L) @@ -3636,20 +3683,20 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 65; break; case 65: - if ((0x14404410000000L & l) != 0L && kind > 175) - kind = 175; + if ((0x14404410000000L & l) != 0L && kind > 177) + kind = 177; break; case 67: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 69: if (curChar == 92) - { jjAddStates(132, 134); } + jjAddStates(132, 134); break; case 70: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 71: if (curChar == 85) @@ -3682,11 +3729,11 @@ else if ((0x20000000200L & l) != 0L) case 78: case 83: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(79); } + jjCheckNAdd(79); break; case 79: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(37, 39); } + jjCheckNAddStates(37, 39); break; case 80: if (curChar == 117) @@ -3702,15 +3749,15 @@ else if ((0x20000000200L & l) != 0L) break; case 85: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 87: if (curChar == 92) - { jjAddStates(135, 137); } + jjAddStates(135, 137); break; case 88: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 89: if (curChar == 85) @@ -3743,11 +3790,11 @@ else if ((0x20000000200L & l) != 0L) case 96: case 101: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(97); } + jjCheckNAdd(97); break; case 97: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(34, 36); } + jjCheckNAddStates(34, 36); break; case 98: if (curChar == 117) @@ -3763,15 +3810,15 @@ else if ((0x20000000200L & l) != 0L) break; case 104: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 107: if (curChar == 92) - { jjAddStates(138, 140); } + jjAddStates(138, 140); break; case 108: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 109: if (curChar == 85) @@ -3804,11 +3851,11 @@ else if ((0x20000000200L & l) != 0L) case 116: case 121: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(117); } + jjCheckNAdd(117); break; case 117: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(54, 57); } + jjCheckNAddStates(54, 57); break; case 118: if (curChar == 117) @@ -3824,15 +3871,15 @@ else if ((0x20000000200L & l) != 0L) break; case 128: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 131: if (curChar == 92) - { jjAddStates(141, 143); } + jjAddStates(141, 143); break; case 132: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 133: if (curChar == 85) @@ -3865,11 +3912,11 @@ else if ((0x20000000200L & l) != 0L) case 140: case 145: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 141: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(60, 63); } + jjCheckNAddStates(60, 63); break; case 142: if (curChar == 117) @@ -3884,49 +3931,49 @@ else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 145; break; case 152: - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 158: if (curChar == 91) - { jjCheckNAddStates(78, 80); } + jjCheckNAddStates(78, 80); break; case 160: - { jjCheckNAddStates(72, 77); } + jjCheckNAddStates(72, 77); break; case 163: - if (curChar == 93 && kind > 190) - kind = 190; + if (curChar == 93 && kind > 192) + kind = 192; break; case 166: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3934,11 +3981,11 @@ else if ((0x20000000200L & l) != 0L) break; case 181: if (curChar == 92) - { jjAddStates(144, 145); } + jjAddStates(144, 145); break; case 182: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 184: if ((0x7e0000007eL & l) != 0L) @@ -3946,7 +3993,7 @@ else if ((0x20000000200L & l) != 0L) break; case 185: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 186: if ((0x7e0000007eL & l) != 0L) @@ -3969,7 +4016,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 193: if ((0x7e0000007eL & l) != 0L) @@ -3980,22 +4027,22 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 204: if ((0x1000000010L & l) != 0L) - { jjAddStates(128, 129); } + jjAddStates(128, 129); break; case 205: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(100, 102); } + jjCheckNAddStates(100, 102); break; case 207: - { jjCheckNAddStates(94, 99); } + jjCheckNAddStates(94, 99); break; case 210: - if ((0x200000002L & l) != 0L && kind > 145) - kind = 145; + if ((0x200000002L & l) != 0L && kind > 147) + kind = 147; break; case 211: if ((0x10000000100000L & l) != 0L) @@ -4027,14 +4074,14 @@ else if ((0x20000000200L & l) != 0L) break; case 220: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(109, 111); } + jjCheckNAddStates(109, 111); break; case 222: - { jjCheckNAddStates(103, 108); } + jjCheckNAddStates(103, 108); break; case 225: - if ((0x2000000020L & l) != 0L && kind > 146) - kind = 146; + if ((0x2000000020L & l) != 0L && kind > 148) + kind = 148; break; case 226: if ((0x4000000040000L & l) != 0L) @@ -4070,39 +4117,39 @@ else if ((0x20000000200L & l) != 0L) break; case 244: if ((0x2000000020L & l) != 0L) - { jjAddStates(146, 147); } + jjAddStates(146, 147); break; case 248: if ((0x2000000020L & l) != 0L) - { jjAddStates(148, 149); } + jjAddStates(148, 149); break; case 253: if ((0x2000000020L & l) != 0L) - { jjAddStates(150, 151); } + jjAddStates(150, 151); break; case 263: if ((0x2000000020L & l) != 0L) - { jjAddStates(152, 153); } + jjAddStates(152, 153); break; case 270: if ((0x2000000020L & l) != 0L) - { jjAddStates(154, 155); } + jjAddStates(154, 155); break; case 274: if ((0x2000000020L & l) != 0L) - { jjAddStates(156, 157); } + jjAddStates(156, 157); break; case 284: if ((0x2000000020L & l) != 0L) - { jjAddStates(158, 159); } + jjAddStates(158, 159); break; case 291: if ((0x2000000020L & l) != 0L) - { jjAddStates(160, 161); } + jjAddStates(160, 161); break; case 295: if ((0x2000000020L & l) != 0L) - { jjAddStates(162, 163); } + jjAddStates(162, 163); break; default : break; } @@ -4110,7 +4157,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -4121,31 +4168,31 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 23: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 24: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 25: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4153,11 +4200,11 @@ else if ((0x20000000200L & l) != 0L) break; case 26: if (jjCanMove_3(hiByte, i1, i2, l1, l2)) - { jjAddStates(166, 167); } + jjAddStates(166, 167); break; case 27: if (jjCanMove_4(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 28: if (jjCanMove_5(hiByte, i1, i2, l1, l2) && kind > 13) @@ -4172,136 +4219,136 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddStates(42, 44); } + jjCheckNAddStates(42, 44); break; case 33: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 34: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 35: if (jjCanMove_8(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 36: if (!jjCanMove_9(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAddTwoStates(34, 35); } + jjCheckNAddTwoStates(34, 35); break; case 37: if (jjCanMove_10(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(36); } + jjCheckNAdd(36); break; case 39: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 40: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 41: if (jjCanMove_11(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 42: if (!jjCanMove_12(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAddTwoStates(40, 41); } + jjCheckNAddTwoStates(40, 41); break; case 43: if (jjCanMove_13(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(42); } + jjCheckNAdd(42); break; case 50: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(45, 50); } + jjAddStates(45, 50); break; case 67: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(37, 39); } + jjAddStates(37, 39); break; case 85: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(34, 36); } + jjAddStates(34, 36); break; case 104: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(54, 57); } + jjAddStates(54, 57); break; case 128: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(60, 63); } + jjAddStates(60, 63); break; case 152: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(66, 71); } + jjAddStates(66, 71); break; case 160: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(72, 77); } + jjAddStates(72, 77); break; case 166: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(120, 127); } + jjCheckNAddStates(120, 127); break; case 167: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 168: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 170: if (jjCanMove_14(hiByte, i1, i2, l1, l2)) - { jjAddStates(168, 169); } + jjAddStates(168, 169); break; case 171: if (jjCanMove_15(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(81, 83); } + jjCheckNAddStates(81, 83); break; case 172: if (jjCanMove_16(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(169); } + jjCheckNAdd(169); break; case 173: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 174: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 176: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 177: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 178: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4309,11 +4356,11 @@ else if ((0x20000000200L & l) != 0L) break; case 179: if (jjCanMove_17(hiByte, i1, i2, l1, l2)) - { jjAddStates(170, 171); } + jjAddStates(170, 171); break; case 180: if (jjCanMove_18(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 189: if (jjCanMove_19(hiByte, i1, i2, l1, l2) && kind > 12) @@ -4328,41 +4375,41 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(87, 91); } + jjCheckNAddStates(87, 91); break; case 197: if (jjCanMove_22(hiByte, i1, i2, l1, l2)) - { jjAddStates(172, 173); } + jjAddStates(172, 173); break; case 198: if (jjCanMove_23(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(84, 86); } + jjCheckNAddStates(84, 86); break; case 199: if (jjCanMove_24(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(175); } + jjCheckNAdd(175); break; case 200: if (jjCanMove_25(hiByte, i1, i2, l1, l2)) - { jjAddStates(164, 165); } + jjAddStates(164, 165); break; case 201: if (jjCanMove_26(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(174, 177); } + jjCheckNAddStates(174, 177); break; case 202: if (jjCanMove_27(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(178, 181); } + jjCheckNAddStates(178, 181); break; case 207: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(94, 99); } + jjAddStates(94, 99); break; case 222: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(103, 108); } + jjAddStates(103, 108); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -4398,63 +4445,19 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, -null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", -"\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", "\74\74", -"\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", "\55", "\52", -"\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", "\74\55", "\77", null, -null, null, null, null, null, null, null, null, null, null, null, }; -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} static final int[] jjnextStates = { - 237, 238, 239, 241, 242, 247, 248, 278, 279, 280, 282, 287, 257, 258, 259, 261, - 266, 176, 190, 192, 195, 151, 154, 155, 39, 43, 6, 7, 8, 1, 2, 4, - 33, 37, 85, 86, 87, 67, 68, 69, 23, 29, 24, 25, 26, 49, 50, 51, - 58, 52, 56, 49, 52, 56, 103, 104, 105, 107, 106, 123, 127, 128, 129, 131, - 130, 147, 151, 152, 153, 157, 154, 155, 159, 160, 161, 165, 162, 163, 159, 162, - 163, 167, 168, 170, 173, 174, 197, 177, 178, 179, 181, 183, 184, 186, 206, 207, - 208, 215, 209, 213, 206, 209, 213, 221, 222, 223, 231, 224, 229, 221, 224, 229, - 267, 268, 273, 274, 288, 289, 294, 295, 167, 168, 169, 173, 174, 175, 197, 170, - 219, 235, 9, 18, 70, 71, 80, 88, 89, 98, 108, 109, 118, 132, 133, 142, - 182, 188, 245, 246, 249, 250, 254, 255, 264, 265, 271, 272, 275, 276, 285, 286, - 292, 293, 296, 297, 201, 202, 27, 28, 171, 172, 180, 189, 198, 199, 167, 168, - 169, 170, 173, 174, 175, 197, + 237, 238, 239, 241, 242, 247, 248, 278, 279, 280, 282, 287, 257, 258, 259, 261, + 266, 176, 190, 192, 195, 151, 154, 155, 39, 43, 6, 7, 8, 1, 2, 4, + 33, 37, 85, 86, 87, 67, 68, 69, 23, 29, 24, 25, 26, 49, 50, 51, + 58, 52, 56, 49, 52, 56, 103, 104, 105, 107, 106, 123, 127, 128, 129, 131, + 130, 147, 151, 152, 153, 157, 154, 155, 159, 160, 161, 165, 162, 163, 159, 162, + 163, 167, 168, 170, 173, 174, 197, 177, 178, 179, 181, 183, 184, 186, 206, 207, + 208, 215, 209, 213, 206, 209, 213, 221, 222, 223, 231, 224, 229, 221, 224, 229, + 267, 268, 273, 274, 288, 289, 294, 295, 167, 168, 169, 173, 174, 175, 197, 170, + 219, 235, 9, 18, 70, 71, 80, 88, 89, 98, 108, 109, 118, 132, 133, 142, + 182, 188, 245, 246, 249, 250, 254, 255, 264, 265, 271, 272, 275, 276, 285, 286, + 292, 293, 296, 297, 201, 202, 27, 28, 171, 172, 180, 189, 198, 199, 167, 168, + 169, 170, 173, 174, 175, 197, }; private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { @@ -4767,6 +4770,113 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, "\50", "\51", null, "\173", "\175", "\133", "\135", null, +"\73", "\54", "\56", "\75", "\41\75", "\76", "\74", "\74\75", "\76\75", "\76\76", +"\74\74", "\173\174", "\174\175", "\41", "\176", "\72", "\174\174", "\46\46", "\53", +"\55", "\52", "\57", "\136\136", "\100", "\72\75", "\174", "\136", "\55\76", +"\74\55", "\77", null, null, null, null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xffe23fefffffffffL, 0x7fffffffL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[298]; +private final int[] jjstateSet = new int[596]; +protected char curChar; +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public ARQParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 298; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4775,7 +4885,7 @@ private static final boolean jjCanMove_27(int hiByte, int i1, int i2, long l1, l int jjmatchedKind; /** Get the next Token. */ -public Token getNextToken() +public Token getNextToken() { Token specialToken = null; Token matchedToken; @@ -4788,10 +4898,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4849,31 +4958,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4901,98 +4985,4 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } - /** Constructor. */ - public ARQParserTokenManager(SimpleCharStream stream){ - - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - - input_stream = stream; - } - - /** Constructor. */ - public ARQParserTokenManager (SimpleCharStream stream, int lexState){ - ReInit(stream); - SwitchTo(lexState); - } - - /** Reinitialise parser. */ - - public void ReInit(SimpleCharStream stream) - { - - - jjmatchedPos = - jjnewStateCnt = - 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() - { - int i; - jjround = 0x80000001; - for (i = 298; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - /** Reinitialise parser. */ - public void ReInit(SimpleCharStream stream, int lexState) - - { - ReInit(stream); - SwitchTo(lexState); - } - - /** Switch to specified lex state. */ - public void SwitchTo(int lexState) - { - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; - -/** Lex State array. */ -public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -}; -static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfff88ffbffffffffL, 0x1fffffffL, -}; -static final long[] jjtoSkip = { - 0x7eL, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x40L, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoMore = { - 0x0L, 0x0L, 0x0L, 0x0L, -}; - protected SimpleCharStream input_stream; - - private final int[] jjrounds = new int[298]; - private final int[] jjstateSet = new int[2 * 298]; - private final StringBuilder jjimage = new StringBuilder(); - private StringBuilder image = jjimage; - private int jjimageLen; - private int lengthOfMatch; - protected int curChar; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java index cb1919325b9..b41e002b02e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ -/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ package org.apache.jena.sparql.lang.arq ; /** @@ -20,11 +20,6 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -65,7 +60,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * following this token will (therefore) be the first error token. + * followng this token will (therefore) be the first error token. */ public Token currentToken; @@ -93,8 +88,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -106,7 +101,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(EOL).append(" "); + expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -122,26 +117,21 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - if (currentToken.next != null) { - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - } - retval += "." + EOL; - - - if (expectedTokenSequences.length == 0) { - // Nothing to add here + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; } else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); + retval += "Was expecting one of:" + eol + " "; } - + retval += expected.toString(); return retval; } + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -149,11 +139,13 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -192,4 +184,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=7f03520468cc43d4f83f09bbb6a97299 (do not edit this line) */ +/* JavaCC - OriginalChecksum=48a48010f2f271416e60bbfb8cf25e4b (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java index d6ffb88916a..37e4f47459a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/SimpleCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; @@ -30,12 +30,10 @@ public class SimpleCharStream protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - - public void setTabSize(int i) { tabSize = i; } - public int getTabSize() { return tabSize; } + protected int tabSize = 8; + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) @@ -203,20 +201,22 @@ public char readChar() throws java.io.IOException return c; } + @Deprecated /** * @deprecated * @see #getEndColumn */ - @Deprecated + public int getColumn() { return bufcolumn[bufpos]; } + @Deprecated /** * @deprecated * @see #getEndLine */ - @Deprecated + public int getLine() { return bufline[bufpos]; } @@ -466,7 +466,6 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } + } -/* JavaCC - OriginalChecksum=5f495744c87e77321fd570f94f38cd5d (do not edit this line) */ +/* JavaCC - OriginalChecksum=68955e9beb09d3242a6c5c1ee95dd485 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java index b4da352e69a..892cc587bd7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.arq ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=0ea2e0bf17ab3b36b824cbe5bb2a103c (do not edit this line) */ +/* JavaCC - OriginalChecksum=d9b4c8c9332fa3054a004615fdb22b89 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java index 7260bb1d483..9731cd9bb79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.arq ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,20 +99,19 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ - protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { - return("Lexical error at line " + // - errorLine + ", column " + // - errorColumn + ". Encountered: " + // - (EOFSeen ? "" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + curChar + "),")) + // - (errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + // - (lexState == 0 ? "" : " (in lexical state " + lexState + ")"); + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); } /** @@ -122,7 +123,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -142,8 +142,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } -/* JavaCC - OriginalChecksum=26900e63a554da1bde0d1d6ebd69f6c3 (do not edit this line) */ +/* JavaCC - OriginalChecksum=8f945f6081b6c05a3722e27c60c90cda (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java index 29c22ef1e10..9a2539fd2fe 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/Tags.java @@ -94,6 +94,7 @@ public class Tags public static final String symAssign = ":="; public static final String tagSlice = "slice"; public static final String tagRename = "rename"; + public static final String tagUnfold = "unfold"; public static final String tagOpTriple = Tags.tagTriple; public static final String tagOpQuad = Tags.tagQuad; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java index d058f331ad5..bc3d84b1628 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java @@ -555,6 +555,25 @@ public void visit(OpExtend opExtend) { finish(opExtend); } + @Override + public void visit(OpUnfold opUnfold) { + start(opUnfold, NoNL); + + start(); + WriterExpr.output(out, opUnfold.getExpr(), sContext); + out.print(" "); + out.print( opUnfold.getVar1().toString() ); + if ( opUnfold.getVar2() != null ) { + out.print(" "); + out.print( opUnfold.getVar2().toString() ); + } + finish(); + + out.println(); + printOp(opUnfold.getSubOp()); + finish(opUnfold); + } + @Override public void visit(OpSlice opSlice) { start(opSlice, NoNL); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java new file mode 100644 index 00000000000..c408eb1ec01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -0,0 +1,86 @@ +/* + * 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 org.apache.jena.sparql.syntax; + +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.util.NodeIsomorphismMap; + +public class ElementUnfold extends Element +{ + private Expr expr ; + private Var var1 ; + private Var var2 ; + + public ElementUnfold(Expr expr, Var v1, Var v2) + { + this.expr = expr ; + this.var1 = v1 ; + this.var2 = v2 ; + } + + public Expr getExpr() + { + return expr ; + } + + public Var getVar1() + { + return var1 ; + } + + public Var getVar2() + { + return var2 ; + } + + @Override + public boolean equalTo(Element el2, NodeIsomorphismMap isoMap) + { + if ( ! ( el2 instanceof ElementUnfold ) ) + return false ; + ElementUnfold f2 = (ElementUnfold)el2 ; + if ( ! this.getVar1().equals(f2.getVar1()) ) + return false ; + if ( this.getVar2() == null && f2.getVar2() != null ) + return false ; + if ( this.getVar2() != null && this.getVar2().equals(f2.getVar2()) ) + return false ; + if ( ! this.getExpr().equals(f2.getExpr()) ) + return false ; + return true ; + } + + @Override + public int hashCode() + { + if ( var2 == null ) + return var1.hashCode()^expr.hashCode(); + else + return var1.hashCode()^var2.hashCode()^expr.hashCode(); + } + + @Override + public void visit(ElementVisitor v) + { +// TODO: extend ElementVisitor +// v.visit(this) ; + } + +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java index 65a80d9fce1..7b236273cd5 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/OpRewriter.java @@ -203,6 +203,12 @@ public void visit(OpExtend opExtend) { push(OpExtend.extend(pop(), rewrite(opExtend.getVarExprList()))); } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + push( new OpUnfold(pop(), opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ); + } + @Override public void visit(OpJoin opJoin) { opJoin.getRight().visit(this); @@ -331,4 +337,4 @@ public void visit(OpTopN opTop) { expRewriter.rewriteSortConditionList(opTop.getConditions()); push(new OpTopN(pop(), opTop.getLimit(), expRewriter.rewriteSortConditionList(opTop.getConditions()))); } -} \ No newline at end of file +} diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java index d0a55a9c539..15f29e69450 100644 --- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java +++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java @@ -314,6 +314,19 @@ public void visit(final OpExtend opExtend) { addOp(OpExtend.extend(rewriteOp1(opExtend), opExtend.getVarExprList())); } + /** + * rewrites the subop of unfold. + */ + @Override + public void visit(final OpUnfold opUnfold) { + if (LOG.isDebugEnabled()) { + LOG.debug("Starting visiting OpUnfold"); + } + Op subOp = rewriteOp1(opUnfold); + OpUnfold opUnfold2 = new OpUnfold(subOp, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()); + addOp(opUnfold2); + } + /** * rewrites the subop of filter. */ From b240b9626a59acb62d7aeb9f24974a8dacbcc2f9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:20:31 +0200 Subject: [PATCH 175/323] extends ElementTransform to cover ElementUnfold --- .../sparql/syntax/syntaxtransform/ElementTransform.java | 1 + .../syntaxtransform/ElementTransformCleanGroupsOfOne.java | 1 + .../syntax/syntaxtransform/ElementTransformCopyBase.java | 7 +++++++ .../syntax/syntaxtransform/ElementTransformIdentity.java | 2 ++ 4 files changed, 11 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java index 954ced762f1..effab2e5f46 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransform.java @@ -38,6 +38,7 @@ public interface ElementTransform public Element transform(ElementFilter el, Expr expr2); public Element transform(ElementAssign el, Var v, Expr expr2); public Element transform(ElementBind el, Var v, Expr expr2); + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2); public Triple transform(Triple triple); public Quad transform(Quad quad); public Element transform(ElementData el); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java index d6818301c6b..f8bb6251b14 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCleanGroupsOfOne.java @@ -47,6 +47,7 @@ public Element transform(ElementGroup eltGroup, List elts) { ( elt instanceof ElementFilter ) || ( elt instanceof ElementBind ) || ( elt instanceof ElementAssign ) || + ( elt instanceof ElementUnfold ) || ( elt instanceof ElementMinus ) || ( elt instanceof ElementOptional ) ) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java index 360011eed3d..5592001f0c8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformCopyBase.java @@ -101,6 +101,13 @@ public Element transform(ElementBind el, Var v, Expr expr2) { return new ElementBind(v, expr2) ; } + @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { + if ( !alwaysCopy && el.getVar1() == v1 && el.getVar2() == v2 && el.getExpr() == expr ) + return el ; + return new ElementUnfold(expr, v1, v2) ; + } + @Override public Element transform(ElementData el) { if( alwaysCopy ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java index 7809f1bef5a..827ae98d382 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ElementTransformIdentity.java @@ -51,6 +51,8 @@ private ElementTransformIdentity() {} @Override public Element transform(ElementBind el, Var v, Expr expr2) { return el ; } @Override + public Element transform(ElementUnfold el, Expr expr, Var v1, Var v2) { return el ; } + @Override public Triple transform(Triple triple) { return triple; } @Override public Quad transform(Quad quad) { return quad; } From a22eff8a8bb639dc5718cf4c6b0a1ba9a9b3a1d8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 21:51:58 +0200 Subject: [PATCH 176/323] extends ElementVisitor to cover ElementUnfold --- .../jena/sparql/lang/SyntaxVarScope.java | 17 ++++++++++++++++ .../sparql/serializer/FormatterElement.java | 12 +++++++++++ .../jena/sparql/syntax/ElementVisitor.java | 1 + .../sparql/syntax/ElementVisitorBase.java | 3 +++ .../jena/sparql/syntax/ElementWalker.java | 8 ++++++++ .../sparql/syntax/PatternVarsVisitor.java | 7 +++++++ .../ApplyElementTransformVisitor.java | 12 +++++++++++ .../rewriters/BuildElementVisitor.java | 8 +++++++- .../rewriters/ElementRewriter.java | 20 ++++++++++++++++++- .../updatebuilder/QuadIteratorBuilder.java | 8 +++++++- .../jena/arq/querybuilder/WhereValidator.java | 8 +++++++- 11 files changed, 100 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java index 5e0690ad151..dea4f3b3029 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/SyntaxVarScope.java @@ -223,6 +223,7 @@ public static class VarScopeChecker extends ElementVisitorBase { @Override public void visit(ElementGroup el) { // BIND scope rules + // UNFOLD scope rules // (and service warning) for ( int i = 0 ; i < el.size() ; i++ ) { @@ -232,6 +233,10 @@ public void visit(ElementGroup el) { Collection accScope = calcScopeAll(el.getElements(), i); checkBIND(accScope, eltBind); } + if ( e instanceof ElementUnfold ) { + Collection accScope = calcScopeAll(el.getElements(), i); + checkUNFOLD(accScope, (ElementUnfold)e); + } if ( e instanceof ElementService eltSvc ) { Collection accScope = calcScopeAll(el.getElements(), i); checkSERVICE(accScope, eltSvc); @@ -264,6 +269,18 @@ private static void checkBIND(Collection scope, ElementBind el) { checkExpr(scope, el.getExpr(), var); } + private static void checkUNFOLD(Collection scope, ElementUnfold el) { + Var var1 = el.getVar1(); + if ( scope.contains(var1) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var1 + " in " + el, -1, -1); + + Var var2 = el.getVar2(); + if ( var2 != null && scope.contains(var2) ) + throw new QueryParseException("UNFOLD: Variable used when already in-scope: " + var2 + " in " + el, -1, -1); + + checkExpr(scope, el.getExpr(), var1); + } + private static void checkSERVICE(Collection scope, ElementService el) { if ( ARQ.isStrictMode() && el.getServiceNode().isVariable() ) { Var var = Var.alloc(el.getServiceNode()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java index f018e91175e..30fd057b21b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/serializer/FormatterElement.java @@ -236,6 +236,18 @@ public void visit(ElementBind el) { out.print(")"); } + @Override + public void visit(ElementUnfold el) { + out.print("UNFOLD("); + FmtExprSPARQL v = new FmtExprSPARQL(out, context); + v.format(el.getExpr()); + out.print(" AS "); + out.print("?" + el.getVar1().getVarName()); + if ( el.getVar2() != null ) + out.print(", ?" + el.getVar2().getVarName()); + out.print(")"); + } + @Override public void visit(ElementData el) { QuerySerializer.outputDataBlock(out, el.getVars(), el.getRows(), context); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java index 97ffe1c8d19..516f5ac693f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitor.java @@ -25,6 +25,7 @@ public interface ElementVisitor public void visit(ElementFilter el) ; public void visit(ElementAssign el) ; public void visit(ElementBind el) ; + public void visit(ElementUnfold el) ; public void visit(ElementData el) ; public void visit(ElementUnion el) ; public void visit(ElementOptional el) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java index f460529d0c4..83fa6e85d55 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementVisitorBase.java @@ -36,6 +36,9 @@ public void visit(ElementAssign el) { } @Override public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { } + @Override public void visit(ElementData el) { } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java index 92fcce4e3a7..b94b3df5ac9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementWalker.java @@ -90,6 +90,14 @@ public void visit(ElementBind el) { after(el); } + @Override + public void visit(ElementUnfold el) + { + before(el) ; + proc.visit(el) ; + after(el) ; + } + @Override public void visit(ElementData el) { before(el); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java index 50818105873..362077bbbcb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/PatternVarsVisitor.java @@ -82,6 +82,13 @@ public void visit(ElementBind el) { acc.add(el.getVar()); } + @Override + public void visit(ElementUnfold el) { + acc.add(el.getVar1()); + if ( el.getVar2() != null ) + acc.add(el.getVar2()); + } + @Override public void visit(ElementData el) { acc.addAll(el.getVars()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java index 43a93006347..cb22c525455 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/syntaxtransform/ApplyElementTransformVisitor.java @@ -99,6 +99,18 @@ public void visit(ElementBind el) { push(el2) ; } + @Override + public void visit(ElementUnfold el) { + Var v1 = el.getVar1() ; + Var v1T = TransformElementLib.applyVar(v1, exprTransform) ; + Var v2 = el.getVar2() ; + Var v2T = (v2 == null) ? null : TransformElementLib.applyVar(v2, exprTransform) ; + Expr expr = el.getExpr() ; + Expr exprT = ExprTransformer.transform(exprTransform, expr) ; + Element el2 = transform.transform(el, exprT, v1T, v2T) ; + push(el2) ; + } + @Override public void visit(ElementData el) { Element el2 = transform.transform(el) ; diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java index 6e21ddc0564..6976cce240d 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/BuildElementVisitor.java @@ -68,6 +68,12 @@ public void visit(ElementBind el) { result = el; } + @Override + public void visit(ElementUnfold el) { + // no change + result = el; + } + @Override public void visit(ElementData el) { // no change @@ -205,4 +211,4 @@ public void visit(ElementSubQuery el) { result = el; } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java index 969ebaa63ec..5c29d008580 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/rewriters/ElementRewriter.java @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.Map; +import java.util.Objects; import org.apache.jena.arq.querybuilder.AbstractQueryBuilder; import org.apache.jena.graph.Node; @@ -100,6 +101,23 @@ public void visit(ElementBind el) { } } + @Override + public void visit(ElementUnfold el) { +// TODO: double check this method; I copied and adapted the method of +// ElementBind (see above) but I am not entirely sure it is correct + Node n1 = changeNode(el.getVar1()); + Node n2 = changeNode(el.getVar2()); + if ( Objects.equals(n1, el.getVar1()) && Objects.equals(n2, el.getVar2()) ) { + ExprRewriter exprRewriter = new ExprRewriter(values); + el.getExpr().visit(exprRewriter); + push( new ElementUnfold(exprRewriter.getResult(), el.getVar1(), el.getVar2()) ); + } else { + // push( new ElementBind( el.getVar(), NodeValue.makeNode( n )) ); + // no op + push(new ElementTriplesBlock()); + } + } + @Override public void visit(ElementData el) { ElementData retval = new ElementData(); @@ -195,4 +213,4 @@ public void visit(ElementSubQuery el) { push(new ElementSubQuery(AbstractQueryBuilder.rewrite(q, values))); } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java index 39be11c8703..3ad11cfdac0 100644 --- a/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java +++ b/jena-extras/jena-querybuilder/src/main/java/org/apache/jena/arq/querybuilder/updatebuilder/QuadIteratorBuilder.java @@ -91,6 +91,12 @@ public void visit(ElementBind el) { } + @Override + public void visit(ElementUnfold el) { + throw new QueryParseException("unfold not permitted in data quad", -1, -1); + + } + @Override public void visit(ElementData el) { throw new QueryParseException("element data not permitted in data quad", -1, -1); @@ -158,4 +164,4 @@ public void visit(ElementSubQuery el) { q.getQueryPattern().visit(this); } -} \ No newline at end of file +} diff --git a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java index b94c3d8052c..34ff6cf5b1b 100644 --- a/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java +++ b/jena-extras/jena-querybuilder/src/test/java/org/apache/jena/arq/querybuilder/WhereValidator.java @@ -90,6 +90,12 @@ public void visit(ElementBind el) { return; } + @Override + public void visit(ElementUnfold el) { + checkMatching(el); + return; + } + @Override public void visit(ElementData el) { checkMatching(el); @@ -195,4 +201,4 @@ public void visit(ElementSubQuery el) { } } -} \ No newline at end of file +} From c9f5e8657e17b99a34e245532fefdeab544d19dd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Jul 2022 21:01:45 +0200 Subject: [PATCH 177/323] initial functional version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 89 +++++++++++++++++-- .../jena/sparql/engine/main/OpExecutor.java | 2 +- .../sparql/engine/ref/EvaluatorSimple.java | 2 +- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d052da6e075..0ecadc1484f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -18,27 +18,104 @@ package org.apache.jena.sparql.engine.iterator; +import java.util.Iterator; + +import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.NodeFactoryExtra; -public class QueryIterUnfold extends QueryIteratorWrapper +public class QueryIterUnfold extends QueryIterRepeatApply { + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; - public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2) { - super(qIter) ; + public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, ExecutionContext execCxt) { + super(qIter, execCxt) ; this.expr = expr ; this.var1 = var1 ; this.var2 = var2 ; } @Override - protected Binding moveToNextBinding() { -System.out.println("QueryIterUnfold"); - return super.moveToNextBinding() ; + protected QueryIterator nextStage(Binding inputBinding) { + NodeValue nv = expr.eval( inputBinding, getExecContext() ); + Node n = nv.asNode(); + if ( n.isLiteral() ) { + String dtURI = n.getLiteralDatatypeURI(); + if ( datatypeUriUntypedList.equals(dtURI) ) + return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + } + + return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + } + + protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseUntypedList(listAsValue); + return new QueryIteratorBase() { + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("a QueryIterator in QueryIterUnfold"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + }; + } + + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + final String[] listAsArray = listAsValue.split(","); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + return new Iterator<>() { + int i = 0; + + @Override + public boolean hasNext() { + return i < listAsArray.length; + } + + @Override + public Node next() { + String listElmt = listAsArray[i].strip(); + i++; + if ( pmap != null ) + return NodeFactoryExtra.parseNode(listElmt, pmap); + else + return NodeFactoryExtra.parseNode(listElmt); + } + }; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 8dbc562c921..03b9000faf6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -452,7 +452,7 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; return qIter ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java index 894dee013c0..a6db3df526d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/ref/EvaluatorSimple.java @@ -254,7 +254,7 @@ public Table extend(Table table, VarExprList exprs) { @Override public Table unfold(Table table, Expr expr, Var var1, Var var2) { QueryIterator qIter = table.iterator(getExecContext()); - qIter = new QueryIterUnfold(qIter, expr, var1, var2); + qIter = new QueryIterUnfold(qIter, expr, var1, var2, getExecContext()); return new TableN(qIter); } From 2f8413bcf9ae8d266eeb5272318f6b62f04aedd6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 6 Jul 2022 21:05:28 +0200 Subject: [PATCH 178/323] enable visiting of ElementUnfold --- .../main/java/org/apache/jena/sparql/syntax/ElementUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java index c408eb1ec01..0ad02807627 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/syntax/ElementUnfold.java @@ -79,8 +79,7 @@ public int hashCode() @Override public void visit(ElementVisitor v) { -// TODO: extend ElementVisitor -// v.visit(this) ; + v.visit(this) ; } } From 5ca2a519efc3bfc0696fc5862614d00556344f6a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 12:26:09 +0200 Subject: [PATCH 179/323] fully working version of QueryIterUnfold --- .../engine/iterator/QueryIterUnfold.java | 220 +++++++++++++++--- 1 file changed, 187 insertions(+), 33 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 0ecadc1484f..1f512244564 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,9 +19,14 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -36,6 +41,14 @@ public class QueryIterUnfold extends QueryIterRepeatApply { public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); protected final Expr expr ; protected final Var var1 ; @@ -56,6 +69,12 @@ protected QueryIterator nextStage(Binding inputBinding) { String dtURI = n.getLiteralDatatypeURI(); if ( datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedList.equals(dtURI) ) + return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriUntypedMap.equals(dtURI) ) + return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( datatypeUriTypedMap.equals(dtURI) ) + return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); @@ -63,59 +82,194 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIteratorBase() { - @Override - public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("a QueryIterator in QueryIterUnfold"); - } + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } - @Override - protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); - } + protected Iterator parseUntypedList(String listAsValue) { + if ( listAsValue.startsWith("[") ) + listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + + return parseList(listAsValue); + } + + protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { + Iterator itListElmts = parseTypedList(listAsValue); + return new QueryIterUnfoldWorker(inputBinding, itListElmts); + } + + protected Iterator parseTypedList(String listAsValue) { + listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); + return parseList(listAsValue); + } + + protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + + protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { + throw new UnsupportedOperationException("TODO"); + } + protected Iterator parseList(String listAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = extractListElements(listAsValue); + return new Iterator<>() { @Override - protected boolean hasNextBinding() { + public boolean hasNext() { return itListElmts.hasNext(); } @Override - protected void requestCancel() { } // nothing to do really - - @Override - protected void closeIterator() { } // nothing to do really + public Node next() { + final String listElmt = itListElmts.next(); + final Node n; + if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + else if ( pmap != null ) + n = NodeFactoryExtra.parseNode(listElmt, pmap); + else + n = NodeFactoryExtra.parseNode(listElmt); + return n; + } }; } - protected Iterator parseUntypedList(String listAsValue) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); + protected Iterator extractListElements(String listAsValue) { + listAsValue = listAsValue.strip(); + + if ( listAsValue.isEmpty() ) { + return new Iterator() { + @Override public boolean hasNext() { return false; } + @Override public String next() { throw new NoSuchElementException(); } + }; + } // TODO: this method needs to be improved and, in particular, made more robust in terms // of parsing the given lexical form of the literal; for instance, simply splitting // by commas is an issue if the list contains literals with commas inside -- can we // use existing code for parsing Turtle here? - final String[] listAsArray = listAsValue.split(","); - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - return new Iterator<>() { - int i = 0; + return new ListElementExtractor(listAsValue); + } - @Override - public boolean hasNext() { - return i < listAsArray.length; + + protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected final Binding inputBinding; + protected final Iterator itListElmts; + + public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + this.inputBinding = inputBinding; + this.itListElmts = itListElmts; + } + + @Override + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorker"); + } + + @Override + protected Binding moveToNextBinding() { + return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + } + + @Override + protected boolean hasNextBinding() { + return itListElmts.hasNext(); + } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected static class ListElementExtractor implements Iterator { + protected final String listAsString; + protected int cursor = 0; + protected String nextElmt = null; + + public ListElementExtractor( final String listAsString ) { + this.listAsString = listAsString.strip(); + } + + @Override + public boolean hasNext() { + if ( nextElmt != null ) + return true; + + consumeWhiteSpace(); + if ( cursor >= listAsString.length() ) { + return false; } - @Override - public Node next() { - String listElmt = listAsArray[i].strip(); - i++; - if ( pmap != null ) - return NodeFactoryExtra.parseNode(listElmt, pmap); - else - return NodeFactoryExtra.parseNode(listElmt); + final int nextElmtBegin = cursor; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); } - }; + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + nextElmt = listAsString.substring(nextElmtBegin, cursor); + cursor++; // move cursor to after comma + return true; + } + + @Override + public String next() { + if ( ! hasNext() ) + throw new NoSuchElementException(); + + String r = nextElmt; + nextElmt = null; + return r; + } + + protected void consumeWhiteSpace() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + cursor++; + } + + protected void advanceToEndOfSubList() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToEndOfSubMap() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + cursor++; + if ( listAsString.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + cursor++; + } + else if ( listAsString.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + cursor++; + } + } + } + + protected void advanceToNextCommaOrEnd() { + while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + cursor++; + } } } From 58b72a50ee6283530e2aa3ab33d7efe2646edfcf Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:10:46 +0200 Subject: [PATCH 180/323] bug fix: if evaluating the expression of an UNFOLD operator fails, create no assignment --- .../sparql/engine/iterator/QueryIterUnfold.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 1f512244564..e3f14076753 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -34,6 +34,7 @@ import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.binding.BindingFactory; import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.util.NodeFactoryExtra; @@ -63,7 +64,18 @@ public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, Execu @Override protected QueryIterator nextStage(Binding inputBinding) { - NodeValue nv = expr.eval( inputBinding, getExecContext() ); + final NodeValue nv; + try { + nv = expr.eval( inputBinding, getExecContext() ); + } + catch ( final ExprEvalException ex ) { + // If the expression failed to evaluate, we create no + // no assignment (exactly as in the case of BIND, see + // the 'accept' method in 'QueryIterAssign') + + return QueryIterSingleton.create( inputBinding, getExecContext() ); + } + Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); From fa5e530a50c76b757642e16b705e57e5ce9aec5c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 18:14:50 +0200 Subject: [PATCH 181/323] bug fix: if evaluating the expression of an UNFOLD operator does not result in a relevant literal, create no assignment --- .../apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e3f14076753..bb0a88067c7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,7 +19,6 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; -import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -89,7 +88,7 @@ protected QueryIterator nextStage(Binding inputBinding) { return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } - return QueryIterSingleton.create( inputBinding, var1, n, getExecContext() ); + return QueryIterSingleton.create( inputBinding, getExecContext() ); } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { From 0c60a2a4af4f95d38c1b2b539a94a649fa234ce8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 19:09:47 +0200 Subject: [PATCH 182/323] adds support for UNFOLDing of untyped maps --- .../engine/iterator/QueryIterUnfold.java | 251 ++++++++++++++---- 1 file changed, 204 insertions(+), 47 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index bb0a88067c7..571df3b3191 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.Map; import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; @@ -93,7 +94,7 @@ protected QueryIterator nextStage(Binding inputBinding) { protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseUntypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseUntypedList(String listAsValue) { @@ -105,7 +106,7 @@ protected Iterator parseUntypedList(String listAsValue) { protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { Iterator itListElmts = parseTypedList(listAsValue); - return new QueryIterUnfoldWorker(inputBinding, itListElmts); + return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } protected Iterator parseTypedList(String listAsValue) { @@ -114,7 +115,15 @@ protected Iterator parseTypedList(String listAsValue) { } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + Iterator> itMapElmts = parseUntypedMap(mapAsValue); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); + } + + protected Iterator> parseUntypedMap(String mapAsValue) { + if ( mapAsValue.startsWith("{") ) + mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); + + return parseMap(mapAsValue); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { @@ -138,9 +147,9 @@ public Node next() { n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.startsWith("}") ) + else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); @@ -169,46 +178,136 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } + protected Iterator> parseMap(String mapAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator> itMapElmts = extractMapElements(mapAsValue); + return new Iterator<>() { + @Override + public boolean hasNext() { + return itMapElmts.hasNext(); + } + + @Override + public Map.Entry next() { + final Map.Entry mapElmt = itMapElmts.next(); + final String keyAsString = mapElmt.getKey(); + final String valueAsString = mapElmt.getValue(); + + final Node keyAsNode; + if ( pmap != null ) + keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); + else + keyAsNode = NodeFactoryExtra.parseNode(keyAsString); + + final Node valueAsNode; + if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) + valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + else if ( pmap != null ) + valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); + else + valueAsNode = NodeFactoryExtra.parseNode(valueAsString); + + return new Map.Entry<>() { + @Override public Node getKey() { return keyAsNode; } + @Override public Node getValue() { return valueAsNode; } + @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } + }; + } + }; + } + + protected Iterator> extractMapElements(String mapAsValue) { + mapAsValue = mapAsValue.strip(); + + if ( mapAsValue.isEmpty() ) { + return new Iterator>() { + @Override public boolean hasNext() { return false; } + @Override public Map.Entry next() { throw new NoSuchElementException(); } + }; + } + +// TODO: this method needs to be improved and, in particular, made more robust in terms +// of parsing the given lexical form of the literal; for instance, simply splitting +// by commas is an issue if the list contains literals with commas inside -- can we +// use existing code for parsing Turtle here? + + return new MapElementExtractor(mapAsValue); + } + - protected class QueryIterUnfoldWorker extends QueryIteratorBase { + protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; - protected final Iterator itListElmts; + protected final Iterator itElmts; - public QueryIterUnfoldWorker(Binding inputBinding, Iterator itListElmts) { + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.inputBinding = inputBinding; - this.itListElmts = itListElmts; + this.itElmts = itElmts; + } + + @Override + protected boolean hasNextBinding() { return itElmts.hasNext(); } + + @Override + protected void requestCancel() { } // nothing to do really + + @Override + protected void closeIterator() { } // nothing to do really + } + + + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); } @Override public void output(IndentedWriter out, SerializationContext sCxt) { - out.write("QueryIterUnfoldWorker"); + out.write("QueryIterUnfoldWorkerForLists"); } @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itListElmts.next() ); + return BindingFactory.binding( inputBinding, var1, itElmts.next() ); } + } - @Override - protected boolean hasNextBinding() { - return itListElmts.hasNext(); + + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); } @Override - protected void requestCancel() { } // nothing to do really + public void output(IndentedWriter out, SerializationContext sCxt) { + out.write("QueryIterUnfoldWorkerForMaps"); + } @Override - protected void closeIterator() { } // nothing to do really + protected Binding moveToNextBinding() { + final Map.Entry elmt = itElmts.next(); + if ( var2 == null ) + return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); + else + return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + } } - protected static class ListElementExtractor implements Iterator { - protected final String listAsString; + protected static abstract class ElementExtractorBase implements Iterator { + protected final String str; protected int cursor = 0; - protected String nextElmt = null; + private T nextElmt = null; - public ListElementExtractor( final String listAsString ) { - this.listAsString = listAsString.strip(); + protected ElementExtractorBase( final String str ) { + this.str = str.strip(); } @Override @@ -216,47 +315,35 @@ public boolean hasNext() { if ( nextElmt != null ) return true; - consumeWhiteSpace(); - if ( cursor >= listAsString.length() ) { - return false; - } - - final int nextElmtBegin = cursor; - if ( listAsString.charAt(cursor) == '[' ) { - advanceToEndOfSubList(); - } - else if ( listAsString.charAt(cursor) == '{' ) { - advanceToEndOfSubMap(); - } - advanceToNextCommaOrEnd(); - nextElmt = listAsString.substring(nextElmtBegin, cursor); - cursor++; // move cursor to after comma - return true; + nextElmt = produceNext(); + return ( nextElmt != null ); } @Override - public String next() { + public T next() { if ( ! hasNext() ) throw new NoSuchElementException(); - String r = nextElmt; + final T r = nextElmt; nextElmt = null; return r; } + protected abstract T produceNext(); + protected void consumeWhiteSpace() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) == ' ' ) + while ( cursor < str.length() && str.charAt(cursor) == ' ' ) cursor++; } protected void advanceToEndOfSubList() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ']' ) { + while ( cursor < str.length() && str.charAt(cursor) != ']' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -264,13 +351,13 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToEndOfSubMap() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != '}' ) { + while ( cursor < str.length() && str.charAt(cursor) != '}' ) { cursor++; - if ( listAsString.charAt(cursor) == '[' ) { + if ( str.charAt(cursor) == '[' ) { advanceToEndOfSubList(); cursor++; } - else if ( listAsString.charAt(cursor) == '{' ) { + else if ( str.charAt(cursor) == '{' ) { advanceToEndOfSubMap(); cursor++; } @@ -278,7 +365,77 @@ else if ( listAsString.charAt(cursor) == '{' ) { } protected void advanceToNextCommaOrEnd() { - while ( cursor < listAsString.length() && listAsString.charAt(cursor) != ',' ) + while ( cursor < str.length() && str.charAt(cursor) != ',' ) + cursor++; + } + } + + + protected static class ListElementExtractor extends ElementExtractorBase { + public ListElementExtractor( final String listAsString ) { + super(listAsString); + } + + @Override + public String produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextElmtBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextElmt = str.substring(nextElmtBegin, cursor).strip(); + cursor++; // move cursor to after comma + return nextElmt; + } + } + + + protected static class MapElementExtractor extends ElementExtractorBase> { + public MapElementExtractor( final String mapAsString ) { + super(mapAsString); + } + + @Override + public Map.Entry produceNext() { + consumeWhiteSpace(); + if ( cursor >= str.length() ) { + return null; + } + + final int nextKeyBegin = cursor; + advanceToNextColon(); + final String nextKey = str.substring(nextKeyBegin, cursor).strip(); + + cursor++; // move cursor to after colon + consumeWhiteSpace(); + final int nextValueBegin = cursor; + if ( str.charAt(cursor) == '[' ) { + advanceToEndOfSubList(); + } + else if ( str.charAt(cursor) == '{' ) { + advanceToEndOfSubMap(); + } + advanceToNextCommaOrEnd(); + final String nextValue = str.substring(nextValueBegin, cursor).strip(); + cursor++; // move cursor to after comma + + return new Map.Entry<>() { + @Override public String getKey() { return nextKey; } + @Override public String getValue() { return nextValue; } + @Override public String setValue(String v) { throw new UnsupportedOperationException(); } + }; + } + + protected void advanceToNextColon() { + while ( cursor < str.length() && str.charAt(cursor) != ':' ) cursor++; } } From 995756c3faa834d1691c67d3989fd670b84fe9bf Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 14:28:32 +0200 Subject: [PATCH 183/323] adds FOLD --- jena-arq/Grammar/arq.jj | 13 + .../jena/sparql/expr/aggregate/AggFold.java | 284 ++++++++++++++++++ .../sparql/expr/aggregate/AggregatorBase.java | 2 + .../expr/aggregate/AggregatorFactory.java | 4 + 4 files changed, 303 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 36120747f0c..622ced68856 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1624,6 +1624,17 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; { agg = AggregatorFactory.createCustom(AggURI.var_samp, distinct, expr) ; } | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } + | t = + { String typeIRI1 = null ; + String typeIRI2 = null ; + Expr orderByExpr = null ; + Var orderByVar = null ; + int orderByDirection = Query.ORDER_DEFAULT ; } + + expr = Expression() ( typeIRI1 = iri() )? + ( expr2 = Expression() ( typeIRI2 = iri() )? )? + + { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } | t = { String iri ; } iri = iri() @@ -1824,6 +1835,8 @@ TOKEN [IGNORE_CASE] : | < VARIANCE: "variance" > | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > +| < FOLD: "fold" > +| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java new file mode 100644 index 00000000000..20d1eb03965 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -0,0 +1,284 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprLib; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.ExprNode; +import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprVisitor; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueString; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.graph.NodeTransform; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFold extends AggregatorBase +{ + protected final Expr expr1; // While the values of these member variables + protected final Expr expr2; // can also be extracted from the ExprList (see + protected final String typeIRI1; // createExprList below), keeping these copies + protected final String typeIRI2; // here makes it easier to access these values. + + public AggFold( final Expr expr1 ) { + this(expr1, null, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1 ) { + this(expr1, typeIRI1, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { + this(expr1, typeIRI1, expr2, null); + } + + public AggFold( final Expr expr1, final Expr expr2 ) { + this(expr1, null, expr2, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { + super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + + this.expr1 = expr1; + this.expr2 = expr2; + this.typeIRI1 = typeIRI1; + this.typeIRI2 = typeIRI2; + } + + protected static ExprList createExprList( final Expr expr1, final String typeIRI1, + final Expr expr2, final String typeIRI2 ) { + final ExprList l = new ExprList(expr1); + + if ( typeIRI1 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI1) ); + } + + if ( expr2 != null ) { + l.add(expr2); + } + + if ( typeIRI2 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI2) ); + } + + return l; + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() < 1 || exprs.size() > 6 ) + throw new IllegalArgumentException(); + + final Iterator it = exprs.iterator(); + final Expr _expr1 = it.next(); + + final Expr _expr2; + final String _typeIRI1; + final String _typeIRI2; + + Expr lookAhead = it.hasNext() ? it.next() : null; + // _typeIRI1 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI1 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI1 = null; + } + + // _expr2 + if ( lookAhead != null ) { + _expr2 = lookAhead; + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _expr2 = null; + } + + // _typeIRI2 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI2 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI2 = null; + } + + if ( lookAhead != null ) { + throw new IllegalArgumentException(); + } + + return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFold ) ) + return false; + final AggFold fold = (AggFold) other; + return exprList.equals(fold.exprList, bySyntax); + } + + @Override + public Accumulator createAccumulator() { + if ( expr2 == null ) + return new ListAccumulator(); + else + return new MapAccumulator(); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + int hc = HC_AggFold; + for ( final Expr e : getExprList() ) { + hc ^= e.hashCode(); + } + return hc; + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + ExprUtils.fmtSPARQL(out, expr1, sCxt); + + if ( typeIRI1 != null ) { + out.append( " TYPE " + typeIRI1 ); + } + + if ( expr2 != null ) { + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); + } + + if ( typeIRI2 != null ) { + out.append( " TYPE " + typeIRI2 ); + } + + out.append(")"); + return out.asString(); + } + + + protected static Expr dummyExprForType = new ExprNode() { + @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } + + @Override public int hashCode() { return -88888; } + + @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + + @Override public Expr copySubstitute(Binding binding) { return this; } + + @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + + @Override public NodeValue eval(Binding binding, FunctionEnv env) { + throw new InternalErrorException("Attempt to eval DummyExprForType"); + } + }; + + protected class ListAccumulator implements Accumulator { + final protected List list = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nv != null ) + list.add( nv.asNode() ); + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + return NodeValue.makeNode(n); + } + } + + protected class MapAccumulator implements Accumulator { + final protected List keys = new ArrayList<>(); + final protected List values = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( key != null && value != null ) { + keys.add( key.asNode() ); + values.add( value.asNode() ); + } + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! keys.isEmpty() ) { + final Iterator it = keys.iterator(); + final Iterator it2 = values.iterator(); + final Node firstKey = it.next(); + final Node firstValue = it2.next(); + final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); + final String firstValueAsString = NodeFmtLib.strTTL(firstValue); + sb.append(firstKeyAsString); + sb.append(" : "); + sb.append(firstValueAsString); + while ( it.hasNext() ) { + final Node nextKey = it.next(); + final Node nextValue = it2.next(); + final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); + final String nextValueAsString = NodeFmtLib.strTTL(nextValue); + sb.append(", "); + sb.append(nextKeyAsString); + sb.append(" : "); + sb.append(nextValueAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + return NodeValue.makeNode(n); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index d60edb1116d..a6869d915b4 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -187,4 +187,6 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; + protected static final int HC_AggFold = 0x186 ; + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index ee99bf43e8c..a7a81aa8729 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,6 +71,10 @@ public static Aggregator createAggNull() { return new AggNull() ; } + public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { + return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + } + public static Aggregator createCustom(String iri, Args a) { return createCustom(iri, a.distinct, ExprList.copy(a)) ; } From 2121eb8faa3eff8ab6fdc7dfcb9e58663b9f0a93 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 17:51:05 +0200 Subject: [PATCH 184/323] extends the implementation of FOLD to actually support the type arguments --- .../jena/sparql/expr/aggregate/AggFold.java | 155 ++++++++++++++---- 1 file changed, 120 insertions(+), 35 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 20d1eb03965..f7ee0f19410 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -3,33 +3,36 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.ExprNode; -import org.apache.jena.sparql.expr.ExprNone; -import org.apache.jena.sparql.expr.ExprVisitor; import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; -import org.apache.jena.sparql.graph.NodeTransform; import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; public class AggFold extends AggregatorBase { + protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); + protected final Expr expr1; // While the values of these member variables protected final Expr expr2; // can also be extracted from the ExprList (see - protected final String typeIRI1; // createExprList below), keeping these copies - protected final String typeIRI2; // here makes it easier to access these values. + protected final Node typeIRI1; // createExprList below), keeping these copies + protected final Node typeIRI2; // here makes it easier to access these values. public AggFold( final Expr expr1 ) { this(expr1, null, null, null); @@ -52,8 +55,8 @@ public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = typeIRI1; - this.typeIRI2 = typeIRI2; + this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; + this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } protected static ExprList createExprList( final Expr expr1, final String typeIRI1, @@ -61,7 +64,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI final ExprList l = new ExprList(expr1); if ( typeIRI1 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI1) ); } @@ -70,7 +73,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI } if ( typeIRI2 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI2) ); } @@ -91,7 +94,7 @@ public Aggregator copy( final ExprList exprs ) { Expr lookAhead = it.hasNext() ? it.next() : null; // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI1 = ((NodeValueString) lookAhead).getString(); @@ -114,7 +117,7 @@ public Aggregator copy( final ExprList exprs ) { } // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI2 = ((NodeValueString) lookAhead).getString(); @@ -168,6 +171,8 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { + final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); + final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); @@ -175,7 +180,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { ExprUtils.fmtSPARQL(out, expr1, sCxt); if ( typeIRI1 != null ) { - out.append( " TYPE " + typeIRI1 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI1, pmap) ); } if ( expr2 != null ) { @@ -184,29 +190,42 @@ public String asSparqlExpr( final SerializationContext sCxt ) { } if ( typeIRI2 != null ) { - out.append( " TYPE " + typeIRI2 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI2, pmap) ); } out.append(")"); return out.asString(); } + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); - protected static Expr dummyExprForType = new ExprNode() { - @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } - - @Override public int hashCode() { return -88888; } - - @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + WriterExpr.output(out, expr1, null); - @Override public Expr copySubstitute(Binding binding) { return this; } + if ( typeIRI1 != null ) { + out.append( " TYPE " ); + out.append( typeIRI1.toString() ); + } - @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + if ( expr2 != null ) { + out.append(", "); + WriterExpr.output(out, expr2, null); + } - @Override public NodeValue eval(Binding binding, FunctionEnv env) { - throw new InternalErrorException("Attempt to eval DummyExprForType"); + if ( typeIRI2 != null ) { + out.append( " TYPE " ); + out.append( typeIRI2.toString() ); } - }; + + out.decIndent(); + out.append(")"); + return out.asString(); + } protected class ListAccumulator implements Accumulator { final protected List list = new ArrayList<>(); @@ -214,13 +233,25 @@ protected class ListAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) - list.add( nv.asNode() ); + if ( nv != null ) { + final Node n = nv.asNode(); + if ( typeIRI1 != null ) { // check the type of the node + final String nTypeIRI; + if ( n.isLiteral() ) + nTypeIRI = n.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the node if it is not of the expected type + } + list.add(n); + } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("["); if ( ! list.isEmpty() ) { final Iterator it = list.iterator(); final Node firstNode = it.next(); @@ -233,7 +264,19 @@ public NodeValue getValue() { sb.append(nextNodeAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + sb.append("]"); + + final RDFDatatype datatype; + if ( typeIRI1 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + datatype = QueryIterUnfold.datatypeTypedList; + } + else { + datatype = QueryIterUnfold.datatypeUntypedList; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } @@ -244,17 +287,41 @@ protected class MapAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( key != null && value != null ) { - keys.add( key.asNode() ); - values.add( value.asNode() ); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvKey != null && nvValue != null ) { + final Node key = nvKey.asNode(); + final Node value = nvValue.asNode(); + + if ( typeIRI1 != null ) { // check the type of the key + final String nTypeIRI; + if ( key.isLiteral() ) + nTypeIRI = key.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the key is not of the expected type + } + + if ( typeIRI2 != null ) { // check the type of the value + final String nTypeIRI; + if ( value.isLiteral() ) + nTypeIRI = value.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI2.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the value is not of the expected type + } + + keys.add(key); + values.add(value); } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("{"); if ( ! keys.isEmpty() ) { final Iterator it = keys.iterator(); final Iterator it2 = values.iterator(); @@ -276,7 +343,25 @@ public NodeValue getValue() { sb.append(nextValueAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + sb.append("}"); + + final RDFDatatype datatype; + if ( typeIRI1 != null || typeIRI2 != null ) { + sb.append("^^"); + if ( typeIRI1 != null ) { + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + } + if ( typeIRI2 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI2) ); + } + datatype = QueryIterUnfold.datatypeTypedMap; + } + else { + datatype = QueryIterUnfold.datatypeUntypedMap; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } From 1c94b5cad8a70a7fb2bf2a31261e1a6a088b141b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 18:49:06 +0200 Subject: [PATCH 185/323] adds support for collection-related functions --- .../engine/iterator/QueryIterUnfold.java | 40 ++++++----- .../jena/sparql/function/ARQFunctions.java | 2 + .../CollectionLiteralFunctions.java | 10 +++ .../function/library/collection/SizeFct.java | 70 +++++++++++++++++++ 4 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 571df3b3191..e7bda9055a8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -93,45 +93,54 @@ protected QueryIterator nextStage(Binding inputBinding) { } protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseUntypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator itListElmts = parseUntypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseUntypedList(String listAsValue) { + public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { if ( listAsValue.startsWith("[") ) listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - Iterator itListElmts = parseTypedList(listAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator itListElmts = parseTypedList(listAsValue, pmap); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - protected Iterator parseTypedList(String listAsValue) { + public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue); + return parseList(listAsValue, pmap); } protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - Iterator> itMapElmts = parseUntypedMap(mapAsValue); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator> parseUntypedMap(String mapAsValue) { + public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { if ( mapAsValue.startsWith("{") ) mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - return parseMap(mapAsValue); + return parseMap(mapAsValue, pmap); } protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - throw new UnsupportedOperationException("TODO"); + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); } - protected Iterator parseList(String listAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { + mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); + return parseMap(mapAsValue, pmap); + } + + public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { final Iterator itListElmts = extractListElements(listAsValue); return new Iterator<>() { @Override @@ -160,7 +169,7 @@ else if ( pmap != null ) }; } - protected Iterator extractListElements(String listAsValue) { + public static Iterator extractListElements(String listAsValue) { listAsValue = listAsValue.strip(); if ( listAsValue.isEmpty() ) { @@ -178,8 +187,7 @@ protected Iterator extractListElements(String listAsValue) { return new ListElementExtractor(listAsValue); } - protected Iterator> parseMap(String mapAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { final Iterator> itMapElmts = extractMapElements(mapAsValue); return new Iterator<>() { @Override @@ -222,7 +230,7 @@ else if ( pmap != null ) }; } - protected Iterator> extractMapElements(String mapAsValue) { + public static Iterator> extractMapElements(String mapAsValue) { mapAsValue = mapAsValue.strip(); if ( mapAsValue.isEmpty() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index a7452a464ae..2acb95dbf84 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -33,5 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); + CollectionLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java new file mode 100644 index 00000000000..f1bb072c595 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -0,0 +1,10 @@ +package org.apache.jena.sparql.function.library.collection; + +import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.FunctionRegistry; + +public class CollectionLiteralFunctions { + public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java new file mode 100644 index 00000000000..94a3f0748b7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -0,0 +1,70 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; + +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class SizeFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + final String datatypeURI = n.getLiteralDatatypeURI(); + final int size; + if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } + + return NodeValue.makeInteger(size); + } + + protected int determineSizeOfUntypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfUntypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineNumberOfElements( final Iterator it ) { + int i = 0; + while ( it.hasNext() ) { + i++; + it.next(); + } + return i; + } + +} From 29444323c3026b8cda33bd87ff92d29108828444 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 17 Aug 2022 18:38:31 +0200 Subject: [PATCH 186/323] adds POC of a 'concat' function for lists --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ConcatFct.java | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index f1bb072c595..5beaeec3aa8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,5 +6,6 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java new file mode 100644 index 00000000000..4ccf1688fcb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -0,0 +1,87 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ConcatFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { + final String list1AsString = getInputListAsString(v1); + final String list2AsString = getInputListAsString(v2); +System.out.println("list1AsString " + list1AsString); +System.out.println("list2AsString " + list2AsString); + return createResultList(list1AsString, list2AsString); + } + + protected String getInputListAsString( final NodeValue v ) { + final Node n = v.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + v); + + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + throw new ExprEvalException("Literal with wrong datatype: " + v); + } + + return n.getLiteralLexicalForm(); + } + + protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { + final String resultListAsString = createResultListAsString(list1AsString, list2AsString); + final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + +System.out.println("resultListAsString " + resultListAsString); + final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + return NodeValue.makeNode(n); + } + + protected String createResultListAsString( final String list1AsString, final String list2AsString ) { + final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); + final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); + final Iterator it = new ConcatenatingIterator(it1, it2); + + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( it.hasNext() ) { + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + sb.append("]"); + + return sb.toString(); + } + + protected static class ConcatenatingIterator implements Iterator { + protected final Iterator it1; + protected final Iterator it2; + public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } + @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } + @Override public T next() { + if ( it1.hasNext() ) + return it1.next(); + else if ( it2.hasNext() ) + return it2.next(); + else + throw new NoSuchElementException(); + } + } + +} From 22190ec8ce1c8ec5b8e5db6ea9ffc53202fbac86 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 Aug 2022 11:57:06 +0200 Subject: [PATCH 187/323] creates Node_LiteralWithList and Node_LiteralWithMap, so far only as placeholders for adding special functionality for such types of literals --- .../engine/iterator/QueryIterUnfold.java | 40 +++++++------------ .../jena/sparql/expr/aggregate/AggFold.java | 11 ++--- .../library/collection/ConcatFct.java | 5 ++- .../function/library/collection/SizeFct.java | 10 +++-- .../jena/graph/Node_LiteralWithList.java | 19 +++++++++ .../jena/graph/Node_LiteralWithMap.java | 18 +++++++++ 6 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e7bda9055a8..e621756f764 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,10 +23,10 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; @@ -41,17 +41,7 @@ public class QueryIterUnfold extends QueryIterRepeatApply { - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - protected final Expr expr ; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; @@ -79,13 +69,13 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( datatypeUriUntypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedList.equals(dtURI) ) + if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriUntypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( datatypeUriTypedMap.equals(dtURI) ) + if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); } @@ -153,13 +143,13 @@ public Node next() { final String listElmt = itListElmts.next(); final Node n; if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedList); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedList); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeUntypedMap); + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, datatypeTypedMap); // brittle + n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) n = NodeFactoryExtra.parseNode(listElmt, pmap); else @@ -209,13 +199,13 @@ public Map.Entry next() { final Node valueAsNode; if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedList); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedList); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeUntypedMap); + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, datatypeTypedMap); // brittle + valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle else if ( pmap != null ) valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); else diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index f7ee0f19410..337d034c01f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -9,11 +9,12 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -270,10 +271,10 @@ public NodeValue getValue() { if ( typeIRI1 != null ) { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = QueryIterUnfold.datatypeTypedList; + datatype = Node_LiteralWithList.datatypeTypedList; } else { - datatype = QueryIterUnfold.datatypeUntypedList; + datatype = Node_LiteralWithList.datatypeUntypedList; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); @@ -355,10 +356,10 @@ public NodeValue getValue() { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI2) ); } - datatype = QueryIterUnfold.datatypeTypedMap; + datatype = Node_LiteralWithMap.datatypeTypedMap; } else { - datatype = QueryIterUnfold.datatypeUntypedMap; + datatype = Node_LiteralWithMap.datatypeUntypedMap; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 4ccf1688fcb..b9d1b3a6c79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; @@ -30,7 +31,7 @@ protected String getInputListAsString( final NodeValue v ) { throw new ExprEvalException("Not a literal: " + v); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { throw new ExprEvalException("Literal with wrong datatype: " + v); } @@ -39,7 +40,7 @@ protected String getInputListAsString( final NodeValue v ) { protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; System.out.println("resultListAsString " + resultListAsString); final Node n = NodeFactory.createLiteral(resultListAsString, datatype); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 94a3f0748b7..982d6b8e5a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -3,6 +3,8 @@ import java.util.Iterator; import org.apache.jena.graph.Node; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -19,16 +21,16 @@ public NodeValue exec( final NodeValue nv ) { final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); } else { diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java new file mode 100644 index 00000000000..37cb8ca1f3e --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java @@ -0,0 +1,19 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithList extends Node_Literal +{ + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + + public Node_LiteralWithList( final LiteralLabel label ) { + super(label); + } + + +} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java new file mode 100644 index 00000000000..27d5bef8656 --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java @@ -0,0 +1,18 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithMap extends Node_Literal +{ + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); + + public Node_LiteralWithMap( final LiteralLabel label ) { + super(label); + } + +} From 10c07f2e37beaee80dee161e34352368e3c55ffa Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 10:35:24 +0100 Subject: [PATCH 188/323] adds an actual parser for the lexical form of cdt:List and cdt:Map literals, and proper integration into the Jena Graph API (via special LiteralLabel implementations) --- jena-arq/Grammar/arq.jj | 11 +- jena-arq/Grammar/cdt_literals.jj | 366 ++++++ jena-arq/Grammar/grammarCDTs | 59 + .../java/org/apache/jena/cdt/CDTFactory.java | 68 ++ .../main/java/org/apache/jena/cdt/CDTKey.java | 62 + .../jena/cdt/CDTLiteralParseException.java | 31 + .../java/org/apache/jena/cdt/CDTValue.java | 100 ++ .../jena/cdt/CompositeDatatypeBase.java | 45 + .../jena/cdt/CompositeDatatypeList.java | 181 +++ .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 154 +++ .../apache/jena/cdt/LiteralLabelForList.java | 79 ++ .../apache/jena/cdt/LiteralLabelForMap.java | 79 ++ .../apache/jena/cdt/ParserForCDTLiterals.java | 155 +++ .../jena/cdt/parser/CDTLiteralParser.java | 570 +++++++++ .../cdt/parser/CDTLiteralParserConstants.java | 147 +++ .../parser/CDTLiteralParserTokenManager.java | 1045 +++++++++++++++++ .../jena/cdt/parser/JavaCharStream.java | 703 +++++++++++ .../jena/cdt/parser/ParseException.java | 205 ++++ .../org/apache/jena/cdt/parser/Token.java | 149 +++ .../apache/jena/cdt/parser/TokenMgrError.java | 167 +++ .../engine/iterator/QueryIterUnfold.java | 260 ++-- .../jena/sparql/expr/aggregate/AggFold.java | 266 +---- .../expr/aggregate/AggregatorFactory.java | 4 +- .../library/collection/ConcatFct.java | 96 +- .../function/library/collection/SizeFct.java | 76 +- .../jena/graph/Node_LiteralWithList.java | 19 - .../jena/graph/Node_LiteralWithMap.java | 18 - 28 files changed, 4741 insertions(+), 549 deletions(-) create mode 100644 jena-arq/Grammar/cdt_literals.jj create mode 100755 jena-arq/Grammar/grammarCDTs create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserConstants.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 622ced68856..40445623781 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1625,16 +1625,14 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { String typeIRI1 = null ; - String typeIRI2 = null ; - Expr orderByExpr = null ; + { Expr orderByExpr = null ; Var orderByVar = null ; int orderByDirection = Query.ORDER_DEFAULT ; } - expr = Expression() ( typeIRI1 = iri() )? - ( expr2 = Expression() ( typeIRI2 = iri() )? )? + expr = Expression() + ( expr2 = Expression() )? - { agg = AggregatorFactory.createFold(expr, typeIRI1, expr2, typeIRI2) ; } + { agg = AggregatorFactory.createFold(expr, expr2) ; } | t = { String iri ; } iri = iri() @@ -1836,7 +1834,6 @@ TOKEN [IGNORE_CASE] : | < VAR_SAMP: "var_samp" > | < VAR_POP: "var_pop" > | < FOLD: "fold" > -| < TYPE: "type" > | < SAMPLE: "sample" > | < GROUP_CONCAT: "group_concat" > | < FILTER: "filter" > diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj new file mode 100644 index 00000000000..eac97b2827e --- /dev/null +++ b/jena-arq/Grammar/cdt_literals.jj @@ -0,0 +1,366 @@ +/* + * 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. + */ + +options +{ + // Use \ u escapes in streams AND use a reader for the query + // => get both raw and escaped unicode + + JAVA_UNICODE_ESCAPE = true ; + UNICODE_INPUT = false ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + +PARSER_BEGIN(CDTLiteralParser) +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase +{ +} +PARSER_END(CDTLiteralParser) + +// --- Entry point + +void parse() : {} +{ + ( List() | Map() ) +} + +List List() : { List l = new ArrayList(); } +{ + + + ( ListElement(l) )? + + ( ListElement(l) )* + + // should we permit a trailing comma? + + + + { return l; } +} + +void ListElement(List l) : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } +| + n = BlankNode() { l.add( CDTFactory.createValue(n) ); } +| + n = RDFLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = NumericLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = BooleanLiteral() { l.add( CDTFactory.createValue(n) ); } +| + { l.add( CDTFactory.getNullValue() ); } +| + subList = List() { l.add( CDTFactory.createValue(subList) ); } +| + m = Map() { l.add( CDTFactory.createValue(m) ); } +} + +Map Map() : { Map m = new HashMap(); } +{ + + + ( MapEntry(m) )? + + ( MapEntry(m) )* + + + + { return m; } +} + +void MapEntry(Map m) : { CDTKey key; CDTValue value; } +{ + key = MapKey() + + + + value = MapValue() + + { + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) throw new ParseException("map with non-unique key (" + key.toString() + ")"); + } +} + +CDTKey MapKey() : { String iri; Node n; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } +| + n = BlankNode() { return CDTFactory.createKey(n); } +| + n = RDFLiteral() { return CDTFactory.createKey(n); } +| + n = NumericLiteral() { return CDTFactory.createKey(n); } +| + n = BooleanLiteral() { return CDTFactory.createKey(n); } +} + +CDTValue MapValue() : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } +| + n = BlankNode() { return CDTFactory.createValue(n); } +| + n = RDFLiteral() { return CDTFactory.createValue(n); } +| + n = NumericLiteral() { return CDTFactory.createValue(n); } +| + n = BooleanLiteral() { return CDTFactory.createValue(n); } +| + { return CDTFactory.getNullValue(); } +| + subList = List() { return CDTFactory.createValue(subList); } +| + m = Map() { return CDTFactory.createValue(m); } +} + + +// ---- Basic terms + +String IRI_REF() : { Token t ; } +{ + t = + { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } +} + +Node BlankNode() : { Token t = null ; } +{ + t = + + { + return createBNode(t.image, t.beginLine, t.beginColumn); + } +} + +Node NumericLiteral() : { Token t ; } +{ + t = { return createLiteralInteger(t.image); } +| t = { return createLiteralDecimal(t.image); } +| t = { return createLiteralDouble(t.image); } +} + +Node BooleanLiteral() : {} +{ + { return XSD_TRUE; } + | + { return XSD_FALSE; } +} + +Node RDFLiteral() : { String lex = null ; } +{ + lex = String() + // Optional lang tag and datatype. + { String lang = null ; String dt = null ; } + ( + lang = Langtag() + | + ( dt = IRI_REF() ) // divergence from the Turtle parser here; instead of IRIref(), we only permit IRI_REF() + )? + + { + return createLiteral(lex, lang, dt); + } +} + +String Langtag() : { Token t ; } +{ + t = // divergence from the Turtle parser here, which also permits AnyDirective() at this point + { String lang = stripChars(t.image, 1) ; return lang ; } +} + +String String() : { Token t ; String lex ; } +{ + ( t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + ) + { lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + return lex ; + } +} + + +// ------------------------------------------ +// Tokens + +// Comments and whitespace + +SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + +TOKEN: { <#WS: " " | "\t" | "\n" | "\r" | "\f"> } + + +// ------------------------------------------------- +// Keywords + +TOKEN [IGNORE_CASE] : +{ + < TRUE: "true" > +| < FALSE: "false" > + +// ------------------------------------------------- + +| < INTEGER: (["-","+"])? > +| + < DECIMAL: (["-","+"])? + (()+ "." ()* | "." ()+) + > + // Required exponent. +| < DOUBLE: + (["+","-"])? + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > +| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| < #QUOTE_3D: "\"\"\""> +| < #QUOTE_3S: "'''"> +// "u" done by javacc input stream. +// "U" escapes not supported yet for Java strings +| + +| < STRING_LITERAL1: + // Single quoted string + "'" ( (~["'","\\","\n","\r"]) | )* "'" > + +| < STRING_LITERAL2: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > + +| < STRING_LITERAL_LONG1: + + ( ~["'","\\"] | | ("'" ~["'"]) | ("''" ~["'"]))* + > + +| < STRING_LITERAL_LONG2: + + ( ~["\"","\\"] | | ("\"" ~["\""]) | ("\"\"" ~["\""]))* + > +| < DIGITS: (["0"-"9"])+> +// | +} + +TOKEN: +{ + // Includes # for relative URIs + ","<", "\"", "{", "}", "^", "\\", "|", "`", + "\u0000"-"\u0020"])* ">" > +| > +| ()+("-" ()+)* > +| <#A2Z: ["a"-"z","A"-"Z"]> +| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> +} + + +TOKEN : +{ + < NULL: "null" > + +| < LBRACE: "{" > +| < RBRACE: "}" > + +| < LBRACKET: "[" > +| < RBRACKET: "]" > + +| < COMMA: "," > +| < COLON: ":" > +} + +// Operator + +TOKEN : +{ + < DATATYPE: "^^"> +| < AT: "@"> +} + +TOKEN: +{ + <#PN_CHARS_BASE: + ["A"-"Z"] | ["a"-"z"] | + ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | + ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | + ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | + ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] + > + // [#x10000-#xEFFFF] +| + <#PN_CHARS_U: | "_" > +| +// No DOT + <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > +| + // With a leading "_", no dot at end of local name. + <#PN_LOCAL: ( | ["0"-"9"]) ((|".")* )? > +} + +// Catch-all tokens. Must be last. +// Any non-whitespace. Causes a parser exception, rather than a +// token manager error (with hidden line numbers). +// Only bad IRIs (e.g. spaces) now give unhelpful parse errors. +TOKEN: +{ + <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > +} + +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs new file mode 100755 index 00000000000..fb95f355e44 --- /dev/null +++ b/jena-arq/Grammar/grammarCDTs @@ -0,0 +1,59 @@ +#!/bin/bash +## 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. + +# Parser builder + +DIR="../src/main/java/org/apache/jena/cdt/parser" +FILE=cdt_literals.jj +CLASS=CDTLiteralParser + +(cd "$DIR" ; rm -f *.java ) + +echo "---- Process grammar ----" + +javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" + +RC=$? +[ "$RC" = 0 ] || return + +## echo "---- Create text form ----" +## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" + +echo "---- Fixing Java warnings in TokenMgrError" +F="$DIR/TokenMgrError.java" +if [ -e "$F" ] +then + sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic class TokenMgrError/' < $F > F + mv F $F +fi + +## JavaCharStream -- SimpleCharStream is OK. +echo "---- Fixing Java warnings in JavaCharStream..." +F="$DIR/JavaCharStream.java" +if [ -e "$F" ] +then + sed -e 's/public/\n@SuppressWarnings("all")\npublic/' < $F > F + mv F $F +fi + +echo "---- Fixing Java warnings in ${CLASS} ..." +F="$DIR/${CLASS}.java" +sed -e 's/@SuppressWarnings("serial")//' \ + < $F > F +mv F $F + +echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java new file mode 100644 index 00000000000..1c96d41b629 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -0,0 +1,68 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.graph.Node; + +public class CDTFactory +{ + public static CDTKey createKey( final Node n ) { + return new CDTKey() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final Node n ) { + return new CDTValue() { + @Override public boolean isNode() { return true; } + @Override public Node asNode() { return n; } + }; + } + + public static CDTValue createValue( final List l ) { + return new CDTValue() { + @Override public boolean isList() { return true; } + @Override public List asList() { return l; } + }; + } + + public static CDTValue createValue( final Map m ) { + return new CDTValue() { + @Override public boolean isMap() { return true; } + @Override public Map asMap() { return m; } + }; + } + + public static CDTValue getNullValue() { + if ( nullValue == null ) { + return new CDTValue() { + @Override public boolean isNull() { return true; } + }; + } + + return nullValue; + } + + private static CDTValue nullValue = null; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java new file mode 100644 index 00000000000..32c455d1810 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.graph.Node; + +public abstract class CDTKey +{ + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public boolean equals( final Object other ) { + if ( !(other instanceof CDTKey) ) { + return false; + } + + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + + @Override + public String toString() { + if ( isNode() ) { + return asNode().toString(); + } + else { + return super.toString(); + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java new file mode 100644 index 00000000000..01325265fc1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParseException.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.shared.JenaException; + +public class CDTLiteralParseException extends JenaException +{ + private static final long serialVersionUID = -6244204787118953600L; + + public CDTLiteralParseException() { super(); } + public CDTLiteralParseException(Throwable cause) { super(cause); } + public CDTLiteralParseException(String msg) { super(msg); } + public CDTLiteralParseException(String msg, Throwable cause) { super(msg, cause); } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java new file mode 100644 index 00000000000..e0bd1443def --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -0,0 +1,100 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; +import java.util.Map; + +public abstract class CDTValue extends CDTKey +{ + /** + * Returns true if this object is a list. In that case, {@link #asList()} + * can be used to get it as an actual {@link List} object. + */ + public boolean isList() { + return false; + } + + /** + * Returns true if this object is a map. In that case, {@link #asMap()} + * can be used to get it as an actual {@link Map} object. + */ + public boolean isMap() { + return false; + } + + /** + * Returns true if this is a null value. + */ + public boolean isNull() { + return false; + } + + /** + * Returns this object as a list, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public List asList() { + throw new UnsupportedOperationException( this + " is not a list" ); + } + + /** + * Returns this object as a map, assuming it is one. If it is not, + * then an {@link UnsupportedOperationException} is thrown. + */ + public Map asMap() { + throw new UnsupportedOperationException( this + " is not a map" ); + } + + @Override + public final boolean equals( final Object other ) { + if ( !(other instanceof CDTValue) ) { + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); + } + else { + return false; + } + } + + if ( isNull() ) { + return false; + } + + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) { + return false; + } + + if ( isNode() && otherValue.isNode() ) { + return asNode().equals( otherValue.asNode() ); + } + else if ( isList() && otherValue.isList() ) { + return asList().equals( otherValue.asList() ); + } + else if ( isMap() && otherValue.isMap() ) { + return asMap().equals( otherValue.asMap() ); + } + else { + return false; + } + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java new file mode 100644 index 00000000000..ca5e1878c18 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -0,0 +1,45 @@ +/* + * 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 org.apache.jena.cdt; + +import org.apache.jena.datatypes.RDFDatatype; + +public abstract class CompositeDatatypeBase implements RDFDatatype +{ + @Override + public Class getJavaClass() { + return null; + } + + @Override + public Object cannonicalise( final Object value ) { + return value; + } + + @Override + public Object extendedTypeDefinition() { + return null; + } + + @Override + public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) { + return this; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java new file mode 100644 index 00000000000..9c43f8978c9 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -0,0 +1,181 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeList extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static CompositeDatatypeList type = new CompositeDatatypeList(); + + protected CompositeDatatypeList() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseList(list); + } + + public static String unparseList( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + public static String unparseListElement( final CDTValue elmt ) { + if ( elmt.isNode() ) + return NodeFmtLib.strTTL( elmt.asNode() ); + else if ( elmt.isList() ) + return unparseList( elmt.asList() ); + else if ( elmt.isMap() ) + return CompositeDatatypeMap.unparseMap( elmt.asMap() ); + else if ( elmt.isNull() ) + return "null"; + else + throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + } + + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + return parseList(lexicalForm); + } + + public static List parseList( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof List) ) { + return false; + } + + final List l = (List) value; + for ( final Object e : l ) { + if ( !(e instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForList objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForList makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForList ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final List list1 = getValue(value1); + final List list2 = getValue(value2); + + return list1.equals(list2); + } + + public static List getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseList(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForList ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java new file mode 100644 index 00000000000..4c71bd18569 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -0,0 +1,175 @@ +package org.apache.jena.cdt; + +import java.util.Iterator; +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.out.NodeFmtLib; + +public class CompositeDatatypeMap extends CompositeDatatypeBase +{ + public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); + + protected CompositeDatatypeMap() {} + + @Override + public String getURI() { + return uri; + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof Map) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + + return unparseMap(map); + } + + public static String unparseMap( final Map map ) { + final StringBuilder sb = new StringBuilder(); + sb.append("{"); + if ( ! map.isEmpty() ) { + final Iterator> it = map.entrySet().iterator(); + + final Map.Entry firstEntry = it.next(); + unparseMapEntry(firstEntry, sb); + + while ( it.hasNext() ) { + sb.append(", "); + + final Map.Entry nextEntry = it.next(); + unparseMapEntry(nextEntry, sb); + } + } + + sb.append("}"); + return sb.toString(); + } + + public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + if ( entry.getKey().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); + else + throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); + + sb.append(" : "); + + if ( entry.getValue().isNode() ) + sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); + else if ( entry.getValue().isList() ) + sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); + else if ( entry.getValue().isMap() ) + sb.append( unparseMap( entry.getValue().asMap() ) ); + else if ( entry.getValue().isNull() ) + sb.append( "null" ); + else + throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + return parseMap(lexicalForm); + } + + public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public boolean isValid( final String lexicalForm ) { + final boolean recursive = false; + try { + ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + return false; + } + return true; + } + + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return true; + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); + + return map1.equals(map2); + } + + public static Map getValue( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return ( (LiteralLabelForMap) lit ).getValue(); + } + else { + final String lex = lit.getLexicalForm(); + return parseMap(lex); + } + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + if ( lit instanceof LiteralLabelForMap ) { + return lit.hashCode(); + } + else { + return lit.getLexicalForm().hashCode(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java new file mode 100644 index 00000000000..c5215fccdc2 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -0,0 +1,154 @@ +package org.apache.jena.cdt; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.rdf.model.impl.Util; + +public abstract class LiteralLabelForCDTs implements LiteralLabel +{ + protected final int hash; + + private T valueForm; + private String lexicalForm; + private boolean lexicalFormTested; + + public LiteralLabelForCDTs( final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = null; + + this.lexicalFormTested = true; + this.hash = valueForm.hashCode(); + } + + public LiteralLabelForCDTs( final String lexicalForm ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = false; + this.hash = lexicalForm.hashCode(); + } + + @Override + public boolean isXML() { + return false; + } + + @Override + public boolean isWellFormed() { + if ( lexicalFormTested ) { + return valueForm != null; + } + + try { + getValue(); + } + catch ( final DatatypeFormatException ex ) { + return false; + } + + return true; + } + + @Override + public boolean isWellFormedRaw() { + return isWellFormed(); + } + + @Override + public String toString( final boolean quoting ) { + final StringBuilder b = new StringBuilder(); + + if ( quoting ) b.append('"'); + + String lex = getLexicalForm(); + lex = Util.replace(lex, "\"", "\\\""); + b.append(lex); + + if ( quoting ) b.append('"'); + + b.append("^^").append( getDatatypeURI() ); + + return b.toString(); + } + + @Override + public String toString() { + return toString(false); + } + + @Override + public String getLexicalForm() { + if ( lexicalForm == null ) { + lexicalForm = unparseValueForm(valueForm); + } + + return lexicalForm; + } + + protected abstract String unparseValueForm( T valueForm ); + + protected boolean isLexicalFormSet() { + return lexicalForm != null; + } + + protected boolean isValueFormSet() { + return valueForm != null; + } + + @Override + public Object getIndexingValue() { + return getLexicalForm(); + } + + @Override + public String language() { + return ""; + } + + @Override + public T getValue() throws DatatypeFormatException { + if ( valueForm == null && ! lexicalFormTested ) { + lexicalFormTested = true; + + // The following function may fail with a DatatypeFormatException, + // in which case 'valueForm' will remain being 'null' but we won't + // try again at the next call of 'getValue()' because now we have + // set 'lexicalFormTested'. + + valueForm = parseLexicalForm(lexicalForm); + } + + return valueForm; + } + + protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { + return false; + } + + if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { + return true; + } + + return getValue().equals( other.getValue() ); + } + + @Override + public int getDefaultHashcode() { + return hash; + } + + @Override + public int hashCode() { + return hash; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java new file mode 100644 index 00000000000..bc626e0fd01 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.List; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForList extends LiteralLabelForCDTs> +{ + public LiteralLabelForList( final List valueForm ) { + super(valueForm); + } + + public LiteralLabelForList( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( List valueForm ) { + return CompositeDatatypeList.unparseList(valueForm); + } + + @Override + protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeList.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForList ) { + final LiteralLabelForList otherListLiteral = (LiteralLabelForList) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherListLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherListLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherListLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java new file mode 100644 index 00000000000..1d5093e1da7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.jena.cdt; + +import java.util.Map; + +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class LiteralLabelForMap extends LiteralLabelForCDTs> +{ + public LiteralLabelForMap( final Map valueForm ) { + super(valueForm); + } + + public LiteralLabelForMap( final String lexicalForm ) { + super(lexicalForm); + } + + @Override + protected String unparseValueForm( Map valueForm ) { + return CompositeDatatypeMap.unparseMap(valueForm); + } + + @Override + protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + } + + @Override + public RDFDatatype getDatatype() { + return CompositeDatatypeMap.type; + } + + @Override + public boolean sameValueAs( final LiteralLabel other ) { + if ( other instanceof LiteralLabelForMap ) { + final LiteralLabelForMap otherMapLiteral = (LiteralLabelForMap) other; + // If the lexical forms of both are equivalent (and we + // actually have the lexical forms of both; i.e., we do + // not need to materialize them just for this check), then + // the values are trivially equivalent. + if ( isLexicalFormSet() + && otherMapLiteral.isLexicalFormSet() + && getLexicalForm().equals(otherMapLiteral.getLexicalForm()) ) { + return true; + } + + // Otherwise, we compare the actual lists that they represent. + return getValue().equals( otherMapLiteral.getValue() ); + } + + return super.sameValueAs(other); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java new file mode 100644 index 00000000000..844bca2ed49 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -0,0 +1,155 @@ +/* + * 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 org.apache.jena.cdt; + +import java.io.InputStream; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.parser.CDTLiteralParser; +import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.ttl.turtle.parser.TokenMgrError; +import org.apache.jena.util.FileUtils; + +public class ParserForCDTLiterals +{ + public static List parseListLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static List parseListLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final List result = parseListLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static List parseListLiteral( final Reader reader, final boolean recursive ) { + final List list; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + list = parser.List(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! list.isEmpty() ) { + for ( int i = 0; i < list.size(); i++ ) { + final CDTValue v = list.get(i); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subList) ); + } + else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + list.set( i, CDTFactory.createValue(subMap) ); + } + } + } + } + + return list; + } + + public static Map parseMapLiteral( final String lex, final boolean recursive ) { + final Reader reader = new StringReader(lex); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException e ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", e); + } + + return result; + } + + public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { + final Reader reader = FileUtils.asUTF8(in); + final Map result = parseMapLiteral(reader, recursive); + + try { reader.close(); } catch ( final IOException ex ) { + throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); + } + + return result; + } + + public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + final Map map; + try { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + map = parser.Map(); + } + catch ( final ParseException | TokenMgrError ex ) { + throw new CDTLiteralParseException( ex.getMessage() ); + } + catch ( final CDTLiteralParseException ex ) { + throw ex; + } + catch ( final Throwable th ) { + throw new CDTLiteralParseException( th.getMessage(), th ); + } + + if ( recursive && ! map.isEmpty() ) { + for ( final CDTKey key : map.keySet() ) { + final CDTValue v = map.get(key); + if ( v.isNode() && v.asNode().isLiteral() ) { + final String lex = v.asNode().getLiteralLexicalForm(); + final String dtURI = v.asNode().getLiteralDatatypeURI(); + + if ( dtURI.equals(CompositeDatatypeMap.uri) ) { + final Map subMap = parseMapLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } + else if ( dtURI.equals(CompositeDatatypeList.uri) ) { + final List subList = parseListLiteral(lex, recursive); + map.put( key, CDTFactory.createValue(subList) ); + } + } + } + } + + return map; + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java new file mode 100644 index 00000000000..a41a068d605 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -0,0 +1,570 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParser.java */ +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { + +// --- Entry point + final public void parse() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACKET: + List(); + break; + case LBRACE: + Map(); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public List List() throws ParseException { + List l = new ArrayList(); + jj_consume_token(LBRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + case NULL: + case LBRACE: + case LBRACKET: + ListElement(l); + break; + default: + jj_la1[1] = jj_gen; + ; + } + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + jj_consume_token(COMMA); + ListElement(l); + } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void ListElement(List l) throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); l.add( CDTFactory.createValue(n) ); + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + l.add( CDTFactory.createValue(n) ); + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + l.add( CDTFactory.createValue(n) ); + break; + case NULL: + jj_consume_token(NULL); + l.add( CDTFactory.getNullValue() ); + break; + case LBRACKET: + subList = List(); + l.add( CDTFactory.createValue(subList) ); + break; + case LBRACE: + m = Map(); + l.add( CDTFactory.createValue(m) ); + break; + default: + jj_la1[3] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public Map Map() throws ParseException { + Map m = new HashMap(); + jj_consume_token(LBRACE); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + case FALSE: + case INTEGER: + case DECIMAL: + case DOUBLE: + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + case IRIref: + case BLANK_NODE_LABEL: + MapEntry(m); + break; + default: + jj_la1[4] = jj_gen; + ; + } + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[5] = jj_gen; + break label_2; + } + jj_consume_token(COMMA); + MapEntry(m); + } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void MapEntry(Map m) throws ParseException { + CDTKey key; CDTValue value; + key = MapKey(); + jj_consume_token(COLON); + value = MapValue(); + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) {if (true) throw new ParseException("map with non-unique key (" + key.toString() + ")");} + } + + final public CDTKey MapKey() throws ParseException { + String iri; Node n; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createKey(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createKey(n);} + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public CDTValue MapValue() throws ParseException { + String iri; Node n; List subList; Map m; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + iri = IRI_REF(); + n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + break; + case BLANK_NODE_LABEL: + n = BlankNode(); + {if (true) return CDTFactory.createValue(n);} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + n = NumericLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return CDTFactory.createValue(n);} + break; + case NULL: + jj_consume_token(NULL); + {if (true) return CDTFactory.getNullValue();} + break; + case LBRACKET: + subList = List(); + {if (true) return CDTFactory.createValue(subList);} + break; + case LBRACE: + m = Map(); + {if (true) return CDTFactory.createValue(m);} + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + +// ---- Basic terms + final public String IRI_REF() throws ParseException { + Token t ; + t = jj_consume_token(IRIref); + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + throw new Error("Missing return statement in function"); + } + + final public Node BlankNode() throws ParseException { + Token t = null ; + t = jj_consume_token(BLANK_NODE_LABEL); + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn);} + throw new Error("Missing return statement in function"); + } + + final public Node NumericLiteral() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: + t = jj_consume_token(INTEGER); + {if (true) return createLiteralInteger(t.image);} + break; + case DECIMAL: + t = jj_consume_token(DECIMAL); + {if (true) return createLiteralDecimal(t.image);} + break; + case DOUBLE: + t = jj_consume_token(DOUBLE); + {if (true) return createLiteralDouble(t.image);} + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node BooleanLiteral() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + jj_consume_token(TRUE); + {if (true) return XSD_TRUE;} + break; + case FALSE: + jj_consume_token(FALSE); + {if (true) return XSD_FALSE;} + break; + default: + jj_la1[9] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public Node RDFLiteral() throws ParseException { + String lex = null ; + lex = String(); + String lang = null ; String dt = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: + lang = Langtag(); + break; + case DATATYPE: + jj_consume_token(DATATYPE); + dt = IRI_REF(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[11] = jj_gen; + ; + } + {if (true) return createLiteral(lex, lang, dt);} + throw new Error("Missing return statement in function"); + } + + final public String Langtag() throws ParseException { + Token t ; + t = jj_consume_token(LANGTAG); + String lang = stripChars(t.image, 1) ; {if (true) return lang ;} + throw new Error("Missing return statement in function"); + } + + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: + t = jj_consume_token(STRING_LITERAL1); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL2: + t = jj_consume_token(STRING_LITERAL2); + lex = stripQuotes(t.image) ; + break; + case STRING_LITERAL_LONG1: + t = jj_consume_token(STRING_LITERAL_LONG1); + lex = stripQuotes3(t.image) ; + break; + case STRING_LITERAL_LONG2: + t = jj_consume_token(STRING_LITERAL_LONG2); + lex = stripQuotes3(t.image) ; + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + {if (true) return lex ;} + throw new Error("Missing return statement in function"); + } + + /** Generated Token Manager. */ + public CDTLiteralParserTokenManager token_source; + JavaCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private int jj_gen; + final private int[] jj_la1 = new int[13]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static { + jj_la1_init_0(); + jj_la1_init_1(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + } + + /** Constructor with InputStream. */ + public CDTLiteralParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public CDTLiteralParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor. */ + public CDTLiteralParser(java.io.Reader stream) { + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new CDTLiteralParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Constructor with generated Token Manager. */ + public CDTLiteralParser(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + /** Reinitialise. */ + public void ReInit(CDTLiteralParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 13; i++) jj_la1[i] = -1; + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[40]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 13; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1<", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "\"\\f\"", + "", + "\"true\"", + "\"false\"", + "", + "", + "", + "", + "\"\\\"\\\"\\\"\"", + "\"\\\'\\\'\\\'\"", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\"null\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\",\"", + "\":\"", + "\"^^\"", + "\"@\"", + "", + "", + "", + "", + "", + }; + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java new file mode 100644 index 00000000000..c7c080e9454 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -0,0 +1,1045 @@ +/* Generated By:JavaCC: Do not edit this line. CDTLiteralParserTokenManager.java */ +/* + * 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 org.apache.jena.cdt.parser; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +/** Token Manager. */ +public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 9: + jjmatchedKind = 2; + return jjMoveNfa_0(0, 0); + case 10: + jjmatchedKind = 3; + return jjMoveNfa_0(0, 0); + case 12: + jjmatchedKind = 5; + return jjMoveNfa_0(0, 0); + case 13: + jjmatchedKind = 4; + return jjMoveNfa_0(0, 0); + case 32: + jjmatchedKind = 1; + return jjMoveNfa_0(0, 0); + case 44: + jjmatchedKind = 31; + return jjMoveNfa_0(0, 0); + case 58: + jjmatchedKind = 32; + return jjMoveNfa_0(0, 0); + case 64: + jjmatchedKind = 34; + return jjMoveNfa_0(0, 0); + case 70: + return jjMoveStringLiteralDfa1_0(0x100L); + case 84: + return jjMoveStringLiteralDfa1_0(0x80L); + case 91: + jjmatchedKind = 29; + return jjMoveNfa_0(0, 0); + case 93: + jjmatchedKind = 30; + return jjMoveNfa_0(0, 0); + case 94: + return jjMoveStringLiteralDfa1_0(0x200000000L); + case 102: + return jjMoveStringLiteralDfa1_0(0x100L); + case 110: + return jjMoveStringLiteralDfa1_0(0x4000000L); + case 116: + return jjMoveStringLiteralDfa1_0(0x80L); + case 123: + jjmatchedKind = 27; + return jjMoveNfa_0(0, 0); + case 125: + jjmatchedKind = 28; + return jjMoveNfa_0(0, 0); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 0); + } + switch(curChar) + { + case 65: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 82: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 94: + if ((active0 & 0x200000000L) != 0L) + { + jjmatchedKind = 33; + jjmatchedPos = 1; + } + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x100L); + case 114: + return jjMoveStringLiteralDfa2_0(active0, 0x80L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); + default : + break; + } + return jjMoveNfa_0(0, 1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 1); + } + switch(curChar) + { + case 76: + return jjMoveStringLiteralDfa3_0(active0, 0x100L); + case 85: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x4000100L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x80L); + default : + break; + } + return jjMoveNfa_0(0, 2); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 2); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 2); + } + switch(curChar) + { + case 69: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 83: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + case 101: + if ((active0 & 0x80L) != 0L) + { + jjmatchedKind = 7; + jjmatchedPos = 3; + } + break; + case 108: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 3; + } + break; + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x100L); + default : + break; + } + return jjMoveNfa_0(0, 3); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjMoveNfa_0(0, 3); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return jjMoveNfa_0(0, 3); + } + switch(curChar) + { + case 69: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + case 101: + if ((active0 & 0x100L) != 0L) + { + jjmatchedKind = 8; + jjmatchedPos = 4; + } + break; + default : + break; + } + return jjMoveNfa_0(0, 4); +} +static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { + 0xfffe7000fffffff6L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x7e00000000ffffffL +}; +static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec5 = { + 0x0L, 0xbfff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec6 = { + 0x3000L, 0xffff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec7 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L +}; +static final long[] jjbitVec8 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffL +}; +static final long[] jjbitVec9 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffffL +}; +static final long[] jjbitVec10 = { + 0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL +}; +static final long[] jjbitVec11 = { + 0xffffffffffffffffL, 0xbfffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec12 = { + 0x8000000000003000L, 0xffff000000000001L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int strKind = jjmatchedKind; + int strPos = jjmatchedPos; + int seenUpto; + input_stream.backup(seenUpto = curPos + 1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error"); } + curPos = 0; + int startsAt = 0; + jjnewStateCnt = 74; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + } + else if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + else if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + else if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + else if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + else if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + if (curChar == 34) + jjCheckNAddStates(13, 15); + else if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 1: + if ((0x8400000000L & l) != 0L && kind > 15) + kind = 15; + break; + case 2: + if (curChar == 39) + jjCheckNAddStates(16, 18); + break; + case 3: + if ((0xffffff7fffffdbffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 5: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 6: + if (curChar == 39 && kind > 16) + kind = 16; + break; + case 7: + if (curChar == 34) + jjCheckNAddStates(13, 15); + break; + case 8: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 10: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 11: + if (curChar == 34 && kind > 17) + kind = 17; + break; + case 12: + if (curChar == 39) + jjCheckNAddStates(19, 22); + break; + case 13: + case 17: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 15: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 16: + case 19: + if (curChar == 39) + jjCheckNAdd(17); + break; + case 18: + if (curChar == 39) + jjAddStates(23, 24); + break; + case 20: + if (curChar == 39 && kind > 18) + kind = 18; + break; + case 21: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 20; + break; + case 22: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 23: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 22; + break; + case 24: + if (curChar == 34) + jjCheckNAddStates(25, 28); + break; + case 25: + case 29: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 27: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 28: + case 31: + if (curChar == 34) + jjCheckNAdd(29); + break; + case 30: + if (curChar == 34) + jjAddStates(29, 30); + break; + case 32: + if (curChar == 34 && kind > 19) + kind = 19; + break; + case 33: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 34: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 24; + break; + case 35: + if (curChar == 34) + jjstateSet[jjnewStateCnt++] = 34; + break; + case 36: + if (curChar == 60) + jjCheckNAddTwoStates(37, 38); + break; + case 37: + if ((0xaffffffa00000000L & l) != 0L) + jjCheckNAddTwoStates(37, 38); + break; + case 38: + if (curChar == 62 && kind > 21) + kind = 21; + break; + case 39: + if (curChar == 58) + jjstateSet[jjnewStateCnt++] = 40; + break; + case 40: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x3ff600000000000L & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x3ff200000000000L & l) != 0L && kind > 22) + kind = 22; + break; + case 46: + if (curChar == 45) + jjCheckNAdd(47); + break; + case 47: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 48: + if ((0x280000000000L & l) != 0L) + jjCheckNAddStates(8, 12); + break; + case 49: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(49); + break; + case 50: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(50, 51); + break; + case 51: + if (curChar != 46) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 52: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(52); + break; + case 53: + if (curChar == 46) + jjCheckNAdd(54); + break; + case 54: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 10) + kind = 10; + jjCheckNAdd(54); + break; + case 55: + if (curChar == 46) + jjCheckNAdd(56); + break; + case 56: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(56, 57); + break; + case 58: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(59); + break; + case 59: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(59); + break; + case 60: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(31, 34); + break; + case 61: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(61, 62); + break; + case 62: + if (curChar == 46) + jjCheckNAddTwoStates(63, 64); + break; + case 63: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(63, 64); + break; + case 65: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(66); + break; + case 66: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(66); + break; + case 67: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(67, 68); + break; + case 69: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(70); + break; + case 70: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 11) + kind = 11; + jjCheckNAdd(70); + break; + case 71: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAddStates(0, 7); + break; + case 72: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 20) + kind = 20; + jjCheckNAdd(72); + break; + case 73: + if (curChar == 46) + jjCheckNAddTwoStates(54, 56); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + if (curChar == 64) + jjCheckNAdd(45); + else if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + else if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 1: + if ((0x14404410144044L & l) != 0L && kind > 15) + kind = 15; + break; + case 3: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 4: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 5; + break; + case 5: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(16, 18); + break; + case 8: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 9: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 13: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 14: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 15; + break; + case 15: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(19, 22); + break; + case 17: + jjCheckNAddStates(19, 22); + break; + case 25: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 26: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 27: + if ((0x14404410144044L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 29: + jjCheckNAddStates(25, 28); + break; + case 37: + if ((0xc7fffffeafffffffL & l) != 0L) + jjAddStates(35, 36); + break; + case 40: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if ((0x7fffffe87fffffeL & l) != 0L) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if ((0x7fffffe87fffffeL & l) != 0L && kind > 22) + kind = 22; + break; + case 43: + if (curChar == 95) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 44: + if (curChar == 64) + jjCheckNAdd(45); + break; + case 45: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(45, 46); + break; + case 47: + if ((0x7fffffe07fffffeL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjCheckNAddTwoStates(46, 47); + break; + case 57: + if ((0x2000000020L & l) != 0L) + jjAddStates(37, 38); + break; + case 64: + if ((0x2000000020L & l) != 0L) + jjAddStates(39, 40); + break; + case 68: + if ((0x2000000020L & l) != 0L) + jjAddStates(41, 42); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 3: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(16, 18); + break; + case 8: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(13, 15); + break; + case 13: + case 17: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(19, 22); + break; + case 25: + case 29: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjCheckNAddStates(25, 28); + break; + case 37: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(35, 36); + break; + case 40: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 22) + kind = 22; + jjCheckNAddTwoStates(41, 42); + break; + case 41: + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) + jjCheckNAddTwoStates(41, 42); + break; + case 42: + if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 22) + kind = 22; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 74 - (jjnewStateCnt = startsAt))) + break; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { break; } + } + if (jjmatchedPos > strPos) + return curPos; + + int toRet = Math.max(curPos, seenUpto); + + if (curPos < toRet) + for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; ) + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); } + + if (jjmatchedPos < strPos) + { + jjmatchedKind = strKind; + jjmatchedPos = strPos; + } + else if (jjmatchedPos == strPos && jjmatchedKind > strKind) + jjmatchedKind = strKind; + + return toRet; +} +static final int[] jjnextStates = { + 49, 50, 51, 61, 62, 67, 68, 72, 49, 50, 53, 55, 60, 8, 9, 11, + 3, 4, 6, 13, 14, 16, 18, 19, 21, 25, 26, 28, 30, 31, 33, 61, + 62, 67, 68, 37, 38, 58, 59, 65, 66, 69, 70, +}; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default : + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 3: + return ((jjbitVec5[i2] & l2) != 0L); + case 32: + return ((jjbitVec6[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec10[i2] & l2) != 0L); + case 3: + return ((jjbitVec11[i2] & l2) != 0L); + case 32: + return ((jjbitVec12[i2] & l2) != 0L); + case 33: + return ((jjbitVec7[i2] & l2) != 0L); + case 47: + return ((jjbitVec8[i2] & l2) != 0L); + case 48: + return ((jjbitVec0[i2] & l2) != 0L); + case 255: + return ((jjbitVec9[i2] & l2) != 0L); + default : + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } +} + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, +"\156\165\154\154", "\173", "\175", "\133", "\135", "\54", "\72", "\136\136", "\100", null, null, +null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0x7fcff8f81L, +}; +static final long[] jjtoSkip = { + 0x3eL, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[74]; +private final int[] jjstateSet = new int[148]; +protected char curChar; +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public CDTLiteralParserTokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 74; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java new file mode 100644 index 00000000000..0db07c051d1 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/JavaCharStream.java @@ -0,0 +1,703 @@ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (with java-like unicode escape processing). + */ + + +@SuppressWarnings("all") +public +class JavaCharStream +{ + /** Whether parser is static. */ + +@SuppressWarnings("all") +public static final boolean staticFlag = false; + + static final int hexval(char c) throws java.io.IOException { + switch(c) + { + case '0' : + return 0; + case '1' : + return 1; + case '2' : + return 2; + case '3' : + return 3; + case '4' : + return 4; + case '5' : + return 5; + case '6' : + return 6; + case '7' : + return 7; + case '8' : + return 8; + case '9' : + return 9; + + case 'a' : + case 'A' : + return 10; + case 'b' : + case 'B' : + return 11; + case 'c' : + case 'C' : + return 12; + case 'd' : + case 'D' : + return 13; + case 'e' : + case 'E' : + return 14; + case 'f' : + case 'F' : + return 15; + } + + throw new java.io.IOException(); // Should never come here + } + +/** Position in buffer. */ + +@SuppressWarnings("all") +public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] nextCharBuf; + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int nextCharInd = -1; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, + 4096 - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + if (bufpos != 0) + { + --bufpos; + backup(0); + } + else + { + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + } + + protected char ReadByte() throws java.io.IOException + { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + +/** @return starting character for token. */ + +@SuppressWarnings("all") +public char BeginToken() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + tokenBegin = bufpos; + return buffer[bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + protected void AdjustBuffSize() + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = 0; + available = tokenBegin; + } + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + +@SuppressWarnings("all") +public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + char c; + + if (++bufpos == available) + AdjustBuffSize(); + + if ((buffer[bufpos] = c = ReadByte()) == '\\') + { + UpdateLineColumn(c); + + int backSlashCnt = 1; + + for (;;) // Read all the backslashes + { + if (++bufpos == available) + AdjustBuffSize(); + + try + { + if ((buffer[bufpos] = c = ReadByte()) != '\\') + { + UpdateLineColumn(c); + // found a non-backslash char. + if ((c == 'u') && ((backSlashCnt & 1) == 1)) + { + if (--bufpos < 0) + bufpos = bufsize - 1; + + break; + } + + backup(backSlashCnt); + return '\\'; + } + } + catch(java.io.IOException e) + { + // We are returning one backslash so we should only backup (count-1) + if (backSlashCnt > 1) + backup(backSlashCnt-1); + + return '\\'; + } + + UpdateLineColumn(c); + backSlashCnt++; + } + + // Here, we have seen an odd number of backslash's followed by a 'u' + try + { + while ((c = ReadByte()) == 'u') + ++column; + + buffer[bufpos] = c = (char)(hexval(c) << 12 | + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); + + column += 4; + } + catch(java.io.IOException e) + { + throw new Error("Invalid escape character at line " + line + + " column " + column + "."); + } + + if (backSlashCnt == 1) + return c; + else + { + backup(backSlashCnt - 1); + return '\\'; + } + } + else + { + UpdateLineColumn(c); + return c; + } + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + +@SuppressWarnings("all") +public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + +@SuppressWarnings("all") +public int getLine() { + return bufline[bufpos]; + } + +/** Get end column. */ + +@SuppressWarnings("all") +public int getEndColumn() { + return bufcolumn[bufpos]; + } + +/** Get end line. */ + +@SuppressWarnings("all") +public int getEndLine() { + return bufline[bufpos]; + } + +/** @return column of token start */ + +@SuppressWarnings("all") +public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + +/** @return line number of token start */ + +@SuppressWarnings("all") +public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Retreat. */ + +@SuppressWarnings("all") +public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + +/** Constructor. */ + +@SuppressWarnings("all") +public JavaCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + +/** Reinitialise. */ + +@SuppressWarnings("all") +public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + + /** @return token image as String */ + +@SuppressWarnings("all") +public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** @return suffix */ + +@SuppressWarnings("all") +public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Set buffers back to null when finished. */ + +@SuppressWarnings("all") +public void Done() + { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + +@SuppressWarnings("all") +public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=2ebc561fdb294979325bb97dfcdf1b61 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java new file mode 100644 index 00000000000..9fff7e2c63a --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/ParseException.java @@ -0,0 +1,205 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=0bd53902852438cd5670da2f50328753 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java new file mode 100644 index 00000000000..3e7793689f3 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/Token.java @@ -0,0 +1,149 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* + * 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 org.apache.jena.cdt.parser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=0bb1e7330fe557a4194caa87be20ae38 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java new file mode 100644 index 00000000000..307f2e7efde --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/TokenMgrError.java @@ -0,0 +1,167 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +/* + * 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 org.apache.jena.cdt.parser; + +/** Token Manager Error. */ + +@SuppressWarnings("all") +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=8d2f5d5473ff1b03e240576a846cb262 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index e621756f764..d376b2ea921 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -23,11 +23,15 @@ import java.util.NoSuchElementException; import org.apache.jena.atlas.io.IndentedWriter; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.ExecutionContext; import org.apache.jena.sparql.engine.QueryIterator; @@ -37,7 +41,6 @@ import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.serializer.SerializationContext; -import org.apache.jena.sparql.util.NodeFactoryExtra; public class QueryIterUnfold extends QueryIterRepeatApply { @@ -69,174 +72,25 @@ protected QueryIterator nextStage(Binding inputBinding) { Node n = nv.asNode(); if ( n.isLiteral() ) { String dtURI = n.getLiteralDatatypeURI(); - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(dtURI) ) - return unfoldUntypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithList.datatypeUriTypedList.equals(dtURI) ) - return unfoldTypedList(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(dtURI) ) - return unfoldUntypedMap(n.getLiteralLexicalForm(), inputBinding); - if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(dtURI) ) - return unfoldTypedMap(n.getLiteralLexicalForm(), inputBinding); + if ( CompositeDatatypeList.uri.equals(dtURI) ) + return unfoldList( n.getLiteral(), inputBinding ); + if ( CompositeDatatypeMap.uri.equals(dtURI) ) + return unfoldMap( n.getLiteral(), inputBinding ); } return QueryIterSingleton.create( inputBinding, getExecContext() ); } - protected QueryIterator unfoldUntypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - final Iterator itListElmts = parseUntypedList(listAsValue, pmap); + protected QueryIterator unfoldList( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable itListElmts = CompositeDatatypeList.getValue(lit); return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); } - public static Iterator parseUntypedList( String listAsValue, final PrefixMap pmap ) { - if ( listAsValue.startsWith("[") ) - listAsValue = listAsValue.substring( 1, listAsValue.length() - 1 ); - - return parseList(listAsValue, pmap); + protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBinding ) { + final Iterable> itMapEntries = CompositeDatatypeMap.getValue(lit).entrySet(); + return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } - protected QueryIterator unfoldTypedList(String listAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator itListElmts = parseTypedList(listAsValue, pmap); - return new QueryIterUnfoldWorkerForLists(inputBinding, itListElmts); - } - - public static Iterator parseTypedList( String listAsValue, final PrefixMap pmap ) { - listAsValue = listAsValue.substring( 1, listAsValue.lastIndexOf("]") ); - return parseList(listAsValue, pmap); - } - - protected QueryIterator unfoldUntypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseUntypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseUntypedMap( String mapAsValue, final PrefixMap pmap ) { - if ( mapAsValue.startsWith("{") ) - mapAsValue = mapAsValue.substring( 1, mapAsValue.length() - 1 ); - - return parseMap(mapAsValue, pmap); - } - - protected QueryIterator unfoldTypedMap(String mapAsValue, Binding inputBinding) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); - Iterator> itMapElmts = parseTypedMap(mapAsValue, pmap); - return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapElmts); - } - - public static Iterator> parseTypedMap( String mapAsValue, final PrefixMap pmap ) { - mapAsValue = mapAsValue.substring( 1, mapAsValue.lastIndexOf("}") ); - return parseMap(mapAsValue, pmap); - } - - public static Iterator parseList( final String listAsValue, final PrefixMap pmap ) { - final Iterator itListElmts = extractListElements(listAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itListElmts.hasNext(); - } - - @Override - public Node next() { - final String listElmt = itListElmts.next(); - final Node n; - if ( listElmt.startsWith("[") && listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeUntypedList); - else if ( listElmt.startsWith("[") && ! listElmt.endsWith("]") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( listElmt.startsWith("{") && listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeUntypedMap); - else if ( listElmt.startsWith("{") && ! listElmt.endsWith("}") ) - n = NodeFactory.createLiteral(listElmt, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - n = NodeFactoryExtra.parseNode(listElmt, pmap); - else - n = NodeFactoryExtra.parseNode(listElmt); - return n; - } - }; - } - - public static Iterator extractListElements(String listAsValue) { - listAsValue = listAsValue.strip(); - - if ( listAsValue.isEmpty() ) { - return new Iterator() { - @Override public boolean hasNext() { return false; } - @Override public String next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new ListElementExtractor(listAsValue); - } - - public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { - final Iterator> itMapElmts = extractMapElements(mapAsValue); - return new Iterator<>() { - @Override - public boolean hasNext() { - return itMapElmts.hasNext(); - } - - @Override - public Map.Entry next() { - final Map.Entry mapElmt = itMapElmts.next(); - final String keyAsString = mapElmt.getKey(); - final String valueAsString = mapElmt.getValue(); - - final Node keyAsNode; - if ( pmap != null ) - keyAsNode = NodeFactoryExtra.parseNode(keyAsString, pmap ); - else - keyAsNode = NodeFactoryExtra.parseNode(keyAsString); - - final Node valueAsNode; - if ( valueAsString.startsWith("[") && valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeUntypedList); - else if ( valueAsString.startsWith("[") && ! valueAsString.endsWith("]") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithList.datatypeTypedList); // brittle - else if ( valueAsString.startsWith("{") && valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeUntypedMap); - else if ( valueAsString.startsWith("{") && ! valueAsString.endsWith("}") ) - valueAsNode = NodeFactory.createLiteral(valueAsString, Node_LiteralWithMap.datatypeTypedMap); // brittle - else if ( pmap != null ) - valueAsNode = NodeFactoryExtra.parseNode(valueAsString, pmap); - else - valueAsNode = NodeFactoryExtra.parseNode(valueAsString); - - return new Map.Entry<>() { - @Override public Node getKey() { return keyAsNode; } - @Override public Node getValue() { return valueAsNode; } - @Override public Node setValue(Node v) { throw new UnsupportedOperationException(); } - }; - } - }; - } - - public static Iterator> extractMapElements(String mapAsValue) { - mapAsValue = mapAsValue.strip(); - - if ( mapAsValue.isEmpty() ) { - return new Iterator>() { - @Override public boolean hasNext() { return false; } - @Override public Map.Entry next() { throw new NoSuchElementException(); } - }; - } - -// TODO: this method needs to be improved and, in particular, made more robust in terms -// of parsing the given lexical form of the literal; for instance, simply splitting -// by commas is an issue if the list contains literals with commas inside -- can we -// use existing code for parsing Turtle here? - - return new MapElementExtractor(mapAsValue); - } protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { @@ -248,6 +102,10 @@ protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterator itElmts) { this.itElmts = itElmts; } + protected QueryIterUnfoldWorkerBase(Binding inputBinding, Iterable itElmts) { + this( inputBinding, itElmts.iterator() ); + } + @Override protected boolean hasNextBinding() { return itElmts.hasNext(); } @@ -259,9 +117,13 @@ protected void closeIterator() { } // nothing to do really } - protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + super(inputBinding, itListElmts); + } - public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterable itListElmts) { super(inputBinding, itListElmts); } @@ -272,14 +134,40 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - return BindingFactory.binding( inputBinding, var1, itElmts.next() ); + final CDTValue nextElmt = itElmts.next(); + + if ( nextElmt.isNull() ) { + return inputBinding; + } + + final Node value; + if ( nextElmt.isNode() ) { + value = nextElmt.asNode(); + } + else if ( nextElmt.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); + value = NodeFactory.createLiteral(lit); + } + else if ( nextElmt.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); + value = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, value); } } - protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + protected class QueryIterUnfoldWorkerForMaps extends QueryIterUnfoldWorkerBase> { + + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + super(inputBinding, itMapElmts); + } - public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterator> itMapElmts) { + public QueryIterUnfoldWorkerForMaps(Binding inputBinding, Iterable> itMapElmts) { super(inputBinding, itMapElmts); } @@ -290,11 +178,39 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { - final Map.Entry elmt = itElmts.next(); - if ( var2 == null ) - return BindingFactory.binding( inputBinding, var1, elmt.getKey() ); - else - return BindingFactory.binding( inputBinding, var1, elmt.getKey(), var2, elmt.getValue() ); + final Map.Entry elmt = itElmts.next(); + final CDTKey key = elmt.getKey(); + final CDTValue value = elmt.getValue(); + + final Node keyNode; + if ( key.isNode() ) { + keyNode = key.asNode(); + } + else { + throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); + } + + if ( value.isNull() ) { + return BindingFactory.binding( inputBinding, var1, keyNode ); + } + + final Node valueNode; + if ( value.isNode() ) { + valueNode = value.asNode(); + } + else if ( value.isList() ) { + final LiteralLabel lit = new LiteralLabelForList( value.asList() ); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( value.isMap() ) { + final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); + valueNode = NodeFactory.createLiteral(lit); + } + else { + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 337d034c01f..93f9a3fb87e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -1,26 +1,25 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.riot.system.PrefixMap; -import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; -import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; @@ -28,114 +27,43 @@ public class AggFold extends AggregatorBase { - protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); - - protected final Expr expr1; // While the values of these member variables - protected final Expr expr2; // can also be extracted from the ExprList (see - protected final Node typeIRI1; // createExprList below), keeping these copies - protected final Node typeIRI2; // here makes it easier to access these values. + protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see + protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. public AggFold( final Expr expr1 ) { - this(expr1, null, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1 ) { - this(expr1, typeIRI1, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { - this(expr1, typeIRI1, expr2, null); + this(expr1, null); } public AggFold( final Expr expr1, final Expr expr2 ) { - this(expr1, null, expr2, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { - super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; - this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } - protected static ExprList createExprList( final Expr expr1, final String typeIRI1, - final Expr expr2, final String typeIRI2 ) { + protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { final ExprList l = new ExprList(expr1); - if ( typeIRI1 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI1) ); - } - if ( expr2 != null ) { l.add(expr2); } - if ( typeIRI2 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI2) ); - } - return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 6 ) + if ( exprs.size() < 1 || exprs.size() > 2 ) throw new IllegalArgumentException(); final Iterator it = exprs.iterator(); final Expr _expr1 = it.next(); - final Expr _expr2; - final String _typeIRI1; - final String _typeIRI2; - Expr lookAhead = it.hasNext() ? it.next() : null; - // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI1 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI1 = null; - } - // _expr2 - if ( lookAhead != null ) { - _expr2 = lookAhead; - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _expr2 = null; - } + final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI2 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI2 = null; - } - - if ( lookAhead != null ) { - throw new IllegalArgumentException(); - } - - return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + return new AggFold(_expr1, _expr2); } @Override @@ -172,29 +100,17 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { - final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); - final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI1, pmap) ); - } - if ( expr2 != null ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI2, pmap) ); - } - out.append(")"); return out.asString(); } @@ -208,161 +124,71 @@ public String toPrefixString() { WriterExpr.output(out, expr1, null); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( typeIRI1.toString() ); - } - if ( expr2 != null ) { out.append(", "); WriterExpr.output(out, expr2, null); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( typeIRI2.toString() ); - } - out.decIndent(); out.append(")"); return out.asString(); } protected class ListAccumulator implements Accumulator { - final protected List list = new ArrayList<>(); + final protected List list = new ArrayList<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v; final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) { - final Node n = nv.asNode(); - if ( typeIRI1 != null ) { // check the type of the node - final String nTypeIRI; - if ( n.isLiteral() ) - nTypeIRI = n.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the node if it is not of the expected type - } - list.add(n); + if ( nv == null ) { + v = CDTFactory.getNullValue(); + } + else { + v = CDTFactory.createValue( nv.asNode() ); } + + list.add(v); } @Override public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); - } - } - sb.append("]"); - - final RDFDatatype datatype; - if ( typeIRI1 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = Node_LiteralWithList.datatypeTypedList; - } - else { - datatype = Node_LiteralWithList.datatypeUntypedList; - } - - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + final LiteralLabelForList lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } protected class MapAccumulator implements Accumulator { - final protected List keys = new ArrayList<>(); - final protected List values = new ArrayList<>(); + final protected Map map = new HashMap<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( nvKey != null && nvValue != null ) { - final Node key = nvKey.asNode(); - final Node value = nvValue.asNode(); - - if ( typeIRI1 != null ) { // check the type of the key - final String nTypeIRI; - if ( key.isLiteral() ) - nTypeIRI = key.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the key is not of the expected type - } - - if ( typeIRI2 != null ) { // check the type of the value - final String nTypeIRI; - if ( value.isLiteral() ) - nTypeIRI = value.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI2.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the value is not of the expected type - } - - keys.add(key); - values.add(value); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nvKey == null ) { + return; // ignore if creating the key using the given binding failed } - } - @Override - public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("{"); - if ( ! keys.isEmpty() ) { - final Iterator it = keys.iterator(); - final Iterator it2 = values.iterator(); - final Node firstKey = it.next(); - final Node firstValue = it2.next(); - final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); - final String firstValueAsString = NodeFmtLib.strTTL(firstValue); - sb.append(firstKeyAsString); - sb.append(" : "); - sb.append(firstValueAsString); - while ( it.hasNext() ) { - final Node nextKey = it.next(); - final Node nextValue = it2.next(); - final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); - final String nextValueAsString = NodeFmtLib.strTTL(nextValue); - sb.append(", "); - sb.append(nextKeyAsString); - sb.append(" : "); - sb.append(nextValueAsString); - } - } - sb.append("}"); - - final RDFDatatype datatype; - if ( typeIRI1 != null || typeIRI2 != null ) { - sb.append("^^"); - if ( typeIRI1 != null ) { - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - } - if ( typeIRI2 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI2) ); - } - datatype = Node_LiteralWithMap.datatypeTypedMap; + final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); + + // TODO: what do we do if the map already contains an entry with the same key? + + final CDTValue value; + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvValue == null ) { + value = CDTFactory.getNullValue(); } else { - datatype = Node_LiteralWithMap.datatypeUntypedMap; + value = CDTFactory.createValue( nvValue.asNode() ); } - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + map.put(key, value); + } + + @Override + public NodeValue getValue() { + final LiteralLabelForMap lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index a7a81aa8729..d11f16dfde9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -71,8 +71,8 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, String typeIRI1, Expr expr2, String typeIRI2) { - return new AggFold(expr1, typeIRI1, expr2, typeIRI2) ; + public static Aggregator createFold(Expr expr1, Expr expr2) { + return new AggFold(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index b9d1b3a6c79..c950980ac3c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,14 +1,15 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; -import java.util.NoSuchElementException; +import java.util.ArrayList; +import java.util.List; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -17,71 +18,40 @@ public class ConcatFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final String list1AsString = getInputListAsString(v1); - final String list2AsString = getInputListAsString(v2); -System.out.println("list1AsString " + list1AsString); -System.out.println("list2AsString " + list2AsString); - return createResultList(list1AsString, list2AsString); - } - - protected String getInputListAsString( final NodeValue v ) { - final Node n = v.asNode(); - - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + v); - - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - throw new ExprEvalException("Literal with wrong datatype: " + v); - } - - return n.getLiteralLexicalForm(); - } + final List list1 = getInputList(v1); + final List list2 = getInputList(v2); - protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { - final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; + final List result = new ArrayList<>(); + result.addAll(list1); + result.addAll(list2); -System.out.println("resultListAsString " + resultListAsString); - final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } - protected String createResultListAsString( final String list1AsString, final String list2AsString ) { - final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); - final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); - final Iterator it = new ConcatenatingIterator(it1, it2); + protected List getInputList( final NodeValue nv ) { + final Node n = nv.asNode(); - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( it.hasNext() ) { - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + return CompositeDatatypeList.parseList(lex); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); } } - sb.append("]"); - - return sb.toString(); - } - - protected static class ConcatenatingIterator implements Iterator { - protected final Iterator it1; - protected final Iterator it2; - public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } - @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } - @Override public T next() { - if ( it1.hasNext() ) - return it1.next(); - else if ( it2.hasNext() ) - return it2.next(); - else - throw new NoSuchElementException(); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 982d6b8e5a6..b4f76e2565f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -1,11 +1,12 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; - +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -19,54 +20,33 @@ public NodeValue exec( final NodeValue nv ) { if ( ! n.isLiteral() ) throw new ExprEvalException("Not a literal: " + nv); - final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { - size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { - size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { - size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + size = ( (LiteralLabelForList) lit ).getValue().size(); + } + else if ( lit instanceof LiteralLabelForMap ) { + size = ( (LiteralLabelForMap) lit ).getValue().size(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeList.parseList(lex).size(); + } + else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeMap.parseMap(lex).size(); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } return NodeValue.makeInteger(size); } - protected int determineSizeOfUntypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfUntypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineNumberOfElements( final Iterator it ) { - int i = 0; - while ( it.hasNext() ) { - i++; - it.next(); - } - return i; - } - } diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java deleted file mode 100644 index 37cb8ca1f3e..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithList extends Node_Literal -{ - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - - public Node_LiteralWithList( final LiteralLabel label ) { - super(label); - } - - -} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java deleted file mode 100644 index 27d5bef8656..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithMap extends Node_Literal -{ - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - public Node_LiteralWithMap( final LiteralLabel label ) { - super(label); - } - -} From 6d13fb515e53ead44464a9168eea9a3bb6e75e06 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 11:14:29 +0100 Subject: [PATCH 189/323] updating the URI prefix 'cdt:' --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- .../src/main/java/org/apache/jena/sparql/ARQConstants.java | 3 +++ .../library/collection/CollectionLiteralFunctions.java | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 9c43f8978c9..8c1ac8b74de 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -27,7 +27,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"; + public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 4c71bd18569..a148cc166e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -9,7 +9,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase { - public final static String uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#Map"; + public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index 8f6ac06a24c..4428b80c65d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -80,6 +80,9 @@ public class ARQConstants /** URI scheme that triggers the loader to load a java class */ public static final String javaClassURIScheme = "java:" ; + /** The ARQ function library URI space */ + public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 5beaeec3aa8..fe5f8956bf8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,7 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } } From 5c96408b2caef6546f5efb357415cecf41616b7c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 13:09:21 +0100 Subject: [PATCH 190/323] adds the constructor function cdt:List --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/ListFct.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index fe5f8956bf8..98a1e89e37c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,6 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java new file mode 100644 index 00000000000..420ab788576 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -0,0 +1,37 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class ListFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + // nothing to do here + } + + @Override + public NodeValue exec( final List args ) { + final List list = new ArrayList<>( args.size() ); + + for ( final NodeValue nv : args ) { + final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 142c78eca05bbb18d27435d37b1f9b1d138389b3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 16:16:18 +0100 Subject: [PATCH 191/323] adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL --- .../apache/jena/sparql/expr/NodeValue.java | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 8296676f73e..e87b8f3b727 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -32,6 +32,8 @@ import org.apache.jena.atlas.lib.DateTimeUtils ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.cdt.CompositeDatatypeList ; +import org.apache.jena.cdt.CompositeDatatypeMap ; import org.apache.jena.datatypes.DatatypeFormatException ; import org.apache.jena.datatypes.RDFDatatype ; import org.apache.jena.datatypes.TypeMapper ; @@ -429,8 +431,128 @@ public boolean isTripleTerm() { return node.isNodeTriple() ; } +<<<<<<< HEAD public ValueSpace getValueSpace() { return classifyValueSpace(this); +======= + // ---------------------------------------------------------------- + // ---- sameValueAs + + // Disjoint value spaces : dateTime and dates are not comparable + // Every langtag implies another value space as well. + + /** Return true if the two NodeValues are known to be the same value + * return false if known to be different values, + * throw ExprEvalException otherwise + */ + public static boolean sameAs(NodeValue nv1, NodeValue nv2) + { + if ( nv1 == null || nv2 == null ) + throw new ARQInternalErrorException("Attempt to sameValueAs on a null") ; + + ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; + + // Special case - date/dateTime comparison is affected by timezones and may be + // indeterminate based on the value of the dateTime/date. + + switch (compType) + { + case VSPACE_NUM: + return XSDFuncOp.compareNumeric(nv1, nv2) == Expr.CMP_EQUAL ; + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_DAY : + { + int x = XSDFuncOp.compareDateTime(nv1, nv2) ; + if ( x == Expr.CMP_INDETERMINATE ) + throw new ExprNotComparableException("Indeterminate dateTime comparison") ; + return x == Expr.CMP_EQUAL ; + } + case VSPACE_DURATION: + { + int x = XSDFuncOp.compareDuration(nv1, nv2) ; + if ( x == Expr.CMP_INDETERMINATE ) + throw new ExprNotComparableException("Indeterminate duration comparison") ; + return x == Expr.CMP_EQUAL ; + } + + case VSPACE_STRING: return XSDFuncOp.compareString(nv1, nv2) == Expr.CMP_EQUAL ; + case VSPACE_BOOLEAN: return XSDFuncOp.compareBoolean(nv1, nv2) == Expr.CMP_EQUAL ; + + case VSPACE_TRIPLE_TERM: { + Triple t1 = nv1.getNode().getTriple(); + Triple t2 = nv2.getNode().getTriple(); + return nSameAs(t1.getSubject(), t2.getSubject()) + && nSameAs(t1.getPredicate(), t2.getPredicate()) + && nSameAs(t1.getObject(), t2.getObject()); + } + + case VSPACE_LANG: + case VSPACE_NODE: + // Two non-literals + return NodeFunctions.sameTerm(nv1.getNode(), nv2.getNode()) ; + + case VSPACE_UNKNOWN: + { + // One or two unknown value spaces, or one has a lang tag (but not both). + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + + if ( ! SystemARQ.ValueExtensions ) + // No value extensions => raw rdfTermEquals + return NodeFunctions.rdfTermEquals(node1, node2) ; + + // Some "value spaces" are know to be not equal (no overlap). + // Like one literal with a language tag, and one without can't be sameAs. + + if ( ! node1.isLiteral() || ! node2.isLiteral() ) + // Can't both be non-literals - that's VSPACE_NODE + // One or other not a literal => not sameAs + return false ; + + // Two literals at this point. + + if ( NodeFunctions.sameTerm(node1, node2) ) + return true ; + + if ( ! node1.getLiteralLanguage().equals("") || + ! node2.getLiteralLanguage().equals("") ) + // One had lang tag but weren't sameNode => not equals + return false ; + + raise(new ExprEvalException("Unknown equality test: "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("raise returned (sameValueAs)") ; + } + case VSPACE_SORTKEY: + return nv1.getSortKey().compareTo(nv2.getSortKey()) == 0 ; + + case VSPACE_DIFFERENT: + // Known to be incompatible. + if ( ! SystemARQ.ValueExtensions && ( nv1.isLiteral() && nv2.isLiteral() ) ) + raise(new ExprEvalException("Incompatible: "+nv1+" and "+nv2)) ; + return false ; + + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeList.type.isEqual(lit1, lit2) ; + } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; + } + } + + throw new ARQInternalErrorException("sameValueAs failure "+nv1+" and "+nv2) ; +>>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { @@ -478,6 +600,7 @@ public static boolean notSameValueAs(NodeValue nv1, NodeValue nv2) { return NodeValueCmp.notSameValueAs(nv1, nv2); } +<<<<<<< HEAD // ---------------------------------------------------------------- // compare @@ -507,6 +630,17 @@ public static int compare(NodeValue nv1, NodeValue nv2) { public static int compareAlways(NodeValue nv1, NodeValue nv2) { //return NodeValueCompare.compareAlways(nv1, nv2); return NodeValueCmp.compareAlways(nv1, nv2); +======= + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; + if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; + } + + if ( NodeUtils.hasLang(nv.asNode()) ) + return VSPACE_LANG ; + return VSPACE_UNKNOWN ; +>>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } // ---------------------------------------------------------------- From b74f4624ef8f681416ff9ef57b5d23520c1ee770 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 21:19:37 +0100 Subject: [PATCH 192/323] correct recursive implementation of 'equals' in 'CDTValue' --- .../main/java/org/apache/jena/cdt/CDTKey.java | 8 +- .../java/org/apache/jena/cdt/CDTValue.java | 83 ++++++++++++++++--- .../jena/cdt/CompositeDatatypeList.java | 25 +++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 20 +++++ 4 files changed, 120 insertions(+), 16 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 32c455d1810..53f4246c1a1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -42,12 +42,12 @@ public Node asNode() { @Override public boolean equals( final Object other ) { - if ( !(other instanceof CDTKey) ) { - return false; + if ( other instanceof CDTKey ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().equals( otherKey.asNode() ); } - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + return false; } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index e0bd1443def..5d2dcd70394 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -21,6 +21,9 @@ import java.util.List; import java.util.Map; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; + public abstract class CDTValue extends CDTKey { /** @@ -64,6 +67,10 @@ public Map asMap() { @Override public final boolean equals( final Object other ) { + if ( isNull() ) { + return false; + } + if ( !(other instanceof CDTValue) ) { if ( other instanceof CDTKey && isNode() ) { final CDTKey otherKey = (CDTKey) other; @@ -74,27 +81,81 @@ public final boolean equals( final Object other ) { } } - if ( isNull() ) { + final CDTValue otherValue = (CDTValue) other; + + if ( otherValue.isNull() ) return false; + + if ( isNode() ) return isEqual( asNode(), otherValue ); + + if ( isList() ) return isEqual( asList(), otherValue ); + + if ( isMap() ) return isEqual( asMap(), otherValue ); + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + + public static boolean isEqual( final Node n1, final CDTValue v2 ) { + if ( CompositeDatatypeList.isListLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isList() ) { + return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); + } + return false; } - final CDTValue otherValue = (CDTValue) other; + if ( CompositeDatatypeMap.isMapLiteral(n1) ) { + final LiteralLabel lit1 = n1.getLiteral(); + + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.type.isEqual(lit1, lit2); + } + + if ( v2.isMap() ) { + return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + } - if ( otherValue.isNull() ) { return false; } - if ( isNode() && otherValue.isNode() ) { - return asNode().equals( otherValue.asNode() ); + if ( v2.isNode() ) { + return v2.asNode().equals(n1); } - else if ( isList() && otherValue.isList() ) { - return asList().equals( otherValue.asList() ); + + return false; + } + + public static boolean isEqual( final List list1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeList.getValue(lit2).equals(list1); } - else if ( isMap() && otherValue.isMap() ) { - return asMap().equals( otherValue.asMap() ); + + if ( v2.isList() ) { + return v2.asList().equals(list1); } - else { - return false; + + return false; + } + + public static boolean isEqual( final Map map1, final CDTValue v2 ) { + if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { + final LiteralLabel lit2 = v2.asNode().getLiteral(); + return CompositeDatatypeMap.getValue(lit2).equals(map1); } + + if ( v2.isMap() ) { + return v2.asMap().equals(map1); + } + + return false; } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 8c1ac8b74de..15ff18434f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -150,11 +151,33 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - +System.out.println("list1"); +System.out.println(list1); +System.out.println("list2"); +System.out.println(list2); return list1.equals(list2); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index a148cc166e2..784cf6bfaf4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -4,6 +4,7 @@ import java.util.Map; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.out.NodeFmtLib; @@ -144,6 +145,25 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Map map1 = getValue(value1); From b76ffb586918e630aaf0a9ee9b04dde3efafe45c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 09:46:50 +0100 Subject: [PATCH 193/323] adds the cdt:contains function --- .../main/java/org/apache/jena/cdt/CDTKey.java | 6 +- .../java/org/apache/jena/cdt/CDTValue.java | 5 +- .../apache/jena/cdt/ParserForCDTLiterals.java | 33 ++--- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsFct.java | 130 ++++++++++++++++++ 5 files changed, 155 insertions(+), 20 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 53f4246c1a1..d42794c877b 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -44,7 +45,10 @@ public Node asNode() { public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); + + final NodeValue thisNV = NodeValue.makeNode( asNode() ); + final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); + return NodeValue.sameAs(thisNV, otherNV); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5d2dcd70394..5dd74a0bce6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -23,6 +23,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTValue extends CDTKey { @@ -126,7 +127,9 @@ public static boolean isEqual( final Node n1, final CDTValue v2 ) { } if ( v2.isNode() ) { - return v2.asNode().equals(n1); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + return NodeValue.sameAs(nv1, nv2); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 844bca2ed49..645cfa15a38 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -27,6 +27,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; +import org.apache.jena.graph.Node; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -73,16 +74,14 @@ public static List parseListLiteral( final Reader reader, final boolea if ( recursive && ! list.isEmpty() ) { for ( int i = 0; i < list.size(); i++ ) { final CDTValue v = list.get(i); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -133,18 +132,16 @@ public static Map parseMapLiteral( final Reader reader, final b if ( recursive && ! map.isEmpty() ) { for ( final CDTKey key : map.keySet() ) { final CDTValue v = map.get(key); - if ( v.isNode() && v.asNode().isLiteral() ) { - final String lex = v.asNode().getLiteralLexicalForm(); - final String dtURI = v.asNode().getLiteralDatatypeURI(); - - if ( dtURI.equals(CompositeDatatypeMap.uri) ) { - final Map subMap = parseMapLiteral(lex, recursive); - map.put( key, CDTFactory.createValue(subMap) ); - } - else if ( dtURI.equals(CompositeDatatypeList.uri) ) { - final List subList = parseListLiteral(lex, recursive); + if ( v.isNode() ) { + final Node vn = v.asNode(); + if ( CompositeDatatypeList.isListLiteral(vn) ) { + final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } + else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + map.put( key, CDTFactory.createValue(subMap) ); + } } } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 98a1e89e37c..afa7c7e2f77 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -8,5 +8,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java new file mode 100644 index 00000000000..a940b91bf33 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -0,0 +1,130 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + final Node n2 = nv2.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + final boolean result; + if ( CompositeDatatypeList.isListLiteral(n2) ) { + result = containsList( list, n2.getLiteral() ); + } + else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { + result = containsMap( list, n2.getLiteral() ); + } + else { + result = containsNode( list, nv2 ); + } + + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term, assuming + * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + */ + protected boolean containsNode( final List list, final NodeValue n ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + final NodeValue vv = NodeValue.makeNode( v.asNode() ); + if ( NodeValue.sameAs(vv,n) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the list represented by + * the given cdt:List literal (i.e., assumes that the given literal + * is a cdt:List literal). + */ + protected boolean containsList( final List list, final LiteralLabel lit ) { + // get the list for the literal only if needed + List otherList = null; + + for ( final CDTValue v : list ) { + final List vList; + if ( v.isList() ) { + vList = v.asList(); + } + else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { + vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); + } + else { + vList = null; + } + + if ( vList != null ) { + // now we need to get the list + if ( otherList == null ) { + otherList = CompositeDatatypeList.getValue(lit); + } + + if ( vList.equals(otherList) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the map represented by + * the given cdt:Map literal (i.e., assumes that the given literal + * is a cdt:Map literal). + */ + protected boolean containsMap( final List list, final LiteralLabel lit) { + // get the map for the literal only if needed + Map otherMap = null; + + for ( final CDTValue v : list ) { + final Map vMap; + if ( v.isMap() ) { + vMap = v.asMap(); + } + else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { + vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); + } + else { + vMap = null; + } + + if ( vMap != null ) { + // now we need to get the map + if ( otherMap == null ) { + otherMap = CompositeDatatypeMap.getValue(lit); + } + + if ( vMap.equals(otherMap) ) { + return true; + } + } + } + + return false; + } +} From 9ad3617f534cd87af73c7f7af21a3f629c7ecec7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:03:55 +0100 Subject: [PATCH 194/323] remove debug printing --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15ff18434f2..3a9b0b9cad8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -174,10 +174,6 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); -System.out.println("list1"); -System.out.println(list1); -System.out.println("list2"); -System.out.println(list2); return list1.equals(list2); } From 5ba0f2ae0ccc1a5ba50317111aed884d9e808239 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:05:01 +0100 Subject: [PATCH 195/323] adds CDTLiteralParserBase to create special Node objects for cdt:List literals and cdt:Map literals --- jena-arq/Grammar/cdt_literals.jj | 3 +-- .../apache/jena/cdt/CDTLiteralParserBase.java | 25 +++++++++++++++++++ .../jena/cdt/parser/CDTLiteralParser.java | 3 +-- .../parser/CDTLiteralParserTokenManager.java | 1 - 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index eac97b2827e..5ee872ef62e 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -57,9 +57,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase +public class CDTLiteralParser extends CDTLiteralParserBase { } PARSER_END(CDTLiteralParser) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java new file mode 100644 index 00000000000..737aaf509eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -0,0 +1,25 @@ +package org.apache.jena.cdt; + +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParserBase extends TurtleParserBase +{ + @Override + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final LiteralLabel lit = new LiteralLabelForList(lex); + return NodeFactory.createLiteral(lit); + } + + if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final LiteralLabel lit = new LiteralLabelForMap(lex); + return NodeFactory.createLiteral(lit); + } + + return super.createLiteral(lex, langTag, datatypeURI); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index a41a068d605..832cc84b276 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -26,9 +26,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase implements CDTLiteralParserConstants { +public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point final public void parse() throws ParseException { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index c7c080e9454..bcf9c3cb8e2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From 18d922c90030b8e450a15bbdefee1302921fac7d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:12:07 +0100 Subject: [PATCH 196/323] bug fix: avoid NPE --- .../main/java/org/apache/jena/cdt/CDTLiteralParserBase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 737aaf509eb..e42b9c339d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -9,12 +9,12 @@ public class CDTLiteralParserBase extends TurtleParserBase { @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); } - if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForMap(lex); return NodeFactory.createLiteral(lit); } From b8677d4b5ed4cb1472042eeaadd5901e91097792 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 19 Nov 2022 16:32:34 +0100 Subject: [PATCH 197/323] bug fix in the CDT grammar (it was possible to have lists that begin with a comma) --- jena-arq/Grammar/cdt_literals.jj | 33 ++++--- jena-arq/Grammar/grammarCDTs | 10 ++- .../jena/cdt/parser/CDTLiteralParser.java | 86 +++++++++---------- 3 files changed, 67 insertions(+), 62 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 5ee872ef62e..514be16467b 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -63,28 +63,26 @@ public class CDTLiteralParser extends CDTLiteralParserBase } PARSER_END(CDTLiteralParser) -// --- Entry point - -void parse() : {} -{ - ( List() | Map() ) -} +// --- Entry point for cdt:List literals List List() : { List l = new ArrayList(); } { - ( ListElement(l) )? - - ( ListElement(l) )* - - // should we permit a trailing comma? + ( NonEmptyListContent(l) )? { return l; } } +void NonEmptyListContent(List l) : { } +{ + ListElement(l) + + ( ListElement(l) )* +} + void ListElement(List l) : { String iri; Node n; List subList; Map m; } { iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } @@ -104,19 +102,26 @@ void ListElement(List l) : { String iri; Node n; List subLis m = Map() { l.add( CDTFactory.createValue(m) ); } } +// --- Entry point for cdt:Map literals + Map Map() : { Map m = new HashMap(); } { - ( MapEntry(m) )? - - ( MapEntry(m) )* + ( NonEmptyMapContent(m) )? { return m; } } +void NonEmptyMapContent(Map m) : { } +{ + MapEntry(m) + + ( MapEntry(m) )* +} + void MapEntry(Map m) : { CDTKey key; CDTValue value; } { key = MapKey() diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs index fb95f355e44..8bbaf8685d4 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/grammarCDTs @@ -30,8 +30,8 @@ javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" RC=$? [ "$RC" = 0 ] || return -## echo "---- Create text form ----" -## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" +echo "---- Create text form ----" +jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" echo "---- Fixing Java warnings in TokenMgrError" F="$DIR/TokenMgrError.java" @@ -56,4 +56,10 @@ sed -e 's/@SuppressWarnings("serial")//' \ < $F > F mv F $F +echo "---- Create HTML form ----" +./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html +./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html + +echo "Check X and Y for IRI_REF because \" became '" + echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 832cc84b276..8f0b6cb9404 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -29,22 +29,7 @@ public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { -// --- Entry point - final public void parse() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACKET: - List(); - break; - case LBRACE: - Map(); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - +// --- Entry point for cdt:List literals final public List List() throws ParseException { List l = new ArrayList(); jj_consume_token(LBRACKET); @@ -63,12 +48,19 @@ final public List List() throws ParseException { case NULL: case LBRACE: case LBRACKET: - ListElement(l); + NonEmptyListContent(l); break; default: - jj_la1[1] = jj_gen; + jj_la1[0] = jj_gen; ; } + jj_consume_token(RBRACKET); + {if (true) return l;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyListContent(List l) throws ParseException { + ListElement(l); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -76,15 +68,12 @@ final public List List() throws ParseException { ; break; default: - jj_la1[2] = jj_gen; + jj_la1[1] = jj_gen; break label_1; } jj_consume_token(COMMA); ListElement(l); } - jj_consume_token(RBRACKET); - {if (true) return l;} - throw new Error("Missing return statement in function"); } final public void ListElement(List l) throws ParseException { @@ -129,12 +118,13 @@ final public void ListElement(List l) throws ParseException { l.add( CDTFactory.createValue(m) ); break; default: - jj_la1[3] = jj_gen; + jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } +// --- Entry point for cdt:Map literals final public Map Map() throws ParseException { Map m = new HashMap(); jj_consume_token(LBRACE); @@ -150,12 +140,19 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG2: case IRIref: case BLANK_NODE_LABEL: - MapEntry(m); + NonEmptyMapContent(m); break; default: - jj_la1[4] = jj_gen; + jj_la1[3] = jj_gen; ; } + jj_consume_token(RBRACE); + {if (true) return m;} + throw new Error("Missing return statement in function"); + } + + final public void NonEmptyMapContent(Map m) throws ParseException { + MapEntry(m); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -163,15 +160,12 @@ final public Map Map() throws ParseException { ; break; default: - jj_la1[5] = jj_gen; + jj_la1[4] = jj_gen; break label_2; } jj_consume_token(COMMA); MapEntry(m); } - jj_consume_token(RBRACE); - {if (true) return m;} - throw new Error("Missing return statement in function"); } final public void MapEntry(Map m) throws ParseException { @@ -213,7 +207,7 @@ final public CDTKey MapKey() throws ParseException { {if (true) return CDTFactory.createKey(n);} break; default: - jj_la1[6] = jj_gen; + jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -262,7 +256,7 @@ final public CDTValue MapValue() throws ParseException { {if (true) return CDTFactory.createValue(m);} break; default: - jj_la1[7] = jj_gen; + jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -300,7 +294,7 @@ final public Node NumericLiteral() throws ParseException { {if (true) return createLiteralDouble(t.image);} break; default: - jj_la1[8] = jj_gen; + jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -318,7 +312,7 @@ final public Node BooleanLiteral() throws ParseException { {if (true) return XSD_FALSE;} break; default: - jj_la1[9] = jj_gen; + jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -341,13 +335,13 @@ final public Node RDFLiteral() throws ParseException { dt = IRI_REF(); break; default: - jj_la1[10] = jj_gen; + jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[11] = jj_gen; + jj_la1[10] = jj_gen; ; } {if (true) return createLiteral(lex, lang, dt);} @@ -381,7 +375,7 @@ final public String String() throws ParseException { lex = stripQuotes3(t.image) ; break; default: - jj_la1[12] = jj_gen; + jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -399,7 +393,7 @@ final public String String() throws ParseException { public Token jj_nt; private int jj_ntk; private int jj_gen; - final private int[] jj_la1 = new int[13]; + final private int[] jj_la1 = new int[12]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { @@ -407,10 +401,10 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x28000000,0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; } /** Constructor with InputStream. */ @@ -424,7 +418,7 @@ public CDTLiteralParser(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -438,7 +432,7 @@ public void ReInit(java.io.InputStream stream, String encoding) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor. */ @@ -448,7 +442,7 @@ public CDTLiteralParser(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -458,7 +452,7 @@ public void ReInit(java.io.Reader stream) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ @@ -467,7 +461,7 @@ public CDTLiteralParser(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } /** Reinitialise. */ @@ -476,7 +470,7 @@ public void ReInit(CDTLiteralParserTokenManager tm) { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 13; i++) jj_la1[i] = -1; + for (int i = 0; i < 12; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { @@ -532,7 +526,7 @@ public ParseException generateParseException() { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 13; i++) { + for (int i = 0; i < 12; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< Date: Sun, 20 Nov 2022 20:56:26 +0100 Subject: [PATCH 198/323] changes CDTValue such that it can be only null or an RDF term --- .../java/org/apache/jena/cdt/CDTFactory.java | 16 +- .../main/java/org/apache/jena/cdt/CDTKey.java | 10 ++ .../java/org/apache/jena/cdt/CDTValue.java | 138 ++++-------------- .../jena/cdt/CompositeDatatypeList.java | 14 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 21 +-- .../apache/jena/cdt/ParserForCDTLiterals.java | 8 +- .../engine/iterator/QueryIterUnfold.java | 67 +++++---- .../library/collection/ConcatFct.java | 25 ++-- .../library/collection/ContainsFct.java | 96 +----------- .../function/library/collection/SizeFct.java | 19 +-- 10 files changed, 115 insertions(+), 299 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index 1c96d41b629..dddd36a52d0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -22,6 +22,8 @@ import java.util.Map; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; public class CDTFactory { @@ -40,17 +42,15 @@ public static CDTValue createValue( final Node n ) { } public static CDTValue createValue( final List l ) { - return new CDTValue() { - @Override public boolean isList() { return true; } - @Override public List asList() { return l; } - }; + final LiteralLabel lit = new LiteralLabelForList(l); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue createValue( final Map m ) { - return new CDTValue() { - @Override public boolean isMap() { return true; } - @Override public Map asMap() { return m; } - }; + final LiteralLabel lit = new LiteralLabelForMap(m); + final Node n = NodeFactory.createLiteral(lit); + return createValue(n); } public static CDTValue getNullValue() { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index d42794c877b..1b2dd152155 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -19,6 +19,7 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; +import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey @@ -63,4 +64,13 @@ public String toString() { return super.toString(); } } + + /** + * Returns a string representation of this element + * to be included in the lexical form of literals. + */ + public String asLexicalForm() { + return NodeFmtLib.strTTL( asNode() ); + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 5dd74a0bce6..b252a7082f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -18,147 +18,67 @@ package org.apache.jena.cdt; -import java.util.List; -import java.util.Map; - import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.riot.out.NodeFmtLib; public abstract class CDTValue extends CDTKey { /** - * Returns true if this object is a list. In that case, {@link #asList()} - * can be used to get it as an actual {@link List} object. - */ - public boolean isList() { - return false; - } - - /** - * Returns true if this object is a map. In that case, {@link #asMap()} - * can be used to get it as an actual {@link Map} object. - */ - public boolean isMap() { - return false; - } - - /** - * Returns true if this is a null value. + * Returns true if this is a null value (in which + * case {@link #isNode()} must return false). */ public boolean isNull() { return false; } - /** - * Returns this object as a list, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public List asList() { - throw new UnsupportedOperationException( this + " is not a list" ); - } - - /** - * Returns this object as a map, assuming it is one. If it is not, - * then an {@link UnsupportedOperationException} is thrown. - */ - public Map asMap() { - throw new UnsupportedOperationException( this + " is not a map" ); - } - @Override public final boolean equals( final Object other ) { if ( isNull() ) { return false; } - if ( !(other instanceof CDTValue) ) { - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().equals( otherKey.asNode() ); - } - else { - return false; - } - } - - final CDTValue otherValue = (CDTValue) other; - - if ( otherValue.isNull() ) return false; - - if ( isNode() ) return isEqual( asNode(), otherValue ); - - if ( isList() ) return isEqual( asList(), otherValue ); - - if ( isMap() ) return isEqual( asMap(), otherValue ); - - throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); - } - - public static boolean isEqual( final Node n1, final CDTValue v2 ) { - if ( CompositeDatatypeList.isListLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); - - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); - } - - if ( v2.isList() ) { - return CompositeDatatypeList.getValue(lit1).equals( v2.asList() ); - } - - return false; - } - - if ( CompositeDatatypeMap.isMapLiteral(n1) ) { - final LiteralLabel lit1 = n1.getLiteral(); + if ( other instanceof CDTValue ) { + final CDTValue otherValue = (CDTValue) other; - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.type.isEqual(lit1, lit2); + if ( otherValue.isNull() ) { + return false; } - if ( v2.isMap() ) { - return CompositeDatatypeMap.getValue(lit1).equals( v2.asMap() ); + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( v2.isNode() ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); - return NodeValue.sameAs(nv1, nv2); + if ( other instanceof CDTKey && isNode() ) { + final CDTKey otherKey = (CDTKey) other; + return asNode().sameValueAs( otherKey.asNode() ); } return false; } - public static boolean isEqual( final List list1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeList.isListLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeList.getValue(lit2).equals(list1); - } - - if ( v2.isList() ) { - return v2.asList().equals(list1); - } - - return false; - } - - public static boolean isEqual( final Map map1, final CDTValue v2 ) { - if ( v2.isNode() && CompositeDatatypeMap.isMapLiteral(v2.asNode()) ) { - final LiteralLabel lit2 = v2.asNode().getLiteral(); - return CompositeDatatypeMap.getValue(lit2).equals(map1); + @Override + public String asLexicalForm() { + if ( isNull() ) { + return "null"; } - if ( v2.isMap() ) { - return v2.asMap().equals(map1); + if ( isNode() ) { + final Node n = asNode(); + if ( CompositeDatatypeList.isListLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + return n.getLiteralLexicalForm(); + } + else { + return NodeFmtLib.strTTL(n); + } } - return false; + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 3a9b0b9cad8..5a778f6c772 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,7 +24,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -70,16 +69,7 @@ public static String unparseList( final List list ) { } public static String unparseListElement( final CDTValue elmt ) { - if ( elmt.isNode() ) - return NodeFmtLib.strTTL( elmt.asNode() ); - else if ( elmt.isList() ) - return unparseList( elmt.asList() ); - else if ( elmt.isMap() ) - return CompositeDatatypeMap.unparseMap( elmt.asMap() ); - else if ( elmt.isNull() ) - return "null"; - else - throw new UnsupportedOperationException( "unexpected list element: " + elmt.getClass().getName() ); + return elmt.asLexicalForm(); } @Override @@ -177,7 +167,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return list1.equals(list2); } - public static List getValue( final LiteralLabel lit ) { + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 784cf6bfaf4..6dec66e9920 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,7 +6,6 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.riot.out.NodeFmtLib; public class CompositeDatatypeMap extends CompositeDatatypeBase { @@ -54,23 +53,9 @@ public static String unparseMap( final Map map ) { } public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { - if ( entry.getKey().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getKey().asNode() ) ); - else - throw new UnsupportedOperationException( "unexpected map key: " + entry.getKey().getClass().getName() ); - + sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); - - if ( entry.getValue().isNode() ) - sb.append( NodeFmtLib.strTTL( entry.getValue().asNode() ) ); - else if ( entry.getValue().isList() ) - sb.append( CompositeDatatypeList.unparseList( entry.getValue().asList() ) ); - else if ( entry.getValue().isMap() ) - sb.append( unparseMap( entry.getValue().asMap() ) ); - else if ( entry.getValue().isNull() ) - sb.append( "null" ); - else - throw new UnsupportedOperationException( "unexpected list element: " + entry.getValue().getClass().getName() ); + sb.append( entry.getValue().asLexicalForm() ); } @Override @@ -172,7 +157,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return map1.equals(map2); } - public static Map getValue( final LiteralLabel lit ) { + public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 645cfa15a38..4284f6f3c1d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -76,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea final CDTValue v = list.get(i); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } @@ -134,11 +134,11 @@ public static Map parseMapLiteral( final Reader reader, final b final CDTValue v = map.get(key); if ( v.isNode() ) { final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) ) { + if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } - else if ( CompositeDatatypeMap.isMapLiteral(vn) ) { + else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index d376b2ea921..90fa39330b6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,6 +19,7 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -140,23 +141,28 @@ protected Binding moveToNextBinding() { return inputBinding; } - final Node value; if ( nextElmt.isNode() ) { - value = nextElmt.asNode(); - } - else if ( nextElmt.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( nextElmt.asList() ); - value = NodeFactory.createLiteral(lit); - } - else if ( nextElmt.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( nextElmt.asMap() ); - value = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); + final Node n = nextElmt.asNode(); + + final Node value; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + value = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + value = NodeFactory.createLiteral(lit); + } + else { + value = n; + } + + return BindingFactory.binding(inputBinding, var1, value); } - return BindingFactory.binding(inputBinding, var1, value); + throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); } } @@ -194,23 +200,28 @@ protected Binding moveToNextBinding() { return BindingFactory.binding( inputBinding, var1, keyNode ); } - final Node valueNode; if ( value.isNode() ) { - valueNode = value.asNode(); - } - else if ( value.isList() ) { - final LiteralLabel lit = new LiteralLabelForList( value.asList() ); - valueNode = NodeFactory.createLiteral(lit); - } - else if ( value.isMap() ) { - final LiteralLabel lit = new LiteralLabelForMap( value.asMap() ); - valueNode = NodeFactory.createLiteral(lit); - } - else { - throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); + final Node n = value.asNode(); + + final Node valueNode; + if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { + final List l = CompositeDatatypeList.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForList(l); + valueNode = NodeFactory.createLiteral(lit); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { + final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); + final LiteralLabel lit = new LiteralLabelForMap(m); + valueNode = NodeFactory.createLiteral(lit); + } + else { + valueNode = n; + } + + return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } - return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); + throw new UnsupportedOperationException( "unexpected map value: " + value.getClass().getName() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index c950980ac3c..3b4a2dfa52e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -21,6 +21,14 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { final List list1 = getInputList(v1); final List list2 = getInputList(v2); + if ( list1.isEmpty() ) { + return v2; + } + + if ( list2.isEmpty() ) { + return v1; + } + final List result = new ArrayList<>(); result.addAll(list1); result.addAll(list2); @@ -33,22 +41,11 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { protected List getInputList( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + nv); try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - return CompositeDatatypeList.parseList(lex); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); - } + return CompositeDatatypeList.getValue( n.getLiteral() ); } catch ( final DatatypeFormatException ex ) { throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index a940b91bf33..b0a323e2e4c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -1,14 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; -import java.util.Map; -import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -18,72 +14,23 @@ public class ContainsFct extends FunctionBase2 @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - final Node n2 = nv2.asNode(); if ( ! CompositeDatatypeList.isListLiteral(n1) ) throw new ExprEvalException("Not a list literal: " + nv1); final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); - - final boolean result; - if ( CompositeDatatypeList.isListLiteral(n2) ) { - result = containsList( list, n2.getLiteral() ); - } - else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { - result = containsMap( list, n2.getLiteral() ); - } - else { - result = containsNode( list, nv2 ); - } - + final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } /** - * Returns true if the given list contains the given RDF term, assuming - * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + * Returns true if the given list contains the given RDF term. */ - protected boolean containsNode( final List list, final NodeValue n ) { + protected boolean containsNode( final List list, final NodeValue nv ) { for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv,n) ) { - return true; - } - } - } - - return false; - } - - /** - * Returns true if the given list contains the list represented by - * the given cdt:List literal (i.e., assumes that the given literal - * is a cdt:List literal). - */ - protected boolean containsList( final List list, final LiteralLabel lit ) { - // get the list for the literal only if needed - List otherList = null; - - for ( final CDTValue v : list ) { - final List vList; - if ( v.isList() ) { - vList = v.asList(); - } - else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { - vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); - } - else { - vList = null; - } - - if ( vList != null ) { - // now we need to get the list - if ( otherList == null ) { - otherList = CompositeDatatypeList.getValue(lit); - } - - if ( vList.equals(otherList) ) { + if ( NodeValue.sameAs(vv, nv) ) { return true; } } @@ -92,39 +39,4 @@ else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { return false; } - /** - * Returns true if the given list contains the map represented by - * the given cdt:Map literal (i.e., assumes that the given literal - * is a cdt:Map literal). - */ - protected boolean containsMap( final List list, final LiteralLabel lit) { - // get the map for the literal only if needed - Map otherMap = null; - - for ( final CDTValue v : list ) { - final Map vMap; - if ( v.isMap() ) { - vMap = v.asMap(); - } - else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { - vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); - } - else { - vMap = null; - } - - if ( vMap != null ) { - // now we need to get the map - if ( otherMap == null ) { - otherMap = CompositeDatatypeMap.getValue(lit); - } - - if ( vMap.equals(otherMap) ) { - return true; - } - } - } - - return false; - } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index b4f76e2565f..4121ba8db3b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,8 +2,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; @@ -24,22 +22,15 @@ public NodeValue exec( final NodeValue nv ) { try { final LiteralLabel lit = n.getLiteral(); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - size = ( (LiteralLabelForList) lit ).getValue().size(); - } - else if ( lit instanceof LiteralLabelForMap ) { - size = ( (LiteralLabelForMap) lit ).getValue().size(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeList.parseList(lex).size(); + + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + size = CompositeDatatypeList.getValue(lit).size(); } else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeMap.parseMap(lex).size(); + size = CompositeDatatypeMap.getValue(lit).size(); } else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); } } catch ( final DatatypeFormatException ex ) { From c1f25ff8a5bdd6b0875ff6fdfd6b91f0832a78cb Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 22:17:37 +0100 Subject: [PATCH 199/323] adds cdt:containsTerm function --- .../apache/jena/cdt/LiteralLabelForCDTs.java | 19 +++++++++ .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsTermFct.java | 42 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index c5215fccdc2..0f87a5ea33f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,5 +1,7 @@ package org.apache.jena.cdt; +import java.util.Objects; + import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.rdf.model.impl.Util; @@ -141,6 +143,23 @@ public boolean sameValueAs( final LiteralLabel other ) { return getValue().equals( other.getValue() ); } + @Override + public boolean equals( final Object other ) { + if ( this == other ) return true; + + if ( other == null || !(other instanceof LiteralLabel) ) return false; + + final LiteralLabel otherLiteral = (LiteralLabel) other; + + final String otherLang = otherLiteral.language(); + if ( otherLang != null && ! otherLang.isEmpty() ) return false; + + final String otherDTypeURI = otherLiteral.getDatatypeURI(); + if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; + + return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); + } + @Override public int getDefaultHashcode() { return hash; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index afa7c7e2f77..7796fef6e8d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -9,5 +9,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java new file mode 100644 index 00000000000..6951d89992e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsTermFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final boolean result = containsTerm( list, nv2 ); + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term. + */ + protected boolean containsTerm( final List list, final NodeValue nv ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + if ( NodeFunctions.sameTerm(v.asNode(), nv.asNode()) ) { + return true; + } + } + } + + return false; + } + +} From 11e84c5e78581cbb3a6ec4879ea4c6b67fca0b97 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 23:04:23 +0100 Subject: [PATCH 200/323] adds cdt:get function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/GetFct.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 7796fef6e8d..4f3959b7342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -10,5 +10,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java new file mode 100644 index 00000000000..41227a7bb10 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -0,0 +1,46 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class GetFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + if ( index > list.size() ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final CDTValue value = list.get( index-1 ); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From 51e61337f38dbac7bc5a6f2aabac41213d940340 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:27:38 +0100 Subject: [PATCH 201/323] adds cdt:head function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/HeadFct.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 4f3959b7342..9a521880665 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,5 +11,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java new file mode 100644 index 00000000000..5fcaf302c84 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -0,0 +1,38 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class HeadFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final CDTValue value = list.get(0); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From b0d097d293aa216a0234bb7c3df1688bd908c34e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:37 +0100 Subject: [PATCH 202/323] adds base class FunctionBase1List --- .../library/collection/FunctionBase1List.java | 27 +++++++++++++++++++ .../function/library/collection/HeadFct.java | 14 ++-------- 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java new file mode 100644 index 00000000000..0f49e6b61fd --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -0,0 +1,27 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public abstract class FunctionBase1List extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + return _exec(list); + } + + protected abstract NodeValue _exec( List list ); +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 5fcaf302c84..4deed24468e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -3,23 +3,13 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; -public class HeadFct extends FunctionBase1 +public class HeadFct extends FunctionBase1List { @Override - public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + protected NodeValue _exec( final List list ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From 3462466e62dcc351139319ee10706d6c732dc42e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:57 +0100 Subject: [PATCH 203/323] adds cdt:tail function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/TailFct.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 9a521880665..8f203ffe4ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -12,5 +12,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java new file mode 100644 index 00000000000..15abce441fa --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -0,0 +1,26 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class TailFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list ) { + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final List sublist = list.subList( 1, list.size() ); + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 04602243cd2277cbc08174ce7ce45e1dfbdd747f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:02:27 +0100 Subject: [PATCH 204/323] changes arguments of '_exec' in FunctionBase1List --- .../sparql/function/library/collection/FunctionBase1List.java | 4 ++-- .../jena/sparql/function/library/collection/HeadFct.java | 2 +- .../jena/sparql/function/library/collection/TailFct.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 0f49e6b61fd..99210c10f0d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -20,8 +20,8 @@ public NodeValue exec( final NodeValue nv ) { final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - return _exec(list); + return _exec(list, nv); } - protected abstract NodeValue _exec( List list ); + protected abstract NodeValue _exec( List list, NodeValue nvList ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 4deed24468e..aebd5f39611 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -9,7 +9,7 @@ public class HeadFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index 15abce441fa..a56581d3195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -13,7 +13,7 @@ public class TailFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From e462cb7802f3ef5c55c4a979bacf5026b5bcbb31 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:28:07 +0100 Subject: [PATCH 205/323] adds cdt:reverse function --- .../CollectionLiteralFunctions.java | 5 +-- .../library/collection/ReverseFct.java | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 8f203ffe4ba..31451f73fbb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,13 +5,14 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java new file mode 100644 index 00000000000..e2d2d3fd4ed --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -0,0 +1,33 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Arrays; +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; + +public class ReverseFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list, final NodeValue nvList ) { + if ( list.size() < 2 ) + return nvList; + + final CDTValue[] reverseArray = new CDTValue[ list.size() ]; + int i = list.size() - 1; + for ( final CDTValue v : list ) { + reverseArray[i] = v; + i--; + } + + final List reverseList = Arrays.asList(reverseArray); + final LiteralLabel lit = new LiteralLabelForList(reverseList); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From b47d601dcdcf80aa820f7e6b5e40a1fdc5dda88e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 11:33:32 +0100 Subject: [PATCH 206/323] adds cdt:subseq function --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/SubSeqFct.java | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 31451f73fbb..1e16821a71e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java new file mode 100644 index 00000000000..d5e8f7b736b --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -0,0 +1,90 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Collections; +import java.util.List; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class SubSeqFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 && args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec( final List args ) { + final NodeValue nv1 = args.get(0); + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final NodeValue nv2 = args.get(1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final int length; + final List list; + if ( args.size() == 3 ) { + final NodeValue nv3 = args.get(2); + + if ( ! nv3.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv3); + + length = nv3.getInteger().intValue(); + + if ( length < 0 ) + throw new ExprEvalException("Illegal length value: " + nv3); + + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + } + else { + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + length = list.size() - index + 1; + } + + if ( index > list.size() + 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + if ( index + length > list.size() + 1 ) + throw new ExprEvalException("Beyond list length (index: " + index + ", length: " + length + ")"); + + final List sublist; + if ( index == list.size() + 1 ) { + if ( length != 0 ) + throw new ExprEvalException("Illegal arguments (index: " + index + ", length: " + length + ")"); + + if ( list.isEmpty() ) + return nv1; + + sublist = Collections.emptyList(); + } + else { + sublist = list.subList( index - 1, index - 1 + length ); + } + + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 8d1650abe5109d808739c1ceccaa8657aea1fc10 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 22:10:18 +0100 Subject: [PATCH 207/323] bugfix in 'isEqual' of CompositeDatatypeList (needs to throw ExprEvalException if null values are there) --- .../java/org/apache/jena/cdt/CDTValue.java | 32 +++++++++++++++++-- .../jena/cdt/CompositeDatatypeList.java | 16 +++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index b252a7082f8..9ac6500d668 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -20,6 +20,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.expr.ExprEvalException; public abstract class CDTValue extends CDTKey { @@ -32,16 +33,25 @@ public boolean isNull() { } @Override - public final boolean equals( final Object other ) { - if ( isNull() ) { + public boolean equals( final Object other ) { + try { + return sameAs(other); + } + catch ( final ExprEvalException ex ) { return false; } + } + + public boolean sameAs( final Object other ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - return false; + throw new ExprEvalException(); } if ( isNode() ) { @@ -59,6 +69,22 @@ public final boolean equals( final Object other ) { return false; } + public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } + + if ( otherValue.isNull() ) { + throw new ExprEvalException(); + } + + if ( isNode() ) { + return otherValue.isNode() && asNode().sameValueAs( otherValue.asNode() ); + } + + throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); + } + @Override public String asLexicalForm() { if ( isNull() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 5a778f6c772..78178ba8ce1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -164,7 +164,21 @@ public static boolean isListLiteral( final LiteralLabel lit ) { public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final List list1 = getValue(value1); final List list2 = getValue(value2); - return list1.equals(list2); + + if ( list1.size() != list2.size() ) return false; + if ( list1.isEmpty() ) return true; + + final Iterator it1 = list1.iterator(); + final Iterator it2 = list2.iterator(); + while ( it1.hasNext() ) { + final CDTValue v1 = it1.next(); + final CDTValue v2 = it2.next(); + if ( ! v1.sameAs(v2) ) { + return false; + } + } + + return true; } public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { From 26a0bb81c31b191d54a1f8e53696ff90b37001a9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 1 Dec 2022 09:26:45 +0100 Subject: [PATCH 208/323] fix: comparing two cdt:List literals using the = operator may still return false even if the lists contain null (but are clearly different in other parts) --- .../src/main/java/org/apache/jena/cdt/CDTValue.java | 8 ++++---- .../org/apache/jena/cdt/CompositeDatatypeList.java | 11 +++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 9ac6500d668..7347d694adf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -44,14 +44,14 @@ public boolean equals( final Object other ) { public boolean sameAs( final Object other ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( other instanceof CDTValue ) { final CDTValue otherValue = (CDTValue) other; if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { @@ -71,11 +71,11 @@ public boolean sameAs( final Object other ) throws ExprEvalException { public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( otherValue.isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 78178ba8ce1..4d0888915f4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -170,14 +171,20 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); + boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - if ( ! v1.sameAs(v2) ) { - return false; + try { + if ( ! v1.sameAs(v2) ) return false; + } + catch ( final ExprEvalException ex ) { + errorCaught = true; } } + if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); + return true; } From 7778a6887b4cdd5c334283d25a2b85a09fb12ab3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 13 Dec 2022 15:42:49 +0100 Subject: [PATCH 209/323] changes the implementation of the cdt:List constructor to be a functional form (rather than a function) which can be used to have null values in the constructed lists --- .../function/library/collection/ListFct.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index 420ab788576..a8820ed567a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -9,9 +9,13 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; public class ListFct extends FunctionBase { @@ -21,11 +25,18 @@ public void checkBuild( final String uri, final ExprList args ) { } @Override - public NodeValue exec( final List args ) { + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { final List list = new ArrayList<>( args.size() ); - for ( final NodeValue nv : args ) { - final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + for ( final Expr e : args ) { + CDTValue v; + try { + final NodeValue nv = e.eval(binding, env); + v = CDTFactory.createValue( nv.asNode() ); + } catch ( final ExprException ex ) { + v = CDTFactory.getNullValue(); + } + list.add(v); } @@ -34,4 +45,9 @@ public NodeValue exec( final List args ) { return NodeValue.makeNode(n); } + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + } From 0f2a7e28ff39960e4c7c26571bd24be065fff82f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 4 Jan 2023 19:49:36 +0100 Subject: [PATCH 210/323] makes cdt:concat an n-ary function --- .../library/collection/ConcatFct.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 3b4a2dfa52e..89526d9215d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -11,27 +11,38 @@ import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; +import org.apache.jena.sparql.function.FunctionBase; -public class ConcatFct extends FunctionBase2 +public class ConcatFct extends FunctionBase { @Override - public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final List list1 = getInputList(v1); - final List list2 = getInputList(v2); + public void checkBuild( final String uri, final ExprList args ) { + // nothing to check + } - if ( list1.isEmpty() ) { - return v2; + @Override + public NodeValue exec( final List args ) { + if ( args.isEmpty() ) { + final List result = new ArrayList<>(); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); } - if ( list2.isEmpty() ) { - return v1; + if ( args.size() == 1 ) { + final NodeValue nv = args.get(0); + // make sure that the argument is a well-formed cdt:List literal + getInputList(nv); + + return nv; } final List result = new ArrayList<>(); - result.addAll(list1); - result.addAll(list2); + for ( final NodeValue nv : args ) { + result.addAll( getInputList(nv) ); + } final LiteralLabel lit = new LiteralLabelForList(result); final Node n = NodeFactory.createLiteral(lit); From 1a40112b8f7f9dbd116908bab939dfe62f7c89c4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 13:30:26 +0100 Subject: [PATCH 211/323] support for the two-variables version of UNFOLD for cdt:List literals --- .../engine/iterator/QueryIterUnfold.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 90fa39330b6..05c83f0ba10 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -30,6 +30,7 @@ import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; @@ -120,6 +121,8 @@ protected void closeIterator() { } // nothing to do really protected class QueryIterUnfoldWorkerForLists extends QueryIterUnfoldWorkerBase { + protected int nextIndex = 0; + public QueryIterUnfoldWorkerForLists(Binding inputBinding, Iterator itListElmts) { super(inputBinding, itListElmts); } @@ -136,9 +139,22 @@ public void output(IndentedWriter out, SerializationContext sCxt) { @Override protected Binding moveToNextBinding() { final CDTValue nextElmt = itElmts.next(); + nextIndex++; // index values to be assigned to the second variable start at 1 + + final Node indexNode; + if ( var2 != null ) { + final String indexStr = Integer.toString(nextIndex); + indexNode = NodeFactory.createLiteral(indexStr, XSDDatatype.XSDinteger); + } + else { + indexNode = null; + } if ( nextElmt.isNull() ) { - return inputBinding; + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var2, indexNode); + else + return inputBinding; } if ( nextElmt.isNode() ) { @@ -159,7 +175,10 @@ else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof Li value = n; } - return BindingFactory.binding(inputBinding, var1, value); + if ( var2 != null ) + return BindingFactory.binding(inputBinding, var1, value, var2, indexNode); + else + return BindingFactory.binding(inputBinding, var1, value); } throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); From f329a0d06b2c8cda11a375706d3b43afc2ef5419 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 Mar 2023 14:17:18 +0100 Subject: [PATCH 212/323] support for the one-variable version of UNFOLD for cdt:Map literals --- .../org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 05c83f0ba10..fa1e3c7c570 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -215,7 +215,7 @@ protected Binding moveToNextBinding() { throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); } - if ( value.isNull() ) { + if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); } From 04711bbffd76497d4a6d20b31e11770281b3a1fc Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 May 2023 11:02:31 +0200 Subject: [PATCH 213/323] support for comparison of cdt:List literals (i.e., < and >) --- .../jena/cdt/CompositeDatatypeList.java | 50 ++- .../apache/jena/sparql/expr/NodeValue.java | 299 ++++++++++++++++++ 2 files changed, 345 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 4d0888915f4..2c59bad884d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -25,6 +25,8 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeList extends CompositeDatatypeBase { @@ -171,7 +173,6 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); - boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); @@ -179,15 +180,56 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( ! v1.sameAs(v2) ) return false; } catch ( final ExprEvalException ex ) { - errorCaught = true; + throw new ExprEvalException("nulls in lists cannot be compared"); } } - if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); - return true; } + public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final List list1; + final List list2; + try { + list1 = getValue(value1); + list2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( list1.isEmpty() && list2.isEmpty() ) return 0; + if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; + if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + + final int n = Math.min( list1.size(), list2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTValue elmt1 = list1.get(i); + final CDTValue elmt2 = list2.get(i); + + if ( elmt1.isNull() || elmt2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + + final int c; + try { + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c != 0 ) return c; + } + } + + return ( list1.size() - list2.size() ); + } + public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index e87b8f3b727..5a054044bd6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -555,9 +555,308 @@ && nSameAs(t1.getPredicate(), t2.getPredicate()) >>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } +<<<<<<< HEAD public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { ValueSpace c1 = classifyValueSpace(nv1); ValueSpace c2 = classifyValueSpace(nv2); +======= + /** Worker for sameAs. */ + private static boolean nSameAs(Node n1, Node n2) { + NodeValue nv1 = NodeValue.makeNode(n1); + NodeValue nv2 = NodeValue.makeNode(n2); + return sameAs(nv1, nv2); + } + + /** Return true if the two Nodes are known to be different, + * return false if the two Nodes are known to be the same, + * else throw ExprEvalException + */ + public static boolean notSameAs(Node n1, Node n2) + { + return notSameAs(NodeValue.makeNode(n1), NodeValue.makeNode(n2)) ; + } + + /** Return true if the two NodeValues are known to be different, + * return false if the two NodeValues are known to be the same, + * else throw ExprEvalException + */ + public static boolean notSameAs(NodeValue nv1, NodeValue nv2) + { + return ! sameAs(nv1, nv2) ; + } + + // ---------------------------------------------------------------- + // compare + + // Compare by value code is here + // NodeUtils.compareRDFTerms for syntactic comparison + + /** Compare by value if possible else compare by kind/type/lexical form + * Only use when you want an ordering regardless of form of NodeValue, + * for example in ORDER BY + * + * @param nv1 + * @param nv2 + * @return negative, 0, or positive for less than, equal, greater than. + */ + + public static int compareAlways(NodeValue nv1, NodeValue nv2) + { + try { + int x = compare(nv1, nv2, true) ; + // Same? + if ( x != Expr.CMP_EQUAL ) + return x ; + } catch (ExprNotComparableException ex) + { /* Drop through */ } + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + } + + /** Compare by value (and only value) if possible. + * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) + * @param nv1 + * @param nv2 + * @return Expr.CMP_INDETERMINATE(+2), Expr.CMP_LESS(-1), Expr.CMP_EQUAL(0) or Expr.CMP_GREATER(+1) + * @throws ExprNotComparableException + */ + public static int compare(NodeValue nv1, NodeValue nv2) + { + if ( nv1 == null || nv2 == null ) + //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; + throw new ARQInternalErrorException("Attempt to compare on null") ; + int x = compare(nv1, nv2, false) ; + return x ; + } + + // E_GreaterThan/E_LessThan/E_GreaterThanOrEqual/E_LessThanOrEqual + // ==> compare(nv1, nv2) => compare (nv1, nv2, false) + + // BindingComparator => compareAlways(nv1, nv2) => compare (nv1, nv2, true) + + // E_Equals calls NodeValue.sameAs() ==> + + // sortOrderingCompare means that the comparison should do something with normally unlike things, + // and split plain strings from xsd:strings. + + private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCompare) + { + if ( nv1 == null && nv2 == null ) + return Expr.CMP_EQUAL ; + + if ( nv1 == null ) + return Expr.CMP_LESS ; + if ( nv2 == null ) + return Expr.CMP_GREATER ; + + ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; + + // Special case - date/dateTime comparison is affected by timezones and may be + // indeterminate based on the value of the dateTime/date. + // Do this first, + + switch (compType) + { + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_DAY : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + { + int x = XSDFuncOp.compareDateTime(nv1, nv2) ; + if ( x != Expr.CMP_INDETERMINATE ) + return x ; + // Indeterminate => can't compare as strict values. + compType = ValueSpaceClassification.VSPACE_DIFFERENT ; + break ; + } + case VSPACE_DURATION: + { + int x = XSDFuncOp.compareDuration(nv1, nv2) ; + // Fix up - Java (Oracle java7 at least) returns "equals" for + // "P1Y"/"P365D" and "P1M"/"P28D", and others split over + // YearMonth/DayTime. + + // OR return Expr.CMP_INDETERMINATE ?? + if ( x == Expr.CMP_EQUAL ) { + Duration d1 = nv1.getDuration() ; + Duration d2 = nv2.getDuration() ; + if ( ( XSDFuncOp.isDayTime(d1) && XSDFuncOp.isYearMonth(d2) ) || + ( XSDFuncOp.isDayTime(d2) && XSDFuncOp.isYearMonth(d1) ) ) + x = Expr.CMP_INDETERMINATE ; + } + if ( x != Expr.CMP_INDETERMINATE ) + return x ; + compType = ValueSpaceClassification.VSPACE_DIFFERENT ; + break ; + } + + // No special cases. + case VSPACE_BOOLEAN : + case VSPACE_DIFFERENT : + case VSPACE_LANG : + case VSPACE_TRIPLE_TERM: + case VSPACE_NODE : + case VSPACE_NUM : + case VSPACE_STRING : + case VSPACE_SORTKEY : + case VSPACE_UNKNOWN : + // Drop through. + } + + switch (compType) + { + case VSPACE_DATETIME: + case VSPACE_DATE: + case VSPACE_TIME: + case VSPACE_G_DAY : + case VSPACE_G_MONTH : + case VSPACE_G_MONTHDAY : + case VSPACE_G_YEAR : + case VSPACE_G_YEARMONTH : + case VSPACE_DURATION: + throw new ARQInternalErrorException("Still seeing date/dateTime/time/duration compare type") ; + + case VSPACE_NUM: return XSDFuncOp.compareNumeric(nv1, nv2) ; + case VSPACE_STRING: + { + int cmp = XSDFuncOp.compareString(nv1, nv2) ; + + if ( ! sortOrderingCompare ) + return cmp ; + if ( cmp != Expr.CMP_EQUAL ) + return cmp ; + + // Equality. + if ( JenaRuntime.isRDF11 ) + // RDF 1.1 : No literals without datatype. + return cmp ; + + // RDF 1.0 + // Split plain literals and xsd:strings for sorting purposes. + // Same by string value. + String dt1 = nv1.asNode().getLiteralDatatypeURI() ; + String dt2 = nv2.asNode().getLiteralDatatypeURI() ; + if ( dt1 == null && dt2 != null ) + return Expr.CMP_LESS ; + if ( dt2 == null && dt1 != null ) + return Expr.CMP_GREATER ; + return Expr.CMP_EQUAL; // Both plain or both xsd:string. + } + case VSPACE_SORTKEY : + return nv1.getSortKey().compareTo(nv2.getSortKey()); + + case VSPACE_BOOLEAN: + return XSDFuncOp.compareBoolean(nv1, nv2) ; + + case VSPACE_LANG: + { + // Two literals, both with language tags. + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + int x = StrUtils.strCompareIgnoreCase(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; + + if ( x != Expr.CMP_EQUAL ) + { + // Different lang tags + if ( ! sortOrderingCompare ) + raise(new ExprNotComparableException("Can't compare (different languages) "+nv1+" and "+nv2)) ; + // Different lang tags - sorting + return x ; + } + + // same lang tag (case insensitive) + x = StrUtils.strCompare(node1.getLiteralLexicalForm(), node2.getLiteralLexicalForm()) ; + if ( x != Expr.CMP_EQUAL ) + return x ; + // Same lexical forms, same lang tag by value + // Try to split by syntactic lang tags. + x = StrUtils.strCompare(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; + // Maybe they are the same after all! + // Should be node.equals by now. + if ( x == Expr.CMP_EQUAL && ! NodeFunctions.sameTerm(node1, node2) ) + throw new ARQInternalErrorException("Looks like the same (lang tags) but not node equals") ; + return x ; + } + + case VSPACE_TRIPLE_TERM: { + Triple t1 = nv1.getNode().getTriple(); + Triple t2 = nv2.getNode().getTriple(); + int x = nCompare(t1.getSubject(), t2.getSubject(), sortOrderingCompare); + if ( x != CMP_EQUAL ) + return x; + x = nCompare(t1.getPredicate(), t2.getPredicate(), sortOrderingCompare); + if ( x != CMP_EQUAL ) + return x; + return nCompare(t1.getObject(), t2.getObject(), sortOrderingCompare); + } + + case VSPACE_NODE: + // Two non-literals don't compare except for sorting. + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + else + { + raise(new ExprNotComparableException("Can't compare (nodes) "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + + case VSPACE_CDT_LIST: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeList.type.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + + case VSPACE_UNKNOWN: + { + // One or two unknown value spaces. + Node node1 = nv1.asNode() ; + Node node2 = nv2.asNode() ; + // Two unknown literals can be equal. + if ( NodeFunctions.sameTerm(node1, node2) ) + return Expr.CMP_EQUAL ; + + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(node1, node2) ; + + raise(new ExprNotComparableException("Can't compare "+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + + case VSPACE_DIFFERENT: + // Two literals, from different known value spaces + if ( sortOrderingCompare ) + return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; + + raise(new ExprNotComparableException("Can't compare (incompatible value spaces)"+nv1+" and "+nv2)) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + throw new ARQInternalErrorException("Compare failure "+nv1+" and "+nv2) ; + } + + /** Worker for compare. */ + private static int nCompare(Node n1, Node n2, boolean sortOrderingCompare) { + if ( n1.equals(n2) ) + return CMP_EQUAL; + NodeValue nv1 = NodeValue.makeNode(n1); + NodeValue nv2 = NodeValue.makeNode(n2); + return compare(nv1, nv2, sortOrderingCompare); + } + + public static ValueSpaceClassification classifyValueOp(NodeValue nv1, NodeValue nv2) + { + ValueSpaceClassification c1 = nv1.getValueSpace() ; + ValueSpaceClassification c2 = nv2.getValueSpace() ; +>>>>>>> ed504e0cc8 (support for comparison of cdt:List literals (i.e., < and >)) if ( c1 == c2 ) return c1 ; if ( c1 == VSPACE_UNKNOWN || c2 == VSPACE_UNKNOWN ) return VSPACE_UNKNOWN ; From 5de488093c88418903f028f4f00f6b98d50c461f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 May 2023 09:11:55 +0200 Subject: [PATCH 214/323] bug fix: visit(OpUnfold) must pop the current expression from the stack --- .../jena/sparql/algebra/walker/ApplyTransformVisitor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java index e6028996b28..0e9ae51129c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/walker/ApplyTransformVisitor.java @@ -149,6 +149,10 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { + final Expr e2 = pop(exprStack); + if ( ! opUnfold.getExpr().equals(e2) ) + throw new IllegalArgumentException("Expression on stack differs from expression of UNFOLD."); + visit1(opUnfold) ; } From 7b7a010cdf20dd6a6f92084c334f7a47db1987d7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 8 Jun 2023 22:50:18 +0200 Subject: [PATCH 215/323] changes implementation of 'list-equal' and 'list-less-than' such that comparing blank nodes (as list elements) raises an error --- .../jena/cdt/CompositeDatatypeList.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2c59bad884d..13cb5ee8d01 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -176,12 +176,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); - try { - if ( ! v1.sameAs(v2) ) return false; - } - catch ( final ExprEvalException ex ) { + + if ( v1.isNull() || v2.isNull() ) { throw new ExprEvalException("nulls in lists cannot be compared"); } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) { + return false; + } } return true; @@ -211,9 +220,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); + + if ( n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); - final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); final int c; try { From c67e5834194c432cac4d1d123e27548cc4f8c63d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 15 Jun 2023 17:43:33 +0200 Subject: [PATCH 216/323] FOLD must not accept blank nodes as keys for maps --- .../java/org/apache/jena/sparql/expr/aggregate/AggFold.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 93f9a3fb87e..b30a46fe7f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -168,6 +168,9 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { if ( nvKey == null ) { return; // ignore if creating the key using the given binding failed } + if ( nvKey.isBlank() ) { + return; // ignore if the key would be a blank node + } final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); From b6009855c89222ea3a487476e9a743457fc56790 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 16:49:32 +0200 Subject: [PATCH 217/323] adds the map version of cdt:get, in this context also changes 'equals' of CDTKey (it must be true only for same terms not for same values) --- .../main/java/org/apache/jena/cdt/CDTKey.java | 12 +++-- .../function/library/collection/GetFct.java | 45 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 1b2dd152155..532ac98b10d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -20,7 +20,6 @@ import org.apache.jena.graph.Node; import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.expr.NodeValue; public abstract class CDTKey { @@ -47,14 +46,19 @@ public boolean equals( final Object other ) { if ( other instanceof CDTKey ) { final CDTKey otherKey = (CDTKey) other; - final NodeValue thisNV = NodeValue.makeNode( asNode() ); - final NodeValue otherNV = NodeValue.makeNode( otherKey.asNode() ); - return NodeValue.sameAs(thisNV, otherNV); + final Node n1 = asNode(); + final Node n2 = otherKey.asNode(); + return n1.equals(n2); } return false; } + @Override + public int hashCode() { + return asNode().hashCode(); + } + @Override public String toString() { if ( isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index 41227a7bb10..ae11240dc47 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -1,10 +1,15 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,9 +20,16 @@ public class GetFct extends FunctionBase2 public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + if ( CompositeDatatypeList.isListLiteral(n1) ) + return getFromList( n1.getLiteral(), nv2 ); + if ( CompositeDatatypeMap.isMapLiteral(n1) ) + return getFromMap( n1.getLiteral(), nv2 ); + + throw new ExprEvalException("Neither a list nor a map literal: " + nv1); + } + + protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -26,7 +38,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CompositeDatatypeList.getValue(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -43,4 +55,31 @@ else if ( value.isNode() ) { } } + protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + final Map map = CompositeDatatypeMap.getValue(n1); + + if ( map.isEmpty() ) + throw new ExprEvalException("empty map"); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + if ( value == null ) { + throw new ExprEvalException("key is not in the map"); + } + else if ( value.isNull() ) { + throw new ExprEvalException("value for key is in null"); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + } From 43a4c25b019cb61a9db1a54c4414d39136b9692e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:21:41 +0200 Subject: [PATCH 218/323] adds support for cdt:containsKey --- .../CollectionLiteralFunctions.java | 6 ++- .../library/collection/ContainsKeyFct.java | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 1e16821a71e..86b9f93d0e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,11 +6,13 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsKey", ContainsKeyFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java new file mode 100644 index 00000000000..f3a54dbe3c7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsKeyFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + final Node n2 = nv2.asNode(); + + // If the second argument is not an IRI or a literal, then it cannot be + // a map key in the given map and, by definition of cdt:containsKey, we + // have to return false. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return NodeValue.booleanReturn(false); + + if ( map.isEmpty() ) + return NodeValue.booleanReturn(false); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + return NodeValue.booleanReturn( value != null ); + } + +} From ac52919ccbfeb1f818d3255040c5abe1516cc440 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:37:56 +0200 Subject: [PATCH 219/323] adds support for cdt:keys --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/KeysFct.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 86b9f93d0e7..36ddc929809 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,6 +11,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java new file mode 100644 index 00000000000..a2f4cb7a8c8 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -0,0 +1,40 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class KeysFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a map literal: " + nv); + + final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + + final List list = new ArrayList<>( map.size() ); + for ( final CDTKey key : map.keySet() ) { + final CDTValue value = CDTFactory.createValue( key.asNode() ); + list.add(value); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From eb9528de1c6ee68c3bb55691d36b8bbbf572b8f4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 19:31:07 +0200 Subject: [PATCH 220/323] adds support for cdt:remove --- .../library/collection/RemoveFct.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java new file mode 100644 index 00000000000..fd298d94010 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -0,0 +1,51 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class RemoveFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + if ( map.isEmpty() ) + return nv1; + + final Node n2 = nv2.asNode(); + + // If the second term is not a map key (and the first term is a well- + // formed cdt:Map literal), the first term needs to be returned as is. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return nv1; + + final CDTKey key = CDTFactory.createKey(n2); + + if ( ! map.containsKey(key) ) + return nv1; + + final Map newMap = new HashMap<>(map); + newMap.remove(key); + + final LiteralLabel lit = new LiteralLabelForMap(newMap); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From bbdd1535c784bde718964b6d51773f7f02f666af Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 14:57:25 +0200 Subject: [PATCH 221/323] bug fix: CDTValue needs to override toString() and hashCode() and cannot rely on CDTKey for that; now it is not a subclass of CDTKey anymore --- .../java/org/apache/jena/cdt/CDTFactory.java | 1 - .../main/java/org/apache/jena/cdt/CDTKey.java | 16 +------ .../java/org/apache/jena/cdt/CDTValue.java | 48 ++++++++++++++++--- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index dddd36a52d0..912f32a47cf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -29,7 +29,6 @@ public class CDTFactory { public static CDTKey createKey( final Node n ) { return new CDTKey() { - @Override public boolean isNode() { return true; } @Override public Node asNode() { return n; } }; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java index 532ac98b10d..7631565e88c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTKey.java @@ -23,15 +23,6 @@ public abstract class CDTKey { - /** - * Returns true if this object is an RDF term (i.e., an IRI, a literal, - * or a blank node). In that case, {@link #asNode()} can be used to get - * a corresponding {@link Node} representation of this RDF term. - */ - public boolean isNode() { - return false; - } - /** * Returns this object as an RDF term (i.e., an IRI, a literal, * or a blank node), assuming it is one. If it is not, then an @@ -61,12 +52,7 @@ public int hashCode() { @Override public String toString() { - if ( isNode() ) { - return asNode().toString(); - } - else { - return super.toString(); - } + return asNode().toString(); } /** diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 7347d694adf..3baed568f3e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -22,7 +22,7 @@ import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.expr.ExprEvalException; -public abstract class CDTValue extends CDTKey +public abstract class CDTValue { /** * Returns true if this is a null value (in which @@ -32,6 +32,46 @@ public boolean isNull() { return false; } + /** + * Returns true if this object is an RDF term (i.e., an IRI, a literal, + * or a blank node). In that case, {@link #asNode()} can be used to get + * a corresponding {@link Node} representation of this RDF term. + */ + public boolean isNode() { + return false; + } + + /** + * Returns this object as an RDF term (i.e., an IRI, a literal, + * or a blank node), assuming it is one. If it is not, then an + * {@link UnsupportedOperationException} is thrown. + */ + public Node asNode() { + throw new UnsupportedOperationException( this + " is not an RDF term" ); + } + + @Override + public String toString() { + if ( isNode() ) + return asNode().toString(); + + if ( isNull() ) + return "null"; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + + @Override + public int hashCode() { + if ( isNode() ) + return asNode().hashCode();; + + if ( isNull() ) + return 1; + + throw new IllegalArgumentException( "not null and not a Node (" + this.getClass().getName() + ")" ); + } + @Override public boolean equals( final Object other ) { try { @@ -61,11 +101,6 @@ public boolean sameAs( final Object other ) throws ExprEvalException { throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - if ( other instanceof CDTKey && isNode() ) { - final CDTKey otherKey = (CDTKey) other; - return asNode().sameValueAs( otherKey.asNode() ); - } - return false; } @@ -85,7 +120,6 @@ public final boolean sameAs( final CDTValue otherValue ) throws ExprEvalExceptio throw new IllegalStateException( "unexpected type of CDTValue: " + this.getClass().getName() ); } - @Override public String asLexicalForm() { if ( isNull() ) { return "null"; From 4ea569f240793f5a5cbc2444ade834cb7974942c Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:31:56 +0200 Subject: [PATCH 222/323] adds CDTLiteralFunctionUtils --- .../collection/CDTLiteralFunctionUtils.java | 119 ++++++++++++++++++ .../library/collection/ConcatFct.java | 37 ++---- .../library/collection/ContainsFct.java | 10 +- .../library/collection/ContainsKeyFct.java | 9 +- .../library/collection/ContainsTermFct.java | 10 +- .../library/collection/FunctionBase1List.java | 11 +- .../function/library/collection/GetFct.java | 13 +- .../function/library/collection/KeysFct.java | 16 +-- .../function/library/collection/ListFct.java | 8 +- .../library/collection/RemoveFct.java | 15 +-- .../library/collection/ReverseFct.java | 8 +- .../function/library/collection/SizeFct.java | 27 ++-- .../library/collection/SubSeqFct.java | 17 +-- .../function/library/collection/TailFct.java | 8 +- 14 files changed, 155 insertions(+), 153 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java new file mode 100644 index 00000000000..d1d3f90c69e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java @@ -0,0 +1,119 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class CDTLiteralFunctionUtils +{ + /** + * Uses {@link CompositeDatatypeList#isListLiteral(Node)} to check whether + * the given node is a cdt:List literal and throws an exception if not. + */ + public static final void ensureListLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + n); + } + + /** + * Uses {@link CompositeDatatypeMap#isMapLiteral(Node)} to check whether + * the given node is a cdt:Map literal and throws an exception if not. + */ + public static final void ensureMapLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a cdt:Map literal: " + n); + } + + /** + * Assumes that the given node is a cdt:List literal and uses + * {@link CompositeDatatypeList#getValue(LiteralLabel)} to get + * the list. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. + */ + public static final List getList( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeList.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:List literal: " + n, ex); + } + } + + /** + * Assumes that the given node is a cdt:Map literal and uses + * {@link CompositeDatatypeMap#getValue(LiteralLabel)} to get + * the map. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. + */ + public static final Map getMap( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeMap.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n, ex); + } + } + + /** + * Calls {@link #ensureListLiteral(Node)} first, and {@link #getList(Node)} + * afterwards. + */ + public static final List checkAndGetList( final Node n ) throws ExprEvalException { + ensureListLiteral(n); + return getList(n); + } + + /** + * Calls {@link #ensureMapLiteral(Node)} first, and {@link #getMap(Node)} + * afterwards. + */ + public static final Map checkAndGetMap( final Node n ) throws ExprEvalException { + ensureMapLiteral(n); + return getMap(n); + } + + public static final List checkAndGetList( final NodeValue nv ) throws ExprEvalException { + return checkAndGetList( nv.asNode() ); + } + + public static final Map checkAndGetMap( final NodeValue nv ) throws ExprEvalException { + return checkAndGetMap( nv.asNode() ); + } + + /** + * Creates a {@link NodeValue} with a cdt:List literal that represents the + * given list. + */ + public static final NodeValue createNodeValue( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + + /** + * Creates a {@link NodeValue} with a cdt:Map literal that represents the + * given map. + */ + public static final NodeValue createNodeValue( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 89526d9215d..2867a64ccae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,16 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; @@ -25,42 +19,25 @@ public void checkBuild( final String uri, final ExprList args ) { @Override public NodeValue exec( final List args ) { if ( args.isEmpty() ) { - final List result = new ArrayList<>(); - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + final List result = Collections.emptyList(); + return CDTLiteralFunctionUtils.createNodeValue(result); } if ( args.size() == 1 ) { final NodeValue nv = args.get(0); // make sure that the argument is a well-formed cdt:List literal - getInputList(nv); + CDTLiteralFunctionUtils.checkAndGetList(nv); return nv; } final List result = new ArrayList<>(); for ( final NodeValue nv : args ) { - result.addAll( getInputList(nv) ); + final List l = CDTLiteralFunctionUtils.checkAndGetList(nv); + result.addAll(l); } - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - - protected List getInputList( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a cdt:List literal: " + nv); - - try { - return CompositeDatatypeList.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); - } + return CDTLiteralFunctionUtils.createNodeValue(result); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index b0a323e2e4c..6784dff603f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -13,12 +10,7 @@ public class ContainsFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java index f3a54dbe3c7..6cfcb050dc3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -5,9 +5,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,12 +13,7 @@ public class ContainsKeyFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); final Node n2 = nv2.asNode(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java index 6951d89992e..3ce25c92108 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; import org.apache.jena.sparql.function.FunctionBase2; @@ -14,12 +11,7 @@ public class ContainsTermFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsTerm( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 99210c10f0d..77491640be0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -13,13 +10,7 @@ public abstract class FunctionBase1List extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv); return _exec(list, nv); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index ae11240dc47..7a2a4e48ae6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -9,7 +9,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -21,15 +20,15 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); if ( CompositeDatatypeList.isListLiteral(n1) ) - return getFromList( n1.getLiteral(), nv2 ); + return getFromList(n1, nv2); if ( CompositeDatatypeMap.isMapLiteral(n1) ) - return getFromMap( n1.getLiteral(), nv2 ); + return getFromMap(n1, nv2); throw new ExprEvalException("Neither a list nor a map literal: " + nv1); } - protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromList( final Node n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -38,7 +37,7 @@ protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue(n1); + final List list = CDTLiteralFunctionUtils.getList(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -55,12 +54,12 @@ else if ( value.isNode() ) { } } - protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromMap( final Node n1, final NodeValue nv2 ) { final Node n2 = nv2.asNode(); if ( ! n2.isURI() && ! n2.isLiteral() ) throw new ExprEvalException("Not a valid map key: " + nv2); - final Map map = CompositeDatatypeMap.getValue(n1); + final Map map = CDTLiteralFunctionUtils.getMap(n1); if ( map.isEmpty() ) throw new ExprEvalException("empty map"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java index a2f4cb7a8c8..507c041fa2a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -7,12 +7,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -20,12 +14,7 @@ public class KeysFct extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n) ) - throw new ExprEvalException("Not a map literal: " + nv); - - final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv); final List list = new ArrayList<>( map.size() ); for ( final CDTKey key : map.keySet() ) { @@ -33,8 +22,7 @@ public NodeValue exec( final NodeValue nv ) { list.add(value); } - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(list); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index a8820ed567a..d151df0132e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -5,10 +5,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprException; @@ -40,9 +36,7 @@ public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv en list.add(v); } - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(list); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java index fd298d94010..f226ed1163d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -6,12 +6,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -19,12 +14,7 @@ public class RemoveFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); if ( map.isEmpty() ) return nv1; @@ -44,8 +34,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Map newMap = new HashMap<>(map); newMap.remove(key); - final LiteralLabel lit = new LiteralLabelForMap(newMap); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(newMap); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java index e2d2d3fd4ed..ffcb70bd1fa 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -4,10 +4,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.NodeValue; public class ReverseFct extends FunctionBase1List @@ -25,9 +21,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { } final List reverseList = Arrays.asList(reverseArray); - final LiteralLabel lit = new LiteralLabelForList(reverseList); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(reverseList); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 4121ba8db3b..4958369b0f3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,9 +2,7 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -15,26 +13,15 @@ public class SizeFct extends FunctionBase1 public NodeValue exec( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); - final int size; - try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - size = CompositeDatatypeList.getValue(lit).size(); - } - else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - size = CompositeDatatypeMap.getValue(lit).size(); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); - } + if ( CompositeDatatypeList.isListLiteral(n) ) { + size = CDTLiteralFunctionUtils.getList(n).size(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + size = CDTLiteralFunctionUtils.getMap(n).size(); } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); + else { + throw new ExprEvalException("Neither a list nor a map literal: " + nv); } return NodeValue.makeInteger(size); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java index d5e8f7b736b..3c0d200eabb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -5,11 +5,7 @@ import org.apache.jena.atlas.lib.Lib; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.query.QueryBuildException; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; @@ -20,7 +16,7 @@ public class SubSeqFct extends FunctionBase { @Override public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 && args.size() > 3 ) + if ( args.size() < 2 || args.size() > 3 ) throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); } @@ -29,8 +25,7 @@ public NodeValue exec( final List args ) { final NodeValue nv1 = args.get(0); final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + CDTLiteralFunctionUtils.ensureListLiteral(n1); final NodeValue nv2 = args.get(1); @@ -55,10 +50,10 @@ public NodeValue exec( final List args ) { if ( length < 0 ) throw new ExprEvalException("Illegal length value: " + nv3); - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); } else { - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); length = list.size() - index + 1; } @@ -82,9 +77,7 @@ public NodeValue exec( final List args ) { sublist = list.subList( index - 1, index - 1 + length ); } - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index a56581d3195..a8c38a88cc1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -3,10 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -18,9 +14,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { throw new ExprEvalException("Empty list"); final List sublist = list.subList( 1, list.size() ); - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } From 1aa8fd5d8258c8cc7bd468da45166aaad46cdc69 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:32:48 +0200 Subject: [PATCH 223/323] adds support for cdt:put --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/PutFct.java | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 36ddc929809..fa97a88d342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java new file mode 100644 index 00000000000..dfb34b5b4ea --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java @@ -0,0 +1,94 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class PutFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 || args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() < 2 || args.size() > 3 ) + throw new ExprException("wrong number of arguments (" + args.size() + "), must be 2 or 3"); + + // check the second argument first because that's less expensive + final NodeValue nv2 = args.get(1).eval(binding, env); + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + // now check the first argument + final NodeValue nv1 = args.get(0).eval(binding, env); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + + final CDTKey key = CDTFactory.createKey(n2); + + // produce a map value from the third argument (if any) + final CDTValue newValue; + if ( args.size() == 2 ) { + newValue = CDTFactory.getNullValue(); + } + else { // in this case, we have that args.size() == 3 + NodeValue nv3 = null; + try { + nv3 = args.get(2).eval(binding, env); + } + catch ( final ExprException ex ) { + // nothing to do here + } + + if ( nv3 != null ) { + newValue = CDTFactory.createValue( nv3.asNode() ); + } + else { + newValue = CDTFactory.getNullValue(); + } + } + + // check if the given map already contains the exact same map entry + // if so, simply return the given cdt:Map literal + final CDTValue oldValue = map.get(key); + if ( oldValue != null ) { + if ( oldValue.isNull() && newValue.isNull() ) + return nv1; + + if ( ! oldValue.isNull() && ! newValue.isNull() ) { + final Node on = oldValue.asNode(); + final Node nn = newValue.asNode(); + if ( on.equals(nn) ) + return nv1; + } + } + + final Map newMap = new HashMap<>(map); + newMap.put(key, newValue); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From 95dcb748e33a6494e17986c61b65e1a49f6e3f92 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:34:57 +0200 Subject: [PATCH 224/323] renames CollectionLiteralFunctions to CDTLiteralFunctions --- .../java/org/apache/jena/sparql/function/ARQFunctions.java | 4 ++-- ...llectionLiteralFunctions.java => CDTLiteralFunctions.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/{CollectionLiteralFunctions.java => CDTLiteralFunctions.java} (97%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 2acb95dbf84..7694f96276a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CollectionLiteralFunctions; +import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). @@ -34,6 +34,6 @@ public class ARQFunctions { public static void load(FunctionRegistry reg) { TripleTermFunctions.register(reg); - CollectionLiteralFunctions.register(reg); + CDTLiteralFunctions.register(reg); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java index fa97a88d342..b388733831c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java @@ -3,7 +3,7 @@ import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; -public class CollectionLiteralFunctions { +public class CDTLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); From ed16c84233ab25ae3371dcd1c594fdf1a3acb3c1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:36:46 +0200 Subject: [PATCH 225/323] renames 'org.apache.jena.sparql.function.library.collections' package to 'org.apache.jena.sparql.function.library.cdt' --- .../main/java/org/apache/jena/sparql/function/ARQFunctions.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctionUtils.java | 2 +- .../library/{collection => cdt}/CDTLiteralFunctions.java | 2 +- .../sparql/function/library/{collection => cdt}/ConcatFct.java | 2 +- .../function/library/{collection => cdt}/ContainsFct.java | 2 +- .../function/library/{collection => cdt}/ContainsKeyFct.java | 2 +- .../function/library/{collection => cdt}/ContainsTermFct.java | 2 +- .../function/library/{collection => cdt}/FunctionBase1List.java | 2 +- .../sparql/function/library/{collection => cdt}/GetFct.java | 2 +- .../sparql/function/library/{collection => cdt}/HeadFct.java | 2 +- .../sparql/function/library/{collection => cdt}/KeysFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ListFct.java | 2 +- .../sparql/function/library/{collection => cdt}/PutFct.java | 2 +- .../sparql/function/library/{collection => cdt}/RemoveFct.java | 2 +- .../sparql/function/library/{collection => cdt}/ReverseFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SizeFct.java | 2 +- .../sparql/function/library/{collection => cdt}/SubSeqFct.java | 2 +- .../sparql/function/library/{collection => cdt}/TailFct.java | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctionUtils.java (98%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/CDTLiteralFunctions.java (96%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ConcatFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsKeyFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ContainsTermFct.java (93%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/FunctionBase1List.java (88%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/GetFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/HeadFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/KeysFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ListFct.java (95%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/PutFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/RemoveFct.java (94%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/ReverseFct.java (91%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SizeFct.java (92%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/SubSeqFct.java (97%) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/{collection => cdt}/TailFct.java (89%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java index 7694f96276a..9c76c037231 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/ARQFunctions.java @@ -19,7 +19,7 @@ package org.apache.jena.sparql.function; import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.library.collection.CDTLiteralFunctions; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctions; import org.apache.jena.sparql.function.library.triple.TripleTermFunctions; /** Load ARQ functions (). diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java similarity index 98% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d1d3f90c69e..1fa1b956656 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java similarity index 96% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index b388733831c..94c3a8af018 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index 2867a64ccae..fc7ed60734d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index 6784dff603f..f9751d78ca5 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index 6cfcb050dc3..eca1978ba1e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java similarity index 93% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index 3ce25c92108..da670a6508e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java similarity index 88% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index 77491640be0..b6f45b33e4b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index 7a2a4e48ae6..c83cd9b764f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index aebd5f39611..1f331c936ac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 507c041fa2a..6c393370ff1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java similarity index 95% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index d151df0132e..ca7c0f92715 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index dfb34b5b4ea..0df7dcfdf00 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java similarity index 94% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index f226ed1163d..0a4a5a99b36 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java similarity index 91% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index ffcb70bd1fa..3d28e7a76e0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java similarity index 92% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 4958369b0f3..5166f1440d9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 3c0d200eabb..80a99fb32f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.Collections; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java similarity index 89% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index a8c38a88cc1..70805975786 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,4 +1,4 @@ -package org.apache.jena.sparql.function.library.collection; +package org.apache.jena.sparql.function.library.cdt; import java.util.List; From c7a40540d68570d252e9b3f17a2570bf4c692a15 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 19:06:28 +0200 Subject: [PATCH 226/323] adds support for cdt:Map constructor --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MapFct.java | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 94c3a8af018..36d36c7fc95 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java new file mode 100644 index 00000000000..3dba18232eb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -0,0 +1,84 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class MapFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() % 2 == 1 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() % 2 == 1 ) + throw new ExprException("Function '"+Lib.className(this)+"' takes an even number of arguments"); + + final Map map = new HashMap<>(); + + final Iterator it = args.iterator(); + while ( it.hasNext() ) { + final Expr exprKey = it.next(); + final Expr exprValue = it.next(); + + final CDTKey key = getKey(exprKey, binding, env); + if ( key != null ) { + final CDTValue value = getValue(exprValue, binding, env); + map.put(key, value); + } + } + + return CDTLiteralFunctionUtils.createNodeValue(map); + } + + protected CDTKey getKey( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return null; + } + + final Node n = nv.asNode(); + if ( ! n.isURI() && ! n.isLiteral() ) + return null; + + return CDTFactory.createKey(n); + } + + protected CDTValue getValue( final Expr e, final Binding binding, final FunctionEnv env ) { + final NodeValue nv; + try { + nv = e.eval(binding, env); + } catch ( final ExprException ex ) { + return CDTFactory.getNullValue(); + } + + return CDTFactory.createValue( nv.asNode() ); + } + + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From 6e864aac54eed4a2ee9297f78010a43817980779 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 21 Aug 2023 12:56:33 +0200 Subject: [PATCH 227/323] big fix: CDTKey does not have a 'isNode()' function anymore --- .../jena/sparql/engine/iterator/QueryIterUnfold.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index fa1e3c7c570..2b518efc68c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -207,13 +207,7 @@ protected Binding moveToNextBinding() { final CDTKey key = elmt.getKey(); final CDTValue value = elmt.getValue(); - final Node keyNode; - if ( key.isNode() ) { - keyNode = key.asNode(); - } - else { - throw new UnsupportedOperationException( "unexpected map key: " + key.getClass().getName() ); - } + final Node keyNode = key.asNode(); if ( value.isNull() || var2 == null ) { return BindingFactory.binding( inputBinding, var1, keyNode ); From 72406bb3277048fa80167387b407ff4da3c57f17 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 14:16:31 +0200 Subject: [PATCH 228/323] the datatypes for the CDT literals need to be registered --- jena-arq/src/main/java/org/apache/jena/query/ARQ.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java index a104dcf8ca7..941f90f6c89 100644 --- a/jena-arq/src/main/java/org/apache/jena/query/ARQ.java +++ b/jena-arq/src/main/java/org/apache/jena/query/ARQ.java @@ -22,6 +22,9 @@ import java.util.concurrent.TimeUnit; import org.apache.jena.atlas.lib.Version; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.datatypes.TypeMapper; import org.apache.jena.http.sys.HttpRequestModifier; import org.apache.jena.http.sys.RegistryRequestModifier; import org.apache.jena.riot.RIOT; @@ -664,6 +667,10 @@ public static void init() { AggregateRegistry.init(); PropertyFunctionRegistry.init(); + // Register the datatypes for the CDT literals + TypeMapper.getInstance().registerDatatype(CompositeDatatypeList.type) ; + TypeMapper.getInstance().registerDatatype(CompositeDatatypeMap.type) ; + JenaSystem.logLifecycle("ARQ.init - finish"); } } From d9a4a27c7527ac5765fbe244c3c6ed96f7f3a5fd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 17:32:00 +0200 Subject: [PATCH 229/323] changes the implementation of LiteralLabelForCDTs to use the corresponding CompositeDatatypeBase implementation more directly --- .../jena/cdt/CompositeDatatypeBase.java | 7 ++++- .../jena/cdt/CompositeDatatypeList.java | 12 ++++++- .../apache/jena/cdt/CompositeDatatypeMap.java | 7 ++++- .../apache/jena/cdt/LiteralLabelForCDTs.java | 31 +++++++------------ .../apache/jena/cdt/LiteralLabelForList.java | 20 +----------- .../apache/jena/cdt/LiteralLabelForMap.java | 20 +----------- 6 files changed, 36 insertions(+), 61 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index ca5e1878c18..5c1e768a424 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -18,9 +18,10 @@ package org.apache.jena.cdt; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; -public abstract class CompositeDatatypeBase implements RDFDatatype +public abstract class CompositeDatatypeBase implements RDFDatatype { @Override public Class getJavaClass() { @@ -42,4 +43,8 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) return this; } + @Override + public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; + + public abstract String unparseValue( final T value ); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 13cb5ee8d01..2b4aa0a30c6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -28,7 +28,7 @@ import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; -public class CompositeDatatypeList extends CompositeDatatypeBase +public class CompositeDatatypeList extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); @@ -49,6 +49,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final List list = (List) value; + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { return unparseList(list); } @@ -246,11 +251,16 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } + @SuppressWarnings("unchecked") public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } else { + final Object value = lit.getValue(); + //if ( value != null && value instanceof List ) + //return (List) value; + final String lex = lit.getLexicalForm(); return parseList(lex); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 6dec66e9920..9853c41fb18 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -7,7 +7,7 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; -public class CompositeDatatypeMap extends CompositeDatatypeBase +public class CompositeDatatypeMap extends CompositeDatatypeBase> { public final static String uri = "http://example.org/cdt/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); @@ -28,6 +28,11 @@ public String unparse( final Object value ) { @SuppressWarnings("unchecked") final Map map = (Map) value; + return unparseValue(map); + } + + @Override + public String unparseValue( final Map map ) { return unparseMap(map); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 0f87a5ea33f..6fea1cfee96 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -30,6 +30,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + @Override + public abstract CompositeDatatypeBase getDatatype(); + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + @Override public boolean isXML() { return false; @@ -81,14 +89,12 @@ public String toString() { @Override public String getLexicalForm() { if ( lexicalForm == null ) { - lexicalForm = unparseValueForm(valueForm); + lexicalForm = getDatatype().unparseValue(valueForm); } return lexicalForm; } - protected abstract String unparseValueForm( T valueForm ); - protected boolean isLexicalFormSet() { return lexicalForm != null; } @@ -117,30 +123,15 @@ public T getValue() throws DatatypeFormatException { // try again at the next call of 'getValue()' because now we have // set 'lexicalFormTested'. - valueForm = parseLexicalForm(lexicalForm); + valueForm = getDatatype().parse(lexicalForm); } return valueForm; } - protected abstract T parseLexicalForm( String lex ) throws DatatypeFormatException; - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - @Override public boolean sameValueAs( final LiteralLabel other ) { - if ( ! other.getDatatypeURI().equals(getDatatypeURI()) ) { - return false; - } - - if ( lexicalForm != null && other.getLexicalForm().equals(lexicalForm) ) { - return true; - } - - return getValue().equals( other.getValue() ); + return getDatatype().isEqual(this, other); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index bc626e0fd01..e84fe915333 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -20,8 +20,6 @@ import java.util.List; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForList extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForList( final String lexicalForm ) { } @Override - protected String unparseValueForm( List valueForm ) { - return CompositeDatatypeList.unparseList(valueForm); - } - - @Override - protected List parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 1d5093e1da7..18ad753f62c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -20,8 +20,6 @@ import java.util.Map; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.impl.LiteralLabel; public class LiteralLabelForMap extends LiteralLabelForCDTs> @@ -35,23 +33,7 @@ public LiteralLabelForMap( final String lexicalForm ) { } @Override - protected String unparseValueForm( Map valueForm ) { - return CompositeDatatypeMap.unparseMap(valueForm); - } - - @Override - protected Map parseLexicalForm( final String lex ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lex, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); - } - } - - @Override - public RDFDatatype getDatatype() { + public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; } From 9c80646adf4f834d5c0d001f56d8d4a0fece069e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 15 Sep 2023 09:52:19 +0200 Subject: [PATCH 230/323] some clean up in CompositeDatatypeList and in CompositeDatatypeMap --- .../jena/cdt/CompositeDatatypeList.java | 199 +++++++++--------- .../apache/jena/cdt/CompositeDatatypeMap.java | 175 +++++++-------- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 3 files changed, 188 insertions(+), 188 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2b4aa0a30c6..d73d1314227 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -40,73 +40,6 @@ public String getURI() { return uri; } - @Override - public String unparse( final Object value ) { - if ( !(value instanceof List) ) { - throw new IllegalArgumentException(); - } - - @SuppressWarnings("unchecked") - final List list = (List) value; - - return unparseValue(list); - } - - @Override - public String unparseValue( final List list ) { - return unparseList(list); - } - - public static String unparseList( final List list ) { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final CDTValue firstElmt = it.next(); - final String firstElmtAsString = unparseListElement(firstElmt); - sb.append(firstElmtAsString); - while ( it.hasNext() ) { - final CDTValue nextElmt = it.next(); - final String nextElmtAsString = unparseListElement(nextElmt); - sb.append(", "); - sb.append(nextElmtAsString); - } - } - sb.append("]"); - return sb.toString(); - } - - public static String unparseListElement( final CDTValue elmt ) { - return elmt.asLexicalForm(); - } - - @Override - public List parse( final String lexicalForm ) throws DatatypeFormatException { - return parseList(lexicalForm); - } - - public static List parseList( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - @Override public boolean isValidValue( final Object value ) { if ( !(value instanceof List) ) { @@ -129,7 +62,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { // datatype and the implementation of LiteralLabelForList makes // sure that these are valid. if ( lit instanceof LiteralLabelForList ) { - return true; + return lit.isWellFormed(); } // However, the given LiteralLabel may come from somewhere else, @@ -149,27 +82,78 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } - /** - * Returns true if the given node is a literal with {@link #uri} - * as its datatype URI. Notice that this does not mean that this - * literal is actually valid; for checking validity, use - * {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final Node n ) { - return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } } - /** - * Returns true if the datatype URI of the given {@link LiteralLabel} is - * {@link #uri}. Notice that this does not mean that this LiteralLabel is - * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final LiteralLabel lit ) { - return lit.getDatatypeURI().equals(uri); + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + protected String unparseListElement( final CDTValue elmt ) { + return elmt.asLexicalForm(); + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isListLiteral(value1) || ! isListLiteral(value2) ) { + return false; + } + final List list1 = getValue(value1); final List list2 = getValue(value2); @@ -201,7 +185,10 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return true; } - public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + /** + * Assumes that the datatype of both of the given literals is cdt:List. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { final List list1; final List list2; try { @@ -251,29 +238,41 @@ public int compare( final LiteralLabel value1, final LiteralLabel value2 ) throw return ( list1.size() - list2.size() ); } - @SuppressWarnings("unchecked") + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given literal is {@link #uri}. + * Notice that this does not mean that this literal is actually valid; + * for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + + /** + * Assumes that the datatype of the given literal is cdt:List. + */ public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForList ) { return ( (LiteralLabelForList) lit ).getValue(); } - else { - final Object value = lit.getValue(); - //if ( value != null && value instanceof List ) - //return (List) value; - final String lex = lit.getLexicalForm(); - return parseList(lex); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof List) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForList ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); - } + @SuppressWarnings("unchecked") + final List list = (List) value; + return list; } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 9853c41fb18..c80adb4bce9 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -19,6 +19,76 @@ public String getURI() { return uri; } + @Override + public boolean isValidValue( final Object value ) { + if ( !(value instanceof Map) ) { + return false; + } + + final Map m = (Map) value; + for ( final Map.Entry e : m.entrySet() ) { + if ( !(e.getKey() instanceof CDTKey) ) { + return false; + } + if ( !(e.getValue() instanceof CDTValue) ) { + return false; + } + } + + return true; + } + + @Override + public boolean isValidLiteral( final LiteralLabel lit ) { + // LiteralLabelForMap objects are supposed to be used for this + // datatype and the implementation of LiteralLabelForMap makes + // sure that these are valid. + if ( lit instanceof LiteralLabelForMap ) { + return lit.isWellFormed(); + } + + // However, the given LiteralLabel may come from somewhere else, + // in which case we have to check its validity as follows. + + final String dtURI = lit.getDatatypeURI(); + if ( dtURI == null || ! dtURI.equals(uri) ) { + return false; + } + + final String lang = lit.language(); + if ( lang != null && ! lang.isEmpty() ) { + return false; + } + + final String lex = lit.getLexicalForm(); + return isValid(lex); + } + + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive ' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + @Override public String unparse( final Object value ) { if ( !(value instanceof Map) ) { @@ -33,10 +103,6 @@ public String unparse( final Object value ) { @Override public String unparseValue( final Map map ) { - return unparseMap(map); - } - - public static String unparseMap( final Map map ) { final StringBuilder sb = new StringBuilder(); sb.append("{"); if ( ! map.isEmpty() ) { @@ -57,82 +123,27 @@ public static String unparseMap( final Map map ) { return sb.toString(); } - public static void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + protected void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { sb.append( entry.getKey().asLexicalForm() ); sb.append(" : "); sb.append( entry.getValue().asLexicalForm() ); } @Override - public Map parse( final String lexicalForm ) throws DatatypeFormatException { - return parseMap(lexicalForm); - } - - public static Map parseMap( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; - try { - return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - throw new DatatypeFormatException(lexicalForm, type, ex); - } - } - - @Override - public boolean isValid( final String lexicalForm ) { - final boolean recursive = false; - try { - ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); - } - catch ( final Exception ex ) { - return false; - } - return true; - } - - @Override - public boolean isValidValue( final Object value ) { - if ( !(value instanceof Map) ) { - return false; - } - - final Map m = (Map) value; - for ( final Map.Entry e : m.entrySet() ) { - if ( !(e.getKey() instanceof CDTKey) ) { - return false; - } - if ( !(e.getValue() instanceof CDTValue) ) { - return false; - } - } - - return true; + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override - public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForMap objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForMap makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForMap ) { - return true; - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - - final String dtURI = lit.getDatatypeURI(); - if ( dtURI == null || ! dtURI.equals(uri) ) { + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { return false; } - final String lang = lit.language(); - if ( lang != null && ! lang.isEmpty() ) { - return false; - } + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); - final String lex = lit.getLexicalForm(); - return isValid(lex); + return map1.equals(map2); } /** @@ -154,32 +165,22 @@ public static boolean isMapLiteral( final LiteralLabel lit ) { return lit.getDatatypeURI().equals(uri); } - @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); - - return map1.equals(map2); - } - + /** + * Assumes that the datatype of the given literal is cdt:Map. + */ public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { if ( lit instanceof LiteralLabelForMap ) { return ( (LiteralLabelForMap) lit ).getValue(); } - else { - final String lex = lit.getLexicalForm(); - return parseMap(lex); - } - } - @Override - public int getHashCode( final LiteralLabel lit ) { - if ( lit instanceof LiteralLabelForMap ) { - return lit.hashCode(); - } - else { - return lit.getLexicalForm().hashCode(); + final Object value = lit.getValue(); + if ( value == null || ! (value instanceof Map) ) { + throw new IllegalArgumentException( lit.toString() + " - " + value ); } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + return map; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 5a054044bd6..3ae359062de 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -808,7 +808,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.type.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2) ; } catch( final ExprNotComparableException e ) { raise(e) ; From 19f2f03793e6fc136a8c8c561f480813ededb707 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 18 Sep 2023 10:54:46 +0200 Subject: [PATCH 231/323] fixes implementation of 'map-equal' --- .../apache/jena/cdt/CompositeDatatypeMap.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index c80adb4bce9..e79b3bd3835 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -135,15 +136,36 @@ public int getHashCode( final LiteralLabel lit ) { } @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { + public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { + if ( ! isMapLiteral(lit1) || ! isMapLiteral(lit2) ) { return false; } - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); + final Map map1 = getValue(lit1); + final Map map2 = getValue(lit2); - return map1.equals(map2); + if ( map1.size() != map2.size() ) return false; + + for ( final Map.Entry entry1 : map1.entrySet() ) { + final CDTValue v1 = entry1.getValue(); + final CDTValue v2 = map2.get( entry1.getKey() ); + if ( v2 == null ) return false; + + if ( v1.isNull() || v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared"); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) return false; + } + + return true; } /** From bc17340f0b3fe496f4ccf16e171320b5b6e119f5 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Sep 2023 17:21:20 +0200 Subject: [PATCH 232/323] adds support for cdt:merge --- .../library/cdt/CDTLiteralFunctions.java | 1 + .../sparql/function/library/cdt/MergeFct.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 36d36c7fc95..48f5d4a7465 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -14,6 +14,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "Map", MapFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "merge", MergeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java new file mode 100644 index 00000000000..ddeb872b3ce --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -0,0 +1,30 @@ +package org.apache.jena.sparql.function.library.cdt; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class MergeFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Map map1 = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + final Map map2 = CDTLiteralFunctionUtils.checkAndGetMap(nv2); + + if ( map1.isEmpty() ) + return nv2; + + if ( map2.isEmpty() ) + return nv1; + + final Map newMap = new HashMap<>(map2); + newMap.putAll(map1); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + +} From a77a1c1176f10ae8ebf797a1687c921bd7dd3113 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 11:26:24 +0200 Subject: [PATCH 233/323] extends SPARQL parser to recognize ORDER BY for FOLD --- jena-arq/Grammar/arq.jj | 39 +- jena-arq/Grammar/main.jj | 8 +- .../expr/aggregate/AggregatorFactory.java | 9 +- .../jena/sparql/lang/arq/ARQParser.java | 819 ++++- .../sparql/lang/sparql_11/JavaCharStream.java | 128 +- .../sparql/lang/sparql_11/ParseException.java | 48 +- .../sparql/lang/sparql_11/SPARQLParser11.java | 3044 ++++++++--------- .../sparql_11/SPARQLParser11TokenManager.java | 616 ++-- .../jena/sparql/lang/sparql_11/Token.java | 7 +- .../sparql/lang/sparql_11/TokenMgrError.java | 21 +- 10 files changed, 2759 insertions(+), 1980 deletions(-) diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 40445623781..0629207d816 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -300,6 +300,26 @@ void OrderCondition() : else getQuery().addOrderBy(v, direction) ; } } +SortCondition OrderConditionForAggregationFunction() : +{ int direction = 0 ; Expr expr = null ; Node v = null ; } +{ + { direction = Query.ORDER_DEFAULT ; } + ( + ( + ( { direction = Query.ORDER_ASCENDING ; } + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() + ) + | + ( expr = Constraint() + | v = Var() + ) + ) + { if ( v == null ) + return new SortCondition(expr, direction) ; + else + return new SortCondition(v, direction) ; } +} void LimitOffsetClauses() : { } { ( @@ -1625,14 +1645,25 @@ Expr Aggregate() : { Aggregator agg = null ; String sep = null ; | t = ( { distinct = true ; } )? expr = Expression() { agg = AggregatorFactory.createCustom(AggURI.var_pop, distinct, expr) ; } | t = - { Expr orderByExpr = null ; - Var orderByVar = null ; - int orderByDirection = Query.ORDER_DEFAULT ; } + { java.util.List scs = null ; + SortCondition sc = null ; } + ( { distinct = true ; } )? expr = Expression() ( expr2 = Expression() )? + ( + + ( + sc = OrderConditionForAggregationFunction() + { + if ( scs == null ) + scs = new java.util.ArrayList(); + scs.add(sc); + } + )+ + )? - { agg = AggregatorFactory.createFold(expr, expr2) ; } + { agg = AggregatorFactory.createFold(distinct, expr, expr2, scs) ; } | t = { String iri ; } iri = iri() diff --git a/jena-arq/Grammar/main.jj b/jena-arq/Grammar/main.jj index 9d60ec0173a..7cb8d7b9a3b 100644 --- a/jena-arq/Grammar/main.jj +++ b/jena-arq/Grammar/main.jj @@ -487,13 +487,13 @@ SortCondition OrderConditionForAggregationFunction() : ( ( // These are for clarity in the HTML ( { direction = Query.ORDER_ASCENDING ; } - | { direction = Query.ORDER_DESCENDING ; } ) - expr = BrackettedExpression() + | { direction = Query.ORDER_DESCENDING ; } ) + expr = BrackettedExpression() ) | ( expr = Constraint() - | v = Var() //{ expr = asExpr(v) ; } - ) + | v = Var() //{ expr = asExpr(v) ; } + ) ) { if ( v == null ) return new SortCondition(expr, direction) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index d11f16dfde9..6c492069c18 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -18,8 +18,11 @@ package org.apache.jena.sparql.expr.aggregate ; +import java.util.List; + import org.apache.jena.atlas.lib.NotImplemented ; import org.apache.jena.atlas.logging.Log ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.expr.Expr ; import org.apache.jena.sparql.expr.ExprList ; @@ -71,7 +74,11 @@ public static Aggregator createAggNull() { return new AggNull() ; } - public static Aggregator createFold(Expr expr1, Expr expr2) { + public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { + if ( distinct ) + throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; + if ( orderBy != null ) + System.out.println( "HERE!! " + orderBy.size() ); return new AggFold(expr1, expr2) ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 9b6244421d6..5f3968f7497 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -4537,6 +4537,59 @@ final public Var Var() throws ParseException { throw new Error("Missing return statement in function"); } +<<<<<<< HEAD +======= + final public Node GraphTerm() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: + case PNAME_NS: + case PNAME_LN: + iri = iri(); + {if (true) return createNode(iri) ;} + break; + case STRING_LITERAL1: + case STRING_LITERAL2: + case STRING_LITERAL_LONG1: + case STRING_LITERAL_LONG2: + n = RDFLiteral(); + {if (true) return n ;} + break; + case INTEGER: + case DECIMAL: + case DOUBLE: + case INTEGER_POSITIVE: + case DECIMAL_POSITIVE: + case DOUBLE_POSITIVE: + case INTEGER_NEGATIVE: + case DECIMAL_NEGATIVE: + case DOUBLE_NEGATIVE: + n = NumericLiteral(); + {if (true) return n ;} + break; + case TRUE: + case FALSE: + n = BooleanLiteral(); + {if (true) return n ;} + break; + case BLANK_NODE_LABEL: + case ANON: + n = BlankNode(); + {if (true) return n ;} + break; + case NIL: + jj_consume_token(NIL); + {if (true) return nRDFnil ;} + break; + default: + jj_la1[143] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) final public Expr Expression() throws ParseException { Expr expr ; expr = ConditionalOrExpression(); @@ -4554,7 +4607,11 @@ final public Expr ConditionalOrExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[143] = jj_gen; +======= + jj_la1[144] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_37; } jj_consume_token(SC_OR); @@ -4575,7 +4632,11 @@ final public Expr ConditionalAndExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[144] = jj_gen; +======= + jj_la1[145] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_38; } jj_consume_token(SC_AND); @@ -4648,13 +4709,21 @@ final public Expr RelationalExpression() throws ParseException { expr1 = new E_NotOneOf(expr1, a) ; break; default: +<<<<<<< HEAD jj_la1[145] = jj_gen; +======= + jj_la1[146] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } break; default: +<<<<<<< HEAD jj_la1[146] = jj_gen; +======= + jj_la1[147] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } {if (true) return expr1 ;} @@ -4685,7 +4754,11 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[147] = jj_gen; +======= + jj_la1[148] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_39; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4723,7 +4796,11 @@ final public Expr AdditiveExpression() throws ParseException { addition = false ; break; default: +<<<<<<< HEAD jj_la1[148] = jj_gen; +======= + jj_la1[149] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4735,7 +4812,11 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[149] = jj_gen; +======= + jj_la1[150] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_40; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4750,7 +4831,11 @@ final public Expr AdditiveExpression() throws ParseException { expr2 = new E_Divide(expr2, expr3) ; break; default: +<<<<<<< HEAD jj_la1[150] = jj_gen; +======= + jj_la1[151] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4761,7 +4846,11 @@ final public Expr AdditiveExpression() throws ParseException { expr1 = new E_Subtract(expr1, expr2) ; break; default: +<<<<<<< HEAD jj_la1[151] = jj_gen; +======= + jj_la1[152] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4783,7 +4872,11 @@ final public Expr MultiplicativeExpression() throws ParseException { ; break; default: +<<<<<<< HEAD jj_la1[152] = jj_gen; +======= + jj_la1[153] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_41; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4808,7 +4901,11 @@ final public Expr MultiplicativeExpression() throws ParseException { expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; default: +<<<<<<< HEAD jj_la1[153] = jj_gen; +======= + jj_la1[154] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4942,7 +5039,11 @@ final public Expr UnaryExpression() throws ParseException { {if (true) return expr ;} break; default: +<<<<<<< HEAD jj_la1[154] = jj_gen; +======= + jj_la1[155] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5080,7 +5181,11 @@ final public Expr PrimaryExpression() throws ParseException { {if (true) return asExpr(n) ;} break; default: +<<<<<<< HEAD jj_la1[155] = jj_gen; +======= + jj_la1[156] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5125,7 +5230,11 @@ final public Node ExprVarOrTerm() throws ParseException { n = ExprQuotedTriple(); break; default: +<<<<<<< HEAD jj_la1[156] = jj_gen; +======= + jj_la1[157] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5226,7 +5335,11 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: +<<<<<<< HEAD jj_la1[157] = jj_gen; +======= + jj_la1[158] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5242,7 +5355,11 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: +<<<<<<< HEAD jj_la1[158] = jj_gen; +======= + jj_la1[159] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5262,7 +5379,11 @@ final public Expr BuiltInCall() throws ParseException { {if (true) return makeFunction_BNode() ;} break; default: +<<<<<<< HEAD jj_la1[159] = jj_gen; +======= + jj_la1[160] = jj_gen; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -6290,7 +6411,10 @@ final public Expr Aggregate() throws ParseException { case SECONDS: case TIMEZONE: case TZ: +<<<<<<< HEAD case ADJUST: +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) case NOW: case UUID: case STRUUID: @@ -6638,13 +6762,43 @@ private boolean jj_2_5(int xla) { finally { jj_save(4, xla); } } +<<<<<<< HEAD private boolean jj_3R_101() { +======= + private boolean jj_3R_103() { + if (jj_3R_120()) return true; + return false; + } + + private boolean jj_3R_102() { + if (jj_scan_token(IS_NUMERIC)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_158() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_101() { + if (jj_scan_token(IS_LITERAL)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_100() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_100() { +======= + private boolean jj_3R_99() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -6710,35 +6864,68 @@ private boolean jj_3_2() { return false; } +<<<<<<< HEAD private boolean jj_3R_97() { +======= + private boolean jj_3R_98() { + if (jj_scan_token(IS_IRI)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_97() { + if (jj_scan_token(SAME_TERM)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_96() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_96() { +======= + private boolean jj_3R_95() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_95() { +======= + private boolean jj_3R_94() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_168() { +======= + private boolean jj_3R_159() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LBRACKET)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_94() { +======= + private boolean jj_3R_93() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_158() { if (jj_3R_168()) return true; return false; @@ -6778,53 +6965,121 @@ private boolean jj_3R_91() { } private boolean jj_3R_90() { +======= + private boolean jj_3R_92() { + if (jj_scan_token(COALESCE)) return true; + if (jj_3R_117()) return true; + return false; + } + + private boolean jj_3R_152() { + if (jj_3R_159()) return true; + return false; + } + + private boolean jj_3R_91() { + if (jj_scan_token(VERSION)) return true; + if (jj_scan_token(NIL)) return true; + return false; + } + + private boolean jj_3R_90() { + if (jj_scan_token(SHA512)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_126() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_151()) { + jj_scanpos = xsp; + if (jj_3R_152()) return true; + } + return false; + } + + private boolean jj_3R_151() { + if (jj_3R_158()) return true; + return false; + } + + private boolean jj_3R_89() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_89() { +======= + private boolean jj_3R_88() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_88() { +======= + private boolean jj_3R_87() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_87() { +======= + private boolean jj_3R_86() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_86() { +======= + private boolean jj_3R_85() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_85() { +======= + private boolean jj_3R_84() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_84() { +======= + private boolean jj_3R_83() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_83() { if (jj_scan_token(ADJUST)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; @@ -6922,7 +7177,11 @@ private boolean jj_3R_67() { } private boolean jj_3R_66() { +<<<<<<< HEAD if (jj_3R_120()) return true; +======= + if (jj_3R_119()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -6933,13 +7192,21 @@ private boolean jj_3R_65() { } private boolean jj_3R_64() { +<<<<<<< HEAD if (jj_3R_119()) return true; +======= + if (jj_3R_118()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; +<<<<<<< HEAD if (jj_3R_118()) return true; +======= + if (jj_3R_117()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -6985,12 +7252,20 @@ private boolean jj_3R_56() { return false; } +<<<<<<< HEAD private boolean jj_3R_117() { +======= + private boolean jj_3R_116() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NIL)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_116() { +======= + private boolean jj_3R_115() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LPAREN)) return true; return false; } @@ -6999,9 +7274,15 @@ private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_116()) { jj_scanpos = xsp; if (jj_3R_117()) return true; +======= + if (jj_3R_115()) { + jj_scanpos = xsp; + if (jj_3R_116()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -7049,7 +7330,11 @@ private boolean jj_3R_48() { } private boolean jj_3R_47() { +<<<<<<< HEAD if (jj_3R_115()) return true; +======= + if (jj_3R_114()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7182,10 +7467,14 @@ private boolean jj_3R_44() { jj_scanpos = xsp; if (jj_3R_109()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) return true; } +======= + if (jj_3R_110()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -7252,26 +7541,44 @@ private boolean jj_3R_44() { return false; } +<<<<<<< HEAD private boolean jj_3R_160() { +======= + private boolean jj_3R_154() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IRIref)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_178() { +======= + private boolean jj_3R_182() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(ANON)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_165() { Token xsp; xsp = jj_scanpos; if (jj_3R_177()) { jj_scanpos = xsp; if (jj_3R_178()) return true; +======= + private boolean jj_3R_172() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_181()) { + jj_scanpos = xsp; + if (jj_3R_182()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_177() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; @@ -7328,20 +7635,107 @@ private boolean jj_3R_182() { } private boolean jj_3R_181() { +======= + private boolean jj_3R_181() { + if (jj_scan_token(BLANK_NODE_LABEL)) return true; + return false; + } + + private boolean jj_3R_174() { + if (jj_scan_token(PNAME_NS)) return true; + return false; + } + + private boolean jj_3R_173() { + if (jj_scan_token(PNAME_LN)) return true; + return false; + } + + private boolean jj_3R_168() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_173()) { + jj_scanpos = xsp; + if (jj_3R_174()) return true; + } + return false; + } + + private boolean jj_3R_161() { + if (jj_3R_168()) return true; + return false; + } + + private boolean jj_3R_153() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_160()) { + jj_scanpos = xsp; + if (jj_3R_161()) return true; + } + return false; + } + + private boolean jj_3R_160() { + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_186() { + if (jj_scan_token(STRING_LITERAL_LONG2)) return true; + return false; + } + + private boolean jj_3R_185() { + if (jj_scan_token(STRING_LITERAL_LONG1)) return true; + return false; + } + + private boolean jj_3R_184() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL2)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_180() { +======= + private boolean jj_3R_183() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL1)) return true; return false; } +<<<<<<< HEAD +======= + private boolean jj_3R_175() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_183()) { + jj_scanpos = xsp; + if (jj_3R_184()) { + jj_scanpos = xsp; + if (jj_3R_185()) { + jj_scanpos = xsp; + if (jj_3R_186()) return true; + } + } + } + return false; + } + + private boolean jj_3R_180() { + if (jj_scan_token(FALSE)) return true; + return false; + } + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_180()) { + if (jj_3R_179()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_181()) { jj_scanpos = xsp; if (jj_3R_182()) { @@ -7349,10 +7743,14 @@ private boolean jj_3R_171() { if (jj_3R_183()) return true; } } +======= + if (jj_3R_180()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_176() { if (jj_scan_token(FALSE)) return true; return false; @@ -7369,38 +7767,85 @@ private boolean jj_3R_164() { } private boolean jj_3R_175() { +======= + private boolean jj_3R_179() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_197() { + private boolean jj_3R_145() { + if (jj_scan_token(LBRACE)) return true; + return false; + } + + private boolean jj_3R_198() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_196() { + private boolean jj_3R_197() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3R_195() { + private boolean jj_3_3() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_46()) return true; + return false; + } + + private boolean jj_3R_196() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_186() { +======= + private boolean jj_3R_189() { Token xsp; xsp = jj_scanpos; - if (jj_3R_195()) { - jj_scanpos = xsp; if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_197()) return true; + if (jj_3R_197()) { + jj_scanpos = xsp; + if (jj_3R_198()) return true; } } return false; } + private boolean jj_3R_195() { + if (jj_scan_token(DOUBLE_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_194() { + if (jj_scan_token(DECIMAL_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_193() { + if (jj_scan_token(INTEGER_POSITIVE)) return true; + return false; + } + + private boolean jj_3R_188() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) + Token xsp; + xsp = jj_scanpos; + if (jj_3R_193()) { + jj_scanpos = xsp; + if (jj_3R_194()) { + jj_scanpos = xsp; + if (jj_3R_195()) return true; + } + } + return false; + } + +<<<<<<< HEAD private boolean jj_3R_146() { if (jj_scan_token(LBRACE)) return true; return false; @@ -7422,14 +7867,27 @@ private boolean jj_3R_193() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_192() { - if (jj_scan_token(INTEGER_POSITIVE)) return true; + if (jj_scan_token(DOUBLE)) return true; + return false; + } + + private boolean jj_3R_191() { + if (jj_scan_token(DECIMAL)) return true; + return false; + } + + private boolean jj_3R_190() { + if (jj_scan_token(INTEGER)) return true; return false; } private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_192()) { jj_scanpos = xsp; if (jj_3R_193()) { @@ -7460,14 +7918,19 @@ private boolean jj_3R_184() { xsp = jj_scanpos; if (jj_3R_189()) { jj_scanpos = xsp; +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_191()) return true; + if (jj_3R_191()) { + jj_scanpos = xsp; + if (jj_3R_192()) return true; } } return false; } +<<<<<<< HEAD private boolean jj_3R_174() { if (jj_3R_186()) return true; return false; @@ -7480,6 +7943,64 @@ private boolean jj_3R_173() { private boolean jj_3R_172() { if (jj_3R_184()) return true; +======= + private boolean jj_3R_178() { + if (jj_3R_189()) return true; + return false; + } + + private boolean jj_3R_177() { + if (jj_3R_188()) return true; + return false; + } + + private boolean jj_3R_176() { + if (jj_3R_187()) return true; + return false; + } + + private boolean jj_3R_170() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_176()) { + jj_scanpos = xsp; + if (jj_3R_177()) { + jj_scanpos = xsp; + if (jj_3R_178()) return true; + } + } + return false; + } + + private boolean jj_3R_169() { + if (jj_3R_175()) return true; + return false; + } + + private boolean jj_3R_143() { + if (jj_scan_token(AGG)) return true; + if (jj_3R_153()) return true; + return false; + } + + private boolean jj_3R_167() { + if (jj_scan_token(NIL)) return true; + return false; + } + + private boolean jj_3R_166() { + if (jj_3R_172()) return true; + return false; + } + + private boolean jj_3R_165() { + if (jj_3R_171()) return true; + return false; + } + + private boolean jj_3R_164() { + if (jj_3R_170()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7496,7 +8017,35 @@ private boolean jj_3R_163() { return false; } + private boolean jj_3R_113() { + if (jj_3R_126()) return true; + return false; + } + + private boolean jj_3R_157() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_162()) { + jj_scanpos = xsp; + if (jj_3R_163()) { + jj_scanpos = xsp; + if (jj_3R_164()) { + jj_scanpos = xsp; + if (jj_3R_165()) { + jj_scanpos = xsp; + if (jj_3R_166()) { + jj_scanpos = xsp; + if (jj_3R_167()) return true; + } + } + } + } + } + return false; + } + private boolean jj_3R_162() { +<<<<<<< HEAD if (jj_3R_171()) return true; return false; } @@ -7508,6 +8057,28 @@ private boolean jj_3R_144() { } private boolean jj_3R_161() { +======= + if (jj_3R_153()) return true; + return false; + } + + private boolean jj_3R_46() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_112()) { + jj_scanpos = xsp; + if (jj_3R_113()) return true; + } + return false; + } + + private boolean jj_3R_112() { + if (jj_3R_125()) return true; + return false; + } + + private boolean jj_3R_156() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -7517,6 +8088,7 @@ private boolean jj_3R_161() { return false; } +<<<<<<< HEAD private boolean jj_3R_114() { if (jj_3R_127()) return true; return false; @@ -7537,6 +8109,8 @@ private boolean jj_3R_113() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; if (jj_3R_46()) return true; @@ -7548,59 +8122,100 @@ private boolean jj_3_1() { return false; } +<<<<<<< HEAD private boolean jj_3R_143() { +======= + private boolean jj_3R_142() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(FOLD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_142() { +======= + private boolean jj_3R_141() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_141() { +======= + private boolean jj_3R_140() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_140() { +======= + private boolean jj_3R_139() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_139() { +======= + private boolean jj_3R_138() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_138() { +======= + private boolean jj_3R_137() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_145() { if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_137() { +======= + private boolean jj_3R_136() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_118() { +======= + private boolean jj_3R_144() { + if (jj_scan_token(LPAREN)) return true; + return false; + } + + private boolean jj_3R_117() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(187)) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_145()) return true; +======= + if (jj_3R_144()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -7611,23 +8226,37 @@ private boolean jj_3_5() { return false; } +<<<<<<< HEAD private boolean jj_3R_166() { if (jj_scan_token(LT2)) return true; return false; } private boolean jj_3R_136() { +======= + private boolean jj_3R_135() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_135() { +======= + private boolean jj_3R_124() { + if (jj_3R_147()) return true; + return false; + } + + private boolean jj_3R_134() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_156() { if (jj_3R_166()) return true; return false; @@ -7639,11 +8268,15 @@ private boolean jj_3R_155() { } private boolean jj_3R_134() { +======= + private boolean jj_3R_133() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_125() { if (jj_3R_148()) return true; return false; @@ -7660,11 +8293,27 @@ private boolean jj_3R_153() { } private boolean jj_3R_133() { +======= + private boolean jj_3R_147() { + if (jj_scan_token(PREFIX)) return true; + if (jj_scan_token(PNAME_NS)) return true; + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_155() { + if (jj_scan_token(LT2)) return true; + return false; + } + + private boolean jj_3R_132() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_152() { if (jj_3R_163()) return true; return false; @@ -7676,11 +8325,15 @@ private boolean jj_3R_151() { } private boolean jj_3R_132() { +======= + private boolean jj_3R_131() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_148() { if (jj_scan_token(PREFIX)) return true; if (jj_scan_token(PNAME_NS)) return true; @@ -7690,20 +8343,33 @@ private boolean jj_3R_148() { private boolean jj_3R_150() { if (jj_3R_159()) return true; +======= + private boolean jj_3R_150() { + if (jj_3R_157()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_149() { +<<<<<<< HEAD if (jj_3R_161()) return true; return false; } private boolean jj_3R_131() { +======= + if (jj_3R_156()) return true; + return false; + } + + private boolean jj_3R_130() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; @@ -7733,17 +8399,64 @@ private boolean jj_3R_126() { } private boolean jj_3R_130() { +======= + private boolean jj_3R_148() { + if (jj_3R_155()) return true; + return false; + } + + private boolean jj_3R_146() { + if (jj_scan_token(BASE)) return true; + if (jj_3R_154()) return true; + return false; + } + + private boolean jj_3R_129() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_129() { +======= + private boolean jj_3R_125() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_148()) { + jj_scanpos = xsp; + if (jj_3R_149()) { + jj_scanpos = xsp; + if (jj_3R_150()) return true; + } + } + return false; + } + + private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) { + jj_scanpos = xsp; + if (jj_3R_124()) return true; + } + return false; + } + + private boolean jj_3R_123() { + if (jj_3R_146()) return true; + return false; + } + + private boolean jj_3R_128() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_147() { if (jj_scan_token(BASE)) return true; if (jj_3R_160()) return true; @@ -7765,24 +8478,42 @@ private boolean jj_3R_124() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_45() { Token xsp; while (true) { xsp = jj_scanpos; +<<<<<<< HEAD if (jj_3R_112()) { jj_scanpos = xsp; break; } +======= + if (jj_3R_111()) { jj_scanpos = xsp; break; } +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } +<<<<<<< HEAD private boolean jj_3R_128() { +======= + private boolean jj_3R_127() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; +======= + private boolean jj_3R_114() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_127()) { + jj_scanpos = xsp; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_128()) { jj_scanpos = xsp; if (jj_3R_129()) { @@ -7813,9 +8544,13 @@ private boolean jj_3R_115() { jj_scanpos = xsp; if (jj_3R_142()) { jj_scanpos = xsp; +<<<<<<< HEAD if (jj_3R_143()) { jj_scanpos = xsp; if (jj_3R_144()) return true; +======= + if (jj_3R_143()) return true; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -7835,12 +8570,17 @@ private boolean jj_3R_115() { return false; } +<<<<<<< HEAD private boolean jj_3R_123() { +======= + private boolean jj_3R_122() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_122() { if (jj_scan_token(EXISTS)) return true; if (jj_3R_146()) return true; @@ -7848,53 +8588,89 @@ private boolean jj_3R_122() { } private boolean jj_3R_120() { +======= + private boolean jj_3R_121() { + if (jj_scan_token(EXISTS)) return true; + if (jj_3R_145()) return true; + return false; + } + + private boolean jj_3R_119() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_119() { +======= + private boolean jj_3R_118() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_121() { +======= + private boolean jj_3R_120() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REGEX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_111() { +======= + private boolean jj_3R_110() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(OBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_110() { +======= + private boolean jj_3R_109() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(PREDICATE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_109() { +======= + private boolean jj_3R_108() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } +<<<<<<< HEAD private boolean jj_3R_108() { +======= + private boolean jj_3R_107() { +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_106() { +<<<<<<< HEAD if (jj_3R_123()) return true; return false; } private boolean jj_3R_107() { +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -7910,6 +8686,7 @@ private boolean jj_3R_104() { return false; } +<<<<<<< HEAD private boolean jj_3R_167() { if (jj_scan_token(LPAREN)) return true; return false; @@ -7927,6 +8704,8 @@ private boolean jj_3R_102() { return false; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -7958,6 +8737,7 @@ private boolean jj_3R_102() { jj_la1_init_7(); } private static void jj_la1_init_0() { +<<<<<<< HEAD jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { @@ -7977,6 +8757,27 @@ private static void jj_la1_init_5() { } private static void jj_la1_init_6() { jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x801,0x0,0x8,0x801,0x801,0x801,0x0,0x8,0x801,0x0,0x801,0x8,0x0,0x801,0x0,0x8,0x801,0x801,0x8,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x800,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x8,0x801,0x0,0x2,0x0,0x0,0x4,0x801,0x8004000,0x8004000,0x2,0x8004000,0x8004000,0x4,0x4000000,0x8400000,0x8400000,0x40280000,0x8004000,0x0,0x4,0x280004,0x40280000,0x4000,0x4000000,0x8000000,0x8000000,0x0,0x8000000,0x0,0x0,0x801,0x801,0x1000,0x1000,0x801,0x801,0x801,0x0,0x800,0x0,0x1,0x0,0x20000,0x40000,0x3f0,0x3f0,0x180000,0x0,0x600000,0x600000,0x180000,0x600000,0x600000,0x184800,0x800,0x800,0x4,0x4,0x0,0x4,0x4,0x0,0x4,0x4,0x4,0x0,0x384800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,}; +======= + jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0018,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } private static void jj_la1_init_7() { jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java index 073cf097d1e..69a6e501578 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -87,9 +87,7 @@ static final int hexval(char c) throws java.io.IOException { protected int maxNextCharInd = 0; protected int nextCharInd = -1; protected int inBuf = 0; - protected int tabSize = 1; - protected boolean trackLineColumn = true; - + protected int tabSize = 8; @SuppressWarnings("all") public void setTabSize(int i) { tabSize = i; } @@ -288,7 +286,7 @@ public char readChar() throws java.io.IOException if ((buffer[bufpos] = c = ReadByte()) == '\\') { - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); int backSlashCnt = 1; @@ -301,7 +299,7 @@ public char readChar() throws java.io.IOException { if ((buffer[bufpos] = c = ReadByte()) != '\\') { - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { @@ -324,7 +322,7 @@ public char readChar() throws java.io.IOException return '\\'; } - if (trackLineColumn) { UpdateLineColumn(c); } + UpdateLineColumn(c); backSlashCnt++; } @@ -362,7 +360,8 @@ public char readChar() throws java.io.IOException } } - /* + @Deprecated + /** * @deprecated * @see #getEndColumn */ @@ -373,10 +372,10 @@ public int getColumn() { return bufcolumn[bufpos]; } - /* + @Deprecated + /** * @deprecated * @see #getEndLine - * @return the line number. */ @Deprecated @@ -403,9 +402,14 @@ public int getEndLine() { return bufline[bufpos]; } +<<<<<<< HEAD /** Get the beginning column. * @return column of token start */ +======= +/** @return column of token start */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getBeginColumn() { return bufcolumn[tokenBegin]; @@ -428,6 +432,7 @@ public void backup(int amount) { bufpos += bufsize; } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -435,6 +440,10 @@ public void backup(int amount) { * @param buffersize size of the buffer */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -450,12 +459,17 @@ public JavaCharStream(java.io.Reader dstream, nextCharBuf = new char[4096]; } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) @@ -463,17 +477,27 @@ public JavaCharStream(java.io.Reader dstream, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -495,8 +519,13 @@ public void ReInit(java.io.Reader dstream, nextCharInd = bufpos = -1; } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn) @@ -504,8 +533,13 @@ public void ReInit(java.io.Reader dstream, ReInit(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /* Reinitialise. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream) { @@ -520,6 +554,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -527,13 +562,18 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin * @param buffersize size of the buffer */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -542,6 +582,10 @@ public JavaCharStream(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException @@ -549,12 +593,17 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(dstream, encoding, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn) @@ -562,28 +611,39 @@ public JavaCharStream(java.io.InputStream dstream, int startline, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ +======= +/** Constructor. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -592,6 +652,10 @@ public JavaCharStream(java.io.InputStream dstream) * @param buffersize size of the buffer */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException @@ -599,6 +663,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -606,12 +671,17 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, * @param buffersize size of the buffer */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -620,49 +690,73 @@ public void ReInit(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. */ +======= +/** Reinitialise. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } +<<<<<<< HEAD /** Get the token timage. * @return token image as String */ +======= + /** @return token image as String */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public String GetImage() { @@ -673,10 +767,15 @@ public String GetImage() new String(buffer, 0, bufpos + 1); } +<<<<<<< HEAD /** Get the suffix as an array of characters. * @param len the length of the array to return. * @return suffix */ +======= + /** @return suffix */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char[] GetSuffix(int len) { @@ -707,9 +806,6 @@ public void Done() /** * Method to adjust line and column numbers for the start of a token. - * - * @param newLine the new line number. - * @param newCol the new column number. */ @SuppressWarnings("all") @@ -756,8 +852,6 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } - boolean getTrackLineColumn() { return trackLineColumn; } - void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } } -/* JavaCC - OriginalChecksum=9698f3eb5988f4ff314d1b8207763eb1 (do not edit this line) */ +/* JavaCC - OriginalChecksum=d63a793bd614cb11b1bb35c273b7864c (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java index da8e2a3c81f..2c32e0affd0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ -/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -20,11 +20,6 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; - /** - * The end of line string for this machine. - */ - protected static String EOL = System.getProperty("line.separator", "\n"); - /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -65,7 +60,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * following this token will (therefore) be the first error token. + * followng this token will (therefore) be the first error token. */ public Token currentToken; @@ -93,8 +88,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - - StringBuilder expected = new StringBuilder(); + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -106,7 +101,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(EOL).append(" "); + expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -122,26 +117,21 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - if (currentToken.next != null) { - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - } - retval += "." + EOL; - - - if (expectedTokenSequences.length == 0) { - // Nothing to add here + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; } else { - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + EOL + " "; - } else { - retval += "Was expecting one of:" + EOL + " "; - } - retval += expected.toString(); + retval += "Was expecting one of:" + eol + " "; } - + retval += expected.toString(); return retval; } + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -149,11 +139,13 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -192,4 +184,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=4221abc4e598fc22c5ec0c1f20bcec78 (do not edit this line) */ +/* JavaCC - OriginalChecksum=25807f74c6efb1bcbd3321a6af1d8604 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java index b44b9e57649..922d77ffdf1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java @@ -1,4 +1,3 @@ -/* SPARQLParser11.java */ /* Generated By:JavaCC: Do not edit this line. SPARQLParser11.java */ package org.apache.jena.sparql.lang.sparql_11 ; import org.apache.jena.graph.* ; @@ -16,112 +15,105 @@ public class SPARQLParser11 extends SPARQLParser11Base implements SPARQLParser11 final public void QueryUnit() throws ParseException { ByteOrderMark(); -startQuery() ; + startQuery() ; Query(); jj_consume_token(0); -finishQuery() ; -} + finishQuery() ; + } final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: SelectQuery(); break; - } - case CONSTRUCT:{ + case CONSTRUCT: ConstructQuery(); break; - } - case DESCRIBE:{ + case DESCRIBE: DescribeQuery(); break; - } - case ASK:{ + case ASK: AskQuery(); break; - } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); -} + } final public void UpdateUnit() throws ParseException { ByteOrderMark(); -startUpdateRequest() ; + startUpdateRequest() ; Update(); jj_consume_token(0); -finishUpdateRequest() ; -} + finishUpdateRequest() ; + } final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BOM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOM: jj_consume_token(BOM); break; - } default: jj_la1[1] = jj_gen; ; } -} + } final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BASE: - case PREFIX:{ + case PREFIX: ; break; - } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BASE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BASE: BaseDecl(); break; - } - case PREFIX:{ + case PREFIX: PrefixDecl(); break; - } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -} + } - final public void BaseDecl() throws ParseException {Token t ; String iri ; + final public void BaseDecl() throws ParseException { + Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); -setBase(iri, t.beginLine, t.beginColumn ) ; -} + setBase(iri, t.beginLine, t.beginColumn ) ; + } - final public void PrefixDecl() throws ParseException {Token t ; String iri ; + final public void PrefixDecl() throws ParseException { + Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); -String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); + String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; -} + } final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[4] = jj_gen; break label_2; @@ -130,115 +122,108 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); -} + } - final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException { + Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); -getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DISTINCT: - case REDUCED:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + case REDUCED: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -getQuery().setDistinct(true); + getQuery().setDistinct(true); break; - } - case REDUCED:{ + case REDUCED: jj_consume_token(REDUCED); -getQuery().setReduced(true); + getQuery().setReduced(true); break; - } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[6] = jj_gen; ; } -setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: case VAR2: - case LPAREN:{ + case LPAREN: label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addResultVar(v) ; + getQuery().addResultVar(v) ; break; - } - case LPAREN:{ -v = null ; + case LPAREN: + v = null ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -getQuery().addResultVar(v, expr) ; -getQuery().setQueryResultStar(false) ; + getQuery().addResultVar(v, expr) ; + getQuery().setQueryResultStar(false) ; break; - } default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: case VAR2: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[8] = jj_gen; break label_3; } } break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void ConstructQuery() throws ParseException {Template t ; + final public void ConstructQuery() throws ParseException { + Template t ; TripleCollectorBGP acc = new TripleCollectorBGP() ; jj_consume_token(CONSTRUCT); -getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: t = ConstructTemplate(); -getQuery().setConstructTemplate(t) ; + getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[10] = jj_gen; break label_4; @@ -248,16 +233,14 @@ final public void SubSelect() throws ParseException { WhereClause(); SolutionModifier(); break; - } case FROM: - case WHERE:{ + case WHERE: label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[11] = jj_gen; break label_5; @@ -266,7 +249,7 @@ final public void SubSelect() throws ParseException { } jj_consume_token(WHERE); jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -291,66 +274,62 @@ final public void SubSelect() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[12] = jj_gen; ; } jj_consume_token(RBRACE); SolutionModifier(); -t = new Template(acc.getBGP()) ; + t = new Template(acc.getBGP()) ; getQuery().setConstructTemplate(t) ; ElementPathBlock epb = new ElementPathBlock(acc.getBGP()) ; ElementGroup elg = new ElementGroup() ; elg.addElement(epb) ; getQuery().setQueryPattern(elg) ; break; - } default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DescribeQuery() throws ParseException {Node n ; + final public void DescribeQuery() throws ParseException { + Node n ; jj_consume_token(DESCRIBE); -getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: label_6: while (true) { n = VarOrIri(); -getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[14] = jj_gen; break label_6; } } -getQuery().setQueryResultStar(false) ; + getQuery().setQueryResultStar(false) ; break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -getQuery().setQueryResultStar(true) ; + getQuery().setQueryResultStar(true) ; break; - } default: jj_la1[15] = jj_gen; jj_consume_token(-1); @@ -358,40 +337,37 @@ final public void SubSelect() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[16] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WHERE: - case LBRACE:{ + case LBRACE: WhereClause(); break; - } default: jj_la1[17] = jj_gen; ; } SolutionModifier(); -} + } final public void AskQuery() throws ParseException { jj_consume_token(ASK); -getQuery().setQueryAskType() ; + getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case FROM:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FROM: ; break; - } default: jj_la1[18] = jj_gen; break label_8; @@ -400,100 +376,97 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); -} + } final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: DefaultGraphClause(); break; - } - case NAMED:{ + case NAMED: NamedGraphClause(); break; - } default: jj_la1[19] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void DefaultGraphClause() throws ParseException {String iri ; + final public void DefaultGraphClause() throws ParseException { + String iri ; iri = SourceSelector(); -getQuery().addGraphURI(iri) ; -} + getQuery().addGraphURI(iri) ; + } - final public void NamedGraphClause() throws ParseException {String iri ; + final public void NamedGraphClause() throws ParseException { + String iri ; jj_consume_token(NAMED); iri = SourceSelector(); -getQuery().addNamedGraphURI(iri) ; -} + getQuery().addNamedGraphURI(iri) ; + } - final public String SourceSelector() throws ParseException {String iri ; + final public String SourceSelector() throws ParseException { + String iri ; iri = iri(); -{if ("" != null) return iri ;} + {if (true) return iri ;} throw new Error("Missing return statement in function"); -} + } - final public void WhereClause() throws ParseException {Element el ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WHERE:{ + final public void WhereClause() throws ParseException { + Element el ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: jj_consume_token(WHERE); break; - } default: jj_la1[20] = jj_gen; ; } -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -getQuery().setQueryPattern(el) ; -finishWherePattern() ; -} + getQuery().setQueryPattern(el) ; + finishWherePattern() ; + } final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GROUP:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GROUP: GroupClause(); break; - } default: jj_la1[21] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case HAVING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HAVING: HavingClause(); break; - } default: jj_la1[22] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ORDER:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ORDER: OrderClause(); break; - } default: jj_la1[23] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIMIT: - case OFFSET:{ + case OFFSET: LimitOffsetClauses(); break; - } default: jj_la1[24] = jj_gen; ; } -} + } final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -501,7 +474,7 @@ final public void GroupClause() throws ParseException { label_9: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -568,19 +541,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[25] = jj_gen; break label_9; } } -} + } - final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void GroupCondition() throws ParseException { + Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXISTS: case NOT: case COUNT: @@ -641,55 +614,50 @@ final public void GroupClause() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = FunctionCall(); -getQuery().addGroupBy((Var)null, expr) ; + getQuery().addGroupBy((Var)null, expr) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case AS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AS: jj_consume_token(AS); v = Var(); break; - } default: jj_la1[26] = jj_gen; ; } jj_consume_token(RPAREN); -getQuery().addGroupBy(v ,expr) ; + getQuery().addGroupBy(v ,expr) ; break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); -getQuery().addGroupBy(v) ; + getQuery().addGroupBy(v) ; break; - } default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void HavingClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_10: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -754,31 +722,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[28] = jj_gen; break label_10; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void HavingCondition() throws ParseException {Expr c ; + final public void HavingCondition() throws ParseException { + Expr c ; c = Constraint(); -getQuery().addHavingCondition(c) ; -} + getQuery().addHavingCondition(c) ; + } final public void OrderClause() throws ParseException { -setAllowAggregatesInExpressions(true) ; + setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_11: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -847,34 +815,32 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: ; break; - } default: jj_la1[29] = jj_gen; break label_11; } } -setAllowAggregatesInExpressions(false) ; -} + setAllowAggregatesInExpressions(false) ; + } - final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; -direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void OrderCondition() throws ParseException { + int direction = 0 ; Expr expr = null ; Node v = null ; + direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASC: - case DESC:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case ASC:{ + case DESC: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASC: jj_consume_token(ASC); -direction = Query.ORDER_ASCENDING ; + direction = Query.ORDER_ASCENDING ; break; - } - case DESC:{ + case DESC: jj_consume_token(DESC); -direction = Query.ORDER_DESCENDING ; + direction = Query.ORDER_DESCENDING ; break; - } default: jj_la1[30] = jj_gen; jj_consume_token(-1); @@ -882,7 +848,6 @@ final public void OrderClause() throws ParseException { } expr = BrackettedExpression(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -949,8 +914,8 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1015,98 +980,93 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN:{ + case LPAREN: expr = Constraint(); break; - } case VAR1: - case VAR2:{ + case VAR2: v = Var(); break; - } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[32] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( v == null ) + if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; -} + } final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case OFFSET:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OFFSET: OffsetClause(); break; - } default: jj_la1[33] = jj_gen; ; } break; - } - case OFFSET:{ + case OFFSET: OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LIMIT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: LimitClause(); break; - } default: jj_la1[34] = jj_gen; ; } break; - } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void LimitClause() throws ParseException {Token t ; + final public void LimitClause() throws ParseException { + Token t ; jj_consume_token(LIMIT); t = jj_consume_token(INTEGER); -getQuery().setLimit(integerValue(t.image)) ; -} + getQuery().setLimit(integerValue(t.image)) ; + } - final public void OffsetClause() throws ParseException {Token t ; + final public void OffsetClause() throws ParseException { + Token t ; jj_consume_token(OFFSET); t = jj_consume_token(INTEGER); -getQuery().setOffset(integerValue(t.image)) ; -} + getQuery().setOffset(integerValue(t.image)) ; + } - final public void ValuesClause() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VALUES:{ + final public void ValuesClause() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VALUES: t = jj_consume_token(VALUES); -startValuesClause(t.beginLine, t.beginColumn) ; + startValuesClause(t.beginLine, t.beginColumn) ; DataBlock(); -finishValuesClause(t.beginLine, t.beginColumn) ; + finishValuesClause(t.beginLine, t.beginColumn) ; break; - } default: jj_la1[36] = jj_gen; ; } -} + } final public void Update() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INSERT: case DELETE: case INSERT_DATA: @@ -1119,170 +1079,157 @@ final public void Update() throws ParseException { case MOVE: case COPY: case DROP: - case WITH:{ + case WITH: Update1(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); Update(); break; - } default: jj_la1[37] = jj_gen; ; } break; - } default: jj_la1[38] = jj_gen; ; } -} + } - final public void Update1() throws ParseException {Update up = null ; -startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LOAD:{ + final public void Update1() throws ParseException { + Update up = null ; + startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOAD: up = Load(); break; - } - case CLEAR:{ + case CLEAR: up = Clear(); break; - } - case DROP:{ + case DROP: up = Drop(); break; - } - case ADD:{ + case ADD: up = Add(); break; - } - case MOVE:{ + case MOVE: up = Move(); break; - } - case COPY:{ + case COPY: up = Copy(); break; - } - case CREATE:{ + case CREATE: up = Create(); break; - } - case DELETE_WHERE:{ + case DELETE_WHERE: up = DeleteWhere(); break; - } case INSERT: case DELETE: - case WITH:{ + case WITH: up = Modify(); break; - } - case INSERT_DATA:{ + case INSERT_DATA: InsertData(); break; - } - case DELETE_DATA:{ + case DELETE_DATA: DeleteData(); break; - } default: jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if (null != up) emitUpdate(up) ; + if (null != up) emitUpdate(up) ; finishUpdateOperation() ; -} + } - final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; + final public Update Load() throws ParseException { + String url ; Node dest = null ; boolean silent = false ; jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[40] = jj_gen; ; } url = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTO:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTO: jj_consume_token(INTO); dest = GraphRef(); break; - } default: jj_la1[41] = jj_gen; ; } -{if ("" != null) return new UpdateLoad(url, dest, silent) ;} + {if (true) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Clear() throws ParseException {boolean silent = false ; Target target ; + final public Update Clear() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[42] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateClear(target, silent) ;} + {if (true) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Drop() throws ParseException {boolean silent = false ; Target target ; + final public Update Drop() throws ParseException { + boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent = true ; + silent = true ; break; - } default: jj_la1[43] = jj_gen; ; } target = GraphRefAll(); -{if ("" != null) return new UpdateDrop(target, silent) ;} + {if (true) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Create() throws ParseException {Node iri ; boolean silent = false ; + final public Update Create() throws ParseException { + Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[44] = jj_gen; ; } iri = GraphRef(); -{if ("" != null) return new UpdateCreate(iri, silent) ;} + {if (true) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[45] = jj_gen; ; @@ -1290,18 +1237,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateAdd(src, dest, silent) ;} + {if (true) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[46] = jj_gen; ; @@ -1309,18 +1256,18 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateMove(src, dest, silent) ;} + {if (true) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException { + Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true ; + silent=true ; break; - } default: jj_la1[47] = jj_gen; ; @@ -1328,70 +1275,70 @@ final public void Update() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); -{if ("" != null) return new UpdateCopy(src, dest, silent) ;} + {if (true) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException { + QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataInsert(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataInsert(qd, beginLine, beginColumn) ; + finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException { + QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDataDelete(qd, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); -finishDataDelete(qd, beginLine, beginColumn) ; + finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; -} + } - final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException { + QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -{if ("" != null) return new UpdateDeleteWhere(qp) ;} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + {if (true) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); -} + } - final public Update Modify() throws ParseException {Element el ; String iri = null ; + final public Update Modify() throws ParseException { + Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; -startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case WITH:{ + startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WITH: jj_consume_token(WITH); iri = iri(); -Node n = createNode(iri) ; up.setWithIRI(n) ; + Node n = createNode(iri) ; up.setWithIRI(n) ; break; - } default: jj_la1[48] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DELETE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DELETE: DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INSERT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INSERT: InsertClause(up); break; - } default: jj_la1[49] = jj_gen; ; } break; - } - case INSERT:{ + case INSERT: InsertClause(up); break; - } default: jj_la1[50] = jj_gen; jj_consume_token(-1); @@ -1399,11 +1346,10 @@ final public void Update() throws ParseException { } label_12: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case USING:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case USING: ; break; - } default: jj_la1[51] = jj_gen; break label_12; @@ -1411,139 +1357,136 @@ final public void Update() throws ParseException { UsingClause(up); } jj_consume_token(WHERE); -startWherePattern() ; + startWherePattern() ; el = GroupGraphPattern(); -up.setElement(el) ; -finishWherePattern() ; -finishModifyUpdate() ; -{if ("" != null) return up ;} + up.setElement(el) ; + finishWherePattern() ; + finishModifyUpdate() ; + {if (true) return up ;} throw new Error("Missing return statement in function"); -} + } - final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startDeleteTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishDeleteTemplate(qp, beginLine, beginColumn) ; -up.setHasDeleteClause(true) ; -} + finishDeleteTemplate(qp, beginLine, beginColumn) ; + up.setHasDeleteClause(true) ; + } - final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException { + QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -startInsertTemplate(qp, beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); -finishInsertTemplate(qp, beginLine, beginColumn) ; -up.setHasInsertClause(true) ; -} + finishInsertTemplate(qp, beginLine, beginColumn) ; + up.setHasInsertClause(true) ; + } - final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException { + String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; update.addUsing(n) ; + n = createNode(iri) ; update.addUsing(n) ; break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); iri = iri(); -n = createNode(iri) ; update.addUsingNamed(n) ; + n = createNode(iri) ; update.addUsingNamed(n) ; break; - } default: jj_la1[52] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public Target GraphOrDefault() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DFT:{ + final public Target GraphOrDefault() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + case GRAPH: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: jj_consume_token(GRAPH); break; - } default: jj_la1[53] = jj_gen; ; } iri = iri(); -{if ("" != null) return Target.create(createNode(iri)) ;} + {if (true) return Target.create(createNode(iri)) ;} break; - } default: jj_la1[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphRef() throws ParseException {String iri ; + final public Node GraphRef() throws ParseException { + String iri ; jj_consume_token(GRAPH); iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} throw new Error("Missing return statement in function"); -} + } - final public Target GraphRefAll() throws ParseException {Node iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + final public Target GraphRefAll() throws ParseException { + Node iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: iri = GraphRef(); -{if ("" != null) return Target.create(iri) ;} + {if (true) return Target.create(iri) ;} break; - } - case DFT:{ + case DFT: jj_consume_token(DFT); -{if ("" != null) return Target.DEFAULT ;} + {if (true) return Target.DEFAULT ;} break; - } - case NAMED:{ + case NAMED: jj_consume_token(NAMED); -{if ("" != null) return Target.NAMED ;} + {if (true) return Target.NAMED ;} break; - } - case ALL:{ + case ALL: jj_consume_token(ALL); -{if ("" != null) return Target.ALL ;} + {if (true) return Target.ALL ;} break; - } default: jj_la1[55] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); -} + } final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1568,36 +1511,33 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[56] = jj_gen; ; } label_13: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GRAPH: ; break; - } default: jj_la1[57] = jj_gen; break label_13; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[58] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1622,23 +1562,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[59] = jj_gen; ; } } -} + } - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { + Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrIri(); -setAccGraph(acc, gn) ; + setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1663,24 +1603,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[60] = jj_gen; ; } jj_consume_token(RBRACE); -setAccGraph(acc, prev) ; -} + setAccGraph(acc, prev) ; + } final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1705,46 +1644,45 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesTemplate(acc); break; - } default: jj_la1[61] = jj_gen; ; } break; - } default: jj_la1[62] = jj_gen; ; } -} + } - final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException { + Element el = null ; Token t ; t = jj_consume_token(LBRACE); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SELECT:{ -startSubSelect(beginLine, beginColumn) ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SELECT: + startSubSelect(beginLine, beginColumn) ; SubSelect(); -Query q = endSubSelect(beginLine, beginColumn) ; + Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; - } default: jj_la1[63] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; -ElementGroup elg = new ElementGroup() ; -startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException { + Element el = null ; + ElementGroup elg = new ElementGroup() ; + startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1769,20 +1707,19 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ -startTriplesBlock() ; + case ANON: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[64] = jj_gen; ; } label_14: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -1790,26 +1727,24 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case BIND: case SERVICE: case FILTER: - case LBRACE:{ + case LBRACE: ; break; - } default: jj_la1[65] = jj_gen; break label_14; } el = GraphPatternNotTriples(); -elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); break; - } default: jj_la1[66] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1834,31 +1769,30 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ -startTriplesBlock() ; + case ANON: + startTriplesBlock() ; el = TriplesBlock(null); -endTriplesBlock() ; + endTriplesBlock() ; elg.addElement(el) ; break; - } default: jj_la1[67] = jj_gen; ; } } -endGroup(elg) ; -{if ("" != null) return elg ;} + endGroup(elg) ; + {if (true) return elg ;} throw new Error("Missing return statement in function"); -} + } final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { -if ( acc == null ) + if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1883,149 +1817,143 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: TriplesBlock(acc); break; - } default: jj_la1[68] = jj_gen; ; } break; - } default: jj_la1[69] = jj_gen; ; } -{if ("" != null) return acc ;} + {if (true) return acc ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LBRACE:{ + final public Element GraphPatternNotTriples() throws ParseException { + Element el = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: el = GroupOrUnionGraphPattern(); break; - } - case OPTIONAL:{ + case OPTIONAL: el = OptionalGraphPattern(); break; - } - case MINUS_P:{ + case MINUS_P: el = MinusGraphPattern(); break; - } - case GRAPH:{ + case GRAPH: el = GraphGraphPattern(); break; - } - case SERVICE:{ + case SERVICE: el = ServiceGraphPattern(); break; - } - case FILTER:{ + case FILTER: el = Filter(); break; - } - case BIND:{ + case BIND: el = Bind(); break; - } - case VALUES:{ + case VALUES: el = InlineData(); break; - } default: jj_la1[70] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return el ;} + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } - final public Element OptionalGraphPattern() throws ParseException {Element el ; + final public Element OptionalGraphPattern() throws ParseException { + Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); -{if ("" != null) return new ElementOptional(el) ;} + {if (true) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException { + Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementNamedGraph(n, el) ;} + {if (true) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException { + Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SILENT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SILENT: jj_consume_token(SILENT); -silent=true; + silent=true; break; - } default: jj_la1[71] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); -{if ("" != null) return new ElementService(n, el, silent) ;} + {if (true) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); -} + } - final public Element Bind() throws ParseException {Var v ; Expr expr ; + final public Element Bind() throws ParseException { + Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new ElementBind(v, expr) ;} + {if (true) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); -} + } - final public Element InlineData() throws ParseException {ElementData el ; Token t ; + final public Element InlineData() throws ParseException { + ElementData el ; Token t ; t = jj_consume_token(VALUES); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -el = new ElementData() ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); -finishInlineData(beginLine, beginColumn) ; - {if ("" != null) return el ;} + finishInlineData(beginLine, beginColumn) ; + {if (true) return el ;} throw new Error("Missing return statement in function"); -} + } final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: InlineDataOneVar(); break; - } case LPAREN: - case NIL:{ + case NIL: InlineDataFull(); break; - } default: jj_la1[72] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } - final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException { + Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2044,48 +1972,45 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: ; break; - } default: jj_la1[73] = jj_gen; break label_15; } n = DataBlockValue(); -startDataBlockValueRow(beginLine, beginColumn) ; + startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); -} + } - final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public void InlineDataFull() throws ParseException { + Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: ; break; - } default: jj_la1[74] = jj_gen; break label_16; } v = Var(); -emitDataBlockVariable(v) ; + emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[75] = jj_gen; jj_consume_token(-1); @@ -2094,24 +2019,23 @@ final public void DataBlock() throws ParseException { jj_consume_token(LBRACE); label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: ; break; - } default: jj_la1[76] = jj_gen; break label_17; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: t = jj_consume_token(LPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; label_18: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2130,29 +2054,26 @@ final public void DataBlock() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: ; break; - } default: jj_la1[77] = jj_gen; break label_18; } n = DataBlockValue(); -emitDataBlockValue(n, beginLine, beginColumn) ; + emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } - case NIL:{ + case NIL: t = jj_consume_token(NIL); -beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; -startDataBlockValueRow(beginLine, beginColumn) ; -finishDataBlockValueRow(beginLine, beginColumn) ; + beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; + startDataBlockValueRow(beginLine, beginColumn) ; + finishDataBlockValueRow(beginLine, beginColumn) ; break; - } default: jj_la1[78] = jj_gen; jj_consume_token(-1); @@ -2160,25 +2081,24 @@ final public void DataBlock() throws ParseException { } } jj_consume_token(RBRACE); -} + } - final public Node DataBlockValue() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node DataBlockValue() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -2187,76 +2107,75 @@ final public void DataBlock() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case UNDEF:{ + case UNDEF: jj_consume_token(UNDEF); -{if ("" != null) return null ;} + {if (true) return null ;} break; - } default: jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Element MinusGraphPattern() throws ParseException {Element el ; + final public Element MinusGraphPattern() throws ParseException { + Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); -{if ("" != null) return new ElementMinus(el) ;} + {if (true) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException { + Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case UNION:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNION: ; break; - } default: jj_la1[80] = jj_gen; break label_19; } jj_consume_token(UNION); -if ( el2 == null ) + if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); -el2.addElement(el) ; + el2.addElement(el) ; } -{if ("" != null) return (el2==null)? el : el2 ;} + {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); -} + } - final public Element Filter() throws ParseException {Expr c ; + final public Element Filter() throws ParseException { + Expr c ; jj_consume_token(FILTER); c = Constraint(); -{if ("" != null) return new ElementFilter(c) ;} + {if (true) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Constraint() throws ParseException {Expr c ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr Constraint() throws ParseException { + Expr c ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: c = BrackettedExpression(); break; - } case EXISTS: case NOT: case COUNT: @@ -2317,132 +2236,127 @@ final public void DataBlock() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: c = BuiltInCall(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: c = FunctionCall(); break; - } default: jj_la1[81] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return c ;} + {if (true) return c ;} throw new Error("Missing return statement in function"); -} + } - final public Expr FunctionCall() throws ParseException {String fname ; Args a ; + final public Expr FunctionCall() throws ParseException { + String fname ; Args a ; fname = iri(); a = ArgList(); -if ( AggregateRegistry.isRegistered(fname) ) { + if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(fname, a) ;} + {if (true) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public Args ArgList() throws ParseException { + Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -args.distinct = true ; -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; -if ( ! getAllowAggregatesInExpressions() ) + args.distinct = true ; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; - } default: jj_la1[82] = jj_gen; ; } expr = Expression(); -args.add(expr) ; + args.add(expr) ; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[83] = jj_gen; break label_20; } jj_consume_token(COMMA); expr = Expression(); -args.add(expr) ; + args.add(expr) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return args ;} + {if (true) return args ;} throw new Error("Missing return statement in function"); -} + } - final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case NIL:{ + final public ExprList ExpressionList() throws ParseException { + Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NIL: jj_consume_token(NIL); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[85] = jj_gen; break label_21; } jj_consume_token(COMMA); expr = Expression(); -exprList.add(expr) ; + exprList.add(expr) ; } jj_consume_token(RPAREN); break; - } default: jj_la1[86] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return exprList ;} + {if (true) return exprList ;} throw new Error("Missing return statement in function"); -} + } - final public Template ConstructTemplate() throws ParseException {TripleCollectorBGP acc = new TripleCollectorBGP(); + final public Template ConstructTemplate() throws ParseException { + TripleCollectorBGP acc = new TripleCollectorBGP(); Template t = new Template(acc.getBGP()) ; -setInConstructTemplate(true) ; + setInConstructTemplate(true) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2467,26 +2381,25 @@ final public void DataBlock() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ConstructTriples(acc); break; - } default: jj_la1[87] = jj_gen; ; } jj_consume_token(RBRACE); -setInConstructTemplate(false) ; - {if ("" != null) return t ;} + setInConstructTemplate(false) ; + {if (true) return t ;} throw new Error("Missing return statement in function"); -} + } final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DOT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2511,24 +2424,23 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ConstructTriples(acc); break; - } default: jj_la1[88] = jj_gen; ; } break; - } default: jj_la1[89] = jj_gen; ; } -} + } - final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2551,109 +2463,104 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: PropertyListNotEmpty(s, acc); break; - } default: jj_la1[91] = jj_gen; ; } -} + } - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { + Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: jj_la1[92] = jj_gen; break label_22; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A:{ + case KW_A: p = Verb(); ObjectList(s, p, null, acc); break; - } default: jj_la1[93] = jj_gen; ; } } -} + } - final public Node Verb() throws ParseException {Node p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node Verb() throws ParseException { + Node p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2:{ + case VAR2: p = VarOrIri(); break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = nRDFtype ; + p = nRDFtype ; break; - } default: jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; Object(s, p, path, acc); label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[95] = jj_gen; break label_23; @@ -2661,16 +2568,18 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio jj_consume_token(COMMA); Object(s, p, path, acc); } -} + } - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; -} + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + } - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { + Node s ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2693,28 +2602,26 @@ final public void PropertyList(Node s, TripleCollector acc) throws ParseExceptio case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; - } case LPAREN: - case LBRACKET:{ -ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET: + ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); -insert(acc, tempAcc) ; + insert(acc, tempAcc) ; break; - } default: jj_la1[96] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -} + } final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2723,33 +2630,31 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: PropertyListPathNotEmpty(s, acc); break; - } default: jj_la1[97] = jj_gen; ; } -} + } - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { + Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: jj_la1[98] = jj_gen; jj_consume_token(-1); @@ -2758,18 +2663,17 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce ObjectListPath(s, p, path, acc); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: ; break; - } default: jj_la1[99] = jj_gen; break label_24; } jj_consume_token(SEMICOLON); -path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2778,23 +2682,21 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case KW_A: case LPAREN: case BANG: - case CARAT:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case CARAT: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT:{ + case CARAT: path = VerbPath(); break; - } case VAR1: - case VAR2:{ + case VAR2: p = VerbSimple(); break; - } default: jj_la1[100] = jj_gen; jj_consume_token(-1); @@ -2802,35 +2704,36 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce } ObjectListPath(s, p, path, acc); break; - } default: jj_la1[101] = jj_gen; ; } } -} + } - final public Path VerbPath() throws ParseException {Node p ; Path path ; + final public Path VerbPath() throws ParseException { + Node p ; Path path ; path = Path(); -{if ("" != null) return path ;} + {if (true) return path ;} throw new Error("Missing return statement in function"); -} + } - final public Node VerbSimple() throws ParseException {Node p ; + final public Node VerbSimple() throws ParseException { + Node p ; p = Var(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; ObjectPath(s, p, path, acc); label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: ; break; - } default: jj_la1[102] = jj_gen; break label_25; @@ -2838,342 +2741,333 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } -} + } - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; -ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { + Node o ; + ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); -insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; -} + insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; + } - final public Path Path() throws ParseException {Path p ; + final public Path Path() throws ParseException { + Path p ; p = PathAlternative(); -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathAlternative() throws ParseException {Path p1 , p2 ; + final public Path PathAlternative() throws ParseException { + Path p1 , p2 ; p1 = PathSequence(); label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: jj_la1[103] = jj_gen; break label_26; } jj_consume_token(VBAR); p2 = PathSequence(); -p1 = PathFactory.pathAlt(p1, p2) ; + p1 = PathFactory.pathAlt(p1, p2) ; } -{if ("" != null) return p1 ;} + {if (true) return p1 ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathSequence() throws ParseException {Path p1 , p2 ; + final public Path PathSequence() throws ParseException { + Path p1 , p2 ; p1 = PathEltOrInverse(); label_27: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SLASH:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SLASH: ; break; - } default: jj_la1[104] = jj_gen; break label_27; } jj_consume_token(SLASH); p2 = PathEltOrInverse(); -p1 = PathFactory.pathSeq(p1, p2) ; + p1 = PathFactory.pathSeq(p1, p2) ; } -{if ("" != null) return p1;} + {if (true) return p1;} throw new Error("Missing return statement in function"); -} + } - final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException { + String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case STAR: - case QMARK:{ + case QMARK: p = PathMod(p); break; - } default: jj_la1[105] = jj_gen; ; } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException { + String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: - case BANG:{ + case BANG: p = PathElt(); break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); p = PathElt(); -p = PathFactory.pathInverse(p) ; + p = PathFactory.pathInverse(p) ; break; - } default: jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case QMARK:{ + final public Path PathMod(Path p) throws ParseException { + long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QMARK: jj_consume_token(QMARK); -{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} + {if (true) return PathFactory.pathZeroOrOne(p) ;} break; - } - case STAR:{ + case STAR: jj_consume_token(STAR); -{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} + {if (true) return PathFactory.pathZeroOrMore1(p) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); -{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} + {if (true) return PathFactory.pathOneOrMore1(p) ;} break; - } default: jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathPrimary() throws ParseException { + String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; p = PathFactory.pathLink(n) ; + n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -p = PathFactory.pathLink(nRDFtype) ; + p = PathFactory.pathLink(nRDFtype) ; break; - } - case BANG:{ + case BANG: jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; - } default: jj_la1[108] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return p ;} + {if (true) return p ;} throw new Error("Missing return statement in function"); -} + } - final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; -pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException { + P_Path0 p ; P_NegPropSet pNegSet ; + pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; break; - } - case LPAREN:{ + case LPAREN: jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT:{ + case CARAT: p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VBAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VBAR: ; break; - } default: jj_la1[109] = jj_gen; break label_28; } jj_consume_token(VBAR); p = PathOneInPropertySet(); -pNegSet.add(p) ; + pNegSet.add(p) ; } break; - } default: jj_la1[110] = jj_gen; ; } jj_consume_token(RPAREN); break; - } default: jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return pNegSet ;} + {if (true) return pNegSet ;} throw new Error("Missing return statement in function"); -} + } - final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException { + String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} + n = createNode(str) ; {if (true) return new P_Link(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_Link(nRDFtype) ;} + {if (true) return new P_Link(nRDFtype) ;} break; - } - case CARAT:{ + case CARAT: jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: str = iri(); -n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} + n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} break; - } - case KW_A:{ + case KW_A: jj_consume_token(KW_A); -{if ("" != null) return new P_ReverseLink(nRDFtype) ;} + {if (true) return new P_ReverseLink(nRDFtype) ;} break; - } default: jj_la1[112] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[113] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public long Integer() throws ParseException {Token t ; + final public long Integer() throws ParseException { + Token t ; t = jj_consume_token(INTEGER); -{if ("" != null) return integerValue(t.image) ;} + {if (true) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = Collection(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyList(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[114] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: n = CollectionPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case LBRACKET:{ + case LBRACKET: n = BlankNodePropertyListPath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[115] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { + Token t ; t = jj_consume_token(LBRACKET); -Node n = createBNode( t.beginLine, t.beginColumn) ; + Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_29: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3198,37 +3092,37 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ; break; - } default: jj_la1[116] = jj_gen; break label_29; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { + Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); -int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_30: while (true) { -Node cell = createListNode( beginLine, beginColumn) ; + Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); -insert(acc, mark, cell, nRDFfirst, n) ; + insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3253,24 +3147,24 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case NIL: case LBRACKET: - case ANON:{ + case ANON: ; break; - } default: jj_la1[117] = jj_gen; break label_30; } } jj_consume_token(RPAREN); -if ( lastCell != null ) + if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if ("" != null) return listHead ;} + {if (true) return listHead ;} throw new Error("Missing return statement in function"); -} + } - final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3293,27 +3187,26 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNode(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3336,32 +3229,30 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = VarOrTerm(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case LPAREN: - case LBRACKET:{ + case LBRACKET: n = TriplesNodePath(acc); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } default: jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node VarOrTerm() throws ParseException {Node n = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrTerm() throws ParseException { + Node n = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3382,106 +3273,100 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON:{ + case ANON: n = GraphTerm(); break; - } default: jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException { + Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR1: - case VAR2:{ + case VAR2: n = Var(); break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -n = createNode(iri) ; + n = createNode(iri) ; break; - } default: jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Var Var() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case VAR1:{ + final public Var Var() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case VAR1: t = jj_consume_token(VAR1); break; - } - case VAR2:{ + case VAR2: t = jj_consume_token(VAR2); break; - } default: jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } - final public Node GraphTerm() throws ParseException {Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node GraphTerm() throws ParseException { + Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = iri(); -{if ("" != null) return createNode(iri) ;} + {if (true) return createNode(iri) ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -3490,93 +3375,92 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } case BLANK_NODE_LABEL: - case ANON:{ + case ANON: n = BlankNode(); -{if ("" != null) return n ;} + {if (true) return n ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); -{if ("" != null) return nRDFnil ;} + {if (true) return nRDFnil ;} break; - } default: jj_la1[124] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr Expression() throws ParseException {Expr expr ; + final public Expr Expression() throws ParseException { + Expr expr ; expr = ConditionalOrExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_OR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: ; break; - } default: jj_la1[125] = jj_gen; break label_31; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); -expr1 = new E_LogicalOr(expr1, expr2) ; + expr1 = new E_LogicalOr(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = ValueLogical(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SC_AND:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: ; break; - } default: jj_la1[126] = jj_gen; break label_32; } jj_consume_token(SC_AND); expr2 = ValueLogical(); -expr1 = new E_LogicalAnd(expr1, expr2) ; + expr1 = new E_LogicalAnd(expr1, expr2) ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ValueLogical() throws ParseException {Expr expr ; + final public Expr ValueLogical() throws ParseException { + Expr expr ; expr = RelationalExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException { + Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NOT: case IN: case EQ: @@ -3584,83 +3468,76 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case GT: case LT: case LE: - case GE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case EQ:{ + case GE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: jj_consume_token(EQ); expr2 = NumericExpression(); -expr1 = new E_Equals(expr1, expr2) ; + expr1 = new E_Equals(expr1, expr2) ; break; - } - case NE:{ + case NE: jj_consume_token(NE); expr2 = NumericExpression(); -expr1 = new E_NotEquals(expr1, expr2) ; + expr1 = new E_NotEquals(expr1, expr2) ; break; - } - case LT:{ + case LT: jj_consume_token(LT); expr2 = NumericExpression(); -expr1 = new E_LessThan(expr1, expr2) ; + expr1 = new E_LessThan(expr1, expr2) ; break; - } - case GT:{ + case GT: jj_consume_token(GT); expr2 = NumericExpression(); -expr1 = new E_GreaterThan(expr1, expr2) ; + expr1 = new E_GreaterThan(expr1, expr2) ; break; - } - case LE:{ + case LE: jj_consume_token(LE); expr2 = NumericExpression(); -expr1 = new E_LessThanOrEqual(expr1, expr2) ; + expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - } - case GE:{ + case GE: jj_consume_token(GE); expr2 = NumericExpression(); -expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; + expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - } - case IN:{ + case IN: jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_OneOf(expr1, a) ; + expr1 = new E_OneOf(expr1, a) ; break; - } - case NOT:{ + case NOT: jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); -expr1 = new E_NotOneOf(expr1, a) ; + expr1 = new E_NotOneOf(expr1, a) ; break; - } default: jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[128] = jj_gen; ; } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NumericExpression() throws ParseException {Expr expr ; + final public Expr NumericExpression() throws ParseException { + Expr expr ; expr = AdditiveExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException { + Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -3668,52 +3545,47 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS:{ + case MINUS: ; break; - } default: jj_la1[129] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PLUS:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Add(expr1, expr2) ; + expr1 = new E_Add(expr1, expr2) ; break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); -expr1 = new E_Subtract(expr1, expr2) ; + expr1 = new E_Subtract(expr1, expr2) ; break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOUBLE_NEGATIVE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); -n = stripSign(n) ; + n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; - } default: jj_la1[130] = jj_gen; jj_consume_token(-1); @@ -3721,108 +3593,100 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce } label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: jj_la1[131] = jj_gen; break label_34; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr3 = UnaryExpression(); -expr2 = new E_Multiply(expr2, expr3) ; + expr2 = new E_Multiply(expr2, expr3) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr3 = UnaryExpression(); -expr2 = new E_Divide(expr2, expr3) ; + expr2 = new E_Divide(expr2, expr3) ; break; - } default: jj_la1[132] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -if ( addition ) + if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; - } default: jj_la1[133] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException { + Expr expr1, expr2 ; expr1 = UnaryExpression(); label_35: while (true) { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STAR: - case SLASH:{ + case SLASH: ; break; - } default: jj_la1[134] = jj_gen; break label_35; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); expr2 = UnaryExpression(); -expr1 = new E_Multiply(expr1, expr2) ; + expr1 = new E_Multiply(expr1, expr2) ; break; - } - case SLASH:{ + case SLASH: jj_consume_token(SLASH); expr2 = UnaryExpression(); -expr1 = new E_Divide(expr1, expr2) ; + expr1 = new E_Divide(expr1, expr2) ; break; - } default: jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } -{if ("" != null) return expr1 ;} + {if (true) return expr1 ;} throw new Error("Missing return statement in function"); -} + } - final public Expr UnaryExpression() throws ParseException {Expr expr ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BANG:{ + final public Expr UnaryExpression() throws ParseException { + Expr expr ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: jj_consume_token(BANG); expr = PrimaryExpression(); -{if ("" != null) return new E_LogicalNot(expr) ;} + {if (true) return new E_LogicalNot(expr) ;} break; - } - case PLUS:{ + case PLUS: jj_consume_token(PLUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryPlus(expr) ;} + {if (true) return new E_UnaryPlus(expr) ;} break; - } - case MINUS:{ + case MINUS: jj_consume_token(MINUS); expr = PrimaryExpression(); -{if ("" != null) return new E_UnaryMinus(expr) ;} + {if (true) return new E_UnaryMinus(expr) ;} break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3904,26 +3768,25 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN:{ + case LPAREN: expr = PrimaryExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + final public Expr PrimaryExpression() throws ParseException { + Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: expr = BrackettedExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case EXISTS: case NOT: case COUNT: @@ -3984,26 +3847,23 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case SHA1: case SHA256: case SHA384: - case SHA512:{ + case SHA512: expr = BuiltInCall(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case IRIref: case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: expr = iriOrFunction(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: n = RDFLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case INTEGER: case DECIMAL: case DOUBLE: @@ -4012,399 +3872,353 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case TRUE: - case FALSE:{ + case FALSE: n = BooleanLiteral(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } case VAR1: - case VAR2:{ + case VAR2: n = Var(); -{if ("" != null) return asExpr(n) ;} + {if (true) return asExpr(n) ;} break; - } default: jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr BrackettedExpression() throws ParseException {Expr expr ; + final public Expr BrackettedExpression() throws ParseException { + Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return expr ;} + {if (true) return expr ;} throw new Error("Missing return statement in function"); -} + } - final public Expr BuiltInCall() throws ParseException {Expr expr ; + final public Expr BuiltInCall() throws ParseException { + Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COUNT: case MIN: case MAX: case SUM: case AVG: case SAMPLE: - case GROUP_CONCAT:{ + case GROUP_CONCAT: expr = Aggregate(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STR:{ + case STR: jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Str(expr) ;} + {if (true) return new E_Str(expr) ;} break; - } - case LANG:{ + case LANG: jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Lang(expr) ;} + {if (true) return new E_Lang(expr) ;} break; - } - case LANGMATCHES:{ + case LANGMATCHES: jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_LangMatches(expr1, expr2) ;} + {if (true) return new E_LangMatches(expr1, expr2) ;} break; - } - case DTYPE:{ + case DTYPE: jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Datatype(expr) ;} + {if (true) return new E_Datatype(expr) ;} break; - } - case BOUND:{ + case BOUND: jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} + {if (true) return new E_Bound(new ExprVar(gn)) ;} break; - } - case IRI:{ + case IRI: jj_consume_token(IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_IRI(expr) ;} + {if (true) return makeFunction_IRI(expr) ;} break; - } - case URI:{ + case URI: jj_consume_token(URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return makeFunction_URI(expr) ;} + {if (true) return makeFunction_URI(expr) ;} break; - } - case BNODE:{ + case BNODE: jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); {if ("" != null) return makeFunction_BNode(expr1) ;} break; - } - case NIL:{ + case NIL: jj_consume_token(NIL); {if ("" != null) return makeFunction_BNode() ;} break; - } default: jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } - case RAND:{ + case RAND: jj_consume_token(RAND); jj_consume_token(NIL); -{if ("" != null) return new E_Random() ;} + {if (true) return new E_Random() ;} break; - } - case ABS:{ + case ABS: jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumAbs(expr1) ;} + {if (true) return new E_NumAbs(expr1) ;} break; - } - case CEIL:{ + case CEIL: jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumCeiling(expr1) ;} + {if (true) return new E_NumCeiling(expr1) ;} break; - } - case FLOOR:{ + case FLOOR: jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumFloor(expr1) ;} + {if (true) return new E_NumFloor(expr1) ;} break; - } - case ROUND:{ + case ROUND: jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_NumRound(expr1) ;} + {if (true) return new E_NumRound(expr1) ;} break; - } - case CONCAT:{ + case CONCAT: jj_consume_token(CONCAT); a = ExpressionList(); -{if ("" != null) return new E_StrConcat(a) ;} + {if (true) return new E_StrConcat(a) ;} break; - } - case SUBSTR:{ + case SUBSTR: expr = SubstringExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case STRLEN:{ + case STRLEN: jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLength(expr1) ;} + {if (true) return new E_StrLength(expr1) ;} break; - } - case REPLACE:{ + case REPLACE: expr = StrReplaceExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case UCASE:{ + case UCASE: jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrUpperCase(expr1) ;} + {if (true) return new E_StrUpperCase(expr1) ;} break; - } - case LCASE:{ + case LCASE: jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLowerCase(expr1) ;} + {if (true) return new E_StrLowerCase(expr1) ;} break; - } - case ENCODE_FOR_URI:{ + case ENCODE_FOR_URI: jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEncodeForURI(expr1) ;} + {if (true) return new E_StrEncodeForURI(expr1) ;} break; - } - case CONTAINS:{ + case CONTAINS: jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrContains(expr1, expr2) ;} + {if (true) return new E_StrContains(expr1, expr2) ;} break; - } - case STRSTARTS:{ + case STRSTARTS: jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} + {if (true) return new E_StrStartsWith(expr1, expr2) ;} break; - } - case STRENDS:{ + case STRENDS: jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} + {if (true) return new E_StrEndsWith(expr1, expr2) ;} break; - } - case STRBEFORE:{ + case STRBEFORE: jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrBefore(expr1, expr2) ;} + {if (true) return new E_StrBefore(expr1, expr2) ;} break; - } - case STRAFTER:{ + case STRAFTER: jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrAfter(expr1, expr2) ;} + {if (true) return new E_StrAfter(expr1, expr2) ;} break; - } - case YEAR:{ + case YEAR: jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeYear(expr1) ;} + {if (true) return new E_DateTimeYear(expr1) ;} break; - } - case MONTH:{ + case MONTH: jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMonth(expr1) ;} + {if (true) return new E_DateTimeMonth(expr1) ;} break; - } - case DAY:{ + case DAY: jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeDay(expr1) ;} + {if (true) return new E_DateTimeDay(expr1) ;} break; - } - case HOURS:{ + case HOURS: jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeHours(expr1) ;} + {if (true) return new E_DateTimeHours(expr1) ;} break; - } - case MINUTES:{ + case MINUTES: jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeMinutes(expr1) ;} + {if (true) return new E_DateTimeMinutes(expr1) ;} break; - } - case SECONDS:{ + case SECONDS: jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeSeconds(expr1) ;} + {if (true) return new E_DateTimeSeconds(expr1) ;} break; - } - case TIMEZONE:{ + case TIMEZONE: jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTimezone(expr1) ;} + {if (true) return new E_DateTimeTimezone(expr1) ;} break; - } - case TZ:{ + case TZ: jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_DateTimeTZ(expr1) ;} + {if (true) return new E_DateTimeTZ(expr1) ;} break; - } - case NOW:{ + case NOW: jj_consume_token(NOW); jj_consume_token(NIL); -{if ("" != null) return new E_Now() ;} + {if (true) return new E_Now() ;} break; - } - case UUID:{ + case UUID: jj_consume_token(UUID); jj_consume_token(NIL); -{if ("" != null) return new E_UUID() ;} + {if (true) return new E_UUID() ;} break; - } - case STRUUID:{ + case STRUUID: jj_consume_token(STRUUID); jj_consume_token(NIL); -{if ("" != null) return new E_StrUUID() ;} + {if (true) return new E_StrUUID() ;} break; - } - case MD5:{ + case MD5: jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_MD5(expr1) ;} + {if (true) return new E_MD5(expr1) ;} break; - } - case SHA1:{ + case SHA1: jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA1(expr1) ;} + {if (true) return new E_SHA1(expr1) ;} break; - } - case SHA256:{ + case SHA256: jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA256(expr1) ;} + {if (true) return new E_SHA256(expr1) ;} break; - } - case SHA384:{ + case SHA384: jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA384(expr1) ;} + {if (true) return new E_SHA384(expr1) ;} break; - } - case SHA512:{ + case SHA512: jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SHA512(expr1) ;} + {if (true) return new E_SHA512(expr1) ;} break; - } - case COALESCE:{ + case COALESCE: jj_consume_token(COALESCE); a = ExpressionList(); -{if ("" != null) return new E_Coalesce(a) ;} + {if (true) return new E_Coalesce(a) ;} break; - } - case IF:{ + case IF: jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -4413,145 +4227,134 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} + {if (true) return new E_Conditional(expr, expr1, expr2) ;} break; - } - case STRLANG:{ + case STRLANG: jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrLang(expr1, expr2) ;} + {if (true) return new E_StrLang(expr1, expr2) ;} break; - } - case STRDT:{ + case STRDT: jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} + {if (true) return new E_StrDatatype(expr1, expr2) ;} break; - } - case SAME_TERM:{ + case SAME_TERM: jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_SameTerm(expr1, expr2) ;} + {if (true) return new E_SameTerm(expr1, expr2) ;} break; - } - case IS_IRI:{ + case IS_IRI: jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsIRI(expr) ;} + {if (true) return new E_IsIRI(expr) ;} break; - } - case IS_URI:{ + case IS_URI: jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsURI(expr) ;} + {if (true) return new E_IsURI(expr) ;} break; - } - case IS_BLANK:{ + case IS_BLANK: jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsBlank(expr) ;} + {if (true) return new E_IsBlank(expr) ;} break; - } - case IS_LITERAL:{ + case IS_LITERAL: jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsLiteral(expr) ;} + {if (true) return new E_IsLiteral(expr) ;} break; - } - case IS_NUMERIC:{ + case IS_NUMERIC: jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); -{if ("" != null) return new E_IsNumeric(expr) ;} + {if (true) return new E_IsNumeric(expr) ;} break; - } - case REGEX:{ + case REGEX: expr = RegexExpression(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case EXISTS:{ + case EXISTS: expr = ExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } - case NOT:{ + case NOT: expr = NotExistsFunc(); -{if ("" != null) return expr ;} + {if (true) return expr ;} break; - } default: jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException { + Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); flagsExpr = Expression(); break; - } default: jj_la1[140] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} + {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr3 = Expression(); break; - } default: jj_la1[141] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} + {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException { + Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -4559,61 +4362,61 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COMMA:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: jj_consume_token(COMMA); expr4 = Expression(); break; - } default: jj_la1[142] = jj_gen; ; } jj_consume_token(RPAREN); -{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} + {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr ExistsFunc() throws ParseException {Element el ; + final public Expr ExistsFunc() throws ParseException { + Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprExists(el) ;} + {if (true) return createExprExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr NotExistsFunc() throws ParseException {Element el ; + final public Expr NotExistsFunc() throws ParseException { + Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); -{if ("" != null) return createExprNotExists(el) ;} + {if (true) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); -} + } - final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException { + Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; -startAggregate(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case COUNT:{ + startAggregate(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COUNT: t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[143] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STAR:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: jj_consume_token(STAR); break; - } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4698,435 +4501,403 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case LPAREN: case BANG: case PLUS: - case MINUS:{ + case MINUS: expr = Expression(); break; - } default: jj_la1[144] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); -if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } + if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - } - case SUM:{ + case SUM: t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[145] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSum(distinct, expr) ; + agg = AggregatorFactory.createSum(distinct, expr) ; break; - } - case MIN:{ + case MIN: t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[146] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMin(distinct, expr) ; + agg = AggregatorFactory.createMin(distinct, expr) ; break; - } - case MAX:{ + case MAX: t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[147] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createMax(distinct, expr) ; + agg = AggregatorFactory.createMax(distinct, expr) ; break; - } - case AVG:{ + case AVG: t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[148] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createAvg(distinct, expr) ; + agg = AggregatorFactory.createAvg(distinct, expr) ; break; - } - case SAMPLE:{ + case SAMPLE: t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[149] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); -agg = AggregatorFactory.createSample(distinct, expr) ; + agg = AggregatorFactory.createSample(distinct, expr) ; break; - } - case GROUP_CONCAT:{ + case GROUP_CONCAT: t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case DISTINCT:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DISTINCT: t = jj_consume_token(DISTINCT); -distinct = true ; + distinct = true ; break; - } default: jj_la1[150] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case SEMICOLON:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); break; - } default: jj_la1[151] = jj_gen; ; } jj_consume_token(RPAREN); -agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; + agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; - } default: jj_la1[152] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -if ( ! getAllowAggregatesInExpressions() ) + if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; -Expr exprAgg = getQuery().allocAggregate(agg) ; + Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} throw new Error("Missing return statement in function"); -} + } - final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException { + String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: - case NIL:{ + case NIL: a = ArgList(); break; - } default: jj_la1[153] = jj_gen; ; } -if ( a == null ) - {if ("" != null) return asExpr(createNode(iri)) ;} + if ( a == null ) + {if (true) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if ("" != null) return exprAgg ;} + {if (true) return exprAgg ;} } - {if ("" != null) return new E_Function(iri, a) ;} + {if (true) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); -} + } - final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException { + Token t ; String lex = null ; lex = String(); -String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LANGTAG: - case DATATYPE:{ - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case LANGTAG:{ + case DATATYPE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LANGTAG: t = jj_consume_token(LANGTAG); -lang = stripChars(t.image, 1) ; + lang = stripChars(t.image, 1) ; break; - } - case DATATYPE:{ + case DATATYPE: jj_consume_token(DATATYPE); uri = iri(); break; - } default: jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - } default: jj_la1[155] = jj_gen; ; } -{if ("" != null) return createLiteral(lex, lang, uri) ;} + {if (true) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteral() throws ParseException {Node n ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + final public Node NumericLiteral() throws ParseException { + Node n ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE:{ + case DOUBLE: n = NumericLiteralUnsigned(); break; - } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: n = NumericLiteralPositive(); break; - } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: n = NumericLiteralNegative(); break; - } default: jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -{if ("" != null) return n ;} + {if (true) return n ;} throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralUnsigned() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER:{ + final public Node NumericLiteralUnsigned() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: t = jj_consume_token(INTEGER); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL:{ + case DECIMAL: t = jj_consume_token(DECIMAL); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE:{ + case DOUBLE: t = jj_consume_token(DOUBLE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralPositive() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_POSITIVE:{ + final public Node NumericLiteralPositive() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_POSITIVE: t = jj_consume_token(INTEGER_POSITIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_POSITIVE:{ + case DECIMAL_POSITIVE: t = jj_consume_token(DECIMAL_POSITIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_POSITIVE:{ + case DOUBLE_POSITIVE: t = jj_consume_token(DOUBLE_POSITIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[158] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node NumericLiteralNegative() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case INTEGER_NEGATIVE:{ + final public Node NumericLiteralNegative() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_NEGATIVE: t = jj_consume_token(INTEGER_NEGATIVE); -{if ("" != null) return createLiteralInteger(t.image) ;} + {if (true) return createLiteralInteger(t.image) ;} break; - } - case DECIMAL_NEGATIVE:{ + case DECIMAL_NEGATIVE: t = jj_consume_token(DECIMAL_NEGATIVE); -{if ("" != null) return createLiteralDecimal(t.image) ;} + {if (true) return createLiteralDecimal(t.image) ;} break; - } - case DOUBLE_NEGATIVE:{ + case DOUBLE_NEGATIVE: t = jj_consume_token(DOUBLE_NEGATIVE); -{if ("" != null) return createLiteralDouble(t.image) ;} + {if (true) return createLiteralDouble(t.image) ;} break; - } default: jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case TRUE:{ + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: jj_consume_token(TRUE); -{if ("" != null) return XSD_TRUE ;} + {if (true) return XSD_TRUE ;} break; - } - case FALSE:{ + case FALSE: jj_consume_token(FALSE); -{if ("" != null) return XSD_FALSE ;} + {if (true) return XSD_FALSE ;} break; - } default: jj_la1[160] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String String() throws ParseException {Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case STRING_LITERAL1:{ + final public String String() throws ParseException { + Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL1: t = jj_consume_token(STRING_LITERAL1); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL2:{ + case STRING_LITERAL2: t = jj_consume_token(STRING_LITERAL2); -lex = stripQuotes(t.image) ; + lex = stripQuotes(t.image) ; break; - } - case STRING_LITERAL_LONG1:{ + case STRING_LITERAL_LONG1: t = jj_consume_token(STRING_LITERAL_LONG1); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } - case STRING_LITERAL_LONG2:{ + case STRING_LITERAL_LONG2: t = jj_consume_token(STRING_LITERAL_LONG2); -lex = stripQuotes3(t.image) ; + lex = stripQuotes3(t.image) ; break; - } default: jj_la1[161] = jj_gen; jj_consume_token(-1); throw new ParseException(); } -checkString(lex, t.beginLine, t.beginColumn) ; + checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if ("" != null) return lex ;} + {if (true) return lex ;} throw new Error("Missing return statement in function"); -} + } - final public String iri() throws ParseException {String iri ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case IRIref:{ + final public String iri() throws ParseException { + String iri ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IRIref: iri = IRIREF(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } case PNAME_NS: - case PNAME_LN:{ + case PNAME_LN: iri = PrefixedName(); -{if ("" != null) return iri ;} + {if (true) return iri ;} break; - } default: jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String PrefixedName() throws ParseException {Token t ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case PNAME_LN:{ + final public String PrefixedName() throws ParseException { + Token t ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PNAME_LN: t = jj_consume_token(PNAME_LN); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } - case PNAME_NS:{ + case PNAME_NS: t = jj_consume_token(PNAME_NS); -{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[163] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public Node BlankNode() throws ParseException {Token t = null ; - switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { - case BLANK_NODE_LABEL:{ + final public Node BlankNode() throws ParseException { + Token t = null ; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLANK_NODE_LABEL: t = jj_consume_token(BLANK_NODE_LABEL); -{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - } - case ANON:{ + case ANON: t = jj_consume_token(ANON); -{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} + {if (true) return createBNode(t.beginLine, t.beginColumn) ;} break; - } default: jj_la1[164] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); -} + } - final public String IRIREF() throws ParseException {Token t ; + final public String IRIREF() throws ParseException { + Token t ; t = jj_consume_token(IRIref); -{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} + {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); -} + } /** Generated Token Manager. */ public SPARQLParser11TokenManager token_source; @@ -5146,149 +4917,141 @@ final public Node BooleanLiteral() throws ParseException { static private int[] jj_la1_5; static private int[] jj_la1_6; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } /** Constructor with InputStream. */ public SPARQLParser11(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public SPARQLParser11(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor. */ public SPARQLParser11(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - if (jj_input_stream == null) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - } else { - jj_input_stream.ReInit(stream, 1, 1); - } - if (token_source == null) { - token_source = new SPARQLParser11TokenManager(jj_input_stream); - } - - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public SPARQLParser11(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk_f() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -5297,58 +5060,51 @@ private int jj_ntk_f() { /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[209]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 165; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 165; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); } else if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); else if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); else if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); else if (curChar == 58) { if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); } else if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 117; else if (curChar == 39) @@ -2313,26 +2326,26 @@ else if (curChar == 39) else if (curChar == 36) jjstateSet[jjnewStateCnt++] = 27; else if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); else if (curChar == 35) { if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); } else if (curChar == 63) jjstateSet[jjnewStateCnt++] = 24; if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); else if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - { jjCheckNAddStates(26, 28); } + jjCheckNAddStates(26, 28); break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2348,11 +2361,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 6: if ((0xaffffffa00000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 9: if ((0x3ff000000000000L & l) != 0L) @@ -2384,7 +2397,7 @@ else if (curChar == 39) break; case 16: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 17: if (curChar == 62 && kind > 10) @@ -2399,11 +2412,11 @@ else if (curChar == 39) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x3ff600000000000L & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2419,7 +2432,7 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 26: if (curChar == 36) @@ -2431,38 +2444,38 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 31: if (curChar == 45) - { jjCheckNAdd(32); } + jjCheckNAdd(32); break; case 32: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 34: if (curChar == 35) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 35: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 36: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 37: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 42: if (curChar == 10) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 43: if (curChar == 13) @@ -2474,11 +2487,11 @@ else if (curChar == 39) break; case 51: if (curChar == 39) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 52: if ((0xffffff7fffffdbffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 53: if (curChar == 39 && kind > 161) @@ -2486,7 +2499,7 @@ else if (curChar == 39) break; case 55: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 57: if ((0x3ff000000000000L & l) != 0L) @@ -2518,15 +2531,15 @@ else if (curChar == 39) break; case 64: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 65: if (curChar == 34) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 66: if ((0xfffffffbffffdbffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 67: if (curChar == 34 && kind > 162) @@ -2534,7 +2547,7 @@ else if (curChar == 39) break; case 69: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 71: if ((0x3ff000000000000L & l) != 0L) @@ -2566,28 +2579,28 @@ else if (curChar == 39) break; case 78: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 79: if (curChar == 39) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 80: case 83: if (curChar == 39) - { jjCheckNAddTwoStates(81, 84); } + jjCheckNAddTwoStates(81, 84); break; case 81: if ((0xffffff7fffffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 82: if (curChar == 39) - { jjAddStates(48, 49); } + jjAddStates(48, 49); break; case 85: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 87: if ((0x3ff000000000000L & l) != 0L) @@ -2619,7 +2632,7 @@ else if (curChar == 39) break; case 94: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 95: if (curChar == 39 && kind > 163) @@ -2639,24 +2652,24 @@ else if (curChar == 39) break; case 99: if (curChar == 34) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 100: case 103: if (curChar == 34) - { jjCheckNAddTwoStates(101, 104); } + jjCheckNAddTwoStates(101, 104); break; case 101: if ((0xfffffffbffffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 102: if (curChar == 34) - { jjAddStates(54, 55); } + jjAddStates(54, 55); break; case 105: if ((0x8400000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 107: if ((0x3ff000000000000L & l) != 0L) @@ -2688,7 +2701,7 @@ else if (curChar == 39) break; case 114: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 115: if (curChar == 34 && kind > 164) @@ -2708,23 +2721,23 @@ else if (curChar == 39) break; case 119: if (curChar == 40) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 120: if (curChar == 35) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 121: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(56, 61); } + jjCheckNAddStates(56, 61); break; case 122: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 123: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 124: if (curChar == 41 && kind > 167) @@ -2732,7 +2745,7 @@ else if (curChar == 39) break; case 125: if (curChar == 10) - { jjCheckNAddStates(20, 22); } + jjCheckNAddStates(20, 22); break; case 126: if (curChar == 13) @@ -2740,23 +2753,23 @@ else if (curChar == 39) break; case 128: if (curChar == 35) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 129: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 130: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 131: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 133: if (curChar == 10) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 134: if (curChar == 13) @@ -2764,7 +2777,7 @@ else if (curChar == 39) break; case 136: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(71, 72); } + jjAddStates(71, 72); break; case 137: if ((0x3ff200000000000L & l) != 0L) @@ -2776,7 +2789,7 @@ else if (curChar == 39) break; case 139: if ((0x3ff600000000000L & l) != 0L) - { jjAddStates(73, 74); } + jjAddStates(73, 74); break; case 140: if ((0x3ff200000000000L & l) != 0L) @@ -2784,18 +2797,18 @@ else if (curChar == 39) break; case 141: if (curChar == 58) - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 142: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7ff600000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -2803,11 +2816,11 @@ else if (curChar == 39) break; case 146: if ((0xa800fffa00000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 147: if (curChar == 37) - { jjAddStates(79, 80); } + jjAddStates(79, 80); break; case 148: if ((0x3ff000000000000L & l) != 0L) @@ -2815,7 +2828,7 @@ else if (curChar == 39) break; case 149: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x3ff000000000000L & l) != 0L) @@ -2834,7 +2847,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 155: if (curChar == 37) @@ -2849,34 +2862,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 158: if (curChar != 58) break; if (kind > 11) kind = 11; - { jjCheckNAddStates(17, 19); } + jjCheckNAddStates(17, 19); break; case 161: if (curChar == 35) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 162: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 163: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 164: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 169: if (curChar == 10) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 170: if (curChar == 13) @@ -2884,23 +2897,23 @@ else if (curChar == 39) break; case 176: if (curChar == 35) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 177: if ((0xffffffffffffdbffL & l) != 0L) - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 178: if ((0x2400L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 179: if ((0x100003600L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 185: if (curChar == 10) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 186: if (curChar == 13) @@ -2911,260 +2924,260 @@ else if (curChar == 39) break; if (kind > 145) kind = 145; - { jjCheckNAddStates(0, 6); } + jjCheckNAddStates(0, 6); break; case 192: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 145) kind = 145; - { jjCheckNAdd(192); } + jjCheckNAdd(192); break; case 193: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(193, 194); } + jjCheckNAddTwoStates(193, 194); break; case 194: if (curChar == 46) - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 195: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 146) kind = 146; - { jjCheckNAdd(195); } + jjCheckNAdd(195); break; case 196: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(196, 197); } + jjCheckNAddTwoStates(196, 197); break; case 197: if (curChar == 46) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 198: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(198, 199); } + jjCheckNAddTwoStates(198, 199); break; case 200: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 201: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(201); } + jjCheckNAdd(201); break; case 202: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(202, 203); } + jjCheckNAddTwoStates(202, 203); break; case 204: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 205: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(205); } + jjCheckNAdd(205); break; case 206: if (curChar == 46) - { jjCheckNAddTwoStates(195, 207); } + jjCheckNAddTwoStates(195, 207); break; case 207: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(207, 208); } + jjCheckNAddTwoStates(207, 208); break; case 209: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 210: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - { jjCheckNAdd(210); } + jjCheckNAdd(210); break; case 211: if (curChar == 43) - { jjCheckNAddStates(12, 16); } + jjCheckNAddStates(12, 16); break; case 212: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 148) kind = 148; - { jjCheckNAdd(212); } + jjCheckNAdd(212); break; case 213: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(213, 214); } + jjCheckNAddTwoStates(213, 214); break; case 214: if (curChar == 46) - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 215: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 149) kind = 149; - { jjCheckNAdd(215); } + jjCheckNAdd(215); break; case 216: if (curChar == 46) - { jjCheckNAdd(217); } + jjCheckNAdd(217); break; case 217: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(217, 218); } + jjCheckNAddTwoStates(217, 218); break; case 219: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 220: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(220); } + jjCheckNAdd(220); break; case 221: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(99, 102); } + jjCheckNAddStates(99, 102); break; case 222: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(222, 223); } + jjCheckNAddTwoStates(222, 223); break; case 223: if (curChar == 46) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 224: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(224, 225); } + jjCheckNAddTwoStates(224, 225); break; case 226: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 227: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(227); } + jjCheckNAdd(227); break; case 228: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(228, 229); } + jjCheckNAddTwoStates(228, 229); break; case 230: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 231: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - { jjCheckNAdd(231); } + jjCheckNAdd(231); break; case 232: if (curChar == 45) - { jjCheckNAddStates(7, 11); } + jjCheckNAddStates(7, 11); break; case 233: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 151) kind = 151; - { jjCheckNAdd(233); } + jjCheckNAdd(233); break; case 234: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(234, 235); } + jjCheckNAddTwoStates(234, 235); break; case 235: if (curChar == 46) - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 236: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 152) kind = 152; - { jjCheckNAdd(236); } + jjCheckNAdd(236); break; case 237: if (curChar == 46) - { jjCheckNAdd(238); } + jjCheckNAdd(238); break; case 238: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(238, 239); } + jjCheckNAddTwoStates(238, 239); break; case 240: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 241: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(241); } + jjCheckNAdd(241); break; case 242: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddStates(103, 106); } + jjCheckNAddStates(103, 106); break; case 243: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(243, 244); } + jjCheckNAddTwoStates(243, 244); break; case 244: if (curChar == 46) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 245: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(245, 246); } + jjCheckNAddTwoStates(245, 246); break; case 247: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 248: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(248); } + jjCheckNAdd(248); break; case 249: if ((0x3ff000000000000L & l) != 0L) - { jjCheckNAddTwoStates(249, 250); } + jjCheckNAddTwoStates(249, 250); break; case 251: if ((0x280000000000L & l) != 0L) - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; case 252: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - { jjCheckNAdd(252); } + jjCheckNAdd(252); break; default : break; } @@ -3179,28 +3192,28 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); else if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 50; else if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 18; if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 47; break; case 1: if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 7: if (curChar == 92) @@ -3240,18 +3253,18 @@ else if ((0x20000000200L & l) != 0L) break; case 16: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(23, 25); } + jjCheckNAddStates(23, 25); break; case 19: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3267,7 +3280,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: case 28: @@ -3275,32 +3288,32 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 29: if (curChar == 64) - { jjCheckNAdd(30); } + jjCheckNAdd(30); break; case 30: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(30, 31); } + jjCheckNAddTwoStates(30, 31); break; case 32: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - { jjCheckNAddTwoStates(31, 32); } + jjCheckNAddTwoStates(31, 32); break; case 33: if ((0x10000000100000L & l) != 0L) - { jjCheckNAddStates(41, 43); } + jjCheckNAddStates(41, 43); break; case 35: - { jjCheckNAddStates(35, 40); } + jjCheckNAddStates(35, 40); break; case 38: if ((0x200000002L & l) != 0L && kind > 126) @@ -3348,15 +3361,15 @@ else if ((0x20000000200L & l) != 0L) break; case 52: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 54: if (curChar == 92) - { jjAddStates(115, 116); } + jjAddStates(115, 116); break; case 55: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 56: if (curChar == 85) @@ -3392,19 +3405,19 @@ else if ((0x20000000200L & l) != 0L) break; case 64: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(32, 34); } + jjCheckNAddStates(32, 34); break; case 66: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 68: if (curChar == 92) - { jjAddStates(117, 118); } + jjAddStates(117, 118); break; case 69: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 70: if (curChar == 85) @@ -3440,19 +3453,19 @@ else if ((0x20000000200L & l) != 0L) break; case 78: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(29, 31); } + jjCheckNAddStates(29, 31); break; case 81: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 84: if (curChar == 92) - { jjAddStates(119, 120); } + jjAddStates(119, 120); break; case 85: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 86: if (curChar == 85) @@ -3488,19 +3501,19 @@ else if ((0x20000000200L & l) != 0L) break; case 94: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(44, 47); } + jjCheckNAddStates(44, 47); break; case 101: if ((0xffffffffefffffffL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 104: if (curChar == 92) - { jjAddStates(121, 122); } + jjAddStates(121, 122); break; case 105: if ((0x14404410000000L & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 106: if (curChar == 85) @@ -3536,17 +3549,17 @@ else if ((0x20000000200L & l) != 0L) break; case 114: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(50, 53); } + jjCheckNAddStates(50, 53); break; case 121: - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 127: if (curChar == 91) - { jjCheckNAddStates(68, 70); } + jjCheckNAddStates(68, 70); break; case 129: - { jjCheckNAddStates(62, 67); } + jjCheckNAddStates(62, 67); break; case 132: if (curChar == 93 && kind > 172) @@ -3554,34 +3567,34 @@ else if ((0x20000000200L & l) != 0L) break; case 135: if ((0x7fffffe07fffffeL & l) != 0L) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 136: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if ((0x7fffffe87fffffeL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3589,11 +3602,11 @@ else if ((0x20000000200L & l) != 0L) break; case 145: if (curChar == 92) - { jjAddStates(123, 124); } + jjAddStates(123, 124); break; case 146: if ((0x4000000080000001L & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 148: if ((0x7e0000007eL & l) != 0L) @@ -3601,7 +3614,7 @@ else if ((0x20000000200L & l) != 0L) break; case 149: if ((0x7e0000007eL & l) != 0L) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 150: if ((0x7e0000007eL & l) != 0L) @@ -3624,7 +3637,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 156: if ((0x7e0000007eL & l) != 0L) @@ -3635,18 +3648,18 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 159: if ((0x1000000010L & l) != 0L) - { jjAddStates(113, 114); } + jjAddStates(113, 114); break; case 160: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(87, 89); } + jjCheckNAddStates(87, 89); break; case 162: - { jjCheckNAddStates(81, 86); } + jjCheckNAddStates(81, 86); break; case 165: if ((0x200000002L & l) != 0L && kind > 127) @@ -3682,10 +3695,10 @@ else if ((0x20000000200L & l) != 0L) break; case 175: if ((0x2000000020L & l) != 0L) - { jjCheckNAddStates(96, 98); } + jjCheckNAddStates(96, 98); break; case 177: - { jjCheckNAddStates(90, 95); } + jjCheckNAddStates(90, 95); break; case 180: if ((0x2000000020L & l) != 0L && kind > 128) @@ -3725,39 +3738,39 @@ else if ((0x20000000200L & l) != 0L) break; case 199: if ((0x2000000020L & l) != 0L) - { jjAddStates(125, 126); } + jjAddStates(125, 126); break; case 203: if ((0x2000000020L & l) != 0L) - { jjAddStates(127, 128); } + jjAddStates(127, 128); break; case 208: if ((0x2000000020L & l) != 0L) - { jjAddStates(129, 130); } + jjAddStates(129, 130); break; case 218: if ((0x2000000020L & l) != 0L) - { jjAddStates(131, 132); } + jjAddStates(131, 132); break; case 225: if ((0x2000000020L & l) != 0L) - { jjAddStates(133, 134); } + jjAddStates(133, 134); break; case 229: if ((0x2000000020L & l) != 0L) - { jjAddStates(135, 136); } + jjAddStates(135, 136); break; case 239: if ((0x2000000020L & l) != 0L) - { jjAddStates(137, 138); } + jjAddStates(137, 138); break; case 246: if ((0x2000000020L & l) != 0L) - { jjAddStates(139, 140); } + jjAddStates(139, 140); break; case 250: if ((0x2000000020L & l) != 0L) - { jjAddStates(141, 142); } + jjAddStates(141, 142); break; default : break; } @@ -3765,7 +3778,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (curChar >> 8); + int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -3776,29 +3789,29 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(107, 112); } + jjCheckNAddStates(107, 112); break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - { jjAddStates(26, 28); } + jjAddStates(26, 28); break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(23, 25); } + jjAddStates(23, 25); break; case 19: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 20: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(20, 21); } + jjCheckNAddTwoStates(20, 21); break; case 21: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -3809,83 +3822,83 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 25: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - { jjCheckNAdd(25); } + jjCheckNAdd(25); break; case 27: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 28: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - { jjCheckNAdd(28); } + jjCheckNAdd(28); break; case 35: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(35, 40); } + jjAddStates(35, 40); break; case 52: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(32, 34); } + jjAddStates(32, 34); break; case 66: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(29, 31); } + jjAddStates(29, 31); break; case 81: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(44, 47); } + jjAddStates(44, 47); break; case 101: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(50, 53); } + jjAddStates(50, 53); break; case 121: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(56, 61); } + jjAddStates(56, 61); break; case 129: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(62, 67); } + jjAddStates(62, 67); break; case 136: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(136, 137); } + jjCheckNAddTwoStates(136, 137); break; case 137: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(138); } + jjCheckNAdd(138); break; case 139: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddTwoStates(139, 140); } + jjCheckNAddTwoStates(139, 140); break; case 140: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAdd(141); } + jjCheckNAdd(141); break; case 142: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 143: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - { jjCheckNAddStates(75, 78); } + jjCheckNAddStates(75, 78); break; case 144: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -3893,13 +3906,13 @@ else if ((0x20000000200L & l) != 0L) break; case 162: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(81, 86); } + jjAddStates(81, 86); break; case 177: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - { jjAddStates(90, 95); } + jjAddStates(90, 95); break; - default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; + default : break; } } while(i != startsAt); } @@ -3935,6 +3948,7 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } +<<<<<<< HEAD /** Token literal values. */ public static final String[] jjstrLiteralImages = { @@ -3977,6 +3991,8 @@ protected Token jjFillToken() return t; } +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) static final int[] jjnextStates = { 192, 193, 194, 196, 197, 202, 203, 233, 234, 235, 237, 242, 212, 213, 214, 216, 221, 142, 153, 155, 120, 123, 124, 6, 7, 17, 1, 2, 4, 66, 67, 68, @@ -4049,6 +4065,111 @@ private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, lo } } +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, +null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, "\50", +"\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", +"\41\75", "\76", "\74", "\74\75", "\76\75", "\41", "\176", "\72", "\174\174", "\46\46", +"\53", "\55", "\52", "\57", "\136\136", "\100", "\174", "\136", "\55\76", "\74\55", +"\77", null, null, null, null, null, null, null, null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffffffe23feffffL, 0x3fL, +}; +static final long[] jjtoSkip = { + 0x7eL, 0x0L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0x40L, 0x0L, 0x0L, 0x0L, +}; +protected JavaCharStream input_stream; +private final int[] jjrounds = new int[253]; +private final int[] jjstateSet = new int[506]; +protected char curChar; +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream){ + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public SPARQLParser11TokenManager(JavaCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 253; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(JavaCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4070,10 +4191,9 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(Exception e) + catch(java.io.IOException e) { jjmatchedKind = 0; - jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4131,31 +4251,6 @@ public Token getNextToken() } } -void SkipLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} -void MoreLexicalActions() -{ - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch(jjmatchedKind) - { - default : - break; - } -} -void TokenLexicalActions(Token matchedToken) -{ - switch(jjmatchedKind) - { - default : - break; - } -} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) @@ -4183,6 +4278,7 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } +<<<<<<< HEAD /** Constructor. */ public SPARQLParser11TokenManager(JavaCharStream stream){ @@ -4276,4 +4372,6 @@ public void SwitchTo(int lexState) private int jjimageLen; private int lengthOfMatch; protected int curChar; +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java index 9c283db5a87..176e379371e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -97,7 +97,6 @@ public Token(int kind, String image) /** * Returns the image. */ - @Override public String toString() { return image; @@ -129,4 +128,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=d168c8aaa91566e8e4a37d907159a9b8 (do not edit this line) */ +/* JavaCC - OriginalChecksum=14a2dd2c56b347f7b769eacf6b50c9b9 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java index a7d04ca9323..a50f6cdf9fd 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - public static final int LEXICAL_ERROR = 0; + static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - public static final int STATIC_LEXER_ERROR = 1; + static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - public static final int INVALID_LEXICAL_STATE = 2; + static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - public static final int LOOP_DETECTED = 3; + static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,11 +50,13 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuilder retval = new StringBuilder(); + StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { + case 0 : + continue; case '\b': retval.append("\\b"); continue; @@ -97,7 +99,7 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * lexState : lexical state in which this error occurred + * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred @@ -122,7 +124,6 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ - @Override public String getMessage() { return super.getMessage(); } @@ -142,8 +143,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { - this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=b8503915d6e2e75526fb396931f35aa6 (do not edit this line) */ From de19a463425371b7ed235d1e08e87238b2c9eb19 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 12:58:05 +0200 Subject: [PATCH 234/323] support for DISTINCT in FOLD --- .../jena/sparql/expr/aggregate/AggFold.java | 56 ++++++++++--------- .../expr/aggregate/AggregatorFactory.java | 6 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index b30a46fe7f0..f25ce45c63a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -11,16 +11,14 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; @@ -30,12 +28,12 @@ public class AggFold extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final Expr expr1 ) { - this(expr1, null); + public AggFold( final boolean isDistinct, final Expr expr1 ) { + this(isDistinct, expr1, null); } - public AggFold( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { + super( "FOLD", isDistinct, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; @@ -63,7 +61,7 @@ public Aggregator copy( final ExprList exprs ) { final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - return new AggFold(_expr1, _expr2); + return new AggFold(isDistinct, _expr1, _expr2); } @Override @@ -79,7 +77,7 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { @Override public Accumulator createAccumulator() { if ( expr2 == null ) - return new ListAccumulator(); + return new ListAccumulator(expr1, isDistinct); else return new MapAccumulator(); } @@ -134,28 +132,38 @@ public String toPrefixString() { return out.asString(); } - protected class ListAccumulator implements Accumulator { + protected class ListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + @Override - public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v; - final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv == null ) { - v = CDTFactory.getNullValue(); - } - else { - v = CDTFactory.createValue( nv.asNode() ); - } + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. @Override public NodeValue getValue() { - final LiteralLabelForList lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return getAccValue(); } } @@ -190,9 +198,7 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final LiteralLabelForMap lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(map); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 6c492069c18..842d65fb273 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,11 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( distinct ) - throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; +// if ( distinct ) +// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(expr1, expr2) ; + return new AggFold(distinct, expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From 396ea867c9f8f0f45e256405c9f311dd16e1e7c4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:29:58 +0200 Subject: [PATCH 235/323] split AggFold into AggFoldList and AggFoldMap --- .../sparql/expr/aggregate/AggFoldList.java | 129 ++++++++++++++++++ .../{AggFold.java => AggFoldMap.java} | 100 +++----------- .../sparql/expr/aggregate/AggregatorBase.java | 3 +- .../expr/aggregate/AggregatorFactory.java | 7 +- 4 files changed, 155 insertions(+), 84 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java rename jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/{AggFold.java => AggFoldMap.java} (58%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java new file mode 100644 index 00000000000..49079b4fa1e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -0,0 +1,129 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFoldList extends AggregatorBase +{ + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { + super( "FOLD", isDistinct, expr1 ); + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() != 1 ) + throw new IllegalArgumentException(); + + final Expr _expr1 = exprs.get(0); + + return new AggFoldList(isDistinct, _expr1); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFoldList ) ) + return false; + final AggFoldList fold = (AggFoldList) other; + return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + } + + @Override + public Accumulator createAccumulator() { + return new ListAccumulator( getExpr(), isDistinct ); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + return HC_AggFoldList ^ getExpr().hashCode(); + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + if ( isDistinct ) + out.append("DISTINCT "); + + ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + + out.append(")"); + return out.asString(); + } + + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); + + if ( isDistinct ) + out.append(" distinct"); + + WriterExpr.output(out, getExpr(), null); + + out.decIndent(); + out.append(")"); + return out.asString(); + } + + protected class ListAccumulator extends AccumulatorExpr { + final protected List list = new ArrayList<>(); + + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + + @Override + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); + list.add(v); + } + + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. + @Override + public NodeValue getValue() { + return getAccValue(); + } + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java similarity index 58% rename from jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java rename to jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index f25ce45c63a..44eb12aaab1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,11 +1,8 @@ package org.apache.jena.sparql.expr.aggregate; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Locale; +import java.util.Map; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; @@ -23,63 +20,47 @@ import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; -public class AggFold extends AggregatorBase +public class AggFoldMap extends AggregatorBase { protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final boolean isDistinct, final Expr expr1 ) { - this(isDistinct, expr1, null); - } - - public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { - super( "FOLD", isDistinct, createExprList(expr1, expr2) ); + public AggFoldMap( final Expr expr1, final Expr expr2 ) { + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; } protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { - final ExprList l = new ExprList(expr1); - - if ( expr2 != null ) { - l.add(expr2); - } + final ExprList l = new ExprList(); + l.add(expr1); + l.add(expr2); return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 2 ) + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - final Iterator it = exprs.iterator(); - final Expr _expr1 = it.next(); - - Expr lookAhead = it.hasNext() ? it.next() : null; - - final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - - return new AggFold(isDistinct, _expr1, _expr2); + return new AggFoldMap( exprs.get(0), exprs.get(1) ); } @Override public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( other == null ) return false; if ( this == other ) return true; - if ( ! ( other instanceof AggFold ) ) + if ( ! ( other instanceof AggFoldMap ) ) return false; - final AggFold fold = (AggFold) other; + final AggFoldMap fold = (AggFoldMap) other; return exprList.equals(fold.exprList, bySyntax); } @Override public Accumulator createAccumulator() { - if ( expr2 == null ) - return new ListAccumulator(expr1, isDistinct); - else - return new MapAccumulator(); + return new MapAccumulator(); } @Override @@ -89,10 +70,10 @@ public Node getValueEmpty() { @Override public int hashCode() { - int hc = HC_AggFold; - for ( final Expr e : getExprList() ) { - hc ^= e.hashCode(); - } + int hc = HC_AggFoldMap; + hc ^= getExprList().get(0).hashCode(); + hc ^= getExprList().get(1).hashCode(); + return hc; } @@ -103,11 +84,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - - if ( expr2 != null ) { - out.append(", "); - ExprUtils.fmtSPARQL(out, expr2, sCxt); - } + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); out.append(")"); return out.asString(); @@ -121,52 +99,14 @@ public String toPrefixString() { out.incIndent(); WriterExpr.output(out, expr1, null); - - if ( expr2 != null ) { - out.append(", "); - WriterExpr.output(out, expr2, null); - } + out.append(", "); + WriterExpr.output(out, expr2, null); out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { - final protected List list = new ArrayList<>(); - - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { - super(expr, makeDistinct); - } - - @Override - protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.createValue( nv.asNode() ); - list.add(v); - } - - @Override - protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.getNullValue(); - list.add(v); - } - - @Override - protected NodeValue getAccValue() { - return CDTLiteralFunctionUtils.createNodeValue(list); - } - - // Overriding this function because the base class would otherwise not - // call getAccValue() in cases in which there was an error during the - // evaluation of the 'expr' for any of the solution mappings. For FOLD, - // however, errors do not cause an aggregation error but just produce - // null values in the created list. - @Override - public NodeValue getValue() { - return getAccValue(); - } - } - protected class MapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java index a6869d915b4..4942b842f48 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorBase.java @@ -187,6 +187,7 @@ public final boolean equals(Object other) { protected static final int HC_AggMode = 0x184 ; protected static final int HC_AggModeDistinct = 0x185 ; - protected static final int HC_AggFold = 0x186 ; + protected static final int HC_AggFoldList = 0x186 ; + protected static final int HC_AggFoldMap = 0x187 ; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 842d65fb273..b22a95806ff 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,11 +75,12 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { -// if ( distinct ) -// throw new NotImplemented("FOLD with DISTINCT not implemented yet") ; if ( orderBy != null ) System.out.println( "HERE!! " + orderBy.size() ); - return new AggFold(distinct, expr1, expr2) ; + if ( expr2 == null ) + return new AggFoldList(distinct, expr1) ; + else + return new AggFoldMap(expr1, expr2) ; } public static Aggregator createCustom(String iri, Args a) { From b4c87d2d76e208f31165c91cbf97606a26a03670 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:53:34 +0200 Subject: [PATCH 236/323] bug fix: correct creation of empty lists and empty maps in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 3 ++- .../sparql/expr/aggregate/AggFoldMap.java | 3 ++- .../library/cdt/CDTLiteralFunctionUtils.java | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 49079b4fa1e..3b766eb9672 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -51,7 +51,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final List emptyList = new ArrayList<>(); + return CDTLiteralFunctionUtils.createNode(emptyList); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 44eb12aaab1..5b64def36d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -65,7 +65,8 @@ public Accumulator createAccumulator() { @Override public Node getValueEmpty() { - return null; + final Map emptyMap = new HashMap<>(); + return CDTLiteralFunctionUtils.createNode(emptyMap); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 1fa1b956656..3e4b5b39b28 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -96,14 +96,30 @@ public static final Map checkAndGetMap( final NodeValue nv ) th return checkAndGetMap( nv.asNode() ); } + /** + * Creates a {@link NodeV} with a cdt:List literal that represents the + * given list. + */ + public static final Node createNode( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeFactory.createLiteral(lit); + } + + /** + * Creates a {@link Node} with a cdt:Map literal that represents the + * given map. + */ + public static final Node createNode( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + return NodeFactory.createLiteral(lit); + } + /** * Creates a {@link NodeValue} with a cdt:List literal that represents the * given list. */ public static final NodeValue createNodeValue( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(list) ); } /** @@ -111,9 +127,7 @@ public static final NodeValue createNodeValue( final List list ) { * given map. */ public static final NodeValue createNodeValue( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return NodeValue.makeNode( createNode(map) ); } } From e41b5276e38be8d708dc6c202cf5bd0721f3027d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 12 Oct 2023 17:31:31 +0200 Subject: [PATCH 237/323] support for ORDER BY in FOLD --- .../sparql/expr/aggregate/AggFoldList.java | 197 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 4 +- 2 files changed, 187 insertions(+), 14 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 3b766eb9672..9bc9e6c4904 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,14 +1,26 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; @@ -16,22 +28,77 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldList extends AggregatorBase { + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldList( final boolean isDistinct, final Expr expr1 ) { - super( "FOLD", isDistinct, expr1 ); + this(isDistinct, expr1, null); + } + + public AggFoldList( final boolean isDistinct, final Expr expr1, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", isDistinct, collectExprs(expr1, orderBy) ); + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } + } + + protected static ExprList collectExprs( final Expr expr1, final List orderBy ) { + final ExprList l = new ExprList(expr1); + + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 1 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 1 ) throw new IllegalArgumentException(); + + _expr1 = exprs.get(0); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+1 ) throw new IllegalArgumentException(); + - final Expr _expr1 = exprs.get(0); + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); - return new AggFoldList(isDistinct, _expr1); + _expr1 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldList(isDistinct, _expr1, _orderBy); } @Override @@ -41,12 +108,17 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldList ) ) return false; final AggFoldList fold = (AggFoldList) other; - return getExpr().equals(fold.getExpr(), bySyntax) && (isDistinct == fold.isDistinct); + return (isDistinct == fold.isDistinct) + && getExprList().get(0).equals(fold.getExprList().get(0), bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new ListAccumulator( getExpr(), isDistinct ); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingListAccumulator(); + else + return new BasicListAccumulator( getExprList().get(0), isDistinct ); } @Override @@ -69,7 +141,16 @@ public String asSparqlExpr( final SerializationContext sCxt ) { if ( isDistinct ) out.append("DISTINCT "); - ExprUtils.fmtSPARQL(out, getExpr(), sCxt); + ExprUtils.fmtSPARQL(out, getExprList().get(0), sCxt); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } out.append(")"); return out.asString(); @@ -85,17 +166,26 @@ public String toPrefixString() { if ( isDistinct ) out.append(" distinct"); - WriterExpr.output(out, getExpr(), null); + WriterExpr.output(out, getExprList().get(0), null); + + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } out.decIndent(); out.append(")"); return out.asString(); } - protected class ListAccumulator extends AccumulatorExpr { + protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); } @@ -127,4 +217,89 @@ public NodeValue getValue() { } } + protected class SortingListAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingListAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it; + if ( isDistinct ) + it = new DuplicateEliminationIterator( sbag.iterator() ); + else + it = sbag.iterator(); + + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + + /** + * Wraps another iterator which is assumed to return its elements in a + * sorted order (that is, all elements that are equal to one another are + * returned by the wrapped iterator directly one after another) and, then, + * returns the elements from that wrapped iterator without duplicates. + */ + protected static class DuplicateEliminationIterator implements Iterator { + protected final Iterator input; + protected E prevReturnedElmt = null; + protected E nextAvailableElmt = null; + + public DuplicateEliminationIterator( final Iterator input ) { + this.input = input; + + if ( input.hasNext() ) { + nextAvailableElmt = input.next(); + } + } + + @Override + public boolean hasNext() { + while ( nextAvailableElmt == null ) { + if ( ! input.hasNext() ) + return false; + + nextAvailableElmt = input.next(); + if ( prevReturnedElmt != null + && prevReturnedElmt.equals(nextAvailableElmt) ) { + // the current next element must not be returned because + // it is a duplicate of the previous returned element + nextAvailableElmt = null; + } + } + return true; + } + + @Override + public E next() { + if ( ! hasNext() ) { + throw new NoSuchElementException(); + } + + prevReturnedElmt = nextAvailableElmt; + nextAvailableElmt = null; + + return prevReturnedElmt; + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index b22a95806ff..2c59b3252c0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -75,10 +75,8 @@ public static Aggregator createAggNull() { } public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, List orderBy) { - if ( orderBy != null ) - System.out.println( "HERE!! " + orderBy.size() ); if ( expr2 == null ) - return new AggFoldList(distinct, expr1) ; + return new AggFoldList(distinct, expr1, orderBy) ; else return new AggFoldMap(expr1, expr2) ; } From 3454fa212af4d766ec18a02d3c90519265ef8379 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 13 Oct 2023 15:45:29 +0200 Subject: [PATCH 238/323] changes the tests of FOLD(DISTINCT ...) to capture the decision that multiple errors collapse into a single null value --- .../expr/aggregate/AccumulatorExpr.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java index d8c5de3f35a..4d59ad2632a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AccumulatorExpr.java @@ -35,7 +35,7 @@ public abstract class AccumulatorExpr implements Accumulator private long accCount = 0 ; protected long errorCount = 0 ; private final Expr expr ; - private final boolean makeDistinct; + protected final boolean makeDistinct; protected AccumulatorExpr(Expr expr, boolean makeDistinct) { this.expr = expr; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 9bc9e6c4904..2f679f7a679 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -184,6 +184,7 @@ public String toPrefixString() { protected static class BasicListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected boolean nullValueAdded = false; protected BasicListAccumulator( final Expr expr, final boolean makeDistinct ) { super(expr, makeDistinct); @@ -197,6 +198,15 @@ protected void accumulate( final NodeValue nv, final Binding binding, final Func @Override protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + // By definition of FOLD, evaluation errors result in null values + // for the created list. If FOLD is used with the keyword DISTINCT, + // then all errors collapse to a single null value. + if ( makeDistinct && nullValueAdded ) { + return; + } + + nullValueAdded = true; + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } @@ -237,12 +247,22 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { final Iterator it; - if ( isDistinct ) + final Accumulator acc; + if ( isDistinct ) { it = new DuplicateEliminationIterator( sbag.iterator() ); - else + acc = new BasicListAccumulator( getExprList().get(0), false ) { + @Override + protected void accumulateError( final Binding b, final FunctionEnv e ) { + if ( nullValueAdded ) return; + super.accumulateError(b, e); + } + }; + } + else { it = sbag.iterator(); + acc = new BasicListAccumulator( getExprList().get(0), false ); + } - final Accumulator acc = new BasicListAccumulator( getExprList().get(0), false ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); } From 69be5f9ecfbc6732302cf1658547e2b41727a015 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 14 Oct 2023 15:46:32 +0200 Subject: [PATCH 239/323] support for ORDER BY in FOLD for maps --- .../sparql/expr/aggregate/AggFoldMap.java | 137 +++++++++++++++++- .../expr/aggregate/AggregatorFactory.java | 2 +- 2 files changed, 130 insertions(+), 9 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 5b64def36d6..70eb9c57eac 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,15 +1,28 @@ package org.apache.jena.sparql.expr.aggregate; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; +import org.apache.jena.atlas.data.BagFactory; +import org.apache.jena.atlas.data.SerializationFactory; +import org.apache.jena.atlas.data.SortedDataBag; +import org.apache.jena.atlas.data.ThresholdPolicy; +import org.apache.jena.atlas.data.ThresholdPolicyFactory; import org.apache.jena.atlas.io.IndentedLineBuffer; import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.graph.Node; +import org.apache.jena.query.ARQ; +import org.apache.jena.query.SortCondition; import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.binding.BindingComparator; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -18,6 +31,7 @@ import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; +import org.apache.jena.sparql.system.SerializationFactoryFinder; import org.apache.jena.sparql.util.ExprUtils; public class AggFoldMap extends AggregatorBase @@ -25,27 +39,80 @@ public class AggFoldMap extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. + protected final List orderBy; + protected final ThresholdPolicy policy; + protected final Comparator comparator; + public AggFoldMap( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + this(expr1, expr2, null); + } + + public AggFoldMap( final Expr expr1, final Expr expr2, final List orderBy ) { + // We need to extract the expressions from the sort conditions + // as well in order for them to be considered by the algebra + // transformer that renames variables from subqueries (see + // {@link TransformScopeRename#RenameByScope}). + super( "FOLD", false, collectExprs(expr1, expr2, orderBy) ); this.expr1 = expr1; this.expr2 = expr2; + + this.orderBy = orderBy; + + if ( orderBy != null && ! orderBy.isEmpty() ) { + policy = ThresholdPolicyFactory.policyFromContext( ARQ.getContext() ); + comparator = new BindingComparator(orderBy); + } + else { + policy = null; + comparator = null; + } } - protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { + protected static ExprList collectExprs( final Expr expr1, final Expr expr2, final List orderBy ) { final ExprList l = new ExprList(); l.add(expr1); l.add(expr2); + if ( orderBy != null ) { + for ( final SortCondition c : orderBy ) { + l.add( c.getExpression() ); + } + } + return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() != 2 ) - throw new IllegalArgumentException(); + final Expr _expr1; + final Expr _expr2; + final List _orderBy; + if ( orderBy == null ) { + if ( exprs.size() != 2 ) throw new IllegalArgumentException(); - return new AggFoldMap( exprs.get(0), exprs.get(1) ); + _expr1 = exprs.get(0); + _expr2 = exprs.get(1); + _orderBy = null; + } + else { + if ( exprs.size() != orderBy.size()+2 ) throw new IllegalArgumentException(); + + + final Iterator cit = orderBy.iterator(); + final Iterator eit = exprs.iterator(); + + _expr1 = eit.next(); + _expr2 = eit.next(); + + _orderBy = new ArrayList<>( orderBy.size() ); + while ( eit.hasNext() ) { + final SortCondition c = new SortCondition( eit.next(), cit.next().getDirection() ); + _orderBy.add(c); + } + } + + return new AggFoldMap(_expr1, _expr2, _orderBy); } @Override @@ -55,12 +122,16 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { if ( ! ( other instanceof AggFoldMap ) ) return false; final AggFoldMap fold = (AggFoldMap) other; - return exprList.equals(fold.exprList, bySyntax); + return exprList.equals(fold.exprList, bySyntax) + && Objects.equals(orderBy, fold.orderBy); } @Override public Accumulator createAccumulator() { - return new MapAccumulator(); + if ( orderBy != null && ! orderBy.isEmpty() ) + return new SortingMapAccumulator(); + else + return new BasicMapAccumulator(); } @Override @@ -88,6 +159,15 @@ public String asSparqlExpr( final SerializationContext sCxt ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" ORDER BY "); + final Iterator it = orderBy.iterator(); + while ( it.hasNext() ) { + it.next().output(out, sCxt); + if ( it.hasNext() ) out.append(", "); + } + } + out.append(")"); return out.asString(); } @@ -103,12 +183,21 @@ public String toPrefixString() { out.append(", "); WriterExpr.output(out, expr2, null); + if ( orderBy != null && ! orderBy.isEmpty() ) { + out.append(" order by "); + out.incIndent(); + for ( final SortCondition c : orderBy ) { + c.output(out); + } + out.decIndent(); + } + out.decIndent(); out.append(")"); return out.asString(); } - protected class MapAccumulator implements Accumulator { + protected class BasicMapAccumulator implements Accumulator { final protected Map map = new HashMap<>(); @Override @@ -143,4 +232,36 @@ public NodeValue getValue() { } } + protected class SortingMapAccumulator implements Accumulator { + protected final SortedDataBag sbag; + protected FunctionEnv functionEnv = null; + + public SortingMapAccumulator() { + final SerializationFactory sf = SerializationFactoryFinder.bindingSerializationFactory(); + sbag = BagFactory.newSortedBag(policy, sf, comparator); + } + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + sbag.add(binding); + + if ( this.functionEnv == null ) + this.functionEnv = functionEnv; + } + + @Override + public NodeValue getValue() { + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicMapAccumulator(); + + while ( it.hasNext() ) { + acc.accumulate( it.next(), functionEnv ); + } + + sbag.close(); + + return acc.getValue(); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java index 2c59b3252c0..4d99bdeb9a2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggregatorFactory.java @@ -78,7 +78,7 @@ public static Aggregator createFold(boolean distinct, Expr expr1, Expr expr2, Li if ( expr2 == null ) return new AggFoldList(distinct, expr1, orderBy) ; else - return new AggFoldMap(expr1, expr2) ; + return new AggFoldMap(expr1, expr2, orderBy) ; } public static Aggregator createCustom(String iri, Args a) { From 6e3b2a67329724e8845875cfde7efd4b3f98de4d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:42:29 +0200 Subject: [PATCH 240/323] support for comparison (<, <=, >, >=) of cdt:Map literals --- .../apache/jena/cdt/CompositeDatatypeMap.java | 119 ++++++++++++++++++ .../apache/jena/sparql/expr/NodeValue.java | 13 ++ 2 files changed, 132 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e79b3bd3835..ca61fea0170 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,12 +1,18 @@ package org.apache.jena.cdt; +import java.util.Comparator; import java.util.Iterator; import java.util.Map; +import java.util.TreeSet; import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.xsd.impl.RDFLangString; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprNotComparableException; +import org.apache.jena.sparql.expr.NodeValue; public class CompositeDatatypeMap extends CompositeDatatypeBase> { @@ -168,6 +174,78 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { return true; } + /** + * Assumes that the datatype of both of the given literals is cdt:Map. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final Map map1; + final Map map2; + try { + map1 = getValue(value1); + map2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; + if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; + if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + + final CDTKeySorter keySorter = new CDTKeySorter(); + final TreeSet sortedKeys1 = new TreeSet<>(keySorter); + final TreeSet sortedKeys2 = new TreeSet<>(keySorter); + sortedKeys1.addAll( map1.keySet() ); + sortedKeys2.addAll( map2.keySet() ); + + final Iterator it1 = sortedKeys1.iterator(); + final Iterator it2 = sortedKeys2.iterator(); + final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTKey k1 = it1.next(); + final CDTKey k2 = it2.next(); + + final int kCmp = keySorter.compare(k1, k2); + if ( kCmp < 0 ) return Expr.CMP_LESS; + if ( kCmp > 0 ) return Expr.CMP_GREATER; + + + final CDTValue v1 = map1.get(k1); + final CDTValue v2 = map2.get(k2); + if ( v1.isNull() || v2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + final boolean nEqCmp; + try { + nEqCmp = n1.sameValueAs(n2); + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( nEqCmp == false ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + try { + final int vCmp = NodeValue.compare(nv1, nv2); + if ( vCmp != Expr.CMP_EQUAL ) + return vCmp; + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + } + } + + final int sizeDiff = map1.size() - map2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } + /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this @@ -205,4 +283,45 @@ public static Map getValue( final LiteralLabel lit ) throws Dat return map; } + protected static class CDTKeySorter implements Comparator { + @Override + public int compare( final CDTKey k1, final CDTKey k2 ) { + final Node n1 = k1.asNode(); + final Node n2 = k2.asNode(); + + if ( n1.isURI() ) { + if ( ! n2.isURI() ) { + return Expr.CMP_LESS; + } + + final String uri1 = n1.getURI(); + final String uri2 = n2.getURI(); + return uri1.compareTo(uri2); + } + else if ( n2.isURI() ) { + return Expr.CMP_GREATER; + } + + // at this point, both RDF terms (n1 and n2) should be literals + final String dt1 = n1.getLiteralDatatypeURI(); + final String dt2 = n2.getLiteralDatatypeURI(); + final int dtCmp = dt1.compareTo(dt2); + if ( dtCmp != 0 ) { + return dtCmp; + } + + final String lex1 = n1.getLiteralLexicalForm(); + final String lex2 = n2.getLiteralLexicalForm(); + final int lexCmp = lex1.compareTo(lex2); + if ( lexCmp != 0 || ! RDFLangString.rdfLangString.getURI().equals(dt1) ) { + return lexCmp; + } + + // at this point, both literals are rdf:LangString literals with the same value + final String lang1 = n1.getLiteralLanguage(); + final String lang2 = n2.getLiteralLanguage(); + return lang1.compareTo(lang2); + } + } + } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 3ae359062de..194b4a9e178 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -816,6 +816,19 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom } } + case VSPACE_CDT_MAP: + { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeMap.compare(lit1, lit2) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN: { // One or two unknown value spaces. From 715db70d3e3b3a04620eaa000762eaf2b20b64b9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:43:11 +0200 Subject: [PATCH 241/323] bug fix in comparison of cdt:List literals --- .../org/apache/jena/cdt/CompositeDatatypeList.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index d73d1314227..922a2b1679f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -24,6 +24,7 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprNotComparableException; import org.apache.jena.sparql.expr.NodeValue; @@ -199,9 +200,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( list1.isEmpty() && list2.isEmpty() ) return 0; - if ( list1.isEmpty() && ! list2.isEmpty() ) return -1; - if ( list2.isEmpty() && ! list1.isEmpty() ) return 1; + if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; + if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; + if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { @@ -231,11 +232,14 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - if ( c != 0 ) return c; + if ( c != Expr.CMP_EQUAL ) return c; } } - return ( list1.size() - list2.size() ); + final int sizeDiff = list1.size() - list2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; } /** From b48d317c0e872d98cdf9591a05dec14b9e13cdd1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 16 Oct 2023 13:16:08 +0200 Subject: [PATCH 242/323] bug fix in FOLD with both DISTINCT, as revealed by the 'fold-list-distinct-orderby-02' test --- .../sparql/expr/aggregate/AggFoldList.java | 67 +------------------ 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index 2f679f7a679..c02bfd0b5e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -246,22 +246,8 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final Iterator it; - final Accumulator acc; - if ( isDistinct ) { - it = new DuplicateEliminationIterator( sbag.iterator() ); - acc = new BasicListAccumulator( getExprList().get(0), false ) { - @Override - protected void accumulateError( final Binding b, final FunctionEnv e ) { - if ( nullValueAdded ) return; - super.accumulateError(b, e); - } - }; - } - else { - it = sbag.iterator(); - acc = new BasicListAccumulator( getExprList().get(0), false ); - } + final Iterator it = sbag.iterator(); + final Accumulator acc = new BasicListAccumulator( getExprList().get(0), isDistinct ); while ( it.hasNext() ) { acc.accumulate( it.next(), functionEnv ); @@ -273,53 +259,4 @@ protected void accumulateError( final Binding b, final FunctionEnv e ) { } } - /** - * Wraps another iterator which is assumed to return its elements in a - * sorted order (that is, all elements that are equal to one another are - * returned by the wrapped iterator directly one after another) and, then, - * returns the elements from that wrapped iterator without duplicates. - */ - protected static class DuplicateEliminationIterator implements Iterator { - protected final Iterator input; - protected E prevReturnedElmt = null; - protected E nextAvailableElmt = null; - - public DuplicateEliminationIterator( final Iterator input ) { - this.input = input; - - if ( input.hasNext() ) { - nextAvailableElmt = input.next(); - } - } - - @Override - public boolean hasNext() { - while ( nextAvailableElmt == null ) { - if ( ! input.hasNext() ) - return false; - - nextAvailableElmt = input.next(); - if ( prevReturnedElmt != null - && prevReturnedElmt.equals(nextAvailableElmt) ) { - // the current next element must not be returned because - // it is a duplicate of the previous returned element - nextAvailableElmt = null; - } - } - return true; - } - - @Override - public E next() { - if ( ! hasNext() ) { - throw new NoSuchElementException(); - } - - prevReturnedElmt = nextAvailableElmt; - nextAvailableElmt = null; - - return prevReturnedElmt; - } - } - } From 60ca2b083bce9b8915b50e8416a45d680ec64738 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 13:27:31 +0200 Subject: [PATCH 243/323] support for ORDER BY for cdt:List literals --- .../jena/cdt/CompositeDatatypeList.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- .../sparql/expr/aggregate/AggFoldList.java | 1 - 3 files changed, 114 insertions(+), 29 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 922a2b1679f..eaf17c59638 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -188,57 +188,143 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { /** * Assumes that the datatype of both of the given literals is cdt:List. + * If 'sortOrderingCompare' is true, the two lists are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the list-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final List list1; - final List list2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + List list1 = null; try { list1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + List list2 = null; + try { list2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( list1 == null || list2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the list-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( list1 != null ) return Expr.CMP_LESS; + if ( list2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( list1.isEmpty() && list2.isEmpty() ) return Expr.CMP_EQUAL; - if ( list1.isEmpty() && ! list2.isEmpty() ) return Expr.CMP_LESS; - if ( list2.isEmpty() && ! list1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two lists is empty, we can decide + // without a pair-wise comparison of the list elements. + if ( list1.isEmpty() || list2.isEmpty() ) { + // The literals with the non-empty list is greater + // than the literal with the empty list. + if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! list2.isEmpty() ) return Expr.CMP_LESS; + + // If both lists are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // list-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the list elements. final int n = Math.min( list1.size(), list2.size() ); for ( int i = 0; i < n; i++ ) { final CDTValue elmt1 = list1.get(i); final CDTValue elmt2 = list2.get(i); - if ( elmt1.isNull() || elmt2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); - - if ( n1.isBlank() && n2.isBlank() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + if ( ! elmt1.isNull() && ! elmt2.isNull() ) { + final Node n1 = elmt1.asNode(); + final Node n2 = elmt2.asNode(); - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } - final int c; - try { - c = NodeValue.compare(nv1, nv2); + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! elmt1.sameAs(elmt2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch ( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two list elements is null. + if ( ! sortOrderingCompare ) { + // When comparing as per the list-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - - if ( c != Expr.CMP_EQUAL ) return c; + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both elements are null, we + // don't do anything here and simply advance to the next + // pair of elements. + // However, if only one of the two elements is null, then + // the literal with this element is ordered lower than the + // other literal. + if ( elmt1.isNull() && ! elmt2.isNull() ) + return Expr.CMP_LESS; + + if ( elmt2.isNull() && ! elmt1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of list elements has not + // led to any decision. Now, we decide based on the size of the lists. final int sizeDiff = list1.size() - list2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; return Expr.CMP_EQUAL; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 194b4a9e178..945dc10bb76 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -808,7 +808,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeList.compare(lit1, lit2) ; + return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index c02bfd0b5e7..e53f8a45263 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.NoSuchElementException; import java.util.Objects; import org.apache.jena.atlas.data.BagFactory; From 58671769b2232d2cee647908ab808792e2937b05 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 16:23:02 +0200 Subject: [PATCH 244/323] support for ORDER BY for cdt:Map literals --- .../jena/cdt/CompositeDatatypeBase.java | 10 ++ .../jena/cdt/CompositeDatatypeList.java | 9 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 140 ++++++++++++++---- .../apache/jena/sparql/expr/NodeValue.java | 2 +- 4 files changed, 120 insertions(+), 41 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java index 5c1e768a424..ffeff44314d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeBase.java @@ -20,6 +20,8 @@ import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.Expr; public abstract class CompositeDatatypeBase implements RDFDatatype { @@ -47,4 +49,12 @@ public RDFDatatype normalizeSubType( final Object value, final RDFDatatype dt ) public abstract T parse( final String lexicalForm ) throws DatatypeFormatException; public abstract String unparseValue( final T value ); + + // helper for the compare function in each of the subclasses + protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { + final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); + if ( lexCmp < 0 ) return Expr.CMP_LESS; + if ( lexCmp > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index eaf17c59638..15c950d212c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -231,7 +231,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // If at least one of the two lists is empty, we can decide // without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { - // The literals with the non-empty list is greater + // The literal with the non-empty list is greater // than the literal with the empty list. if ( ! list1.isEmpty() ) return Expr.CMP_GREATER; if ( ! list2.isEmpty() ) return Expr.CMP_LESS; @@ -321,13 +321,6 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, return Expr.CMP_EQUAL; } - protected static int compareByLexicalForms( final LiteralLabel value1, final LiteralLabel value2 ) { - final int lexCmp = value1.getLexicalForm().compareTo( value2.getLexicalForm() ); - if ( lexCmp < 0 ) return Expr.CMP_LESS; - if ( lexCmp > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; - } - /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index ca61fea0170..3745596481f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -176,28 +176,73 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { /** * Assumes that the datatype of both of the given literals is cdt:Map. + * + * If 'sortOrderingCompare' is true, the two maps are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the map-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final Map map1; - final Map map2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + Map map1 = null; try { map1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + Map map2 = null; + try { map2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + // handling errors / ill-formed literals now + if ( map1 == null || map2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the map-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( map1 != null ) return Expr.CMP_LESS; + if ( map2 != null ) return Expr.CMP_GREATER; + + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } } - if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; - if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; - if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + // If at least one of the two maps is empty, we can decide + // without a pair-wise comparison of the map entries. + if ( map1.isEmpty() || map2.isEmpty() ) { + // The literal with the non-empty map is greater + // than the literal with the empty map. + if ( ! map1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! map2.isEmpty() ) return Expr.CMP_LESS; + + // If both maps are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // map-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + // Now we go into the pair-wise comparison of the map entries. + // To this end, we first need to sort the map entries. final CDTKeySorter keySorter = new CDTKeySorter(); final TreeSet sortedKeys1 = new TreeSet<>(keySorter); final TreeSet sortedKeys2 = new TreeSet<>(keySorter); sortedKeys1.addAll( map1.keySet() ); sortedKeys2.addAll( map2.keySet() ); + // Now we can perform the pair-wise comparison of the map entries. final Iterator it1 = sortedKeys1.iterator(); final Iterator it2 = sortedKeys2.iterator(); final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); @@ -209,41 +254,72 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 if ( kCmp < 0 ) return Expr.CMP_LESS; if ( kCmp > 0 ) return Expr.CMP_GREATER; - final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); - if ( v1.isNull() || v2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - final boolean nEqCmp; - try { - nEqCmp = n1.sameValueAs(n2); - } - catch( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - - if ( nEqCmp == false ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - try { - final int vCmp = NodeValue.compare(nv1, nv2); - if ( vCmp != Expr.CMP_EQUAL ) - return vCmp; + if ( ! v1.isNull() && ! v2.isNull() ) { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! n1.sameValueAs(n2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two map entries has null as its value. + if ( ! sortOrderingCompare ) { + // When comparing as per the map-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both map entries have null + // as their value, we don't do anything here and simply + // advance to the next pair of map entries. + // However, if the map value of only one of the two map + // entries is null, then the literal with this map entry + // is ordered lower than the other literal. + if ( v1.isNull() && ! v2.isNull() ) + return Expr.CMP_LESS; + + if ( v2.isNull() && ! v1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of map entries has not led + // to any decision. Now, we decide based on the size of the maps. final int sizeDiff = map1.size() - map2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; } /** diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 945dc10bb76..82275d4b24f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -821,7 +821,7 @@ private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCom final LiteralLabel lit1 = nv1.asNode().getLiteral() ; final LiteralLabel lit2 = nv2.asNode().getLiteral() ; try { - return CompositeDatatypeMap.compare(lit1, lit2) ; + return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; } catch( final ExprNotComparableException e ) { raise(e) ; From e7750de58bcae71223422f34f822998b018265e7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 20 Oct 2023 14:23:54 +0200 Subject: [PATCH 245/323] changed the implementation of ORDER BY for CDT literals such that the relative order is undefined if one of the compared literals is ill-formed --- .../jena/cdt/CompositeDatatypeList.java | 35 +++---------------- .../apache/jena/cdt/CompositeDatatypeMap.java | 35 +++---------------- 2 files changed, 10 insertions(+), 60 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 15c950d212c..de29b966b16 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -193,43 +193,18 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - List list1 = null; + final List list1; + final List list2; try { list1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - List list2 = null; - try { list2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( list1 == null || list2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the list-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( list1 != null ) return Expr.CMP_LESS; - if ( list2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two lists is empty, we can decide - // without a pair-wise comparison of the list elements. + // If at least one of the two lists is empty, then we can decide their + // relative order without a pair-wise comparison of the list elements. if ( list1.isEmpty() || list2.isEmpty() ) { // The literal with the non-empty list is greater // than the literal with the empty list. diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 3745596481f..24a76bbb7b5 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -182,43 +182,18 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - Map map1 = null; + final Map map1; + final Map map2; try { map1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - Map map2 = null; - try { map2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( map1 == null || map2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the map-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( map1 != null ) return Expr.CMP_LESS; - if ( map2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two maps is empty, we can decide - // without a pair-wise comparison of the map entries. + // If at least one of the two maps is empty, then we can decide their + // relative order without a pair-wise comparison of the map entries. if ( map1.isEmpty() || map2.isEmpty() ) { // The literal with the non-empty map is greater // than the literal with the empty map. From 66ef7e084fafe49f8884aabe2d74ba15877939fd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 Nov 2023 19:03:52 +0100 Subject: [PATCH 246/323] implements the decision that 'null=null' is true rather than an error --- .../jena/cdt/CompositeDatatypeList.java | 91 ++++++++++++------- .../apache/jena/cdt/CompositeDatatypeMap.java | 85 +++++++++++------ 2 files changed, 113 insertions(+), 63 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index de29b966b16..e680a30c99f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -168,18 +168,21 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final CDTValue v2 = it2.next(); if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); - } + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } - if ( ! n1.sameValueAs(n2) ) { - return false; + if ( ! n1.sameValueAs(n2) ) { + return false; + } } } @@ -227,36 +230,57 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue elmt2 = list2.get(i); if ( ! elmt1.isNull() && ! elmt2.isNull() ) { - final Node n1 = elmt1.asNode(); - final Node n2 = elmt2.asNode(); + final NodeValue nv1 = NodeValue.makeNode( elmt1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( elmt2.asNode() ); - if ( ! sortOrderingCompare && n1.isBlank() && n2.isBlank() ) { + if ( ! sortOrderingCompare && nv1.isBlank() && nv2.isBlank() ) { throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! elmt1.sameAs(elmt2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - + // Compare the values represented by the two list elements + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // lists. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of list elements. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -264,8 +288,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two list elements is null. if ( ! sortOrderingCompare ) { // When comparing as per the list-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! elmt1.isNull() || ! elmt2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 24a76bbb7b5..e3a2ad317cd 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -158,17 +158,20 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v2 == null ) return false; if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + if ( ! n1.sameValueAs(n2) ) return false; } - - if ( ! n1.sameValueAs(n2) ) return false; } return true; @@ -232,32 +235,53 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); if ( ! v1.isNull() && ! v2.isNull() ) { - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! n1.sameValueAs(n2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + final NodeValue nv1 = NodeValue.makeNode( v1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + // Compare the actual values represented by the two map values + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // maps. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of map entries. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -265,8 +289,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two map entries has null as its value. if ( ! sortOrderingCompare ) { // When comparing as per the map-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! v1.isNull() || ! v2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are From 6cb18705fe0f597c16ca148166fbfd389a4d2930 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Dec 2023 13:41:20 +0100 Subject: [PATCH 247/323] implements the decision that null is not equal to any RDF term --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index e680a30c99f..b630fc4c864 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -169,7 +169,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in lists cannot be compared to something other than nulls"); + return false; } } else { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index e3a2ad317cd..59b52ebed89 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -159,7 +159,7 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + return false; } } else { From 4a1ab4a9881ba7e29b8a5b430d159ed7d900d238 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 8 Jan 2024 19:29:16 +0100 Subject: [PATCH 248/323] bug fix: map keys cannot be blank nodes --- jena-arq/Grammar/cdt_literals.jj | 2 -- .../java/org/apache/jena/cdt/parser/CDTLiteralParser.java | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 514be16467b..24b3d46524d 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -140,8 +140,6 @@ CDTKey MapKey() : { String iri; Node n; } { iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } | - n = BlankNode() { return CDTFactory.createKey(n); } -| n = RDFLiteral() { return CDTFactory.createKey(n); } | n = NumericLiteral() { return CDTFactory.createKey(n); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 8f0b6cb9404..27a51bed270 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -139,7 +139,6 @@ final public Map Map() throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case IRIref: - case BLANK_NODE_LABEL: NonEmptyMapContent(m); break; default: @@ -184,10 +183,6 @@ final public CDTKey MapKey() throws ParseException { iri = IRI_REF(); n = createNode(iri); {if (true) return CDTFactory.createKey(n);} break; - case BLANK_NODE_LABEL: - n = BlankNode(); - {if (true) return CDTFactory.createKey(n);} - break; case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: @@ -401,7 +396,7 @@ final public String String() throws ParseException { jj_la1_init_1(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x6f0f80,0x80000000,0x6f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; + jj_la1_0 = new int[] {0x2c6f0f80,0x80000000,0x2c6f0f80,0x2f0f80,0x80000000,0x2f0f80,0x2c6f0f80,0xe00,0x180,0x800000,0x800000,0xf0000,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x0,}; From c1c8add0c836bd995c90cf5716eea800017775f2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:28:47 +0100 Subject: [PATCH 249/323] changes CDTLiteralParserBase to extend LangParserBase instead of TurtleParserBase because, in later versions of Jena, TurtleParserBase has been removed --- jena-arq/Grammar/cdt_literals.jj | 16 +++++++++------- .../apache/jena/cdt/CDTLiteralParserBase.java | 8 ++++---- .../apache/jena/cdt/ParserForCDTLiterals.java | 3 +++ .../apache/jena/cdt/parser/CDTLiteralParser.java | 16 +++++++++------- .../cdt/parser/CDTLiteralParserTokenManager.java | 1 + 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 24b3d46524d..d2e098b906c 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -58,6 +58,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase { } @@ -85,7 +87,7 @@ void NonEmptyListContent(List l) : { } void ListElement(List l) : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); } | n = BlankNode() { l.add( CDTFactory.createValue(n) ); } | @@ -138,7 +140,7 @@ void MapEntry(Map m) : { CDTKey key; CDTValue value; } CDTKey MapKey() : { String iri; Node n; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createKey(n); } | n = RDFLiteral() { return CDTFactory.createKey(n); } | @@ -149,7 +151,7 @@ CDTKey MapKey() : { String iri; Node n; } CDTValue MapValue() : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createValue(n); } | n = BlankNode() { return CDTFactory.createValue(n); } | @@ -186,9 +188,9 @@ Node BlankNode() : { Token t = null ; } Node NumericLiteral() : { Token t ; } { - t = { return createLiteralInteger(t.image); } -| t = { return createLiteralDecimal(t.image); } -| t = { return createLiteralDouble(t.image); } + t = { return createLiteralInteger(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDecimal(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDouble(t.image, t.beginLine, t.beginColumn); } } Node BooleanLiteral() : {} @@ -210,7 +212,7 @@ Node RDFLiteral() : { String lex = null ; } )? { - return createLiteral(lex, lang, dt); + return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index e42b9c339d0..9d4bac04dd6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -3,12 +3,12 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.ttl.turtle.TurtleParserBase; +import org.apache.jena.riot.lang.extra.LangParserBase; -public class CDTLiteralParserBase extends TurtleParserBase +public class CDTLiteralParserBase extends LangParserBase { @Override - protected Node createLiteral( final String lex, final String langTag, final String datatypeURI ) { + protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { final LiteralLabel lit = new LiteralLabelForList(lex); return NodeFactory.createLiteral(lit); @@ -19,7 +19,7 @@ protected Node createLiteral( final String lex, final String langTag, final Stri return NodeFactory.createLiteral(lit); } - return super.createLiteral(lex, langTag, datatypeURI); + return super.createLiteral(lex, langTag, datatypeURI, line, column); } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 4284f6f3c1d..02700094c5e 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -28,6 +28,7 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; import org.apache.jena.util.FileUtils; @@ -59,6 +60,7 @@ public static List parseListLiteral( final Reader reader, final boolea final List list; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -117,6 +119,7 @@ public static Map parseMapLiteral( final Reader reader, final b final Map map; try { final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java index 27a51bed270..febae9906be 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParser.java @@ -27,6 +27,8 @@ import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase implements CDTLiteralParserConstants { // --- Entry point for cdt:List literals @@ -81,7 +83,7 @@ final public void ListElement(List l) throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); l.add( CDTFactory.createValue(n) ); + n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -181,7 +183,7 @@ final public CDTKey MapKey() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createKey(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createKey(n);} break; case STRING_LITERAL1: case STRING_LITERAL2: @@ -214,7 +216,7 @@ final public CDTValue MapValue() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IRIref: iri = IRI_REF(); - n = createNode(iri); {if (true) return CDTFactory.createValue(n);} + n = createURI(iri, token.beginLine, token.beginColumn); {if (true) return CDTFactory.createValue(n);} break; case BLANK_NODE_LABEL: n = BlankNode(); @@ -278,15 +280,15 @@ final public Node NumericLiteral() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INTEGER: t = jj_consume_token(INTEGER); - {if (true) return createLiteralInteger(t.image);} + {if (true) return createLiteralInteger(t.image, t.beginLine, t.beginColumn);} break; case DECIMAL: t = jj_consume_token(DECIMAL); - {if (true) return createLiteralDecimal(t.image);} + {if (true) return createLiteralDecimal(t.image, t.beginLine, t.beginColumn);} break; case DOUBLE: t = jj_consume_token(DOUBLE); - {if (true) return createLiteralDouble(t.image);} + {if (true) return createLiteralDouble(t.image, t.beginLine, t.beginColumn);} break; default: jj_la1[7] = jj_gen; @@ -339,7 +341,7 @@ final public Node RDFLiteral() throws ParseException { jj_la1[10] = jj_gen; ; } - {if (true) return createLiteral(lex, lang, dt);} + {if (true) return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn);} throw new Error("Missing return statement in function"); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java index bcf9c3cb8e2..9f7b775c892 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/parser/CDTLiteralParserTokenManager.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; /** Token Manager. */ public class CDTLiteralParserTokenManager implements CDTLiteralParserConstants From c45a00408ea3cd2a933c65a3a604bb1dcb1d6d39 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:36:58 +0100 Subject: [PATCH 250/323] moves the CDT literals grammar to the subdirectory './jena-arq/Grammar/CDTs/' --- jena-arq/Grammar/{ => CDTs}/cdt_literals.jj | 0 jena-arq/Grammar/{grammarCDTs => CDTs/generate} | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename jena-arq/Grammar/{ => CDTs}/cdt_literals.jj (100%) rename jena-arq/Grammar/{grammarCDTs => CDTs/generate} (90%) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/CDTs/cdt_literals.jj similarity index 100% rename from jena-arq/Grammar/cdt_literals.jj rename to jena-arq/Grammar/CDTs/cdt_literals.jj diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/CDTs/generate similarity index 90% rename from jena-arq/Grammar/grammarCDTs rename to jena-arq/Grammar/CDTs/generate index 8bbaf8685d4..687b81f0532 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/CDTs/generate @@ -17,7 +17,7 @@ # Parser builder -DIR="../src/main/java/org/apache/jena/cdt/parser" +DIR="../../src/main/java/org/apache/jena/cdt/parser" FILE=cdt_literals.jj CLASS=CDTLiteralParser @@ -57,8 +57,8 @@ sed -e 's/@SuppressWarnings("serial")//' \ mv F $F echo "---- Create HTML form ----" -./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html -./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html +../jj2html ${FILE%%.jj}.txt '../tokens.txt' > ${FILE%%.jj}-1.html +../grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html echo "Check X and Y for IRI_REF because \" became '" From 5aabb495dde37fca75261351b79e78475c0ebbe9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Mar 2024 14:25:50 +0100 Subject: [PATCH 251/323] adds license comment at the begin oft he files --- .../apache/jena/cdt/CDTLiteralParserBase.java | 18 ++++++++++++++++++ .../apache/jena/cdt/CompositeDatatypeMap.java | 18 ++++++++++++++++++ .../apache/jena/cdt/LiteralLabelForCDTs.java | 18 ++++++++++++++++++ .../sparql/expr/aggregate/AggFoldList.java | 18 ++++++++++++++++++ .../jena/sparql/expr/aggregate/AggFoldMap.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctionUtils.java | 18 ++++++++++++++++++ .../library/cdt/CDTLiteralFunctions.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ConcatFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsKeyFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ContainsTermFct.java | 18 ++++++++++++++++++ .../library/cdt/FunctionBase1List.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/GetFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/HeadFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/KeysFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/ListFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MapFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/MergeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/PutFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/RemoveFct.java | 18 ++++++++++++++++++ .../function/library/cdt/ReverseFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SizeFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/SubSeqFct.java | 18 ++++++++++++++++++ .../sparql/function/library/cdt/TailFct.java | 18 ++++++++++++++++++ 24 files changed, 432 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 9d4bac04dd6..86f89242fe4 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import org.apache.jena.graph.Node; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 59b52ebed89..999c087dca6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Comparator; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 6fea1cfee96..b835f619c83 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.cdt; import java.util.Objects; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java index e53f8a45263..52687ef030c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldList.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java index 70eb9c57eac..923e42934bc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFoldMap.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 3e4b5b39b28..d7449b162f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java index 48f5d4a7465..35b2e78a78b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctions.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.sparql.ARQConstants; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java index fc7ed60734d..6a0dba23500 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ConcatFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index f9751d78ca5..462398e98f8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java index eca1978ba1e..88a46fd2d08 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsKeyFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Map; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java index da670a6508e..e5fc0421f49 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsTermFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java index b6f45b33e4b..0b2af548103 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/FunctionBase1List.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java index c83cd9b764f..24bcbfcfb50 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/GetFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java index 1f331c936ac..0eb1348f986 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/HeadFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java index 6c393370ff1..2c919eb9347 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/KeysFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java index ca7c0f92715..dc50559d9f2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ListFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.ArrayList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java index 3dba18232eb..fec5c220524 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MapFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java index ddeb872b3ce..344f3117fae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/MergeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java index 0df7dcfdf00..428c000d5bb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/PutFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java index 0a4a5a99b36..b5df5a5a292 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/RemoveFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.HashMap; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java index 3d28e7a76e0..9b918036c72 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ReverseFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Arrays; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java index 5166f1440d9..e0bb791c076 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SizeFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import org.apache.jena.cdt.CompositeDatatypeList; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java index 80a99fb32f0..e508185c7dc 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/SubSeqFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.Collections; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java index 70805975786..aee058e6586 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/TailFct.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.sparql.function.library.cdt; import java.util.List; From b5f98d5f1c9ba8b072135f99f1b7f7fee38425fc Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 13 Jan 2024 11:25:30 +0100 Subject: [PATCH 252/323] extends LiteralLabelForCDTs with a constructor to pass both the lexical form and the value form --- .../org/apache/jena/cdt/LiteralLabelForCDTs.java | 13 +++++++++++++ .../org/apache/jena/cdt/LiteralLabelForList.java | 9 +++++++++ .../org/apache/jena/cdt/LiteralLabelForMap.java | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index b835f619c83..cd1df7b2b86 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -48,6 +48,19 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForCDTs( final String lexicalForm, final T valueForm ) { + this.valueForm = valueForm; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + @Override public abstract CompositeDatatypeBase getDatatype(); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index e84fe915333..32c1331befc 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,15 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForList( final String lexicalForm, final List valueForm ) { + super(lexicalForm , valueForm); + } + @Override public CompositeDatatypeList getDatatype() { return CompositeDatatypeList.type; diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 18ad753f62c..028fb646c5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,15 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + /** + * Use this constructor only if you have made sure that the given lexical + * form parses indeed into the given value form, which implicitly also + * means that the given lexical form is well formed. + */ + public LiteralLabelForMap( final String lexicalForm, final Map valueForm ) { + super(lexicalForm, valueForm); + } + @Override public CompositeDatatypeMap getDatatype() { return CompositeDatatypeMap.type; From 26280be1d7d34df2657a70f322381d6a365390ab Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 18 May 2024 10:54:01 +0200 Subject: [PATCH 253/323] permanent URI for the CDT datatypes and functions --- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 2 +- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index b630fc4c864..0edfd9b0a63 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -31,7 +31,7 @@ public class CompositeDatatypeList extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/List"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/List"; public final static CompositeDatatypeList type = new CompositeDatatypeList(); protected CompositeDatatypeList() {} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 999c087dca6..23516072ec2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -34,7 +34,7 @@ public class CompositeDatatypeMap extends CompositeDatatypeBase> { - public final static String uri = "http://example.org/cdt/Map"; + public final static String uri = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/Map"; public final static CompositeDatatypeMap type = new CompositeDatatypeMap(); protected CompositeDatatypeMap() {} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java index 4428b80c65d..d18420b3f6d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java @@ -81,7 +81,7 @@ public class ARQConstants public static final String javaClassURIScheme = "java:" ; /** The ARQ function library URI space */ - public static final String CDTFunctionLibraryURI = "http://example.org/cdt/" ; + public static final String CDTFunctionLibraryURI = "http://w3id.org/awslabs/neptune/SPARQL-CDTs/" ; /** The ARQ function library URI space */ public static final String ARQFunctionLibraryURI = "http://jena.apache.org/ARQ/function#" ; From 49bb7e7d9259065c04339d26d2eef75c605b7916 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 25 May 2024 18:18:32 +0300 Subject: [PATCH 254/323] removes the InputStream versions of parseListLiteral and parseMapLiteral --- .../apache/jena/cdt/ParserForCDTLiterals.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index 02700094c5e..fbaed36de26 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -45,17 +45,6 @@ public static List parseListLiteral( final String lex, final boolean r return result; } - public static List parseListLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final List result = parseListLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static List parseListLiteral( final Reader reader, final boolean recursive ) { final List list; try { @@ -104,17 +93,6 @@ public static Map parseMapLiteral( final String lex, final bool return result; } - public static Map parseMapLiteral( final InputStream in, final boolean recursive ) { - final Reader reader = FileUtils.asUTF8(in); - final Map result = parseMapLiteral(reader, recursive); - - try { reader.close(); } catch ( final IOException ex ) { - throw new CDTLiteralParseException("Closing the reader caused an exception.", ex); - } - - return result; - } - public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { final Map map; try { From ced5f7c0a728c10ce7081fc4490f0b8be70267cd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:20:09 +0300 Subject: [PATCH 255/323] adds the possibility to create CDT literals that are known to be ill-formed (because their lexical form has already been checked) --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 5 +++++ .../java/org/apache/jena/cdt/CompositeDatatypeMap.java | 5 +++++ .../java/org/apache/jena/cdt/LiteralLabelForCDTs.java | 8 ++++++++ .../java/org/apache/jena/cdt/LiteralLabelForList.java | 4 ++++ .../main/java/org/apache/jena/cdt/LiteralLabelForMap.java | 4 ++++ .../function/library/cdt/CDTLiteralFunctionUtils.java | 6 ++++++ 6 files changed, 32 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 0edfd9b0a63..c250c09dbcf 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -196,6 +196,11 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { * applies the list-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final List list1; final List list2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 23516072ec2..587e30f9805 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -203,6 +203,11 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final Map map1; final Map map2; try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index cd1df7b2b86..48eb6c0f0fe 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -48,6 +48,14 @@ public LiteralLabelForCDTs( final String lexicalForm ) { this.hash = lexicalForm.hashCode(); } + public LiteralLabelForCDTs( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + this.valueForm = null; + this.lexicalForm = lexicalForm; + + this.lexicalFormTested = true; + this.hash = lexicalForm.hashCode(); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java index 32c1331befc..60f76f02c71 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java @@ -32,6 +32,10 @@ public LiteralLabelForList( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForList( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java index 028fb646c5c..c3a18961075 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java @@ -32,6 +32,10 @@ public LiteralLabelForMap( final String lexicalForm ) { super(lexicalForm); } + public LiteralLabelForMap( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { + super(lexicalForm, checkedAndIdentifiedAsIllformed ); + } + /** * Use this constructor only if you have made sure that the given lexical * form parses indeed into the given value form, which implicitly also diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index d7449b162f8..37ff826a846 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -63,6 +63,9 @@ public static final void ensureMapLiteral( final Node n ) throws ExprEvalExcepti * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. */ public static final List getList( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeList.getValue( n.getLiteral() ); } @@ -80,6 +83,9 @@ public static final List getList( final Node n ) throws ExprEvalExcept * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. */ public static final Map getMap( final Node n ) throws ExprEvalException { + if ( ! n.getLiteral().isWellFormed() ) + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n); + try { return CompositeDatatypeMap.getValue( n.getLiteral() ); } From eecfc043381786c373718453f29804466f3bdc02 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:41:10 +0300 Subject: [PATCH 256/323] changes the parsing of CDT literals such that the scope of bnode identifiers extends to all CDT literals within a file as well as to the file itself; as per https://github.com/awslabs/SPARQL-CDTs/pull/2 and https://github.com/awslabs/SPARQL-CDTs/pull/4 --- .../apache/jena/cdt/CDTLiteralParserBase.java | 20 ++-- .../apache/jena/cdt/ParserForCDTLiterals.java | 41 ++++++--- .../java/org/apache/jena/riot/RDFParser.java | 2 +- .../riot/system/CDTAwareParserProfile.java | 92 +++++++++++++++++++ .../org/apache/jena/riot/system/RiotLib.java | 4 +- .../jena/sparql/lang/arq/ARQParserBase.java | 59 ++++++++++++ 6 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java index 86f89242fe4..7e26446c20f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTLiteralParserBase.java @@ -19,22 +19,30 @@ package org.apache.jena.cdt; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.lang.extra.LangParserBase; public class CDTLiteralParserBase extends LangParserBase { + @Override + protected Node createBNode( final String label, final int line, final int column ) { + // We need to cut away the leading '_:' of the given blank node label. + // This is necessary because the Turtle parser does the same. If we + // would not do it here for the blank node labels obtained from the + // lexical forms of CDT literals, then the label-to-bnode mapping of + // the shared parser state fails to map the same blank node identifiers + // inside and outside of CDT literals to the same blank node. + final String lbl = label.startsWith("_:") ? label.substring(2) : label; + return super.createBNode(lbl, line, column); + } + @Override protected Node createLiteral( final String lex, final String langTag, final String datatypeURI, final int line, final int column ) { if ( CompositeDatatypeList.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForList(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeList.type, 0L, 0L); } if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) { - final LiteralLabel lit = new LiteralLabelForMap(lex); - return NodeFactory.createLiteral(lit); + return profile.createTypedLiteral(lex, CompositeDatatypeMap.type, 0L, 0L); } return super.createLiteral(lex, langTag, datatypeURI, line, column); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index fbaed36de26..b4297a8ce91 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -18,7 +18,6 @@ package org.apache.jena.cdt; -import java.io.InputStream; import java.io.IOException; import java.io.Reader; import java.io.StringReader; @@ -28,15 +27,19 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; import org.apache.jena.graph.Node; +import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; import org.apache.jena.ttl.turtle.parser.TokenMgrError; -import org.apache.jena.util.FileUtils; public class ParserForCDTLiterals { public static List parseListLiteral( final String lex, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final List result = parseListLiteral(reader, recursive); + final List result = parseListLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -46,10 +49,15 @@ public static List parseListLiteral( final String lex, final boolean r } public static List parseListLiteral( final Reader reader, final boolean recursive ) { + return parseListLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static List parseListLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final List list; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); list = parser.List(); } catch ( final ParseException | TokenMgrError ex ) { @@ -68,11 +76,11 @@ public static List parseListLiteral( final Reader reader, final boolea if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); list.set( i, CDTFactory.createValue(subMap) ); } } @@ -83,8 +91,12 @@ else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof } public static Map parseMapLiteral( final String lex, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), lex, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { final Reader reader = new StringReader(lex); - final Map result = parseMapLiteral(reader, recursive); + final Map result = parseMapLiteral(pp, reader, recursive); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -94,10 +106,15 @@ public static Map parseMapLiteral( final String lex, final bool } public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { + return parseMapLiteral( RiotLib.dftProfile(), reader, recursive ); + } + + public static Map parseMapLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + final CDTLiteralParser parser = new CDTLiteralParser(reader); + parser.setProfile(pp); + final Map map; try { - final CDTLiteralParser parser = new CDTLiteralParser(reader); - parser.setProfile( RiotLib.dftProfile() ); map = parser.Map(); } catch ( final ParseException | TokenMgrError ex ) { @@ -116,11 +133,11 @@ public static Map parseMapLiteral( final Reader reader, final b if ( v.isNode() ) { final Node vn = v.asNode(); if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(vn.getLiteralLexicalForm(), recursive); + final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subList) ); } else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(vn.getLiteralLexicalForm(), recursive); + final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); map.put( key, CDTFactory.createValue(subMap) ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java index 35c451d004c..f9e04c747c6 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java @@ -553,7 +553,7 @@ private ParserProfile makeParserProfile(Lang lang) { ? resolver : IRIxResolver.create().base(baseStr).resolve(resolve).allowRelative(allowRelative).build(); PrefixMap pmap = ( this.prefixMap != null ) ? this.prefixMap : PrefixMapFactory.create(); - ParserProfileStd parserFactory = new ParserProfileStd(factory, errorHandler, + ParserProfileStd parserFactory = new CDTAwareParserProfile(factory, errorHandler, parserResolver, pmap, context, checking$, strict); return parserFactory; diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java new file mode 100644 index 00000000000..3b904f091b6 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -0,0 +1,92 @@ +package org.apache.jena.riot.system; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.cdt.ParserForCDTLiterals; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.irix.IRIxResolver; +import org.apache.jena.sparql.util.Context; + +/** + * This is a {@link ParserProfile} that supports parsing of CDT literals + * that occur within the parsed file. The main point is to share the + * {@link FactoryRDF} object of this parser profile with the parser of + * these literals in order to get the same blank nodes for the same + * blank node identifiers both within and outside of the literals, as + * well as across multiple CDT literals that occur in the parsed file. + */ +public class CDTAwareParserProfile extends ParserProfileStd { + + public CDTAwareParserProfile( final FactoryRDF factory, + final ErrorHandler errorHandler, + final IRIxResolver resolver, + final PrefixMap prefixMap, + final Context context, + final boolean checking, + final boolean strictMode ) { + super(factory, errorHandler, resolver, prefixMap, context, checking, strictMode); + } + + @Override + public Node createTypedLiteral( final String lex, final RDFDatatype datatype, final long line, final long col ) { + if ( datatype.equals(CompositeDatatypeList.type) ) { + return createListLiteral(lex); + } + + if ( datatype.equals(CompositeDatatypeMap.type) ) { + return createMapLiteral(lex); + } + + return super.createTypedLiteral(lex, datatype, line, col); + } + + protected Node createListLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final List value; + try { + value = ParserForCDTLiterals.parseListLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForList(lex, value); + return NodeFactory.createLiteral(lit); + } + + protected Node createMapLiteral( final String lex ) { + // Attention: In contrast to the overridden createTypedLiteral function + // in the superclass, for literals of the CDT datatypes we do not perform + // a checkLiteral check because that would parse the lexical form of the + // literal already once before doing the other parse to obtain the value. + + final boolean recursive = false; + final Map value; + try { + value = ParserForCDTLiterals.parseMapLiteral(this, lex, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); + } + + final LiteralLabel lit = new LiteralLabelForMap(lex, value); + return NodeFactory.createLiteral(lit); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java index b81691b2891..11e3568a3e3 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java @@ -224,7 +224,7 @@ public static ParserProfile dftProfile() { * Create a {@link ParserProfile} with default settings, and a specific error handler. */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, IRIxResolver.create(IRIs.getSystemBase()).build(), PrefixMapFactory.create(), @@ -238,7 +238,7 @@ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler */ public static ParserProfile createParserProfile(FactoryRDF factory, ErrorHandler errorHandler, IRIxResolver resolver, boolean checking) { - return new ParserProfileStd(factory, + return new CDTAwareParserProfile(factory, errorHandler, resolver, PrefixMapFactory.create(), diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java index 9ee67142138..ce3350e2f0e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java @@ -22,7 +22,17 @@ import org.apache.jena.atlas.json.io.JSONHandler ; import org.apache.jena.atlas.json.io.JSONHandlerBase ; import org.apache.jena.atlas.lib.NotImplemented ; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.riot.system.ParserProfile; +import org.apache.jena.riot.system.RiotLib; import org.apache.jena.sparql.core.BasicPattern; import org.apache.jena.sparql.core.Quad; import org.apache.jena.sparql.lang.SPARQLParserBase ; @@ -89,4 +99,53 @@ protected ElementGroup createQueryPattern(Template t){ } return elg; } + + // CDT literals + protected ParserProfile parserProfileForCDTs = null; + + @Override + protected Node createLiteral(String lexicalForm, String langTag, String datatypeURI) { + // CDT literals need to be handled in a special way because their + // lexical forms may contain blank node identifiers, and the same + // blank node identifier in different CDT literals within the same + // query must be mapped to the same blank node. To this end, we are + // reusing the same ParserProfile for parsing all the CDT literals. + final RDFDatatype cdtDatatype; + if ( CompositeDatatypeList.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeList.type; + else if ( CompositeDatatypeMap.uri.equals(datatypeURI) ) + cdtDatatype = CompositeDatatypeMap.type; + else + cdtDatatype = null; + + if ( cdtDatatype != null ) { + ensureParserProfileForCDTs(); + try { + return parserProfileForCDTs.createTypedLiteral(lexicalForm, cdtDatatype, 0L, 0L); + } + catch ( DatatypeFormatException ex ) { + return createIllformedLiteral(lexicalForm, cdtDatatype); + } + } + + return super.createLiteral(lexicalForm, langTag, datatypeURI); + } + + protected void ensureParserProfileForCDTs() { + if ( parserProfileForCDTs == null ) { + parserProfileForCDTs = RiotLib.dftProfile(); + } + } + + protected Node createIllformedLiteral(String lexicalForm, RDFDatatype cdtDatatype) { + final LiteralLabel lit; + if ( CompositeDatatypeList.type.equals(cdtDatatype) ) + lit = new LiteralLabelForList(lexicalForm, true); + else if ( CompositeDatatypeMap.type.equals(cdtDatatype) ) + lit = new LiteralLabelForMap(lexicalForm, true); + else + throw new IllegalArgumentException( cdtDatatype.toString() ); + + return NodeFactory.createLiteral(lit); + } } From 164fea51735fe1ba818a4ec668982dfbbda6969d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 3 Jul 2022 20:45:50 +0200 Subject: [PATCH 257/323] initial addition of Unfold to the ARQ grammar, including all code changes necessary for the query engine to handle this new operator (but without invoking any actual functionality if it is present in a query) --- .../jena/sparql/algebra/AlgebraGenerator.java | 5 + .../apache/jena/sparql/algebra/OpVars.java | 16 + .../engine/iterator/QueryIterUnfold.java | 1 + .../jena/sparql/engine/main/OpExecutor.java | 6 + .../jena/sparql/engine/main/VarFinder.java | 12 + .../jena/sparql/lang/arq/ARQParser.java | 819 +----------------- 6 files changed, 49 insertions(+), 810 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index 22383d9a7af..fdffca3fe87 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -329,6 +329,11 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); } + if ( elt instanceof ElementUnfold ) { + ElementUnfold unfold = (ElementUnfold)elt; + return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + } + // Filters were collected together by prepareGroup // This only handles filters left in place by some magic. if ( elt instanceof ElementFilter ef) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index 5ecb30b5095..b0796b30c5b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -319,6 +319,14 @@ public void visit(OpUnfold opUnfold) { } } + @Override + public void visit(OpUnfold opUnfold) { + acc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + acc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { PropFuncArg.addVars(acc, opPropFunc.getSubjectArgs()); @@ -446,6 +454,14 @@ public void visit(OpUnfold opUnfold) { } } + @Override + public void visit(OpUnfold opUnfold) { + unknownAcc.add( opUnfold.getVar1() ) ; + if ( opUnfold.getVar2() != null ) { + unknownAcc.add( opUnfold.getVar2() ) ; + } + } + @Override public void visit(OpPropFunc opPropFunc) { addvars(subjAcc, opPropFunc.getSubjectArgs()); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 2b518efc68c..946f8d429d4 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -52,6 +52,7 @@ public class QueryIterUnfold extends QueryIterRepeatApply public QueryIterUnfold(QueryIterator qIter, Expr expr, Var var1, Var var2, ExecutionContext execCxt) { super(qIter, execCxt) ; + this.expr = expr ; this.var1 = var1 ; this.var2 = var2 ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 03b9000faf6..dd67b48e40c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -456,6 +456,12 @@ protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { return qIter ; } + protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { + QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + return qIter ; + } + public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { return QueryIterRoot.create(execCxt); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index a1a5408cdb3..77d7f4448c9 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -388,6 +388,18 @@ public void visit(OpUnfold opUnfold) { ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); } + @Override + public void visit(OpUnfold opUnfold) { + opUnfold.getSubOp().visit(this); + + defines.add( opUnfold.getVar1() ); + + if ( opUnfold.getVar2() != null ) + defines.add( opUnfold.getVar2() ); + + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + } + @Override public void visit(OpProject opProject) { List vars = opProject.getVars(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java index 5f3968f7497..9b6244421d6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParser.java @@ -4537,59 +4537,6 @@ final public Var Var() throws ParseException { throw new Error("Missing return statement in function"); } -<<<<<<< HEAD -======= - final public Node GraphTerm() throws ParseException { - Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case IRIref: - case PNAME_NS: - case PNAME_LN: - iri = iri(); - {if (true) return createNode(iri) ;} - break; - case STRING_LITERAL1: - case STRING_LITERAL2: - case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: - n = RDFLiteral(); - {if (true) return n ;} - break; - case INTEGER: - case DECIMAL: - case DOUBLE: - case INTEGER_POSITIVE: - case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE: - case INTEGER_NEGATIVE: - case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: - n = NumericLiteral(); - {if (true) return n ;} - break; - case TRUE: - case FALSE: - n = BooleanLiteral(); - {if (true) return n ;} - break; - case BLANK_NODE_LABEL: - case ANON: - n = BlankNode(); - {if (true) return n ;} - break; - case NIL: - jj_consume_token(NIL); - {if (true) return nRDFnil ;} - break; - default: - jj_la1[143] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) final public Expr Expression() throws ParseException { Expr expr ; expr = ConditionalOrExpression(); @@ -4607,11 +4554,7 @@ final public Expr ConditionalOrExpression() throws ParseException { ; break; default: -<<<<<<< HEAD jj_la1[143] = jj_gen; -======= - jj_la1[144] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_37; } jj_consume_token(SC_OR); @@ -4632,11 +4575,7 @@ final public Expr ConditionalAndExpression() throws ParseException { ; break; default: -<<<<<<< HEAD jj_la1[144] = jj_gen; -======= - jj_la1[145] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_38; } jj_consume_token(SC_AND); @@ -4709,21 +4648,13 @@ final public Expr RelationalExpression() throws ParseException { expr1 = new E_NotOneOf(expr1, a) ; break; default: -<<<<<<< HEAD jj_la1[145] = jj_gen; -======= - jj_la1[146] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } break; default: -<<<<<<< HEAD jj_la1[146] = jj_gen; -======= - jj_la1[147] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } {if (true) return expr1 ;} @@ -4754,11 +4685,7 @@ final public Expr AdditiveExpression() throws ParseException { ; break; default: -<<<<<<< HEAD jj_la1[147] = jj_gen; -======= - jj_la1[148] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_39; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4796,11 +4723,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) addition = false ; break; default: -<<<<<<< HEAD jj_la1[148] = jj_gen; -======= - jj_la1[149] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4812,11 +4735,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; break; default: -<<<<<<< HEAD jj_la1[149] = jj_gen; -======= - jj_la1[150] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_40; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4831,11 +4750,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) expr2 = new E_Divide(expr2, expr3) ; break; default: -<<<<<<< HEAD jj_la1[150] = jj_gen; -======= - jj_la1[151] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4846,11 +4761,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) expr1 = new E_Subtract(expr1, expr2) ; break; default: -<<<<<<< HEAD jj_la1[151] = jj_gen; -======= - jj_la1[152] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -4872,11 +4783,7 @@ final public Expr MultiplicativeExpression() throws ParseException { ; break; default: -<<<<<<< HEAD jj_la1[152] = jj_gen; -======= - jj_la1[153] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) break label_41; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -4901,11 +4808,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) expr1 = new E_OpNumericIntegerDivide(expr1, expr2) ; break; default: -<<<<<<< HEAD jj_la1[153] = jj_gen; -======= - jj_la1[154] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5039,11 +4942,7 @@ final public Expr UnaryExpression() throws ParseException { {if (true) return expr ;} break; default: -<<<<<<< HEAD jj_la1[154] = jj_gen; -======= - jj_la1[155] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5181,11 +5080,7 @@ final public Expr PrimaryExpression() throws ParseException { {if (true) return asExpr(n) ;} break; default: -<<<<<<< HEAD jj_la1[155] = jj_gen; -======= - jj_la1[156] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5230,11 +5125,7 @@ final public Node ExprVarOrTerm() throws ParseException { n = ExprQuotedTriple(); break; default: -<<<<<<< HEAD jj_la1[156] = jj_gen; -======= - jj_la1[157] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -5335,11 +5226,7 @@ final public Expr BuiltInCall() throws ParseException { expr2 = Expression(); break; default: -<<<<<<< HEAD jj_la1[157] = jj_gen; -======= - jj_la1[158] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5355,11 +5242,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) expr2 = Expression(); break; default: -<<<<<<< HEAD jj_la1[158] = jj_gen; -======= - jj_la1[159] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) ; } jj_consume_token(RPAREN); @@ -5379,11 +5262,7 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) {if (true) return makeFunction_BNode() ;} break; default: -<<<<<<< HEAD jj_la1[159] = jj_gen; -======= - jj_la1[160] = jj_gen; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_consume_token(-1); throw new ParseException(); } @@ -6411,10 +6290,7 @@ final public Expr Aggregate() throws ParseException { case SECONDS: case TIMEZONE: case TZ: -<<<<<<< HEAD case ADJUST: -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) case NOW: case UUID: case STRUUID: @@ -6762,43 +6638,13 @@ private boolean jj_2_5(int xla) { finally { jj_save(4, xla); } } -<<<<<<< HEAD private boolean jj_3R_101() { -======= - private boolean jj_3R_103() { - if (jj_3R_120()) return true; - return false; - } - - private boolean jj_3R_102() { - if (jj_scan_token(IS_NUMERIC)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_158() { - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_101() { - if (jj_scan_token(IS_LITERAL)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_100() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_BLANK)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_100() { -======= - private boolean jj_3R_99() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_URI)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -6864,68 +6710,35 @@ private boolean jj_3_2() { return false; } -<<<<<<< HEAD private boolean jj_3R_97() { -======= - private boolean jj_3R_98() { - if (jj_scan_token(IS_IRI)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_97() { - if (jj_scan_token(SAME_TERM)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_96() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRDT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_96() { -======= - private boolean jj_3R_95() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRLANG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_95() { -======= - private boolean jj_3R_94() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IF)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_168() { -======= - private boolean jj_3R_159() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LBRACKET)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_94() { -======= - private boolean jj_3R_93() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(CALL)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_158() { if (jj_3R_168()) return true; return false; @@ -6965,121 +6778,53 @@ private boolean jj_3R_91() { } private boolean jj_3R_90() { -======= - private boolean jj_3R_92() { - if (jj_scan_token(COALESCE)) return true; - if (jj_3R_117()) return true; - return false; - } - - private boolean jj_3R_152() { - if (jj_3R_159()) return true; - return false; - } - - private boolean jj_3R_91() { - if (jj_scan_token(VERSION)) return true; - if (jj_scan_token(NIL)) return true; - return false; - } - - private boolean jj_3R_90() { - if (jj_scan_token(SHA512)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_126() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_151()) { - jj_scanpos = xsp; - if (jj_3R_152()) return true; - } - return false; - } - - private boolean jj_3R_151() { - if (jj_3R_158()) return true; - return false; - } - - private boolean jj_3R_89() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA384)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_89() { -======= - private boolean jj_3R_88() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA256)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_88() { -======= - private boolean jj_3R_87() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SHA1)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_87() { -======= - private boolean jj_3R_86() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MD5)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_86() { -======= - private boolean jj_3R_85() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRUUID)) return true; if (jj_scan_token(NIL)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_85() { -======= - private boolean jj_3R_84() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(UUID)) return true; if (jj_scan_token(NIL)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_84() { -======= - private boolean jj_3R_83() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOW)) return true; if (jj_scan_token(NIL)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_83() { if (jj_scan_token(ADJUST)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_82() { if (jj_scan_token(TZ)) return true; if (jj_scan_token(LPAREN)) return true; @@ -7177,11 +6922,7 @@ private boolean jj_3R_67() { } private boolean jj_3R_66() { -<<<<<<< HEAD if (jj_3R_120()) return true; -======= - if (jj_3R_119()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7192,21 +6933,13 @@ private boolean jj_3R_65() { } private boolean jj_3R_64() { -<<<<<<< HEAD if (jj_3R_119()) return true; -======= - if (jj_3R_118()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_63() { if (jj_scan_token(CONCAT)) return true; -<<<<<<< HEAD if (jj_3R_118()) return true; -======= - if (jj_3R_117()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7252,20 +6985,12 @@ private boolean jj_3R_56() { return false; } -<<<<<<< HEAD private boolean jj_3R_117() { -======= - private boolean jj_3R_116() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NIL)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_116() { -======= - private boolean jj_3R_115() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(LPAREN)) return true; return false; } @@ -7274,15 +6999,9 @@ private boolean jj_3R_55() { if (jj_scan_token(BNODE)) return true; Token xsp; xsp = jj_scanpos; -<<<<<<< HEAD if (jj_3R_116()) { jj_scanpos = xsp; if (jj_3R_117()) return true; -======= - if (jj_3R_115()) { - jj_scanpos = xsp; - if (jj_3R_116()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -7330,11 +7049,7 @@ private boolean jj_3R_48() { } private boolean jj_3R_47() { -<<<<<<< HEAD if (jj_3R_115()) return true; -======= - if (jj_3R_114()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -7467,14 +7182,10 @@ private boolean jj_3R_44() { jj_scanpos = xsp; if (jj_3R_109()) { jj_scanpos = xsp; -<<<<<<< HEAD if (jj_3R_110()) { jj_scanpos = xsp; if (jj_3R_111()) return true; } -======= - if (jj_3R_110()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -7541,44 +7252,26 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } -<<<<<<< HEAD private boolean jj_3R_160() { -======= - private boolean jj_3R_154() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IRIref)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_178() { -======= - private boolean jj_3R_182() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(ANON)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_165() { Token xsp; xsp = jj_scanpos; if (jj_3R_177()) { jj_scanpos = xsp; if (jj_3R_178()) return true; -======= - private boolean jj_3R_172() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_181()) { - jj_scanpos = xsp; - if (jj_3R_182()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } -<<<<<<< HEAD private boolean jj_3R_177() { if (jj_scan_token(BLANK_NODE_LABEL)) return true; return false; @@ -7635,107 +7328,20 @@ private boolean jj_3R_182() { } private boolean jj_3R_181() { -======= - private boolean jj_3R_181() { - if (jj_scan_token(BLANK_NODE_LABEL)) return true; - return false; - } - - private boolean jj_3R_174() { - if (jj_scan_token(PNAME_NS)) return true; - return false; - } - - private boolean jj_3R_173() { - if (jj_scan_token(PNAME_LN)) return true; - return false; - } - - private boolean jj_3R_168() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_173()) { - jj_scanpos = xsp; - if (jj_3R_174()) return true; - } - return false; - } - - private boolean jj_3R_161() { - if (jj_3R_168()) return true; - return false; - } - - private boolean jj_3R_153() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_160()) { - jj_scanpos = xsp; - if (jj_3R_161()) return true; - } - return false; - } - - private boolean jj_3R_160() { - if (jj_3R_154()) return true; - return false; - } - - private boolean jj_3R_186() { - if (jj_scan_token(STRING_LITERAL_LONG2)) return true; - return false; - } - - private boolean jj_3R_185() { - if (jj_scan_token(STRING_LITERAL_LONG1)) return true; - return false; - } - - private boolean jj_3R_184() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL2)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_180() { -======= - private boolean jj_3R_183() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STRING_LITERAL1)) return true; return false; } -<<<<<<< HEAD -======= - private boolean jj_3R_175() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_183()) { - jj_scanpos = xsp; - if (jj_3R_184()) { - jj_scanpos = xsp; - if (jj_3R_185()) { - jj_scanpos = xsp; - if (jj_3R_186()) return true; - } - } - } - return false; - } - - private boolean jj_3R_180() { - if (jj_scan_token(FALSE)) return true; - return false; - } - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_171() { Token xsp; xsp = jj_scanpos; - if (jj_3R_179()) { + if (jj_3R_180()) { jj_scanpos = xsp; -<<<<<<< HEAD if (jj_3R_181()) { jj_scanpos = xsp; if (jj_3R_182()) { @@ -7743,14 +7349,10 @@ private boolean jj_3R_171() { if (jj_3R_183()) return true; } } -======= - if (jj_3R_180()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } -<<<<<<< HEAD private boolean jj_3R_176() { if (jj_scan_token(FALSE)) return true; return false; @@ -7767,85 +7369,38 @@ private boolean jj_3R_164() { } private boolean jj_3R_175() { -======= - private boolean jj_3R_179() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRUE)) return true; return false; } - private boolean jj_3R_145() { - if (jj_scan_token(LBRACE)) return true; - return false; - } - - private boolean jj_3R_198() { + private boolean jj_3R_197() { if (jj_scan_token(DOUBLE_NEGATIVE)) return true; return false; } - private boolean jj_3R_197() { + private boolean jj_3R_196() { if (jj_scan_token(DECIMAL_NEGATIVE)) return true; return false; } - private boolean jj_3_3() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_46()) return true; - return false; - } - - private boolean jj_3R_196() { + private boolean jj_3R_195() { if (jj_scan_token(INTEGER_NEGATIVE)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_186() { -======= - private boolean jj_3R_189() { Token xsp; xsp = jj_scanpos; - if (jj_3R_196()) { - jj_scanpos = xsp; - if (jj_3R_197()) { - jj_scanpos = xsp; - if (jj_3R_198()) return true; - } - } - return false; - } - - private boolean jj_3R_195() { - if (jj_scan_token(DOUBLE_POSITIVE)) return true; - return false; - } - - private boolean jj_3R_194() { - if (jj_scan_token(DECIMAL_POSITIVE)) return true; - return false; - } - - private boolean jj_3R_193() { - if (jj_scan_token(INTEGER_POSITIVE)) return true; - return false; - } - - private boolean jj_3R_188() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) - Token xsp; - xsp = jj_scanpos; - if (jj_3R_193()) { + if (jj_3R_195()) { jj_scanpos = xsp; - if (jj_3R_194()) { + if (jj_3R_196()) { jj_scanpos = xsp; - if (jj_3R_195()) return true; + if (jj_3R_197()) return true; } } return false; } -<<<<<<< HEAD private boolean jj_3R_146() { if (jj_scan_token(LBRACE)) return true; return false; @@ -7867,27 +7422,14 @@ private boolean jj_3R_193() { return false; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_192() { - if (jj_scan_token(DOUBLE)) return true; - return false; - } - - private boolean jj_3R_191() { - if (jj_scan_token(DECIMAL)) return true; - return false; - } - - private boolean jj_3R_190() { - if (jj_scan_token(INTEGER)) return true; + if (jj_scan_token(INTEGER_POSITIVE)) return true; return false; } private boolean jj_3R_185() { Token xsp; xsp = jj_scanpos; -<<<<<<< HEAD if (jj_3R_192()) { jj_scanpos = xsp; if (jj_3R_193()) { @@ -7918,19 +7460,14 @@ private boolean jj_3R_184() { xsp = jj_scanpos; if (jj_3R_189()) { jj_scanpos = xsp; -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_190()) { jj_scanpos = xsp; - if (jj_3R_191()) { - jj_scanpos = xsp; - if (jj_3R_192()) return true; + if (jj_3R_191()) return true; } } return false; } -<<<<<<< HEAD private boolean jj_3R_174() { if (jj_3R_186()) return true; return false; @@ -7943,64 +7480,6 @@ private boolean jj_3R_173() { private boolean jj_3R_172() { if (jj_3R_184()) return true; -======= - private boolean jj_3R_178() { - if (jj_3R_189()) return true; - return false; - } - - private boolean jj_3R_177() { - if (jj_3R_188()) return true; - return false; - } - - private boolean jj_3R_176() { - if (jj_3R_187()) return true; - return false; - } - - private boolean jj_3R_170() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_176()) { - jj_scanpos = xsp; - if (jj_3R_177()) { - jj_scanpos = xsp; - if (jj_3R_178()) return true; - } - } - return false; - } - - private boolean jj_3R_169() { - if (jj_3R_175()) return true; - return false; - } - - private boolean jj_3R_143() { - if (jj_scan_token(AGG)) return true; - if (jj_3R_153()) return true; - return false; - } - - private boolean jj_3R_167() { - if (jj_scan_token(NIL)) return true; - return false; - } - - private boolean jj_3R_166() { - if (jj_3R_172()) return true; - return false; - } - - private boolean jj_3R_165() { - if (jj_3R_171()) return true; - return false; - } - - private boolean jj_3R_164() { - if (jj_3R_170()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } @@ -8017,35 +7496,7 @@ private boolean jj_3R_163() { return false; } - private boolean jj_3R_113() { - if (jj_3R_126()) return true; - return false; - } - - private boolean jj_3R_157() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_162()) { - jj_scanpos = xsp; - if (jj_3R_163()) { - jj_scanpos = xsp; - if (jj_3R_164()) { - jj_scanpos = xsp; - if (jj_3R_165()) { - jj_scanpos = xsp; - if (jj_3R_166()) { - jj_scanpos = xsp; - if (jj_3R_167()) return true; - } - } - } - } - } - return false; - } - private boolean jj_3R_162() { -<<<<<<< HEAD if (jj_3R_171()) return true; return false; } @@ -8057,28 +7508,6 @@ private boolean jj_3R_144() { } private boolean jj_3R_161() { -======= - if (jj_3R_153()) return true; - return false; - } - - private boolean jj_3R_46() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_112()) { - jj_scanpos = xsp; - if (jj_3R_113()) return true; - } - return false; - } - - private boolean jj_3R_112() { - if (jj_3R_125()) return true; - return false; - } - - private boolean jj_3R_156() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(14)) { @@ -8088,7 +7517,6 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } -<<<<<<< HEAD private boolean jj_3R_114() { if (jj_3R_127()) return true; return false; @@ -8109,8 +7537,6 @@ private boolean jj_3R_113() { return false; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3_4() { if (jj_scan_token(DOT)) return true; if (jj_3R_46()) return true; @@ -8122,100 +7548,59 @@ private boolean jj_3_1() { return false; } -<<<<<<< HEAD private boolean jj_3R_143() { -======= - private boolean jj_3R_142() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(FOLD)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_142() { -======= - private boolean jj_3R_141() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_141() { -======= - private boolean jj_3R_140() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VAR_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_140() { -======= - private boolean jj_3R_139() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(VARIANCE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_139() { -======= - private boolean jj_3R_138() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_POP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_138() { -======= - private boolean jj_3R_137() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV_SAMP)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_145() { if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_137() { -======= - private boolean jj_3R_136() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(STDEV)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_118() { -======= - private boolean jj_3R_144() { - if (jj_scan_token(LPAREN)) return true; - return false; - } - - private boolean jj_3R_117() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) Token xsp; xsp = jj_scanpos; if (jj_scan_token(187)) { jj_scanpos = xsp; -<<<<<<< HEAD if (jj_3R_145()) return true; -======= - if (jj_3R_144()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } @@ -8226,37 +7611,23 @@ private boolean jj_3_5() { return false; } -<<<<<<< HEAD private boolean jj_3R_166() { if (jj_scan_token(LT2)) return true; return false; } private boolean jj_3R_136() { -======= - private boolean jj_3R_135() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(GROUP_CONCAT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_135() { -======= - private boolean jj_3R_124() { - if (jj_3R_147()) return true; - return false; - } - - private boolean jj_3R_134() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SAMPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_156() { if (jj_3R_166()) return true; return false; @@ -8268,15 +7639,11 @@ private boolean jj_3R_155() { } private boolean jj_3R_134() { -======= - private boolean jj_3R_133() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MODE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_125() { if (jj_3R_148()) return true; return false; @@ -8293,27 +7660,11 @@ private boolean jj_3R_153() { } private boolean jj_3R_133() { -======= - private boolean jj_3R_147() { - if (jj_scan_token(PREFIX)) return true; - if (jj_scan_token(PNAME_NS)) return true; - if (jj_3R_154()) return true; - return false; - } - - private boolean jj_3R_155() { - if (jj_scan_token(LT2)) return true; - return false; - } - - private boolean jj_3R_132() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MEDIAN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_152() { if (jj_3R_163()) return true; return false; @@ -8325,15 +7676,11 @@ private boolean jj_3R_151() { } private boolean jj_3R_132() { -======= - private boolean jj_3R_131() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(AVG)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_148() { if (jj_scan_token(PREFIX)) return true; if (jj_scan_token(PNAME_NS)) return true; @@ -8343,33 +7690,20 @@ private boolean jj_3R_148() { private boolean jj_3R_150() { if (jj_3R_159()) return true; -======= - private boolean jj_3R_150() { - if (jj_3R_157()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } private boolean jj_3R_149() { -<<<<<<< HEAD if (jj_3R_161()) return true; return false; } private boolean jj_3R_131() { -======= - if (jj_3R_156()) return true; - return false; - } - - private boolean jj_3R_130() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MAX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_126() { Token xsp; xsp = jj_scanpos; @@ -8399,64 +7733,17 @@ private boolean jj_3R_126() { } private boolean jj_3R_130() { -======= - private boolean jj_3R_148() { - if (jj_3R_155()) return true; - return false; - } - - private boolean jj_3R_146() { - if (jj_scan_token(BASE)) return true; - if (jj_3R_154()) return true; - return false; - } - - private boolean jj_3R_129() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(MIN)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_129() { -======= - private boolean jj_3R_125() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_148()) { - jj_scanpos = xsp; - if (jj_3R_149()) { - jj_scanpos = xsp; - if (jj_3R_150()) return true; - } - } - return false; - } - - private boolean jj_3R_111() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_123()) { - jj_scanpos = xsp; - if (jj_3R_124()) return true; - } - return false; - } - - private boolean jj_3R_123() { - if (jj_3R_146()) return true; - return false; - } - - private boolean jj_3R_128() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUM)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_147() { if (jj_scan_token(BASE)) return true; if (jj_3R_160()) return true; @@ -8478,42 +7765,24 @@ private boolean jj_3R_124() { return false; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) private boolean jj_3R_45() { Token xsp; while (true) { xsp = jj_scanpos; -<<<<<<< HEAD if (jj_3R_112()) { jj_scanpos = xsp; break; } -======= - if (jj_3R_111()) { jj_scanpos = xsp; break; } ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } return false; } -<<<<<<< HEAD private boolean jj_3R_128() { -======= - private boolean jj_3R_127() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(COUNT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; -======= - private boolean jj_3R_114() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_127()) { - jj_scanpos = xsp; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_3R_128()) { jj_scanpos = xsp; if (jj_3R_129()) { @@ -8544,13 +7813,9 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_scanpos = xsp; if (jj_3R_142()) { jj_scanpos = xsp; -<<<<<<< HEAD if (jj_3R_143()) { jj_scanpos = xsp; if (jj_3R_144()) return true; -======= - if (jj_3R_143()) return true; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } } } @@ -8570,17 +7835,12 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) return false; } -<<<<<<< HEAD private boolean jj_3R_123() { -======= - private boolean jj_3R_122() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(NOT)) return true; if (jj_scan_token(EXISTS)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_122() { if (jj_scan_token(EXISTS)) return true; if (jj_3R_146()) return true; @@ -8588,89 +7848,53 @@ private boolean jj_3R_122() { } private boolean jj_3R_120() { -======= - private boolean jj_3R_121() { - if (jj_scan_token(EXISTS)) return true; - if (jj_3R_145()) return true; - return false; - } - - private boolean jj_3R_119() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REPLACE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_119() { -======= - private boolean jj_3R_118() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBSTR)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_121() { -======= - private boolean jj_3R_120() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(REGEX)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_111() { -======= - private boolean jj_3R_110() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(OBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_110() { -======= - private boolean jj_3R_109() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(PREDICATE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_109() { -======= - private boolean jj_3R_108() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(SUBJECT)) return true; if (jj_scan_token(LPAREN)) return true; return false; } -<<<<<<< HEAD private boolean jj_3R_108() { -======= - private boolean jj_3R_107() { ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; } private boolean jj_3R_106() { -<<<<<<< HEAD if (jj_3R_123()) return true; return false; } private boolean jj_3R_107() { -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) if (jj_scan_token(IS_TRIPLE)) return true; if (jj_scan_token(LPAREN)) return true; return false; @@ -8686,7 +7910,6 @@ private boolean jj_3R_104() { return false; } -<<<<<<< HEAD private boolean jj_3R_167() { if (jj_scan_token(LPAREN)) return true; return false; @@ -8704,8 +7927,6 @@ private boolean jj_3R_102() { return false; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Generated Token Manager. */ public ARQParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -8737,7 +7958,6 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) jj_la1_init_7(); } private static void jj_la1_init_0() { -<<<<<<< HEAD jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; } private static void jj_la1_init_1() { @@ -8757,27 +7977,6 @@ private static void jj_la1_init_5() { } private static void jj_la1_init_6() { jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x801,0x0,0x8,0x801,0x801,0x801,0x0,0x8,0x801,0x0,0x801,0x8,0x0,0x801,0x0,0x8,0x801,0x801,0x8,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x800,0x0,0x800,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x8,0x801,0x0,0x2,0x0,0x0,0x4,0x801,0x8004000,0x8004000,0x2,0x8004000,0x8004000,0x4,0x4000000,0x8400000,0x8400000,0x40280000,0x8004000,0x0,0x4,0x280004,0x40280000,0x4000,0x4000000,0x8000000,0x8000000,0x0,0x8000000,0x0,0x0,0x801,0x801,0x1000,0x1000,0x801,0x801,0x801,0x0,0x800,0x0,0x1,0x0,0x20000,0x40000,0x3f0,0x3f0,0x180000,0x0,0x600000,0x600000,0x180000,0x600000,0x600000,0x184800,0x800,0x800,0x4,0x4,0x0,0x4,0x4,0x0,0x4,0x4,0x4,0x0,0x384800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,}; -======= - jj_la1_0 = new int[] {0x1e400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0x1c00,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0xc000,0x1c00,0x0,0x0,0x0,0x80000000,0x60000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x0,0xdc00,0xdc00,0x40000000,0x20000000,0x60000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x0,0xfc00,0x0,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x88dc00,0x88dc00,0x0,0x88dc00,0x88dc00,0x0,0x0,0x0,0x0,0x0,0x881c00,0x0,0x0,0x0,0x0,0x881c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x81c00,0x1c00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0xdc00,0x80000000,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x1000000,0xf0df0000,0xf0df0000,0xf0df0000,0x40,0x40,0xc0,0x0,0x0,0x40,0x80,0x40,0x40,0x0,0x0,0x20,0x80,0x2000000,0x4000000,0x0,0x0,0xf0df0000,0x1000000,0xf0df0000,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x18,0xf0df0000,0xf0df0018,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x200,0x200,0x220,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x0,0x0,0xe0f602,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x4,0x0,0x800,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0xf0df0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0df0018,0x0,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x1800000,0x0,0x1800000,0x1800000,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe5edfff,0x0,0x1fff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0xffffffff,0xffffffff,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x1f7f,0x1f7f,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x77f,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x77f,0x77f,0x0,0x0,0x0,0x0,0x0,0x9ffc000,0x9ffc000,0x4000000,0x10000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x4000000,0x0,0x4000,0xc000,0x0,0x0,0x0,0x40000000,0xc0000000,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x1800,0x0,0x0,0x1800,0x1800,0x0,0x0,0x4000000,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x1800,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x1800,0x0,0x0,0x1800,0x1800,0x1800,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f7f,0x1f7f,0x1800,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x1f7f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x77f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x780ff8,0x0,0xf80ff8,0xf80ff8,0xf80ff8,0x0,0x0,0x4000000,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x780ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x800000,0x800000,0x0,0x0,0x0,0x0,0x80000000,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x0,0x52f80ff8,0x0,0x0,0x52f80ff8,0x4000000,0x0,0x52f80ff8,0x52f80ff8,0x0,0x4000000,0x0,0x2800000,0x780ff8,0x0,0x2800000,0x2800000,0x780ff8,0x2800000,0x780ff8,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x2800000,0x0,0x52f80ff8,0x0,0x80000000,0x0,0x0,0x0,0x52f80ff8,0x800000,0x800000,0x80000000,0x800000,0x800000,0x0,0x0,0x0,0x0,0x4000000,0x800000,0x8000008,0x8000000,0x8,0x4000000,0x800000,0x0,0x0,0x800000,0x0,0x0,0x10800000,0x10800000,0x52f80ff8,0x52f80ff8,0x0,0x0,0x52f80ff8,0x52f80ff8,0x42780ff8,0x0,0x780ff8,0x0,0x40000000,0x0,0x42780ff8,0x0,0x0,0x0,0x0,0xfc0,0xfc0,0x0,0x0,0xfc0,0x0,0x0,0xf80ff8,0xf80ff8,0x780ff8,0x0,0x0,0x2800000,0x0,0x0,0x0,0x0,0x0,0x0,0xf80ff8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x2800000,0x0,0x0,0xff8,0x38,0x1c0,0xe00,0x0,0x780000,0x0,0x0,0x40000000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x2,0x200,0x200,0x200,0x0,0x2,0x200,0x0,0x200,0x2,0x0,0x200,0x0,0x2,0x200,0x200,0x2,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x200,0x0,0x200,0x1,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x2,0x200,0x0,0x0,0x0,0x0,0x1,0x200,0x2001000,0x2001000,0x0,0x2001000,0x2001000,0x1,0x1000000,0x2100000,0x2100000,0x100a0000,0x2001000,0x0,0x1,0xa0001,0x100a0000,0x1000,0x1000000,0x2000000,0x2000000,0x0,0x2000000,0x0,0x0,0x200,0x200,0x400,0x400,0x200,0x200,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x8000,0x10000,0xfc,0xfc,0x60000,0x0,0x180000,0x180000,0x60000,0x180000,0x180000,0x61200,0x200,0x200,0x1,0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x0,0xe1200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } private static void jj_la1_init_7() { jj_la1_7 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; From 9e2cb97331f6fea6266bb0960499fedb9b260a0f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 4 Jul 2022 21:01:45 +0200 Subject: [PATCH 258/323] initial functional version of QueryIterUnfold --- .../java/org/apache/jena/sparql/engine/main/OpExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index dd67b48e40c..233ecb6bdc4 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -458,7 +458,7 @@ protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2()) ; + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; return qIter ; } From 91f3e2ec429827e6ca9657373598728feeb30948 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 12:26:09 +0200 Subject: [PATCH 259/323] fully working version of QueryIterUnfold --- .../apache/jena/sparql/engine/iterator/QueryIterUnfold.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 946f8d429d4..48149b3de80 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -46,7 +46,7 @@ public class QueryIterUnfold extends QueryIterRepeatApply { - protected final Expr expr ; + protected final Expr expr ; protected final Var var1 ; protected final Var var2 ; @@ -95,7 +95,6 @@ protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBi } - protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; protected final Iterator itElmts; From 67f49c4e0603f51dd2fd2226d1d76ce05fde88f3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 10 Aug 2022 19:09:47 +0200 Subject: [PATCH 260/323] adds support for UNFOLDing of untyped maps --- .../jena/sparql/engine/iterator/QueryIterUnfold.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 48149b3de80..9e553fc40cd 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -94,6 +94,14 @@ protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBi return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } + protected Iterator> parseMap(String mapAsValue) { + final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + final Iterator> itMapElmts = extractMapElements(mapAsValue); + return new Iterator<>() { + @Override + public boolean hasNext() { + return itMapElmts.hasNext(); + } protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; From 2daa40370e33e5988630980ad0f86d93da1bf8db Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 14:28:32 +0200 Subject: [PATCH 261/323] adds FOLD --- jena-arq/Grammar/arq.jj | 2 +- .../jena/sparql/expr/aggregate/AggFold.java | 284 ++++++++++++++++++ 2 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java diff --git a/jena-arq/Grammar/arq.jj b/jena-arq/Grammar/arq.jj index 0629207d816..4ffca766a36 100644 --- a/jena-arq/Grammar/arq.jj +++ b/jena-arq/Grammar/arq.jj @@ -1838,12 +1838,12 @@ TOKEN [IGNORE_CASE] : | < SERVICE: "service" > | < LET: "LET" > | < LATERAL: "LATERAL" > +| < UNFOLD: "unfold" > | < TRIPLE: "TRIPLE" > | < IS_TRIPLE: "isTRIPLE" > | < SUBJECT: "SUBJECT" > | < PREDICATE: "PREDICATE" > | < OBJECT: "OBJECT" > -| < UNFOLD: "unfold" > | < EXISTS: "exists" > | < NOT: "not" > | < AS: "as" > diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java new file mode 100644 index 00000000000..20d1eb03965 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -0,0 +1,284 @@ +package org.apache.jena.sparql.expr.aggregate; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.jena.atlas.io.IndentedLineBuffer; +import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprLib; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.ExprNode; +import org.apache.jena.sparql.expr.ExprNone; +import org.apache.jena.sparql.expr.ExprVisitor; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueString; +import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.graph.NodeTransform; +import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.util.ExprUtils; + +public class AggFold extends AggregatorBase +{ + protected final Expr expr1; // While the values of these member variables + protected final Expr expr2; // can also be extracted from the ExprList (see + protected final String typeIRI1; // createExprList below), keeping these copies + protected final String typeIRI2; // here makes it easier to access these values. + + public AggFold( final Expr expr1 ) { + this(expr1, null, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1 ) { + this(expr1, typeIRI1, null, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { + this(expr1, typeIRI1, expr2, null); + } + + public AggFold( final Expr expr1, final Expr expr2 ) { + this(expr1, null, expr2, null); + } + + public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { + super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + + this.expr1 = expr1; + this.expr2 = expr2; + this.typeIRI1 = typeIRI1; + this.typeIRI2 = typeIRI2; + } + + protected static ExprList createExprList( final Expr expr1, final String typeIRI1, + final Expr expr2, final String typeIRI2 ) { + final ExprList l = new ExprList(expr1); + + if ( typeIRI1 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI1) ); + } + + if ( expr2 != null ) { + l.add(expr2); + } + + if ( typeIRI2 != null ) { + l.add(dummyExprForType); + l.add( new NodeValueString(typeIRI2) ); + } + + return l; + } + + @Override + public Aggregator copy( final ExprList exprs ) { + if ( exprs.size() < 1 || exprs.size() > 6 ) + throw new IllegalArgumentException(); + + final Iterator it = exprs.iterator(); + final Expr _expr1 = it.next(); + + final Expr _expr2; + final String _typeIRI1; + final String _typeIRI2; + + Expr lookAhead = it.hasNext() ? it.next() : null; + // _typeIRI1 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI1 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI1 = null; + } + + // _expr2 + if ( lookAhead != null ) { + _expr2 = lookAhead; + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _expr2 = null; + } + + // _typeIRI2 + if ( lookAhead != null && lookAhead == dummyExprForType ) { + lookAhead = it.hasNext() ? it.next() : null; + if ( lookAhead != null && lookAhead instanceof NodeValueString ) + _typeIRI2 = ((NodeValueString) lookAhead).getString(); + else + throw new IllegalArgumentException(); + + lookAhead = it.hasNext() ? it.next() : null; + } + else { + _typeIRI2 = null; + } + + if ( lookAhead != null ) { + throw new IllegalArgumentException(); + } + + return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + } + + @Override + public boolean equals( final Aggregator other, final boolean bySyntax ) { + if ( other == null ) return false; + if ( this == other ) return true; + if ( ! ( other instanceof AggFold ) ) + return false; + final AggFold fold = (AggFold) other; + return exprList.equals(fold.exprList, bySyntax); + } + + @Override + public Accumulator createAccumulator() { + if ( expr2 == null ) + return new ListAccumulator(); + else + return new MapAccumulator(); + } + + @Override + public Node getValueEmpty() { + return null; + } + + @Override + public int hashCode() { + int hc = HC_AggFold; + for ( final Expr e : getExprList() ) { + hc ^= e.hashCode(); + } + return hc; + } + + @Override + public String asSparqlExpr( final SerializationContext sCxt ) { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append( getName() ); + out.append( "(" ); + + ExprUtils.fmtSPARQL(out, expr1, sCxt); + + if ( typeIRI1 != null ) { + out.append( " TYPE " + typeIRI1 ); + } + + if ( expr2 != null ) { + out.append(", "); + ExprUtils.fmtSPARQL(out, expr2, sCxt); + } + + if ( typeIRI2 != null ) { + out.append( " TYPE " + typeIRI2 ); + } + + out.append(")"); + return out.asString(); + } + + + protected static Expr dummyExprForType = new ExprNode() { + @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } + + @Override public int hashCode() { return -88888; } + + @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + + @Override public Expr copySubstitute(Binding binding) { return this; } + + @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + + @Override public NodeValue eval(Binding binding, FunctionEnv env) { + throw new InternalErrorException("Attempt to eval DummyExprForType"); + } + }; + + protected class ListAccumulator implements Accumulator { + final protected List list = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nv != null ) + list.add( nv.asNode() ); + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + return NodeValue.makeNode(n); + } + } + + protected class MapAccumulator implements Accumulator { + final protected List keys = new ArrayList<>(); + final protected List values = new ArrayList<>(); + + @Override + public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( key != null && value != null ) { + keys.add( key.asNode() ); + values.add( value.asNode() ); + } + } + + @Override + public NodeValue getValue() { + final StringBuilder sb = new StringBuilder(); + if ( ! keys.isEmpty() ) { + final Iterator it = keys.iterator(); + final Iterator it2 = values.iterator(); + final Node firstKey = it.next(); + final Node firstValue = it2.next(); + final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); + final String firstValueAsString = NodeFmtLib.strTTL(firstValue); + sb.append(firstKeyAsString); + sb.append(" : "); + sb.append(firstValueAsString); + while ( it.hasNext() ) { + final Node nextKey = it.next(); + final Node nextValue = it2.next(); + final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); + final String nextValueAsString = NodeFmtLib.strTTL(nextValue); + sb.append(", "); + sb.append(nextKeyAsString); + sb.append(" : "); + sb.append(nextValueAsString); + } + } + final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + return NodeValue.makeNode(n); + } + } + +} From 94bd4cfadca63ccd76b874864aaadea6812608e9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 17:51:05 +0200 Subject: [PATCH 262/323] extends the implementation of FOLD to actually support the type arguments --- .../jena/sparql/expr/aggregate/AggFold.java | 155 ++++++++++++++---- 1 file changed, 120 insertions(+), 35 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 20d1eb03965..f7ee0f19410 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -3,33 +3,36 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.riot.system.PrefixMap; +import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.ExprNode; -import org.apache.jena.sparql.expr.ExprNone; -import org.apache.jena.sparql.expr.ExprVisitor; import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; -import org.apache.jena.sparql.graph.NodeTransform; import org.apache.jena.sparql.serializer.SerializationContext; +import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; public class AggFold extends AggregatorBase { + protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); + protected final Expr expr1; // While the values of these member variables protected final Expr expr2; // can also be extracted from the ExprList (see - protected final String typeIRI1; // createExprList below), keeping these copies - protected final String typeIRI2; // here makes it easier to access these values. + protected final Node typeIRI1; // createExprList below), keeping these copies + protected final Node typeIRI2; // here makes it easier to access these values. public AggFold( final Expr expr1 ) { this(expr1, null, null, null); @@ -52,8 +55,8 @@ public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = typeIRI1; - this.typeIRI2 = typeIRI2; + this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; + this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } protected static ExprList createExprList( final Expr expr1, final String typeIRI1, @@ -61,7 +64,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI final ExprList l = new ExprList(expr1); if ( typeIRI1 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI1) ); } @@ -70,7 +73,7 @@ protected static ExprList createExprList( final Expr expr1, final String typeIRI } if ( typeIRI2 != null ) { - l.add(dummyExprForType); + l.add(dummyExprForTypeKeyword); l.add( new NodeValueString(typeIRI2) ); } @@ -91,7 +94,7 @@ public Aggregator copy( final ExprList exprs ) { Expr lookAhead = it.hasNext() ? it.next() : null; // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI1 = ((NodeValueString) lookAhead).getString(); @@ -114,7 +117,7 @@ public Aggregator copy( final ExprList exprs ) { } // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForType ) { + if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { lookAhead = it.hasNext() ? it.next() : null; if ( lookAhead != null && lookAhead instanceof NodeValueString ) _typeIRI2 = ((NodeValueString) lookAhead).getString(); @@ -168,6 +171,8 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { + final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); + final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); @@ -175,7 +180,8 @@ public String asSparqlExpr( final SerializationContext sCxt ) { ExprUtils.fmtSPARQL(out, expr1, sCxt); if ( typeIRI1 != null ) { - out.append( " TYPE " + typeIRI1 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI1, pmap) ); } if ( expr2 != null ) { @@ -184,29 +190,42 @@ public String asSparqlExpr( final SerializationContext sCxt ) { } if ( typeIRI2 != null ) { - out.append( " TYPE " + typeIRI2 ); + out.append( " TYPE " ); + out.append( NodeFmtLib.str(typeIRI2, pmap) ); } out.append(")"); return out.asString(); } + @Override + public String toPrefixString() { + final IndentedLineBuffer out = new IndentedLineBuffer(); + out.append("("); + out.append( getName().toLowerCase(Locale.ROOT) ); + out.incIndent(); - protected static Expr dummyExprForType = new ExprNode() { - @Override public void visit(ExprVisitor visitor) { visitor.visit( (ExprNone) ExprNone.NONE ); } - - @Override public int hashCode() { return -88888; } - - @Override public boolean equals(Expr other, boolean bySyntax) { return other == this; } + WriterExpr.output(out, expr1, null); - @Override public Expr copySubstitute(Binding binding) { return this; } + if ( typeIRI1 != null ) { + out.append( " TYPE " ); + out.append( typeIRI1.toString() ); + } - @Override public Expr applyNodeTransform(NodeTransform transform) { return this; } + if ( expr2 != null ) { + out.append(", "); + WriterExpr.output(out, expr2, null); + } - @Override public NodeValue eval(Binding binding, FunctionEnv env) { - throw new InternalErrorException("Attempt to eval DummyExprForType"); + if ( typeIRI2 != null ) { + out.append( " TYPE " ); + out.append( typeIRI2.toString() ); } - }; + + out.decIndent(); + out.append(")"); + return out.asString(); + } protected class ListAccumulator implements Accumulator { final protected List list = new ArrayList<>(); @@ -214,13 +233,25 @@ protected class ListAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) - list.add( nv.asNode() ); + if ( nv != null ) { + final Node n = nv.asNode(); + if ( typeIRI1 != null ) { // check the type of the node + final String nTypeIRI; + if ( n.isLiteral() ) + nTypeIRI = n.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the node if it is not of the expected type + } + list.add(n); + } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("["); if ( ! list.isEmpty() ) { final Iterator it = list.iterator(); final Node firstNode = it.next(); @@ -233,7 +264,19 @@ public NodeValue getValue() { sb.append(nextNodeAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedList ); + sb.append("]"); + + final RDFDatatype datatype; + if ( typeIRI1 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + datatype = QueryIterUnfold.datatypeTypedList; + } + else { + datatype = QueryIterUnfold.datatypeUntypedList; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } @@ -244,17 +287,41 @@ protected class MapAccumulator implements Accumulator { @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue key = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue value = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( key != null && value != null ) { - keys.add( key.asNode() ); - values.add( value.asNode() ); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvKey != null && nvValue != null ) { + final Node key = nvKey.asNode(); + final Node value = nvValue.asNode(); + + if ( typeIRI1 != null ) { // check the type of the key + final String nTypeIRI; + if ( key.isLiteral() ) + nTypeIRI = key.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI1.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the key is not of the expected type + } + + if ( typeIRI2 != null ) { // check the type of the value + final String nTypeIRI; + if ( value.isLiteral() ) + nTypeIRI = value.getLiteralDatatypeURI(); + else + nTypeIRI = null; + if ( ! typeIRI2.getURI().equals(nTypeIRI) ) + return; // ignore the key-value pair if the value is not of the expected type + } + + keys.add(key); + values.add(value); } } @Override public NodeValue getValue() { final StringBuilder sb = new StringBuilder(); + sb.append("{"); if ( ! keys.isEmpty() ) { final Iterator it = keys.iterator(); final Iterator it2 = values.iterator(); @@ -276,7 +343,25 @@ public NodeValue getValue() { sb.append(nextValueAsString); } } - final Node n = NodeFactory.createLiteral( sb.toString(), QueryIterUnfold.datatypeUntypedMap ); + sb.append("}"); + + final RDFDatatype datatype; + if ( typeIRI1 != null || typeIRI2 != null ) { + sb.append("^^"); + if ( typeIRI1 != null ) { + sb.append( NodeFmtLib.strTTL(typeIRI1) ); + } + if ( typeIRI2 != null ) { + sb.append("^^"); + sb.append( NodeFmtLib.strTTL(typeIRI2) ); + } + datatype = QueryIterUnfold.datatypeTypedMap; + } + else { + datatype = QueryIterUnfold.datatypeUntypedMap; + } + + final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); return NodeValue.makeNode(n); } } From 71aac09294bbd793ef88275e5a3b8d4bf5218aa8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 Aug 2022 18:49:06 +0200 Subject: [PATCH 263/323] adds support for collection-related functions --- .../engine/iterator/QueryIterUnfold.java | 5 +- .../CollectionLiteralFunctions.java | 10 +++ .../function/library/collection/SizeFct.java | 70 +++++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 9e553fc40cd..48deaaee91c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -94,14 +94,15 @@ protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBi return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } - protected Iterator> parseMap(String mapAsValue) { - final PrefixMap pmap = (getExecContext().getDataset() == null) ? null : getExecContext().getDataset().prefixes(); + public static Iterator> parseMap( final String mapAsValue, final PrefixMap pmap ) { final Iterator> itMapElmts = extractMapElements(mapAsValue); return new Iterator<>() { @Override public boolean hasNext() { return itMapElmts.hasNext(); } + } + } protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java new file mode 100644 index 00000000000..f1bb072c595 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -0,0 +1,10 @@ +package org.apache.jena.sparql.function.library.collection; + +import org.apache.jena.sparql.ARQConstants; +import org.apache.jena.sparql.function.FunctionRegistry; + +public class CollectionLiteralFunctions { + public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + } +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java new file mode 100644 index 00000000000..94a3f0748b7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -0,0 +1,70 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; + +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class SizeFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + final String datatypeURI = n.getLiteralDatatypeURI(); + final int size; + if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); + } + else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } + + return NodeValue.makeInteger(size); + } + + protected int determineSizeOfUntypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedList( final String listAsString ) { + final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfUntypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineSizeOfTypedMap( final String mapAsString ) { + final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); + return determineNumberOfElements(it); + } + + protected int determineNumberOfElements( final Iterator it ) { + int i = 0; + while ( it.hasNext() ) { + i++; + it.next(); + } + return i; + } + +} From dde32ba20ec1e2c8c6d5d4d2d2b20011af2f8d1b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 17 Aug 2022 18:38:31 +0200 Subject: [PATCH 264/323] adds POC of a 'concat' function for lists --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ConcatFct.java | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index f1bb072c595..5beaeec3aa8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,5 +6,6 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java new file mode 100644 index 00000000000..4ccf1688fcb --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -0,0 +1,87 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.riot.out.NodeFmtLib; +import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ConcatFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { + final String list1AsString = getInputListAsString(v1); + final String list2AsString = getInputListAsString(v2); +System.out.println("list1AsString " + list1AsString); +System.out.println("list2AsString " + list2AsString); + return createResultList(list1AsString, list2AsString); + } + + protected String getInputListAsString( final NodeValue v ) { + final Node n = v.asNode(); + + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + v); + + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + throw new ExprEvalException("Literal with wrong datatype: " + v); + } + + return n.getLiteralLexicalForm(); + } + + protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { + final String resultListAsString = createResultListAsString(list1AsString, list2AsString); + final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + +System.out.println("resultListAsString " + resultListAsString); + final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + return NodeValue.makeNode(n); + } + + protected String createResultListAsString( final String list1AsString, final String list2AsString ) { + final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); + final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); + final Iterator it = new ConcatenatingIterator(it1, it2); + + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( it.hasNext() ) { + final Node firstNode = it.next(); + final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); + sb.append(firstNodeAsString); + while ( it.hasNext() ) { + final Node nextNode = it.next(); + final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); + sb.append(", "); + sb.append(nextNodeAsString); + } + } + sb.append("]"); + + return sb.toString(); + } + + protected static class ConcatenatingIterator implements Iterator { + protected final Iterator it1; + protected final Iterator it2; + public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } + @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } + @Override public T next() { + if ( it1.hasNext() ) + return it1.next(); + else if ( it2.hasNext() ) + return it2.next(); + else + throw new NoSuchElementException(); + } + } + +} From be8779138108c263e0af8832b1c1639af91232f8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 19 Aug 2022 11:57:06 +0200 Subject: [PATCH 265/323] creates Node_LiteralWithList and Node_LiteralWithMap, so far only as placeholders for adding special functionality for such types of literals --- .../jena/sparql/expr/aggregate/AggFold.java | 11 ++++++----- .../library/collection/ConcatFct.java | 5 +++-- .../function/library/collection/SizeFct.java | 10 ++++++---- .../jena/graph/Node_LiteralWithList.java | 19 +++++++++++++++++++ .../jena/graph/Node_LiteralWithMap.java | 18 ++++++++++++++++++ 5 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java create mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index f7ee0f19410..337d034c01f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -9,11 +9,12 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.riot.system.PrefixMap; import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; @@ -270,10 +271,10 @@ public NodeValue getValue() { if ( typeIRI1 != null ) { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = QueryIterUnfold.datatypeTypedList; + datatype = Node_LiteralWithList.datatypeTypedList; } else { - datatype = QueryIterUnfold.datatypeUntypedList; + datatype = Node_LiteralWithList.datatypeUntypedList; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); @@ -355,10 +356,10 @@ public NodeValue getValue() { sb.append("^^"); sb.append( NodeFmtLib.strTTL(typeIRI2) ); } - datatype = QueryIterUnfold.datatypeTypedMap; + datatype = Node_LiteralWithMap.datatypeTypedMap; } else { - datatype = QueryIterUnfold.datatypeUntypedMap; + datatype = Node_LiteralWithMap.datatypeUntypedMap; } final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 4ccf1688fcb..b9d1b3a6c79 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -6,6 +6,7 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.Node_LiteralWithList; import org.apache.jena.riot.out.NodeFmtLib; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; @@ -30,7 +31,7 @@ protected String getInputListAsString( final NodeValue v ) { throw new ExprEvalException("Not a literal: " + v); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { throw new ExprEvalException("Literal with wrong datatype: " + v); } @@ -39,7 +40,7 @@ protected String getInputListAsString( final NodeValue v ) { protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = QueryIterUnfold.datatypeUntypedList; + final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; System.out.println("resultListAsString " + resultListAsString); final Node n = NodeFactory.createLiteral(resultListAsString, datatype); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 94a3f0748b7..982d6b8e5a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -3,6 +3,8 @@ import java.util.Iterator; import org.apache.jena.graph.Node; +import org.apache.jena.graph.Node_LiteralWithList; +import org.apache.jena.graph.Node_LiteralWithMap; import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -19,16 +21,16 @@ public NodeValue exec( final NodeValue nv ) { final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( QueryIterUnfold.datatypeUriUntypedList.equals(datatypeURI) ) { + if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedList.equals(datatypeURI) ) { + else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriUntypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); } - else if ( QueryIterUnfold.datatypeUriTypedMap.equals(datatypeURI) ) { + else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); } else { diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java new file mode 100644 index 00000000000..37cb8ca1f3e --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java @@ -0,0 +1,19 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithList extends Node_Literal +{ + public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; + public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; + public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); + public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); + + public Node_LiteralWithList( final LiteralLabel label ) { + super(label); + } + + +} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java new file mode 100644 index 00000000000..27d5bef8656 --- /dev/null +++ b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java @@ -0,0 +1,18 @@ +package org.apache.jena.graph; + +import org.apache.jena.datatypes.BaseDatatype; +import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.graph.impl.LiteralLabel; + +public class Node_LiteralWithMap extends Node_Literal +{ + public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; + public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; + public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); + public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); + + public Node_LiteralWithMap( final LiteralLabel label ) { + super(label); + } + +} From 108b236e98c94bd1cff052cedf97a50d995eab2e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 10:35:24 +0100 Subject: [PATCH 266/323] adds an actual parser for the lexical form of cdt:List and cdt:Map literals, and proper integration into the Jena Graph API (via special LiteralLabel implementations) --- jena-arq/Grammar/cdt_literals.jj | 366 ++++++++++++++++++ jena-arq/Grammar/grammarCDTs | 59 +++ .../jena/sparql/expr/aggregate/AggFold.java | 266 +++---------- .../library/collection/ConcatFct.java | 96 ++--- .../function/library/collection/SizeFct.java | 76 ++-- .../jena/graph/Node_LiteralWithList.java | 19 - .../jena/graph/Node_LiteralWithMap.java | 18 - 7 files changed, 532 insertions(+), 368 deletions(-) create mode 100644 jena-arq/Grammar/cdt_literals.jj create mode 100755 jena-arq/Grammar/grammarCDTs delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java delete mode 100644 jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj new file mode 100644 index 00000000000..eac97b2827e --- /dev/null +++ b/jena-arq/Grammar/cdt_literals.jj @@ -0,0 +1,366 @@ +/* + * 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. + */ + +options +{ + // Use \ u escapes in streams AND use a reader for the query + // => get both raw and escaped unicode + + JAVA_UNICODE_ESCAPE = true ; + UNICODE_INPUT = false ; + + STATIC = false ; +// DEBUG_PARSER = true ; +// DEBUG_TOKEN_MANAGER = true ; +} + +PARSER_BEGIN(CDTLiteralParser) +/* + * 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 org.apache.jena.cdt.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.*; +import org.apache.jena.graph.Node; +import org.apache.jena.ttl.turtle.TurtleParserBase; + +public class CDTLiteralParser extends TurtleParserBase +{ +} +PARSER_END(CDTLiteralParser) + +// --- Entry point + +void parse() : {} +{ + ( List() | Map() ) +} + +List List() : { List l = new ArrayList(); } +{ + + + ( ListElement(l) )? + + ( ListElement(l) )* + + // should we permit a trailing comma? + + + + { return l; } +} + +void ListElement(List l) : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } +| + n = BlankNode() { l.add( CDTFactory.createValue(n) ); } +| + n = RDFLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = NumericLiteral() { l.add( CDTFactory.createValue(n) ); } +| + n = BooleanLiteral() { l.add( CDTFactory.createValue(n) ); } +| + { l.add( CDTFactory.getNullValue() ); } +| + subList = List() { l.add( CDTFactory.createValue(subList) ); } +| + m = Map() { l.add( CDTFactory.createValue(m) ); } +} + +Map Map() : { Map m = new HashMap(); } +{ + + + ( MapEntry(m) )? + + ( MapEntry(m) )* + + + + { return m; } +} + +void MapEntry(Map m) : { CDTKey key; CDTValue value; } +{ + key = MapKey() + + + + value = MapValue() + + { + final CDTValue oldValue = m.put(key, value); + if ( oldValue != null ) throw new ParseException("map with non-unique key (" + key.toString() + ")"); + } +} + +CDTKey MapKey() : { String iri; Node n; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } +| + n = BlankNode() { return CDTFactory.createKey(n); } +| + n = RDFLiteral() { return CDTFactory.createKey(n); } +| + n = NumericLiteral() { return CDTFactory.createKey(n); } +| + n = BooleanLiteral() { return CDTFactory.createKey(n); } +} + +CDTValue MapValue() : { String iri; Node n; List subList; Map m; } +{ + iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } +| + n = BlankNode() { return CDTFactory.createValue(n); } +| + n = RDFLiteral() { return CDTFactory.createValue(n); } +| + n = NumericLiteral() { return CDTFactory.createValue(n); } +| + n = BooleanLiteral() { return CDTFactory.createValue(n); } +| + { return CDTFactory.getNullValue(); } +| + subList = List() { return CDTFactory.createValue(subList); } +| + m = Map() { return CDTFactory.createValue(m); } +} + + +// ---- Basic terms + +String IRI_REF() : { Token t ; } +{ + t = + { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } +} + +Node BlankNode() : { Token t = null ; } +{ + t = + + { + return createBNode(t.image, t.beginLine, t.beginColumn); + } +} + +Node NumericLiteral() : { Token t ; } +{ + t = { return createLiteralInteger(t.image); } +| t = { return createLiteralDecimal(t.image); } +| t = { return createLiteralDouble(t.image); } +} + +Node BooleanLiteral() : {} +{ + { return XSD_TRUE; } + | + { return XSD_FALSE; } +} + +Node RDFLiteral() : { String lex = null ; } +{ + lex = String() + // Optional lang tag and datatype. + { String lang = null ; String dt = null ; } + ( + lang = Langtag() + | + ( dt = IRI_REF() ) // divergence from the Turtle parser here; instead of IRIref(), we only permit IRI_REF() + )? + + { + return createLiteral(lex, lang, dt); + } +} + +String Langtag() : { Token t ; } +{ + t = // divergence from the Turtle parser here, which also permits AnyDirective() at this point + { String lang = stripChars(t.image, 1) ; return lang ; } +} + +String String() : { Token t ; String lex ; } +{ + ( t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + | t = { lex = stripQuotes3(t.image) ; } + ) + { lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; + return lex ; + } +} + + +// ------------------------------------------ +// Tokens + +// Comments and whitespace + +SKIP : { " " | "\t" | "\n" | "\r" | "\f" } + +TOKEN: { <#WS: " " | "\t" | "\n" | "\r" | "\f"> } + + +// ------------------------------------------------- +// Keywords + +TOKEN [IGNORE_CASE] : +{ + < TRUE: "true" > +| < FALSE: "false" > + +// ------------------------------------------------- + +| < INTEGER: (["-","+"])? > +| + < DECIMAL: (["-","+"])? + (()+ "." ()* | "." ()+) + > + // Required exponent. +| < DOUBLE: + (["+","-"])? + ( + (["0"-"9"])+ "." (["0"-"9"])* + | "." (["0"-"9"])+ () + | (["0"-"9"])+ + ) + > +| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| < #QUOTE_3D: "\"\"\""> +| < #QUOTE_3S: "'''"> +// "u" done by javacc input stream. +// "U" escapes not supported yet for Java strings +| + +| < STRING_LITERAL1: + // Single quoted string + "'" ( (~["'","\\","\n","\r"]) | )* "'" > + +| < STRING_LITERAL2: + // Double quoted string + "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > + +| < STRING_LITERAL_LONG1: + + ( ~["'","\\"] | | ("'" ~["'"]) | ("''" ~["'"]))* + > + +| < STRING_LITERAL_LONG2: + + ( ~["\"","\\"] | | ("\"" ~["\""]) | ("\"\"" ~["\""]))* + > +| < DIGITS: (["0"-"9"])+> +// | +} + +TOKEN: +{ + // Includes # for relative URIs + ","<", "\"", "{", "}", "^", "\\", "|", "`", + "\u0000"-"\u0020"])* ">" > +| > +| ()+("-" ()+)* > +| <#A2Z: ["a"-"z","A"-"Z"]> +| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> +} + + +TOKEN : +{ + < NULL: "null" > + +| < LBRACE: "{" > +| < RBRACE: "}" > + +| < LBRACKET: "[" > +| < RBRACKET: "]" > + +| < COMMA: "," > +| < COLON: ":" > +} + +// Operator + +TOKEN : +{ + < DATATYPE: "^^"> +| < AT: "@"> +} + +TOKEN: +{ + <#PN_CHARS_BASE: + ["A"-"Z"] | ["a"-"z"] | + ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | + ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | + ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | + ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] + > + // [#x10000-#xEFFFF] +| + <#PN_CHARS_U: | "_" > +| +// No DOT + <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | + ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > +| + // With a leading "_", no dot at end of local name. + <#PN_LOCAL: ( | ["0"-"9"]) ((|".")* )? > +} + +// Catch-all tokens. Must be last. +// Any non-whitespace. Causes a parser exception, rather than a +// token manager error (with hidden line numbers). +// Only bad IRIs (e.g. spaces) now give unhelpful parse errors. +TOKEN: +{ + <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > +} + +/* +# Local Variables: +# tab-width: 4 +# indent-tabs-mode: nil +# comment-default-style: "//" +# End: +*/ diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs new file mode 100755 index 00000000000..fb95f355e44 --- /dev/null +++ b/jena-arq/Grammar/grammarCDTs @@ -0,0 +1,59 @@ +#!/bin/bash +## 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. + +# Parser builder + +DIR="../src/main/java/org/apache/jena/cdt/parser" +FILE=cdt_literals.jj +CLASS=CDTLiteralParser + +(cd "$DIR" ; rm -f *.java ) + +echo "---- Process grammar ----" + +javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" + +RC=$? +[ "$RC" = 0 ] || return + +## echo "---- Create text form ----" +## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" + +echo "---- Fixing Java warnings in TokenMgrError" +F="$DIR/TokenMgrError.java" +if [ -e "$F" ] +then + sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic class TokenMgrError/' < $F > F + mv F $F +fi + +## JavaCharStream -- SimpleCharStream is OK. +echo "---- Fixing Java warnings in JavaCharStream..." +F="$DIR/JavaCharStream.java" +if [ -e "$F" ] +then + sed -e 's/public/\n@SuppressWarnings("all")\npublic/' < $F > F + mv F $F +fi + +echo "---- Fixing Java warnings in ${CLASS} ..." +F="$DIR/${CLASS}.java" +sed -e 's/@SuppressWarnings("serial")//' \ + < $F > F +mv F $F + +echo "---- Done" diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 337d034c01f..93f9a3fb87e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -1,26 +1,25 @@ package org.apache.jena.sparql.expr.aggregate; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Locale; import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.riot.system.PrefixMap; -import org.apache.jena.riot.system.PrefixMapFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.expr.nodevalue.NodeValueNode; -import org.apache.jena.sparql.expr.nodevalue.NodeValueString; import org.apache.jena.sparql.function.FunctionEnv; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; @@ -28,114 +27,43 @@ public class AggFold extends AggregatorBase { - protected static Expr dummyExprForTypeKeyword = new NodeValueNode( Node.ANY );// Node_Marker.xlabel("TYPE") ); - - protected final Expr expr1; // While the values of these member variables - protected final Expr expr2; // can also be extracted from the ExprList (see - protected final Node typeIRI1; // createExprList below), keeping these copies - protected final Node typeIRI2; // here makes it easier to access these values. + protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see + protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. public AggFold( final Expr expr1 ) { - this(expr1, null, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1 ) { - this(expr1, typeIRI1, null, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2 ) { - this(expr1, typeIRI1, expr2, null); + this(expr1, null); } public AggFold( final Expr expr1, final Expr expr2 ) { - this(expr1, null, expr2, null); - } - - public AggFold( final Expr expr1, final String typeIRI1, final Expr expr2, final String typeIRI2 ) { - super( "FOLD", false, createExprList(expr1, typeIRI1, expr2, typeIRI2) ); + super( "FOLD", false, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; - this.typeIRI1 = (typeIRI1 != null) ? NodeFactory.createURI(typeIRI1) : null; - this.typeIRI2 = (typeIRI2 != null) ? NodeFactory.createURI(typeIRI2) : null; } - protected static ExprList createExprList( final Expr expr1, final String typeIRI1, - final Expr expr2, final String typeIRI2 ) { + protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { final ExprList l = new ExprList(expr1); - if ( typeIRI1 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI1) ); - } - if ( expr2 != null ) { l.add(expr2); } - if ( typeIRI2 != null ) { - l.add(dummyExprForTypeKeyword); - l.add( new NodeValueString(typeIRI2) ); - } - return l; } @Override public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 6 ) + if ( exprs.size() < 1 || exprs.size() > 2 ) throw new IllegalArgumentException(); final Iterator it = exprs.iterator(); final Expr _expr1 = it.next(); - final Expr _expr2; - final String _typeIRI1; - final String _typeIRI2; - Expr lookAhead = it.hasNext() ? it.next() : null; - // _typeIRI1 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI1 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI1 = null; - } - // _expr2 - if ( lookAhead != null ) { - _expr2 = lookAhead; - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _expr2 = null; - } + final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - // _typeIRI2 - if ( lookAhead != null && lookAhead == dummyExprForTypeKeyword ) { - lookAhead = it.hasNext() ? it.next() : null; - if ( lookAhead != null && lookAhead instanceof NodeValueString ) - _typeIRI2 = ((NodeValueString) lookAhead).getString(); - else - throw new IllegalArgumentException(); - - lookAhead = it.hasNext() ? it.next() : null; - } - else { - _typeIRI2 = null; - } - - if ( lookAhead != null ) { - throw new IllegalArgumentException(); - } - - return new AggFold(_expr1, _typeIRI1, _expr2, _typeIRI2); + return new AggFold(_expr1, _expr2); } @Override @@ -172,29 +100,17 @@ public int hashCode() { @Override public String asSparqlExpr( final SerializationContext sCxt ) { - final PrefixMap pmap = PrefixMapFactory.create( sCxt.getPrefixMapping() ); - final IndentedLineBuffer out = new IndentedLineBuffer(); out.append( getName() ); out.append( "(" ); ExprUtils.fmtSPARQL(out, expr1, sCxt); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI1, pmap) ); - } - if ( expr2 != null ) { out.append(", "); ExprUtils.fmtSPARQL(out, expr2, sCxt); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( NodeFmtLib.str(typeIRI2, pmap) ); - } - out.append(")"); return out.asString(); } @@ -208,161 +124,71 @@ public String toPrefixString() { WriterExpr.output(out, expr1, null); - if ( typeIRI1 != null ) { - out.append( " TYPE " ); - out.append( typeIRI1.toString() ); - } - if ( expr2 != null ) { out.append(", "); WriterExpr.output(out, expr2, null); } - if ( typeIRI2 != null ) { - out.append( " TYPE " ); - out.append( typeIRI2.toString() ); - } - out.decIndent(); out.append(")"); return out.asString(); } protected class ListAccumulator implements Accumulator { - final protected List list = new ArrayList<>(); + final protected List list = new ArrayList<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v; final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv != null ) { - final Node n = nv.asNode(); - if ( typeIRI1 != null ) { // check the type of the node - final String nTypeIRI; - if ( n.isLiteral() ) - nTypeIRI = n.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the node if it is not of the expected type - } - list.add(n); + if ( nv == null ) { + v = CDTFactory.getNullValue(); + } + else { + v = CDTFactory.createValue( nv.asNode() ); } + + list.add(v); } @Override public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( ! list.isEmpty() ) { - final Iterator it = list.iterator(); - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); - } - } - sb.append("]"); - - final RDFDatatype datatype; - if ( typeIRI1 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - datatype = Node_LiteralWithList.datatypeTypedList; - } - else { - datatype = Node_LiteralWithList.datatypeUntypedList; - } - - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + final LiteralLabelForList lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } protected class MapAccumulator implements Accumulator { - final protected List keys = new ArrayList<>(); - final protected List values = new ArrayList<>(); + final protected Map map = new HashMap<>(); @Override public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); - final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( nvKey != null && nvValue != null ) { - final Node key = nvKey.asNode(); - final Node value = nvValue.asNode(); - - if ( typeIRI1 != null ) { // check the type of the key - final String nTypeIRI; - if ( key.isLiteral() ) - nTypeIRI = key.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI1.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the key is not of the expected type - } - - if ( typeIRI2 != null ) { // check the type of the value - final String nTypeIRI; - if ( value.isLiteral() ) - nTypeIRI = value.getLiteralDatatypeURI(); - else - nTypeIRI = null; - if ( ! typeIRI2.getURI().equals(nTypeIRI) ) - return; // ignore the key-value pair if the value is not of the expected type - } - - keys.add(key); - values.add(value); + final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); + if ( nvKey == null ) { + return; // ignore if creating the key using the given binding failed } - } - @Override - public NodeValue getValue() { - final StringBuilder sb = new StringBuilder(); - sb.append("{"); - if ( ! keys.isEmpty() ) { - final Iterator it = keys.iterator(); - final Iterator it2 = values.iterator(); - final Node firstKey = it.next(); - final Node firstValue = it2.next(); - final String firstKeyAsString = NodeFmtLib.strTTL(firstKey); - final String firstValueAsString = NodeFmtLib.strTTL(firstValue); - sb.append(firstKeyAsString); - sb.append(" : "); - sb.append(firstValueAsString); - while ( it.hasNext() ) { - final Node nextKey = it.next(); - final Node nextValue = it2.next(); - final String nextKeyAsString = NodeFmtLib.strTTL(nextKey); - final String nextValueAsString = NodeFmtLib.strTTL(nextValue); - sb.append(", "); - sb.append(nextKeyAsString); - sb.append(" : "); - sb.append(nextValueAsString); - } - } - sb.append("}"); - - final RDFDatatype datatype; - if ( typeIRI1 != null || typeIRI2 != null ) { - sb.append("^^"); - if ( typeIRI1 != null ) { - sb.append( NodeFmtLib.strTTL(typeIRI1) ); - } - if ( typeIRI2 != null ) { - sb.append("^^"); - sb.append( NodeFmtLib.strTTL(typeIRI2) ); - } - datatype = Node_LiteralWithMap.datatypeTypedMap; + final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); + + // TODO: what do we do if the map already contains an entry with the same key? + + final CDTValue value; + final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); + if ( nvValue == null ) { + value = CDTFactory.getNullValue(); } else { - datatype = Node_LiteralWithMap.datatypeUntypedMap; + value = CDTFactory.createValue( nvValue.asNode() ); } - final Node n = NodeFactory.createLiteral( sb.toString(), datatype ); + map.put(key, value); + } + + @Override + public NodeValue getValue() { + final LiteralLabelForMap lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index b9d1b3a6c79..c950980ac3c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,14 +1,15 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; -import java.util.NoSuchElementException; +import java.util.ArrayList; +import java.util.List; -import org.apache.jena.datatypes.RDFDatatype; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.riot.out.NodeFmtLib; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -17,71 +18,40 @@ public class ConcatFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final String list1AsString = getInputListAsString(v1); - final String list2AsString = getInputListAsString(v2); -System.out.println("list1AsString " + list1AsString); -System.out.println("list2AsString " + list2AsString); - return createResultList(list1AsString, list2AsString); - } - - protected String getInputListAsString( final NodeValue v ) { - final Node n = v.asNode(); - - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + v); - - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( ! Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - throw new ExprEvalException("Literal with wrong datatype: " + v); - } - - return n.getLiteralLexicalForm(); - } + final List list1 = getInputList(v1); + final List list2 = getInputList(v2); - protected NodeValue createResultList( final String list1AsString, final String list2AsString ) { - final String resultListAsString = createResultListAsString(list1AsString, list2AsString); - final RDFDatatype datatype = Node_LiteralWithList.datatypeUntypedList; + final List result = new ArrayList<>(); + result.addAll(list1); + result.addAll(list2); -System.out.println("resultListAsString " + resultListAsString); - final Node n = NodeFactory.createLiteral(resultListAsString, datatype); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); return NodeValue.makeNode(n); } - protected String createResultListAsString( final String list1AsString, final String list2AsString ) { - final Iterator it1 = QueryIterUnfold.parseUntypedList(list1AsString, null); - final Iterator it2 = QueryIterUnfold.parseUntypedList(list2AsString, null); - final Iterator it = new ConcatenatingIterator(it1, it2); + protected List getInputList( final NodeValue nv ) { + final Node n = nv.asNode(); - final StringBuilder sb = new StringBuilder(); - sb.append("["); - if ( it.hasNext() ) { - final Node firstNode = it.next(); - final String firstNodeAsString = NodeFmtLib.strTTL(firstNode); - sb.append(firstNodeAsString); - while ( it.hasNext() ) { - final Node nextNode = it.next(); - final String nextNodeAsString = NodeFmtLib.strTTL(nextNode); - sb.append(", "); - sb.append(nextNodeAsString); + if ( ! n.isLiteral() ) + throw new ExprEvalException("Not a literal: " + nv); + + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + return ( (LiteralLabelForList) lit ).getValue(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + return CompositeDatatypeList.parseList(lex); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); } } - sb.append("]"); - - return sb.toString(); - } - - protected static class ConcatenatingIterator implements Iterator { - protected final Iterator it1; - protected final Iterator it2; - public ConcatenatingIterator( final Iterator it1, final Iterator it2 ) { this.it1 = it1; this.it2 = it2; } - @Override public boolean hasNext() { return it1.hasNext() || it2.hasNext(); } - @Override public T next() { - if ( it1.hasNext() ) - return it1.next(); - else if ( it2.hasNext() ) - return it2.next(); - else - throw new NoSuchElementException(); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 982d6b8e5a6..b4f76e2565f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -1,11 +1,12 @@ package org.apache.jena.sparql.function.library.collection; -import java.util.Iterator; - +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.Node_LiteralWithList; -import org.apache.jena.graph.Node_LiteralWithMap; -import org.apache.jena.sparql.engine.iterator.QueryIterUnfold; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -19,54 +20,33 @@ public NodeValue exec( final NodeValue nv ) { if ( ! n.isLiteral() ) throw new ExprEvalException("Not a literal: " + nv); - final String datatypeURI = n.getLiteralDatatypeURI(); final int size; - if ( Node_LiteralWithList.datatypeUriUntypedList.equals(datatypeURI) ) { - size = determineSizeOfUntypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithList.datatypeUriTypedList.equals(datatypeURI) ) { - size = determineSizeOfTypedList( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriUntypedMap.equals(datatypeURI) ) { - size = determineSizeOfUntypedMap( n.getLiteral().getLexicalForm() ); - } - else if ( Node_LiteralWithMap.datatypeUriTypedMap.equals(datatypeURI) ) { - size = determineSizeOfTypedMap( n.getLiteral().getLexicalForm() ); + try { + final LiteralLabel lit = n.getLiteral(); + final String datatypeURI = n.getLiteralDatatypeURI(); + if ( lit instanceof LiteralLabelForList ) { + size = ( (LiteralLabelForList) lit ).getValue().size(); + } + else if ( lit instanceof LiteralLabelForMap ) { + size = ( (LiteralLabelForMap) lit ).getValue().size(); + } + else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeList.parseList(lex).size(); + } + else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { + final String lex = lit.getLexicalForm(); + size = CompositeDatatypeMap.parseMap(lex).size(); + } + else { + throw new ExprEvalException("Literal with wrong datatype: " + nv); + } } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); } return NodeValue.makeInteger(size); } - protected int determineSizeOfUntypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedList( final String listAsString ) { - final Iterator it = QueryIterUnfold.parseTypedList(listAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfUntypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseUntypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineSizeOfTypedMap( final String mapAsString ) { - final Iterator it = QueryIterUnfold.parseTypedMap(mapAsString, null); - return determineNumberOfElements(it); - } - - protected int determineNumberOfElements( final Iterator it ) { - int i = 0; - while ( it.hasNext() ) { - i++; - it.next(); - } - return i; - } - } diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java deleted file mode 100644 index 37cb8ca1f3e..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithList.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithList extends Node_Literal -{ - public static final String datatypeUriUntypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedList"; - public static final String datatypeUriTypedList = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedList"; - public static final RDFDatatype datatypeUntypedList = new BaseDatatype(datatypeUriUntypedList); - public static final RDFDatatype datatypeTypedList = new BaseDatatype(datatypeUriTypedList); - - public Node_LiteralWithList( final LiteralLabel label ) { - super(label); - } - - -} diff --git a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java b/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java deleted file mode 100644 index 27d5bef8656..00000000000 --- a/jena-core/src/main/java/org/apache/jena/graph/Node_LiteralWithMap.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.jena.graph; - -import org.apache.jena.datatypes.BaseDatatype; -import org.apache.jena.datatypes.RDFDatatype; -import org.apache.jena.graph.impl.LiteralLabel; - -public class Node_LiteralWithMap extends Node_Literal -{ - public static final String datatypeUriUntypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#UntypedMap"; - public static final String datatypeUriTypedMap = "http://www.w3.org/1999/02/22-rdf-syntax-ns#TypedMap"; - public static final RDFDatatype datatypeUntypedMap = new BaseDatatype(datatypeUriUntypedMap); - public static final RDFDatatype datatypeTypedMap = new BaseDatatype(datatypeUriTypedMap); - - public Node_LiteralWithMap( final LiteralLabel label ) { - super(label); - } - -} From c8cccb0193e4e7d5b4995fae120b573a5bba8327 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 11:14:29 +0100 Subject: [PATCH 267/323] updating the URI prefix 'cdt:' --- .../library/collection/CollectionLiteralFunctions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 5beaeec3aa8..fe5f8956bf8 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,7 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "size", SizeFct.class ); - functionRegistry.put( ARQConstants.ARQFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } } From 87d7c928c0c674a5c1d74af9db0961cad7348fbc Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 13:09:21 +0100 Subject: [PATCH 268/323] adds the constructor function cdt:List --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/ListFct.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index fe5f8956bf8..98a1e89e37c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,6 +5,7 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java new file mode 100644 index 00000000000..420ab788576 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -0,0 +1,37 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class ListFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + // nothing to do here + } + + @Override + public NodeValue exec( final List args ) { + final List list = new ArrayList<>( args.size() ); + + for ( final NodeValue nv : args ) { + final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 5a4259fb6f144ff7c76f26aa2e7e12c8fc370977 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 16:16:18 +0100 Subject: [PATCH 269/323] adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL --- .../main/java/org/apache/jena/sparql/expr/NodeValue.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 82275d4b24f..edf95175591 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -949,6 +949,12 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; } + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; + if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; + } + if ( NodeUtils.hasLang(nv.asNode()) ) return VSPACE_LANG ; return VSPACE_UNKNOWN ; From da9f3fbc9a12bc07e9a94dbd421f597ef6ba60ed Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Nov 2022 21:19:37 +0100 Subject: [PATCH 270/323] correct recursive implementation of 'equals' in 'CDTValue' --- .../java/org/apache/jena/cdt/CDTValue.java | 6 ++++++ .../jena/cdt/CompositeDatatypeList.java | 19 +++++++++++++++++++ .../apache/jena/cdt/CompositeDatatypeMap.java | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 3baed568f3e..265b012a466 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -80,6 +80,12 @@ public boolean equals( final Object other ) { catch ( final ExprEvalException ex ) { return false; } + + if ( v2.isNode() ) { + return v2.asNode().equals(n1); + } + + return false; } public boolean sameAs( final Object other ) throws ExprEvalException { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index c250c09dbcf..f25044887c1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -83,6 +83,25 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isListLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isValid( final String lexicalForm ) { try { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 587e30f9805..10401f49708 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -89,6 +89,25 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + /** + * Returns true if the given node is a literal with {@link #uri} + * as its datatype URI. Notice that this does not mean that this + * literal is actually valid; for checking validity, use + * {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final Node n ) { + return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + } + + /** + * Returns true if the datatype URI of the given {@link LiteralLabel} is + * {@link #uri}. Notice that this does not mean that this LiteralLabel is + * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. + */ + public static boolean isMapLiteral( final LiteralLabel lit ) { + return lit.getDatatypeURI().equals(uri); + } + @Override public boolean isValid( final String lexicalForm ) { try { From d3deb8ef4fc4c013f4fbab6c44d0d2dc328a0e5a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 09:46:50 +0100 Subject: [PATCH 271/323] adds the cdt:contains function --- .../java/org/apache/jena/cdt/CDTValue.java | 4 +- .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsFct.java | 130 ++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 265b012a466..43633e9121d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -82,7 +82,9 @@ public boolean equals( final Object other ) { } if ( v2.isNode() ) { - return v2.asNode().equals(n1); + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + return NodeValue.sameAs(nv1, nv2); } return false; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 98a1e89e37c..afa7c7e2f77 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -8,5 +8,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java new file mode 100644 index 00000000000..a940b91bf33 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -0,0 +1,130 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + final Node n2 = nv2.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + final boolean result; + if ( CompositeDatatypeList.isListLiteral(n2) ) { + result = containsList( list, n2.getLiteral() ); + } + else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { + result = containsMap( list, n2.getLiteral() ); + } + else { + result = containsNode( list, nv2 ); + } + + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term, assuming + * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + */ + protected boolean containsNode( final List list, final NodeValue n ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + final NodeValue vv = NodeValue.makeNode( v.asNode() ); + if ( NodeValue.sameAs(vv,n) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the list represented by + * the given cdt:List literal (i.e., assumes that the given literal + * is a cdt:List literal). + */ + protected boolean containsList( final List list, final LiteralLabel lit ) { + // get the list for the literal only if needed + List otherList = null; + + for ( final CDTValue v : list ) { + final List vList; + if ( v.isList() ) { + vList = v.asList(); + } + else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { + vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); + } + else { + vList = null; + } + + if ( vList != null ) { + // now we need to get the list + if ( otherList == null ) { + otherList = CompositeDatatypeList.getValue(lit); + } + + if ( vList.equals(otherList) ) { + return true; + } + } + } + + return false; + } + + /** + * Returns true if the given list contains the map represented by + * the given cdt:Map literal (i.e., assumes that the given literal + * is a cdt:Map literal). + */ + protected boolean containsMap( final List list, final LiteralLabel lit) { + // get the map for the literal only if needed + Map otherMap = null; + + for ( final CDTValue v : list ) { + final Map vMap; + if ( v.isMap() ) { + vMap = v.asMap(); + } + else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { + vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); + } + else { + vMap = null; + } + + if ( vMap != null ) { + // now we need to get the map + if ( otherMap == null ) { + otherMap = CompositeDatatypeMap.getValue(lit); + } + + if ( vMap.equals(otherMap) ) { + return true; + } + } + } + + return false; + } +} From 8508e53b13eb307eaafc48ab6c8fce00d50e5219 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 14 Nov 2022 20:05:01 +0100 Subject: [PATCH 272/323] adds CDTLiteralParserBase to create special Node objects for cdt:List literals and cdt:Map literals --- jena-arq/Grammar/cdt_literals.jj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index eac97b2827e..5ee872ef62e 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -57,9 +57,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; -import org.apache.jena.ttl.turtle.TurtleParserBase; -public class CDTLiteralParser extends TurtleParserBase +public class CDTLiteralParser extends CDTLiteralParserBase { } PARSER_END(CDTLiteralParser) From 6d28de9014c137d15f1af43f22fbfbeaa95aa4b2 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sat, 19 Nov 2022 16:32:34 +0100 Subject: [PATCH 273/323] bug fix in the CDT grammar (it was possible to have lists that begin with a comma) --- jena-arq/Grammar/cdt_literals.jj | 33 ++++++++++++++++++-------------- jena-arq/Grammar/grammarCDTs | 10 ++++++++-- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 5ee872ef62e..514be16467b 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -63,28 +63,26 @@ public class CDTLiteralParser extends CDTLiteralParserBase } PARSER_END(CDTLiteralParser) -// --- Entry point - -void parse() : {} -{ - ( List() | Map() ) -} +// --- Entry point for cdt:List literals List List() : { List l = new ArrayList(); } { - ( ListElement(l) )? - - ( ListElement(l) )* - - // should we permit a trailing comma? + ( NonEmptyListContent(l) )? { return l; } } +void NonEmptyListContent(List l) : { } +{ + ListElement(l) + + ( ListElement(l) )* +} + void ListElement(List l) : { String iri; Node n; List subList; Map m; } { iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } @@ -104,19 +102,26 @@ void ListElement(List l) : { String iri; Node n; List subLis m = Map() { l.add( CDTFactory.createValue(m) ); } } +// --- Entry point for cdt:Map literals + Map Map() : { Map m = new HashMap(); } { - ( MapEntry(m) )? - - ( MapEntry(m) )* + ( NonEmptyMapContent(m) )? { return m; } } +void NonEmptyMapContent(Map m) : { } +{ + MapEntry(m) + + ( MapEntry(m) )* +} + void MapEntry(Map m) : { CDTKey key; CDTValue value; } { key = MapKey() diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs index fb95f355e44..8bbaf8685d4 100755 --- a/jena-arq/Grammar/grammarCDTs +++ b/jena-arq/Grammar/grammarCDTs @@ -30,8 +30,8 @@ javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" RC=$? [ "$RC" = 0 ] || return -## echo "---- Create text form ----" -## jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" +echo "---- Create text form ----" +jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" echo "---- Fixing Java warnings in TokenMgrError" F="$DIR/TokenMgrError.java" @@ -56,4 +56,10 @@ sed -e 's/@SuppressWarnings("serial")//' \ < $F > F mv F $F +echo "---- Create HTML form ----" +./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html +./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html + +echo "Check X and Y for IRI_REF because \" became '" + echo "---- Done" From cb2d10a85469073b4ed2f5b9985119ac45b56ed3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 20 Nov 2022 20:56:26 +0100 Subject: [PATCH 274/323] changes CDTValue such that it can be only null or an RDF term --- .../library/collection/ConcatFct.java | 25 +++-- .../library/collection/ContainsFct.java | 96 +------------------ .../function/library/collection/SizeFct.java | 19 +--- 3 files changed, 20 insertions(+), 120 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index c950980ac3c..3b4a2dfa52e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -21,6 +21,14 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { final List list1 = getInputList(v1); final List list2 = getInputList(v2); + if ( list1.isEmpty() ) { + return v2; + } + + if ( list2.isEmpty() ) { + return v1; + } + final List result = new ArrayList<>(); result.addAll(list1); result.addAll(list2); @@ -33,22 +41,11 @@ public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { protected List getInputList( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + nv); try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - return CompositeDatatypeList.parseList(lex); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); - } + return CompositeDatatypeList.getValue( n.getLiteral() ); } catch ( final DatatypeFormatException ex ) { throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index a940b91bf33..b0a323e2e4c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -1,14 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; -import java.util.Map; -import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -18,72 +14,23 @@ public class ContainsFct extends FunctionBase2 @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - final Node n2 = nv2.asNode(); if ( ! CompositeDatatypeList.isListLiteral(n1) ) throw new ExprEvalException("Not a list literal: " + nv1); final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); - - final boolean result; - if ( CompositeDatatypeList.isListLiteral(n2) ) { - result = containsList( list, n2.getLiteral() ); - } - else if ( CompositeDatatypeMap.isMapLiteral(n2) ) { - result = containsMap( list, n2.getLiteral() ); - } - else { - result = containsNode( list, nv2 ); - } - + final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } /** - * Returns true if the given list contains the given RDF term, assuming - * that this RDF terms is neither a cdt:List literal nor a cdt:Map literal. + * Returns true if the given list contains the given RDF term. */ - protected boolean containsNode( final List list, final NodeValue n ) { + protected boolean containsNode( final List list, final NodeValue nv ) { for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv,n) ) { - return true; - } - } - } - - return false; - } - - /** - * Returns true if the given list contains the list represented by - * the given cdt:List literal (i.e., assumes that the given literal - * is a cdt:List literal). - */ - protected boolean containsList( final List list, final LiteralLabel lit ) { - // get the list for the literal only if needed - List otherList = null; - - for ( final CDTValue v : list ) { - final List vList; - if ( v.isList() ) { - vList = v.asList(); - } - else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { - vList = CompositeDatatypeList.getValue( v.asNode().getLiteral() ); - } - else { - vList = null; - } - - if ( vList != null ) { - // now we need to get the list - if ( otherList == null ) { - otherList = CompositeDatatypeList.getValue(lit); - } - - if ( vList.equals(otherList) ) { + if ( NodeValue.sameAs(vv, nv) ) { return true; } } @@ -92,39 +39,4 @@ else if ( v.isNode() && CompositeDatatypeList.isListLiteral(v.asNode()) ) { return false; } - /** - * Returns true if the given list contains the map represented by - * the given cdt:Map literal (i.e., assumes that the given literal - * is a cdt:Map literal). - */ - protected boolean containsMap( final List list, final LiteralLabel lit) { - // get the map for the literal only if needed - Map otherMap = null; - - for ( final CDTValue v : list ) { - final Map vMap; - if ( v.isMap() ) { - vMap = v.asMap(); - } - else if ( v.isNode() && CompositeDatatypeMap.isMapLiteral(v.asNode()) ) { - vMap = CompositeDatatypeMap.getValue( v.asNode().getLiteral() ); - } - else { - vMap = null; - } - - if ( vMap != null ) { - // now we need to get the map - if ( otherMap == null ) { - otherMap = CompositeDatatypeMap.getValue(lit); - } - - if ( vMap.equals(otherMap) ) { - return true; - } - } - } - - return false; - } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index b4f76e2565f..4121ba8db3b 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,8 +2,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.impl.LiteralLabel; @@ -24,22 +22,15 @@ public NodeValue exec( final NodeValue nv ) { try { final LiteralLabel lit = n.getLiteral(); final String datatypeURI = n.getLiteralDatatypeURI(); - if ( lit instanceof LiteralLabelForList ) { - size = ( (LiteralLabelForList) lit ).getValue().size(); - } - else if ( lit instanceof LiteralLabelForMap ) { - size = ( (LiteralLabelForMap) lit ).getValue().size(); - } - else if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeList.parseList(lex).size(); + + if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { + size = CompositeDatatypeList.getValue(lit).size(); } else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - final String lex = lit.getLexicalForm(); - size = CompositeDatatypeMap.parseMap(lex).size(); + size = CompositeDatatypeMap.getValue(lit).size(); } else { - throw new ExprEvalException("Literal with wrong datatype: " + nv); + throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); } } catch ( final DatatypeFormatException ex ) { From 42864e02bf86ddf0a02ef37166bda5d4a38245e3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 22:17:37 +0100 Subject: [PATCH 275/323] adds cdt:containsTerm function --- .../apache/jena/cdt/LiteralLabelForCDTs.java | 17 ++++++++ .../CollectionLiteralFunctions.java | 1 + .../library/collection/ContainsTermFct.java | 42 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 48eb6c0f0fe..3b66ce02eb7 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -190,6 +190,23 @@ public boolean equals( final Object other ) { return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); } + @Override + public boolean equals( final Object other ) { + if ( this == other ) return true; + + if ( other == null || !(other instanceof LiteralLabel) ) return false; + + final LiteralLabel otherLiteral = (LiteralLabel) other; + + final String otherLang = otherLiteral.language(); + if ( otherLang != null && ! otherLang.isEmpty() ) return false; + + final String otherDTypeURI = otherLiteral.getDatatypeURI(); + if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; + + return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); + } + @Override public int getDefaultHashcode() { return hash; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index afa7c7e2f77..7796fef6e8d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -9,5 +9,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java new file mode 100644 index 00000000000..6951d89992e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsTermFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final boolean result = containsTerm( list, nv2 ); + return NodeValue.booleanReturn(result); + } + + /** + * Returns true if the given list contains the given RDF term. + */ + protected boolean containsTerm( final List list, final NodeValue nv ) { + for ( final CDTValue v : list ) { + if ( v.isNode() ) { + if ( NodeFunctions.sameTerm(v.asNode(), nv.asNode()) ) { + return true; + } + } + } + + return false; + } + +} From b5f9329b7614609105e3b32369ef12ff0c079d80 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 29 Nov 2022 23:04:23 +0100 Subject: [PATCH 276/323] adds cdt:get function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/GetFct.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 7796fef6e8d..4f3959b7342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -10,5 +10,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java new file mode 100644 index 00000000000..41227a7bb10 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -0,0 +1,46 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class GetFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + + if ( index > list.size() ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final CDTValue value = list.get( index-1 ); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From af5719f69c1b90a45bb55b2a5232d762b50e35db Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:27:38 +0100 Subject: [PATCH 277/323] adds cdt:head function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/HeadFct.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 4f3959b7342..9a521880665 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,5 +11,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java new file mode 100644 index 00000000000..5fcaf302c84 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -0,0 +1,38 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class HeadFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final CDTValue value = list.get(0); + if ( value.isNull() ) { + throw new ExprEvalException("accessing null value from list" ); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + +} From 845683a99236740fc13b2ba78af5feca5fa6122b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:37 +0100 Subject: [PATCH 278/323] adds base class FunctionBase1List --- .../library/collection/FunctionBase1List.java | 27 +++++++++++++++++++ .../function/library/collection/HeadFct.java | 14 ++-------- 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java new file mode 100644 index 00000000000..0f49e6b61fd --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -0,0 +1,27 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public abstract class FunctionBase1List extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a list literal: " + nv); + + final List list = CompositeDatatypeList.getValue( n.getLiteral() ); + + return _exec(list); + } + + protected abstract NodeValue _exec( List list ); +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 5fcaf302c84..4deed24468e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -3,23 +3,13 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; -public class HeadFct extends FunctionBase1 +public class HeadFct extends FunctionBase1List { @Override - public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + protected NodeValue _exec( final List list ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From f6adcc10bef6ab690d59389e720b0061a1d63420 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 07:51:57 +0100 Subject: [PATCH 279/323] adds cdt:tail function --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/TailFct.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 9a521880665..8f203ffe4ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -12,5 +12,6 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java new file mode 100644 index 00000000000..15abce441fa --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -0,0 +1,26 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class TailFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list ) { + if ( list.size() == 0 ) + throw new ExprEvalException("Empty list"); + + final List sublist = list.subList( 1, list.size() ); + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From afb1020b4617fd3d633f3545ad3d946773a65402 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:02:27 +0100 Subject: [PATCH 280/323] changes arguments of '_exec' in FunctionBase1List --- .../sparql/function/library/collection/FunctionBase1List.java | 4 ++-- .../jena/sparql/function/library/collection/HeadFct.java | 2 +- .../jena/sparql/function/library/collection/TailFct.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 0f49e6b61fd..99210c10f0d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -20,8 +20,8 @@ public NodeValue exec( final NodeValue nv ) { final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - return _exec(list); + return _exec(list, nv); } - protected abstract NodeValue _exec( List list ); + protected abstract NodeValue _exec( List list, NodeValue nvList ); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java index 4deed24468e..aebd5f39611 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java @@ -9,7 +9,7 @@ public class HeadFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index 15abce441fa..a56581d3195 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -13,7 +13,7 @@ public class TailFct extends FunctionBase1List { @Override - protected NodeValue _exec( final List list ) { + protected NodeValue _exec( final List list, final NodeValue nvList ) { if ( list.size() == 0 ) throw new ExprEvalException("Empty list"); From d3114488b879ef75eb49e8c2a4ed2abb5a60ed1a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 08:28:07 +0100 Subject: [PATCH 281/323] adds cdt:reverse function --- .../CollectionLiteralFunctions.java | 5 +-- .../library/collection/ReverseFct.java | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 8f203ffe4ba..31451f73fbb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -5,13 +5,14 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java new file mode 100644 index 00000000000..e2d2d3fd4ed --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -0,0 +1,33 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Arrays; +import java.util.List; + +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.NodeValue; + +public class ReverseFct extends FunctionBase1List +{ + @Override + protected NodeValue _exec( final List list, final NodeValue nvList ) { + if ( list.size() < 2 ) + return nvList; + + final CDTValue[] reverseArray = new CDTValue[ list.size() ]; + int i = list.size() - 1; + for ( final CDTValue v : list ) { + reverseArray[i] = v; + i--; + } + + final List reverseList = Arrays.asList(reverseArray); + final LiteralLabel lit = new LiteralLabelForList(reverseList); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From a475abbbc180e1466fe806c080a067d9c0fd2c97 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 11:33:32 +0100 Subject: [PATCH 282/323] adds cdt:subseq function --- .../CollectionLiteralFunctions.java | 1 + .../library/collection/SubSeqFct.java | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 31451f73fbb..1e16821a71e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java new file mode 100644 index 00000000000..d5e8f7b736b --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -0,0 +1,90 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Collections; +import java.util.List; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; + +public class SubSeqFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 && args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec( final List args ) { + final NodeValue nv1 = args.get(0); + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeList.isListLiteral(n1) ) + throw new ExprEvalException("Not a list literal: " + nv1); + + final NodeValue nv2 = args.get(1); + + if ( ! nv2.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv2); + + final int index = nv2.getInteger().intValue(); + + if ( index < 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + final int length; + final List list; + if ( args.size() == 3 ) { + final NodeValue nv3 = args.get(2); + + if ( ! nv3.isInteger() ) + throw new ExprEvalException("Not an integer literal: " + nv3); + + length = nv3.getInteger().intValue(); + + if ( length < 0 ) + throw new ExprEvalException("Illegal length value: " + nv3); + + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + } + else { + list = CompositeDatatypeList.getValue( n1.getLiteral() ); + length = list.size() - index + 1; + } + + if ( index > list.size() + 1 ) + throw new ExprEvalException("Out of bounds index value: " + nv2); + + if ( index + length > list.size() + 1 ) + throw new ExprEvalException("Beyond list length (index: " + index + ", length: " + length + ")"); + + final List sublist; + if ( index == list.size() + 1 ) { + if ( length != 0 ) + throw new ExprEvalException("Illegal arguments (index: " + index + ", length: " + length + ")"); + + if ( list.isEmpty() ) + return nv1; + + sublist = Collections.emptyList(); + } + else { + sublist = list.subList( index - 1, index - 1 + length ); + } + + final LiteralLabel lit = new LiteralLabelForList(sublist); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} From 678e1649bcad857d785cd859cc2fa56d34284bdb Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 30 Nov 2022 22:10:18 +0100 Subject: [PATCH 283/323] bugfix in 'isEqual' of CompositeDatatypeList (needs to throw ExprEvalException if null values are there) --- jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index 43633e9121d..ebbe5712b74 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -80,6 +80,12 @@ public boolean equals( final Object other ) { catch ( final ExprEvalException ex ) { return false; } + } + + public boolean sameAs( final Object other ) throws ExprEvalException { + if ( isNull() ) { + throw new ExprEvalException(); + } if ( v2.isNode() ) { final NodeValue nv1 = NodeValue.makeNode(n1); From 10795774a9e7dc1afd76180ed272d021c2f24e49 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 1 Dec 2022 09:26:45 +0100 Subject: [PATCH 284/323] fix: comparing two cdt:List literals using the = operator may still return false even if the lists contain null (but are clearly different in other parts) --- jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java | 2 +- .../main/java/org/apache/jena/cdt/CompositeDatatypeList.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java index ebbe5712b74..436d037fd08 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTValue.java @@ -84,7 +84,7 @@ public boolean equals( final Object other ) { public boolean sameAs( final Object other ) throws ExprEvalException { if ( isNull() ) { - throw new ExprEvalException(); + throw new ExprEvalException("nulls cannot be compared"); } if ( v2.isNode() ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index f25044887c1..990ce698061 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -182,6 +182,7 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); + boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); @@ -205,6 +206,8 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { } } + if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); + return true; } From ea8f4b42e78c67aea34ee20c84e3c3a55af285ab Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 13 Dec 2022 15:42:49 +0100 Subject: [PATCH 285/323] changes the implementation of the cdt:List constructor to be a functional form (rather than a function) which can be used to have null values in the constructed lists --- .../function/library/collection/ListFct.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index 420ab788576..a8820ed567a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -9,9 +9,13 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.Expr; +import org.apache.jena.sparql.expr.ExprException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; public class ListFct extends FunctionBase { @@ -21,11 +25,18 @@ public void checkBuild( final String uri, final ExprList args ) { } @Override - public NodeValue exec( final List args ) { + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { final List list = new ArrayList<>( args.size() ); - for ( final NodeValue nv : args ) { - final CDTValue v = (nv == null) ? CDTFactory.getNullValue() : CDTFactory.createValue( nv.asNode() ); + for ( final Expr e : args ) { + CDTValue v; + try { + final NodeValue nv = e.eval(binding, env); + v = CDTFactory.createValue( nv.asNode() ); + } catch ( final ExprException ex ) { + v = CDTFactory.getNullValue(); + } + list.add(v); } @@ -34,4 +45,9 @@ public NodeValue exec( final List args ) { return NodeValue.makeNode(n); } + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + } From 4aa9bc40d079256a64472fcb5643de1a99c3ba5a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 4 Jan 2023 19:49:36 +0100 Subject: [PATCH 286/323] makes cdt:concat an n-ary function --- .../library/collection/ConcatFct.java | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 3b4a2dfa52e..89526d9215d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -11,27 +11,38 @@ import org.apache.jena.graph.NodeFactory; import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; +import org.apache.jena.sparql.function.FunctionBase; -public class ConcatFct extends FunctionBase2 +public class ConcatFct extends FunctionBase { @Override - public NodeValue exec( final NodeValue v1, final NodeValue v2 ) { - final List list1 = getInputList(v1); - final List list2 = getInputList(v2); + public void checkBuild( final String uri, final ExprList args ) { + // nothing to check + } - if ( list1.isEmpty() ) { - return v2; + @Override + public NodeValue exec( final List args ) { + if ( args.isEmpty() ) { + final List result = new ArrayList<>(); + final LiteralLabel lit = new LiteralLabelForList(result); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); } - if ( list2.isEmpty() ) { - return v1; + if ( args.size() == 1 ) { + final NodeValue nv = args.get(0); + // make sure that the argument is a well-formed cdt:List literal + getInputList(nv); + + return nv; } final List result = new ArrayList<>(); - result.addAll(list1); - result.addAll(list2); + for ( final NodeValue nv : args ) { + result.addAll( getInputList(nv) ); + } final LiteralLabel lit = new LiteralLabelForList(result); final Node n = NodeFactory.createLiteral(lit); From 05b39c4ac2ccf095037344a1753f3cb0f89bc8f7 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 11 May 2023 11:02:31 +0200 Subject: [PATCH 287/323] support for comparison of cdt:List literals (i.e., < and >) --- .../jena/cdt/CompositeDatatypeList.java | 3 - .../apache/jena/sparql/expr/NodeValue.java | 450 ------------------ 2 files changed, 453 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 990ce698061..f25044887c1 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -182,7 +182,6 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Iterator it1 = list1.iterator(); final Iterator it2 = list2.iterator(); - boolean errorCaught = false; while ( it1.hasNext() ) { final CDTValue v1 = it1.next(); final CDTValue v2 = it2.next(); @@ -206,8 +205,6 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { } } - if ( errorCaught ) throw new ExprEvalException("nulls in lists cannot be compared"); - return true; } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index edf95175591..7695f4e6dbf 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -431,445 +431,13 @@ public boolean isTripleTerm() { return node.isNodeTriple() ; } -<<<<<<< HEAD public ValueSpace getValueSpace() { return classifyValueSpace(this); -======= - // ---------------------------------------------------------------- - // ---- sameValueAs - - // Disjoint value spaces : dateTime and dates are not comparable - // Every langtag implies another value space as well. - - /** Return true if the two NodeValues are known to be the same value - * return false if known to be different values, - * throw ExprEvalException otherwise - */ - public static boolean sameAs(NodeValue nv1, NodeValue nv2) - { - if ( nv1 == null || nv2 == null ) - throw new ARQInternalErrorException("Attempt to sameValueAs on a null") ; - - ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; - - // Special case - date/dateTime comparison is affected by timezones and may be - // indeterminate based on the value of the dateTime/date. - - switch (compType) - { - case VSPACE_NUM: - return XSDFuncOp.compareNumeric(nv1, nv2) == Expr.CMP_EQUAL ; - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_DAY : - { - int x = XSDFuncOp.compareDateTime(nv1, nv2) ; - if ( x == Expr.CMP_INDETERMINATE ) - throw new ExprNotComparableException("Indeterminate dateTime comparison") ; - return x == Expr.CMP_EQUAL ; - } - case VSPACE_DURATION: - { - int x = XSDFuncOp.compareDuration(nv1, nv2) ; - if ( x == Expr.CMP_INDETERMINATE ) - throw new ExprNotComparableException("Indeterminate duration comparison") ; - return x == Expr.CMP_EQUAL ; - } - - case VSPACE_STRING: return XSDFuncOp.compareString(nv1, nv2) == Expr.CMP_EQUAL ; - case VSPACE_BOOLEAN: return XSDFuncOp.compareBoolean(nv1, nv2) == Expr.CMP_EQUAL ; - - case VSPACE_TRIPLE_TERM: { - Triple t1 = nv1.getNode().getTriple(); - Triple t2 = nv2.getNode().getTriple(); - return nSameAs(t1.getSubject(), t2.getSubject()) - && nSameAs(t1.getPredicate(), t2.getPredicate()) - && nSameAs(t1.getObject(), t2.getObject()); - } - - case VSPACE_LANG: - case VSPACE_NODE: - // Two non-literals - return NodeFunctions.sameTerm(nv1.getNode(), nv2.getNode()) ; - - case VSPACE_UNKNOWN: - { - // One or two unknown value spaces, or one has a lang tag (but not both). - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - - if ( ! SystemARQ.ValueExtensions ) - // No value extensions => raw rdfTermEquals - return NodeFunctions.rdfTermEquals(node1, node2) ; - - // Some "value spaces" are know to be not equal (no overlap). - // Like one literal with a language tag, and one without can't be sameAs. - - if ( ! node1.isLiteral() || ! node2.isLiteral() ) - // Can't both be non-literals - that's VSPACE_NODE - // One or other not a literal => not sameAs - return false ; - - // Two literals at this point. - - if ( NodeFunctions.sameTerm(node1, node2) ) - return true ; - - if ( ! node1.getLiteralLanguage().equals("") || - ! node2.getLiteralLanguage().equals("") ) - // One had lang tag but weren't sameNode => not equals - return false ; - - raise(new ExprEvalException("Unknown equality test: "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("raise returned (sameValueAs)") ; - } - case VSPACE_SORTKEY: - return nv1.getSortKey().compareTo(nv2.getSortKey()) == 0 ; - - case VSPACE_DIFFERENT: - // Known to be incompatible. - if ( ! SystemARQ.ValueExtensions && ( nv1.isLiteral() && nv2.isLiteral() ) ) - raise(new ExprEvalException("Incompatible: "+nv1+" and "+nv2)) ; - return false ; - - case VSPACE_CDT_LIST: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - return CompositeDatatypeList.type.isEqual(lit1, lit2) ; - } - case VSPACE_CDT_MAP: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; - } - } - - throw new ARQInternalErrorException("sameValueAs failure "+nv1+" and "+nv2) ; ->>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } -<<<<<<< HEAD public static ValueSpace classifyValueOp(NodeValue nv1, NodeValue nv2) { ValueSpace c1 = classifyValueSpace(nv1); ValueSpace c2 = classifyValueSpace(nv2); -======= - /** Worker for sameAs. */ - private static boolean nSameAs(Node n1, Node n2) { - NodeValue nv1 = NodeValue.makeNode(n1); - NodeValue nv2 = NodeValue.makeNode(n2); - return sameAs(nv1, nv2); - } - - /** Return true if the two Nodes are known to be different, - * return false if the two Nodes are known to be the same, - * else throw ExprEvalException - */ - public static boolean notSameAs(Node n1, Node n2) - { - return notSameAs(NodeValue.makeNode(n1), NodeValue.makeNode(n2)) ; - } - - /** Return true if the two NodeValues are known to be different, - * return false if the two NodeValues are known to be the same, - * else throw ExprEvalException - */ - public static boolean notSameAs(NodeValue nv1, NodeValue nv2) - { - return ! sameAs(nv1, nv2) ; - } - - // ---------------------------------------------------------------- - // compare - - // Compare by value code is here - // NodeUtils.compareRDFTerms for syntactic comparison - - /** Compare by value if possible else compare by kind/type/lexical form - * Only use when you want an ordering regardless of form of NodeValue, - * for example in ORDER BY - * - * @param nv1 - * @param nv2 - * @return negative, 0, or positive for less than, equal, greater than. - */ - - public static int compareAlways(NodeValue nv1, NodeValue nv2) - { - try { - int x = compare(nv1, nv2, true) ; - // Same? - if ( x != Expr.CMP_EQUAL ) - return x ; - } catch (ExprNotComparableException ex) - { /* Drop through */ } - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - } - - /** Compare by value (and only value) if possible. - * Supports <, <=, >, >= but not = nor != (which are sameValueAs and notSameValueAs) - * @param nv1 - * @param nv2 - * @return Expr.CMP_INDETERMINATE(+2), Expr.CMP_LESS(-1), Expr.CMP_EQUAL(0) or Expr.CMP_GREATER(+1) - * @throws ExprNotComparableException - */ - public static int compare(NodeValue nv1, NodeValue nv2) - { - if ( nv1 == null || nv2 == null ) - //raise(new ExprEvalException("Attempt to notSameValueAs on null") ; - throw new ARQInternalErrorException("Attempt to compare on null") ; - int x = compare(nv1, nv2, false) ; - return x ; - } - - // E_GreaterThan/E_LessThan/E_GreaterThanOrEqual/E_LessThanOrEqual - // ==> compare(nv1, nv2) => compare (nv1, nv2, false) - - // BindingComparator => compareAlways(nv1, nv2) => compare (nv1, nv2, true) - - // E_Equals calls NodeValue.sameAs() ==> - - // sortOrderingCompare means that the comparison should do something with normally unlike things, - // and split plain strings from xsd:strings. - - private static int compare(NodeValue nv1, NodeValue nv2, boolean sortOrderingCompare) - { - if ( nv1 == null && nv2 == null ) - return Expr.CMP_EQUAL ; - - if ( nv1 == null ) - return Expr.CMP_LESS ; - if ( nv2 == null ) - return Expr.CMP_GREATER ; - - ValueSpaceClassification compType = classifyValueOp(nv1, nv2) ; - - // Special case - date/dateTime comparison is affected by timezones and may be - // indeterminate based on the value of the dateTime/date. - // Do this first, - - switch (compType) - { - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_DAY : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - { - int x = XSDFuncOp.compareDateTime(nv1, nv2) ; - if ( x != Expr.CMP_INDETERMINATE ) - return x ; - // Indeterminate => can't compare as strict values. - compType = ValueSpaceClassification.VSPACE_DIFFERENT ; - break ; - } - case VSPACE_DURATION: - { - int x = XSDFuncOp.compareDuration(nv1, nv2) ; - // Fix up - Java (Oracle java7 at least) returns "equals" for - // "P1Y"/"P365D" and "P1M"/"P28D", and others split over - // YearMonth/DayTime. - - // OR return Expr.CMP_INDETERMINATE ?? - if ( x == Expr.CMP_EQUAL ) { - Duration d1 = nv1.getDuration() ; - Duration d2 = nv2.getDuration() ; - if ( ( XSDFuncOp.isDayTime(d1) && XSDFuncOp.isYearMonth(d2) ) || - ( XSDFuncOp.isDayTime(d2) && XSDFuncOp.isYearMonth(d1) ) ) - x = Expr.CMP_INDETERMINATE ; - } - if ( x != Expr.CMP_INDETERMINATE ) - return x ; - compType = ValueSpaceClassification.VSPACE_DIFFERENT ; - break ; - } - - // No special cases. - case VSPACE_BOOLEAN : - case VSPACE_DIFFERENT : - case VSPACE_LANG : - case VSPACE_TRIPLE_TERM: - case VSPACE_NODE : - case VSPACE_NUM : - case VSPACE_STRING : - case VSPACE_SORTKEY : - case VSPACE_UNKNOWN : - // Drop through. - } - - switch (compType) - { - case VSPACE_DATETIME: - case VSPACE_DATE: - case VSPACE_TIME: - case VSPACE_G_DAY : - case VSPACE_G_MONTH : - case VSPACE_G_MONTHDAY : - case VSPACE_G_YEAR : - case VSPACE_G_YEARMONTH : - case VSPACE_DURATION: - throw new ARQInternalErrorException("Still seeing date/dateTime/time/duration compare type") ; - - case VSPACE_NUM: return XSDFuncOp.compareNumeric(nv1, nv2) ; - case VSPACE_STRING: - { - int cmp = XSDFuncOp.compareString(nv1, nv2) ; - - if ( ! sortOrderingCompare ) - return cmp ; - if ( cmp != Expr.CMP_EQUAL ) - return cmp ; - - // Equality. - if ( JenaRuntime.isRDF11 ) - // RDF 1.1 : No literals without datatype. - return cmp ; - - // RDF 1.0 - // Split plain literals and xsd:strings for sorting purposes. - // Same by string value. - String dt1 = nv1.asNode().getLiteralDatatypeURI() ; - String dt2 = nv2.asNode().getLiteralDatatypeURI() ; - if ( dt1 == null && dt2 != null ) - return Expr.CMP_LESS ; - if ( dt2 == null && dt1 != null ) - return Expr.CMP_GREATER ; - return Expr.CMP_EQUAL; // Both plain or both xsd:string. - } - case VSPACE_SORTKEY : - return nv1.getSortKey().compareTo(nv2.getSortKey()); - - case VSPACE_BOOLEAN: - return XSDFuncOp.compareBoolean(nv1, nv2) ; - - case VSPACE_LANG: - { - // Two literals, both with language tags. - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - int x = StrUtils.strCompareIgnoreCase(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; - - if ( x != Expr.CMP_EQUAL ) - { - // Different lang tags - if ( ! sortOrderingCompare ) - raise(new ExprNotComparableException("Can't compare (different languages) "+nv1+" and "+nv2)) ; - // Different lang tags - sorting - return x ; - } - - // same lang tag (case insensitive) - x = StrUtils.strCompare(node1.getLiteralLexicalForm(), node2.getLiteralLexicalForm()) ; - if ( x != Expr.CMP_EQUAL ) - return x ; - // Same lexical forms, same lang tag by value - // Try to split by syntactic lang tags. - x = StrUtils.strCompare(node1.getLiteralLanguage(), node2.getLiteralLanguage()) ; - // Maybe they are the same after all! - // Should be node.equals by now. - if ( x == Expr.CMP_EQUAL && ! NodeFunctions.sameTerm(node1, node2) ) - throw new ARQInternalErrorException("Looks like the same (lang tags) but not node equals") ; - return x ; - } - - case VSPACE_TRIPLE_TERM: { - Triple t1 = nv1.getNode().getTriple(); - Triple t2 = nv2.getNode().getTriple(); - int x = nCompare(t1.getSubject(), t2.getSubject(), sortOrderingCompare); - if ( x != CMP_EQUAL ) - return x; - x = nCompare(t1.getPredicate(), t2.getPredicate(), sortOrderingCompare); - if ( x != CMP_EQUAL ) - return x; - return nCompare(t1.getObject(), t2.getObject(), sortOrderingCompare); - } - - case VSPACE_NODE: - // Two non-literals don't compare except for sorting. - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - else - { - raise(new ExprNotComparableException("Can't compare (nodes) "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - - case VSPACE_CDT_LIST: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - try { - return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; - } - catch( final ExprNotComparableException e ) { - raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - } - - case VSPACE_CDT_MAP: - { - final LiteralLabel lit1 = nv1.asNode().getLiteral() ; - final LiteralLabel lit2 = nv2.asNode().getLiteral() ; - try { - return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; - } - catch( final ExprNotComparableException e ) { - raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - } - - case VSPACE_UNKNOWN: - { - // One or two unknown value spaces. - Node node1 = nv1.asNode() ; - Node node2 = nv2.asNode() ; - // Two unknown literals can be equal. - if ( NodeFunctions.sameTerm(node1, node2) ) - return Expr.CMP_EQUAL ; - - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(node1, node2) ; - - raise(new ExprNotComparableException("Can't compare "+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - - case VSPACE_DIFFERENT: - // Two literals, from different known value spaces - if ( sortOrderingCompare ) - return NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode()) ; - - raise(new ExprNotComparableException("Can't compare (incompatible value spaces)"+nv1+" and "+nv2)) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; - } - throw new ARQInternalErrorException("Compare failure "+nv1+" and "+nv2) ; - } - - /** Worker for compare. */ - private static int nCompare(Node n1, Node n2, boolean sortOrderingCompare) { - if ( n1.equals(n2) ) - return CMP_EQUAL; - NodeValue nv1 = NodeValue.makeNode(n1); - NodeValue nv2 = NodeValue.makeNode(n2); - return compare(nv1, nv2, sortOrderingCompare); - } - - public static ValueSpaceClassification classifyValueOp(NodeValue nv1, NodeValue nv2) - { - ValueSpaceClassification c1 = nv1.getValueSpace() ; - ValueSpaceClassification c2 = nv2.getValueSpace() ; ->>>>>>> ed504e0cc8 (support for comparison of cdt:List literals (i.e., < and >)) if ( c1 == c2 ) return c1 ; if ( c1 == VSPACE_UNKNOWN || c2 == VSPACE_UNKNOWN ) return VSPACE_UNKNOWN ; @@ -912,7 +480,6 @@ public static boolean notSameValueAs(NodeValue nv1, NodeValue nv2) { return NodeValueCmp.notSameValueAs(nv1, nv2); } -<<<<<<< HEAD // ---------------------------------------------------------------- // compare @@ -942,23 +509,6 @@ public static int compare(NodeValue nv1, NodeValue nv2) { public static int compareAlways(NodeValue nv1, NodeValue nv2) { //return NodeValueCompare.compareAlways(nv1, nv2); return NodeValueCmp.compareAlways(nv1, nv2); -======= - if ( nv.isLiteral() ) { - final String dtURI = nv.getDatatypeURI() ; - if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; - if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; - } - - if ( nv.isLiteral() ) { - final String dtURI = nv.getDatatypeURI() ; - if ( dtURI.equals(CompositeDatatypeList.uri) ) return VSPACE_CDT_LIST ; - if ( dtURI.equals(CompositeDatatypeMap.uri) ) return VSPACE_CDT_MAP ; - } - - if ( NodeUtils.hasLang(nv.asNode()) ) - return VSPACE_LANG ; - return VSPACE_UNKNOWN ; ->>>>>>> 3f5b140c95 (adds comparison of cdt:List literals and of cdt:Map literals as another special case for the equals (=) operator in SPARQL) } // ---------------------------------------------------------------- From ab7db7c8a96890f7916d717e4af5371f54d45bf4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 8 Jun 2023 22:50:18 +0200 Subject: [PATCH 288/323] changes implementation of 'list-equal' and 'list-less-than' such that comparing blank nodes (as list elements) raises an error --- .../org/apache/jena/cdt/CompositeDatatypeList.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index f25044887c1..2b9f921ce0d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -203,6 +203,17 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return false; } } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) { + return false; + } } return true; From 9ef3b7fb565ff315dae421c475cdfdd6c04d55aa Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 15 Jun 2023 17:43:33 +0200 Subject: [PATCH 289/323] FOLD must not accept blank nodes as keys for maps --- .../java/org/apache/jena/sparql/expr/aggregate/AggFold.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index 93f9a3fb87e..b30a46fe7f0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -168,6 +168,9 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { if ( nvKey == null ) { return; // ignore if creating the key using the given binding failed } + if ( nvKey.isBlank() ) { + return; // ignore if the key would be a blank node + } final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); From dcb2059c2cd547b4d3254359946ded50710620b6 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 16:49:32 +0200 Subject: [PATCH 290/323] adds the map version of cdt:get, in this context also changes 'equals' of CDTKey (it must be true only for same terms not for same values) --- .../function/library/collection/GetFct.java | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index 41227a7bb10..ae11240dc47 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -1,10 +1,15 @@ package org.apache.jena.sparql.function.library.collection; import java.util.List; +import java.util.Map; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,9 +20,16 @@ public class GetFct extends FunctionBase2 public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + if ( CompositeDatatypeList.isListLiteral(n1) ) + return getFromList( n1.getLiteral(), nv2 ); + if ( CompositeDatatypeMap.isMapLiteral(n1) ) + return getFromMap( n1.getLiteral(), nv2 ); + + throw new ExprEvalException("Neither a list nor a map literal: " + nv1); + } + + protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -26,7 +38,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CompositeDatatypeList.getValue(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -43,4 +55,31 @@ else if ( value.isNode() ) { } } + protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + final Map map = CompositeDatatypeMap.getValue(n1); + + if ( map.isEmpty() ) + throw new ExprEvalException("empty map"); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + if ( value == null ) { + throw new ExprEvalException("key is not in the map"); + } + else if ( value.isNull() ) { + throw new ExprEvalException("value for key is in null"); + } + else if ( value.isNode() ) { + return NodeValue.makeNode( value.asNode() ); + } + else { + throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); + } + } + } From 8d41d6683f2ff6a6951ee22749e44988e724503e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:21:41 +0200 Subject: [PATCH 291/323] adds support for cdt:containsKey --- .../CollectionLiteralFunctions.java | 6 ++- .../library/collection/ContainsKeyFct.java | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 1e16821a71e..86b9f93d0e7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -6,11 +6,13 @@ public class CollectionLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsKey", ContainsKeyFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java new file mode 100644 index 00000000000..f3a54dbe3c7 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -0,0 +1,42 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class ContainsKeyFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + final Node n2 = nv2.asNode(); + + // If the second argument is not an IRI or a literal, then it cannot be + // a map key in the given map and, by definition of cdt:containsKey, we + // have to return false. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return NodeValue.booleanReturn(false); + + if ( map.isEmpty() ) + return NodeValue.booleanReturn(false); + + final CDTKey key = CDTFactory.createKey(n2); + final CDTValue value = map.get(key); + + return NodeValue.booleanReturn( value != null ); + } + +} From 829f3ea4016d1a290ea3db71176a2319b021a15b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 18:37:56 +0200 Subject: [PATCH 292/323] adds support for cdt:keys --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/KeysFct.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 86b9f93d0e7..36ddc929809 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -11,6 +11,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java new file mode 100644 index 00000000000..a2f4cb7a8c8 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -0,0 +1,40 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase1; + +public class KeysFct extends FunctionBase1 +{ + @Override + public NodeValue exec( final NodeValue nv ) { + final Node n = nv.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a map literal: " + nv); + + final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + + final List list = new ArrayList<>( map.size() ); + for ( final CDTKey key : map.keySet() ) { + final CDTValue value = CDTFactory.createValue( key.asNode() ); + list.add(value); + } + + final LiteralLabel lit = new LiteralLabelForList(list); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From 8d200b4a5bb56f37a4b64917f2bc79d46cfb09a0 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 10 Aug 2023 19:31:07 +0200 Subject: [PATCH 293/323] adds support for cdt:remove --- .../library/collection/RemoveFct.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java new file mode 100644 index 00000000000..fd298d94010 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -0,0 +1,51 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase2; + +public class RemoveFct extends FunctionBase2 +{ + @Override + public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { + final Node n1 = nv1.asNode(); + + if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) + throw new ExprEvalException("Not a map literal: " + nv1); + + final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + + if ( map.isEmpty() ) + return nv1; + + final Node n2 = nv2.asNode(); + + // If the second term is not a map key (and the first term is a well- + // formed cdt:Map literal), the first term needs to be returned as is. + if ( ! n2.isURI() && ! n2.isLiteral() ) + return nv1; + + final CDTKey key = CDTFactory.createKey(n2); + + if ( ! map.containsKey(key) ) + return nv1; + + final Map newMap = new HashMap<>(map); + newMap.remove(key); + + final LiteralLabel lit = new LiteralLabelForMap(newMap); + return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + } + +} From 93cf90ef3f6f59bbf9d1f39ec5cda3e391800147 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:31:56 +0200 Subject: [PATCH 294/323] adds CDTLiteralFunctionUtils --- .../collection/CDTLiteralFunctionUtils.java | 119 ++++++++++++++++++ .../library/collection/ConcatFct.java | 37 ++---- .../library/collection/ContainsFct.java | 10 +- .../library/collection/ContainsKeyFct.java | 9 +- .../library/collection/ContainsTermFct.java | 10 +- .../library/collection/FunctionBase1List.java | 11 +- .../function/library/collection/GetFct.java | 13 +- .../function/library/collection/KeysFct.java | 16 +-- .../function/library/collection/ListFct.java | 8 +- .../library/collection/RemoveFct.java | 15 +-- .../library/collection/ReverseFct.java | 8 +- .../function/library/collection/SizeFct.java | 27 ++-- .../library/collection/SubSeqFct.java | 17 +-- .../function/library/collection/TailFct.java | 8 +- 14 files changed, 155 insertions(+), 153 deletions(-) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java new file mode 100644 index 00000000000..d1d3f90c69e --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java @@ -0,0 +1,119 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.List; +import java.util.Map; + +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; +import org.apache.jena.cdt.LiteralLabelForList; +import org.apache.jena.cdt.LiteralLabelForMap; +import org.apache.jena.datatypes.DatatypeFormatException; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.NodeValue; + +public class CDTLiteralFunctionUtils +{ + /** + * Uses {@link CompositeDatatypeList#isListLiteral(Node)} to check whether + * the given node is a cdt:List literal and throws an exception if not. + */ + public static final void ensureListLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeList.isListLiteral(n) ) + throw new ExprEvalException("Not a cdt:List literal: " + n); + } + + /** + * Uses {@link CompositeDatatypeMap#isMapLiteral(Node)} to check whether + * the given node is a cdt:Map literal and throws an exception if not. + */ + public static final void ensureMapLiteral( final Node n ) throws ExprEvalException { + if ( ! CompositeDatatypeMap.isMapLiteral(n) ) + throw new ExprEvalException("Not a cdt:Map literal: " + n); + } + + /** + * Assumes that the given node is a cdt:List literal and uses + * {@link CompositeDatatypeList#getValue(LiteralLabel)} to get + * the list. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. + */ + public static final List getList( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeList.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:List literal: " + n, ex); + } + } + + /** + * Assumes that the given node is a cdt:Map literal and uses + * {@link CompositeDatatypeMap#getValue(LiteralLabel)} to get + * the map. + * + * Throws an ExprEvalException if a DatatypeFormatException is + * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. + */ + public static final Map getMap( final Node n ) throws ExprEvalException { + try { + return CompositeDatatypeMap.getValue( n.getLiteral() ); + } + catch ( final DatatypeFormatException ex ) { + throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n, ex); + } + } + + /** + * Calls {@link #ensureListLiteral(Node)} first, and {@link #getList(Node)} + * afterwards. + */ + public static final List checkAndGetList( final Node n ) throws ExprEvalException { + ensureListLiteral(n); + return getList(n); + } + + /** + * Calls {@link #ensureMapLiteral(Node)} first, and {@link #getMap(Node)} + * afterwards. + */ + public static final Map checkAndGetMap( final Node n ) throws ExprEvalException { + ensureMapLiteral(n); + return getMap(n); + } + + public static final List checkAndGetList( final NodeValue nv ) throws ExprEvalException { + return checkAndGetList( nv.asNode() ); + } + + public static final Map checkAndGetMap( final NodeValue nv ) throws ExprEvalException { + return checkAndGetMap( nv.asNode() ); + } + + /** + * Creates a {@link NodeValue} with a cdt:List literal that represents the + * given list. + */ + public static final NodeValue createNodeValue( final List list ) { + final LiteralLabel lit = new LiteralLabelForList(list); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + + /** + * Creates a {@link NodeValue} with a cdt:Map literal that represents the + * given map. + */ + public static final NodeValue createNodeValue( final Map map ) { + final LiteralLabel lit = new LiteralLabelForMap(map); + final Node n = NodeFactory.createLiteral(lit); + return NodeValue.makeNode(n); + } + +} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java index 89526d9215d..2867a64ccae 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java @@ -1,16 +1,10 @@ package org.apache.jena.sparql.function.library.collection; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase; @@ -25,42 +19,25 @@ public void checkBuild( final String uri, final ExprList args ) { @Override public NodeValue exec( final List args ) { if ( args.isEmpty() ) { - final List result = new ArrayList<>(); - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + final List result = Collections.emptyList(); + return CDTLiteralFunctionUtils.createNodeValue(result); } if ( args.size() == 1 ) { final NodeValue nv = args.get(0); // make sure that the argument is a well-formed cdt:List literal - getInputList(nv); + CDTLiteralFunctionUtils.checkAndGetList(nv); return nv; } final List result = new ArrayList<>(); for ( final NodeValue nv : args ) { - result.addAll( getInputList(nv) ); + final List l = CDTLiteralFunctionUtils.checkAndGetList(nv); + result.addAll(l); } - final LiteralLabel lit = new LiteralLabelForList(result); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - - protected List getInputList( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a cdt:List literal: " + nv); - - try { - return CompositeDatatypeList.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); - } + return CDTLiteralFunctionUtils.createNodeValue(result); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java index b0a323e2e4c..6784dff603f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -13,12 +10,7 @@ public class ContainsFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsNode( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java index f3a54dbe3c7..6cfcb050dc3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java @@ -5,9 +5,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -15,12 +13,7 @@ public class ContainsKeyFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); final Node n2 = nv2.asNode(); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java index 6951d89992e..3ce25c92108 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; import org.apache.jena.sparql.function.FunctionBase2; @@ -14,12 +11,7 @@ public class ContainsTermFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); - - final List list = CompositeDatatypeList.getValue( n1.getLiteral() ); + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); final boolean result = containsTerm( list, nv2 ); return NodeValue.booleanReturn(result); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java index 99210c10f0d..77491640be0 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java @@ -3,9 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -13,13 +10,7 @@ public abstract class FunctionBase1List extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a list literal: " + nv); - - final List list = CompositeDatatypeList.getValue( n.getLiteral() ); - + final List list = CDTLiteralFunctionUtils.checkAndGetList(nv); return _exec(list, nv); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java index ae11240dc47..7a2a4e48ae6 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java @@ -9,7 +9,6 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -21,15 +20,15 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Node n1 = nv1.asNode(); if ( CompositeDatatypeList.isListLiteral(n1) ) - return getFromList( n1.getLiteral(), nv2 ); + return getFromList(n1, nv2); if ( CompositeDatatypeMap.isMapLiteral(n1) ) - return getFromMap( n1.getLiteral(), nv2 ); + return getFromMap(n1, nv2); throw new ExprEvalException("Neither a list nor a map literal: " + nv1); } - protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromList( final Node n1, final NodeValue nv2 ) { if ( ! nv2.isInteger() ) throw new ExprEvalException("Not an integer literal: " + nv2); @@ -38,7 +37,7 @@ protected NodeValue getFromList( final LiteralLabel n1, final NodeValue nv2 ) { if ( index < 1 ) throw new ExprEvalException("Out of bounds index value: " + nv2); - final List list = CompositeDatatypeList.getValue(n1); + final List list = CDTLiteralFunctionUtils.getList(n1); if ( index > list.size() ) throw new ExprEvalException("Out of bounds index value: " + nv2); @@ -55,12 +54,12 @@ else if ( value.isNode() ) { } } - protected NodeValue getFromMap( final LiteralLabel n1, final NodeValue nv2 ) { + protected NodeValue getFromMap( final Node n1, final NodeValue nv2 ) { final Node n2 = nv2.asNode(); if ( ! n2.isURI() && ! n2.isLiteral() ) throw new ExprEvalException("Not a valid map key: " + nv2); - final Map map = CompositeDatatypeMap.getValue(n1); + final Map map = CDTLiteralFunctionUtils.getMap(n1); if ( map.isEmpty() ) throw new ExprEvalException("empty map"); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java index a2f4cb7a8c8..507c041fa2a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java @@ -7,12 +7,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -20,12 +14,7 @@ public class KeysFct extends FunctionBase1 { @Override public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n) ) - throw new ExprEvalException("Not a map literal: " + nv); - - final Map map = CompositeDatatypeMap.getValue( n.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv); final List list = new ArrayList<>( map.size() ); for ( final CDTKey key : map.keySet() ) { @@ -33,8 +22,7 @@ public NodeValue exec( final NodeValue nv ) { list.add(value); } - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(list); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java index a8820ed567a..d151df0132e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java @@ -5,10 +5,6 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprException; @@ -40,9 +36,7 @@ public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv en list.add(v); } - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(list); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java index fd298d94010..f226ed1163d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java @@ -6,12 +6,7 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase2; @@ -19,12 +14,7 @@ public class RemoveFct extends FunctionBase2 { @Override public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( ! CompositeDatatypeMap.isMapLiteral(n1) ) - throw new ExprEvalException("Not a map literal: " + nv1); - - final Map map = CompositeDatatypeMap.getValue( n1.getLiteral() ); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); if ( map.isEmpty() ) return nv1; @@ -44,8 +34,7 @@ public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { final Map newMap = new HashMap<>(map); newMap.remove(key); - final LiteralLabel lit = new LiteralLabelForMap(newMap); - return NodeValue.makeNode( NodeFactory.createLiteral(lit) ); + return CDTLiteralFunctionUtils.createNodeValue(newMap); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java index e2d2d3fd4ed..ffcb70bd1fa 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java @@ -4,10 +4,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.NodeValue; public class ReverseFct extends FunctionBase1List @@ -25,9 +21,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { } final List reverseList = Arrays.asList(reverseArray); - final LiteralLabel lit = new LiteralLabelForList(reverseList); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(reverseList); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java index 4121ba8db3b..4958369b0f3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java @@ -2,9 +2,7 @@ import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionBase1; @@ -15,26 +13,15 @@ public class SizeFct extends FunctionBase1 public NodeValue exec( final NodeValue nv ) { final Node n = nv.asNode(); - if ( ! n.isLiteral() ) - throw new ExprEvalException("Not a literal: " + nv); - final int size; - try { - final LiteralLabel lit = n.getLiteral(); - final String datatypeURI = n.getLiteralDatatypeURI(); - - if ( datatypeURI.equals(CompositeDatatypeList.uri) ) { - size = CompositeDatatypeList.getValue(lit).size(); - } - else if ( datatypeURI.equals(CompositeDatatypeMap.uri) ) { - size = CompositeDatatypeMap.getValue(lit).size(); - } - else { - throw new ExprEvalException("Literal with wrong datatype: " + datatypeURI); - } + if ( CompositeDatatypeList.isListLiteral(n) ) { + size = CDTLiteralFunctionUtils.getList(n).size(); + } + else if ( CompositeDatatypeMap.isMapLiteral(n) ) { + size = CDTLiteralFunctionUtils.getMap(n).size(); } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Literal with incorrect lexical form: " + nv, ex); + else { + throw new ExprEvalException("Neither a list nor a map literal: " + nv); } return NodeValue.makeInteger(size); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java index d5e8f7b736b..3c0d200eabb 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java @@ -5,11 +5,7 @@ import org.apache.jena.atlas.lib.Lib; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.LiteralLabelForList; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.query.QueryBuildException; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.ExprList; @@ -20,7 +16,7 @@ public class SubSeqFct extends FunctionBase { @Override public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 && args.size() > 3 ) + if ( args.size() < 2 || args.size() > 3 ) throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); } @@ -29,8 +25,7 @@ public NodeValue exec( final List args ) { final NodeValue nv1 = args.get(0); final Node n1 = nv1.asNode(); - if ( ! CompositeDatatypeList.isListLiteral(n1) ) - throw new ExprEvalException("Not a list literal: " + nv1); + CDTLiteralFunctionUtils.ensureListLiteral(n1); final NodeValue nv2 = args.get(1); @@ -55,10 +50,10 @@ public NodeValue exec( final List args ) { if ( length < 0 ) throw new ExprEvalException("Illegal length value: " + nv3); - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); } else { - list = CompositeDatatypeList.getValue( n1.getLiteral() ); + list = CDTLiteralFunctionUtils.getList(n1); length = list.size() - index + 1; } @@ -82,9 +77,7 @@ public NodeValue exec( final List args ) { sublist = list.subList( index - 1, index - 1 + length ); } - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java index a56581d3195..a8c38a88cc1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java @@ -3,10 +3,6 @@ import java.util.List; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.expr.ExprEvalException; import org.apache.jena.sparql.expr.NodeValue; @@ -18,9 +14,7 @@ protected NodeValue _exec( final List list, final NodeValue nvList ) { throw new ExprEvalException("Empty list"); final List sublist = list.subList( 1, list.size() ); - final LiteralLabel lit = new LiteralLabelForList(sublist); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(sublist); } } From f9cd4e97556f9f773f66b2c9723b1457c9dc9932 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:32:48 +0200 Subject: [PATCH 295/323] adds support for cdt:put --- .../CollectionLiteralFunctions.java | 1 + .../function/library/collection/PutFct.java | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java index 36ddc929809..fa97a88d342 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java @@ -13,6 +13,7 @@ public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); + functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java new file mode 100644 index 00000000000..dfb34b5b4ea --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java @@ -0,0 +1,94 @@ +package org.apache.jena.sparql.function.library.collection; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.jena.atlas.lib.Lib; +import org.apache.jena.cdt.CDTFactory; +import org.apache.jena.cdt.CDTKey; +import org.apache.jena.cdt.CDTValue; +import org.apache.jena.graph.Node; +import org.apache.jena.query.QueryBuildException; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.expr.ExprEvalException; +import org.apache.jena.sparql.expr.ExprException; +import org.apache.jena.sparql.expr.ExprList; +import org.apache.jena.sparql.expr.NodeValue; +import org.apache.jena.sparql.function.FunctionBase; +import org.apache.jena.sparql.function.FunctionEnv; + +public class PutFct extends FunctionBase +{ + @Override + public void checkBuild( final String uri, final ExprList args ) { + if ( args.size() < 2 || args.size() > 3 ) + throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); + } + + @Override + public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { + if ( args.size() < 2 || args.size() > 3 ) + throw new ExprException("wrong number of arguments (" + args.size() + "), must be 2 or 3"); + + // check the second argument first because that's less expensive + final NodeValue nv2 = args.get(1).eval(binding, env); + final Node n2 = nv2.asNode(); + if ( ! n2.isURI() && ! n2.isLiteral() ) + throw new ExprEvalException("Not a valid map key: " + nv2); + + // now check the first argument + final NodeValue nv1 = args.get(0).eval(binding, env); + final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); + + final CDTKey key = CDTFactory.createKey(n2); + + // produce a map value from the third argument (if any) + final CDTValue newValue; + if ( args.size() == 2 ) { + newValue = CDTFactory.getNullValue(); + } + else { // in this case, we have that args.size() == 3 + NodeValue nv3 = null; + try { + nv3 = args.get(2).eval(binding, env); + } + catch ( final ExprException ex ) { + // nothing to do here + } + + if ( nv3 != null ) { + newValue = CDTFactory.createValue( nv3.asNode() ); + } + else { + newValue = CDTFactory.getNullValue(); + } + } + + // check if the given map already contains the exact same map entry + // if so, simply return the given cdt:Map literal + final CDTValue oldValue = map.get(key); + if ( oldValue != null ) { + if ( oldValue.isNull() && newValue.isNull() ) + return nv1; + + if ( ! oldValue.isNull() && ! newValue.isNull() ) { + final Node on = oldValue.asNode(); + final Node nn = newValue.asNode(); + if ( on.equals(nn) ) + return nv1; + } + } + + final Map newMap = new HashMap<>(map); + newMap.put(key, newValue); + + return CDTLiteralFunctionUtils.createNodeValue(newMap); + } + + @Override + public NodeValue exec( final List args ) { + throw new IllegalStateException("should never end up here"); + } + +} From cf7751737c4059b144bc3a758d676a50f2f1f2e1 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:34:57 +0200 Subject: [PATCH 296/323] renames CollectionLiteralFunctions to CDTLiteralFunctions --- ...CollectionLiteralFunctions.java => CDTLiteralFunctions.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/{CollectionLiteralFunctions.java => CDTLiteralFunctions.java} (97%) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java similarity index 97% rename from jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java rename to jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java index fa97a88d342..b388733831c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CollectionLiteralFunctions.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java @@ -3,7 +3,7 @@ import org.apache.jena.sparql.ARQConstants; import org.apache.jena.sparql.function.FunctionRegistry; -public class CollectionLiteralFunctions { +public class CDTLiteralFunctions { public static void register( final FunctionRegistry functionRegistry ) { functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); From ad6dae56083f59d0bee9855da9ed45896ee6a1dc Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 11 Aug 2023 16:36:46 +0200 Subject: [PATCH 297/323] renames 'org.apache.jena.sparql.function.library.collections' package to 'org.apache.jena.sparql.function.library.cdt' --- .../collection/CDTLiteralFunctionUtils.java | 119 ------------------ .../collection/CDTLiteralFunctions.java | 23 ---- .../library/collection/ConcatFct.java | 43 ------- .../library/collection/ContainsFct.java | 34 ----- .../library/collection/ContainsKeyFct.java | 35 ------ .../library/collection/ContainsTermFct.java | 34 ----- .../library/collection/FunctionBase1List.java | 18 --- .../function/library/collection/GetFct.java | 84 ------------- .../function/library/collection/HeadFct.java | 28 ----- .../function/library/collection/KeysFct.java | 28 ----- .../function/library/collection/ListFct.java | 47 ------- .../function/library/collection/PutFct.java | 94 -------------- .../library/collection/RemoveFct.java | 40 ------ .../library/collection/ReverseFct.java | 27 ---- .../function/library/collection/SizeFct.java | 30 ----- .../library/collection/SubSeqFct.java | 83 ------------ .../function/library/collection/TailFct.java | 20 --- 17 files changed, 787 deletions(-) delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java deleted file mode 100644 index d1d3f90c69e..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctionUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; -import java.util.Map; - -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.NodeValue; - -public class CDTLiteralFunctionUtils -{ - /** - * Uses {@link CompositeDatatypeList#isListLiteral(Node)} to check whether - * the given node is a cdt:List literal and throws an exception if not. - */ - public static final void ensureListLiteral( final Node n ) throws ExprEvalException { - if ( ! CompositeDatatypeList.isListLiteral(n) ) - throw new ExprEvalException("Not a cdt:List literal: " + n); - } - - /** - * Uses {@link CompositeDatatypeMap#isMapLiteral(Node)} to check whether - * the given node is a cdt:Map literal and throws an exception if not. - */ - public static final void ensureMapLiteral( final Node n ) throws ExprEvalException { - if ( ! CompositeDatatypeMap.isMapLiteral(n) ) - throw new ExprEvalException("Not a cdt:Map literal: " + n); - } - - /** - * Assumes that the given node is a cdt:List literal and uses - * {@link CompositeDatatypeList#getValue(LiteralLabel)} to get - * the list. - * - * Throws an ExprEvalException if a DatatypeFormatException is - * thrown by {@link CompositeDatatypeList#getValue(LiteralLabel)}. - */ - public static final List getList( final Node n ) throws ExprEvalException { - try { - return CompositeDatatypeList.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Not a well-formed cdt:List literal: " + n, ex); - } - } - - /** - * Assumes that the given node is a cdt:Map literal and uses - * {@link CompositeDatatypeMap#getValue(LiteralLabel)} to get - * the map. - * - * Throws an ExprEvalException if a DatatypeFormatException is - * thrown by {@link CompositeDatatypeMap#getValue(LiteralLabel)}. - */ - public static final Map getMap( final Node n ) throws ExprEvalException { - try { - return CompositeDatatypeMap.getValue( n.getLiteral() ); - } - catch ( final DatatypeFormatException ex ) { - throw new ExprEvalException("Not a well-formed cdt:Map literal: " + n, ex); - } - } - - /** - * Calls {@link #ensureListLiteral(Node)} first, and {@link #getList(Node)} - * afterwards. - */ - public static final List checkAndGetList( final Node n ) throws ExprEvalException { - ensureListLiteral(n); - return getList(n); - } - - /** - * Calls {@link #ensureMapLiteral(Node)} first, and {@link #getMap(Node)} - * afterwards. - */ - public static final Map checkAndGetMap( final Node n ) throws ExprEvalException { - ensureMapLiteral(n); - return getMap(n); - } - - public static final List checkAndGetList( final NodeValue nv ) throws ExprEvalException { - return checkAndGetList( nv.asNode() ); - } - - public static final Map checkAndGetMap( final NodeValue nv ) throws ExprEvalException { - return checkAndGetMap( nv.asNode() ); - } - - /** - * Creates a {@link NodeValue} with a cdt:List literal that represents the - * given list. - */ - public static final NodeValue createNodeValue( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - - /** - * Creates a {@link NodeValue} with a cdt:Map literal that represents the - * given map. - */ - public static final NodeValue createNodeValue( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java deleted file mode 100644 index b388733831c..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/CDTLiteralFunctions.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import org.apache.jena.sparql.ARQConstants; -import org.apache.jena.sparql.function.FunctionRegistry; - -public class CDTLiteralFunctions { - public static void register( final FunctionRegistry functionRegistry ) { - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "concat", ConcatFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "contains", ContainsFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsKey", ContainsKeyFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "containsTerm", ContainsTermFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "get", GetFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "head", HeadFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "keys", KeysFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "List", ListFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "put", PutFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "remove", RemoveFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "reverse", ReverseFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "size", SizeFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "subseq", SubSeqFct.class ); - functionRegistry.put( ARQConstants.CDTFunctionLibraryURI + "tail", TailFct.class ); - } -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java deleted file mode 100644 index 2867a64ccae..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ConcatFct.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase; - -public class ConcatFct extends FunctionBase -{ - @Override - public void checkBuild( final String uri, final ExprList args ) { - // nothing to check - } - - @Override - public NodeValue exec( final List args ) { - if ( args.isEmpty() ) { - final List result = Collections.emptyList(); - return CDTLiteralFunctionUtils.createNodeValue(result); - } - - if ( args.size() == 1 ) { - final NodeValue nv = args.get(0); - // make sure that the argument is a well-formed cdt:List literal - CDTLiteralFunctionUtils.checkAndGetList(nv); - - return nv; - } - - final List result = new ArrayList<>(); - for ( final NodeValue nv : args ) { - final List l = CDTLiteralFunctionUtils.checkAndGetList(nv); - result.addAll(l); - } - - return CDTLiteralFunctionUtils.createNodeValue(result); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java deleted file mode 100644 index 6784dff603f..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsFct.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; - -public class ContainsFct extends FunctionBase2 -{ - @Override - public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); - final boolean result = containsNode( list, nv2 ); - return NodeValue.booleanReturn(result); - } - - /** - * Returns true if the given list contains the given RDF term. - */ - protected boolean containsNode( final List list, final NodeValue nv ) { - for ( final CDTValue v : list ) { - if ( v.isNode() ) { - final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv, nv) ) { - return true; - } - } - } - - return false; - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java deleted file mode 100644 index 6cfcb050dc3..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsKeyFct.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.Map; - -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; - -public class ContainsKeyFct extends FunctionBase2 -{ - @Override - public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); - - final Node n2 = nv2.asNode(); - - // If the second argument is not an IRI or a literal, then it cannot be - // a map key in the given map and, by definition of cdt:containsKey, we - // have to return false. - if ( ! n2.isURI() && ! n2.isLiteral() ) - return NodeValue.booleanReturn(false); - - if ( map.isEmpty() ) - return NodeValue.booleanReturn(false); - - final CDTKey key = CDTFactory.createKey(n2); - final CDTValue value = map.get(key); - - return NodeValue.booleanReturn( value != null ); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java deleted file mode 100644 index 3ce25c92108..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ContainsTermFct.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; -import org.apache.jena.sparql.function.FunctionBase2; - -public class ContainsTermFct extends FunctionBase2 -{ - @Override - public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final List list = CDTLiteralFunctionUtils.checkAndGetList(nv1); - final boolean result = containsTerm( list, nv2 ); - return NodeValue.booleanReturn(result); - } - - /** - * Returns true if the given list contains the given RDF term. - */ - protected boolean containsTerm( final List list, final NodeValue nv ) { - for ( final CDTValue v : list ) { - if ( v.isNode() ) { - if ( NodeFunctions.sameTerm(v.asNode(), nv.asNode()) ) { - return true; - } - } - } - - return false; - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java deleted file mode 100644 index 77491640be0..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/FunctionBase1List.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; - -public abstract class FunctionBase1List extends FunctionBase1 -{ - @Override - public NodeValue exec( final NodeValue nv ) { - final List list = CDTLiteralFunctionUtils.checkAndGetList(nv); - return _exec(list, nv); - } - - protected abstract NodeValue _exec( List list, NodeValue nvList ); -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java deleted file mode 100644 index 7a2a4e48ae6..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/GetFct.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; -import java.util.Map; - -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; - -public class GetFct extends FunctionBase2 -{ - @Override - public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Node n1 = nv1.asNode(); - - if ( CompositeDatatypeList.isListLiteral(n1) ) - return getFromList(n1, nv2); - - if ( CompositeDatatypeMap.isMapLiteral(n1) ) - return getFromMap(n1, nv2); - - throw new ExprEvalException("Neither a list nor a map literal: " + nv1); - } - - protected NodeValue getFromList( final Node n1, final NodeValue nv2 ) { - if ( ! nv2.isInteger() ) - throw new ExprEvalException("Not an integer literal: " + nv2); - - final int index = nv2.getInteger().intValue(); - - if ( index < 1 ) - throw new ExprEvalException("Out of bounds index value: " + nv2); - - final List list = CDTLiteralFunctionUtils.getList(n1); - - if ( index > list.size() ) - throw new ExprEvalException("Out of bounds index value: " + nv2); - - final CDTValue value = list.get( index-1 ); - if ( value.isNull() ) { - throw new ExprEvalException("accessing null value from list" ); - } - else if ( value.isNode() ) { - return NodeValue.makeNode( value.asNode() ); - } - else { - throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); - } - } - - protected NodeValue getFromMap( final Node n1, final NodeValue nv2 ) { - final Node n2 = nv2.asNode(); - if ( ! n2.isURI() && ! n2.isLiteral() ) - throw new ExprEvalException("Not a valid map key: " + nv2); - - final Map map = CDTLiteralFunctionUtils.getMap(n1); - - if ( map.isEmpty() ) - throw new ExprEvalException("empty map"); - - final CDTKey key = CDTFactory.createKey(n2); - final CDTValue value = map.get(key); - - if ( value == null ) { - throw new ExprEvalException("key is not in the map"); - } - else if ( value.isNull() ) { - throw new ExprEvalException("value for key is in null"); - } - else if ( value.isNode() ) { - return NodeValue.makeNode( value.asNode() ); - } - else { - throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); - } - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java deleted file mode 100644 index aebd5f39611..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/HeadFct.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.NodeValue; - -public class HeadFct extends FunctionBase1List -{ - @Override - protected NodeValue _exec( final List list, final NodeValue nvList ) { - if ( list.size() == 0 ) - throw new ExprEvalException("Empty list"); - - final CDTValue value = list.get(0); - if ( value.isNull() ) { - throw new ExprEvalException("accessing null value from list" ); - } - else if ( value.isNode() ) { - return NodeValue.makeNode( value.asNode() ); - } - else { - throw new ExprEvalException("Unexpected type of CDTValue: " + value.getClass().getName() ); - } - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java deleted file mode 100644 index 507c041fa2a..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/KeysFct.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; - -public class KeysFct extends FunctionBase1 -{ - @Override - public NodeValue exec( final NodeValue nv ) { - final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv); - - final List list = new ArrayList<>( map.size() ); - for ( final CDTKey key : map.keySet() ) { - final CDTValue value = CDTFactory.createValue( key.asNode() ); - list.add(value); - } - - return CDTLiteralFunctionUtils.createNodeValue(list); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java deleted file mode 100644 index d151df0132e..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ListFct.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.expr.Expr; -import org.apache.jena.sparql.expr.ExprException; -import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase; -import org.apache.jena.sparql.function.FunctionEnv; - -public class ListFct extends FunctionBase -{ - @Override - public void checkBuild( final String uri, final ExprList args ) { - // nothing to do here - } - - @Override - public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { - final List list = new ArrayList<>( args.size() ); - - for ( final Expr e : args ) { - CDTValue v; - try { - final NodeValue nv = e.eval(binding, env); - v = CDTFactory.createValue( nv.asNode() ); - } catch ( final ExprException ex ) { - v = CDTFactory.getNullValue(); - } - - list.add(v); - } - - return CDTLiteralFunctionUtils.createNodeValue(list); - } - - @Override - public NodeValue exec( final List args ) { - throw new IllegalStateException("should never end up here"); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java deleted file mode 100644 index dfb34b5b4ea..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/PutFct.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.jena.atlas.lib.Lib; -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.graph.Node; -import org.apache.jena.query.QueryBuildException; -import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.ExprException; -import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase; -import org.apache.jena.sparql.function.FunctionEnv; - -public class PutFct extends FunctionBase -{ - @Override - public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 || args.size() > 3 ) - throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); - } - - @Override - public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) { - if ( args.size() < 2 || args.size() > 3 ) - throw new ExprException("wrong number of arguments (" + args.size() + "), must be 2 or 3"); - - // check the second argument first because that's less expensive - final NodeValue nv2 = args.get(1).eval(binding, env); - final Node n2 = nv2.asNode(); - if ( ! n2.isURI() && ! n2.isLiteral() ) - throw new ExprEvalException("Not a valid map key: " + nv2); - - // now check the first argument - final NodeValue nv1 = args.get(0).eval(binding, env); - final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); - - final CDTKey key = CDTFactory.createKey(n2); - - // produce a map value from the third argument (if any) - final CDTValue newValue; - if ( args.size() == 2 ) { - newValue = CDTFactory.getNullValue(); - } - else { // in this case, we have that args.size() == 3 - NodeValue nv3 = null; - try { - nv3 = args.get(2).eval(binding, env); - } - catch ( final ExprException ex ) { - // nothing to do here - } - - if ( nv3 != null ) { - newValue = CDTFactory.createValue( nv3.asNode() ); - } - else { - newValue = CDTFactory.getNullValue(); - } - } - - // check if the given map already contains the exact same map entry - // if so, simply return the given cdt:Map literal - final CDTValue oldValue = map.get(key); - if ( oldValue != null ) { - if ( oldValue.isNull() && newValue.isNull() ) - return nv1; - - if ( ! oldValue.isNull() && ! newValue.isNull() ) { - final Node on = oldValue.asNode(); - final Node nn = newValue.asNode(); - if ( on.equals(nn) ) - return nv1; - } - } - - final Map newMap = new HashMap<>(map); - newMap.put(key, newValue); - - return CDTLiteralFunctionUtils.createNodeValue(newMap); - } - - @Override - public NodeValue exec( final List args ) { - throw new IllegalStateException("should never end up here"); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java deleted file mode 100644 index f226ed1163d..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/RemoveFct.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase2; - -public class RemoveFct extends FunctionBase2 -{ - @Override - public NodeValue exec( final NodeValue nv1, final NodeValue nv2 ) { - final Map map = CDTLiteralFunctionUtils.checkAndGetMap(nv1); - - if ( map.isEmpty() ) - return nv1; - - final Node n2 = nv2.asNode(); - - // If the second term is not a map key (and the first term is a well- - // formed cdt:Map literal), the first term needs to be returned as is. - if ( ! n2.isURI() && ! n2.isLiteral() ) - return nv1; - - final CDTKey key = CDTFactory.createKey(n2); - - if ( ! map.containsKey(key) ) - return nv1; - - final Map newMap = new HashMap<>(map); - newMap.remove(key); - - return CDTLiteralFunctionUtils.createNodeValue(newMap); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java deleted file mode 100644 index ffcb70bd1fa..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/ReverseFct.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.Arrays; -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.NodeValue; - -public class ReverseFct extends FunctionBase1List -{ - @Override - protected NodeValue _exec( final List list, final NodeValue nvList ) { - if ( list.size() < 2 ) - return nvList; - - final CDTValue[] reverseArray = new CDTValue[ list.size() ]; - int i = list.size() - 1; - for ( final CDTValue v : list ) { - reverseArray[i] = v; - i--; - } - - final List reverseList = Arrays.asList(reverseArray); - return CDTLiteralFunctionUtils.createNodeValue(reverseList); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java deleted file mode 100644 index 4958369b0f3..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SizeFct.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import org.apache.jena.cdt.CompositeDatatypeList; -import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase1; - -public class SizeFct extends FunctionBase1 -{ - @Override - public NodeValue exec( final NodeValue nv ) { - final Node n = nv.asNode(); - - final int size; - if ( CompositeDatatypeList.isListLiteral(n) ) { - size = CDTLiteralFunctionUtils.getList(n).size(); - } - else if ( CompositeDatatypeMap.isMapLiteral(n) ) { - size = CDTLiteralFunctionUtils.getMap(n).size(); - } - else { - throw new ExprEvalException("Neither a list nor a map literal: " + nv); - } - - return NodeValue.makeInteger(size); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java deleted file mode 100644 index 3c0d200eabb..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/SubSeqFct.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.Collections; -import java.util.List; - -import org.apache.jena.atlas.lib.Lib; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.graph.Node; -import org.apache.jena.query.QueryBuildException; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionBase; - -public class SubSeqFct extends FunctionBase -{ - @Override - public void checkBuild( final String uri, final ExprList args ) { - if ( args.size() < 2 || args.size() > 3 ) - throw new QueryBuildException("Function '"+Lib.className(this)+"' takes two or three arguments"); - } - - @Override - public NodeValue exec( final List args ) { - final NodeValue nv1 = args.get(0); - final Node n1 = nv1.asNode(); - - CDTLiteralFunctionUtils.ensureListLiteral(n1); - - final NodeValue nv2 = args.get(1); - - if ( ! nv2.isInteger() ) - throw new ExprEvalException("Not an integer literal: " + nv2); - - final int index = nv2.getInteger().intValue(); - - if ( index < 1 ) - throw new ExprEvalException("Out of bounds index value: " + nv2); - - final int length; - final List list; - if ( args.size() == 3 ) { - final NodeValue nv3 = args.get(2); - - if ( ! nv3.isInteger() ) - throw new ExprEvalException("Not an integer literal: " + nv3); - - length = nv3.getInteger().intValue(); - - if ( length < 0 ) - throw new ExprEvalException("Illegal length value: " + nv3); - - list = CDTLiteralFunctionUtils.getList(n1); - } - else { - list = CDTLiteralFunctionUtils.getList(n1); - length = list.size() - index + 1; - } - - if ( index > list.size() + 1 ) - throw new ExprEvalException("Out of bounds index value: " + nv2); - - if ( index + length > list.size() + 1 ) - throw new ExprEvalException("Beyond list length (index: " + index + ", length: " + length + ")"); - - final List sublist; - if ( index == list.size() + 1 ) { - if ( length != 0 ) - throw new ExprEvalException("Illegal arguments (index: " + index + ", length: " + length + ")"); - - if ( list.isEmpty() ) - return nv1; - - sublist = Collections.emptyList(); - } - else { - sublist = list.subList( index - 1, index - 1 + length ); - } - - return CDTLiteralFunctionUtils.createNodeValue(sublist); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java deleted file mode 100644 index a8c38a88cc1..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/collection/TailFct.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.apache.jena.sparql.function.library.collection; - -import java.util.List; - -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.sparql.expr.ExprEvalException; -import org.apache.jena.sparql.expr.NodeValue; - -public class TailFct extends FunctionBase1List -{ - @Override - protected NodeValue _exec( final List list, final NodeValue nvList ) { - if ( list.size() == 0 ) - throw new ExprEvalException("Empty list"); - - final List sublist = list.subList( 1, list.size() ); - return CDTLiteralFunctionUtils.createNodeValue(sublist); - } - -} From 05db05efba5118a089d8ad3f2c9a3ef3d03451a9 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 14 Sep 2023 17:32:00 +0200 Subject: [PATCH 298/323] changes the implementation of LiteralLabelForCDTs to use the corresponding CompositeDatatypeBase implementation more directly --- .../java/org/apache/jena/cdt/LiteralLabelForCDTs.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java index 3b66ce02eb7..d620e491c2d 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java @@ -77,6 +77,14 @@ public String getDatatypeURI() { return getDatatype().getURI(); } + @Override + public abstract CompositeDatatypeBase getDatatype(); + + @Override + public String getDatatypeURI() { + return getDatatype().getURI(); + } + @Override public boolean isXML() { return false; From 46b7cc11004f5ef300d292421cc13d9d80f38b52 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 15 Sep 2023 09:52:19 +0200 Subject: [PATCH 299/323] some clean up in CompositeDatatypeList and in CompositeDatatypeMap --- .../jena/cdt/CompositeDatatypeList.java | 77 +++++++++++++---- .../apache/jena/cdt/CompositeDatatypeMap.java | 86 +++++++++++++++++++ 2 files changed, 148 insertions(+), 15 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 2b9f921ce0d..108d066b1c3 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -83,23 +83,70 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } - /** - * Returns true if the given node is a literal with {@link #uri} - * as its datatype URI. Notice that this does not mean that this - * literal is actually valid; for checking validity, use - * {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final Node n ) { - return n.isLiteral() && n.getLiteralDatatypeURI().equals(uri); + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } } - /** - * Returns true if the datatype URI of the given {@link LiteralLabel} is - * {@link #uri}. Notice that this does not mean that this LiteralLabel is - * actually valid; for checking validity, use {@link #isValidLiteral(LiteralLabel)}. - */ - public static boolean isListLiteral( final LiteralLabel lit ) { - return lit.getDatatypeURI().equals(uri); + @Override + public List parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof List) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final List list = (List) value; + + return unparseValue(list); + } + + @Override + public String unparseValue( final List list ) { + final StringBuilder sb = new StringBuilder(); + sb.append("["); + if ( ! list.isEmpty() ) { + final Iterator it = list.iterator(); + final CDTValue firstElmt = it.next(); + final String firstElmtAsString = unparseListElement(firstElmt); + sb.append(firstElmtAsString); + while ( it.hasNext() ) { + final CDTValue nextElmt = it.next(); + final String nextElmtAsString = unparseListElement(nextElmt); + sb.append(", "); + sb.append(nextElmtAsString); + } + } + sb.append("]"); + return sb.toString(); + } + + protected String unparseListElement( final CDTValue elmt ) { + return elmt.asLexicalForm(); + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); } @Override diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 10401f49708..8b283e3174f 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -89,6 +89,88 @@ public boolean isValidLiteral( final LiteralLabel lit ) { return isValid(lex); } + @Override + public boolean isValid( final String lexicalForm ) { + try { + // 'recursive ' must be false here because the validity check + // is only for the literal with the given lexical form and not + // for any possible CDT literals inside it + ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + return true; + } + catch ( final Exception ex ) { + return false; + } + } + + @Override + public Map parse( final String lexicalForm ) throws DatatypeFormatException { + final boolean recursive = false; + try { + return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + } + catch ( final Exception ex ) { + throw new DatatypeFormatException(lexicalForm, type, ex); + } + } + + @Override + public String unparse( final Object value ) { + if ( !(value instanceof Map) ) { + throw new IllegalArgumentException(); + } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + + return unparseValue(map); + } + + @Override + public String unparseValue( final Map map ) { + final StringBuilder sb = new StringBuilder(); + sb.append("{"); + if ( ! map.isEmpty() ) { + final Iterator> it = map.entrySet().iterator(); + + final Map.Entry firstEntry = it.next(); + unparseMapEntry(firstEntry, sb); + + while ( it.hasNext() ) { + sb.append(", "); + + final Map.Entry nextEntry = it.next(); + unparseMapEntry(nextEntry, sb); + } + } + + sb.append("}"); + return sb.toString(); + } + + protected void unparseMapEntry( final Map.Entry entry, final StringBuilder sb ) { + sb.append( entry.getKey().asLexicalForm() ); + sb.append(" : "); + sb.append( entry.getValue().asLexicalForm() ); + } + + @Override + public int getHashCode( final LiteralLabel lit ) { + return lit.getDefaultHashcode(); + } + + @Override + public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { + if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { + return false; + } + + final Map map1 = getValue(value1); + final Map map2 = getValue(value2); + + return map1.equals(map2); + } + /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this @@ -440,6 +522,10 @@ else if ( n2.isURI() ) { final String lang2 = n2.getLiteralLanguage(); return lang1.compareTo(lang2); } + + @SuppressWarnings("unchecked") + final Map map = (Map) value; + return map; } } From b7b2c7c8d4945e56c7f4b4d3ad18b88fb4e76bff Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 18 Sep 2023 10:54:46 +0200 Subject: [PATCH 300/323] fixes implementation of 'map-equal' --- .../apache/jena/cdt/CompositeDatatypeMap.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 8b283e3174f..3fb6cb7637c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -160,15 +160,36 @@ public int getHashCode( final LiteralLabel lit ) { } @Override - public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { - if ( ! isMapLiteral(value1) || ! isMapLiteral(value2) ) { + public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { + if ( ! isMapLiteral(lit1) || ! isMapLiteral(lit2) ) { return false; } - final Map map1 = getValue(value1); - final Map map2 = getValue(value2); + final Map map1 = getValue(lit1); + final Map map2 = getValue(lit2); + + if ( map1.size() != map2.size() ) return false; + + for ( final Map.Entry entry1 : map1.entrySet() ) { + final CDTValue v1 = entry1.getValue(); + final CDTValue v2 = map2.get( entry1.getKey() ); + if ( v2 == null ) return false; + + if ( v1.isNull() || v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared"); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - return map1.equals(map2); + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } + + if ( ! n1.sameValueAs(n2) ) return false; + } + + return true; } /** From fa36dcf65ef65c0a8a8c8c5ab9466b639a6ed4ca Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 11:26:24 +0200 Subject: [PATCH 301/323] extends SPARQL parser to recognize ORDER BY for FOLD --- .../sparql/lang/sparql_11/JavaCharStream.java | 98 +++++++++++++++++++ .../sparql_11/SPARQLParser11TokenManager.java | 6 -- 2 files changed, 98 insertions(+), 6 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java index 69a6e501578..527e07aef71 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java @@ -64,8 +64,13 @@ static final int hexval(char c) throws java.io.IOException { throw new java.io.IOException(); // Should never come here } +<<<<<<< HEAD /* Position in buffer. */ +======= +/** Position in buffer. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int bufpos = -1; int bufsize; @@ -89,11 +94,16 @@ static final int hexval(char c) throws java.io.IOException { protected int inBuf = 0; protected int tabSize = 8; +<<<<<<< HEAD @SuppressWarnings("all") public void setTabSize(int i) { tabSize = i; } @SuppressWarnings("all") public int getTabSize() { return tabSize; } +======= + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) protected void ExpandBuff(boolean wrapAround) { @@ -182,8 +192,13 @@ protected char ReadByte() throws java.io.IOException return nextCharBuf[nextCharInd]; } +<<<<<<< HEAD /* @return starting character for token. */ +======= +/** @return starting character for token. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char BeginToken() throws java.io.IOException { @@ -264,8 +279,13 @@ else if (prevCharIsCR) bufcolumn[bufpos] = column; } +<<<<<<< HEAD /* Read a character. */ +======= +/** Read a character. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char readChar() throws java.io.IOException { @@ -365,8 +385,12 @@ public char readChar() throws java.io.IOException * @deprecated * @see #getEndColumn */ +<<<<<<< HEAD @Deprecated +======= + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getColumn() { return bufcolumn[bufpos]; @@ -377,36 +401,53 @@ public int getColumn() { * @deprecated * @see #getEndLine */ +<<<<<<< HEAD @Deprecated +======= + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getLine() { return bufline[bufpos]; } +<<<<<<< HEAD /** Get end column. * @return the end column or -1 */ +======= +/** Get end column. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getEndColumn() { return bufcolumn[bufpos]; } +<<<<<<< HEAD /** Get end line. * @return the end line number or -1 */ +======= +/** Get end line. */ + +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getEndLine() { return bufline[bufpos]; } +<<<<<<< HEAD <<<<<<< HEAD /** Get the beginning column. * @return column of token start */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** @return column of token start */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -432,6 +473,7 @@ public void backup(int amount) { bufpos += bufsize; } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -441,6 +483,8 @@ public void backup(int amount) { */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -459,6 +503,7 @@ public JavaCharStream(java.io.Reader dstream, nextCharBuf = new char[4096]; } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -467,6 +512,8 @@ public JavaCharStream(java.io.Reader dstream, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -477,12 +524,15 @@ public JavaCharStream(java.io.Reader dstream, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -492,9 +542,12 @@ public JavaCharStream(java.io.Reader dstream) this(dstream, 1, 1, 4096); } <<<<<<< HEAD +<<<<<<< HEAD /* Reinitialise. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -519,10 +572,13 @@ public void ReInit(java.io.Reader dstream, nextCharInd = bufpos = -1; } +<<<<<<< HEAD <<<<<<< HEAD /* Reinitialise. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -533,10 +589,13 @@ public void ReInit(java.io.Reader dstream, ReInit(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /* Reinitialise. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -554,6 +613,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -563,6 +623,8 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -573,6 +635,7 @@ public JavaCharStream(java.io.InputStream dstream, int startline, this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -583,6 +646,8 @@ public JavaCharStream(java.io.InputStream dstream, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -593,6 +658,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(dstream, encoding, startline, startcolumn, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -601,6 +667,8 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -611,6 +679,7 @@ public JavaCharStream(java.io.InputStream dstream, int startline, this(dstream, startline, startcolumn, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. @@ -619,6 +688,8 @@ public JavaCharStream(java.io.InputStream dstream, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -628,12 +699,15 @@ public JavaCharStream(java.io.InputStream dstream, String encoding) throws java. this(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Constructor. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -643,6 +717,7 @@ public JavaCharStream(java.io.InputStream dstream) this(dstream, 1, 1, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. @@ -653,6 +728,8 @@ public JavaCharStream(java.io.InputStream dstream) */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -663,6 +740,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } +<<<<<<< HEAD <<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. @@ -672,6 +750,8 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -682,6 +762,7 @@ public void ReInit(java.io.InputStream dstream, int startline, ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } <<<<<<< HEAD +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -691,6 +772,8 @@ public void ReInit(java.io.InputStream dstream, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -701,6 +784,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, ReInit(dstream, encoding, startline, startcolumn, 4096); } <<<<<<< HEAD +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -708,6 +792,8 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -718,6 +804,7 @@ public void ReInit(java.io.InputStream dstream, int startline, ReInit(dstream, startline, startcolumn, 4096); } <<<<<<< HEAD +<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -725,6 +812,8 @@ public void ReInit(java.io.InputStream dstream, int startline, */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -734,12 +823,15 @@ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io. ReInit(dstream, encoding, 1, 1, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** Reinitialise. */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -749,11 +841,14 @@ public void ReInit(java.io.InputStream dstream) ReInit(dstream, 1, 1, 4096); } +<<<<<<< HEAD <<<<<<< HEAD /** Get the token timage. * @return token image as String */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** @return token image as String */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @@ -767,12 +862,15 @@ public String GetImage() new String(buffer, 0, bufpos + 1); } +<<<<<<< HEAD <<<<<<< HEAD /** Get the suffix as an array of characters. * @param len the length of the array to return. * @return suffix */ ======= +======= +>>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) /** @return suffix */ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11TokenManager.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11TokenManager.java index f72c0f276ca..91fcfc52fbd 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11TokenManager.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11TokenManager.java @@ -3948,7 +3948,6 @@ else if (jjmatchedPos == strPos && jjmatchedKind > strKind) return toRet; } -<<<<<<< HEAD /** Token literal values. */ public static final String[] jjstrLiteralImages = { @@ -3991,8 +3990,6 @@ protected Token jjFillToken() return t; } -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) static final int[] jjnextStates = { 192, 193, 194, 196, 197, 202, 203, 233, 234, 235, 237, 242, 212, 213, 214, 216, 221, 142, 153, 155, 120, 123, 124, 6, 7, 17, 1, 2, 4, 66, 67, 68, @@ -4278,7 +4275,6 @@ private void jjCheckNAddStates(int start, int end) } while (start++ != end); } -<<<<<<< HEAD /** Constructor. */ public SPARQLParser11TokenManager(JavaCharStream stream){ @@ -4372,6 +4368,4 @@ public void SwitchTo(int lexState) private int jjimageLen; private int lengthOfMatch; protected int curChar; -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) } From 2a8c6468e7e9fe8bf08408cc309ebd47cd32799f Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 12:58:05 +0200 Subject: [PATCH 302/323] support for DISTINCT in FOLD --- .../jena/sparql/expr/aggregate/AggFold.java | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java index b30a46fe7f0..f25ce45c63a 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java @@ -11,16 +11,14 @@ import org.apache.jena.cdt.CDTFactory; import org.apache.jena.cdt.CDTKey; import org.apache.jena.cdt.CDTValue; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.graph.Node; -import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.expr.Expr; import org.apache.jena.sparql.expr.ExprLib; import org.apache.jena.sparql.expr.ExprList; import org.apache.jena.sparql.expr.NodeValue; import org.apache.jena.sparql.function.FunctionEnv; +import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; import org.apache.jena.sparql.serializer.SerializationContext; import org.apache.jena.sparql.sse.writers.WriterExpr; import org.apache.jena.sparql.util.ExprUtils; @@ -30,12 +28,12 @@ public class AggFold extends AggregatorBase protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - public AggFold( final Expr expr1 ) { - this(expr1, null); + public AggFold( final boolean isDistinct, final Expr expr1 ) { + this(isDistinct, expr1, null); } - public AggFold( final Expr expr1, final Expr expr2 ) { - super( "FOLD", false, createExprList(expr1, expr2) ); + public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { + super( "FOLD", isDistinct, createExprList(expr1, expr2) ); this.expr1 = expr1; this.expr2 = expr2; @@ -63,7 +61,7 @@ public Aggregator copy( final ExprList exprs ) { final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - return new AggFold(_expr1, _expr2); + return new AggFold(isDistinct, _expr1, _expr2); } @Override @@ -79,7 +77,7 @@ public boolean equals( final Aggregator other, final boolean bySyntax ) { @Override public Accumulator createAccumulator() { if ( expr2 == null ) - return new ListAccumulator(); + return new ListAccumulator(expr1, isDistinct); else return new MapAccumulator(); } @@ -134,28 +132,38 @@ public String toPrefixString() { return out.asString(); } - protected class ListAccumulator implements Accumulator { + protected class ListAccumulator extends AccumulatorExpr { final protected List list = new ArrayList<>(); + protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { + super(expr, makeDistinct); + } + @Override - public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v; - final NodeValue nv = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nv == null ) { - v = CDTFactory.getNullValue(); - } - else { - v = CDTFactory.createValue( nv.asNode() ); - } + protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.createValue( nv.asNode() ); + list.add(v); + } + @Override + protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { + final CDTValue v = CDTFactory.getNullValue(); list.add(v); } + @Override + protected NodeValue getAccValue() { + return CDTLiteralFunctionUtils.createNodeValue(list); + } + + // Overriding this function because the base class would otherwise not + // call getAccValue() in cases in which there was an error during the + // evaluation of the 'expr' for any of the solution mappings. For FOLD, + // however, errors do not cause an aggregation error but just produce + // null values in the created list. @Override public NodeValue getValue() { - final LiteralLabelForList lit = new LiteralLabelForList(list); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return getAccValue(); } } @@ -190,9 +198,7 @@ public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { @Override public NodeValue getValue() { - final LiteralLabelForMap lit = new LiteralLabelForMap(map); - final Node n = NodeFactory.createLiteral(lit); - return NodeValue.makeNode(n); + return CDTLiteralFunctionUtils.createNodeValue(map); } } From b05f9fd4b6f05bc2027715f1e184916ba1a7cfef Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 5 Oct 2023 15:29:58 +0200 Subject: [PATCH 303/323] split AggFold into AggFoldList and AggFoldMap --- .../jena/sparql/expr/aggregate/AggFold.java | 205 ------------------ 1 file changed, 205 deletions(-) delete mode 100644 jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java deleted file mode 100644 index f25ce45c63a..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/aggregate/AggFold.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.apache.jena.sparql.expr.aggregate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Locale; - -import org.apache.jena.atlas.io.IndentedLineBuffer; -import org.apache.jena.cdt.CDTFactory; -import org.apache.jena.cdt.CDTKey; -import org.apache.jena.cdt.CDTValue; -import org.apache.jena.graph.Node; -import org.apache.jena.sparql.engine.binding.Binding; -import org.apache.jena.sparql.expr.Expr; -import org.apache.jena.sparql.expr.ExprLib; -import org.apache.jena.sparql.expr.ExprList; -import org.apache.jena.sparql.expr.NodeValue; -import org.apache.jena.sparql.function.FunctionEnv; -import org.apache.jena.sparql.function.library.cdt.CDTLiteralFunctionUtils; -import org.apache.jena.sparql.serializer.SerializationContext; -import org.apache.jena.sparql.sse.writers.WriterExpr; -import org.apache.jena.sparql.util.ExprUtils; - -public class AggFold extends AggregatorBase -{ - protected final Expr expr1; // While the values of these member variables can also be extracted from the ExprList (see - protected final Expr expr2; // createExprList below), keeping these copies here makes it easier to access these values. - - public AggFold( final boolean isDistinct, final Expr expr1 ) { - this(isDistinct, expr1, null); - } - - public AggFold( final boolean isDistinct, final Expr expr1, final Expr expr2 ) { - super( "FOLD", isDistinct, createExprList(expr1, expr2) ); - - this.expr1 = expr1; - this.expr2 = expr2; - } - - protected static ExprList createExprList( final Expr expr1, final Expr expr2 ) { - final ExprList l = new ExprList(expr1); - - if ( expr2 != null ) { - l.add(expr2); - } - - return l; - } - - @Override - public Aggregator copy( final ExprList exprs ) { - if ( exprs.size() < 1 || exprs.size() > 2 ) - throw new IllegalArgumentException(); - - final Iterator it = exprs.iterator(); - final Expr _expr1 = it.next(); - - Expr lookAhead = it.hasNext() ? it.next() : null; - - final Expr _expr2 = ( lookAhead != null ) ? lookAhead : null; - - return new AggFold(isDistinct, _expr1, _expr2); - } - - @Override - public boolean equals( final Aggregator other, final boolean bySyntax ) { - if ( other == null ) return false; - if ( this == other ) return true; - if ( ! ( other instanceof AggFold ) ) - return false; - final AggFold fold = (AggFold) other; - return exprList.equals(fold.exprList, bySyntax); - } - - @Override - public Accumulator createAccumulator() { - if ( expr2 == null ) - return new ListAccumulator(expr1, isDistinct); - else - return new MapAccumulator(); - } - - @Override - public Node getValueEmpty() { - return null; - } - - @Override - public int hashCode() { - int hc = HC_AggFold; - for ( final Expr e : getExprList() ) { - hc ^= e.hashCode(); - } - return hc; - } - - @Override - public String asSparqlExpr( final SerializationContext sCxt ) { - final IndentedLineBuffer out = new IndentedLineBuffer(); - out.append( getName() ); - out.append( "(" ); - - ExprUtils.fmtSPARQL(out, expr1, sCxt); - - if ( expr2 != null ) { - out.append(", "); - ExprUtils.fmtSPARQL(out, expr2, sCxt); - } - - out.append(")"); - return out.asString(); - } - - @Override - public String toPrefixString() { - final IndentedLineBuffer out = new IndentedLineBuffer(); - out.append("("); - out.append( getName().toLowerCase(Locale.ROOT) ); - out.incIndent(); - - WriterExpr.output(out, expr1, null); - - if ( expr2 != null ) { - out.append(", "); - WriterExpr.output(out, expr2, null); - } - - out.decIndent(); - out.append(")"); - return out.asString(); - } - - protected class ListAccumulator extends AccumulatorExpr { - final protected List list = new ArrayList<>(); - - protected ListAccumulator( final Expr expr, final boolean makeDistinct ) { - super(expr, makeDistinct); - } - - @Override - protected void accumulate( final NodeValue nv, final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.createValue( nv.asNode() ); - list.add(v); - } - - @Override - protected void accumulateError( final Binding binding, final FunctionEnv functionEnv ) { - final CDTValue v = CDTFactory.getNullValue(); - list.add(v); - } - - @Override - protected NodeValue getAccValue() { - return CDTLiteralFunctionUtils.createNodeValue(list); - } - - // Overriding this function because the base class would otherwise not - // call getAccValue() in cases in which there was an error during the - // evaluation of the 'expr' for any of the solution mappings. For FOLD, - // however, errors do not cause an aggregation error but just produce - // null values in the created list. - @Override - public NodeValue getValue() { - return getAccValue(); - } - } - - protected class MapAccumulator implements Accumulator { - final protected Map map = new HashMap<>(); - - @Override - public void accumulate( final Binding binding, final FunctionEnv functionEnv ) { - final NodeValue nvKey = ExprLib.evalOrNull(expr1, binding, functionEnv); - if ( nvKey == null ) { - return; // ignore if creating the key using the given binding failed - } - if ( nvKey.isBlank() ) { - return; // ignore if the key would be a blank node - } - - final CDTKey key = CDTFactory.createKey( nvKey.asNode() ); - - // TODO: what do we do if the map already contains an entry with the same key? - - final CDTValue value; - final NodeValue nvValue = ExprLib.evalOrNull(expr2, binding, functionEnv); - if ( nvValue == null ) { - value = CDTFactory.getNullValue(); - } - else { - value = CDTFactory.createValue( nvValue.asNode() ); - } - - map.put(key, value); - } - - @Override - public NodeValue getValue() { - return CDTLiteralFunctionUtils.createNodeValue(map); - } - } - -} From f206200081583d3582d1228625c7a19c46fe9444 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 17 Oct 2023 10:42:29 +0200 Subject: [PATCH 304/323] support for comparison (<, <=, >, >=) of cdt:Map literals --- .../apache/jena/cdt/CompositeDatatypeMap.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 3fb6cb7637c..5fb8e6fc805 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -192,6 +192,78 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { return true; } + /** + * Assumes that the datatype of both of the given literals is cdt:Map. + */ + public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { + final Map map1; + final Map map2; + try { + map1 = getValue(value1); + map2 = getValue(value2); + } + catch ( final DatatypeFormatException e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; + if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; + if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + + final CDTKeySorter keySorter = new CDTKeySorter(); + final TreeSet sortedKeys1 = new TreeSet<>(keySorter); + final TreeSet sortedKeys2 = new TreeSet<>(keySorter); + sortedKeys1.addAll( map1.keySet() ); + sortedKeys2.addAll( map2.keySet() ); + + final Iterator it1 = sortedKeys1.iterator(); + final Iterator it2 = sortedKeys2.iterator(); + final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); + for ( int i = 0; i < n; i++ ) { + final CDTKey k1 = it1.next(); + final CDTKey k2 = it2.next(); + + final int kCmp = keySorter.compare(k1, k2); + if ( kCmp < 0 ) return Expr.CMP_LESS; + if ( kCmp > 0 ) return Expr.CMP_GREATER; + + + final CDTValue v1 = map1.get(k1); + final CDTValue v2 = map2.get(k2); + if ( v1.isNull() || v2.isNull() ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); + final boolean nEqCmp; + try { + nEqCmp = n1.sameValueAs(n2); + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( nEqCmp == false ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); + try { + final int vCmp = NodeValue.compare(nv1, nv2); + if ( vCmp != Expr.CMP_EQUAL ) + return vCmp; + } + catch( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + } + } + + final int sizeDiff = map1.size() - map2.size(); + if ( sizeDiff < 0 ) return Expr.CMP_LESS; + if ( sizeDiff > 0 ) return Expr.CMP_GREATER; + return Expr.CMP_EQUAL; + } + /** * Returns true if the given node is a literal with {@link #uri} * as its datatype URI. Notice that this does not mean that this From ebdb75e167c46d6407ae77338f7a29ab4ea95f7a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 13:27:31 +0200 Subject: [PATCH 305/323] support for ORDER BY for cdt:List literals --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 108d066b1c3..588a5203afb 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -282,6 +282,13 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final List list2; try { list1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + List list2 = null; + try { list2 = getValue(value2); } catch ( final Exception e ) { From 1cb11656c915ee1c79c42de2b8ad7542ec08f398 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 18 Oct 2023 16:23:02 +0200 Subject: [PATCH 306/323] support for ORDER BY for cdt:Map literals --- .../apache/jena/cdt/CompositeDatatypeMap.java | 136 ++++++++++++++---- 1 file changed, 106 insertions(+), 30 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 5fb8e6fc805..94a4f8d4244 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -194,28 +194,73 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { /** * Assumes that the datatype of both of the given literals is cdt:Map. + * + * If 'sortOrderingCompare' is true, the two maps are compared as per the + * semantics for ORDER BY. If 'sortOrderingCompare' is false, the comparison + * applies the map-less-than semantics. */ - public static int compare( final LiteralLabel value1, final LiteralLabel value2 ) throws ExprNotComparableException { - final Map map1; - final Map map2; + public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + Map map1 = null; try { map1 = getValue(value1); + } + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next + } + + Map map2 = null; + try { map2 = getValue(value2); } - catch ( final DatatypeFormatException e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + catch ( final Exception e ) { + // do nothing at this point, we will check for errors next } - if ( map1.isEmpty() && map2.isEmpty() ) return Expr.CMP_EQUAL; - if ( map1.isEmpty() && ! map2.isEmpty() ) return Expr.CMP_LESS; - if ( map2.isEmpty() && ! map1.isEmpty() ) return Expr.CMP_GREATER; + // handling errors / ill-formed literals now + if ( map1 == null || map2 == null ) { + if ( ! sortOrderingCompare ) { + // If comparing as per the map-less-than semantics, + // both literals must be well-formed. + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + else { + // If comparing as per the ORDER BY semantics, the + // ill-formed one of the two literals is order higher. + if ( map1 != null ) return Expr.CMP_LESS; + if ( map2 != null ) return Expr.CMP_GREATER; + // If both literals are ill-formed, the order + // is determined based on the lexical forms. + return compareByLexicalForms(value1, value2); + } + } + + // If at least one of the two maps is empty, we can decide + // without a pair-wise comparison of the map entries. + if ( map1.isEmpty() || map2.isEmpty() ) { + // The literal with the non-empty map is greater + // than the literal with the empty map. + if ( ! map1.isEmpty() ) return Expr.CMP_GREATER; + if ( ! map2.isEmpty() ) return Expr.CMP_LESS; + + // If both maps are empty, under the ORDER BY semantics we then + // decide the order based on the lexical forms, and under the + // map-less-than semantics, both literals are considered equal. + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; + } + + // Now we go into the pair-wise comparison of the map entries. + // To this end, we first need to sort the map entries. final CDTKeySorter keySorter = new CDTKeySorter(); final TreeSet sortedKeys1 = new TreeSet<>(keySorter); final TreeSet sortedKeys2 = new TreeSet<>(keySorter); sortedKeys1.addAll( map1.keySet() ); sortedKeys2.addAll( map2.keySet() ); + // Now we can perform the pair-wise comparison of the map entries. final Iterator it1 = sortedKeys1.iterator(); final Iterator it2 = sortedKeys2.iterator(); final int n = Math.min( sortedKeys1.size(), sortedKeys2.size() ); @@ -227,41 +272,72 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2 if ( kCmp < 0 ) return Expr.CMP_LESS; if ( kCmp > 0 ) return Expr.CMP_GREATER; - final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); - if ( v1.isNull() || v2.isNull() ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + if ( ! v1.isNull() && ! v2.isNull() ) { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - final boolean nEqCmp; - try { - nEqCmp = n1.sameValueAs(n2); - } - catch( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + // Test whether the two RDF terms are the same value (i.e., + // comparing them using = results in true). If they are, we + // can skip to the next pair of list elements. If they are + // not, we compare them. + if ( ! n1.sameValueAs(n2) ) { + final NodeValue nv1 = NodeValue.makeNode(n1); + final NodeValue nv2 = NodeValue.makeNode(n2); - if ( nEqCmp == false ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); - try { - final int vCmp = NodeValue.compare(nv1, nv2); - if ( vCmp != Expr.CMP_EQUAL ) - return vCmp; + final int c; + try { + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + } + catch ( final Exception e ) { + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + } + + if ( c < 0 ) return Expr.CMP_LESS; + if ( c > 0 ) return Expr.CMP_GREATER; + + if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; } - catch( final Exception e ) { + } + else { + // This else-branch covers cases in which at least one of the + // two map entries has null as its value. + if ( ! sortOrderingCompare ) { + // When comparing as per the map-less-than semantics, + // null values cannot be compared to one another. throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } + else { + // When comparing as per the ORDER BY semantics, nulls are + // ordered the same. Hence, if both map entries have null + // as their value, we don't do anything here and simply + // advance to the next pair of map entries. + // However, if the map value of only one of the two map + // entries is null, then the literal with this map entry + // is ordered lower than the other literal. + if ( v1.isNull() && ! v2.isNull() ) + return Expr.CMP_LESS; + + if ( v2.isNull() && ! v1.isNull() ) + return Expr.CMP_GREATER; + } } } + // At this point, the pair-wise comparison of map entries has not led + // to any decision. Now, we decide based on the size of the maps. final int sizeDiff = map1.size() - map2.size(); if ( sizeDiff < 0 ) return Expr.CMP_LESS; if ( sizeDiff > 0 ) return Expr.CMP_GREATER; - return Expr.CMP_EQUAL; + + if ( sortOrderingCompare ) + return compareByLexicalForms(value1, value2); + else + return Expr.CMP_EQUAL; } /** From 31435f3c468333352b2cca086d60533d4d148c72 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 20 Oct 2023 14:23:54 +0200 Subject: [PATCH 307/323] changed the implementation of ORDER BY for CDT literals such that the relative order is undefined if one of the compared literals is ill-formed --- .../jena/cdt/CompositeDatatypeList.java | 7 ---- .../apache/jena/cdt/CompositeDatatypeMap.java | 35 +++---------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 588a5203afb..108d066b1c3 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -282,13 +282,6 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final List list2; try { list1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - List list2 = null; - try { list2 = getValue(value2); } catch ( final Exception e ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 94a4f8d4244..a86bb013ed7 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -200,43 +200,18 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { - Map map1 = null; + final Map map1; + final Map map2; try { map1 = getValue(value1); - } - catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - Map map2 = null; - try { map2 = getValue(value2); } catch ( final Exception e ) { - // do nothing at this point, we will check for errors next - } - - // handling errors / ill-formed literals now - if ( map1 == null || map2 == null ) { - if ( ! sortOrderingCompare ) { - // If comparing as per the map-less-than semantics, - // both literals must be well-formed. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } - else { - // If comparing as per the ORDER BY semantics, the - // ill-formed one of the two literals is order higher. - if ( map1 != null ) return Expr.CMP_LESS; - if ( map2 != null ) return Expr.CMP_GREATER; - - // If both literals are ill-formed, the order - // is determined based on the lexical forms. - return compareByLexicalForms(value1, value2); - } + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } - // If at least one of the two maps is empty, we can decide - // without a pair-wise comparison of the map entries. + // If at least one of the two maps is empty, then we can decide their + // relative order without a pair-wise comparison of the map entries. if ( map1.isEmpty() || map2.isEmpty() ) { // The literal with the non-empty map is greater // than the literal with the empty map. From 267bd152d589a73aef0734ca60faedf5526bc4c8 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 Nov 2023 19:03:52 +0100 Subject: [PATCH 308/323] implements the decision that 'null=null' is true rather than an error --- .../jena/cdt/CompositeDatatypeList.java | 17 ++-- .../apache/jena/cdt/CompositeDatatypeMap.java | 83 ++++++++++++------- 2 files changed, 63 insertions(+), 37 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 108d066b1c3..846e9654b62 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -250,16 +250,17 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { return false; } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); - } + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } - if ( ! n1.sameValueAs(n2) ) { - return false; + if ( ! n1.sameValueAs(n2) ) { + return false; + } } } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index a86bb013ed7..fc384c60849 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -176,17 +176,20 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v2 == null ) return false; if ( v1.isNull() || v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared"); + if ( ! v1.isNull() || ! v2.isNull() ) { + throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + } } + else { + final Node n1 = v1.asNode(); + final Node n2 = v2.asNode(); - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); + if ( n1.isBlank() || n2.isBlank() ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } - if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + if ( ! n1.sameValueAs(n2) ) return false; } - - if ( ! n1.sameValueAs(n2) ) return false; } return true; @@ -250,32 +253,53 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final CDTValue v1 = map1.get(k1); final CDTValue v2 = map2.get(k2); if ( ! v1.isNull() && ! v2.isNull() ) { - final Node n1 = v1.asNode(); - final Node n2 = v2.asNode(); - - // Test whether the two RDF terms are the same value (i.e., - // comparing them using = results in true). If they are, we - // can skip to the next pair of list elements. If they are - // not, we compare them. - if ( ! n1.sameValueAs(n2) ) { - final NodeValue nv1 = NodeValue.makeNode(n1); - final NodeValue nv2 = NodeValue.makeNode(n2); + final NodeValue nv1 = NodeValue.makeNode( v1.asNode() ); + final NodeValue nv2 = NodeValue.makeNode( v2.asNode() ); + // Compare the actual values represented by the two map values + // in terms of which of them is greater than the other one. + try { final int c; - try { - if ( sortOrderingCompare ) - c = NodeValue.compareAlways(nv1, nv2); - else - c = NodeValue.compare(nv1, nv2); - } - catch ( final Exception e ) { - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); - } + if ( sortOrderingCompare ) + c = NodeValue.compareAlways(nv1, nv2); + else + c = NodeValue.compare(nv1, nv2); + // If one of the two values is greater than the other one, + // return this result as the result for comparing the two + // maps. if ( c < 0 ) return Expr.CMP_LESS; if ( c > 0 ) return Expr.CMP_GREATER; + } + catch ( final Exception e ) { + // If the comparison failed, simply move on to the + // next code block (i.e., nothing to do here). + } - if ( c == 0 && sortOrderingCompare ) return Expr.CMP_INDETERMINATE; + // If the comparison of nv1 and nv2 failed with an exception + // or none of them is greater than the other, we test whether + // they are the same value (i.e., comparing them using = + // results in true). + boolean sameValueTestResult = false; + boolean sameValueTestFailed = false; + try { + sameValueTestResult = NodeValue.sameAs(nv1, nv2); + } + catch ( final Exception e ) { + sameValueTestFailed = true; + } + + // If nv1 and nv2 are not the same value or testing whether + // they are the same value failed, we can terminate the whole + // comparison (as being done in the following if block). + // If, however, nv1 and nv2 are indeed the same value (in which + // case the following if condition is not true), we continue to + // the next pair of map entries. + if ( sameValueTestFailed == true || sameValueTestResult == false ) { + if ( sortOrderingCompare ) + return Expr.CMP_INDETERMINATE; + else + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } } else { @@ -283,8 +307,9 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, // two map entries has null as its value. if ( ! sortOrderingCompare ) { // When comparing as per the map-less-than semantics, - // null values cannot be compared to one another. - throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + // null cannot be compared to anything other than null. + if ( ! v1.isNull() || ! v2.isNull() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); } else { // When comparing as per the ORDER BY semantics, nulls are From fcff8a88fc4d9841c8d7ebc984d5b6ffee5e71ac Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 19 Dec 2023 13:41:20 +0100 Subject: [PATCH 309/323] implements the decision that null is not equal to any RDF term --- .../src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index fc384c60849..ee6e51e7cb2 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -177,7 +177,7 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { if ( v1.isNull() || v2.isNull() ) { if ( ! v1.isNull() || ! v2.isNull() ) { - throw new ExprEvalException("nulls in maps cannot be compared to something other than nulls"); + return false; } } else { From 2ed03c9e072b7ddfcb79f131b12437ddcdd22329 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 8 Jan 2024 19:29:16 +0100 Subject: [PATCH 310/323] bug fix: map keys cannot be blank nodes --- jena-arq/Grammar/cdt_literals.jj | 2 -- 1 file changed, 2 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 514be16467b..24b3d46524d 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -140,8 +140,6 @@ CDTKey MapKey() : { String iri; Node n; } { iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } | - n = BlankNode() { return CDTFactory.createKey(n); } -| n = RDFLiteral() { return CDTFactory.createKey(n); } | n = NumericLiteral() { return CDTFactory.createKey(n); } From b88ae1dae5918cd70d591f2ae1d4e864eb791304 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:28:47 +0100 Subject: [PATCH 311/323] changes CDTLiteralParserBase to extend LangParserBase instead of TurtleParserBase because, in later versions of Jena, TurtleParserBase has been removed --- jena-arq/Grammar/cdt_literals.jj | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj index 24b3d46524d..d2e098b906c 100644 --- a/jena-arq/Grammar/cdt_literals.jj +++ b/jena-arq/Grammar/cdt_literals.jj @@ -58,6 +58,8 @@ import java.util.Map; import org.apache.jena.cdt.*; import org.apache.jena.graph.Node; +import static org.apache.jena.riot.lang.extra.LangParserLib.*; + public class CDTLiteralParser extends CDTLiteralParserBase { } @@ -85,7 +87,7 @@ void NonEmptyListContent(List l) : { } void ListElement(List l) : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); l.add( CDTFactory.createValue(n) ); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); } | n = BlankNode() { l.add( CDTFactory.createValue(n) ); } | @@ -138,7 +140,7 @@ void MapEntry(Map m) : { CDTKey key; CDTValue value; } CDTKey MapKey() : { String iri; Node n; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createKey(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createKey(n); } | n = RDFLiteral() { return CDTFactory.createKey(n); } | @@ -149,7 +151,7 @@ CDTKey MapKey() : { String iri; Node n; } CDTValue MapValue() : { String iri; Node n; List subList; Map m; } { - iri = IRI_REF() { n = createNode(iri); return CDTFactory.createValue(n); } + iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createValue(n); } | n = BlankNode() { return CDTFactory.createValue(n); } | @@ -186,9 +188,9 @@ Node BlankNode() : { Token t = null ; } Node NumericLiteral() : { Token t ; } { - t = { return createLiteralInteger(t.image); } -| t = { return createLiteralDecimal(t.image); } -| t = { return createLiteralDouble(t.image); } + t = { return createLiteralInteger(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDecimal(t.image, t.beginLine, t.beginColumn); } +| t = { return createLiteralDouble(t.image, t.beginLine, t.beginColumn); } } Node BooleanLiteral() : {} @@ -210,7 +212,7 @@ Node RDFLiteral() : { String lex = null ; } )? { - return createLiteral(lex, lang, dt); + return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn); } } From c3137db2fe5a00372ae485183b6c88ec28c0b04b Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 12 Jan 2024 13:36:58 +0100 Subject: [PATCH 312/323] moves the CDT literals grammar to the subdirectory './jena-arq/Grammar/CDTs/' --- jena-arq/Grammar/cdt_literals.jj | 370 ------------------------------- jena-arq/Grammar/grammarCDTs | 65 ------ 2 files changed, 435 deletions(-) delete mode 100644 jena-arq/Grammar/cdt_literals.jj delete mode 100755 jena-arq/Grammar/grammarCDTs diff --git a/jena-arq/Grammar/cdt_literals.jj b/jena-arq/Grammar/cdt_literals.jj deleted file mode 100644 index d2e098b906c..00000000000 --- a/jena-arq/Grammar/cdt_literals.jj +++ /dev/null @@ -1,370 +0,0 @@ -/* - * 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. - */ - -options -{ - // Use \ u escapes in streams AND use a reader for the query - // => get both raw and escaped unicode - - JAVA_UNICODE_ESCAPE = true ; - UNICODE_INPUT = false ; - - STATIC = false ; -// DEBUG_PARSER = true ; -// DEBUG_TOKEN_MANAGER = true ; -} - -PARSER_BEGIN(CDTLiteralParser) -/* - * 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 org.apache.jena.cdt.parser; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.jena.cdt.*; -import org.apache.jena.graph.Node; - -import static org.apache.jena.riot.lang.extra.LangParserLib.*; - -public class CDTLiteralParser extends CDTLiteralParserBase -{ -} -PARSER_END(CDTLiteralParser) - -// --- Entry point for cdt:List literals - -List List() : { List l = new ArrayList(); } -{ - - - ( NonEmptyListContent(l) )? - - - - { return l; } -} - -void NonEmptyListContent(List l) : { } -{ - ListElement(l) - - ( ListElement(l) )* -} - -void ListElement(List l) : { String iri; Node n; List subList; Map m; } -{ - iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); l.add( CDTFactory.createValue(n) ); } -| - n = BlankNode() { l.add( CDTFactory.createValue(n) ); } -| - n = RDFLiteral() { l.add( CDTFactory.createValue(n) ); } -| - n = NumericLiteral() { l.add( CDTFactory.createValue(n) ); } -| - n = BooleanLiteral() { l.add( CDTFactory.createValue(n) ); } -| - { l.add( CDTFactory.getNullValue() ); } -| - subList = List() { l.add( CDTFactory.createValue(subList) ); } -| - m = Map() { l.add( CDTFactory.createValue(m) ); } -} - -// --- Entry point for cdt:Map literals - -Map Map() : { Map m = new HashMap(); } -{ - - - ( NonEmptyMapContent(m) )? - - - - { return m; } -} - -void NonEmptyMapContent(Map m) : { } -{ - MapEntry(m) - - ( MapEntry(m) )* -} - -void MapEntry(Map m) : { CDTKey key; CDTValue value; } -{ - key = MapKey() - - - - value = MapValue() - - { - final CDTValue oldValue = m.put(key, value); - if ( oldValue != null ) throw new ParseException("map with non-unique key (" + key.toString() + ")"); - } -} - -CDTKey MapKey() : { String iri; Node n; } -{ - iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createKey(n); } -| - n = RDFLiteral() { return CDTFactory.createKey(n); } -| - n = NumericLiteral() { return CDTFactory.createKey(n); } -| - n = BooleanLiteral() { return CDTFactory.createKey(n); } -} - -CDTValue MapValue() : { String iri; Node n; List subList; Map m; } -{ - iri = IRI_REF() { n = createURI(iri, token.beginLine, token.beginColumn); return CDTFactory.createValue(n); } -| - n = BlankNode() { return CDTFactory.createValue(n); } -| - n = RDFLiteral() { return CDTFactory.createValue(n); } -| - n = NumericLiteral() { return CDTFactory.createValue(n); } -| - n = BooleanLiteral() { return CDTFactory.createValue(n); } -| - { return CDTFactory.getNullValue(); } -| - subList = List() { return CDTFactory.createValue(subList); } -| - m = Map() { return CDTFactory.createValue(m); } -} - - -// ---- Basic terms - -String IRI_REF() : { Token t ; } -{ - t = - { return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ; } -} - -Node BlankNode() : { Token t = null ; } -{ - t = - - { - return createBNode(t.image, t.beginLine, t.beginColumn); - } -} - -Node NumericLiteral() : { Token t ; } -{ - t = { return createLiteralInteger(t.image, t.beginLine, t.beginColumn); } -| t = { return createLiteralDecimal(t.image, t.beginLine, t.beginColumn); } -| t = { return createLiteralDouble(t.image, t.beginLine, t.beginColumn); } -} - -Node BooleanLiteral() : {} -{ - { return XSD_TRUE; } - | - { return XSD_FALSE; } -} - -Node RDFLiteral() : { String lex = null ; } -{ - lex = String() - // Optional lang tag and datatype. - { String lang = null ; String dt = null ; } - ( - lang = Langtag() - | - ( dt = IRI_REF() ) // divergence from the Turtle parser here; instead of IRIref(), we only permit IRI_REF() - )? - - { - return createLiteral(lex, lang, dt, token.beginLine, token.beginColumn); - } -} - -String Langtag() : { Token t ; } -{ - t = // divergence from the Turtle parser here, which also permits AnyDirective() at this point - { String lang = stripChars(t.image, 1) ; return lang ; } -} - -String String() : { Token t ; String lex ; } -{ - ( t = { lex = stripQuotes(t.image) ; } - | t = { lex = stripQuotes(t.image) ; } - | t = { lex = stripQuotes3(t.image) ; } - | t = { lex = stripQuotes3(t.image) ; } - ) - { lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - return lex ; - } -} - - -// ------------------------------------------ -// Tokens - -// Comments and whitespace - -SKIP : { " " | "\t" | "\n" | "\r" | "\f" } - -TOKEN: { <#WS: " " | "\t" | "\n" | "\r" | "\f"> } - - -// ------------------------------------------------- -// Keywords - -TOKEN [IGNORE_CASE] : -{ - < TRUE: "true" > -| < FALSE: "false" > - -// ------------------------------------------------- - -| < INTEGER: (["-","+"])? > -| - < DECIMAL: (["-","+"])? - (()+ "." ()* | "." ()+) - > - // Required exponent. -| < DOUBLE: - (["+","-"])? - ( - (["0"-"9"])+ "." (["0"-"9"])* - | "." (["0"-"9"])+ () - | (["0"-"9"])+ - ) - > -| < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > -| < #QUOTE_3D: "\"\"\""> -| < #QUOTE_3S: "'''"> -// "u" done by javacc input stream. -// "U" escapes not supported yet for Java strings -| - -| < STRING_LITERAL1: - // Single quoted string - "'" ( (~["'","\\","\n","\r"]) | )* "'" > - -| < STRING_LITERAL2: - // Double quoted string - "\"" ( (~["\"","\\","\n","\r"]) | )* "\"" > - -| < STRING_LITERAL_LONG1: - - ( ~["'","\\"] | | ("'" ~["'"]) | ("''" ~["'"]))* - > - -| < STRING_LITERAL_LONG2: - - ( ~["\"","\\"] | | ("\"" ~["\""]) | ("\"\"" ~["\""]))* - > -| < DIGITS: (["0"-"9"])+> -// | -} - -TOKEN: -{ - // Includes # for relative URIs - ","<", "\"", "{", "}", "^", "\\", "|", "`", - "\u0000"-"\u0020"])* ">" > -| > -| ()+("-" ()+)* > -| <#A2Z: ["a"-"z","A"-"Z"]> -| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]> -} - - -TOKEN : -{ - < NULL: "null" > - -| < LBRACE: "{" > -| < RBRACE: "}" > - -| < LBRACKET: "[" > -| < RBRACKET: "]" > - -| < COMMA: "," > -| < COLON: ":" > -} - -// Operator - -TOKEN : -{ - < DATATYPE: "^^"> -| < AT: "@"> -} - -TOKEN: -{ - <#PN_CHARS_BASE: - ["A"-"Z"] | ["a"-"z"] | - ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] | ["\u00F8"-"\u02FF"] | - ["\u0370"-"\u037D"] | ["\u037F"-"\u1FFF"] | - ["\u200C"-"\u200D"] | ["\u2070"-"\u218F"] | ["\u2C00"-"\u2FEF"] | - ["\u3001"-"\uD7FF"] | ["\uF900"-"\uFFFD"] - > - // [#x10000-#xEFFFF] -| - <#PN_CHARS_U: | "_" > -| -// No DOT - <#PN_CHARS: ( | "-" | ["0"-"9"] | "\u00B7" | - ["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] ) > -| - // With a leading "_", no dot at end of local name. - <#PN_LOCAL: ( | ["0"-"9"]) ((|".")* )? > -} - -// Catch-all tokens. Must be last. -// Any non-whitespace. Causes a parser exception, rather than a -// token manager error (with hidden line numbers). -// Only bad IRIs (e.g. spaces) now give unhelpful parse errors. -TOKEN: -{ - <#UNKNOWN: (~[" ","\t","\n","\r","\f" ])+ > -} - -/* -# Local Variables: -# tab-width: 4 -# indent-tabs-mode: nil -# comment-default-style: "//" -# End: -*/ diff --git a/jena-arq/Grammar/grammarCDTs b/jena-arq/Grammar/grammarCDTs deleted file mode 100755 index 8bbaf8685d4..00000000000 --- a/jena-arq/Grammar/grammarCDTs +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -## 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. - -# Parser builder - -DIR="../src/main/java/org/apache/jena/cdt/parser" -FILE=cdt_literals.jj -CLASS=CDTLiteralParser - -(cd "$DIR" ; rm -f *.java ) - -echo "---- Process grammar ----" - -javacc -OUTPUT_DIRECTORY=$DIR -JDK_VERSION=1.8 "$FILE" - -RC=$? -[ "$RC" = 0 ] || return - -echo "---- Create text form ----" -jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}" - -echo "---- Fixing Java warnings in TokenMgrError" -F="$DIR/TokenMgrError.java" -if [ -e "$F" ] -then - sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic class TokenMgrError/' < $F > F - mv F $F -fi - -## JavaCharStream -- SimpleCharStream is OK. -echo "---- Fixing Java warnings in JavaCharStream..." -F="$DIR/JavaCharStream.java" -if [ -e "$F" ] -then - sed -e 's/public/\n@SuppressWarnings("all")\npublic/' < $F > F - mv F $F -fi - -echo "---- Fixing Java warnings in ${CLASS} ..." -F="$DIR/${CLASS}.java" -sed -e 's/@SuppressWarnings("serial")//' \ - < $F > F -mv F $F - -echo "---- Create HTML form ----" -./jj2html ${FILE%%.jj}.txt 'tokens.txt' > ${FILE%%.jj}-1.html -./grammarExtracts < ${FILE%%.jj}-1.html > ${FILE%%.jj}-2.html - -echo "Check X and Y for IRI_REF because \" became '" - -echo "---- Done" From 203c3fa2bcf1313612d56dc144b62e0d18801807 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Sun, 26 May 2024 20:20:09 +0300 Subject: [PATCH 313/323] adds the possibility to create CDT literals that are known to be ill-formed (because their lexical form has already been checked) --- .../main/java/org/apache/jena/cdt/CompositeDatatypeMap.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index ee6e51e7cb2..b4719a2574c 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -203,6 +203,11 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { * applies the map-less-than semantics. */ public static int compare( final LiteralLabel value1, final LiteralLabel value2, final boolean sortOrderingCompare ) throws ExprNotComparableException { + // Verify first that both literals are well-formed. If at least one of + // them is not well-formed, then their relative order is undefined. + if ( ! value1.isWellFormed() || ! value2.isWellFormed() ) + throw new ExprNotComparableException("Can't compare "+value1+" and "+value2); + final Map map1; final Map map2; try { From 77a4a779d2a0bd7091c0cbee826618e8d460e42d Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 19:52:47 +0300 Subject: [PATCH 314/323] adaption to the reorganized NodeValue class after rebasing --- .../apache/jena/sparql/expr/NodeValue.java | 2 - .../apache/jena/sparql/expr/NodeValueCmp.java | 38 +++++++++++++++++++ .../apache/jena/sparql/expr/ValueSpace.java | 11 ++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java index 7695f4e6dbf..8296676f73e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValue.java @@ -32,8 +32,6 @@ import org.apache.jena.atlas.lib.DateTimeUtils ; import org.apache.jena.atlas.logging.Log ; -import org.apache.jena.cdt.CompositeDatatypeList ; -import org.apache.jena.cdt.CompositeDatatypeMap ; import org.apache.jena.datatypes.DatatypeFormatException ; import org.apache.jena.datatypes.RDFDatatype ; import org.apache.jena.datatypes.TypeMapper ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index 23fc679298c..f57e7315715 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -28,8 +28,11 @@ import javax.xml.datatype.Duration; import org.apache.jena.atlas.lib.StrUtils; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; +import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.sparql.ARQInternalErrorException; import org.apache.jena.sparql.SystemARQ; import org.apache.jena.sparql.expr.nodevalue.NodeFunctions; @@ -144,6 +147,17 @@ public static boolean sameValueAs(NodeValue nv1, NodeValue nv2) { raise(new ExprEvalException("Incompatible: " + nv1 + " and " + nv2)); // Not same node. return false; + + case VSPACE_CDT_LIST : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeList.type.isEqual(lit1, lit2) ; + } + case VSPACE_CDT_MAP : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + return CompositeDatatypeMap.type.isEqual(lit1, lit2) ; + } } throw new ARQInternalErrorException("sameValueAs failure " + nv1 + " and " + nv2); @@ -349,6 +363,30 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { raise(new ExprNotComparableException("Can't compare valiables as values "+nv1+" and "+nv2)) ; } + case VSPACE_CDT_LIST : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeList.compare(lit1, lit2, sortOrderingCompare) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + + case VSPACE_CDT_MAP : { + final LiteralLabel lit1 = nv1.asNode().getLiteral() ; + final LiteralLabel lit2 = nv2.asNode().getLiteral() ; + try { + return CompositeDatatypeMap.compare(lit1, lit2, sortOrderingCompare) ; + } + catch( final ExprNotComparableException e ) { + raise(e) ; + throw new ARQInternalErrorException("NodeValue.raise returned") ; + } + } + case VSPACE_UNKNOWN : { // One or two unknown value spaces. Node node1 = nv1.asNode() ; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java index 4ac00d4dab0..8440eff14ca 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ValueSpace.java @@ -18,6 +18,8 @@ package org.apache.jena.sparql.expr; +import org.apache.jena.cdt.CompositeDatatypeList; +import org.apache.jena.cdt.CompositeDatatypeMap; import org.apache.jena.sparql.SystemARQ; import org.apache.jena.sparql.util.NodeUtils; @@ -95,6 +97,9 @@ public enum ValueSpace { // VSPACE_G_MONTH(230), // VSPACE_G_DAY(240), + VSPACE_CDT_LIST(300), + VSPACE_CDT_MAP(301), + VSPACE_SORTKEY(900), VSPACE_QUOTED_TRIPLE(999), // RDF-star : Last recognized value space. @@ -188,6 +193,12 @@ public static ValueSpace valueSpace(NodeValue nv) { if ( nv.isSortKey() ) return VSPACE_SORTKEY ; + if ( nv.isLiteral() ) { + final String dtURI = nv.getDatatypeURI() ; + if ( CompositeDatatypeList.uri.equals(dtURI) ) return VSPACE_CDT_LIST ; + if ( CompositeDatatypeMap.uri.equals(dtURI) ) return VSPACE_CDT_MAP ; + } + //if ( nv.isLiteral() ) return VSPACE_UNKNOWN ; if ( nv.isBlank() ) return VSPACE_BLANKNODE; From aaff3ec3f9ecf82a732a3be550923d76f3b28e9a Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 20:59:30 +0300 Subject: [PATCH 315/323] a few more fixes of issues that resulted from rebasing --- .../apache/jena/sparql/algebra/OpVars.java | 24 ++++--------------- .../jena/sparql/engine/main/OpExecutor.java | 12 +++------- .../jena/sparql/engine/main/VarFinder.java | 14 +---------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java index b0796b30c5b..96c4b287bb7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpVars.java @@ -313,17 +313,9 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { - acc.add( opUnfold.getVar1() ) ; + acc.add( opUnfold.getVar1() ); if ( opUnfold.getVar2() != null ) { - acc.add( opUnfold.getVar2() ) ; - } - } - - @Override - public void visit(OpUnfold opUnfold) { - acc.add( opUnfold.getVar1() ) ; - if ( opUnfold.getVar2() != null ) { - acc.add( opUnfold.getVar2() ) ; + acc.add( opUnfold.getVar2() ); } } @@ -448,17 +440,9 @@ public void visit(OpExtend opExtend) { @Override public void visit(OpUnfold opUnfold) { - unknownAcc.add( opUnfold.getVar1() ) ; - if ( opUnfold.getVar2() != null ) { - unknownAcc.add( opUnfold.getVar2() ) ; - } - } - - @Override - public void visit(OpUnfold opUnfold) { - unknownAcc.add( opUnfold.getVar1() ) ; + unknownAcc.add( opUnfold.getVar1() ); if ( opUnfold.getVar2() != null ) { - unknownAcc.add( opUnfold.getVar2() ) ; + unknownAcc.add( opUnfold.getVar2() ); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java index 233ecb6bdc4..e7293e21ee3 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/OpExecutor.java @@ -451,15 +451,9 @@ protected QueryIterator execute(OpExtend opExtend, QueryIterator input) { } protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { - QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; - return qIter ; - } - - protected QueryIterator execute(OpUnfold opUnfold, QueryIterator input) { - QueryIterator qIter = exec(opUnfold.getSubOp(), input) ; - qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt) ; - return qIter ; + QueryIterator qIter = exec(opUnfold.getSubOp(), input); + qIter = new QueryIterUnfold(qIter, opUnfold.getExpr(), opUnfold.getVar1(), opUnfold.getVar2(), execCxt); + return qIter; } public static QueryIterator createRootQueryIterator(ExecutionContext execCxt) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java index 77d7f4448c9..46d0f6dbc85 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/VarFinder.java @@ -385,19 +385,7 @@ public void visit(OpUnfold opUnfold) { if ( opUnfold.getVar2() != null ) defines.add( opUnfold.getVar2() ); - ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); - } - - @Override - public void visit(OpUnfold opUnfold) { - opUnfold.getSubOp().visit(this); - - defines.add( opUnfold.getVar1() ); - - if ( opUnfold.getVar2() != null ) - defines.add( opUnfold.getVar2() ); - - ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr()); + ExprVars.nonOpVarsMentioned( assignMentions, opUnfold.getExpr() ); } @Override From 451a6d96b8184a9530e823a6e6d5dadf6323ecc4 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 21:11:15 +0300 Subject: [PATCH 316/323] after rebasing, changes the CDT implementation to adapt to the fact that LiteralLabel is not anymore an interface but a *final* class --- .../java/org/apache/jena/cdt/CDTFactory.java | 7 +- .../jena/cdt/CompositeDatatypeList.java | 26 +- .../apache/jena/cdt/CompositeDatatypeMap.java | 26 +- .../apache/jena/cdt/LiteralLabelForCDTs.java | 228 ------------------ .../apache/jena/cdt/LiteralLabelForList.java | 74 ------ .../apache/jena/cdt/LiteralLabelForMap.java | 74 ------ .../apache/jena/cdt/ParserForCDTLiterals.java | 65 ++--- .../riot/system/CDTAwareParserProfile.java | 15 +- .../engine/iterator/QueryIterUnfold.java | 42 +--- .../library/cdt/CDTLiteralFunctionUtils.java | 8 +- .../function/library/cdt/ContainsFct.java | 2 +- .../jena/sparql/lang/arq/ARQParserBase.java | 17 +- 12 files changed, 41 insertions(+), 543 deletions(-) delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java delete mode 100644 jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java index 912f32a47cf..9af154467a6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CDTFactory.java @@ -23,7 +23,6 @@ import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; public class CDTFactory { @@ -41,14 +40,12 @@ public static CDTValue createValue( final Node n ) { } public static CDTValue createValue( final List l ) { - final LiteralLabel lit = new LiteralLabelForList(l); - final Node n = NodeFactory.createLiteral(lit); + final Node n = NodeFactory.createLiteralByValue(l, CompositeDatatypeList.type); return createValue(n); } public static CDTValue createValue( final Map m ) { - final LiteralLabel lit = new LiteralLabelForMap(m); - final Node n = NodeFactory.createLiteral(lit); + final Node n = NodeFactory.createLiteralByValue(m, CompositeDatatypeMap.type); return createValue(n); } diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index 846e9654b62..e94a9eee5ba 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -59,16 +59,6 @@ public boolean isValidValue( final Object value ) { @Override public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForList objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForList makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForList ) { - return lit.isWellFormed(); - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - final String dtURI = lit.getDatatypeURI(); if ( dtURI == null || ! dtURI.equals(uri) ) { return false; @@ -86,10 +76,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { @Override public boolean isValid( final String lexicalForm ) { try { - // 'recursive' must be false here because the validity check - // is only for the literal with the given lexical form and not - // for any possible CDT literals inside it - ParserForCDTLiterals.parseListLiteral(lexicalForm, false); + ParserForCDTLiterals.parseListLiteral(lexicalForm); return true; } catch ( final Exception ex ) { @@ -99,9 +86,8 @@ public boolean isValid( final String lexicalForm ) { @Override public List parse( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; try { - return ParserForCDTLiterals.parseListLiteral(lexicalForm, recursive); + return ParserForCDTLiterals.parseListLiteral(lexicalForm); } catch ( final Exception ex ) { throw new DatatypeFormatException(lexicalForm, type, ex); @@ -146,7 +132,7 @@ protected String unparseListElement( final CDTValue elmt ) { @Override public int getHashCode( final LiteralLabel lit ) { - return lit.getDefaultHashcode(); + return lit.hashCode(); } @Override @@ -347,7 +333,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, boolean sameValueTestResult = false; boolean sameValueTestFailed = false; try { - sameValueTestResult = NodeValue.sameAs(nv1, nv2); + sameValueTestResult = NodeValue.sameValueAs(nv1, nv2); } catch ( final Exception e ) { sameValueTestFailed = true; @@ -427,10 +413,6 @@ public static boolean isListLiteral( final LiteralLabel lit ) { * Assumes that the datatype of the given literal is cdt:List. */ public static List getValue( final LiteralLabel lit ) throws DatatypeFormatException { - if ( lit instanceof LiteralLabelForList ) { - return ( (LiteralLabelForList) lit ).getValue(); - } - final Object value = lit.getValue(); if ( value == null || ! (value instanceof List) ) { throw new IllegalArgumentException( lit.toString() + " - " + value ); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index b4719a2574c..248ff077ae6 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -65,16 +65,6 @@ public boolean isValidValue( final Object value ) { @Override public boolean isValidLiteral( final LiteralLabel lit ) { - // LiteralLabelForMap objects are supposed to be used for this - // datatype and the implementation of LiteralLabelForMap makes - // sure that these are valid. - if ( lit instanceof LiteralLabelForMap ) { - return lit.isWellFormed(); - } - - // However, the given LiteralLabel may come from somewhere else, - // in which case we have to check its validity as follows. - final String dtURI = lit.getDatatypeURI(); if ( dtURI == null || ! dtURI.equals(uri) ) { return false; @@ -92,10 +82,7 @@ public boolean isValidLiteral( final LiteralLabel lit ) { @Override public boolean isValid( final String lexicalForm ) { try { - // 'recursive ' must be false here because the validity check - // is only for the literal with the given lexical form and not - // for any possible CDT literals inside it - ParserForCDTLiterals.parseMapLiteral(lexicalForm, false); + ParserForCDTLiterals.parseMapLiteral(lexicalForm); return true; } catch ( final Exception ex ) { @@ -105,9 +92,8 @@ public boolean isValid( final String lexicalForm ) { @Override public Map parse( final String lexicalForm ) throws DatatypeFormatException { - final boolean recursive = false; try { - return ParserForCDTLiterals.parseMapLiteral(lexicalForm, recursive); + return ParserForCDTLiterals.parseMapLiteral(lexicalForm); } catch ( final Exception ex ) { throw new DatatypeFormatException(lexicalForm, type, ex); @@ -156,7 +142,7 @@ protected void unparseMapEntry( final Map.Entry entry, final St @Override public int getHashCode( final LiteralLabel lit ) { - return lit.getDefaultHashcode(); + return lit.hashCode(); } @Override @@ -288,7 +274,7 @@ public static int compare( final LiteralLabel value1, final LiteralLabel value2, boolean sameValueTestResult = false; boolean sameValueTestFailed = false; try { - sameValueTestResult = NodeValue.sameAs(nv1, nv2); + sameValueTestResult = NodeValue.sameValueAs(nv1, nv2); } catch ( final Exception e ) { sameValueTestFailed = true; @@ -643,10 +629,6 @@ public static boolean isMapLiteral( final LiteralLabel lit ) { * Assumes that the datatype of the given literal is cdt:Map. */ public static Map getValue( final LiteralLabel lit ) throws DatatypeFormatException { - if ( lit instanceof LiteralLabelForMap ) { - return ( (LiteralLabelForMap) lit ).getValue(); - } - final Object value = lit.getValue(); if ( value == null || ! (value instanceof Map) ) { throw new IllegalArgumentException( lit.toString() + " - " + value ); diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java deleted file mode 100644 index d620e491c2d..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForCDTs.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.Objects; - -import org.apache.jena.datatypes.DatatypeFormatException; -import org.apache.jena.graph.impl.LiteralLabel; -import org.apache.jena.rdf.model.impl.Util; - -public abstract class LiteralLabelForCDTs implements LiteralLabel -{ - protected final int hash; - - private T valueForm; - private String lexicalForm; - private boolean lexicalFormTested; - - public LiteralLabelForCDTs( final T valueForm ) { - this.valueForm = valueForm; - this.lexicalForm = null; - - this.lexicalFormTested = true; - this.hash = valueForm.hashCode(); - } - - public LiteralLabelForCDTs( final String lexicalForm ) { - this.valueForm = null; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = false; - this.hash = lexicalForm.hashCode(); - } - - public LiteralLabelForCDTs( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - this.valueForm = null; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = true; - this.hash = lexicalForm.hashCode(); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForCDTs( final String lexicalForm, final T valueForm ) { - this.valueForm = valueForm; - this.lexicalForm = lexicalForm; - - this.lexicalFormTested = true; - this.hash = lexicalForm.hashCode(); - } - - @Override - public abstract CompositeDatatypeBase getDatatype(); - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - - @Override - public abstract CompositeDatatypeBase getDatatype(); - - @Override - public String getDatatypeURI() { - return getDatatype().getURI(); - } - - @Override - public boolean isXML() { - return false; - } - - @Override - public boolean isWellFormed() { - if ( lexicalFormTested ) { - return valueForm != null; - } - - try { - getValue(); - } - catch ( final DatatypeFormatException ex ) { - return false; - } - - return true; - } - - @Override - public boolean isWellFormedRaw() { - return isWellFormed(); - } - - @Override - public String toString( final boolean quoting ) { - final StringBuilder b = new StringBuilder(); - - if ( quoting ) b.append('"'); - - String lex = getLexicalForm(); - lex = Util.replace(lex, "\"", "\\\""); - b.append(lex); - - if ( quoting ) b.append('"'); - - b.append("^^").append( getDatatypeURI() ); - - return b.toString(); - } - - @Override - public String toString() { - return toString(false); - } - - @Override - public String getLexicalForm() { - if ( lexicalForm == null ) { - lexicalForm = getDatatype().unparseValue(valueForm); - } - - return lexicalForm; - } - - protected boolean isLexicalFormSet() { - return lexicalForm != null; - } - - protected boolean isValueFormSet() { - return valueForm != null; - } - - @Override - public Object getIndexingValue() { - return getLexicalForm(); - } - - @Override - public String language() { - return ""; - } - - @Override - public T getValue() throws DatatypeFormatException { - if ( valueForm == null && ! lexicalFormTested ) { - lexicalFormTested = true; - - // The following function may fail with a DatatypeFormatException, - // in which case 'valueForm' will remain being 'null' but we won't - // try again at the next call of 'getValue()' because now we have - // set 'lexicalFormTested'. - - valueForm = getDatatype().parse(lexicalForm); - } - - return valueForm; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - return getDatatype().isEqual(this, other); - } - - @Override - public boolean equals( final Object other ) { - if ( this == other ) return true; - - if ( other == null || !(other instanceof LiteralLabel) ) return false; - - final LiteralLabel otherLiteral = (LiteralLabel) other; - - final String otherLang = otherLiteral.language(); - if ( otherLang != null && ! otherLang.isEmpty() ) return false; - - final String otherDTypeURI = otherLiteral.getDatatypeURI(); - if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; - - return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); - } - - @Override - public boolean equals( final Object other ) { - if ( this == other ) return true; - - if ( other == null || !(other instanceof LiteralLabel) ) return false; - - final LiteralLabel otherLiteral = (LiteralLabel) other; - - final String otherLang = otherLiteral.language(); - if ( otherLang != null && ! otherLang.isEmpty() ) return false; - - final String otherDTypeURI = otherLiteral.getDatatypeURI(); - if ( ! Objects.equals(getDatatypeURI(), otherDTypeURI) ) return false; - - return Objects.equals( getLexicalForm(), otherLiteral.getLexicalForm() ); - } - - @Override - public int getDefaultHashcode() { - return hash; - } - - @Override - public int hashCode() { - return hash; - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java deleted file mode 100644 index 60f76f02c71..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForList.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.List; - -import org.apache.jena.graph.impl.LiteralLabel; - -public class LiteralLabelForList extends LiteralLabelForCDTs> -{ - public LiteralLabelForList( final List valueForm ) { - super(valueForm); - } - - public LiteralLabelForList( final String lexicalForm ) { - super(lexicalForm); - } - - public LiteralLabelForList( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - super(lexicalForm, checkedAndIdentifiedAsIllformed); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForList( final String lexicalForm, final List valueForm ) { - super(lexicalForm , valueForm); - } - - @Override - public CompositeDatatypeList getDatatype() { - return CompositeDatatypeList.type; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - if ( other instanceof LiteralLabelForList ) { - final LiteralLabelForList otherListLiteral = (LiteralLabelForList) other; - // If the lexical forms of both are equivalent (and we - // actually have the lexical forms of both; i.e., we do - // not need to materialize them just for this check), then - // the values are trivially equivalent. - if ( isLexicalFormSet() - && otherListLiteral.isLexicalFormSet() - && getLexicalForm().equals(otherListLiteral.getLexicalForm()) ) { - return true; - } - - // Otherwise, we compare the actual lists that they represent. - return getValue().equals( otherListLiteral.getValue() ); - } - - return super.sameValueAs(other); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java deleted file mode 100644 index c3a18961075..00000000000 --- a/jena-arq/src/main/java/org/apache/jena/cdt/LiteralLabelForMap.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 org.apache.jena.cdt; - -import java.util.Map; - -import org.apache.jena.graph.impl.LiteralLabel; - -public class LiteralLabelForMap extends LiteralLabelForCDTs> -{ - public LiteralLabelForMap( final Map valueForm ) { - super(valueForm); - } - - public LiteralLabelForMap( final String lexicalForm ) { - super(lexicalForm); - } - - public LiteralLabelForMap( final String lexicalForm, final boolean checkedAndIdentifiedAsIllformed ) { - super(lexicalForm, checkedAndIdentifiedAsIllformed ); - } - - /** - * Use this constructor only if you have made sure that the given lexical - * form parses indeed into the given value form, which implicitly also - * means that the given lexical form is well formed. - */ - public LiteralLabelForMap( final String lexicalForm, final Map valueForm ) { - super(lexicalForm, valueForm); - } - - @Override - public CompositeDatatypeMap getDatatype() { - return CompositeDatatypeMap.type; - } - - @Override - public boolean sameValueAs( final LiteralLabel other ) { - if ( other instanceof LiteralLabelForMap ) { - final LiteralLabelForMap otherMapLiteral = (LiteralLabelForMap) other; - // If the lexical forms of both are equivalent (and we - // actually have the lexical forms of both; i.e., we do - // not need to materialize them just for this check), then - // the values are trivially equivalent. - if ( isLexicalFormSet() - && otherMapLiteral.isLexicalFormSet() - && getLexicalForm().equals(otherMapLiteral.getLexicalForm()) ) { - return true; - } - - // Otherwise, we compare the actual lists that they represent. - return getValue().equals( otherMapLiteral.getValue() ); - } - - return super.sameValueAs(other); - } - -} diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java index b4297a8ce91..28b376f7f44 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/ParserForCDTLiterals.java @@ -26,20 +26,19 @@ import org.apache.jena.cdt.parser.CDTLiteralParser; import org.apache.jena.cdt.parser.ParseException; -import org.apache.jena.graph.Node; +import org.apache.jena.cdt.parser.TokenMgrError; import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; -import org.apache.jena.ttl.turtle.parser.TokenMgrError; public class ParserForCDTLiterals { - public static List parseListLiteral( final String lex, final boolean recursive ) { - return parseListLiteral( RiotLib.dftProfile(), lex, recursive ); + public static List parseListLiteral( final String lex ) { + return parseListLiteral( RiotLib.dftProfile(), lex ); } - public static List parseListLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { + public static List parseListLiteral( final ParserProfile pp, final String lex ) { final Reader reader = new StringReader(lex); - final List result = parseListLiteral(pp, reader, recursive); + final List result = parseListLiteral(pp, reader); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -48,11 +47,11 @@ public static List parseListLiteral( final ParserProfile pp, final Str return result; } - public static List parseListLiteral( final Reader reader, final boolean recursive ) { - return parseListLiteral( RiotLib.dftProfile(), reader, recursive ); + public static List parseListLiteral( final Reader reader ) { + return parseListLiteral( RiotLib.dftProfile(), reader ); } - public static List parseListLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + public static List parseListLiteral( final ParserProfile pp, final Reader reader ) { final CDTLiteralParser parser = new CDTLiteralParser(reader); parser.setProfile(pp); @@ -70,33 +69,16 @@ public static List parseListLiteral( final ParserProfile pp, final Rea throw new CDTLiteralParseException( th.getMessage(), th ); } - if ( recursive && ! list.isEmpty() ) { - for ( int i = 0; i < list.size(); i++ ) { - final CDTValue v = list.get(i); - if ( v.isNode() ) { - final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); - list.set( i, CDTFactory.createValue(subList) ); - } - else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); - list.set( i, CDTFactory.createValue(subMap) ); - } - } - } - } - return list; } - public static Map parseMapLiteral( final String lex, final boolean recursive ) { - return parseMapLiteral( RiotLib.dftProfile(), lex, recursive ); + public static Map parseMapLiteral( final String lex ) { + return parseMapLiteral( RiotLib.dftProfile(), lex ); } - public static Map parseMapLiteral( final ParserProfile pp, final String lex, final boolean recursive ) { + public static Map parseMapLiteral( final ParserProfile pp, final String lex ) { final Reader reader = new StringReader(lex); - final Map result = parseMapLiteral(pp, reader, recursive); + final Map result = parseMapLiteral(pp, reader); try { reader.close(); } catch ( final IOException e ) { throw new CDTLiteralParseException("Closing the reader caused an exception.", e); @@ -105,11 +87,11 @@ public static Map parseMapLiteral( final ParserProfile pp, fina return result; } - public static Map parseMapLiteral( final Reader reader, final boolean recursive ) { - return parseMapLiteral( RiotLib.dftProfile(), reader, recursive ); + public static Map parseMapLiteral( final Reader reader ) { + return parseMapLiteral( RiotLib.dftProfile(), reader ); } - public static Map parseMapLiteral( final ParserProfile pp, final Reader reader, final boolean recursive ) { + public static Map parseMapLiteral( final ParserProfile pp, final Reader reader ) { final CDTLiteralParser parser = new CDTLiteralParser(reader); parser.setProfile(pp); @@ -127,23 +109,6 @@ public static Map parseMapLiteral( final ParserProfile pp, fina throw new CDTLiteralParseException( th.getMessage(), th ); } - if ( recursive && ! map.isEmpty() ) { - for ( final CDTKey key : map.keySet() ) { - final CDTValue v = map.get(key); - if ( v.isNode() ) { - final Node vn = v.asNode(); - if ( CompositeDatatypeList.isListLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForList) ) { - final List subList = parseListLiteral(pp, vn.getLiteralLexicalForm(), recursive); - map.put( key, CDTFactory.createValue(subList) ); - } - else if ( CompositeDatatypeMap.isMapLiteral(vn) && !(vn.getLiteral() instanceof LiteralLabelForMap) ) { - final Map subMap = parseMapLiteral(pp, vn.getLiteralLexicalForm(), recursive); - map.put( key, CDTFactory.createValue(subMap) ); - } - } - } - } - return map; } diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java index 3b904f091b6..5cc008edb7f 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -7,14 +7,11 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.cdt.ParserForCDTLiterals; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.irix.IRIxResolver; import org.apache.jena.sparql.util.Context; @@ -57,17 +54,15 @@ protected Node createListLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. - final boolean recursive = false; final List value; try { - value = ParserForCDTLiterals.parseListLiteral(this, lex, recursive); + value = ParserForCDTLiterals.parseListLiteral(this, lex); } catch ( final Exception ex ) { throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); } - final LiteralLabel lit = new LiteralLabelForList(lex, value); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(value, CompositeDatatypeList.type); } protected Node createMapLiteral( final String lex ) { @@ -76,17 +71,15 @@ protected Node createMapLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. - final boolean recursive = false; final Map value; try { - value = ParserForCDTLiterals.parseMapLiteral(this, lex, recursive); + value = ParserForCDTLiterals.parseMapLiteral(this, lex); } catch ( final Exception ex ) { throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); } - final LiteralLabel lit = new LiteralLabelForMap(lex, value); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(value, CompositeDatatypeMap.type); } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 48deaaee91c..1e65837d9a7 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -19,7 +19,6 @@ package org.apache.jena.sparql.engine.iterator; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -28,8 +27,6 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.xsd.XSDDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; @@ -167,27 +164,12 @@ protected Binding moveToNextBinding() { } if ( nextElmt.isNode() ) { - final Node n = nextElmt.asNode(); - - final Node value; - if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { - final List l = CompositeDatatypeList.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForList(l); - value = NodeFactory.createLiteral(lit); - } - else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { - final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForMap(m); - value = NodeFactory.createLiteral(lit); - } - else { - value = n; - } + final Node elmtNode = nextElmt.asNode(); if ( var2 != null ) - return BindingFactory.binding(inputBinding, var1, value, var2, indexNode); + return BindingFactory.binding(inputBinding, var1, elmtNode, var2, indexNode); else - return BindingFactory.binding(inputBinding, var1, value); + return BindingFactory.binding(inputBinding, var1, elmtNode); } throw new UnsupportedOperationException( "unexpected list element: " + nextElmt.getClass().getName() ); @@ -223,23 +205,7 @@ protected Binding moveToNextBinding() { } if ( value.isNode() ) { - final Node n = value.asNode(); - - final Node valueNode; - if ( CompositeDatatypeList.isListLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForList) ) { - final List l = CompositeDatatypeList.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForList(l); - valueNode = NodeFactory.createLiteral(lit); - } - else if ( CompositeDatatypeMap.isMapLiteral(n) && !(n.getLiteral() instanceof LiteralLabelForMap) ) { - final Map m = CompositeDatatypeMap.getValue( n.getLiteral() ); - final LiteralLabel lit = new LiteralLabelForMap(m); - valueNode = NodeFactory.createLiteral(lit); - } - else { - valueNode = n; - } - + final Node valueNode = value.asNode(); return BindingFactory.binding(inputBinding, var1, keyNode, var2, valueNode); } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java index 37ff826a846..d7d5f146744 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/CDTLiteralFunctionUtils.java @@ -25,8 +25,6 @@ import org.apache.jena.cdt.CDTValue; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; @@ -125,8 +123,7 @@ public static final Map checkAndGetMap( final NodeValue nv ) th * given list. */ public static final Node createNode( final List list ) { - final LiteralLabel lit = new LiteralLabelForList(list); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(list, CompositeDatatypeList.type); } /** @@ -134,8 +131,7 @@ public static final Node createNode( final List list ) { * given map. */ public static final Node createNode( final Map map ) { - final LiteralLabel lit = new LiteralLabelForMap(map); - return NodeFactory.createLiteral(lit); + return NodeFactory.createLiteralByValue(map, CompositeDatatypeMap.type); } /** diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java index 462398e98f8..90aa9217a8c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/library/cdt/ContainsFct.java @@ -40,7 +40,7 @@ protected boolean containsNode( final List list, final NodeValue nv ) for ( final CDTValue v : list ) { if ( v.isNode() ) { final NodeValue vv = NodeValue.makeNode( v.asNode() ); - if ( NodeValue.sameAs(vv, nv) ) { + if ( NodeValue.sameValueAs(vv, nv) ) { return true; } } diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java index ce3350e2f0e..c25e12a4f7e 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/ARQParserBase.java @@ -24,13 +24,10 @@ import org.apache.jena.atlas.lib.NotImplemented ; import org.apache.jena.cdt.CompositeDatatypeList; import org.apache.jena.cdt.CompositeDatatypeMap; -import org.apache.jena.cdt.LiteralLabelForList; -import org.apache.jena.cdt.LiteralLabelForMap; import org.apache.jena.datatypes.DatatypeFormatException; import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; -import org.apache.jena.graph.impl.LiteralLabel; import org.apache.jena.riot.system.ParserProfile; import org.apache.jena.riot.system.RiotLib; import org.apache.jena.sparql.core.BasicPattern; @@ -138,14 +135,10 @@ protected void ensureParserProfileForCDTs() { } protected Node createIllformedLiteral(String lexicalForm, RDFDatatype cdtDatatype) { - final LiteralLabel lit; - if ( CompositeDatatypeList.type.equals(cdtDatatype) ) - lit = new LiteralLabelForList(lexicalForm, true); - else if ( CompositeDatatypeMap.type.equals(cdtDatatype) ) - lit = new LiteralLabelForMap(lexicalForm, true); - else - throw new IllegalArgumentException( cdtDatatype.toString() ); - - return NodeFactory.createLiteral(lit); + // Attention: This implementation is inefficient because, internally, + // the following function checks whether the given lexical form is + // well formed but, in the current case, we already know that it is + // not well formed. + return NodeFactory.createLiteral(lexicalForm, cdtDatatype); } } From 280bb15ed766fa772c6a277fa61a21b4a5252963 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 22:20:32 +0300 Subject: [PATCH 317/323] further adaption to the reorganized NodeValue class after rebasing (ORDER BY of CDT literals didn't work correctly anymore) --- .../org/apache/jena/sparql/expr/NodeValueCmp.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index f57e7315715..ba2e1477d5c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -371,7 +371,6 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { } catch( final ExprNotComparableException e ) { raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; } } @@ -465,6 +464,18 @@ public static int compareWithOrdering(NodeValue nv1, NodeValue nv2) { return NodeCmp$compareRDFTerms(nv1, nv2); } + if ( vs1 == ValueSpace.VSPACE_CDT_LIST && vs2 == ValueSpace.VSPACE_CDT_LIST ) { + LiteralLabel l1 = nv1.asNode().getLiteral(); + LiteralLabel l2 = nv2.asNode().getLiteral(); + return CompositeDatatypeList.compare(l1, l2, true); + } + + if ( vs1 == ValueSpace.VSPACE_CDT_MAP && vs2 == ValueSpace.VSPACE_CDT_MAP ) { + LiteralLabel l1 = nv1.asNode().getLiteral(); + LiteralLabel l2 = nv2.asNode().getLiteral(); + return CompositeDatatypeMap.compare(l1, l2, true); + } + // XXX G and Date cases. int vsOrder = ValueSpace.comparisonOrder(vs1, vs2); From 4dd0cc26d4b8db86c08f6bac70279fa837d5dd1e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Mon, 27 May 2024 22:47:55 +0300 Subject: [PATCH 318/323] a bit more cleaning up after rebasing --- .../apache/jena/sparql/algebra/AlgebraGenerator.java | 10 ++-------- .../java/org/apache/jena/sparql/expr/NodeValueCmp.java | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java index fdffca3fe87..016a0240c9d 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/AlgebraGenerator.java @@ -324,14 +324,8 @@ protected Op compileOneInGroup(Element elt, Op current, Deque acc) { if ( elt instanceof ElementNotExists elt2 ) return compileElementNotExists(current, elt2); - if ( elt instanceof ElementUnfold ) { - ElementUnfold unfold = (ElementUnfold)elt; - return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); - } - - if ( elt instanceof ElementUnfold ) { - ElementUnfold unfold = (ElementUnfold)elt; - return new OpUnfold(current, unfold.getExpr(), unfold.getVar1(), unfold.getVar2()); + if ( elt instanceof ElementUnfold eltUnfold ) { + return new OpUnfold(current, eltUnfold.getExpr(), eltUnfold.getVar1(), eltUnfold.getVar2()); } // Filters were collected together by prepareGroup diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index ba2e1477d5c..0ed94b9f530 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -382,7 +382,6 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { } catch( final ExprNotComparableException e ) { raise(e) ; - throw new ARQInternalErrorException("NodeValue.raise returned") ; } } From 6ca6d452d16f9c6506f68f8cd2ac3206ab11bf61 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 28 May 2024 17:53:18 +0300 Subject: [PATCH 319/323] corrects the handling of = and < for CDT literals after rebasing, also related to https://github.com/awslabs/SPARQL-CDTs/pull/5 --- .../java/org/apache/jena/cdt/CompositeDatatypeList.java | 7 ++++++- .../java/org/apache/jena/cdt/CompositeDatatypeMap.java | 7 ++++++- .../java/org/apache/jena/sparql/expr/NodeValueCmp.java | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java index e94a9eee5ba..5dc87b522a0 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeList.java @@ -229,7 +229,12 @@ public boolean isEqual( final LiteralLabel value1, final LiteralLabel value2 ) { final Node n2 = v2.asNode(); if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in lists cannot be compared"); + // If at least one of the two elements is a blank node, + // throw an error unless both elements are *the same* + // blank node. + if ( ! n1.equals(n2) ) { + throw new ExprEvalException("blank nodes in lists cannot be compared"); + } } if ( ! n1.sameValueAs(n2) ) { diff --git a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java index 248ff077ae6..fb83c30b687 100644 --- a/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java +++ b/jena-arq/src/main/java/org/apache/jena/cdt/CompositeDatatypeMap.java @@ -171,7 +171,12 @@ public boolean isEqual( final LiteralLabel lit1, final LiteralLabel lit2 ) { final Node n2 = v2.asNode(); if ( n1.isBlank() || n2.isBlank() ) { - throw new ExprEvalException("blank nodes in maps cannot be compared"); + // If at least one of the two elements is a blank node, + // throw an error unless both elements are *the same* + // blank node. + if ( ! n1.equals(n2) ) { + throw new ExprEvalException("blank nodes in maps cannot be compared"); + } } if ( ! n1.sameValueAs(n2) ) return false; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java index 0ed94b9f530..280f37506d2 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/NodeValueCmp.java @@ -218,14 +218,17 @@ public static int compareAlways(NodeValue nv1, NodeValue nv2) { if ( nv2 == null ) return CMP_GREATER; - if ( nv1.hasNode() && nv2.hasNode() ) { + ValueSpace compType = classifyValueOp(nv1, nv2) ; + + if ( nv1.hasNode() + && nv2.hasNode() + && compType != ValueSpace.VSPACE_CDT_LIST + && compType != ValueSpace.VSPACE_CDT_MAP ) { // Fast path - same RDF term => CMP_EQUAL if ( nv1.getNode().equals(nv2.getNode()) ) return CMP_EQUAL; } - ValueSpace compType = classifyValueOp(nv1, nv2) ; - // Special case - date/dateTime comparison is affected by timezones and may be // indeterminate based on the value of the dateTime/date. // Do this first, so that indeterminate can drop through to a general ordering. From b3bc2229d7f90db0553a373677ca5eeb2dac5bb3 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Tue, 4 Jun 2024 14:59:29 +0200 Subject: [PATCH 320/323] adds license header to CDTAwareParserProfile --- .../riot/system/CDTAwareParserProfile.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java index 5cc008edb7f..802362236c2 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -1,3 +1,21 @@ +/* + * 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 org.apache.jena.riot.system; import java.util.List; From 1670e3945ac1fef83489e5378b116db21567bc05 Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Wed, 5 Jun 2024 00:08:55 +0200 Subject: [PATCH 321/323] fixes issues that resulted from rebasing --- .../engine/iterator/QueryIterUnfold.java | 1 - .../sparql/lang/sparql_11/JavaCharStream.java | 226 +- .../sparql/lang/sparql_11/ParseException.java | 48 +- .../sparql/lang/sparql_11/SPARQLParser11.java | 3044 +++++++++-------- .../sparql_11/SPARQLParser11TokenManager.java | 610 ++-- .../jena/sparql/lang/sparql_11/Token.java | 7 +- .../sparql/lang/sparql_11/TokenMgrError.java | 21 +- 7 files changed, 1962 insertions(+), 1995 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java index 606a7f029b7..6de9f31fc8f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/iterator/QueryIterUnfold.java @@ -91,7 +91,6 @@ protected QueryIterator unfoldMap( final LiteralLabel lit, final Binding inputBi return new QueryIterUnfoldWorkerForMaps(inputBinding, itMapEntries); } -v protected abstract class QueryIterUnfoldWorkerBase extends QueryIteratorBase { protected final Binding inputBinding; protected final Iterator itElmts; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java index 527e07aef71..57b1eb0b3b1 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/JavaCharStream.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 7.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -64,13 +64,8 @@ static final int hexval(char c) throws java.io.IOException { throw new java.io.IOException(); // Should never come here } -<<<<<<< HEAD /* Position in buffer. */ -======= -/** Position in buffer. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int bufpos = -1; int bufsize; @@ -92,18 +87,15 @@ >>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) protected int maxNextCharInd = 0; protected int nextCharInd = -1; protected int inBuf = 0; - protected int tabSize = 8; + protected int tabSize = 1; + protected boolean trackLineColumn = true; + -<<<<<<< HEAD @SuppressWarnings("all") public void setTabSize(int i) { tabSize = i; } @SuppressWarnings("all") public int getTabSize() { return tabSize; } -======= - protected void setTabSize(int i) { tabSize = i; } - protected int getTabSize(int i) { return tabSize; } ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) protected void ExpandBuff(boolean wrapAround) { @@ -192,13 +184,8 @@ protected char ReadByte() throws java.io.IOException return nextCharBuf[nextCharInd]; } -<<<<<<< HEAD /* @return starting character for token. */ -======= -/** @return starting character for token. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char BeginToken() throws java.io.IOException { @@ -279,13 +266,8 @@ else if (prevCharIsCR) bufcolumn[bufpos] = column; } -<<<<<<< HEAD /* Read a character. */ -======= -/** Read a character. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char readChar() throws java.io.IOException { @@ -306,7 +288,7 @@ public char readChar() throws java.io.IOException if ((buffer[bufpos] = c = ReadByte()) == '\\') { - UpdateLineColumn(c); + if (trackLineColumn) { UpdateLineColumn(c); } int backSlashCnt = 1; @@ -319,7 +301,7 @@ public char readChar() throws java.io.IOException { if ((buffer[bufpos] = c = ReadByte()) != '\\') { - UpdateLineColumn(c); + if (trackLineColumn) { UpdateLineColumn(c); } // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { @@ -342,7 +324,7 @@ public char readChar() throws java.io.IOException return '\\'; } - UpdateLineColumn(c); + if (trackLineColumn) { UpdateLineColumn(c); } backSlashCnt++; } @@ -380,77 +362,50 @@ public char readChar() throws java.io.IOException } } - @Deprecated - /** + /* * @deprecated * @see #getEndColumn */ -<<<<<<< HEAD @Deprecated -======= - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getColumn() { return bufcolumn[bufpos]; } - @Deprecated - /** + /* * @deprecated * @see #getEndLine + * @return the line number. */ -<<<<<<< HEAD @Deprecated -======= - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getLine() { return bufline[bufpos]; } -<<<<<<< HEAD /** Get end column. * @return the end column or -1 */ -======= -/** Get end column. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getEndColumn() { return bufcolumn[bufpos]; } -<<<<<<< HEAD /** Get end line. * @return the end line number or -1 */ -======= -/** Get end line. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getEndLine() { return bufline[bufpos]; } -<<<<<<< HEAD -<<<<<<< HEAD /** Get the beginning column. * @return column of token start */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** @return column of token start */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public int getBeginColumn() { return bufcolumn[tokenBegin]; @@ -473,8 +428,6 @@ public void backup(int amount) { bufpos += bufsize; } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -482,12 +435,6 @@ public void backup(int amount) { * @param buffersize size of the buffer */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -503,20 +450,12 @@ public JavaCharStream(java.io.Reader dstream, nextCharBuf = new char[4096]; } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) @@ -524,33 +463,17 @@ public JavaCharStream(java.io.Reader dstream, this(dstream, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /* Reinitialise. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) @@ -572,16 +495,8 @@ public void ReInit(java.io.Reader dstream, nextCharInd = bufpos = -1; } -<<<<<<< HEAD -<<<<<<< HEAD /* Reinitialise. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream, int startline, int startcolumn) @@ -589,16 +504,8 @@ public void ReInit(java.io.Reader dstream, ReInit(dstream, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /* Reinitialise. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.Reader dstream) { @@ -613,8 +520,6 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -622,21 +527,13 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin * @param buffersize size of the buffer */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -645,12 +542,6 @@ public JavaCharStream(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException @@ -658,20 +549,12 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin this(dstream, encoding, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn) @@ -679,46 +562,28 @@ public JavaCharStream(java.io.InputStream dstream, int startline, this(dstream, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Constructor. * @param dstream the underlying data source. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Constructor. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public JavaCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -727,12 +592,6 @@ public JavaCharStream(java.io.InputStream dstream) * @param buffersize size of the buffer */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException @@ -740,8 +599,6 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. @@ -749,20 +606,12 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline, * @param buffersize size of the buffer */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. @@ -771,87 +620,49 @@ public void ReInit(java.io.InputStream dstream, int startline, * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param startline line number of the first character of the stream, mostly for error messages. * @param startcolumn column number of the first character of the stream. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. * @param encoding the character encoding of the data stream. * @throws java.io.UnsupportedEncodingException encoding is invalid or unsupported. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Reinitialise. * @param dstream the underlying data source. */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) -/** Reinitialise. */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } -<<<<<<< HEAD -<<<<<<< HEAD /** Get the token timage. * @return token image as String */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) - /** @return token image as String */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public String GetImage() { @@ -862,18 +673,10 @@ public String GetImage() new String(buffer, 0, bufpos + 1); } -<<<<<<< HEAD -<<<<<<< HEAD /** Get the suffix as an array of characters. * @param len the length of the array to return. * @return suffix */ -======= -======= ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) - /** @return suffix */ - ->>>>>>> b5d4838066 (extends SPARQL parser to recognize ORDER BY for FOLD) @SuppressWarnings("all") public char[] GetSuffix(int len) { @@ -904,6 +707,9 @@ public void Done() /** * Method to adjust line and column numbers for the start of a token. + * + * @param newLine the new line number. + * @param newCol the new column number. */ @SuppressWarnings("all") @@ -950,6 +756,8 @@ public void adjustBeginLineColumn(int newLine, int newCol) line = bufline[j]; column = bufcolumn[j]; } + boolean getTrackLineColumn() { return trackLineColumn; } + void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } } -/* JavaCC - OriginalChecksum=d63a793bd614cb11b1bb35c273b7864c (do not edit this line) */ +/* JavaCC - OriginalChecksum=9698f3eb5988f4ff314d1b8207763eb1 (do not edit this line) */ \ No newline at end of file diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java index 2c32e0affd0..da8e2a3c81f 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/ParseException.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ -/* JavaCCOptions:KEEP_LINE_COL=null */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ +/* JavaCCOptions:KEEP_LINE_COLUMN=true */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -20,6 +20,11 @@ public class ParseException extends Exception { */ private static final long serialVersionUID = 1L; + /** + * The end of line string for this machine. + */ + protected static String EOL = System.getProperty("line.separator", "\n"); + /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates @@ -60,7 +65,7 @@ public ParseException(String message) { /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. + * following this token will (therefore) be the first error token. */ public Token currentToken; @@ -88,8 +93,8 @@ public ParseException(String message) { private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { - String eol = System.getProperty("line.separator", "\n"); - StringBuffer expected = new StringBuffer(); + + StringBuilder expected = new StringBuilder(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -101,7 +106,7 @@ private static String initialise(Token currentToken, if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } - expected.append(eol).append(" "); + expected.append(EOL).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -117,21 +122,26 @@ private static String initialise(Token currentToken, retval += " \""; tok = tok.next; } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; + if (currentToken.next != null) { + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + } + retval += "." + EOL; + + + if (expectedTokenSequences.length == 0) { + // Nothing to add here } else { - retval += "Was expecting one of:" + eol + " "; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + EOL + " "; + } else { + retval += "Was expecting one of:" + EOL + " "; + } + retval += expected.toString(); } - retval += expected.toString(); + return retval; } - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version @@ -139,13 +149,11 @@ private static String initialise(Token currentToken, * string literal. */ static String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { - case 0 : - continue; case '\b': retval.append("\\b"); continue; @@ -184,4 +192,4 @@ static String add_escapes(String str) { } } -/* JavaCC - OriginalChecksum=25807f74c6efb1bcbd3321a6af1d8604 (do not edit this line) */ +/* JavaCC - OriginalChecksum=4221abc4e598fc22c5ec0c1f20bcec78 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java index 922d77ffdf1..b44b9e57649 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/SPARQLParser11.java @@ -1,3 +1,4 @@ +/* SPARQLParser11.java */ /* Generated By:JavaCC: Do not edit this line. SPARQLParser11.java */ package org.apache.jena.sparql.lang.sparql_11 ; import org.apache.jena.graph.* ; @@ -15,105 +16,112 @@ public class SPARQLParser11 extends SPARQLParser11Base implements SPARQLParser11 final public void QueryUnit() throws ParseException { ByteOrderMark(); - startQuery() ; +startQuery() ; Query(); jj_consume_token(0); - finishQuery() ; - } +finishQuery() ; +} final public void Query() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SELECT:{ SelectQuery(); break; - case CONSTRUCT: + } + case CONSTRUCT:{ ConstructQuery(); break; - case DESCRIBE: + } + case DESCRIBE:{ DescribeQuery(); break; - case ASK: + } + case ASK:{ AskQuery(); break; + } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } ValuesClause(); - } +} final public void UpdateUnit() throws ParseException { ByteOrderMark(); - startUpdateRequest() ; +startUpdateRequest() ; Update(); jj_consume_token(0); - finishUpdateRequest() ; - } +finishUpdateRequest() ; +} final public void ByteOrderMark() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BOM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BOM:{ jj_consume_token(BOM); break; + } default: jj_la1[1] = jj_gen; ; } - } +} final public void Prologue() throws ParseException { label_1: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASE: - case PREFIX: + case PREFIX:{ ; break; + } default: jj_la1[2] = jj_gen; break label_1; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BASE: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BASE:{ BaseDecl(); break; - case PREFIX: + } + case PREFIX:{ PrefixDecl(); break; + } default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } - } +} - final public void BaseDecl() throws ParseException { - Token t ; String iri ; + final public void BaseDecl() throws ParseException {Token t ; String iri ; t = jj_consume_token(BASE); iri = IRIREF(); - setBase(iri, t.beginLine, t.beginColumn ) ; - } +setBase(iri, t.beginLine, t.beginColumn ) ; +} - final public void PrefixDecl() throws ParseException { - Token t ; String iri ; + final public void PrefixDecl() throws ParseException {Token t ; String iri ; jj_consume_token(PREFIX); t = jj_consume_token(PNAME_NS); iri = IRIREF(); - String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); +String s = fixupPrefix(t.image, t.beginLine, t.beginColumn); setPrefix(s, iri, t.beginLine, t.beginColumn) ; - } +} final public void SelectQuery() throws ParseException { SelectClause(); label_2: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case FROM:{ ; break; + } default: jj_la1[4] = jj_gen; break label_2; @@ -122,108 +130,115 @@ final public void SelectQuery() throws ParseException { } WhereClause(); SolutionModifier(); - } +} final public void SubSelect() throws ParseException { SelectClause(); WhereClause(); SolutionModifier(); ValuesClause(); - } +} - final public void SelectClause() throws ParseException { - Var v ; Expr expr ; Node n ; + final public void SelectClause() throws ParseException {Var v ; Expr expr ; Node n ; jj_consume_token(SELECT); - getQuery().setQuerySelectType() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +getQuery().setQuerySelectType() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DISTINCT: - case REDUCED: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + case REDUCED:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - getQuery().setDistinct(true); +getQuery().setDistinct(true); break; - case REDUCED: + } + case REDUCED:{ jj_consume_token(REDUCED); - getQuery().setReduced(true); +getQuery().setReduced(true); break; + } default: jj_la1[5] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; + } default: jj_la1[6] = jj_gen; ; } - setAllowAggregatesInExpressions(true) ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +setAllowAggregatesInExpressions(true) ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: case VAR2: - case LPAREN: + case LPAREN:{ label_3: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ v = Var(); - getQuery().addResultVar(v) ; +getQuery().addResultVar(v) ; break; - case LPAREN: - v = null ; + } + case LPAREN:{ +v = null ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); - getQuery().addResultVar(v, expr) ; - getQuery().setQueryResultStar(false) ; +getQuery().addResultVar(v, expr) ; +getQuery().setQueryResultStar(false) ; break; + } default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: case VAR2: - case LPAREN: + case LPAREN:{ ; break; + } default: jj_la1[8] = jj_gen; break label_3; } } break; - case STAR: + } + case STAR:{ jj_consume_token(STAR); - getQuery().setQueryResultStar(true) ; +getQuery().setQueryResultStar(true) ; break; + } default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - setAllowAggregatesInExpressions(false) ; - } +setAllowAggregatesInExpressions(false) ; +} - final public void ConstructQuery() throws ParseException { - Template t ; + final public void ConstructQuery() throws ParseException {Template t ; TripleCollectorBGP acc = new TripleCollectorBGP() ; jj_consume_token(CONSTRUCT); - getQuery().setQueryConstructType() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACE: +getQuery().setQueryConstructType() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LBRACE:{ t = ConstructTemplate(); - getQuery().setConstructTemplate(t) ; +getQuery().setConstructTemplate(t) ; label_4: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case FROM:{ ; break; + } default: jj_la1[10] = jj_gen; break label_4; @@ -233,14 +248,16 @@ final public void ConstructQuery() throws ParseException { WhereClause(); SolutionModifier(); break; + } case FROM: - case WHERE: + case WHERE:{ label_5: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case FROM:{ ; break; + } default: jj_la1[11] = jj_gen; break label_5; @@ -249,7 +266,7 @@ final public void ConstructQuery() throws ParseException { } jj_consume_token(WHERE); jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -274,62 +291,66 @@ final public void ConstructQuery() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesTemplate(acc); break; + } default: jj_la1[12] = jj_gen; ; } jj_consume_token(RBRACE); SolutionModifier(); - t = new Template(acc.getBGP()) ; +t = new Template(acc.getBGP()) ; getQuery().setConstructTemplate(t) ; ElementPathBlock epb = new ElementPathBlock(acc.getBGP()) ; ElementGroup elg = new ElementGroup() ; elg.addElement(epb) ; getQuery().setQueryPattern(elg) ; break; + } default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} - final public void DescribeQuery() throws ParseException { - Node n ; + final public void DescribeQuery() throws ParseException {Node n ; jj_consume_token(DESCRIBE); - getQuery().setQueryDescribeType() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +getQuery().setQueryDescribeType() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2: + case VAR2:{ label_6: while (true) { n = VarOrIri(); - getQuery().addDescribeNode(n) ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +getQuery().addDescribeNode(n) ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2: + case VAR2:{ ; break; + } default: jj_la1[14] = jj_gen; break label_6; } } - getQuery().setQueryResultStar(false) ; +getQuery().setQueryResultStar(false) ; break; - case STAR: + } + case STAR:{ jj_consume_token(STAR); - getQuery().setQueryResultStar(true) ; +getQuery().setQueryResultStar(true) ; break; + } default: jj_la1[15] = jj_gen; jj_consume_token(-1); @@ -337,37 +358,40 @@ final public void DescribeQuery() throws ParseException { } label_7: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case FROM:{ ; break; + } default: jj_la1[16] = jj_gen; break label_7; } DatasetClause(); } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHERE: - case LBRACE: + case LBRACE:{ WhereClause(); break; + } default: jj_la1[17] = jj_gen; ; } SolutionModifier(); - } +} final public void AskQuery() throws ParseException { jj_consume_token(ASK); - getQuery().setQueryAskType() ; +getQuery().setQueryAskType() ; label_8: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case FROM:{ ; break; + } default: jj_la1[18] = jj_gen; break label_8; @@ -376,97 +400,100 @@ final public void AskQuery() throws ParseException { } WhereClause(); SolutionModifier(); - } +} final public void DatasetClause() throws ParseException { jj_consume_token(FROM); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ DefaultGraphClause(); break; - case NAMED: + } + case NAMED:{ NamedGraphClause(); break; + } default: jj_la1[19] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} - final public void DefaultGraphClause() throws ParseException { - String iri ; + final public void DefaultGraphClause() throws ParseException {String iri ; iri = SourceSelector(); - getQuery().addGraphURI(iri) ; - } +getQuery().addGraphURI(iri) ; +} - final public void NamedGraphClause() throws ParseException { - String iri ; + final public void NamedGraphClause() throws ParseException {String iri ; jj_consume_token(NAMED); iri = SourceSelector(); - getQuery().addNamedGraphURI(iri) ; - } +getQuery().addNamedGraphURI(iri) ; +} - final public String SourceSelector() throws ParseException { - String iri ; + final public String SourceSelector() throws ParseException {String iri ; iri = iri(); - {if (true) return iri ;} +{if ("" != null) return iri ;} throw new Error("Missing return statement in function"); - } +} - final public void WhereClause() throws ParseException { - Element el ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case WHERE: + final public void WhereClause() throws ParseException {Element el ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case WHERE:{ jj_consume_token(WHERE); break; + } default: jj_la1[20] = jj_gen; ; } - startWherePattern() ; +startWherePattern() ; el = GroupGraphPattern(); - getQuery().setQueryPattern(el) ; - finishWherePattern() ; - } +getQuery().setQueryPattern(el) ; +finishWherePattern() ; +} final public void SolutionModifier() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case GROUP: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case GROUP:{ GroupClause(); break; + } default: jj_la1[21] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case HAVING: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case HAVING:{ HavingClause(); break; + } default: jj_la1[22] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ORDER: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ORDER:{ OrderClause(); break; + } default: jj_la1[23] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LIMIT: - case OFFSET: + case OFFSET:{ LimitOffsetClauses(); break; + } default: jj_la1[24] = jj_gen; ; } - } +} final public void GroupClause() throws ParseException { jj_consume_token(GROUP); @@ -474,7 +501,7 @@ final public void GroupClause() throws ParseException { label_9: while (true) { GroupCondition(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -541,19 +568,19 @@ final public void GroupClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN: + case LPAREN:{ ; break; + } default: jj_la1[25] = jj_gen; break label_9; } } - } +} - final public void GroupCondition() throws ParseException { - Var v = null ; Expr expr = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public void GroupCondition() throws ParseException {Var v = null ; Expr expr = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case EXISTS: case NOT: case COUNT: @@ -614,50 +641,55 @@ final public void GroupCondition() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512: + case SHA512:{ expr = BuiltInCall(); - getQuery().addGroupBy((Var)null, expr) ; +getQuery().addGroupBy((Var)null, expr) ; break; + } case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ expr = FunctionCall(); - getQuery().addGroupBy((Var)null, expr) ; +getQuery().addGroupBy((Var)null, expr) ; break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case AS: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case AS:{ jj_consume_token(AS); v = Var(); break; + } default: jj_la1[26] = jj_gen; ; } jj_consume_token(RPAREN); - getQuery().addGroupBy(v ,expr) ; +getQuery().addGroupBy(v ,expr) ; break; + } case VAR1: - case VAR2: + case VAR2:{ v = Var(); - getQuery().addGroupBy(v) ; +getQuery().addGroupBy(v) ; break; + } default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} final public void HavingClause() throws ParseException { - setAllowAggregatesInExpressions(true) ; +setAllowAggregatesInExpressions(true) ; jj_consume_token(HAVING); label_10: while (true) { HavingCondition(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -722,31 +754,31 @@ final public void HavingClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN: + case LPAREN:{ ; break; + } default: jj_la1[28] = jj_gen; break label_10; } } - setAllowAggregatesInExpressions(false) ; - } +setAllowAggregatesInExpressions(false) ; +} - final public void HavingCondition() throws ParseException { - Expr c ; + final public void HavingCondition() throws ParseException {Expr c ; c = Constraint(); - getQuery().addHavingCondition(c) ; - } +getQuery().addHavingCondition(c) ; +} final public void OrderClause() throws ParseException { - setAllowAggregatesInExpressions(true) ; +setAllowAggregatesInExpressions(true) ; jj_consume_token(ORDER); jj_consume_token(BY); label_11: while (true) { OrderCondition(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -815,32 +847,34 @@ final public void OrderClause() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN: + case LPAREN:{ ; break; + } default: jj_la1[29] = jj_gen; break label_11; } } - setAllowAggregatesInExpressions(false) ; - } +setAllowAggregatesInExpressions(false) ; +} - final public void OrderCondition() throws ParseException { - int direction = 0 ; Expr expr = null ; Node v = null ; - direction = Query.ORDER_DEFAULT ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public void OrderCondition() throws ParseException {int direction = 0 ; Expr expr = null ; Node v = null ; +direction = Query.ORDER_DEFAULT ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASC: - case DESC: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ASC: + case DESC:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case ASC:{ jj_consume_token(ASC); - direction = Query.ORDER_ASCENDING ; +direction = Query.ORDER_ASCENDING ; break; - case DESC: + } + case DESC:{ jj_consume_token(DESC); - direction = Query.ORDER_DESCENDING ; +direction = Query.ORDER_DESCENDING ; break; + } default: jj_la1[30] = jj_gen; jj_consume_token(-1); @@ -848,6 +882,7 @@ final public void OrderCondition() throws ParseException { } expr = BrackettedExpression(); break; + } case IRIref: case PNAME_NS: case PNAME_LN: @@ -914,8 +949,8 @@ final public void OrderCondition() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -980,93 +1015,98 @@ final public void OrderCondition() throws ParseException { case SHA256: case SHA384: case SHA512: - case LPAREN: + case LPAREN:{ expr = Constraint(); break; + } case VAR1: - case VAR2: + case VAR2:{ v = Var(); break; + } default: jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; + } default: jj_la1[32] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - if ( v == null ) +if ( v == null ) getQuery().addOrderBy(expr, direction) ; else getQuery().addOrderBy(v, direction) ; - } +} final public void LimitOffsetClauses() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LIMIT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LIMIT:{ LimitClause(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case OFFSET: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case OFFSET:{ OffsetClause(); break; + } default: jj_la1[33] = jj_gen; ; } break; - case OFFSET: + } + case OFFSET:{ OffsetClause(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LIMIT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LIMIT:{ LimitClause(); break; + } default: jj_la1[34] = jj_gen; ; } break; + } default: jj_la1[35] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} - final public void LimitClause() throws ParseException { - Token t ; + final public void LimitClause() throws ParseException {Token t ; jj_consume_token(LIMIT); t = jj_consume_token(INTEGER); - getQuery().setLimit(integerValue(t.image)) ; - } +getQuery().setLimit(integerValue(t.image)) ; +} - final public void OffsetClause() throws ParseException { - Token t ; + final public void OffsetClause() throws ParseException {Token t ; jj_consume_token(OFFSET); t = jj_consume_token(INTEGER); - getQuery().setOffset(integerValue(t.image)) ; - } +getQuery().setOffset(integerValue(t.image)) ; +} - final public void ValuesClause() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case VALUES: + final public void ValuesClause() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VALUES:{ t = jj_consume_token(VALUES); - startValuesClause(t.beginLine, t.beginColumn) ; +startValuesClause(t.beginLine, t.beginColumn) ; DataBlock(); - finishValuesClause(t.beginLine, t.beginColumn) ; +finishValuesClause(t.beginLine, t.beginColumn) ; break; + } default: jj_la1[36] = jj_gen; ; } - } +} final public void Update() throws ParseException { Prologue(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INSERT: case DELETE: case INSERT_DATA: @@ -1079,157 +1119,170 @@ final public void Update() throws ParseException { case MOVE: case COPY: case DROP: - case WITH: + case WITH:{ Update1(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SEMICOLON: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SEMICOLON:{ jj_consume_token(SEMICOLON); Update(); break; + } default: jj_la1[37] = jj_gen; ; } break; + } default: jj_la1[38] = jj_gen; ; } - } +} - final public void Update1() throws ParseException { - Update up = null ; - startUpdateOperation() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOAD: + final public void Update1() throws ParseException {Update up = null ; +startUpdateOperation() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LOAD:{ up = Load(); break; - case CLEAR: + } + case CLEAR:{ up = Clear(); break; - case DROP: + } + case DROP:{ up = Drop(); break; - case ADD: + } + case ADD:{ up = Add(); break; - case MOVE: + } + case MOVE:{ up = Move(); break; - case COPY: + } + case COPY:{ up = Copy(); break; - case CREATE: + } + case CREATE:{ up = Create(); break; - case DELETE_WHERE: + } + case DELETE_WHERE:{ up = DeleteWhere(); break; + } case INSERT: case DELETE: - case WITH: + case WITH:{ up = Modify(); break; - case INSERT_DATA: + } + case INSERT_DATA:{ InsertData(); break; - case DELETE_DATA: + } + case DELETE_DATA:{ DeleteData(); break; + } default: jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - if (null != up) emitUpdate(up) ; +if (null != up) emitUpdate(up) ; finishUpdateOperation() ; - } +} - final public Update Load() throws ParseException { - String url ; Node dest = null ; boolean silent = false ; + final public Update Load() throws ParseException {String url ; Node dest = null ; boolean silent = false ; jj_consume_token(LOAD); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent = true ; +silent = true ; break; + } default: jj_la1[40] = jj_gen; ; } url = iri(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTO: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INTO:{ jj_consume_token(INTO); dest = GraphRef(); break; + } default: jj_la1[41] = jj_gen; ; } - {if (true) return new UpdateLoad(url, dest, silent) ;} +{if ("" != null) return new UpdateLoad(url, dest, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Clear() throws ParseException { - boolean silent = false ; Target target ; + final public Update Clear() throws ParseException {boolean silent = false ; Target target ; jj_consume_token(CLEAR); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent = true ; +silent = true ; break; + } default: jj_la1[42] = jj_gen; ; } target = GraphRefAll(); - {if (true) return new UpdateClear(target, silent) ;} +{if ("" != null) return new UpdateClear(target, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Drop() throws ParseException { - boolean silent = false ; Target target ; + final public Update Drop() throws ParseException {boolean silent = false ; Target target ; jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent = true ; +silent = true ; break; + } default: jj_la1[43] = jj_gen; ; } target = GraphRefAll(); - {if (true) return new UpdateDrop(target, silent) ;} +{if ("" != null) return new UpdateDrop(target, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Create() throws ParseException { - Node iri ; boolean silent = false ; + final public Update Create() throws ParseException {Node iri ; boolean silent = false ; jj_consume_token(CREATE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent=true ; +silent=true ; break; + } default: jj_la1[44] = jj_gen; ; } iri = GraphRef(); - {if (true) return new UpdateCreate(iri, silent) ;} +{if ("" != null) return new UpdateCreate(iri, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Add() throws ParseException { - Target src ; Target dest ; boolean silent = false ; + final public Update Add() throws ParseException {Target src ; Target dest ; boolean silent = false ; jj_consume_token(ADD); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent=true ; +silent=true ; break; + } default: jj_la1[45] = jj_gen; ; @@ -1237,18 +1290,18 @@ final public Update Add() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); - {if (true) return new UpdateAdd(src, dest, silent) ;} +{if ("" != null) return new UpdateAdd(src, dest, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Move() throws ParseException { - Target src ; Target dest ; boolean silent = false ; + final public Update Move() throws ParseException {Target src ; Target dest ; boolean silent = false ; jj_consume_token(MOVE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent=true ; +silent=true ; break; + } default: jj_la1[46] = jj_gen; ; @@ -1256,18 +1309,18 @@ final public Update Move() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); - {if (true) return new UpdateMove(src, dest, silent) ;} +{if ("" != null) return new UpdateMove(src, dest, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Copy() throws ParseException { - Target src ; Target dest ; boolean silent = false ; + final public Update Copy() throws ParseException {Target src ; Target dest ; boolean silent = false ; jj_consume_token(COPY); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent=true ; +silent=true ; break; + } default: jj_la1[47] = jj_gen; ; @@ -1275,70 +1328,70 @@ final public Update Copy() throws ParseException { src = GraphOrDefault(); jj_consume_token(TO); dest = GraphOrDefault(); - {if (true) return new UpdateCopy(src, dest, silent) ;} +{if ("" != null) return new UpdateCopy(src, dest, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public void InsertData() throws ParseException { - QuadDataAccSink qd = createInsertDataSink() ; Token t ; + final public void InsertData() throws ParseException {QuadDataAccSink qd = createInsertDataSink() ; Token t ; t = jj_consume_token(INSERT_DATA); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - startDataInsert(qd, beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +startDataInsert(qd, beginLine, beginColumn) ; QuadData(qd); - finishDataInsert(qd, beginLine, beginColumn) ; +finishDataInsert(qd, beginLine, beginColumn) ; qd.close() ; - } +} - final public void DeleteData() throws ParseException { - QuadDataAccSink qd = createDeleteDataSink() ; Token t ; + final public void DeleteData() throws ParseException {QuadDataAccSink qd = createDeleteDataSink() ; Token t ; t = jj_consume_token(DELETE_DATA); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - startDataDelete(qd, beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +startDataDelete(qd, beginLine, beginColumn) ; QuadData(qd); - finishDataDelete(qd, beginLine, beginColumn) ; +finishDataDelete(qd, beginLine, beginColumn) ; qd.close() ; - } +} - final public Update DeleteWhere() throws ParseException { - QuadAcc qp = new QuadAcc() ; Token t ; + final public Update DeleteWhere() throws ParseException {QuadAcc qp = new QuadAcc() ; Token t ; t = jj_consume_token(DELETE_WHERE); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - startDeleteTemplate(qp, beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); - finishDeleteTemplate(qp, beginLine, beginColumn) ; - {if (true) return new UpdateDeleteWhere(qp) ;} +finishDeleteTemplate(qp, beginLine, beginColumn) ; +{if ("" != null) return new UpdateDeleteWhere(qp) ;} throw new Error("Missing return statement in function"); - } +} - final public Update Modify() throws ParseException { - Element el ; String iri = null ; + final public Update Modify() throws ParseException {Element el ; String iri = null ; UpdateModify up = new UpdateModify() ; - startModifyUpdate() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case WITH: +startModifyUpdate() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case WITH:{ jj_consume_token(WITH); iri = iri(); - Node n = createNode(iri) ; up.setWithIRI(n) ; +Node n = createNode(iri) ; up.setWithIRI(n) ; break; + } default: jj_la1[48] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DELETE: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DELETE:{ DeleteClause(up); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INSERT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INSERT:{ InsertClause(up); break; + } default: jj_la1[49] = jj_gen; ; } break; - case INSERT: + } + case INSERT:{ InsertClause(up); break; + } default: jj_la1[50] = jj_gen; jj_consume_token(-1); @@ -1346,10 +1399,11 @@ final public Update Modify() throws ParseException { } label_12: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case USING: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case USING:{ ; break; + } default: jj_la1[51] = jj_gen; break label_12; @@ -1357,136 +1411,139 @@ final public Update Modify() throws ParseException { UsingClause(up); } jj_consume_token(WHERE); - startWherePattern() ; +startWherePattern() ; el = GroupGraphPattern(); - up.setElement(el) ; - finishWherePattern() ; - finishModifyUpdate() ; - {if (true) return up ;} +up.setElement(el) ; +finishWherePattern() ; +finishModifyUpdate() ; +{if ("" != null) return up ;} throw new Error("Missing return statement in function"); - } +} - final public void DeleteClause(UpdateModify up) throws ParseException { - QuadAcc qp = up.getDeleteAcc() ; Token t ; + final public void DeleteClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getDeleteAcc() ; Token t ; t = jj_consume_token(DELETE); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - startDeleteTemplate(qp, beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +startDeleteTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); - finishDeleteTemplate(qp, beginLine, beginColumn) ; - up.setHasDeleteClause(true) ; - } +finishDeleteTemplate(qp, beginLine, beginColumn) ; +up.setHasDeleteClause(true) ; +} - final public void InsertClause(UpdateModify up) throws ParseException { - QuadAcc qp = up.getInsertAcc() ; Token t ; + final public void InsertClause(UpdateModify up) throws ParseException {QuadAcc qp = up.getInsertAcc() ; Token t ; t = jj_consume_token(INSERT); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - startInsertTemplate(qp, beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +startInsertTemplate(qp, beginLine, beginColumn) ; QuadPattern(qp); - finishInsertTemplate(qp, beginLine, beginColumn) ; - up.setHasInsertClause(true) ; - } +finishInsertTemplate(qp, beginLine, beginColumn) ; +up.setHasInsertClause(true) ; +} - final public void UsingClause(UpdateWithUsing update) throws ParseException { - String iri ; Node n ; + final public void UsingClause(UpdateWithUsing update) throws ParseException {String iri ; Node n ; jj_consume_token(USING); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = iri(); - n = createNode(iri) ; update.addUsing(n) ; +n = createNode(iri) ; update.addUsing(n) ; break; - case NAMED: + } + case NAMED:{ jj_consume_token(NAMED); iri = iri(); - n = createNode(iri) ; update.addUsingNamed(n) ; +n = createNode(iri) ; update.addUsingNamed(n) ; break; + } default: jj_la1[52] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} - final public Target GraphOrDefault() throws ParseException { - String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DFT: + final public Target GraphOrDefault() throws ParseException {String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DFT:{ jj_consume_token(DFT); - {if (true) return Target.DEFAULT ;} +{if ("" != null) return Target.DEFAULT ;} break; + } case IRIref: case PNAME_NS: case PNAME_LN: - case GRAPH: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case GRAPH: + case GRAPH:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case GRAPH:{ jj_consume_token(GRAPH); break; + } default: jj_la1[53] = jj_gen; ; } iri = iri(); - {if (true) return Target.create(createNode(iri)) ;} +{if ("" != null) return Target.create(createNode(iri)) ;} break; + } default: jj_la1[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node GraphRef() throws ParseException { - String iri ; + final public Node GraphRef() throws ParseException {String iri ; jj_consume_token(GRAPH); iri = iri(); - {if (true) return createNode(iri) ;} +{if ("" != null) return createNode(iri) ;} throw new Error("Missing return statement in function"); - } +} - final public Target GraphRefAll() throws ParseException { - Node iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case GRAPH: + final public Target GraphRefAll() throws ParseException {Node iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case GRAPH:{ iri = GraphRef(); - {if (true) return Target.create(iri) ;} +{if ("" != null) return Target.create(iri) ;} break; - case DFT: + } + case DFT:{ jj_consume_token(DFT); - {if (true) return Target.DEFAULT ;} +{if ("" != null) return Target.DEFAULT ;} break; - case NAMED: + } + case NAMED:{ jj_consume_token(NAMED); - {if (true) return Target.NAMED ;} +{if ("" != null) return Target.NAMED ;} break; - case ALL: + } + case ALL:{ jj_consume_token(ALL); - {if (true) return Target.ALL ;} +{if ("" != null) return Target.ALL ;} break; + } default: jj_la1[55] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} final public void QuadPattern(QuadAcc acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); - } +} final public void QuadData(QuadDataAccSink acc) throws ParseException { jj_consume_token(LBRACE); Quads(acc); jj_consume_token(RBRACE); - } +} final public void Quads(QuadAccSink acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1511,33 +1568,36 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesTemplate(acc); break; + } default: jj_la1[56] = jj_gen; ; } label_13: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case GRAPH: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case GRAPH:{ ; break; + } default: jj_la1[57] = jj_gen; break label_13; } QuadsNotTriples(acc); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOT:{ jj_consume_token(DOT); break; + } default: jj_la1[58] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1562,23 +1622,23 @@ final public void Quads(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesTemplate(acc); break; + } default: jj_la1[59] = jj_gen; ; } } - } +} - final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { - Node gn ; Node prev = acc.getGraph() ; + final public void QuadsNotTriples(QuadAccSink acc) throws ParseException {Node gn ; Node prev = acc.getGraph() ; jj_consume_token(GRAPH); gn = VarOrIri(); - setAccGraph(acc, gn) ; +setAccGraph(acc, gn) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1603,23 +1663,24 @@ final public void QuadsNotTriples(QuadAccSink acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesTemplate(acc); break; + } default: jj_la1[60] = jj_gen; ; } jj_consume_token(RBRACE); - setAccGraph(acc, prev) ; - } +setAccGraph(acc, prev) ; +} final public void TriplesTemplate(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOT:{ jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1644,45 +1705,46 @@ final public void TriplesTemplate(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesTemplate(acc); break; + } default: jj_la1[61] = jj_gen; ; } break; + } default: jj_la1[62] = jj_gen; ; } - } +} - final public Element GroupGraphPattern() throws ParseException { - Element el = null ; Token t ; + final public Element GroupGraphPattern() throws ParseException {Element el = null ; Token t ; t = jj_consume_token(LBRACE); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: - startSubSelect(beginLine, beginColumn) ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SELECT:{ +startSubSelect(beginLine, beginColumn) ; SubSelect(); - Query q = endSubSelect(beginLine, beginColumn) ; +Query q = endSubSelect(beginLine, beginColumn) ; el = new ElementSubQuery(q) ; break; + } default: jj_la1[63] = jj_gen; el = GroupGraphPatternSub(); } jj_consume_token(RBRACE); - {if (true) return el ;} +{if ("" != null) return el ;} throw new Error("Missing return statement in function"); - } +} - final public Element GroupGraphPatternSub() throws ParseException { - Element el = null ; - ElementGroup elg = new ElementGroup() ; - startGroup(elg) ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Element GroupGraphPatternSub() throws ParseException {Element el = null ; +ElementGroup elg = new ElementGroup() ; +startGroup(elg) ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1707,19 +1769,20 @@ final public Element GroupGraphPatternSub() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: - startTriplesBlock() ; + case ANON:{ +startTriplesBlock() ; el = TriplesBlock(null); - endTriplesBlock() ; +endTriplesBlock() ; elg.addElement(el) ; break; + } default: jj_la1[64] = jj_gen; ; } label_14: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VALUES: case GRAPH: case OPTIONAL: @@ -1727,24 +1790,26 @@ final public Element GroupGraphPatternSub() throws ParseException { case BIND: case SERVICE: case FILTER: - case LBRACE: + case LBRACE:{ ; break; + } default: jj_la1[65] = jj_gen; break label_14; } el = GraphPatternNotTriples(); - elg.addElement(el) ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOT: +elg.addElement(el) ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOT:{ jj_consume_token(DOT); break; + } default: jj_la1[66] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1769,30 +1834,31 @@ final public Element GroupGraphPatternSub() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: - startTriplesBlock() ; + case ANON:{ +startTriplesBlock() ; el = TriplesBlock(null); - endTriplesBlock() ; +endTriplesBlock() ; elg.addElement(el) ; break; + } default: jj_la1[67] = jj_gen; ; } } - endGroup(elg) ; - {if (true) return elg ;} +endGroup(elg) ; +{if ("" != null) return elg ;} throw new Error("Missing return statement in function"); - } +} final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { - if ( acc == null ) +if ( acc == null ) acc = new ElementPathBlock() ; TriplesSameSubjectPath(acc); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOT:{ jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1817,143 +1883,149 @@ final public Element TriplesBlock(ElementPathBlock acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ TriplesBlock(acc); break; + } default: jj_la1[68] = jj_gen; ; } break; + } default: jj_la1[69] = jj_gen; ; } - {if (true) return acc ;} +{if ("" != null) return acc ;} throw new Error("Missing return statement in function"); - } +} - final public Element GraphPatternNotTriples() throws ParseException { - Element el = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LBRACE: + final public Element GraphPatternNotTriples() throws ParseException {Element el = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LBRACE:{ el = GroupOrUnionGraphPattern(); break; - case OPTIONAL: + } + case OPTIONAL:{ el = OptionalGraphPattern(); break; - case MINUS_P: + } + case MINUS_P:{ el = MinusGraphPattern(); break; - case GRAPH: + } + case GRAPH:{ el = GraphGraphPattern(); break; - case SERVICE: + } + case SERVICE:{ el = ServiceGraphPattern(); break; - case FILTER: + } + case FILTER:{ el = Filter(); break; - case BIND: + } + case BIND:{ el = Bind(); break; - case VALUES: + } + case VALUES:{ el = InlineData(); break; + } default: jj_la1[70] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return el ;} +{if ("" != null) return el ;} throw new Error("Missing return statement in function"); - } +} - final public Element OptionalGraphPattern() throws ParseException { - Element el ; + final public Element OptionalGraphPattern() throws ParseException {Element el ; jj_consume_token(OPTIONAL); el = GroupGraphPattern(); - {if (true) return new ElementOptional(el) ;} +{if ("" != null) return new ElementOptional(el) ;} throw new Error("Missing return statement in function"); - } +} - final public Element GraphGraphPattern() throws ParseException { - Element el ; Node n ; + final public Element GraphGraphPattern() throws ParseException {Element el ; Node n ; jj_consume_token(GRAPH); n = VarOrIri(); el = GroupGraphPattern(); - {if (true) return new ElementNamedGraph(n, el) ;} +{if ("" != null) return new ElementNamedGraph(n, el) ;} throw new Error("Missing return statement in function"); - } +} - final public Element ServiceGraphPattern() throws ParseException { - Element el ; Node n ; boolean silent = false ; + final public Element ServiceGraphPattern() throws ParseException {Element el ; Node n ; boolean silent = false ; jj_consume_token(SERVICE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SILENT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SILENT:{ jj_consume_token(SILENT); - silent=true; +silent=true; break; + } default: jj_la1[71] = jj_gen; ; } n = VarOrIri(); el = GroupGraphPattern(); - {if (true) return new ElementService(n, el, silent) ;} +{if ("" != null) return new ElementService(n, el, silent) ;} throw new Error("Missing return statement in function"); - } +} - final public Element Bind() throws ParseException { - Var v ; Expr expr ; + final public Element Bind() throws ParseException {Var v ; Expr expr ; jj_consume_token(BIND); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(AS); v = Var(); jj_consume_token(RPAREN); - {if (true) return new ElementBind(v, expr) ;} +{if ("" != null) return new ElementBind(v, expr) ;} throw new Error("Missing return statement in function"); - } +} - final public Element InlineData() throws ParseException { - ElementData el ; Token t ; + final public Element InlineData() throws ParseException {ElementData el ; Token t ; t = jj_consume_token(VALUES); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - el = new ElementData() ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +el = new ElementData() ; startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; DataBlock(); - finishInlineData(beginLine, beginColumn) ; - {if (true) return el ;} +finishInlineData(beginLine, beginColumn) ; + {if ("" != null) return el ;} throw new Error("Missing return statement in function"); - } +} final public void DataBlock() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ InlineDataOneVar(); break; + } case LPAREN: - case NIL: + case NIL:{ InlineDataFull(); break; + } default: jj_la1[72] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} - final public void InlineDataOneVar() throws ParseException { - Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; + final public void InlineDataOneVar() throws ParseException {Var v ; Node n ; Token t ; ; int beginLine; int beginColumn; v = Var(); - emitDataBlockVariable(v) ; +emitDataBlockVariable(v) ; t = jj_consume_token(LBRACE); - beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; +beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; label_15: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -1972,45 +2044,48 @@ final public void InlineDataOneVar() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: + case STRING_LITERAL_LONG2:{ ; break; + } default: jj_la1[73] = jj_gen; break label_15; } n = DataBlockValue(); - startDataBlockValueRow(beginLine, beginColumn) ; +startDataBlockValueRow(beginLine, beginColumn) ; emitDataBlockValue(n, beginLine, beginColumn) ; finishDataBlockValueRow(beginLine, beginColumn) ; } t = jj_consume_token(RBRACE); - } +} - final public void InlineDataFull() throws ParseException { - Var v ; Node n ; Token t ; int beginLine; int beginColumn; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NIL: + final public void InlineDataFull() throws ParseException {Var v ; Node n ; Token t ; int beginLine; int beginColumn; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case NIL:{ jj_consume_token(NIL); break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); label_16: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ ; break; + } default: jj_la1[74] = jj_gen; break label_16; } v = Var(); - emitDataBlockVariable(v) ; +emitDataBlockVariable(v) ; } jj_consume_token(RPAREN); break; + } default: jj_la1[75] = jj_gen; jj_consume_token(-1); @@ -2019,23 +2094,24 @@ final public void InlineDataFull() throws ParseException { jj_consume_token(LBRACE); label_17: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN: - case NIL: + case NIL:{ ; break; + } default: jj_la1[76] = jj_gen; break label_17; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ t = jj_consume_token(LPAREN); - beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; - startDataBlockValueRow(beginLine, beginColumn) ; +beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; +startDataBlockValueRow(beginLine, beginColumn) ; label_18: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2054,26 +2130,29 @@ final public void InlineDataFull() throws ParseException { case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: + case STRING_LITERAL_LONG2:{ ; break; + } default: jj_la1[77] = jj_gen; break label_18; } n = DataBlockValue(); - emitDataBlockValue(n, beginLine, beginColumn) ; +emitDataBlockValue(n, beginLine, beginColumn) ; } t = jj_consume_token(RPAREN); - beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; - finishDataBlockValueRow(beginLine, beginColumn) ; +beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; +finishDataBlockValueRow(beginLine, beginColumn) ; break; - case NIL: + } + case NIL:{ t = jj_consume_token(NIL); - beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; - startDataBlockValueRow(beginLine, beginColumn) ; - finishDataBlockValueRow(beginLine, beginColumn) ; +beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; +startDataBlockValueRow(beginLine, beginColumn) ; +finishDataBlockValueRow(beginLine, beginColumn) ; break; + } default: jj_la1[78] = jj_gen; jj_consume_token(-1); @@ -2081,24 +2160,25 @@ final public void InlineDataFull() throws ParseException { } } jj_consume_token(RBRACE); - } +} - final public Node DataBlockValue() throws ParseException { - Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node DataBlockValue() throws ParseException {Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = iri(); - {if (true) return createNode(iri) ;} +{if ("" != null) return createNode(iri) ;} break; + } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: + case STRING_LITERAL_LONG2:{ n = RDFLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case INTEGER: case DECIMAL: case DOUBLE: @@ -2107,75 +2187,76 @@ final public Node DataBlockValue() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: + case DOUBLE_NEGATIVE:{ n = NumericLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case TRUE: - case FALSE: + case FALSE:{ n = BooleanLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; - case UNDEF: + } + case UNDEF:{ jj_consume_token(UNDEF); - {if (true) return null ;} +{if ("" != null) return null ;} break; + } default: jj_la1[79] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Element MinusGraphPattern() throws ParseException { - Element el ; + final public Element MinusGraphPattern() throws ParseException {Element el ; jj_consume_token(MINUS_P); el = GroupGraphPattern(); - {if (true) return new ElementMinus(el) ;} +{if ("" != null) return new ElementMinus(el) ;} throw new Error("Missing return statement in function"); - } +} - final public Element GroupOrUnionGraphPattern() throws ParseException { - Element el = null ; ElementUnion el2 = null ; + final public Element GroupOrUnionGraphPattern() throws ParseException {Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_19: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case UNION: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case UNION:{ ; break; + } default: jj_la1[80] = jj_gen; break label_19; } jj_consume_token(UNION); - if ( el2 == null ) +if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); - el2.addElement(el) ; +el2.addElement(el) ; } - {if (true) return (el2==null)? el : el2 ;} +{if ("" != null) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); - } +} - final public Element Filter() throws ParseException { - Expr c ; + final public Element Filter() throws ParseException {Expr c ; jj_consume_token(FILTER); c = Constraint(); - {if (true) return new ElementFilter(c) ;} +{if ("" != null) return new ElementFilter(c) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr Constraint() throws ParseException { - Expr c ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + final public Expr Constraint() throws ParseException {Expr c ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ c = BrackettedExpression(); break; + } case EXISTS: case NOT: case COUNT: @@ -2236,127 +2317,132 @@ final public Expr Constraint() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512: + case SHA512:{ c = BuiltInCall(); break; + } case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ c = FunctionCall(); break; + } default: jj_la1[81] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return c ;} +{if ("" != null) return c ;} throw new Error("Missing return statement in function"); - } +} - final public Expr FunctionCall() throws ParseException { - String fname ; Args a ; + final public Expr FunctionCall() throws ParseException {String fname ; Args a ; fname = iri(); a = ArgList(); - if ( AggregateRegistry.isRegistered(fname) ) { +if ( AggregateRegistry.isRegistered(fname) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+fname, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(fname, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if (true) return exprAgg ;} + {if ("" != null) return exprAgg ;} } - {if (true) return new E_Function(fname, a) ;} + {if ("" != null) return new E_Function(fname, a) ;} throw new Error("Missing return statement in function"); - } +} - final public Args ArgList() throws ParseException { - Expr expr ; Args args = new Args() ; Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NIL: + final public Args ArgList() throws ParseException {Expr expr ; Args args = new Args() ; Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case NIL:{ jj_consume_token(NIL); break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ t = jj_consume_token(DISTINCT); - args.distinct = true ; - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; - if ( ! getAllowAggregatesInExpressions() ) +args.distinct = true ; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", beginLine, beginColumn) ; break; + } default: jj_la1[82] = jj_gen; ; } expr = Expression(); - args.add(expr) ; +args.add(expr) ; label_20: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ ; break; + } default: jj_la1[83] = jj_gen; break label_20; } jj_consume_token(COMMA); expr = Expression(); - args.add(expr) ; +args.add(expr) ; } jj_consume_token(RPAREN); break; + } default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return args ;} +{if ("" != null) return args ;} throw new Error("Missing return statement in function"); - } +} - final public ExprList ExpressionList() throws ParseException { - Expr expr = null ; ExprList exprList = new ExprList() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NIL: + final public ExprList ExpressionList() throws ParseException {Expr expr = null ; ExprList exprList = new ExprList() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case NIL:{ jj_consume_token(NIL); break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); expr = Expression(); - exprList.add(expr) ; +exprList.add(expr) ; label_21: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ ; break; + } default: jj_la1[85] = jj_gen; break label_21; } jj_consume_token(COMMA); expr = Expression(); - exprList.add(expr) ; +exprList.add(expr) ; } jj_consume_token(RPAREN); break; + } default: jj_la1[86] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return exprList ;} +{if ("" != null) return exprList ;} throw new Error("Missing return statement in function"); - } +} - final public Template ConstructTemplate() throws ParseException { - TripleCollectorBGP acc = new TripleCollectorBGP(); + final public Template ConstructTemplate() throws ParseException {TripleCollectorBGP acc = new TripleCollectorBGP(); Template t = new Template(acc.getBGP()) ; - setInConstructTemplate(true) ; +setInConstructTemplate(true) ; jj_consume_token(LBRACE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2381,25 +2467,26 @@ final public Template ConstructTemplate() throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ ConstructTriples(acc); break; + } default: jj_la1[87] = jj_gen; ; } jj_consume_token(RBRACE); - setInConstructTemplate(false) ; - {if (true) return t ;} +setInConstructTemplate(false) ; + {if ("" != null) return t ;} throw new Error("Missing return statement in function"); - } +} final public void ConstructTriples(TripleCollector acc) throws ParseException { TriplesSameSubject(acc); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DOT:{ jj_consume_token(DOT); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2424,23 +2511,24 @@ final public void ConstructTriples(TripleCollector acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ ConstructTriples(acc); break; + } default: jj_la1[88] = jj_gen; ; } break; + } default: jj_la1[89] = jj_gen; ; } - } +} - final public void TriplesSameSubject(TripleCollector acc) throws ParseException { - Node s ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public void TriplesSameSubject(TripleCollector acc) throws ParseException {Node s ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2463,104 +2551,109 @@ final public void TriplesSameSubject(TripleCollector acc) throws ParseException case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON: + case ANON:{ s = VarOrTerm(); PropertyListNotEmpty(s, acc); break; + } case LPAREN: - case LBRACKET: - ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET:{ +ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNode(tempAcc); PropertyList(s, tempAcc); - insert(acc, tempAcc) ; +insert(acc, tempAcc) ; break; + } default: jj_la1[90] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} final public void PropertyList(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A: + case KW_A:{ PropertyListNotEmpty(s, acc); break; + } default: jj_la1[91] = jj_gen; ; } - } +} - final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException { - Node p = null ; + final public void PropertyListNotEmpty(Node s, TripleCollector acc) throws ParseException {Node p = null ; p = Verb(); ObjectList(s, p, null, acc); label_22: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SEMICOLON: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SEMICOLON:{ ; break; + } default: jj_la1[92] = jj_gen; break label_22; } jj_consume_token(SEMICOLON); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: case VAR2: - case KW_A: + case KW_A:{ p = Verb(); ObjectList(s, p, null, acc); break; + } default: jj_la1[93] = jj_gen; ; } } - } +} - final public Node Verb() throws ParseException { - Node p ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node Verb() throws ParseException {Node p ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case VAR1: - case VAR2: + case VAR2:{ p = VarOrIri(); break; - case KW_A: + } + case KW_A:{ jj_consume_token(KW_A); - p = nRDFtype ; +p = nRDFtype ; break; + } default: jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException { - Node o ; + final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; Object(s, p, path, acc); label_23: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ ; break; + } default: jj_la1[95] = jj_gen; break label_23; @@ -2568,18 +2661,16 @@ final public void ObjectList(Node s, Node p, Path path, TripleCollector acc) thr jj_consume_token(COMMA); Object(s, p, path, acc); } - } +} - final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException { - Node o ; - ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; +ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNode(tempAcc); - insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; - } +insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; +} - final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException { - Node s ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseException {Node s ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2602,26 +2693,28 @@ final public void TriplesSameSubjectPath(TripleCollector acc) throws ParseExcept case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON: + case ANON:{ s = VarOrTerm(); PropertyListPathNotEmpty(s, acc); break; + } case LPAREN: - case LBRACKET: - ElementPathBlock tempAcc = new ElementPathBlock() ; + case LBRACKET:{ +ElementPathBlock tempAcc = new ElementPathBlock() ; s = TriplesNodePath(tempAcc); PropertyListPath(s, tempAcc); - insert(acc, tempAcc) ; +insert(acc, tempAcc) ; break; + } default: jj_la1[96] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - } +} final public void PropertyListPath(Node s, TripleCollector acc) throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2630,31 +2723,33 @@ final public void PropertyListPath(Node s, TripleCollector acc) throws ParseExce case KW_A: case LPAREN: case BANG: - case CARAT: + case CARAT:{ PropertyListPathNotEmpty(s, acc); break; + } default: jj_la1[97] = jj_gen; ; } - } +} - final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException { - Path path = null ; Node p = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws ParseException {Path path = null ; Node p = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT: + case CARAT:{ path = VerbPath(); break; + } case VAR1: - case VAR2: + case VAR2:{ p = VerbSimple(); break; + } default: jj_la1[98] = jj_gen; jj_consume_token(-1); @@ -2663,17 +2758,18 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P ObjectListPath(s, p, path, acc); label_24: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SEMICOLON: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SEMICOLON:{ ; break; + } default: jj_la1[99] = jj_gen; break label_24; } jj_consume_token(SEMICOLON); - path = null ; p = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +path = null ; p = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -2682,21 +2778,23 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P case KW_A: case LPAREN: case BANG: - case CARAT: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CARAT:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: case BANG: - case CARAT: + case CARAT:{ path = VerbPath(); break; + } case VAR1: - case VAR2: + case VAR2:{ p = VerbSimple(); break; + } default: jj_la1[100] = jj_gen; jj_consume_token(-1); @@ -2704,36 +2802,35 @@ final public void PropertyListPathNotEmpty(Node s, TripleCollector acc) throws P } ObjectListPath(s, p, path, acc); break; + } default: jj_la1[101] = jj_gen; ; } } - } +} - final public Path VerbPath() throws ParseException { - Node p ; Path path ; + final public Path VerbPath() throws ParseException {Node p ; Path path ; path = Path(); - {if (true) return path ;} +{if ("" != null) return path ;} throw new Error("Missing return statement in function"); - } +} - final public Node VerbSimple() throws ParseException { - Node p ; + final public Node VerbSimple() throws ParseException {Node p ; p = Var(); - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { - Node o ; + final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; ObjectPath(s, p, path, acc); label_25: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ ; break; + } default: jj_la1[102] = jj_gen; break label_25; @@ -2741,333 +2838,342 @@ final public void ObjectListPath(Node s, Node p, Path path, TripleCollector acc) jj_consume_token(COMMA); ObjectPath(s, p, path, acc); } - } +} - final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException { - Node o ; - ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; + final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {Node o ; +ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; o = GraphNodePath(tempAcc); - insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; - } +insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; +} - final public Path Path() throws ParseException { - Path p ; + final public Path Path() throws ParseException {Path p ; p = PathAlternative(); - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public Path PathAlternative() throws ParseException { - Path p1 , p2 ; + final public Path PathAlternative() throws ParseException {Path p1 , p2 ; p1 = PathSequence(); label_26: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case VBAR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VBAR:{ ; break; + } default: jj_la1[103] = jj_gen; break label_26; } jj_consume_token(VBAR); p2 = PathSequence(); - p1 = PathFactory.pathAlt(p1, p2) ; +p1 = PathFactory.pathAlt(p1, p2) ; } - {if (true) return p1 ;} +{if ("" != null) return p1 ;} throw new Error("Missing return statement in function"); - } +} - final public Path PathSequence() throws ParseException { - Path p1 , p2 ; + final public Path PathSequence() throws ParseException {Path p1 , p2 ; p1 = PathEltOrInverse(); label_27: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SLASH: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SLASH:{ ; break; + } default: jj_la1[104] = jj_gen; break label_27; } jj_consume_token(SLASH); p2 = PathEltOrInverse(); - p1 = PathFactory.pathSeq(p1, p2) ; +p1 = PathFactory.pathSeq(p1, p2) ; } - {if (true) return p1;} +{if ("" != null) return p1;} throw new Error("Missing return statement in function"); - } +} - final public Path PathElt() throws ParseException { - String str ; Node n ; Path p ; + final public Path PathElt() throws ParseException {String str ; Node n ; Path p ; p = PathPrimary(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PLUS: case STAR: - case QMARK: + case QMARK:{ p = PathMod(p); break; + } default: jj_la1[105] = jj_gen; ; } - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public Path PathEltOrInverse() throws ParseException { - String str ; Node n ; Path p ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Path PathEltOrInverse() throws ParseException {String str ; Node n ; Path p ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: case LPAREN: - case BANG: + case BANG:{ p = PathElt(); break; - case CARAT: + } + case CARAT:{ jj_consume_token(CARAT); p = PathElt(); - p = PathFactory.pathInverse(p) ; +p = PathFactory.pathInverse(p) ; break; + } default: jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public Path PathMod(Path p) throws ParseException { - long i1 ; long i2 ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case QMARK: + final public Path PathMod(Path p) throws ParseException {long i1 ; long i2 ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case QMARK:{ jj_consume_token(QMARK); - {if (true) return PathFactory.pathZeroOrOne(p) ;} +{if ("" != null) return PathFactory.pathZeroOrOne(p) ;} break; - case STAR: + } + case STAR:{ jj_consume_token(STAR); - {if (true) return PathFactory.pathZeroOrMore1(p) ;} +{if ("" != null) return PathFactory.pathZeroOrMore1(p) ;} break; - case PLUS: + } + case PLUS:{ jj_consume_token(PLUS); - {if (true) return PathFactory.pathOneOrMore1(p) ;} +{if ("" != null) return PathFactory.pathOneOrMore1(p) ;} break; + } default: jj_la1[107] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Path PathPrimary() throws ParseException { - String str ; Path p ; Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Path PathPrimary() throws ParseException {String str ; Path p ; Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ str = iri(); - n = createNode(str) ; p = PathFactory.pathLink(n) ; +n = createNode(str) ; p = PathFactory.pathLink(n) ; break; - case KW_A: + } + case KW_A:{ jj_consume_token(KW_A); - p = PathFactory.pathLink(nRDFtype) ; +p = PathFactory.pathLink(nRDFtype) ; break; - case BANG: + } + case BANG:{ jj_consume_token(BANG); p = PathNegatedPropertySet(); break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); p = Path(); jj_consume_token(RPAREN); break; + } default: jj_la1[108] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return p ;} +{if ("" != null) return p ;} throw new Error("Missing return statement in function"); - } +} - final public Path PathNegatedPropertySet() throws ParseException { - P_Path0 p ; P_NegPropSet pNegSet ; - pNegSet = new P_NegPropSet() ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Path PathNegatedPropertySet() throws ParseException {P_Path0 p ; P_NegPropSet pNegSet ; +pNegSet = new P_NegPropSet() ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT: + case CARAT:{ p = PathOneInPropertySet(); - pNegSet.add(p) ; +pNegSet.add(p) ; break; - case LPAREN: + } + case LPAREN:{ jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: case KW_A: - case CARAT: + case CARAT:{ p = PathOneInPropertySet(); - pNegSet.add(p) ; +pNegSet.add(p) ; label_28: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case VBAR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VBAR:{ ; break; + } default: jj_la1[109] = jj_gen; break label_28; } jj_consume_token(VBAR); p = PathOneInPropertySet(); - pNegSet.add(p) ; +pNegSet.add(p) ; } break; + } default: jj_la1[110] = jj_gen; ; } jj_consume_token(RPAREN); break; + } default: jj_la1[111] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return pNegSet ;} +{if ("" != null) return pNegSet ;} throw new Error("Missing return statement in function"); - } +} - final public P_Path0 PathOneInPropertySet() throws ParseException { - String str ; Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public P_Path0 PathOneInPropertySet() throws ParseException {String str ; Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ str = iri(); - n = createNode(str) ; {if (true) return new P_Link(n) ;} +n = createNode(str) ; {if ("" != null) return new P_Link(n) ;} break; - case KW_A: + } + case KW_A:{ jj_consume_token(KW_A); - {if (true) return new P_Link(nRDFtype) ;} +{if ("" != null) return new P_Link(nRDFtype) ;} break; - case CARAT: + } + case CARAT:{ jj_consume_token(CARAT); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ str = iri(); - n = createNode(str) ; {if (true) return new P_ReverseLink(n) ;} +n = createNode(str) ; {if ("" != null) return new P_ReverseLink(n) ;} break; - case KW_A: + } + case KW_A:{ jj_consume_token(KW_A); - {if (true) return new P_ReverseLink(nRDFtype) ;} +{if ("" != null) return new P_ReverseLink(nRDFtype) ;} break; + } default: jj_la1[112] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; + } default: jj_la1[113] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public long Integer() throws ParseException { - Token t ; + final public long Integer() throws ParseException {Token t ; t = jj_consume_token(INTEGER); - {if (true) return integerValue(t.image) ;} +{if ("" != null) return integerValue(t.image) ;} throw new Error("Missing return statement in function"); - } +} - final public Node TriplesNode(TripleCollectorMark acc) throws ParseException { - Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ n = Collection(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; - case LBRACKET: + } + case LBRACKET:{ n = BlankNodePropertyList(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } default: jj_la1[114] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException { - Token t ; + final public Node BlankNodePropertyList(TripleCollector acc) throws ParseException {Token t ; t = jj_consume_token(LBRACKET); - Node n = createBNode( t.beginLine, t.beginColumn) ; +Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListNotEmpty(n, acc); jj_consume_token(RBRACKET); - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException { - Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ n = CollectionPath(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; - case LBRACKET: + } + case LBRACKET:{ n = BlankNodePropertyListPath(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } default: jj_la1[115] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException { - Token t ; + final public Node BlankNodePropertyListPath(TripleCollector acc) throws ParseException {Token t ; t = jj_consume_token(LBRACKET); - Node n = createBNode( t.beginLine, t.beginColumn) ; +Node n = createBNode( t.beginLine, t.beginColumn) ; PropertyListPathNotEmpty(n, acc); jj_consume_token(RBRACKET); - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Node Collection(TripleCollectorMark acc) throws ParseException { - Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node Collection(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_29: while (true) { - Node cell = createListNode( beginLine, beginColumn) ; +Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNode(acc); - insert(acc, mark, cell, nRDFfirst, n) ; +insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3092,37 +3198,37 @@ final public Node Collection(TripleCollectorMark acc) throws ParseException { case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ ; break; + } default: jj_la1[116] = jj_gen; break label_29; } } jj_consume_token(RPAREN); - if ( lastCell != null ) +if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if (true) return listHead ;} + {if ("" != null) return listHead ;} throw new Error("Missing return statement in function"); - } +} - final public Node CollectionPath(TripleCollectorMark acc) throws ParseException { - Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; + final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; t = jj_consume_token(LPAREN); - int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; +int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; label_30: while (true) { - Node cell = createListNode( beginLine, beginColumn) ; +Node cell = createListNode( beginLine, beginColumn) ; if ( listHead == nRDFnil ) listHead = cell ; if ( lastCell != null ) insert(acc, lastCell, nRDFrest, cell) ; mark = acc.mark() ; n = GraphNodePath(acc); - insert(acc, mark, cell, nRDFfirst, n) ; +insert(acc, mark, cell, nRDFfirst, n) ; lastCell = cell ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3147,24 +3253,24 @@ final public Node CollectionPath(TripleCollectorMark acc) throws ParseException case LPAREN: case NIL: case LBRACKET: - case ANON: + case ANON:{ ; break; + } default: jj_la1[117] = jj_gen; break label_30; } } jj_consume_token(RPAREN); - if ( lastCell != null ) +if ( lastCell != null ) insert(acc, lastCell, nRDFrest, nRDFnil) ; - {if (true) return listHead ;} + {if ("" != null) return listHead ;} throw new Error("Missing return statement in function"); - } +} - final public Node GraphNode(TripleCollectorMark acc) throws ParseException { - Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node GraphNode(TripleCollectorMark acc) throws ParseException {Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3187,26 +3293,27 @@ final public Node GraphNode(TripleCollectorMark acc) throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON: + case ANON:{ n = VarOrTerm(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case LPAREN: - case LBRACKET: + case LBRACKET:{ n = TriplesNode(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } default: jj_la1[118] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { - Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: case PNAME_LN: @@ -3229,30 +3336,32 @@ final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON: + case ANON:{ n = VarOrTerm(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case LPAREN: - case LBRACKET: + case LBRACKET:{ n = TriplesNodePath(acc); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } default: jj_la1[119] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node VarOrTerm() throws ParseException { - Node n = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node VarOrTerm() throws ParseException {Node n = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ n = Var(); break; + } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3273,100 +3382,106 @@ final public Node VarOrTerm() throws ParseException { case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: case NIL: - case ANON: + case ANON:{ n = GraphTerm(); break; + } default: jj_la1[120] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Node VarOrIri() throws ParseException { - Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node VarOrIri() throws ParseException {Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ n = Var(); break; + } case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = iri(); - n = createNode(iri) ; +n = createNode(iri) ; break; + } default: jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Node VarOrBlankNodeOrIri() throws ParseException { - Node n = null ; String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node VarOrBlankNodeOrIri() throws ParseException {Node n = null ; String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VAR1: - case VAR2: + case VAR2:{ n = Var(); break; + } case BLANK_NODE_LABEL: - case ANON: + case ANON:{ n = BlankNode(); break; + } case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = iri(); - n = createNode(iri) ; +n = createNode(iri) ; break; + } default: jj_la1[122] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Var Var() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case VAR1: + final public Var Var() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case VAR1:{ t = jj_consume_token(VAR1); break; - case VAR2: + } + case VAR2:{ t = jj_consume_token(VAR2); break; + } default: jj_la1[123] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return createVariable(t.image, t.beginLine, t.beginColumn) ;} +{if ("" != null) return createVariable(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); - } +} - final public Node GraphTerm() throws ParseException { - Node n ; String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node GraphTerm() throws ParseException {Node n ; String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = iri(); - {if (true) return createNode(iri) ;} +{if ("" != null) return createNode(iri) ;} break; + } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: + case STRING_LITERAL_LONG2:{ n = RDFLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case INTEGER: case DECIMAL: case DOUBLE: @@ -3375,92 +3490,93 @@ final public Node GraphTerm() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: + case DOUBLE_NEGATIVE:{ n = NumericLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case TRUE: - case FALSE: + case FALSE:{ n = BooleanLiteral(); - {if (true) return n ;} +{if ("" != null) return n ;} break; + } case BLANK_NODE_LABEL: - case ANON: + case ANON:{ n = BlankNode(); - {if (true) return n ;} +{if ("" != null) return n ;} break; - case NIL: + } + case NIL:{ jj_consume_token(NIL); - {if (true) return nRDFnil ;} +{if ("" != null) return nRDFnil ;} break; + } default: jj_la1[124] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Expr Expression() throws ParseException { - Expr expr ; + final public Expr Expression() throws ParseException {Expr expr ; expr = ConditionalOrExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} throw new Error("Missing return statement in function"); - } +} - final public Expr ConditionalOrExpression() throws ParseException { - Expr expr1, expr2 ; + final public Expr ConditionalOrExpression() throws ParseException {Expr expr1, expr2 ; expr1 = ConditionalAndExpression(); label_31: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SC_OR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SC_OR:{ ; break; + } default: jj_la1[125] = jj_gen; break label_31; } jj_consume_token(SC_OR); expr2 = ConditionalAndExpression(); - expr1 = new E_LogicalOr(expr1, expr2) ; +expr1 = new E_LogicalOr(expr1, expr2) ; } - {if (true) return expr1 ;} +{if ("" != null) return expr1 ;} throw new Error("Missing return statement in function"); - } +} - final public Expr ConditionalAndExpression() throws ParseException { - Expr expr1, expr2 ; + final public Expr ConditionalAndExpression() throws ParseException {Expr expr1, expr2 ; expr1 = ValueLogical(); label_32: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SC_AND: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SC_AND:{ ; break; + } default: jj_la1[126] = jj_gen; break label_32; } jj_consume_token(SC_AND); expr2 = ValueLogical(); - expr1 = new E_LogicalAnd(expr1, expr2) ; +expr1 = new E_LogicalAnd(expr1, expr2) ; } - {if (true) return expr1 ;} +{if ("" != null) return expr1 ;} throw new Error("Missing return statement in function"); - } +} - final public Expr ValueLogical() throws ParseException { - Expr expr ; + final public Expr ValueLogical() throws ParseException {Expr expr ; expr = RelationalExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} throw new Error("Missing return statement in function"); - } +} - final public Expr RelationalExpression() throws ParseException { - Expr expr1, expr2 ; ExprList a ; + final public Expr RelationalExpression() throws ParseException {Expr expr1, expr2 ; ExprList a ; expr1 = NumericExpression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT: case IN: case EQ: @@ -3468,76 +3584,83 @@ final public Expr RelationalExpression() throws ParseException { case GT: case LT: case LE: - case GE: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case EQ: + case GE:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case EQ:{ jj_consume_token(EQ); expr2 = NumericExpression(); - expr1 = new E_Equals(expr1, expr2) ; +expr1 = new E_Equals(expr1, expr2) ; break; - case NE: + } + case NE:{ jj_consume_token(NE); expr2 = NumericExpression(); - expr1 = new E_NotEquals(expr1, expr2) ; +expr1 = new E_NotEquals(expr1, expr2) ; break; - case LT: + } + case LT:{ jj_consume_token(LT); expr2 = NumericExpression(); - expr1 = new E_LessThan(expr1, expr2) ; +expr1 = new E_LessThan(expr1, expr2) ; break; - case GT: + } + case GT:{ jj_consume_token(GT); expr2 = NumericExpression(); - expr1 = new E_GreaterThan(expr1, expr2) ; +expr1 = new E_GreaterThan(expr1, expr2) ; break; - case LE: + } + case LE:{ jj_consume_token(LE); expr2 = NumericExpression(); - expr1 = new E_LessThanOrEqual(expr1, expr2) ; +expr1 = new E_LessThanOrEqual(expr1, expr2) ; break; - case GE: + } + case GE:{ jj_consume_token(GE); expr2 = NumericExpression(); - expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; +expr1 = new E_GreaterThanOrEqual(expr1, expr2) ; break; - case IN: + } + case IN:{ jj_consume_token(IN); a = ExpressionList(); - expr1 = new E_OneOf(expr1, a) ; +expr1 = new E_OneOf(expr1, a) ; break; - case NOT: + } + case NOT:{ jj_consume_token(NOT); jj_consume_token(IN); a = ExpressionList(); - expr1 = new E_NotOneOf(expr1, a) ; +expr1 = new E_NotOneOf(expr1, a) ; break; + } default: jj_la1[127] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; + } default: jj_la1[128] = jj_gen; ; } - {if (true) return expr1 ;} +{if ("" != null) return expr1 ;} throw new Error("Missing return statement in function"); - } +} - final public Expr NumericExpression() throws ParseException { - Expr expr ; + final public Expr NumericExpression() throws ParseException {Expr expr ; expr = AdditiveExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} throw new Error("Missing return statement in function"); - } +} - final public Expr AdditiveExpression() throws ParseException { - Expr expr1, expr2, expr3 ; boolean addition ; Node n ; + final public Expr AdditiveExpression() throws ParseException {Expr expr1, expr2, expr3 ; boolean addition ; Node n ; expr1 = MultiplicativeExpression(); label_33: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: @@ -3545,47 +3668,52 @@ final public Expr AdditiveExpression() throws ParseException { case DECIMAL_NEGATIVE: case DOUBLE_NEGATIVE: case PLUS: - case MINUS: + case MINUS:{ ; break; + } default: jj_la1[129] = jj_gen; break label_33; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case PLUS:{ jj_consume_token(PLUS); expr2 = MultiplicativeExpression(); - expr1 = new E_Add(expr1, expr2) ; +expr1 = new E_Add(expr1, expr2) ; break; - case MINUS: + } + case MINUS:{ jj_consume_token(MINUS); expr2 = MultiplicativeExpression(); - expr1 = new E_Subtract(expr1, expr2) ; +expr1 = new E_Subtract(expr1, expr2) ; break; + } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOUBLE_NEGATIVE:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE: + case DOUBLE_POSITIVE:{ n = NumericLiteralPositive(); - n = stripSign(n) ; +n = stripSign(n) ; expr2 = asExpr(n) ; addition = true ; break; + } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: + case DOUBLE_NEGATIVE:{ n = NumericLiteralNegative(); - n = stripSign(n) ; +n = stripSign(n) ; expr2 = asExpr(n) ; addition = false ; break; + } default: jj_la1[130] = jj_gen; jj_consume_token(-1); @@ -3593,100 +3721,108 @@ final public Expr AdditiveExpression() throws ParseException { } label_34: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case STAR: - case SLASH: + case SLASH:{ ; break; + } default: jj_la1[131] = jj_gen; break label_34; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STAR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case STAR:{ jj_consume_token(STAR); expr3 = UnaryExpression(); - expr2 = new E_Multiply(expr2, expr3) ; +expr2 = new E_Multiply(expr2, expr3) ; break; - case SLASH: + } + case SLASH:{ jj_consume_token(SLASH); expr3 = UnaryExpression(); - expr2 = new E_Divide(expr2, expr3) ; +expr2 = new E_Divide(expr2, expr3) ; break; + } default: jj_la1[132] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } - if ( addition ) +if ( addition ) expr1 = new E_Add(expr1, expr2) ; else expr1 = new E_Subtract(expr1, expr2) ; break; + } default: jj_la1[133] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } - {if (true) return expr1 ;} +{if ("" != null) return expr1 ;} throw new Error("Missing return statement in function"); - } +} - final public Expr MultiplicativeExpression() throws ParseException { - Expr expr1, expr2 ; + final public Expr MultiplicativeExpression() throws ParseException {Expr expr1, expr2 ; expr1 = UnaryExpression(); label_35: while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case STAR: - case SLASH: + case SLASH:{ ; break; + } default: jj_la1[134] = jj_gen; break label_35; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STAR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case STAR:{ jj_consume_token(STAR); expr2 = UnaryExpression(); - expr1 = new E_Multiply(expr1, expr2) ; +expr1 = new E_Multiply(expr1, expr2) ; break; - case SLASH: + } + case SLASH:{ jj_consume_token(SLASH); expr2 = UnaryExpression(); - expr1 = new E_Divide(expr1, expr2) ; +expr1 = new E_Divide(expr1, expr2) ; break; + } default: jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } - {if (true) return expr1 ;} +{if ("" != null) return expr1 ;} throw new Error("Missing return statement in function"); - } +} - final public Expr UnaryExpression() throws ParseException { - Expr expr ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BANG: + final public Expr UnaryExpression() throws ParseException {Expr expr ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BANG:{ jj_consume_token(BANG); expr = PrimaryExpression(); - {if (true) return new E_LogicalNot(expr) ;} +{if ("" != null) return new E_LogicalNot(expr) ;} break; - case PLUS: + } + case PLUS:{ jj_consume_token(PLUS); expr = PrimaryExpression(); - {if (true) return new E_UnaryPlus(expr) ;} +{if ("" != null) return new E_UnaryPlus(expr) ;} break; - case MINUS: + } + case MINUS:{ jj_consume_token(MINUS); expr = PrimaryExpression(); - {if (true) return new E_UnaryMinus(expr) ;} +{if ("" != null) return new E_UnaryMinus(expr) ;} break; + } case IRIref: case PNAME_NS: case PNAME_LN: @@ -3768,25 +3904,26 @@ final public Expr UnaryExpression() throws ParseException { case STRING_LITERAL2: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: - case LPAREN: + case LPAREN:{ expr = PrimaryExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; + } default: jj_la1[136] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Expr PrimaryExpression() throws ParseException { - Expr expr ; Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + final public Expr PrimaryExpression() throws ParseException {Expr expr ; Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ expr = BrackettedExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; + } case EXISTS: case NOT: case COUNT: @@ -3847,23 +3984,26 @@ final public Expr PrimaryExpression() throws ParseException { case SHA1: case SHA256: case SHA384: - case SHA512: + case SHA512:{ expr = BuiltInCall(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; + } case IRIref: case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ expr = iriOrFunction(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; + } case STRING_LITERAL1: case STRING_LITERAL2: case STRING_LITERAL_LONG1: - case STRING_LITERAL_LONG2: + case STRING_LITERAL_LONG2:{ n = RDFLiteral(); - {if (true) return asExpr(n) ;} +{if ("" != null) return asExpr(n) ;} break; + } case INTEGER: case DECIMAL: case DOUBLE: @@ -3872,353 +4012,399 @@ final public Expr PrimaryExpression() throws ParseException { case DOUBLE_POSITIVE: case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: + case DOUBLE_NEGATIVE:{ n = NumericLiteral(); - {if (true) return asExpr(n) ;} +{if ("" != null) return asExpr(n) ;} break; + } case TRUE: - case FALSE: + case FALSE:{ n = BooleanLiteral(); - {if (true) return asExpr(n) ;} +{if ("" != null) return asExpr(n) ;} break; + } case VAR1: - case VAR2: + case VAR2:{ n = Var(); - {if (true) return asExpr(n) ;} +{if ("" != null) return asExpr(n) ;} break; + } default: jj_la1[137] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Expr BrackettedExpression() throws ParseException { - Expr expr ; + final public Expr BrackettedExpression() throws ParseException {Expr expr ; jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return expr ;} +{if ("" != null) return expr ;} throw new Error("Missing return statement in function"); - } +} - final public Expr BuiltInCall() throws ParseException { - Expr expr ; + final public Expr BuiltInCall() throws ParseException {Expr expr ; Expr expr1 = null ; Expr expr2 = null ; Expr expr3 = null ; Node gn ; ExprList a ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COUNT: case MIN: case MAX: case SUM: case AVG: case SAMPLE: - case GROUP_CONCAT: + case GROUP_CONCAT:{ expr = Aggregate(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; - case STR: + } + case STR:{ jj_consume_token(STR); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_Str(expr) ;} +{if ("" != null) return new E_Str(expr) ;} break; - case LANG: + } + case LANG:{ jj_consume_token(LANG); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_Lang(expr) ;} +{if ("" != null) return new E_Lang(expr) ;} break; - case LANGMATCHES: + } + case LANGMATCHES:{ jj_consume_token(LANGMATCHES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_LangMatches(expr1, expr2) ;} +{if ("" != null) return new E_LangMatches(expr1, expr2) ;} break; - case DTYPE: + } + case DTYPE:{ jj_consume_token(DTYPE); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_Datatype(expr) ;} +{if ("" != null) return new E_Datatype(expr) ;} break; - case BOUND: + } + case BOUND:{ jj_consume_token(BOUND); jj_consume_token(LPAREN); gn = Var(); jj_consume_token(RPAREN); - {if (true) return new E_Bound(new ExprVar(gn)) ;} +{if ("" != null) return new E_Bound(new ExprVar(gn)) ;} break; - case IRI: + } + case IRI:{ jj_consume_token(IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return makeFunction_IRI(expr) ;} +{if ("" != null) return makeFunction_IRI(expr) ;} break; - case URI: + } + case URI:{ jj_consume_token(URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return makeFunction_URI(expr) ;} +{if ("" != null) return makeFunction_URI(expr) ;} break; - case BNODE: + } + case BNODE:{ jj_consume_token(BNODE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LPAREN: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LPAREN:{ jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); {if ("" != null) return makeFunction_BNode(expr1) ;} break; - case NIL: + } + case NIL:{ jj_consume_token(NIL); {if ("" != null) return makeFunction_BNode() ;} break; + } default: jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; - case RAND: + } + case RAND:{ jj_consume_token(RAND); jj_consume_token(NIL); - {if (true) return new E_Random() ;} +{if ("" != null) return new E_Random() ;} break; - case ABS: + } + case ABS:{ jj_consume_token(ABS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_NumAbs(expr1) ;} +{if ("" != null) return new E_NumAbs(expr1) ;} break; - case CEIL: + } + case CEIL:{ jj_consume_token(CEIL); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_NumCeiling(expr1) ;} +{if ("" != null) return new E_NumCeiling(expr1) ;} break; - case FLOOR: + } + case FLOOR:{ jj_consume_token(FLOOR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_NumFloor(expr1) ;} +{if ("" != null) return new E_NumFloor(expr1) ;} break; - case ROUND: + } + case ROUND:{ jj_consume_token(ROUND); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_NumRound(expr1) ;} +{if ("" != null) return new E_NumRound(expr1) ;} break; - case CONCAT: + } + case CONCAT:{ jj_consume_token(CONCAT); a = ExpressionList(); - {if (true) return new E_StrConcat(a) ;} +{if ("" != null) return new E_StrConcat(a) ;} break; - case SUBSTR: + } + case SUBSTR:{ expr = SubstringExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; - case STRLEN: + } + case STRLEN:{ jj_consume_token(STRLEN); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrLength(expr1) ;} +{if ("" != null) return new E_StrLength(expr1) ;} break; - case REPLACE: + } + case REPLACE:{ expr = StrReplaceExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; - case UCASE: + } + case UCASE:{ jj_consume_token(UCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrUpperCase(expr1) ;} +{if ("" != null) return new E_StrUpperCase(expr1) ;} break; - case LCASE: + } + case LCASE:{ jj_consume_token(LCASE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrLowerCase(expr1) ;} +{if ("" != null) return new E_StrLowerCase(expr1) ;} break; - case ENCODE_FOR_URI: + } + case ENCODE_FOR_URI:{ jj_consume_token(ENCODE_FOR_URI); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrEncodeForURI(expr1) ;} +{if ("" != null) return new E_StrEncodeForURI(expr1) ;} break; - case CONTAINS: + } + case CONTAINS:{ jj_consume_token(CONTAINS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrContains(expr1, expr2) ;} +{if ("" != null) return new E_StrContains(expr1, expr2) ;} break; - case STRSTARTS: + } + case STRSTARTS:{ jj_consume_token(STRSTARTS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrStartsWith(expr1, expr2) ;} +{if ("" != null) return new E_StrStartsWith(expr1, expr2) ;} break; - case STRENDS: + } + case STRENDS:{ jj_consume_token(STRENDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrEndsWith(expr1, expr2) ;} +{if ("" != null) return new E_StrEndsWith(expr1, expr2) ;} break; - case STRBEFORE: + } + case STRBEFORE:{ jj_consume_token(STRBEFORE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrBefore(expr1, expr2) ;} +{if ("" != null) return new E_StrBefore(expr1, expr2) ;} break; - case STRAFTER: + } + case STRAFTER:{ jj_consume_token(STRAFTER); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrAfter(expr1, expr2) ;} +{if ("" != null) return new E_StrAfter(expr1, expr2) ;} break; - case YEAR: + } + case YEAR:{ jj_consume_token(YEAR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeYear(expr1) ;} +{if ("" != null) return new E_DateTimeYear(expr1) ;} break; - case MONTH: + } + case MONTH:{ jj_consume_token(MONTH); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeMonth(expr1) ;} +{if ("" != null) return new E_DateTimeMonth(expr1) ;} break; - case DAY: + } + case DAY:{ jj_consume_token(DAY); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeDay(expr1) ;} +{if ("" != null) return new E_DateTimeDay(expr1) ;} break; - case HOURS: + } + case HOURS:{ jj_consume_token(HOURS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeHours(expr1) ;} +{if ("" != null) return new E_DateTimeHours(expr1) ;} break; - case MINUTES: + } + case MINUTES:{ jj_consume_token(MINUTES); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeMinutes(expr1) ;} +{if ("" != null) return new E_DateTimeMinutes(expr1) ;} break; - case SECONDS: + } + case SECONDS:{ jj_consume_token(SECONDS); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeSeconds(expr1) ;} +{if ("" != null) return new E_DateTimeSeconds(expr1) ;} break; - case TIMEZONE: + } + case TIMEZONE:{ jj_consume_token(TIMEZONE); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeTimezone(expr1) ;} +{if ("" != null) return new E_DateTimeTimezone(expr1) ;} break; - case TZ: + } + case TZ:{ jj_consume_token(TZ); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_DateTimeTZ(expr1) ;} +{if ("" != null) return new E_DateTimeTZ(expr1) ;} break; - case NOW: + } + case NOW:{ jj_consume_token(NOW); jj_consume_token(NIL); - {if (true) return new E_Now() ;} +{if ("" != null) return new E_Now() ;} break; - case UUID: + } + case UUID:{ jj_consume_token(UUID); jj_consume_token(NIL); - {if (true) return new E_UUID() ;} +{if ("" != null) return new E_UUID() ;} break; - case STRUUID: + } + case STRUUID:{ jj_consume_token(STRUUID); jj_consume_token(NIL); - {if (true) return new E_StrUUID() ;} +{if ("" != null) return new E_StrUUID() ;} break; - case MD5: + } + case MD5:{ jj_consume_token(MD5); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_MD5(expr1) ;} +{if ("" != null) return new E_MD5(expr1) ;} break; - case SHA1: + } + case SHA1:{ jj_consume_token(SHA1); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_SHA1(expr1) ;} +{if ("" != null) return new E_SHA1(expr1) ;} break; - case SHA256: + } + case SHA256:{ jj_consume_token(SHA256); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_SHA256(expr1) ;} +{if ("" != null) return new E_SHA256(expr1) ;} break; - case SHA384: + } + case SHA384:{ jj_consume_token(SHA384); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_SHA384(expr1) ;} +{if ("" != null) return new E_SHA384(expr1) ;} break; - case SHA512: + } + case SHA512:{ jj_consume_token(SHA512); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_SHA512(expr1) ;} +{if ("" != null) return new E_SHA512(expr1) ;} break; - case COALESCE: + } + case COALESCE:{ jj_consume_token(COALESCE); a = ExpressionList(); - {if (true) return new E_Coalesce(a) ;} +{if ("" != null) return new E_Coalesce(a) ;} break; - case IF: + } + case IF:{ jj_consume_token(IF); jj_consume_token(LPAREN); expr = Expression(); @@ -4227,134 +4413,145 @@ final public Expr BuiltInCall() throws ParseException { jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_Conditional(expr, expr1, expr2) ;} +{if ("" != null) return new E_Conditional(expr, expr1, expr2) ;} break; - case STRLANG: + } + case STRLANG:{ jj_consume_token(STRLANG); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrLang(expr1, expr2) ;} +{if ("" != null) return new E_StrLang(expr1, expr2) ;} break; - case STRDT: + } + case STRDT:{ jj_consume_token(STRDT); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_StrDatatype(expr1, expr2) ;} +{if ("" != null) return new E_StrDatatype(expr1, expr2) ;} break; - case SAME_TERM: + } + case SAME_TERM:{ jj_consume_token(SAME_TERM); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_SameTerm(expr1, expr2) ;} +{if ("" != null) return new E_SameTerm(expr1, expr2) ;} break; - case IS_IRI: + } + case IS_IRI:{ jj_consume_token(IS_IRI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_IsIRI(expr) ;} +{if ("" != null) return new E_IsIRI(expr) ;} break; - case IS_URI: + } + case IS_URI:{ jj_consume_token(IS_URI); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_IsURI(expr) ;} +{if ("" != null) return new E_IsURI(expr) ;} break; - case IS_BLANK: + } + case IS_BLANK:{ jj_consume_token(IS_BLANK); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_IsBlank(expr) ;} +{if ("" != null) return new E_IsBlank(expr) ;} break; - case IS_LITERAL: + } + case IS_LITERAL:{ jj_consume_token(IS_LITERAL); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_IsLiteral(expr) ;} +{if ("" != null) return new E_IsLiteral(expr) ;} break; - case IS_NUMERIC: + } + case IS_NUMERIC:{ jj_consume_token(IS_NUMERIC); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(RPAREN); - {if (true) return new E_IsNumeric(expr) ;} +{if ("" != null) return new E_IsNumeric(expr) ;} break; - case REGEX: + } + case REGEX:{ expr = RegexExpression(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; - case EXISTS: + } + case EXISTS:{ expr = ExistsFunc(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; - case NOT: + } + case NOT:{ expr = NotExistsFunc(); - {if (true) return expr ;} +{if ("" != null) return expr ;} break; + } default: jj_la1[139] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Expr RegexExpression() throws ParseException { - Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; + final public Expr RegexExpression() throws ParseException {Expr expr ; Expr patExpr = null ; Expr flagsExpr = null ; jj_consume_token(REGEX); jj_consume_token(LPAREN); expr = Expression(); jj_consume_token(COMMA); patExpr = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ jj_consume_token(COMMA); flagsExpr = Expression(); break; + } default: jj_la1[140] = jj_gen; ; } jj_consume_token(RPAREN); - {if (true) return new E_Regex(expr, patExpr, flagsExpr) ;} +{if ("" != null) return new E_Regex(expr, patExpr, flagsExpr) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr SubstringExpression() throws ParseException { - Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; + final public Expr SubstringExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; jj_consume_token(SUBSTR); jj_consume_token(LPAREN); expr1 = Expression(); jj_consume_token(COMMA); expr2 = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ jj_consume_token(COMMA); expr3 = Expression(); break; + } default: jj_la1[141] = jj_gen; ; } jj_consume_token(RPAREN); - {if (true) return new E_StrSubstring(expr1, expr2, expr3) ;} +{if ("" != null) return new E_StrSubstring(expr1, expr2, expr3) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr StrReplaceExpression() throws ParseException { - Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; + final public Expr StrReplaceExpression() throws ParseException {Expr expr1 ; Expr expr2 = null ; Expr expr3 = null ; Expr expr4 = null ; jj_consume_token(REPLACE); jj_consume_token(LPAREN); expr1 = Expression(); @@ -4362,61 +4559,61 @@ final public Expr StrReplaceExpression() throws ParseException { expr2 = Expression(); jj_consume_token(COMMA); expr3 = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COMMA:{ jj_consume_token(COMMA); expr4 = Expression(); break; + } default: jj_la1[142] = jj_gen; ; } jj_consume_token(RPAREN); - {if (true) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} +{if ("" != null) return new E_StrReplace(expr1,expr2,expr3,expr4) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr ExistsFunc() throws ParseException { - Element el ; + final public Expr ExistsFunc() throws ParseException {Element el ; jj_consume_token(EXISTS); el = GroupGraphPattern(); - {if (true) return createExprExists(el) ;} +{if ("" != null) return createExprExists(el) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr NotExistsFunc() throws ParseException { - Element el ; + final public Expr NotExistsFunc() throws ParseException {Element el ; jj_consume_token(NOT); jj_consume_token(EXISTS); el = GroupGraphPattern(); - {if (true) return createExprNotExists(el) ;} +{if ("" != null) return createExprNotExists(el) ;} throw new Error("Missing return statement in function"); - } +} - final public Expr Aggregate() throws ParseException { - Aggregator agg = null ; String sep = null ; + final public Expr Aggregate() throws ParseException {Aggregator agg = null ; String sep = null ; Expr expr = null ; Expr expr2 = null ; boolean distinct = false ; ExprList ordered = new ExprList() ; Token t ; - startAggregate(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COUNT: +startAggregate(); + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case COUNT:{ t = jj_consume_token(COUNT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[143] = jj_gen; ; } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STAR: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case STAR:{ jj_consume_token(STAR); break; + } case IRIref: case PNAME_NS: case PNAME_LN: @@ -4501,403 +4698,435 @@ final public Expr Aggregate() throws ParseException { case LPAREN: case BANG: case PLUS: - case MINUS: + case MINUS:{ expr = Expression(); break; + } default: jj_la1[144] = jj_gen; jj_consume_token(-1); throw new ParseException(); } jj_consume_token(RPAREN); - if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } +if ( expr == null ) { agg = AggregatorFactory.createCount(distinct) ; } if ( expr != null ) { agg = AggregatorFactory.createCountExpr(distinct, expr) ; } break; - case SUM: + } + case SUM:{ t = jj_consume_token(SUM); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[145] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); - agg = AggregatorFactory.createSum(distinct, expr) ; +agg = AggregatorFactory.createSum(distinct, expr) ; break; - case MIN: + } + case MIN:{ t = jj_consume_token(MIN); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[146] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); - agg = AggregatorFactory.createMin(distinct, expr) ; +agg = AggregatorFactory.createMin(distinct, expr) ; break; - case MAX: + } + case MAX:{ t = jj_consume_token(MAX); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[147] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); - agg = AggregatorFactory.createMax(distinct, expr) ; +agg = AggregatorFactory.createMax(distinct, expr) ; break; - case AVG: + } + case AVG:{ t = jj_consume_token(AVG); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[148] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); - agg = AggregatorFactory.createAvg(distinct, expr) ; +agg = AggregatorFactory.createAvg(distinct, expr) ; break; - case SAMPLE: + } + case SAMPLE:{ t = jj_consume_token(SAMPLE); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[149] = jj_gen; ; } expr = Expression(); jj_consume_token(RPAREN); - agg = AggregatorFactory.createSample(distinct, expr) ; +agg = AggregatorFactory.createSample(distinct, expr) ; break; - case GROUP_CONCAT: + } + case GROUP_CONCAT:{ t = jj_consume_token(GROUP_CONCAT); jj_consume_token(LPAREN); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DISTINCT: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case DISTINCT:{ t = jj_consume_token(DISTINCT); - distinct = true ; +distinct = true ; break; + } default: jj_la1[150] = jj_gen; ; } expr = Expression(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SEMICOLON: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case SEMICOLON:{ jj_consume_token(SEMICOLON); jj_consume_token(SEPARATOR); jj_consume_token(EQ); sep = String(); break; + } default: jj_la1[151] = jj_gen; ; } jj_consume_token(RPAREN); - agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; +agg = AggregatorFactory.createGroupConcat(distinct, expr, sep, ordered) ; break; + } default: jj_la1[152] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - if ( ! getAllowAggregatesInExpressions() ) +if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point", t.beginLine, t.beginColumn) ; if ( getAggregateDepth() > 1 ) throwParseException("Nested aggregate in expression not legal", t.beginLine, t.beginColumn) ; - Expr exprAgg = getQuery().allocAggregate(agg) ; +Expr exprAgg = getQuery().allocAggregate(agg) ; finishAggregate(); - {if (true) return exprAgg ;} + {if ("" != null) return exprAgg ;} throw new Error("Missing return statement in function"); - } +} - final public Expr iriOrFunction() throws ParseException { - String iri ; Args a = null ; + final public Expr iriOrFunction() throws ParseException {String iri ; Args a = null ; iri = iri(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN: - case NIL: + case NIL:{ a = ArgList(); break; + } default: jj_la1[153] = jj_gen; ; } - if ( a == null ) - {if (true) return asExpr(createNode(iri)) ;} +if ( a == null ) + {if ("" != null) return asExpr(createNode(iri)) ;} if ( AggregateRegistry.isRegistered(iri) ) { if ( ! getAllowAggregatesInExpressions() ) throwParseException("Aggregate expression not legal at this point : "+iri, -1, -1) ; Aggregator agg = AggregatorFactory.createCustom(iri, a) ; Expr exprAgg = getQuery().allocAggregate(agg) ; - {if (true) return exprAgg ;} + {if ("" != null) return exprAgg ;} } - {if (true) return new E_Function(iri, a) ;} + {if ("" != null) return new E_Function(iri, a) ;} throw new Error("Missing return statement in function"); - } +} - final public Node RDFLiteral() throws ParseException { - Token t ; String lex = null ; + final public Node RDFLiteral() throws ParseException {Token t ; String lex = null ; lex = String(); - String lang = null ; String uri = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { +String lang = null ; String uri = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LANGTAG: - case DATATYPE: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LANGTAG: + case DATATYPE:{ + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case LANGTAG:{ t = jj_consume_token(LANGTAG); - lang = stripChars(t.image, 1) ; +lang = stripChars(t.image, 1) ; break; - case DATATYPE: + } + case DATATYPE:{ jj_consume_token(DATATYPE); uri = iri(); break; + } default: jj_la1[154] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; + } default: jj_la1[155] = jj_gen; ; } - {if (true) return createLiteral(lex, lang, uri) ;} +{if ("" != null) return createLiteral(lex, lang, uri) ;} throw new Error("Missing return statement in function"); - } +} - final public Node NumericLiteral() throws ParseException { - Node n ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + final public Node NumericLiteral() throws ParseException {Node n ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INTEGER: case DECIMAL: - case DOUBLE: + case DOUBLE:{ n = NumericLiteralUnsigned(); break; + } case INTEGER_POSITIVE: case DECIMAL_POSITIVE: - case DOUBLE_POSITIVE: + case DOUBLE_POSITIVE:{ n = NumericLiteralPositive(); break; + } case INTEGER_NEGATIVE: case DECIMAL_NEGATIVE: - case DOUBLE_NEGATIVE: + case DOUBLE_NEGATIVE:{ n = NumericLiteralNegative(); break; + } default: jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - {if (true) return n ;} +{if ("" != null) return n ;} throw new Error("Missing return statement in function"); - } +} - final public Node NumericLiteralUnsigned() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER: + final public Node NumericLiteralUnsigned() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INTEGER:{ t = jj_consume_token(INTEGER); - {if (true) return createLiteralInteger(t.image) ;} +{if ("" != null) return createLiteralInteger(t.image) ;} break; - case DECIMAL: + } + case DECIMAL:{ t = jj_consume_token(DECIMAL); - {if (true) return createLiteralDecimal(t.image) ;} +{if ("" != null) return createLiteralDecimal(t.image) ;} break; - case DOUBLE: + } + case DOUBLE:{ t = jj_consume_token(DOUBLE); - {if (true) return createLiteralDouble(t.image) ;} +{if ("" != null) return createLiteralDouble(t.image) ;} break; + } default: jj_la1[157] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node NumericLiteralPositive() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER_POSITIVE: + final public Node NumericLiteralPositive() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INTEGER_POSITIVE:{ t = jj_consume_token(INTEGER_POSITIVE); - {if (true) return createLiteralInteger(t.image) ;} +{if ("" != null) return createLiteralInteger(t.image) ;} break; - case DECIMAL_POSITIVE: + } + case DECIMAL_POSITIVE:{ t = jj_consume_token(DECIMAL_POSITIVE); - {if (true) return createLiteralDecimal(t.image) ;} +{if ("" != null) return createLiteralDecimal(t.image) ;} break; - case DOUBLE_POSITIVE: + } + case DOUBLE_POSITIVE:{ t = jj_consume_token(DOUBLE_POSITIVE); - {if (true) return createLiteralDouble(t.image) ;} +{if ("" != null) return createLiteralDouble(t.image) ;} break; + } default: jj_la1[158] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node NumericLiteralNegative() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER_NEGATIVE: + final public Node NumericLiteralNegative() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case INTEGER_NEGATIVE:{ t = jj_consume_token(INTEGER_NEGATIVE); - {if (true) return createLiteralInteger(t.image) ;} +{if ("" != null) return createLiteralInteger(t.image) ;} break; - case DECIMAL_NEGATIVE: + } + case DECIMAL_NEGATIVE:{ t = jj_consume_token(DECIMAL_NEGATIVE); - {if (true) return createLiteralDecimal(t.image) ;} +{if ("" != null) return createLiteralDecimal(t.image) ;} break; - case DOUBLE_NEGATIVE: + } + case DOUBLE_NEGATIVE:{ t = jj_consume_token(DOUBLE_NEGATIVE); - {if (true) return createLiteralDouble(t.image) ;} +{if ("" != null) return createLiteralDouble(t.image) ;} break; + } default: jj_la1[159] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} final public Node BooleanLiteral() throws ParseException { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TRUE: + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case TRUE:{ jj_consume_token(TRUE); - {if (true) return XSD_TRUE ;} +{if ("" != null) return XSD_TRUE ;} break; - case FALSE: + } + case FALSE:{ jj_consume_token(FALSE); - {if (true) return XSD_FALSE ;} +{if ("" != null) return XSD_FALSE ;} break; + } default: jj_la1[160] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public String String() throws ParseException { - Token t ; String lex ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STRING_LITERAL1: + final public String String() throws ParseException {Token t ; String lex ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case STRING_LITERAL1:{ t = jj_consume_token(STRING_LITERAL1); - lex = stripQuotes(t.image) ; +lex = stripQuotes(t.image) ; break; - case STRING_LITERAL2: + } + case STRING_LITERAL2:{ t = jj_consume_token(STRING_LITERAL2); - lex = stripQuotes(t.image) ; +lex = stripQuotes(t.image) ; break; - case STRING_LITERAL_LONG1: + } + case STRING_LITERAL_LONG1:{ t = jj_consume_token(STRING_LITERAL_LONG1); - lex = stripQuotes3(t.image) ; +lex = stripQuotes3(t.image) ; break; - case STRING_LITERAL_LONG2: + } + case STRING_LITERAL_LONG2:{ t = jj_consume_token(STRING_LITERAL_LONG2); - lex = stripQuotes3(t.image) ; +lex = stripQuotes3(t.image) ; break; + } default: jj_la1[161] = jj_gen; jj_consume_token(-1); throw new ParseException(); } - checkString(lex, t.beginLine, t.beginColumn) ; +checkString(lex, t.beginLine, t.beginColumn) ; lex = unescapeStr(lex, t.beginLine, t.beginColumn) ; - {if (true) return lex ;} + {if ("" != null) return lex ;} throw new Error("Missing return statement in function"); - } +} - final public String iri() throws ParseException { - String iri ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case IRIref: + final public String iri() throws ParseException {String iri ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case IRIref:{ iri = IRIREF(); - {if (true) return iri ;} +{if ("" != null) return iri ;} break; + } case PNAME_NS: - case PNAME_LN: + case PNAME_LN:{ iri = PrefixedName(); - {if (true) return iri ;} +{if ("" != null) return iri ;} break; + } default: jj_la1[162] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public String PrefixedName() throws ParseException { - Token t ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PNAME_LN: + final public String PrefixedName() throws ParseException {Token t ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case PNAME_LN:{ t = jj_consume_token(PNAME_LN); - {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} +{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; - case PNAME_NS: + } + case PNAME_NS:{ t = jj_consume_token(PNAME_NS); - {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} +{if ("" != null) return resolvePName(t.image, t.beginLine, t.beginColumn) ;} break; + } default: jj_la1[163] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public Node BlankNode() throws ParseException { - Token t = null ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BLANK_NODE_LABEL: + final public Node BlankNode() throws ParseException {Token t = null ; + switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { + case BLANK_NODE_LABEL:{ t = jj_consume_token(BLANK_NODE_LABEL); - {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;} +{if ("" != null) return createBNode(t.image, t.beginLine, t.beginColumn) ;} break; - case ANON: + } + case ANON:{ t = jj_consume_token(ANON); - {if (true) return createBNode(t.beginLine, t.beginColumn) ;} +{if ("" != null) return createBNode(t.beginLine, t.beginColumn) ;} break; + } default: jj_la1[164] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); - } +} - final public String IRIREF() throws ParseException { - Token t ; + final public String IRIREF() throws ParseException {Token t ; t = jj_consume_token(IRIref); - {if (true) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} +{if ("" != null) return resolveQuotedIRI(t.image, t.beginLine, t.beginColumn) ;} throw new Error("Missing return statement in function"); - } +} /** Generated Token Manager. */ public SPARQLParser11TokenManager token_source; @@ -4917,141 +5146,149 @@ final public String IRIREF() throws ParseException { static private int[] jj_la1_5; static private int[] jj_la1_6; static { - jj_la1_init_0(); - jj_la1_init_1(); - jj_la1_init_2(); - jj_la1_init_3(); - jj_la1_init_4(); - jj_la1_init_5(); - jj_la1_init_6(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; - } - private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_4() { - jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_init_5() { - jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; - } - private static void jj_la1_init_6() { - jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + jj_la1_init_3(); + jj_la1_init_4(); + jj_la1_init_5(); + jj_la1_init_6(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0xe400000,0x200,0x300000,0x300000,0x0,0x1800000,0x1800000,0xc000,0xc000,0xc000,0x0,0x0,0xfc00,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x1c00,0x0,0x0,0x0,0x40000000,0x30000000,0xdc00,0x0,0xdc00,0x1c00,0xdc00,0x0,0xdc00,0xdc00,0x20000000,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0xfc00,0x0,0x0,0xfc00,0xfc00,0xfc00,0x0,0x400000,0xfc00,0x0,0x0,0xfc00,0xfc00,0x0,0x0,0x0,0xc000,0x1c00,0xc000,0x0,0x0,0x1c00,0x0,0x1c00,0x0,0x1c00,0x800000,0x0,0x0,0x0,0x0,0xfc00,0xfc00,0x0,0xfc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0xfc00,0x8dc00,0x8dc00,0x0,0x8dc00,0x8dc00,0x0,0x0,0x0,0x0,0x81c00,0x0,0x81c00,0x0,0x81c00,0x81c00,0x81c00,0x81c00,0x0,0x0,0xfc00,0xfc00,0xfc00,0xfc00,0xfc00,0xdc00,0xfc00,0xc000,0x3c00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xdc00,0xdc00,0x0,0x0,0x0,0x0,0x0,0x800000,0xdc00,0x800000,0x800000,0x800000,0x800000,0x800000,0x800000,0x0,0x0,0x0,0x10000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x1c00,0x1800,0x2000,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x60,0x0,0x0,0x20,0x40,0x20,0x10,0x40,0x20000,0x40000,0x0,0x0,0x3e0c000,0x10000,0x3e0c000,0x3e0c000,0x3e0c00c,0xc,0x3e0c000,0x3e0c00c,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x100,0x100,0x110,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x0,0x0,0x3b01,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x2,0x400,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e0c000,0x3e0c000,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x3e0c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3e00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffdb,0xffffffdb,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0xffffffdb,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_3() { + jj_la1_3 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x1dfffff,0x0,0x1dfffff,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0xf0000000,0xf0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x6000000,0x0,0x0,0x6000000,0x0,0x0,0x6000000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x6000000,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x6000000,0x6000000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7dfffff,0x7dfffff,0x0,0x1dfffff,0x0,0x0,0x0,0x0,0x7dfffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_4() { + jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x427f,0x427f,0x100,0x400,0x100,0x100,0x100,0x100,0x100,0x100,0x4000,0x0,0x0,0x8000,0x0,0x0,0x1000,0x3000,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x3fe0000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x100,0x0,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x3f00000,0x3f00000,0x0,0x0,0x3f00000,0x0,0x0,0x3fe0000,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3fe0000,0xe0000,0x700000,0x3800000,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_5() { + jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x20,0x20000020,0x0,0x0,0x14be,0x100,0x0,0x20000000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x14be,0x0,0x8000,0x14be,0x14be,0x14be,0x8000,0x0,0x14be,0x100,0x8000,0x14be,0x14be,0x8000,0x100,0x0,0xa0,0x1e,0x0,0xa0,0xa0,0x1e,0xa0,0x1e,0x0,0x20,0x0,0x4000,0xa0,0x4000,0xa0,0x14be,0x14be,0x8000,0x14be,0x0,0x2000,0x0,0x0,0x4000,0x14be,0x400020,0x400020,0x2000,0x400020,0x400020,0x4000,0x0,0x40000000,0x28000000,0x400020,0x28000000,0x400020,0x0,0x0,0x20,0x0,0x0,0x420,0x420,0x14be,0x14be,0x14be,0x14be,0x109e,0x0,0x1000,0x0,0x109e,0x2000000,0x4000000,0x3f0000,0x3f0000,0x18000000,0x0,0x60000000,0x60000000,0x18000000,0x60000000,0x60000000,0x1840003e,0x3e,0xa0,0x0,0x4000,0x4000,0x4000,0x0,0x3840003e,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0xa0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x0,0x1000,}; + } + private static void jj_la1_init_6() { + jj_la1_6 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4,0x0,0x2,0x0,0x20,0x4,0x20,0x0,0x2,0x4,0x4,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } /** Constructor with InputStream. */ public SPARQLParser11(java.io.InputStream stream) { - this(stream, null); + this(stream, null); } /** Constructor with InputStream and supplied encoding */ public SPARQLParser11(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); + ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor. */ public SPARQLParser11(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new SPARQLParser11TokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new SPARQLParser11TokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + if (jj_input_stream == null) { + jj_input_stream = new JavaCharStream(stream, 1, 1); + } else { + jj_input_stream.ReInit(stream, 1, 1); + } + if (token_source == null) { + token_source = new SPARQLParser11TokenManager(jj_input_stream); + } + + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public SPARQLParser11(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(SPARQLParser11TokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 165; i++) jj_la1[i] = -1; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 165; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; } /** Get the specific Token. */ final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; } - private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); + private int jj_ntk_f() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); @@ -5060,51 +5297,58 @@ private int jj_ntk() { /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[209]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 165; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 165; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< 145) kind = 145; - jjCheckNAddStates(0, 6); + { jjCheckNAddStates(0, 6); } } else if (curChar == 45) - jjCheckNAddStates(7, 11); + { jjCheckNAddStates(7, 11); } else if (curChar == 43) - jjCheckNAddStates(12, 16); + { jjCheckNAddStates(12, 16); } else if (curChar == 46) - jjCheckNAddTwoStates(195, 207); + { jjCheckNAddTwoStates(195, 207); } else if (curChar == 58) { if (kind > 11) kind = 11; - jjCheckNAddStates(17, 19); + { jjCheckNAddStates(17, 19); } } else if (curChar == 40) - jjCheckNAddStates(20, 22); + { jjCheckNAddStates(20, 22); } else if (curChar == 34) jjstateSet[jjnewStateCnt++] = 117; else if (curChar == 39) @@ -2326,26 +2313,26 @@ else if (curChar == 39) else if (curChar == 36) jjstateSet[jjnewStateCnt++] = 27; else if (curChar == 60) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } else if (curChar == 35) { if (kind > 6) kind = 6; - jjCheckNAddStates(26, 28); + { jjCheckNAddStates(26, 28); } } else if (curChar == 63) jjstateSet[jjnewStateCnt++] = 24; if (curChar == 34) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } else if (curChar == 39) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 1: if ((0xffffffffffffdbffL & l) == 0L) break; if (kind > 6) kind = 6; - jjCheckNAddStates(26, 28); + { jjCheckNAddStates(26, 28); } break; case 2: if ((0x2400L & l) != 0L && kind > 6) @@ -2361,11 +2348,11 @@ else if (curChar == 39) break; case 5: if (curChar == 60) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } break; case 6: if ((0xaffffffa00000000L & l) != 0L) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } break; case 9: if ((0x3ff000000000000L & l) != 0L) @@ -2397,7 +2384,7 @@ else if (curChar == 39) break; case 16: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } break; case 17: if (curChar == 62 && kind > 10) @@ -2412,11 +2399,11 @@ else if (curChar == 39) break; if (kind > 13) kind = 13; - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 20: if ((0x3ff600000000000L & l) != 0L) - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 21: if ((0x3ff200000000000L & l) != 0L && kind > 13) @@ -2432,7 +2419,7 @@ else if (curChar == 39) break; if (kind > 14) kind = 14; - jjCheckNAdd(25); + { jjCheckNAdd(25); } break; case 26: if (curChar == 36) @@ -2444,38 +2431,38 @@ else if (curChar == 39) break; if (kind > 15) kind = 15; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 31: if (curChar == 45) - jjCheckNAdd(32); + { jjCheckNAdd(32); } break; case 32: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 16) kind = 16; - jjCheckNAddTwoStates(31, 32); + { jjCheckNAddTwoStates(31, 32); } break; case 34: if (curChar == 35) - jjCheckNAddStates(35, 40); + { jjCheckNAddStates(35, 40); } break; case 35: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(35, 40); + { jjCheckNAddStates(35, 40); } break; case 36: if ((0x2400L & l) != 0L) - jjCheckNAddStates(41, 43); + { jjCheckNAddStates(41, 43); } break; case 37: if ((0x100003600L & l) != 0L) - jjCheckNAddStates(41, 43); + { jjCheckNAddStates(41, 43); } break; case 42: if (curChar == 10) - jjCheckNAddStates(41, 43); + { jjCheckNAddStates(41, 43); } break; case 43: if (curChar == 13) @@ -2487,11 +2474,11 @@ else if (curChar == 39) break; case 51: if (curChar == 39) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 52: if ((0xffffff7fffffdbffL & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 53: if (curChar == 39 && kind > 161) @@ -2499,7 +2486,7 @@ else if (curChar == 39) break; case 55: if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 57: if ((0x3ff000000000000L & l) != 0L) @@ -2531,15 +2518,15 @@ else if (curChar == 39) break; case 64: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 65: if (curChar == 34) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 66: if ((0xfffffffbffffdbffL & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 67: if (curChar == 34 && kind > 162) @@ -2547,7 +2534,7 @@ else if (curChar == 39) break; case 69: if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 71: if ((0x3ff000000000000L & l) != 0L) @@ -2579,28 +2566,28 @@ else if (curChar == 39) break; case 78: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 79: if (curChar == 39) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 80: case 83: if (curChar == 39) - jjCheckNAddTwoStates(81, 84); + { jjCheckNAddTwoStates(81, 84); } break; case 81: if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 82: if (curChar == 39) - jjAddStates(48, 49); + { jjAddStates(48, 49); } break; case 85: if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 87: if ((0x3ff000000000000L & l) != 0L) @@ -2632,7 +2619,7 @@ else if (curChar == 39) break; case 94: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 95: if (curChar == 39 && kind > 163) @@ -2652,24 +2639,24 @@ else if (curChar == 39) break; case 99: if (curChar == 34) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 100: case 103: if (curChar == 34) - jjCheckNAddTwoStates(101, 104); + { jjCheckNAddTwoStates(101, 104); } break; case 101: if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 102: if (curChar == 34) - jjAddStates(54, 55); + { jjAddStates(54, 55); } break; case 105: if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 107: if ((0x3ff000000000000L & l) != 0L) @@ -2701,7 +2688,7 @@ else if (curChar == 39) break; case 114: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 115: if (curChar == 34 && kind > 164) @@ -2721,23 +2708,23 @@ else if (curChar == 39) break; case 119: if (curChar == 40) - jjCheckNAddStates(20, 22); + { jjCheckNAddStates(20, 22); } break; case 120: if (curChar == 35) - jjCheckNAddStates(56, 61); + { jjCheckNAddStates(56, 61); } break; case 121: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(56, 61); + { jjCheckNAddStates(56, 61); } break; case 122: if ((0x2400L & l) != 0L) - jjCheckNAddStates(20, 22); + { jjCheckNAddStates(20, 22); } break; case 123: if ((0x100003600L & l) != 0L) - jjCheckNAddStates(20, 22); + { jjCheckNAddStates(20, 22); } break; case 124: if (curChar == 41 && kind > 167) @@ -2745,7 +2732,7 @@ else if (curChar == 39) break; case 125: if (curChar == 10) - jjCheckNAddStates(20, 22); + { jjCheckNAddStates(20, 22); } break; case 126: if (curChar == 13) @@ -2753,23 +2740,23 @@ else if (curChar == 39) break; case 128: if (curChar == 35) - jjCheckNAddStates(62, 67); + { jjCheckNAddStates(62, 67); } break; case 129: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(62, 67); + { jjCheckNAddStates(62, 67); } break; case 130: if ((0x2400L & l) != 0L) - jjCheckNAddStates(68, 70); + { jjCheckNAddStates(68, 70); } break; case 131: if ((0x100003600L & l) != 0L) - jjCheckNAddStates(68, 70); + { jjCheckNAddStates(68, 70); } break; case 133: if (curChar == 10) - jjCheckNAddStates(68, 70); + { jjCheckNAddStates(68, 70); } break; case 134: if (curChar == 13) @@ -2777,7 +2764,7 @@ else if (curChar == 39) break; case 136: if ((0x3ff600000000000L & l) != 0L) - jjAddStates(71, 72); + { jjAddStates(71, 72); } break; case 137: if ((0x3ff200000000000L & l) != 0L) @@ -2789,7 +2776,7 @@ else if (curChar == 39) break; case 139: if ((0x3ff600000000000L & l) != 0L) - jjAddStates(73, 74); + { jjAddStates(73, 74); } break; case 140: if ((0x3ff200000000000L & l) != 0L) @@ -2797,18 +2784,18 @@ else if (curChar == 39) break; case 141: if (curChar == 58) - jjCheckNAddStates(17, 19); + { jjCheckNAddStates(17, 19); } break; case 142: if ((0x7ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 143: if ((0x7ff600000000000L & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 144: if ((0x7ff200000000000L & l) != 0L && kind > 12) @@ -2816,11 +2803,11 @@ else if (curChar == 39) break; case 146: if ((0xa800fffa00000000L & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 147: if (curChar == 37) - jjAddStates(79, 80); + { jjAddStates(79, 80); } break; case 148: if ((0x3ff000000000000L & l) != 0L) @@ -2828,7 +2815,7 @@ else if (curChar == 39) break; case 149: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 150: if ((0x3ff000000000000L & l) != 0L) @@ -2847,7 +2834,7 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 155: if (curChar == 37) @@ -2862,34 +2849,34 @@ else if (curChar == 39) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 158: if (curChar != 58) break; if (kind > 11) kind = 11; - jjCheckNAddStates(17, 19); + { jjCheckNAddStates(17, 19); } break; case 161: if (curChar == 35) - jjCheckNAddStates(81, 86); + { jjCheckNAddStates(81, 86); } break; case 162: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(81, 86); + { jjCheckNAddStates(81, 86); } break; case 163: if ((0x2400L & l) != 0L) - jjCheckNAddStates(87, 89); + { jjCheckNAddStates(87, 89); } break; case 164: if ((0x100003600L & l) != 0L) - jjCheckNAddStates(87, 89); + { jjCheckNAddStates(87, 89); } break; case 169: if (curChar == 10) - jjCheckNAddStates(87, 89); + { jjCheckNAddStates(87, 89); } break; case 170: if (curChar == 13) @@ -2897,23 +2884,23 @@ else if (curChar == 39) break; case 176: if (curChar == 35) - jjCheckNAddStates(90, 95); + { jjCheckNAddStates(90, 95); } break; case 177: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(90, 95); + { jjCheckNAddStates(90, 95); } break; case 178: if ((0x2400L & l) != 0L) - jjCheckNAddStates(96, 98); + { jjCheckNAddStates(96, 98); } break; case 179: if ((0x100003600L & l) != 0L) - jjCheckNAddStates(96, 98); + { jjCheckNAddStates(96, 98); } break; case 185: if (curChar == 10) - jjCheckNAddStates(96, 98); + { jjCheckNAddStates(96, 98); } break; case 186: if (curChar == 13) @@ -2924,260 +2911,260 @@ else if (curChar == 39) break; if (kind > 145) kind = 145; - jjCheckNAddStates(0, 6); + { jjCheckNAddStates(0, 6); } break; case 192: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 145) kind = 145; - jjCheckNAdd(192); + { jjCheckNAdd(192); } break; case 193: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(193, 194); + { jjCheckNAddTwoStates(193, 194); } break; case 194: if (curChar == 46) - jjCheckNAdd(195); + { jjCheckNAdd(195); } break; case 195: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 146) kind = 146; - jjCheckNAdd(195); + { jjCheckNAdd(195); } break; case 196: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(196, 197); + { jjCheckNAddTwoStates(196, 197); } break; case 197: if (curChar == 46) - jjCheckNAddTwoStates(198, 199); + { jjCheckNAddTwoStates(198, 199); } break; case 198: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(198, 199); + { jjCheckNAddTwoStates(198, 199); } break; case 200: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(201); + { jjCheckNAdd(201); } break; case 201: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - jjCheckNAdd(201); + { jjCheckNAdd(201); } break; case 202: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(202, 203); + { jjCheckNAddTwoStates(202, 203); } break; case 204: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(205); + { jjCheckNAdd(205); } break; case 205: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - jjCheckNAdd(205); + { jjCheckNAdd(205); } break; case 206: if (curChar == 46) - jjCheckNAddTwoStates(195, 207); + { jjCheckNAddTwoStates(195, 207); } break; case 207: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(207, 208); + { jjCheckNAddTwoStates(207, 208); } break; case 209: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(210); + { jjCheckNAdd(210); } break; case 210: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 147) kind = 147; - jjCheckNAdd(210); + { jjCheckNAdd(210); } break; case 211: if (curChar == 43) - jjCheckNAddStates(12, 16); + { jjCheckNAddStates(12, 16); } break; case 212: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 148) kind = 148; - jjCheckNAdd(212); + { jjCheckNAdd(212); } break; case 213: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(213, 214); + { jjCheckNAddTwoStates(213, 214); } break; case 214: if (curChar == 46) - jjCheckNAdd(215); + { jjCheckNAdd(215); } break; case 215: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 149) kind = 149; - jjCheckNAdd(215); + { jjCheckNAdd(215); } break; case 216: if (curChar == 46) - jjCheckNAdd(217); + { jjCheckNAdd(217); } break; case 217: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(217, 218); + { jjCheckNAddTwoStates(217, 218); } break; case 219: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(220); + { jjCheckNAdd(220); } break; case 220: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - jjCheckNAdd(220); + { jjCheckNAdd(220); } break; case 221: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(99, 102); + { jjCheckNAddStates(99, 102); } break; case 222: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(222, 223); + { jjCheckNAddTwoStates(222, 223); } break; case 223: if (curChar == 46) - jjCheckNAddTwoStates(224, 225); + { jjCheckNAddTwoStates(224, 225); } break; case 224: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(224, 225); + { jjCheckNAddTwoStates(224, 225); } break; case 226: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(227); + { jjCheckNAdd(227); } break; case 227: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - jjCheckNAdd(227); + { jjCheckNAdd(227); } break; case 228: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(228, 229); + { jjCheckNAddTwoStates(228, 229); } break; case 230: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(231); + { jjCheckNAdd(231); } break; case 231: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 150) kind = 150; - jjCheckNAdd(231); + { jjCheckNAdd(231); } break; case 232: if (curChar == 45) - jjCheckNAddStates(7, 11); + { jjCheckNAddStates(7, 11); } break; case 233: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 151) kind = 151; - jjCheckNAdd(233); + { jjCheckNAdd(233); } break; case 234: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(234, 235); + { jjCheckNAddTwoStates(234, 235); } break; case 235: if (curChar == 46) - jjCheckNAdd(236); + { jjCheckNAdd(236); } break; case 236: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 152) kind = 152; - jjCheckNAdd(236); + { jjCheckNAdd(236); } break; case 237: if (curChar == 46) - jjCheckNAdd(238); + { jjCheckNAdd(238); } break; case 238: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(238, 239); + { jjCheckNAddTwoStates(238, 239); } break; case 240: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(241); + { jjCheckNAdd(241); } break; case 241: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - jjCheckNAdd(241); + { jjCheckNAdd(241); } break; case 242: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(103, 106); + { jjCheckNAddStates(103, 106); } break; case 243: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(243, 244); + { jjCheckNAddTwoStates(243, 244); } break; case 244: if (curChar == 46) - jjCheckNAddTwoStates(245, 246); + { jjCheckNAddTwoStates(245, 246); } break; case 245: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(245, 246); + { jjCheckNAddTwoStates(245, 246); } break; case 247: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(248); + { jjCheckNAdd(248); } break; case 248: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - jjCheckNAdd(248); + { jjCheckNAdd(248); } break; case 249: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(249, 250); + { jjCheckNAddTwoStates(249, 250); } break; case 251: if ((0x280000000000L & l) != 0L) - jjCheckNAdd(252); + { jjCheckNAdd(252); } break; case 252: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 153) kind = 153; - jjCheckNAdd(252); + { jjCheckNAdd(252); } break; default : break; } @@ -3192,28 +3179,28 @@ else if (curChar < 128) { case 0: if ((0x7fffffe07fffffeL & l) != 0L) - jjCheckNAddStates(107, 112); + { jjCheckNAddStates(107, 112); } else if (curChar == 91) - jjCheckNAddStates(68, 70); + { jjCheckNAddStates(68, 70); } else if (curChar == 92) jjstateSet[jjnewStateCnt++] = 50; else if (curChar == 64) - jjCheckNAdd(30); + { jjCheckNAdd(30); } else if (curChar == 95) jjstateSet[jjnewStateCnt++] = 18; if ((0x1000000010L & l) != 0L) - jjAddStates(113, 114); + { jjAddStates(113, 114); } else if ((0x20000000200L & l) != 0L) jjstateSet[jjnewStateCnt++] = 47; break; case 1: if (kind > 6) kind = 6; - jjAddStates(26, 28); + { jjAddStates(26, 28); } break; case 6: if ((0xc7fffffeafffffffL & l) != 0L) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } break; case 7: if (curChar == 92) @@ -3253,18 +3240,18 @@ else if ((0x20000000200L & l) != 0L) break; case 16: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(23, 25); + { jjCheckNAddStates(23, 25); } break; case 19: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 13) kind = 13; - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 20: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 21: if ((0x7fffffe87fffffeL & l) != 0L && kind > 13) @@ -3280,7 +3267,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - jjCheckNAdd(25); + { jjCheckNAdd(25); } break; case 27: case 28: @@ -3288,32 +3275,32 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 15) kind = 15; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 29: if (curChar == 64) - jjCheckNAdd(30); + { jjCheckNAdd(30); } break; case 30: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - jjCheckNAddTwoStates(30, 31); + { jjCheckNAddTwoStates(30, 31); } break; case 32: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 16) kind = 16; - jjCheckNAddTwoStates(31, 32); + { jjCheckNAddTwoStates(31, 32); } break; case 33: if ((0x10000000100000L & l) != 0L) - jjCheckNAddStates(41, 43); + { jjCheckNAddStates(41, 43); } break; case 35: - jjCheckNAddStates(35, 40); + { jjCheckNAddStates(35, 40); } break; case 38: if ((0x200000002L & l) != 0L && kind > 126) @@ -3361,15 +3348,15 @@ else if ((0x20000000200L & l) != 0L) break; case 52: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 54: if (curChar == 92) - jjAddStates(115, 116); + { jjAddStates(115, 116); } break; case 55: if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 56: if (curChar == 85) @@ -3405,19 +3392,19 @@ else if ((0x20000000200L & l) != 0L) break; case 64: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(32, 34); + { jjCheckNAddStates(32, 34); } break; case 66: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 68: if (curChar == 92) - jjAddStates(117, 118); + { jjAddStates(117, 118); } break; case 69: if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 70: if (curChar == 85) @@ -3453,19 +3440,19 @@ else if ((0x20000000200L & l) != 0L) break; case 78: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(29, 31); + { jjCheckNAddStates(29, 31); } break; case 81: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 84: if (curChar == 92) - jjAddStates(119, 120); + { jjAddStates(119, 120); } break; case 85: if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 86: if (curChar == 85) @@ -3501,19 +3488,19 @@ else if ((0x20000000200L & l) != 0L) break; case 94: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(44, 47); + { jjCheckNAddStates(44, 47); } break; case 101: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 104: if (curChar == 92) - jjAddStates(121, 122); + { jjAddStates(121, 122); } break; case 105: if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 106: if (curChar == 85) @@ -3549,17 +3536,17 @@ else if ((0x20000000200L & l) != 0L) break; case 114: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(50, 53); + { jjCheckNAddStates(50, 53); } break; case 121: - jjAddStates(56, 61); + { jjAddStates(56, 61); } break; case 127: if (curChar == 91) - jjCheckNAddStates(68, 70); + { jjCheckNAddStates(68, 70); } break; case 129: - jjCheckNAddStates(62, 67); + { jjCheckNAddStates(62, 67); } break; case 132: if (curChar == 93 && kind > 172) @@ -3567,34 +3554,34 @@ else if ((0x20000000200L & l) != 0L) break; case 135: if ((0x7fffffe07fffffeL & l) != 0L) - jjCheckNAddStates(107, 112); + { jjCheckNAddStates(107, 112); } break; case 136: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAddTwoStates(136, 137); + { jjCheckNAddTwoStates(136, 137); } break; case 137: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAdd(138); + { jjCheckNAdd(138); } break; case 139: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAddTwoStates(139, 140); + { jjCheckNAddTwoStates(139, 140); } break; case 140: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAdd(141); + { jjCheckNAdd(141); } break; case 142: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 143: if ((0x7fffffe87fffffeL & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 144: if ((0x7fffffe87fffffeL & l) != 0L && kind > 12) @@ -3602,11 +3589,11 @@ else if ((0x20000000200L & l) != 0L) break; case 145: if (curChar == 92) - jjAddStates(123, 124); + { jjAddStates(123, 124); } break; case 146: if ((0x4000000080000001L & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 148: if ((0x7e0000007eL & l) != 0L) @@ -3614,7 +3601,7 @@ else if ((0x20000000200L & l) != 0L) break; case 149: if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 150: if ((0x7e0000007eL & l) != 0L) @@ -3637,7 +3624,7 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 156: if ((0x7e0000007eL & l) != 0L) @@ -3648,18 +3635,18 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 159: if ((0x1000000010L & l) != 0L) - jjAddStates(113, 114); + { jjAddStates(113, 114); } break; case 160: if ((0x2000000020L & l) != 0L) - jjCheckNAddStates(87, 89); + { jjCheckNAddStates(87, 89); } break; case 162: - jjCheckNAddStates(81, 86); + { jjCheckNAddStates(81, 86); } break; case 165: if ((0x200000002L & l) != 0L && kind > 127) @@ -3695,10 +3682,10 @@ else if ((0x20000000200L & l) != 0L) break; case 175: if ((0x2000000020L & l) != 0L) - jjCheckNAddStates(96, 98); + { jjCheckNAddStates(96, 98); } break; case 177: - jjCheckNAddStates(90, 95); + { jjCheckNAddStates(90, 95); } break; case 180: if ((0x2000000020L & l) != 0L && kind > 128) @@ -3738,39 +3725,39 @@ else if ((0x20000000200L & l) != 0L) break; case 199: if ((0x2000000020L & l) != 0L) - jjAddStates(125, 126); + { jjAddStates(125, 126); } break; case 203: if ((0x2000000020L & l) != 0L) - jjAddStates(127, 128); + { jjAddStates(127, 128); } break; case 208: if ((0x2000000020L & l) != 0L) - jjAddStates(129, 130); + { jjAddStates(129, 130); } break; case 218: if ((0x2000000020L & l) != 0L) - jjAddStates(131, 132); + { jjAddStates(131, 132); } break; case 225: if ((0x2000000020L & l) != 0L) - jjAddStates(133, 134); + { jjAddStates(133, 134); } break; case 229: if ((0x2000000020L & l) != 0L) - jjAddStates(135, 136); + { jjAddStates(135, 136); } break; case 239: if ((0x2000000020L & l) != 0L) - jjAddStates(137, 138); + { jjAddStates(137, 138); } break; case 246: if ((0x2000000020L & l) != 0L) - jjAddStates(139, 140); + { jjAddStates(139, 140); } break; case 250: if ((0x2000000020L & l) != 0L) - jjAddStates(141, 142); + { jjAddStates(141, 142); } break; default : break; } @@ -3778,7 +3765,7 @@ else if ((0x20000000200L & l) != 0L) } else { - int hiByte = (int)(curChar >> 8); + int hiByte = (curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; @@ -3789,29 +3776,29 @@ else if ((0x20000000200L & l) != 0L) { case 0: if (jjCanMove_1(hiByte, i1, i2, l1, l2)) - jjCheckNAddStates(107, 112); + { jjCheckNAddStates(107, 112); } break; case 1: if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; if (kind > 6) kind = 6; - jjAddStates(26, 28); + { jjAddStates(26, 28); } break; case 6: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(23, 25); + { jjAddStates(23, 25); } break; case 19: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 13) kind = 13; - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 20: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAddTwoStates(20, 21); + { jjCheckNAddTwoStates(20, 21); } break; case 21: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 13) @@ -3822,83 +3809,83 @@ else if ((0x20000000200L & l) != 0L) break; if (kind > 14) kind = 14; - jjCheckNAdd(25); + { jjCheckNAdd(25); } break; case 25: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 14) kind = 14; - jjCheckNAdd(25); + { jjCheckNAdd(25); } break; case 27: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 28: if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 15) kind = 15; - jjCheckNAdd(28); + { jjCheckNAdd(28); } break; case 35: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(35, 40); + { jjAddStates(35, 40); } break; case 52: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(32, 34); + { jjAddStates(32, 34); } break; case 66: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(29, 31); + { jjAddStates(29, 31); } break; case 81: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(44, 47); + { jjAddStates(44, 47); } break; case 101: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(50, 53); + { jjAddStates(50, 53); } break; case 121: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(56, 61); + { jjAddStates(56, 61); } break; case 129: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(62, 67); + { jjAddStates(62, 67); } break; case 136: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAddTwoStates(136, 137); + { jjCheckNAddTwoStates(136, 137); } break; case 137: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAdd(138); + { jjCheckNAdd(138); } break; case 139: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAddTwoStates(139, 140); + { jjCheckNAddTwoStates(139, 140); } break; case 140: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAdd(141); + { jjCheckNAdd(141); } break; case 142: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 143: if (jjCanMove_2(hiByte, i1, i2, l1, l2)) - jjCheckNAddStates(75, 78); + { jjCheckNAddStates(75, 78); } break; case 144: if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 12) @@ -3906,13 +3893,13 @@ else if ((0x20000000200L & l) != 0L) break; case 162: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(81, 86); + { jjAddStates(81, 86); } break; case 177: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(90, 95); + { jjAddStates(90, 95); } break; - default : break; + default : if (i1 == 0 || l1 == 0 || i2 == 0 || l2 == 0) break; else break; } } while(i != startsAt); } @@ -4062,111 +4049,6 @@ private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, lo } } -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, "\ufeff", null, null, null, -null, null, null, null, null, null, "\141", null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, "\50", -"\51", null, "\173", "\175", "\133", "\135", null, "\73", "\54", "\56", "\75", -"\41\75", "\76", "\74", "\74\75", "\76\75", "\41", "\176", "\72", "\174\174", "\46\46", -"\53", "\55", "\52", "\57", "\136\136", "\100", "\174", "\136", "\55\76", "\74\55", -"\77", null, null, null, null, null, null, null, null, null, null, null, }; - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; -static final long[] jjtoToken = { - 0xfffffffffff9fe01L, 0xffffffffffffffffL, 0xfffffffe23feffffL, 0x3fL, -}; -static final long[] jjtoSkip = { - 0x7eL, 0x0L, 0x0L, 0x0L, -}; -static final long[] jjtoSpecial = { - 0x40L, 0x0L, 0x0L, 0x0L, -}; -protected JavaCharStream input_stream; -private final int[] jjrounds = new int[253]; -private final int[] jjstateSet = new int[506]; -protected char curChar; -/** Constructor. */ -public SPARQLParser11TokenManager(JavaCharStream stream){ - if (JavaCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} - -/** Constructor. */ -public SPARQLParser11TokenManager(JavaCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} - -/** Reinitialise parser. */ -public void ReInit(JavaCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 253; i-- > 0;) - jjrounds[i] = 0x80000000; -} - -/** Reinitialise parser. */ -public void ReInit(JavaCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} - -/** Switch to specified lex state. */ -public void SwitchTo(int lexState) -{ - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} - int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; @@ -4188,9 +4070,10 @@ public Token getNextToken() { curChar = input_stream.BeginToken(); } - catch(java.io.IOException e) + catch(Exception e) { jjmatchedKind = 0; + jjmatchedPos = -1; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; @@ -4248,6 +4131,31 @@ public Token getNextToken() } } +void SkipLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + default : + break; + } +} +void MoreLexicalActions() +{ + jjimageLen += (lengthOfMatch = jjmatchedPos + 1); + switch(jjmatchedKind) + { + default : + break; + } +} +void TokenLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + default : + break; + } +} private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java index 176e379371e..9c283db5a87 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/Token.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.apache.jena.sparql.lang.sparql_11 ; /** @@ -97,6 +97,7 @@ public Token(int kind, String image) /** * Returns the image. */ + @Override public String toString() { return image; @@ -128,4 +129,4 @@ public static Token newToken(int ofKind) } } -/* JavaCC - OriginalChecksum=14a2dd2c56b347f7b769eacf6b50c9b9 (do not edit this line) */ +/* JavaCC - OriginalChecksum=d168c8aaa91566e8e4a37d907159a9b8 (do not edit this line) */ diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java index a50f6cdf9fd..a7d04ca9323 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/lang/sparql_11/TokenMgrError.java @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ /* JavaCCOptions: */ package org.apache.jena.sparql.lang.sparql_11 ; @@ -22,22 +22,22 @@ public class TokenMgrError extends Error /** * Lexical error occurred. */ - static final int LEXICAL_ERROR = 0; + public static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ - static final int STATIC_LEXER_ERROR = 1; + public static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ - static final int INVALID_LEXICAL_STATE = 2; + public static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ - static final int LOOP_DETECTED = 3; + public static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have @@ -50,13 +50,11 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { - case 0 : - continue; case '\b': retval.append("\\b"); continue; @@ -99,7 +97,7 @@ protected static final String addEscapes(String str) { * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error - * curLexState : lexical state in which this error occurred + * lexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred @@ -124,6 +122,7 @@ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, * * from this method for such cases in the release version of your parser. */ + @Override public String getMessage() { return super.getMessage(); } @@ -143,8 +142,8 @@ public TokenMgrError(String message, int reason) { } /** Full Constructor. */ - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { + this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=b8503915d6e2e75526fb396931f35aa6 (do not edit this line) */ From 25494354c61e2999747b297b99d86e8bfca1d5cd Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Thu, 4 Jul 2024 22:36:31 +0200 Subject: [PATCH 322/323] copies the test suite from the SPARQL-CDTs repo --- .../jena/external/Scripts_SPARQLCDTs.java | 32 + jena-arq/testing/README.txt | 3 + .../SPARQL-CDTs/bnodes/bnodes-sparql-01.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-sparql-02.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-sparql-03.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-sparql-04.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-sparql-05.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-06.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-07.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-08.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-09.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-11.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-12.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-13.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-14.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-15.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-16.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-17.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-18.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-21.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-22.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-23.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-24.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-sparql-25.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-26.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-27.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-sparql-28.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-turtle-01.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-01.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-02.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-02.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-03.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-03.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-04.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-04.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-05.rq | 12 + .../SPARQL-CDTs/bnodes/bnodes-turtle-05.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-06.rq | 12 + .../SPARQL-CDTs/bnodes/bnodes-turtle-06.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-07.rq | 12 + .../SPARQL-CDTs/bnodes/bnodes-turtle-07.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-08.rq | 12 + .../SPARQL-CDTs/bnodes/bnodes-turtle-08.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-09.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-09.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-10.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-10.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-11.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-11.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-12.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-12.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-13.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-13.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-14.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-14.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-15.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-15a.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-15b.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-16.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-16a.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-16b.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-17.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-17a.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-17b.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-18.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-18a.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-18b.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-19.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-19a.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-19b.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-21.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-21.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-22.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-22.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-23.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-23.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-24.rq | 14 + .../SPARQL-CDTs/bnodes/bnodes-turtle-24.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-25.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-25.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-26.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-26.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-27.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-27.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-28.rq | 13 + .../SPARQL-CDTs/bnodes/bnodes-turtle-28.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-29.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-turtle-29.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-30.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-turtle-30.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-31.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-turtle-31.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-32.rq | 15 + .../SPARQL-CDTs/bnodes/bnodes-turtle-32.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-41.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-42.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-43.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-44.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-45.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-46.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-47.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-48.ttl | 7 + .../SPARQL-CDTs/bnodes/bnodes-turtle-49.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-50.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-51.ttl | 8 + .../SPARQL-CDTs/bnodes/bnodes-turtle-52.ttl | 8 + .../bnodes/bnodes-turtle-sparql-01.rq | 14 + .../bnodes/bnodes-turtle-sparql-01.ttl | 7 + .../bnodes/bnodes-turtle-sparql-02.rq | 14 + .../bnodes/bnodes-turtle-sparql-02.ttl | 7 + .../bnodes/bnodes-turtle-sparql-03.rq | 13 + .../bnodes/bnodes-turtle-sparql-03.ttl | 7 + .../bnodes/bnodes-turtle-sparql-04.rq | 13 + .../bnodes/bnodes-turtle-sparql-04.ttl | 7 + jena-arq/testing/SPARQL-CDTs/bnodes/empty.ttl | 0 .../testing/SPARQL-CDTs/bnodes/manifest.ttl | 749 ++++ jena-arq/testing/SPARQL-CDTs/bnodes/true.srx | 5 + jena-arq/testing/SPARQL-CDTs/fold/empty.ttl | 0 .../testing/SPARQL-CDTs/fold/fold-list-01.rq | 11 + .../testing/SPARQL-CDTs/fold/fold-list-02.rq | 11 + .../testing/SPARQL-CDTs/fold/fold-list-03.rq | 15 + .../testing/SPARQL-CDTs/fold/fold-list-04.rq | 21 + .../testing/SPARQL-CDTs/fold/fold-list-05.rq | 24 + .../SPARQL-CDTs/fold/fold-list-distinct-01.rq | 11 + .../SPARQL-CDTs/fold/fold-list-distinct-02.rq | 18 + .../SPARQL-CDTs/fold/fold-list-distinct-03.rq | 18 + .../SPARQL-CDTs/fold/fold-list-distinct-04.rq | 21 + .../SPARQL-CDTs/fold/fold-list-distinct-05.rq | 21 + .../SPARQL-CDTs/fold/fold-list-distinct-06.rq | 21 + .../SPARQL-CDTs/fold/fold-list-distinct-07.rq | 22 + .../SPARQL-CDTs/fold/fold-list-distinct-08.rq | 22 + .../fold/fold-list-distinct-orderby-01.rq | 31 + .../fold/fold-list-distinct-orderby-02.rq | 22 + .../fold/fold-list-distinct-orderby-03.rq | 40 + .../SPARQL-CDTs/fold/fold-list-orderby-01.rq | 11 + .../SPARQL-CDTs/fold/fold-list-orderby-02.rq | 11 + .../SPARQL-CDTs/fold/fold-list-orderby-03.rq | 15 + .../SPARQL-CDTs/fold/fold-list-orderby-04.rq | 18 + .../SPARQL-CDTs/fold/fold-list-orderby-05.rq | 15 + .../SPARQL-CDTs/fold/fold-list-orderby-06.rq | 16 + .../testing/SPARQL-CDTs/fold/fold-map-01.rq | 11 + .../testing/SPARQL-CDTs/fold/fold-map-02.rq | 15 + .../testing/SPARQL-CDTs/fold/fold-map-03.rq | 19 + .../testing/SPARQL-CDTs/fold/fold-map-04.rq | 15 + .../testing/SPARQL-CDTs/fold/fold-map-05.rq | 19 + .../testing/SPARQL-CDTs/fold/fold-map-06.rq | 15 + .../SPARQL-CDTs/fold/fold-map-orderby-01.rq | 16 + .../SPARQL-CDTs/fold/fold-map-orderby-02.rq | 16 + .../testing/SPARQL-CDTs/fold/manifest.ttl | 354 ++ jena-arq/testing/SPARQL-CDTs/fold/true.srx | 5 + .../SPARQL-CDTs/list-functions/concat-01.rq | 8 + .../SPARQL-CDTs/list-functions/concat-02.rq | 10 + .../SPARQL-CDTs/list-functions/concat-03.rq | 10 + .../SPARQL-CDTs/list-functions/concat-04.rq | 9 + .../SPARQL-CDTs/list-functions/concat-05.rq | 9 + .../SPARQL-CDTs/list-functions/concat-06.rq | 10 + .../SPARQL-CDTs/list-functions/concat-07.rq | 10 + .../SPARQL-CDTs/list-functions/concat-08.rq | 8 + .../SPARQL-CDTs/list-functions/concat-09.rq | 9 + .../SPARQL-CDTs/list-functions/concat-10.rq | 10 + .../list-functions/concat-error-01.rq | 8 + .../list-functions/concat-error-02.rq | 7 + .../list-functions/concat-null-01.rq | 14 + .../SPARQL-CDTs/list-functions/contains-01.rq | 8 + .../SPARQL-CDTs/list-functions/contains-02.rq | 8 + .../SPARQL-CDTs/list-functions/contains-03.rq | 22 + .../SPARQL-CDTs/list-functions/contains-04.rq | 8 + .../SPARQL-CDTs/list-functions/contains-05.rq | 11 + .../SPARQL-CDTs/list-functions/contains-06.rq | 11 + .../SPARQL-CDTs/list-functions/contains-07.rq | 11 + .../SPARQL-CDTs/list-functions/contains-08.rq | 11 + .../SPARQL-CDTs/list-functions/contains-09.rq | 12 + .../SPARQL-CDTs/list-functions/contains-10.rq | 12 + .../list-functions/contains-error-01.rq | 8 + .../list-functions/contains-null-01.rq | 9 + .../SPARQL-CDTs/list-functions/empty.ttl | 0 .../SPARQL-CDTs/list-functions/get-01.rq | 7 + .../SPARQL-CDTs/list-functions/get-02.rq | 8 + .../SPARQL-CDTs/list-functions/get-03.rq | 7 + .../SPARQL-CDTs/list-functions/get-04.rq | 8 + .../SPARQL-CDTs/list-functions/get-05.rq | 8 + .../SPARQL-CDTs/list-functions/get-06.rq | 11 + .../SPARQL-CDTs/list-functions/get-07.rq | 9 + .../SPARQL-CDTs/list-functions/get-08.rq | 10 + .../SPARQL-CDTs/list-functions/get-09.rq | 9 + .../SPARQL-CDTs/list-functions/get-10.rq | 9 + .../SPARQL-CDTs/list-functions/get-11.rq | 12 + .../SPARQL-CDTs/list-functions/get-12.rq | 12 + .../SPARQL-CDTs/list-functions/get-13.rq | 12 + .../list-functions/get-error-01.rq | 7 + .../list-functions/get-error-02.rq | 7 + .../list-functions/get-error-03.rq | 7 + .../list-functions/get-error-04.rq | 7 + .../list-functions/get-error-05.rq | 7 + .../list-functions/get-error-06.rq | 7 + .../SPARQL-CDTs/list-functions/get-null-01.rq | 7 + .../SPARQL-CDTs/list-functions/get-null-02.rq | 7 + .../SPARQL-CDTs/list-functions/head-01.rq | 8 + .../SPARQL-CDTs/list-functions/head-02.rq | 7 + .../SPARQL-CDTs/list-functions/head-03.rq | 7 + .../SPARQL-CDTs/list-functions/head-04.rq | 7 + .../SPARQL-CDTs/list-functions/head-05.rq | 7 + .../SPARQL-CDTs/list-functions/head-06.rq | 7 + .../SPARQL-CDTs/list-functions/head-07.rq | 8 + .../SPARQL-CDTs/list-functions/head-08.rq | 7 + .../SPARQL-CDTs/list-functions/head-09.rq | 7 + .../SPARQL-CDTs/list-functions/head-10.rq | 8 + .../SPARQL-CDTs/list-functions/head-11.rq | 8 + .../SPARQL-CDTs/list-functions/head-12.rq | 11 + .../list-functions/head-error-01.rq | 8 + .../list-functions/head-null-01.rq | 7 + .../list-functions/head-null-02.rq | 7 + .../list-functions/list-constructor-01.rq | 7 + .../list-functions/list-constructor-02.rq | 8 + .../list-functions/list-constructor-03.rq | 8 + .../list-functions/list-constructor-04.rq | 8 + .../list-functions/list-constructor-05.rq | 8 + .../list-functions/list-constructor-06.rq | 8 + .../list-functions/list-constructor-09.rq | 8 + .../list-functions/list-constructor-10.rq | 8 + .../list-functions/list-constructor-11.rq | 8 + .../list-functions/list-constructor-12.rq | 12 + .../list-functions/list-constructor-13.rq | 9 + .../list-functions/list-constructor-14.rq | 8 + .../list-functions/list-constructor-15.rq | 9 + .../list-functions/list-constructor-16.rq | 12 + .../list-constructor-null-01.rq | 12 + .../list-constructor-null-02.rq | 12 + .../list-functions/list-equals-01.rq | 6 + .../list-functions/list-equals-02.rq | 6 + .../list-functions/list-equals-03.rq | 6 + .../list-functions/list-equals-04.rq | 6 + .../list-functions/list-equals-05.rq | 6 + .../list-functions/list-equals-06.rq | 7 + .../list-functions/list-equals-07.rq | 7 + .../list-functions/list-equals-08.rq | 9 + .../list-functions/list-equals-09.rq | 8 + .../list-functions/list-equals-null-01.rq | 7 + .../list-functions/list-equals-null-02.rq | 7 + .../list-functions/list-greater-equal-01.rq | 8 + .../list-functions/list-greater-equal-02.rq | 8 + .../list-functions/list-greater-equal-03.rq | 8 + .../list-functions/list-greater-equal-04.rq | 8 + .../list-functions/list-greater-equal-05.rq | 8 + .../list-functions/list-greater-equal-06.rq | 8 + .../list-functions/list-greater-equal-07.rq | 8 + .../list-functions/list-greater-equal-08.rq | 8 + .../list-functions/list-greater-equal-09.rq | 8 + .../list-functions/list-greater-equal-10.rq | 8 + .../list-functions/list-greater-equal-11.rq | 8 + .../list-functions/list-greater-equal-12.rq | 8 + .../list-functions/list-greater-equal-13.rq | 8 + .../list-functions/list-greater-equal-14.rq | 8 + .../list-functions/list-greater-equal-15.rq | 8 + .../list-functions/list-greater-equal-16.rq | 8 + .../list-functions/list-greater-equal-19.rq | 8 + .../list-functions/list-greater-equal-20.rq | 8 + .../list-functions/list-greater-equal-21.rq | 8 + .../list-functions/list-greater-equal-22.rq | 8 + .../list-functions/list-greater-equal-23.rq | 8 + .../list-functions/list-greater-equal-24.rq | 8 + .../list-functions/list-greater-equal-25.rq | 8 + .../list-functions/list-greater-equal-26.rq | 8 + .../list-functions/list-greater-equal-27.rq | 9 + .../list-functions/list-greater-equal-28.rq | 7 + .../list-functions/list-greater-equal-29.rq | 8 + .../list-functions/list-greater-equal-31.rq | 8 + .../list-greater-equal-error-03.rq | 8 + .../list-greater-equal-error-04.rq | 8 + .../list-greater-equal-null-01.rq | 8 + .../list-greater-equal-null-02.rq | 8 + .../list-greater-equal-null-03.rq | 7 + .../list-greater-equal-null-04.rq | 11 + .../list-greater-equal-null-05.rq | 8 + .../list-greater-equal-null-06.rq | 9 + .../list-functions/list-greater-than-01.rq | 8 + .../list-functions/list-greater-than-02.rq | 8 + .../list-functions/list-greater-than-03.rq | 8 + .../list-functions/list-greater-than-04.rq | 8 + .../list-functions/list-greater-than-05.rq | 8 + .../list-functions/list-greater-than-06.rq | 8 + .../list-functions/list-greater-than-07.rq | 8 + .../list-functions/list-greater-than-08.rq | 8 + .../list-functions/list-greater-than-09.rq | 8 + .../list-functions/list-greater-than-10.rq | 8 + .../list-functions/list-greater-than-11.rq | 8 + .../list-functions/list-greater-than-12.rq | 8 + .../list-functions/list-greater-than-13.rq | 8 + .../list-functions/list-greater-than-14.rq | 8 + .../list-functions/list-greater-than-15.rq | 8 + .../list-functions/list-greater-than-16.rq | 8 + .../list-functions/list-greater-than-19.rq | 8 + .../list-functions/list-greater-than-20.rq | 8 + .../list-functions/list-greater-than-21.rq | 8 + .../list-functions/list-greater-than-22.rq | 8 + .../list-functions/list-greater-than-23.rq | 8 + .../list-functions/list-greater-than-24.rq | 8 + .../list-functions/list-greater-than-25.rq | 8 + .../list-functions/list-greater-than-26.rq | 8 + .../list-functions/list-greater-than-27.rq | 9 + .../list-functions/list-greater-than-28.rq | 7 + .../list-functions/list-greater-than-29.rq | 8 + .../list-functions/list-greater-than-31.rq | 8 + .../list-greater-than-error-03.rq | 8 + .../list-greater-than-error-04.rq | 8 + .../list-greater-than-null-01.rq | 8 + .../list-greater-than-null-02.rq | 8 + .../list-greater-than-null-03.rq | 9 + .../list-greater-than-null-04.rq | 11 + .../list-greater-than-null-05.rq | 8 + .../list-greater-than-null-06.rq | 9 + .../list-functions/list-less-equal-01.rq | 8 + .../list-functions/list-less-equal-02.rq | 8 + .../list-functions/list-less-equal-03.rq | 8 + .../list-functions/list-less-equal-04.rq | 8 + .../list-functions/list-less-equal-05.rq | 8 + .../list-functions/list-less-equal-06.rq | 8 + .../list-functions/list-less-equal-07.rq | 8 + .../list-functions/list-less-equal-08.rq | 8 + .../list-functions/list-less-equal-09.rq | 8 + .../list-functions/list-less-equal-10.rq | 8 + .../list-functions/list-less-equal-11.rq | 8 + .../list-functions/list-less-equal-12.rq | 8 + .../list-functions/list-less-equal-13.rq | 8 + .../list-functions/list-less-equal-14.rq | 8 + .../list-functions/list-less-equal-15.rq | 8 + .../list-functions/list-less-equal-16.rq | 8 + .../list-functions/list-less-equal-19.rq | 8 + .../list-functions/list-less-equal-20.rq | 8 + .../list-functions/list-less-equal-21.rq | 8 + .../list-functions/list-less-equal-22.rq | 8 + .../list-functions/list-less-equal-23.rq | 8 + .../list-functions/list-less-equal-24.rq | 8 + .../list-functions/list-less-equal-25.rq | 8 + .../list-functions/list-less-equal-26.rq | 8 + .../list-functions/list-less-equal-27.rq | 9 + .../list-functions/list-less-equal-28.rq | 7 + .../list-functions/list-less-equal-29.rq | 8 + .../list-functions/list-less-equal-31.rq | 8 + .../list-less-equal-error-03.rq | 8 + .../list-less-equal-error-04.rq | 8 + .../list-functions/list-less-equal-null-01.rq | 8 + .../list-functions/list-less-equal-null-02.rq | 8 + .../list-functions/list-less-equal-null-03.rq | 9 + .../list-functions/list-less-equal-null-04.rq | 11 + .../list-functions/list-less-equal-null-05.rq | 8 + .../list-functions/list-less-equal-null-06.rq | 9 + .../list-functions/list-less-than-01.rq | 8 + .../list-functions/list-less-than-02.rq | 8 + .../list-functions/list-less-than-03.rq | 8 + .../list-functions/list-less-than-04.rq | 8 + .../list-functions/list-less-than-05.rq | 8 + .../list-functions/list-less-than-06.rq | 8 + .../list-functions/list-less-than-07.rq | 8 + .../list-functions/list-less-than-08.rq | 8 + .../list-functions/list-less-than-09.rq | 8 + .../list-functions/list-less-than-10.rq | 8 + .../list-functions/list-less-than-11.rq | 8 + .../list-functions/list-less-than-12.rq | 8 + .../list-functions/list-less-than-13.rq | 8 + .../list-functions/list-less-than-14.rq | 8 + .../list-functions/list-less-than-15.rq | 8 + .../list-functions/list-less-than-16.rq | 8 + .../list-functions/list-less-than-19.rq | 8 + .../list-functions/list-less-than-20.rq | 8 + .../list-functions/list-less-than-21.rq | 8 + .../list-functions/list-less-than-22.rq | 8 + .../list-functions/list-less-than-23.rq | 8 + .../list-functions/list-less-than-24.rq | 8 + .../list-functions/list-less-than-25.rq | 8 + .../list-functions/list-less-than-26.rq | 8 + .../list-functions/list-less-than-27.rq | 9 + .../list-functions/list-less-than-28.rq | 7 + .../list-functions/list-less-than-29.rq | 8 + .../list-functions/list-less-than-31.rq | 8 + .../list-functions/list-less-than-error-03.rq | 8 + .../list-functions/list-less-than-error-04.rq | 8 + .../list-functions/list-less-than-null-01.rq | 8 + .../list-functions/list-less-than-null-02.rq | 8 + .../list-functions/list-less-than-null-03.rq | 9 + .../list-functions/list-less-than-null-04.rq | 11 + .../list-functions/list-less-than-null-05.rq | 8 + .../list-functions/list-less-than-null-06.rq | 9 + .../SPARQL-CDTs/list-functions/manifest.ttl | 3226 +++++++++++++++++ .../SPARQL-CDTs/list-functions/reverse-01.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-02.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-03.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-04.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-05.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-06.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-07.rq | 9 + .../SPARQL-CDTs/list-functions/reverse-08.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-09.rq | 7 + .../SPARQL-CDTs/list-functions/reverse-10.rq | 9 + .../list-functions/reverse-error-01.rq | 8 + .../SPARQL-CDTs/list-functions/sameterm-01.rq | 6 + .../SPARQL-CDTs/list-functions/sameterm-02.rq | 6 + .../SPARQL-CDTs/list-functions/sameterm-03.rq | 6 + .../SPARQL-CDTs/list-functions/sameterm-04.rq | 6 + .../list-functions/sameterm-null-01.rq | 6 + .../SPARQL-CDTs/list-functions/size-01.rq | 7 + .../SPARQL-CDTs/list-functions/size-02.rq | 7 + .../SPARQL-CDTs/list-functions/size-03.rq | 7 + .../SPARQL-CDTs/list-functions/size-04.rq | 7 + .../SPARQL-CDTs/list-functions/size-05.rq | 7 + .../SPARQL-CDTs/list-functions/size-06.rq | 7 + .../SPARQL-CDTs/list-functions/size-07.rq | 7 + .../SPARQL-CDTs/list-functions/size-08.rq | 7 + .../SPARQL-CDTs/list-functions/size-09.rq | 7 + .../SPARQL-CDTs/list-functions/size-10.rq | 7 + .../SPARQL-CDTs/list-functions/size-11.rq | 7 + .../SPARQL-CDTs/list-functions/size-12.rq | 7 + .../list-functions/size-error-01.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-01.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-02.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-03.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-04.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-05.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-06.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-07.rq | 7 + .../SPARQL-CDTs/list-functions/subseq-08.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-09.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-10.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-11.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-12.rq | 8 + .../SPARQL-CDTs/list-functions/subseq-13.rq | 8 + .../list-functions/subseq-error-01.rq | 8 + .../list-functions/subseq-error-02.rq | 8 + .../SPARQL-CDTs/list-functions/tail-01.rq | 8 + .../SPARQL-CDTs/list-functions/tail-02.rq | 7 + .../SPARQL-CDTs/list-functions/tail-03.rq | 7 + .../SPARQL-CDTs/list-functions/tail-04.rq | 7 + .../SPARQL-CDTs/list-functions/tail-05.rq | 7 + .../SPARQL-CDTs/list-functions/tail-06.rq | 7 + .../SPARQL-CDTs/list-functions/tail-07.rq | 7 + .../SPARQL-CDTs/list-functions/tail-08.rq | 7 + .../SPARQL-CDTs/list-functions/tail-09.rq | 7 + .../SPARQL-CDTs/list-functions/tail-10.rq | 7 + .../list-functions/tail-error-01.rq | 8 + .../SPARQL-CDTs/list-functions/true.srx | 5 + jena-arq/testing/SPARQL-CDTs/manifest-all.ttl | 16 + .../map-functions/containsKey-01.rq | 9 + .../map-functions/containsKey-02.rq | 9 + .../map-functions/containsKey-03.rq | 11 + .../SPARQL-CDTs/map-functions/empty.ttl | 0 .../SPARQL-CDTs/map-functions/get-01.rq | 9 + .../SPARQL-CDTs/map-functions/get-02.rq | 9 + .../SPARQL-CDTs/map-functions/get-03.rq | 12 + .../SPARQL-CDTs/map-functions/get-04.rq | 12 + .../SPARQL-CDTs/map-functions/get-error-01.rq | 8 + .../SPARQL-CDTs/map-functions/get-null-01.rq | 8 + .../SPARQL-CDTs/map-functions/keys-01.rq | 7 + .../SPARQL-CDTs/map-functions/keys-02.rq | 7 + .../SPARQL-CDTs/map-functions/keys-03.rq | 10 + .../SPARQL-CDTs/map-functions/manifest.ttl | 2081 +++++++++++ .../map-functions/map-constructor-01.rq | 7 + .../map-functions/map-constructor-02.rq | 7 + .../map-functions/map-constructor-03.rq | 7 + .../map-functions/map-constructor-04.rq | 7 + .../map-functions/map-constructor-05.rq | 7 + .../map-functions/map-constructor-06.rq | 7 + .../map-functions/map-constructor-07.rq | 7 + .../map-functions/map-constructor-08.rq | 7 + .../map-functions/map-constructor-09.rq | 7 + .../map-functions/map-constructor-10.rq | 15 + .../map-functions/map-constructor-11.rq | 17 + .../map-functions/map-equals-01.rq | 6 + .../map-functions/map-equals-02.rq | 6 + .../map-functions/map-equals-03.rq | 6 + .../map-functions/map-equals-04.rq | 7 + .../map-functions/map-equals-05.rq | 6 + .../map-functions/map-equals-06.rq | 7 + .../map-functions/map-equals-07.rq | 7 + .../map-functions/map-equals-08.rq | 9 + .../map-functions/map-equals-09.rq | 8 + .../map-functions/map-equals-null-01.rq | 9 + .../map-functions/map-equals-null-02.rq | 9 + .../map-functions/map-greater-equal-01.rq | 8 + .../map-functions/map-greater-equal-02.rq | 8 + .../map-functions/map-greater-equal-03.rq | 8 + .../map-functions/map-greater-equal-04.rq | 8 + .../map-functions/map-greater-equal-05.rq | 8 + .../map-functions/map-greater-equal-06.rq | 8 + .../map-functions/map-greater-equal-07.rq | 8 + .../map-functions/map-greater-equal-08.rq | 8 + .../map-functions/map-greater-equal-09.rq | 8 + .../map-functions/map-greater-equal-10.rq | 8 + .../map-functions/map-greater-equal-11.rq | 8 + .../map-functions/map-greater-equal-12.rq | 8 + .../map-functions/map-greater-equal-13.rq | 8 + .../map-functions/map-greater-equal-14.rq | 8 + .../map-functions/map-greater-equal-15.rq | 10 + .../map-functions/map-greater-equal-16.rq | 10 + .../map-functions/map-greater-equal-17.rq | 10 + .../map-functions/map-greater-equal-18.rq | 10 + .../map-functions/map-greater-equal-19.rq | 10 + .../map-functions/map-greater-equal-20.rq | 10 + .../map-functions/map-greater-equal-21.rq | 10 + .../map-greater-equal-error-01.rq | 10 + .../map-greater-equal-error-02.rq | 10 + .../map-greater-equal-null-01.rq | 7 + .../map-greater-equal-null-02.rq | 8 + .../map-greater-equal-null-03.rq | 9 + .../map-greater-equal-null-04.rq | 9 + .../map-functions/map-greater-than-01.rq | 8 + .../map-functions/map-greater-than-02.rq | 8 + .../map-functions/map-greater-than-03.rq | 8 + .../map-functions/map-greater-than-04.rq | 8 + .../map-functions/map-greater-than-05.rq | 8 + .../map-functions/map-greater-than-06.rq | 8 + .../map-functions/map-greater-than-07.rq | 8 + .../map-functions/map-greater-than-08.rq | 8 + .../map-functions/map-greater-than-09.rq | 8 + .../map-functions/map-greater-than-10.rq | 8 + .../map-functions/map-greater-than-11.rq | 8 + .../map-functions/map-greater-than-12.rq | 8 + .../map-functions/map-greater-than-13.rq | 8 + .../map-functions/map-greater-than-14.rq | 8 + .../map-functions/map-greater-than-15.rq | 10 + .../map-functions/map-greater-than-16.rq | 10 + .../map-functions/map-greater-than-17.rq | 10 + .../map-functions/map-greater-than-18.rq | 10 + .../map-functions/map-greater-than-19.rq | 10 + .../map-functions/map-greater-than-20.rq | 10 + .../map-functions/map-greater-than-21.rq | 10 + .../map-greater-than-error-01.rq | 10 + .../map-greater-than-error-02.rq | 10 + .../map-functions/map-greater-than-null-01.rq | 7 + .../map-functions/map-greater-than-null-02.rq | 8 + .../map-functions/map-greater-than-null-03.rq | 9 + .../map-functions/map-greater-than-null-04.rq | 9 + .../map-functions/map-less-equal-01.rq | 8 + .../map-functions/map-less-equal-02.rq | 8 + .../map-functions/map-less-equal-03.rq | 8 + .../map-functions/map-less-equal-04.rq | 8 + .../map-functions/map-less-equal-05.rq | 8 + .../map-functions/map-less-equal-06.rq | 8 + .../map-functions/map-less-equal-07.rq | 8 + .../map-functions/map-less-equal-08.rq | 8 + .../map-functions/map-less-equal-09.rq | 8 + .../map-functions/map-less-equal-10.rq | 8 + .../map-functions/map-less-equal-11.rq | 8 + .../map-functions/map-less-equal-12.rq | 8 + .../map-functions/map-less-equal-13.rq | 8 + .../map-functions/map-less-equal-14.rq | 8 + .../map-functions/map-less-equal-15.rq | 10 + .../map-functions/map-less-equal-16.rq | 10 + .../map-functions/map-less-equal-17.rq | 10 + .../map-functions/map-less-equal-18.rq | 10 + .../map-functions/map-less-equal-19.rq | 10 + .../map-functions/map-less-equal-20.rq | 10 + .../map-functions/map-less-equal-21.rq | 10 + .../map-functions/map-less-equal-error-01.rq | 10 + .../map-functions/map-less-equal-error-02.rq | 10 + .../map-functions/map-less-equal-null-01.rq | 7 + .../map-functions/map-less-equal-null-02.rq | 8 + .../map-functions/map-less-equal-null-03.rq | 9 + .../map-functions/map-less-equal-null-04.rq | 9 + .../map-functions/map-less-than-01.rq | 8 + .../map-functions/map-less-than-02.rq | 8 + .../map-functions/map-less-than-03.rq | 8 + .../map-functions/map-less-than-04.rq | 8 + .../map-functions/map-less-than-05.rq | 8 + .../map-functions/map-less-than-06.rq | 8 + .../map-functions/map-less-than-07.rq | 8 + .../map-functions/map-less-than-08.rq | 8 + .../map-functions/map-less-than-09.rq | 8 + .../map-functions/map-less-than-10.rq | 8 + .../map-functions/map-less-than-11.rq | 8 + .../map-functions/map-less-than-12.rq | 8 + .../map-functions/map-less-than-13.rq | 8 + .../map-functions/map-less-than-14.rq | 8 + .../map-functions/map-less-than-15.rq | 10 + .../map-functions/map-less-than-16.rq | 10 + .../map-functions/map-less-than-17.rq | 10 + .../map-functions/map-less-than-18.rq | 10 + .../map-functions/map-less-than-19.rq | 10 + .../map-functions/map-less-than-20.rq | 10 + .../map-functions/map-less-than-21.rq | 10 + .../map-functions/map-less-than-error-01.rq | 10 + .../map-functions/map-less-than-error-02.rq | 10 + .../map-functions/map-less-than-null-01.rq | 7 + .../map-functions/map-less-than-null-02.rq | 8 + .../map-functions/map-less-than-null-03.rq | 9 + .../map-functions/map-less-than-null-04.rq | 9 + .../SPARQL-CDTs/map-functions/merge-01.rq | 10 + .../SPARQL-CDTs/map-functions/merge-02.rq | 10 + .../SPARQL-CDTs/map-functions/merge-03.rq | 10 + .../SPARQL-CDTs/map-functions/merge-04.rq | 10 + .../SPARQL-CDTs/map-functions/merge-05.rq | 10 + .../SPARQL-CDTs/map-functions/merge-06.rq | 10 + .../SPARQL-CDTs/map-functions/merge-07.rq | 10 + .../SPARQL-CDTs/map-functions/merge-08.rq | 10 + .../map-functions/merge-null-01.rq | 18 + .../map-functions/merge-null-02.rq | 18 + .../map-functions/merge-null-03.rq | 14 + .../map-functions/merge-null-04.rq | 10 + .../SPARQL-CDTs/map-functions/put-01.rq | 9 + .../SPARQL-CDTs/map-functions/put-02.rq | 12 + .../SPARQL-CDTs/map-functions/put-03.rq | 12 + .../SPARQL-CDTs/map-functions/put-04.rq | 9 + .../SPARQL-CDTs/map-functions/put-05.rq | 9 + .../SPARQL-CDTs/map-functions/put-06.rq | 9 + .../SPARQL-CDTs/map-functions/put-07.rq | 15 + .../SPARQL-CDTs/map-functions/put-08.rq | 15 + .../SPARQL-CDTs/map-functions/put-09.rq | 9 + .../SPARQL-CDTs/map-functions/put-10.rq | 15 + .../SPARQL-CDTs/map-functions/put-11.rq | 15 + .../SPARQL-CDTs/map-functions/put-12.rq | 10 + .../SPARQL-CDTs/map-functions/put-13.rq | 9 + .../SPARQL-CDTs/map-functions/put-14.rq | 9 + .../SPARQL-CDTs/map-functions/put-15.rq | 9 + .../SPARQL-CDTs/map-functions/put-error-01.rq | 8 + .../SPARQL-CDTs/map-functions/put-error-02.rq | 8 + .../SPARQL-CDTs/map-functions/put-error-03.rq | 8 + .../SPARQL-CDTs/map-functions/put-error-04.rq | 8 + .../SPARQL-CDTs/map-functions/put-error-05.rq | 7 + .../SPARQL-CDTs/map-functions/remove-01.rq | 11 + .../SPARQL-CDTs/map-functions/remove-02.rq | 9 + .../SPARQL-CDTs/map-functions/remove-03.rq | 9 + .../SPARQL-CDTs/map-functions/remove-04.rq | 9 + .../SPARQL-CDTs/map-functions/remove-05.rq | 10 + .../SPARQL-CDTs/map-functions/remove-06.rq | 10 + .../SPARQL-CDTs/map-functions/remove-07.rq | 10 + .../SPARQL-CDTs/map-functions/remove-08.rq | 9 + .../SPARQL-CDTs/map-functions/remove-09.rq | 9 + .../SPARQL-CDTs/map-functions/remove-10.rq | 9 + .../SPARQL-CDTs/map-functions/remove-11.rq | 9 + .../SPARQL-CDTs/map-functions/sameterm-01.rq | 6 + .../SPARQL-CDTs/map-functions/sameterm-02.rq | 6 + .../SPARQL-CDTs/map-functions/sameterm-03.rq | 6 + .../SPARQL-CDTs/map-functions/sameterm-04.rq | 6 + .../SPARQL-CDTs/map-functions/sameterm-05.rq | 6 + .../map-functions/sameterm-null-01.rq | 6 + .../SPARQL-CDTs/map-functions/size-01.rq | 7 + .../SPARQL-CDTs/map-functions/size-02.rq | 7 + .../SPARQL-CDTs/map-functions/size-03.rq | 7 + .../SPARQL-CDTs/map-functions/size-04.rq | 7 + .../SPARQL-CDTs/map-functions/size-05.rq | 7 + .../SPARQL-CDTs/map-functions/true.srx | 5 + .../testing/SPARQL-CDTs/orderby/empty.ttl | 0 .../testing/SPARQL-CDTs/orderby/manifest.ttl | 291 ++ .../SPARQL-CDTs/orderby/order-list-03.rq | 15 + .../SPARQL-CDTs/orderby/order-list-04.rq | 15 + .../SPARQL-CDTs/orderby/order-list-05.rq | 18 + .../SPARQL-CDTs/orderby/order-list-06.rq | 15 + .../SPARQL-CDTs/orderby/order-list-07.rq | 15 + .../SPARQL-CDTs/orderby/order-list-08.rq | 15 + .../SPARQL-CDTs/orderby/order-list-09.rq | 15 + .../SPARQL-CDTs/orderby/order-list-10.rq | 15 + .../SPARQL-CDTs/orderby/order-list-null-01.rq | 15 + .../SPARQL-CDTs/orderby/order-list-null-02.rq | 16 + .../SPARQL-CDTs/orderby/order-map-03.rq | 15 + .../SPARQL-CDTs/orderby/order-map-04.rq | 15 + .../SPARQL-CDTs/orderby/order-map-05.rq | 15 + .../SPARQL-CDTs/orderby/order-map-06.rq | 15 + .../SPARQL-CDTs/orderby/order-map-07.rq | 15 + .../SPARQL-CDTs/orderby/order-map-08.rq | 15 + .../SPARQL-CDTs/orderby/order-map-09.rq | 15 + .../SPARQL-CDTs/orderby/order-map-10.rq | 15 + .../SPARQL-CDTs/orderby/order-map-11.rq | 15 + .../SPARQL-CDTs/orderby/order-map-12.rq | 18 + .../SPARQL-CDTs/orderby/order-map-13.rq | 15 + .../SPARQL-CDTs/orderby/order-map-14.rq | 15 + .../SPARQL-CDTs/orderby/order-map-15.rq | 15 + .../SPARQL-CDTs/orderby/order-map-16.rq | 15 + .../SPARQL-CDTs/orderby/order-map-17.rq | 15 + .../SPARQL-CDTs/orderby/order-map-null-01.rq | 15 + .../SPARQL-CDTs/orderby/order-map-null-02.rq | 16 + jena-arq/testing/SPARQL-CDTs/orderby/true.srx | 5 + jena-arq/testing/SPARQL-CDTs/unfold/empty.ttl | 0 .../testing/SPARQL-CDTs/unfold/manifest.ttl | 483 +++ jena-arq/testing/SPARQL-CDTs/unfold/true.srx | 5 + .../unfold/unfold-get-list-1var-01.rq | 7 + .../unfold/unfold-get-list-1var-02.rq | 7 + .../unfold/unfold-get-list-1var-03.rq | 9 + .../unfold/unfold-get-list-1var-04.rq | 9 + .../unfold/unfold-get-list-2vars-01.rq | 7 + .../unfold/unfold-get-list-2vars-02.rq | 7 + .../unfold/unfold-get-list-2vars-03.rq | 9 + .../unfold/unfold-get-list-2vars-04.rq | 9 + .../unfold/unfold-get-list-2vars-05.rq | 7 + .../unfold/unfold-get-list-2vars-06.rq | 10 + .../SPARQL-CDTs/unfold/unfold-list-1var-01.rq | 6 + .../unfold/unfold-list-1var-01.srj | 14 + .../SPARQL-CDTs/unfold/unfold-list-1var-02.rq | 6 + .../unfold/unfold-list-1var-02.srj | 17 + .../SPARQL-CDTs/unfold/unfold-list-1var-03.rq | 6 + .../unfold/unfold-list-1var-03.srj | 14 + .../SPARQL-CDTs/unfold/unfold-list-1var-04.rq | 6 + .../unfold/unfold-list-1var-04.srj | 14 + .../SPARQL-CDTs/unfold/unfold-list-1var-05.rq | 6 + .../unfold/unfold-list-1var-05.srj | 14 + .../SPARQL-CDTs/unfold/unfold-list-1var-06.rq | 6 + .../unfold/unfold-list-1var-06.srj | 14 + .../SPARQL-CDTs/unfold/unfold-list-1var-07.rq | 6 + .../unfold/unfold-list-1var-07.srj | 17 + .../SPARQL-CDTs/unfold/unfold-list-1var-08.rq | 6 + .../unfold/unfold-list-1var-08.srj | 17 + .../SPARQL-CDTs/unfold/unfold-list-1var-09.rq | 6 + .../unfold/unfold-list-1var-09.srj | 13 + .../SPARQL-CDTs/unfold/unfold-list-1var-10.rq | 6 + .../unfold/unfold-list-1var-10.srj | 15 + .../unfold/unfold-list-2vars-01.rq | 6 + .../unfold/unfold-list-2vars-01.srj | 16 + .../unfold/unfold-list-2vars-02.rq | 6 + .../unfold/unfold-list-2vars-02.srj | 20 + .../unfold/unfold-list-2vars-03.rq | 6 + .../unfold/unfold-list-2vars-03.srj | 16 + .../unfold/unfold-list-2vars-04.rq | 6 + .../unfold/unfold-list-2vars-04.srj | 16 + .../unfold/unfold-list-2vars-05.rq | 6 + .../unfold/unfold-list-2vars-05.srj | 16 + .../unfold/unfold-list-2vars-06.rq | 6 + .../unfold/unfold-list-2vars-06.srj | 16 + .../unfold/unfold-list-2vars-07.rq | 6 + .../unfold/unfold-list-2vars-07.srj | 20 + .../unfold/unfold-list-2vars-08.rq | 6 + .../unfold/unfold-list-2vars-08.srj | 20 + .../unfold/unfold-list-2vars-09.rq | 6 + .../unfold/unfold-list-2vars-09.srj | 15 + .../unfold/unfold-list-2vars-10.rq | 6 + .../unfold/unfold-list-2vars-10.srj | 18 + .../SPARQL-CDTs/unfold/unfold-map-1var-01.rq | 6 + .../SPARQL-CDTs/unfold/unfold-map-1var-01.srj | 14 + .../SPARQL-CDTs/unfold/unfold-map-1var-02.rq | 6 + .../SPARQL-CDTs/unfold/unfold-map-1var-02.srj | 14 + .../SPARQL-CDTs/unfold/unfold-map-1var-03.rq | 6 + .../SPARQL-CDTs/unfold/unfold-map-1var-03.srj | 14 + .../SPARQL-CDTs/unfold/unfold-map-1var-04.rq | 6 + .../SPARQL-CDTs/unfold/unfold-map-1var-04.srj | 14 + .../SPARQL-CDTs/unfold/unfold-map-2vars-01.rq | 6 + .../unfold/unfold-map-2vars-01.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-02.rq | 6 + .../unfold/unfold-map-2vars-02.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-03.rq | 6 + .../unfold/unfold-map-2vars-03.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-04.rq | 6 + .../unfold/unfold-map-2vars-04.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-05.rq | 6 + .../unfold/unfold-map-2vars-05.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-06.rq | 6 + .../unfold/unfold-map-2vars-06.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-07.rq | 6 + .../unfold/unfold-map-2vars-07.srj | 16 + .../SPARQL-CDTs/unfold/unfold-map-2vars-08.rq | 6 + .../unfold/unfold-map-2vars-08.srj | 15 + 747 files changed, 14280 insertions(+) create mode 100644 jena-arq/src/test/java/org/apache/jena/external/Scripts_SPARQLCDTs.java create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15a.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15b.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16a.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16b.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17a.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17b.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18a.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18b.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19a.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19b.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-41.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-42.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-43.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-44.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-45.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-46.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-47.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-48.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-49.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-50.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-51.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-52.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/bnodes/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/fold/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/concat-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/contains-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-error-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/get-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/head-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-29.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-31.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-29.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-31.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-29.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-31.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-22.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-23.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-24.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-25.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-26.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-27.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-28.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-29.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-31.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/reverse-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/size-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/tail-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/list-functions/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/manifest-all.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/get-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/keys-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/keys-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/keys-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-18.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-19.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-20.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-21.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-error-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-error-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-error-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-error-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/put-error-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/remove-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/size-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/size-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/size-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/size-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/size-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/map-functions/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-11.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-12.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-13.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-14.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-15.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-16.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-17.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/orderby/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/empty.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/manifest.ttl create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/true.srx create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.srj create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.rq create mode 100644 jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.srj diff --git a/jena-arq/src/test/java/org/apache/jena/external/Scripts_SPARQLCDTs.java b/jena-arq/src/test/java/org/apache/jena/external/Scripts_SPARQLCDTs.java new file mode 100644 index 00000000000..906bc276d12 --- /dev/null +++ b/jena-arq/src/test/java/org/apache/jena/external/Scripts_SPARQLCDTs.java @@ -0,0 +1,32 @@ +/** + * 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 org.apache.jena.external; + +import org.apache.jena.arq.junit.manifest.Manifests; +import org.apache.jena.arq.junit.runners.Label; +import org.apache.jena.arq.junit.runners.RunnerSPARQL; +import org.junit.runner.RunWith; + +@RunWith(RunnerSPARQL.class) +@Label("SPARQL CDTs") +@Manifests({ + "testing/SPARQL-CDTs/manifest-all.ttl" +}) + +public class Scripts_SPARQLCDTs {} diff --git a/jena-arq/testing/README.txt b/jena-arq/testing/README.txt index 63cb39390d6..18de84cd2fb 100644 --- a/jena-arq/testing/README.txt +++ b/jena-arq/testing/README.txt @@ -23,3 +23,6 @@ extensions. * supports expression without AS in SELECT clause +SPARQL-CDTs/ Test copied (on July 4, 2024) from + https://github.com/awslabs/SPARQL-CDTs/tree/main/tests + diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-01.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-01.rq new file mode 100644 index 00000000000..e4d9c2bd37b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-01.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42, _:b]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-02.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-02.rq new file mode 100644 index 00000000000..8e8be35e895 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-02.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42, '3': _:b }"^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-03.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-03.rq new file mode 100644 index 00000000000..93ebd5664d1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-03.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42, _:b2]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-04.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-04.rq new file mode 100644 index 00000000000..f2ce31b6b78 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-04.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b1, '2': 42, '3': _:b2 }"^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-05.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-05.rq new file mode 100644 index 00000000000..d2b344dac5a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-05.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42]"^^cdt:List AS ?list1 ) + BIND( "[_:b, 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-06.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-06.rq new file mode 100644 index 00000000000..c850d8e4e98 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-06.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( "{ '1': _:b, '2': 43 }"^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-07.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-07.rq new file mode 100644 index 00000000000..61386dbba5b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-07.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42]"^^cdt:List AS ?list1 ) + BIND( "[_:b2, 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-08.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-08.rq new file mode 100644 index 00000000000..918c642959e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-08.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b1, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( "{ '1': _:b2, '2': 43 }"^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-09.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-09.rq new file mode 100644 index 00000000000..5b95fe6da62 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-09.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[ _:b, 42 ]"^^cdt:List AS ?list ) + BIND( "{ '1': _:b, '2': 43 }"^^cdt:Map AS ?map ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?map,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-11.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-11.rq new file mode 100644 index 00000000000..422c6aaac23 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-11.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42, [_:b] ]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-12.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-12.rq new file mode 100644 index 00000000000..a4f54282ec5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-12.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42, '3': {'4': _:b} }"^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-13.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-13.rq new file mode 100644 index 00000000000..4d15b0baa02 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-13.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42, [_:b2] ]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-14.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-14.rq new file mode 100644 index 00000000000..dd785407ec8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-14.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b1, '2': 42, '3': {'4': _:b2} }"^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-15.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-15.rq new file mode 100644 index 00000000000..b9eb123855c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-15.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42]"^^cdt:List AS ?list1 ) + BIND( "[ [_:b], 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-16.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-16.rq new file mode 100644 index 00000000000..945ee890a79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-16.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( "{ '1': {'3': _:b}, '2': 43 }"^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-17.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-17.rq new file mode 100644 index 00000000000..cdfef2ed011 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-17.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42]"^^cdt:List AS ?list1 ) + BIND( "[ [_:b2], 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-18.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-18.rq new file mode 100644 index 00000000000..307e031346d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-18.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b1, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( "{ '1': {'3': _:b2}, '2': 43 }"^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-21.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-21.rq new file mode 100644 index 00000000000..c53b1c7065a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-21.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42, '[_:b]'^^ ]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-22.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-22.rq new file mode 100644 index 00000000000..cc2e538dd3a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-22.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( """{ '1': _:b, '2': 42, '3': "{'4': _:b}"^^ }"""^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-23.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-23.rq new file mode 100644 index 00000000000..6aec1c7ef92 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-23.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42, '[_:b2]'^^ ]"^^cdt:List AS ?list ) + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-24.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-24.rq new file mode 100644 index 00000000000..c1ed49d4029 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-24.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( """{ '1': _:b1, '2': 42, '3': "{'4': _:b2}"^^ }"""^^cdt:Map AS ?map ) + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-25.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-25.rq new file mode 100644 index 00000000000..4a92c370f47 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-25.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42]"^^cdt:List AS ?list1 ) + BIND( "[ '[_:b]'^^, 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-26.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-26.rq new file mode 100644 index 00000000000..9b72d62fb0d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-26.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( """{ '1': "{'3': _:b}"^^, '2': 43 }"""^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-27.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-27.rq new file mode 100644 index 00000000000..cd1b9ab2076 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-27.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b1, 42]"^^cdt:List AS ?list1 ) + BIND( "[ '[_:b2]'^^, 43]"^^cdt:List AS ?list2 ) + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-28.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-28.rq new file mode 100644 index 00000000000..84308d2ac01 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-sparql-28.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b1, '2': 42 }"^^cdt:Map AS ?map1 ) + BIND( """{ '1': "{'3': _:b2}"^^, '2': 43 }"""^^cdt:Map AS ?map2 ) + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.rq new file mode 100644 index 00000000000..0ee93c7bf1d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.ttl new file mode 100644 index 00000000000..eb2752733eb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-01.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b, 42, _:b]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.rq new file mode 100644 index 00000000000..7258c34b428 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.ttl new file mode 100644 index 00000000000..90ffb7f25c2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-02.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "{ '1': _:b, '2': 42, '3': _:b }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.rq new file mode 100644 index 00000000000..88d7a34d556 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.ttl new file mode 100644 index 00000000000..5502a19e922 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-03.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b1, 42, _:b2]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.rq new file mode 100644 index 00000000000..b04cf7208b2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.ttl new file mode 100644 index 00000000000..8d7f8d07dbf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-04.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "{ '1': _:b1, '2': 42, '3': _:b2 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.rq new file mode 100644 index 00000000000..36a894ac01d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s = ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.ttl new file mode 100644 index 00000000000..6194f8e35cb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-05.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p "[_:b, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.rq new file mode 100644 index 00000000000..b2fa647e518 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s = ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.ttl new file mode 100644 index 00000000000..05fc3eaef24 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-06.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p "{ '1': _:b, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.rq new file mode 100644 index 00000000000..04ed6a8bf56 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s != ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.ttl new file mode 100644 index 00000000000..211ee3dfb48 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-07.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p "[_:b2, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.rq new file mode 100644 index 00000000000..e7bb213f05a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s != ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.ttl new file mode 100644 index 00000000000..ff9c4133215 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-08.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p "{ '1': _:b2, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.rq new file mode 100644 index 00000000000..458d01bbe3f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list1 . + ex:s ex:p2 ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.ttl new file mode 100644 index 00000000000..4cbb085bed0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-09.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . +ex:s ex:p2 "[_:b, 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.rq new file mode 100644 index 00000000000..523312c8de0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map1 . + ex:s ex:p2 ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.ttl new file mode 100644 index 00000000000..ac3b7836b41 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-10.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b, '2': 42 }"^^cdt:Map . +ex:s ex:p2 "{ '1': _:b, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.rq new file mode 100644 index 00000000000..ef9a8a0577a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list1 . + ex:s ex:p2 ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.ttl new file mode 100644 index 00000000000..3372e37b3cc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-11.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b1, 42]"^^cdt:List . +ex:s ex:p2 "[_:b2, 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.rq new file mode 100644 index 00000000000..eda5afd3987 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map1 . + ex:s ex:p2 ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.ttl new file mode 100644 index 00000000000..1cbb9944518 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-12.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b1, '2': 42 }"^^cdt:Map . +ex:s ex:p2 "{ '1': _:b2, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.rq new file mode 100644 index 00000000000..02ff4313287 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list . + ex:s ex:p2 ?map . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?map,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.ttl new file mode 100644 index 00000000000..55d61641873 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-13.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[ _:b, 42 ]"^^cdt:List . +ex:s ex:p2 "{ '1': _:b, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.rq new file mode 100644 index 00000000000..1ae250c6e1a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list . + ex:s ex:p2 ?map . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?map,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.ttl new file mode 100644 index 00000000000..1541932ad91 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-14.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[ _:b1, 42 ]"^^cdt:List . +ex:s ex:p2 "{ '1': _:b2, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15.rq new file mode 100644 index 00000000000..ef9a8a0577a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list1 . + ex:s ex:p2 ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15a.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15a.ttl new file mode 100644 index 00000000000..9d414841c38 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15a.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15b.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15b.ttl new file mode 100644 index 00000000000..c4b0e9de469 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-15b.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p2 "[_:b, 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16.rq new file mode 100644 index 00000000000..eda5afd3987 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map1 . + ex:s ex:p2 ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16a.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16a.ttl new file mode 100644 index 00000000000..9667eb0bf47 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16a.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16b.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16b.ttl new file mode 100644 index 00000000000..3a858d3d899 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-16b.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p2 "{ '1': _:b, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17.rq new file mode 100644 index 00000000000..3e89da7cd83 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list . + ex:s ex:p2 ?bn . + + BIND( cdt:get(?list,1) AS ?e1 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?bn) ) + FILTER( ?e1 != ?bn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17a.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17a.ttl new file mode 100644 index 00000000000..9d414841c38 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17a.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17b.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17b.ttl new file mode 100644 index 00000000000..fa65368fd78 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-17b.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p2 _:b . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18.rq new file mode 100644 index 00000000000..87f7b29f398 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map . + ex:s ex:p2 ?bn . + + BIND( cdt:get(?map,'1') AS ?e1 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?bn) ) + FILTER( ?e1 != ?bn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18a.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18a.ttl new file mode 100644 index 00000000000..9667eb0bf47 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18a.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18b.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18b.ttl new file mode 100644 index 00000000000..fa65368fd78 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-18b.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p2 _:b . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19.rq new file mode 100644 index 00000000000..1ae250c6e1a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list . + ex:s ex:p2 ?map . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?map,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19a.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19a.ttl new file mode 100644 index 00000000000..9d414841c38 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19a.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19b.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19b.ttl new file mode 100644 index 00000000000..3a858d3d899 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-19b.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p2 "{ '1': _:b, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.rq new file mode 100644 index 00000000000..9d8ce958922 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.ttl new file mode 100644 index 00000000000..081108e9bfe --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-21.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b, 42, [_:b] ]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.rq new file mode 100644 index 00000000000..475e111f0a3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 = ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.ttl new file mode 100644 index 00000000000..a203de82c9b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-22.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "{ '1': _:b, '2': 42, '3': {'4': _:b} }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.rq new file mode 100644 index 00000000000..52d3753acd4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?e1 ) + BIND( cdt:get(?list,3) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.ttl new file mode 100644 index 00000000000..ca1ec509c7d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-23.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b1, 42, [_:b2] ]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.rq new file mode 100644 index 00000000000..e38b5dfa972 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?e1 ) + BIND( cdt:get(?map,'3') AS ?innermap ) + BIND( cdt:get(?innermap,'4') AS ?e3 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e3) ) + FILTER( ?e1 != ?e3 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.ttl new file mode 100644 index 00000000000..e9094880c5f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-24.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "{ '1': _:b1, '2': 42, '3': {'4': _:b2} }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.rq new file mode 100644 index 00000000000..773ee2b1cef --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s = ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.ttl new file mode 100644 index 00000000000..219352750ab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-25.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p " [ [_:b], 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.rq new file mode 100644 index 00000000000..3c6d05d6ef1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s = ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.ttl new file mode 100644 index 00000000000..3ed6ba200df --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-26.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p "{ '1': {'3': _:b}, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.rq new file mode 100644 index 00000000000..3889700951e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?list . + + BIND( cdt:get(?list,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s != ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.ttl new file mode 100644 index 00000000000..ea8e4ec6db0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-27.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p "[ [_:b2], 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.rq new file mode 100644 index 00000000000..938b214449f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ?s ex:p ?map . + + BIND( cdt:get(?map,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e1 ) + + FILTER( isBLANK(?s) ) + FILTER( isBLANK(?e1) ) + FILTER( ?s != ?e1 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.ttl new file mode 100644 index 00000000000..dc0498b184e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-28.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p "{ '1': {'3': _:b2}, '2': 42 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.rq new file mode 100644 index 00000000000..7ee3e301649 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list1 . + ex:s ex:p2 ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.ttl new file mode 100644 index 00000000000..80e3b3c5860 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-29.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . +ex:s ex:p2 "[ [_:b], 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.rq new file mode 100644 index 00000000000..54e37e63d1e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map1 . + ex:s ex:p2 ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 = ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.ttl new file mode 100644 index 00000000000..b5e116b8dfd --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-30.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b, '2': 42 }"^^cdt:Map . +ex:s ex:p2 "{ '1': {'3': _:b}, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.rq new file mode 100644 index 00000000000..cbbd4379c9e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?list1 . + ex:s ex:p2 ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?innerlist ) + BIND( cdt:get(?innerlist,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.ttl new file mode 100644 index 00000000000..09bb8e49691 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-31.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b1, 42]"^^cdt:List . +ex:s ex:p2 "[ [_:b2], 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.rq new file mode 100644 index 00000000000..9d5d1b22cac --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + ex:s ex:p1 ?map1 . + ex:s ex:p2 ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?innermap ) + BIND( cdt:get(?innermap,'3') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.ttl new file mode 100644 index 00000000000..dd63fb29ba5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-32.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b1, '2': 42 }"^^cdt:Map . +ex:s ex:p2 "{ '1': {'3': _:b2}, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-41.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-41.ttl new file mode 100644 index 00000000000..ae81042e19c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-41.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b, 42, '[_:b]'^^ ]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-42.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-42.ttl new file mode 100644 index 00000000000..d2976d8b6c3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-42.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p """{ '1': _:b, '2': 42, '3': "{'4': _:b}"^^ }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-43.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-43.ttl new file mode 100644 index 00000000000..3d5bf351cb7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-43.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b1, 42, '[_:b2]'^^ ]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-44.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-44.ttl new file mode 100644 index 00000000000..8e9f25f47e6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-44.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p """{ '1': _:b1, '2': 42, '3': "{'4': _:b2}"^^ }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-45.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-45.ttl new file mode 100644 index 00000000000..0d5cff1a03c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-45.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p "[ '[_:b]'^^, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-46.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-46.ttl new file mode 100644 index 00000000000..ec80c1fbe20 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-46.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b ex:p """{ '1': "{'3': _:b}"^^, '2': 42 }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-47.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-47.ttl new file mode 100644 index 00000000000..02da47e903f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-47.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p "[ '[_:b2]'^^, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-48.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-48.ttl new file mode 100644 index 00000000000..6d22ca06b75 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-48.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +_:b1 ex:p """{ '1': "{'3': _:b2}"^^, '2': 42 }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-49.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-49.ttl new file mode 100644 index 00000000000..3923af01254 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-49.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b, 42]"^^cdt:List . +ex:s ex:p2 "[ '[_:b]'^^, 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-50.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-50.ttl new file mode 100644 index 00000000000..77364e76c80 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-50.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b, '2': 42 }"^^cdt:Map . +ex:s ex:p2 """{ '1': "{'3': _:b}"^^, '2': 43 }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-51.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-51.ttl new file mode 100644 index 00000000000..99d0674cf44 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-51.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "[_:b1, 42]"^^cdt:List . +ex:s ex:p2 "[ '[_:b2]'^^, 43]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-52.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-52.ttl new file mode 100644 index 00000000000..a19b160ef85 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-52.ttl @@ -0,0 +1,8 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p1 "{ '1': _:b1, '2': 42 }"^^cdt:Map . +ex:s ex:p2 """{ '1': "{'3': _:b2}"^^, '2': 43 }"""^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.rq new file mode 100644 index 00000000000..144f722b48d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42]"^^cdt:List AS ?list1 ) + ex:s ex:p ?list2 . + + BIND( cdt:get(?list1,1) AS ?e1 ) + BIND( cdt:get(?list2,1) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.ttl new file mode 100644 index 00000000000..e46c2ca5c0e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-01.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "[_:b, 42]"^^cdt:List . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.rq new file mode 100644 index 00000000000..cdca76e68ac --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42 }"^^cdt:Map AS ?map1 ) + ex:s ex:p ?map2 . + + BIND( cdt:get(?map1,'1') AS ?e1 ) + BIND( cdt:get(?map2,'1') AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ?e1 != ?e2 ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.ttl new file mode 100644 index 00000000000..badff0fccc2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-02.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p "{ '1': _:b, '2': 43 }"^^cdt:Map . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.rq new file mode 100644 index 00000000000..0b4097da294 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "[_:b, 42]"^^cdt:List AS ?list ) + ex:s ex:p ?bn . + + BIND( cdt:get(?list,1) AS ?e1 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?bn) ) + FILTER( ?e1 != ?bn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.ttl new file mode 100644 index 00000000000..d4fb3570e11 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-03.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p _:b . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.rq b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.rq new file mode 100644 index 00000000000..822b971d84b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.rq @@ -0,0 +1,13 @@ +PREFIX cdt: +PREFIX ex: + +ASK { + BIND( "{ '1': _:b, '2': 42 }"^^cdt:Map AS ?map ) + ex:s ex:p ?bn . + + BIND( cdt:get(?map,'1') AS ?e1 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?bn) ) + FILTER( ?e1 != ?bn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.ttl new file mode 100644 index 00000000000..d4fb3570e11 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/bnodes-turtle-sparql-04.ttl @@ -0,0 +1,7 @@ +PREFIX rdf: +PREFIX rdfs: +PREFIX xsd: +PREFIX cdt: +PREFIX ex: + +ex:s ex:p _:b . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/empty.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/bnodes/manifest.ttl new file mode 100644 index 00000000000..b026ae1cb25 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/manifest.ttl @@ -0,0 +1,749 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "Handling of blank nodes in CDT literals" ; + mf:entries + ( + :bnodes-turtle-01 + :bnodes-turtle-02 + :bnodes-turtle-03 + :bnodes-turtle-04 + :bnodes-turtle-05 + :bnodes-turtle-06 + :bnodes-turtle-07 + :bnodes-turtle-08 + :bnodes-turtle-09 + :bnodes-turtle-10 + :bnodes-turtle-11 + :bnodes-turtle-12 + :bnodes-turtle-13 + :bnodes-turtle-14 + :bnodes-turtle-15 + :bnodes-turtle-16 + :bnodes-turtle-17 + :bnodes-turtle-18 + :bnodes-turtle-19 + + :bnodes-turtle-21 + :bnodes-turtle-22 + :bnodes-turtle-23 + :bnodes-turtle-24 + :bnodes-turtle-25 + :bnodes-turtle-26 + :bnodes-turtle-27 + :bnodes-turtle-28 + :bnodes-turtle-29 + :bnodes-turtle-30 + :bnodes-turtle-31 + :bnodes-turtle-32 + + :bnodes-turtle-41 + :bnodes-turtle-42 + :bnodes-turtle-43 + :bnodes-turtle-44 + :bnodes-turtle-45 + :bnodes-turtle-46 + :bnodes-turtle-47 + :bnodes-turtle-48 + :bnodes-turtle-49 + :bnodes-turtle-50 + :bnodes-turtle-51 + :bnodes-turtle-52 + + :bnodes-sparql-01 + :bnodes-sparql-02 + :bnodes-sparql-03 + :bnodes-sparql-04 + :bnodes-sparql-05 + :bnodes-sparql-06 + :bnodes-sparql-07 + :bnodes-sparql-08 + :bnodes-sparql-09 + + :bnodes-sparql-11 + :bnodes-sparql-12 + :bnodes-sparql-13 + :bnodes-sparql-14 + :bnodes-sparql-15 + :bnodes-sparql-16 + :bnodes-sparql-17 + :bnodes-sparql-18 + + :bnodes-sparql-21 + :bnodes-sparql-22 + :bnodes-sparql-23 + :bnodes-sparql-24 + :bnodes-sparql-25 + :bnodes-sparql-26 + :bnodes-sparql-27 + :bnodes-sparql-28 + + :bnodes-turtle-sparql-01 + :bnodes-turtle-sparql-02 + :bnodes-turtle-sparql-03 + :bnodes-turtle-sparql-04 + ) . + +:bnodes-turtle-01 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-01" ; + rdfs:comment "same blank node identifier twice within a cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-02 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-02" ; + rdfs:comment "same blank node identifier twice within a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-03 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-03" ; + rdfs:comment "different blank node identifiers within a cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-04 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-04" ; + rdfs:comment "different blank node identifiers within a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-05 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-05" ; + rdfs:comment "same blank node identifier both within a cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-06 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-06" ; + rdfs:comment "same blank node identifier both within a cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-07 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-07" ; + rdfs:comment "different blank node identifiers within a cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-08 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-08" ; + rdfs:comment "different blank node identifiers within a cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-09 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-09" ; + rdfs:comment "same blank node identifier within two different cdt:List literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-10 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-10" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-11 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-11" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-12 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-12" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-13 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-13" ; + rdfs:comment "same blank node identifier both within a cdt:List literal and a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-14 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-14" ; + rdfs:comment "different blank node identifiers within a cdt:List literal and a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-15 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-15" ; + rdfs:comment "same blank node identifier within cdt:List literals in two different files" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data , + ; + qt:query ] ; + mf:result . + +:bnodes-turtle-16 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-16" ; + rdfs:comment "same blank node identifier within cdt:Map literals in two different files" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data , + ; + qt:query ] ; + mf:result . + +:bnodes-turtle-17 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-17" ; + rdfs:comment "same blank node identifier within a cdt:List literal in one file and outside of literals in another file" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data , + ; + qt:query ] ; + mf:result . + +:bnodes-turtle-18 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-18" ; + rdfs:comment "same blank node identifier within a cdt:Map literal in one file and outside of literals in another file" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data , + ; + qt:query ] ; + mf:result . + +:bnodes-turtle-19 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-19" ; + rdfs:comment "same blank node identifier within a cdt:List literal in one file and within a cdt:Map literal in another file" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data , + ; + qt:query ] ; + mf:result . + +:bnodes-turtle-21 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-21" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-22 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-22" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-23 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-23" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-24 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-24" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-25 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-25" ; + rdfs:comment "same blank node identifier both within a *nested* cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-26 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-26" ; + rdfs:comment "same blank node identifier both within a *nested* cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-27 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-27" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-28 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-28" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-29 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-29" ; + rdfs:comment "same blank node identifier within two different cdt:List literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-30 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-30" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-31 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-31" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-32 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-32" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-41 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-41" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-42 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-42" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-43 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-43" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-44 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-44" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-45 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-45" ; + rdfs:comment "same blank node identifier both within a *nested* cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-46 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-46" ; + rdfs:comment "same blank node identifier both within a *nested* cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-47 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-47" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:List literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-48 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-48" ; + rdfs:comment "different blank node identifiers within a *nested* cdt:Map literal and outside of the literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-49 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-49" ; + rdfs:comment "same blank node identifier within two different cdt:List literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-50 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-50" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-51 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-51" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-52 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-52" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals, where one of them is nested" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + + + +:bnodes-sparql-01 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-01" ; + rdfs:comment "same blank node identifier twice within a cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-02 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-02" ; + rdfs:comment "same blank node identifier twice within a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-03 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-03" ; + rdfs:comment "two different blank node identifiers within a cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-04 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-04" ; + rdfs:comment "two different blank node identifiers within a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-05 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-05" ; + rdfs:comment "same blank node identifier within two different cdt:List literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-06 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-06" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-07 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-07" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-08 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-08" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-09 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-09" ; + rdfs:comment "same blank node identifier, once within a cdt:List literal and once within a cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-11 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-11" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-12 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-12" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-13 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-13" ; + rdfs:comment "two different blank node identifiers within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-14 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-14" ; + rdfs:comment "two different blank node identifiers within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-15 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-15" ; + rdfs:comment "same blank node identifier within two different cdt:List literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-16 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-16" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-17 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-17" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-18 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-18" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-21 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-21" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-22 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-22" ; + rdfs:comment "same blank node identifier twice within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-23 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-23" ; + rdfs:comment "two different blank node identifiers within a *nested* cdt:List literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-24 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-24" ; + rdfs:comment "two different blank node identifiers within a *nested* cdt:Map literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-25 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-25" ; + rdfs:comment "same blank node identifier within two different cdt:List literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-26 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-26" ; + rdfs:comment "same blank node identifier within two different cdt:Map literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-27 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-27" ; + rdfs:comment "different blank node identifiers within two different cdt:List literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-sparql-28 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-sparql-28" ; + rdfs:comment "different blank node identifiers within two different cdt:Map literals, where one of them is a nested one" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + + + +:bnodes-turtle-sparql-01 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-sparql-01" ; + rdfs:comment "same blank node identifier both within a cdt:List literal in a Turtle file and within a cdt:List literal in the SPARQL query" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-sparql-02 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-sparql-02" ; + rdfs:comment "same blank node identifier both within a cdt:Map literal in a Turtle file and within a cdt:Map literal in the SPARQL query" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-sparql-03 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-sparql-03" ; + rdfs:comment "same blank node identifier both within a cdt:List literal in the SPARQL query and outside of literals in a Turtle file" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . + +:bnodes-turtle-sparql-04 rdf:type mf:QueryEvaluationTest ; + mf:name "bnodes-turtle-sparql-04" ; + rdfs:comment "same blank node identifier both within a cdt:Map literal in the SPARQL query and outside of literals in a Turtle file" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:data ; + qt:query ] ; + mf:result . diff --git a/jena-arq/testing/SPARQL-CDTs/bnodes/true.srx b/jena-arq/testing/SPARQL-CDTs/bnodes/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/bnodes/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/fold/empty.ttl b/jena-arq/testing/SPARQL-CDTs/fold/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-01.rq new file mode 100644 index 00000000000..d6fdf304f64 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-01.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v) AS ?list) + WHERE { + VALUES ?v { 1 } + } + } + FILTER(?list = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-02.rq new file mode 100644 index 00000000000..9ed294fac36 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-02.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v) AS ?list) + WHERE { + FILTER(false) + } + } + FILTER(?list = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-03.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-03.rq new file mode 100644 index 00000000000..019f5bf5ecf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-03.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v) AS ?list) + WHERE { + VALUES ?v { 1 2 } + } + } + FILTER( + (cdt:get(?list, 1) = 1 && cdt:get(?list, 2) = 2) + || + (cdt:get(?list, 1) = 2 && cdt:get(?list, 2) = 1) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-04.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-04.rq new file mode 100644 index 00000000000..86fb69e3ecb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-04.rq @@ -0,0 +1,21 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v) AS ?list) + WHERE { + VALUES ?v { 1 UNDEF } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( ?e1 = 1 && ! BOUND(?e2) ) + || + ( ?e2 = 1 && ! BOUND(?e1) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-05.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-05.rq new file mode 100644 index 00000000000..d1ce9e51bd3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-05.rq @@ -0,0 +1,24 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v) AS ?list) + WHERE { + VALUES ?v { 1 UNDEF UNDEF } + } + } + + FILTER( cdt:size(?list) = 3 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + BIND( cdt:get(?list, 3) AS ?e3 ) + + FILTER( + ( ?e1 = 1 && ! BOUND(?e2) && ! BOUND(?e3) ) + || + ( ?e2 = 1 && ! BOUND(?e1) && ! BOUND(?e3) ) + || + ( ?e3 = 1 && ! BOUND(?e1) && ! BOUND(?e2) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-01.rq new file mode 100644 index 00000000000..1378cc1cc79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-01.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 1 } + } + } + FILTER(?list = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-02.rq new file mode 100644 index 00000000000..6f6c04db7d1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-02.rq @@ -0,0 +1,18 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 2 1 } + } + } + + FILTER( cdt:size(?list) = 2 ) + + FILTER( + (cdt:get(?list, 1) = 1 && cdt:get(?list, 2) = 2) + || + (cdt:get(?list, 1) = 2 && cdt:get(?list, 2) = 1) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-03.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-03.rq new file mode 100644 index 00000000000..94a338a0ebf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-03.rq @@ -0,0 +1,18 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 1 2 } + } + } + + FILTER( cdt:size(?list) = 2 ) + + FILTER( + (cdt:get(?list, 1) = 1 && cdt:get(?list, 2) = 2) + || + (cdt:get(?list, 1) = 2 && cdt:get(?list, 2) = 1) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-04.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-04.rq new file mode 100644 index 00000000000..2673de51329 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-04.rq @@ -0,0 +1,21 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 1 UNDEF } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( ?e1 = 1 && ! BOUND(?e2) ) + || + ( ?e2 = 1 && ! BOUND(?e1) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-05.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-05.rq new file mode 100644 index 00000000000..1dbe33acae1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-05.rq @@ -0,0 +1,21 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 UNDEF UNDEF } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( ?e1 = 1 && ! BOUND(?e2) ) + || + ( ?e2 = 1 && ! BOUND(?e1) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-06.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-06.rq new file mode 100644 index 00000000000..e9ec655bc0d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-06.rq @@ -0,0 +1,21 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { 1 UNDEF UNDEF 1 } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( ?e1 = 1 && ! BOUND(?e2) ) + || + ( ?e2 = 1 && ! BOUND(?e1) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-07.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-07.rq new file mode 100644 index 00000000000..8bdd1aa9918 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-07.rq @@ -0,0 +1,22 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { "1"^^xsd:integer "01"^^xsd:integer } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( SAMETERM(?e1,"1"^^xsd:integer) && SAMETERM(?e2,"01"^^xsd:integer) ) + || + ( SAMETERM(?e2,"1"^^xsd:integer) && SAMETERM(?e1,"01"^^xsd:integer) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-08.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-08.rq new file mode 100644 index 00000000000..3431aaaf876 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-08.rq @@ -0,0 +1,22 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT (FOLD(DISTINCT ?v) AS ?list) + WHERE { + VALUES ?v { "1"^^xsd:integer "01"^^xsd:integer "1"^^xsd:integer "01"^^xsd:integer } + } + } + + FILTER( cdt:size(?list) = 2 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( + ( SAMETERM(?e1,"1"^^xsd:integer) && SAMETERM(?e2,"01"^^xsd:integer) ) + || + ( SAMETERM(?e2,"1"^^xsd:integer) && SAMETERM(?e1,"01"^^xsd:integer) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-01.rq new file mode 100644 index 00000000000..3952a58a43f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-01.rq @@ -0,0 +1,31 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v ORDER BY ASC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v) { + (1 1) + (3 3) + (2 2) + (2 2) + (3 4) + } + } + } + + FILTER( cdt:size(?list) = 4 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + BIND( cdt:get(?list, 3) AS ?e3 ) + BIND( cdt:get(?list, 4) AS ?e4 ) + + FILTER( ?e1 = 1 ) + FILTER( ?e2 = 2 ) + FILTER( + ( (?e3=3) && (?e4=4) ) + || + ( (?e3=4) && (?e4=3) ) + ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-02.rq new file mode 100644 index 00000000000..71423fd357d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-02.rq @@ -0,0 +1,22 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v ORDER BY ASC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v ?other) { + (1 1 "same") + (1 1 "same") + + (3 3 "same") + (3 3 "same") + (3 3 "different") + + (2 2 "different a") + (2 2 "different b") + } + } + } + + FILTER(?list = "[1,2,3]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-03.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-03.rq new file mode 100644 index 00000000000..669d31eb648 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-distinct-orderby-03.rq @@ -0,0 +1,40 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(DISTINCT ?v ORDER BY ASC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v) { + (2 UNDEF) + (1 3) + (UNDEF "same") # duplicate 1 + (3 5) + (UNDEF "same") # duplicate 1 + (4 6) # duplicate 2 + (UNDEF "different") + (4 6) # duplicate 2 + } + } + } + + FILTER( cdt:size(?list) = 6 ) + + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + BIND( cdt:get(?list, 3) AS ?e3 ) + BIND( cdt:get(?list, 4) AS ?e4 ) + BIND( cdt:get(?list, 5) AS ?e5 ) + BIND( cdt:get(?list, 6) AS ?e6 ) + + FILTER( + ( (?e1="same") && (?e2="different") ) + || + ( (?e2="same") && (?e1="different") ) + ) + + FILTER( ?e3 = 3 ) + FILTER( ! BOUND(?e4) ) + FILTER( ?e5 = 5 ) + FILTER( ?e6 = 6 ) + +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-01.rq new file mode 100644 index 00000000000..ac68545f906 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-01.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY ?v) AS ?list) + WHERE { + VALUES ?v { 1 2 3 6 5 4 } + } + } + FILTER(?list = "[1,2,3,4,5,6]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-02.rq new file mode 100644 index 00000000000..244ccff8274 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-02.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY ?sort) AS ?list) + WHERE { + VALUES (?sort ?v) { (1 1) (3 2) (2 3) } + } + } + FILTER(?list = "[1,3,2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-03.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-03.rq new file mode 100644 index 00000000000..f29540e0076 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-03.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY DESC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v) { + (1 "one") + (2 "two") + (3 "three") + } + } + } + FILTER(?list = "['three','two','one']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-04.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-04.rq new file mode 100644 index 00000000000..6b8dd588cc3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-04.rq @@ -0,0 +1,18 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY ASC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v) { + (1 1) + (3 3) + (2 UNDEF) + } + } + } + FILTER(cdt:get(?list, 1) = 1) + FILTER(cdt:get(?list, 3) = 3) + BIND(cdt:get(?list, 2) AS ?null) + FILTER(!BOUND(?null)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-05.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-05.rq new file mode 100644 index 00000000000..552da7f42b1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-05.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY ASC(?sort)) AS ?list) + WHERE { + VALUES (?sort ?v) { + ( 3) + ("literal" 4) + (UNDEF 1) + } + } + } + FILTER(?list = "[1,3,4]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-06.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-06.rq new file mode 100644 index 00000000000..fece86254d0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-list-orderby-06.rq @@ -0,0 +1,16 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?v ORDER BY ASC(?sort1) ASC(?sort2)) AS ?list) + WHERE { + VALUES (?sort1 ?sort2 ?v) { + (2 2 "three") + (2 3 "four") + (2 1 "two") + (1 UNDEF "one") + } + } + } + FILTER(?list = "['one','two','three','four']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-01.rq new file mode 100644 index 00000000000..04235a0dd41 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-01.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + FILTER(false) + } + } + FILTER(?map = "{}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-02.rq new file mode 100644 index 00000000000..ff88b4d87bf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-02.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + VALUES (?k ?v) { + (2 "two") + (1 "one") + ("hello"@en "there"@en) + } + } + } + FILTER(?map = "{\"hello\"@en:'there'@en,1:'one',2:'two'}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-03.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-03.rq new file mode 100644 index 00000000000..6ff6d91bf1c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-03.rq @@ -0,0 +1,19 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + VALUES (?k ?v) { + (2 UNDEF) + (1 "one") + ("hello"@en "there"@en) + } + } + } + + FILTER(cdt:get(?map, 1) = "one") + BIND(cdt:get(?map, 2) AS ?null) + FILTER(!BOUND(?null)) + FILTER(cdt:get(?map, 'hello'@en) = "there"@en) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-04.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-04.rq new file mode 100644 index 00000000000..a84aa97c266 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-04.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + VALUES (?k ?v) { + (UNDEF "two") + (1 "one") + ("hello"@en "there"@en) + } + } + } + FILTER(?map = "{\"hello\"@en:'there'@en,1:'one'}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-05.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-05.rq new file mode 100644 index 00000000000..bd898e79a6d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-05.rq @@ -0,0 +1,19 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + { + BIND( BNODE() AS ?k ) + BIND( 1 AS ?v ) + } + UNION + { + BIND( 42 AS ?k ) + BIND( 2 AS ?v ) + } + } + } + FILTER(?map = "{42:2}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-06.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-06.rq new file mode 100644 index 00000000000..7a4ae6931d4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-06.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v) AS ?map) + WHERE { + VALUES (?k ?v) { + (1 100) + (2 201) + (2 202) + } + } + } + FILTER( (?map = "{1:100, 2:201}"^^cdt:Map) || (?map = "{1:100, 2:202}"^^cdt:Map) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-01.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-01.rq new file mode 100644 index 00000000000..4d95047e05a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-01.rq @@ -0,0 +1,16 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v ORDER BY ?sort) AS ?map) + WHERE { + VALUES (?k ?v ?sort) { + (1 100 "irrelevant") + (2 201 1) + (2 203 3) + (2 202 2) + } + } + } + FILTER( ?map = "{1:100, 2:203}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-02.rq b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-02.rq new file mode 100644 index 00000000000..f4ab9f4795b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/fold-map-orderby-02.rq @@ -0,0 +1,16 @@ +PREFIX cdt: + +ASK { + { + SELECT (FOLD(?k, ?v ORDER BY DESC(?sort)) AS ?map) + WHERE { + VALUES (?k ?v ?sort) { + (1 100 "irrelevant") + (2 201 1) + (2 203 3) + (2 202 2) + } + } + } + FILTER( ?map = "{1:100, 2:201}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/fold/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/fold/manifest.ttl new file mode 100644 index 00000000000..71d216486db --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/manifest.ttl @@ -0,0 +1,354 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "SPARQL FOLD operator" ; + mf:entries + ( + :fold-list-01 + :fold-list-02 + :fold-list-03 + :fold-list-04 + :fold-list-05 + + :fold-list-distinct-01 + :fold-list-distinct-02 + :fold-list-distinct-03 + :fold-list-distinct-04 + :fold-list-distinct-05 + :fold-list-distinct-06 + :fold-list-distinct-07 + :fold-list-distinct-08 + + :fold-list-orderby-01 + :fold-list-orderby-02 + :fold-list-orderby-03 + :fold-list-orderby-04 + :fold-list-orderby-05 + :fold-list-orderby-06 + + :fold-list-distinct-orderby-01 + :fold-list-distinct-orderby-02 + :fold-list-distinct-orderby-03 + + :fold-map-01 + :fold-map-02 + :fold-map-03 + :fold-map-04 + :fold-map-05 + :fold-map-06 + + :fold-map-orderby-01 + :fold-map-orderby-02 + ) . + +:fold-list-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-01" ; + rdfs:comment "FOLD a single value list" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-02" ; + rdfs:comment "FOLD on empty group" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-03 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-03" ; + rdfs:comment "FOLD with two elements but no ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-04 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-04" ; + rdfs:comment "FOLD with two elements, including an error" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-05 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-05" ; + rdfs:comment "FOLD with three elements, including two errors" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + +:fold-list-distinct-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-01" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-02" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-03 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-03" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-04 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-04" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-05 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-05" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-06 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-06" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-07 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-07" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-08 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-08" ; + rdfs:comment "FOLD with DISTINCT" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + +:fold-list-orderby-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-01" ; + rdfs:comment "FOLD with ordering on the list member values" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-orderby-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-02" ; + rdfs:comment "FOLD with ordering on correlated values" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-orderby-03 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-03" ; + rdfs:comment "FOLD with descending ordering on correlated values" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-orderby-04 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-04" ; + rdfs:comment "FOLD with unbound elements" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-orderby-05 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-05" ; + rdfs:comment "FOLD with ORDER BY over different types of RDF terms" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-orderby-06 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-orderby-06" ; + rdfs:comment "FOLD with ORDER BY with two sort conditions" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + +:fold-list-distinct-orderby-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-orderby-01" ; + rdfs:comment "FOLD with DISTINCT and ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-orderby-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-orderby-02" ; + rdfs:comment "FOLD with DISTINCT and ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-list-distinct-orderby-03 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-list-distinct-orderby-03" ; + rdfs:comment "FOLD with DISTINCT and ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + +:fold-map-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-01" ; + rdfs:comment "FOLD on empty group" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-02" ; + rdfs:comment "FOLD pairs into map" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-03 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-03" ; + rdfs:comment "FOLD into map with unbound values" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-04 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-04" ; + rdfs:comment "FOLD into map with unbound keys" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-05 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-05" ; + rdfs:comment "FOLD into map with blank node as key" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-06 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-06" ; + rdfs:comment "FOLD into map with duplicate keys" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + +:fold-map-orderby-01 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-orderby-01" ; + rdfs:comment "FOLD for maps with ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:fold-map-orderby-02 rdf:type mf:QueryEvaluationTest ; + mf:name "fold-map-orderby-02" ; + rdfs:comment "FOLD for maps with ORDER BY" ; + mf:feature cdt:fold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . diff --git a/jena-arq/testing/SPARQL-CDTs/fold/true.srx b/jena-arq/testing/SPARQL-CDTs/fold/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/fold/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-01.rq new file mode 100644 index 00000000000..bbb3b05ef37 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# empty lists +ASK { + BIND("[]"^^cdt:List AS ?empty) + BIND(cdt:concat(?empty, ?empty) AS ?result) + FILTER(?result = ?empty) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-02.rq new file mode 100644 index 00000000000..e2bf264f4d3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + + +# concat identity (lhs) +ASK { + BIND("[]"^^cdt:List AS ?empty) + BIND("[1]"^^cdt:List AS ?one) + BIND(cdt:concat(?empty, ?one) AS ?result) + FILTER(?result = ?one) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-03.rq new file mode 100644 index 00000000000..9306bc8693f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-03.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + + +# concat identity (rhs) +ASK { + BIND("[]"^^cdt:List AS ?empty) + BIND("[1]"^^cdt:List AS ?one) + BIND(cdt:concat(?one, ?empty) AS ?result) + FILTER(?result = ?one) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-04.rq new file mode 100644 index 00000000000..3f5d77d2ca6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + + +# concat duplicate 1-element +ASK { + BIND("[1]"^^cdt:List AS ?one) + BIND(cdt:concat(?one, ?one) AS ?result) + FILTER(?result = "[1,1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-05.rq new file mode 100644 index 00000000000..58b63f93842 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-05.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + + +# concat duplicate 2-element +ASK { + BIND("[1, 2]"^^cdt:List AS ?list) + BIND(cdt:concat(?list, ?list) AS ?result) + FILTER(?result = "[1,2,1,2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-06.rq new file mode 100644 index 00000000000..fa1125742e4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-06.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + + +# concat different lists +ASK { + BIND("[1, 2]"^^cdt:List AS ?lhs) + BIND("[3, 4]"^^cdt:List AS ?rhs) + BIND(cdt:concat(?lhs, ?rhs) AS ?result) + FILTER(?result = "[1,2,3,4]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-07.rq new file mode 100644 index 00000000000..e8c27da5580 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-07.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + + +# concat nested lists +ASK { + BIND("[[1]]"^^cdt:List AS ?lhs) + BIND("[[2]]"^^cdt:List AS ?rhs) + BIND(cdt:concat(?lhs, ?rhs) AS ?result) + FILTER(?result = "[[1],[2]]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-08.rq new file mode 100644 index 00000000000..4d7c47bcf01 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# nullary concat +ASK { + BIND(cdt:concat() AS ?result) + FILTER(?result = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-09.rq new file mode 100644 index 00000000000..7d81767101d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-09.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + + +# unary concat +ASK { + BIND("[1]"^^cdt:List AS ?input) + BIND(cdt:concat(?input) AS ?result) + FILTER(?result = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-10.rq new file mode 100644 index 00000000000..9807d411bdb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-10.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + + +# ternary concat +ASK { + BIND("[1]"^^cdt:List AS ?list1) + BIND("[2,3]"^^cdt:List AS ?list2) + BIND(cdt:concat(?list1, ?list2, ?list1) AS ?result) + FILTER(?result = "[1,2,3,1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-01.rq new file mode 100644 index 00000000000..629ca62612f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +ASK { + BIND("[]" AS ?noListLiteral) + BIND("[1]"^^cdt:List AS ?one) + BIND(cdt:concat(?noListLiteral, ?one) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-02.rq new file mode 100644 index 00000000000..fc5c4c0fb69 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-error-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[]" AS ?noListLiteral) + BIND(cdt:concat(?noListLiteral) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/concat-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-null-01.rq new file mode 100644 index 00000000000..83b77d7ed81 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/concat-null-01.rq @@ -0,0 +1,14 @@ +PREFIX cdt: + +ASK { + BIND("[null]"^^cdt:List AS ?list) + BIND(cdt:concat(?list, ?list) AS ?result) + + FILTER(cdt:size(?result) = 2) + + BIND(cdt:get(?result,1) AS ?elm1) + FILTER(!BOUND(?elm1)) + + BIND(cdt:get(?result,2) AS ?elm2) + FILTER(!BOUND(?elm2)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-01.rq new file mode 100644 index 00000000000..31cf52ede35 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +# empty lists +ASK { + BIND("[]"^^cdt:List AS ?list) + FILTER(!cdt:contains(?list, 1)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-02.rq new file mode 100644 index 00000000000..52172f204a8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# contains integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:contains(?list, 1)) + FILTER(!cdt:contains(?list, 2)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-03.rq new file mode 100644 index 00000000000..56a4bc7b9cc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-03.rq @@ -0,0 +1,22 @@ +PREFIX cdt: +PREFIX xsd: +# contains equality +ASK { + BIND("[1,'a','b'@en,2.0]"^^cdt:List AS ?list) + + # numeric forms + FILTER(cdt:contains(?list, 1)) + FILTER(cdt:contains(?list, "+1"^^xsd:integer)) + FILTER(cdt:contains(?list, "01"^^xsd:integer)) + FILTER(cdt:contains(?list, 1.0)) + FILTER(cdt:contains(?list, 1.0)) + FILTER(cdt:contains(?list, 1e0)) + FILTER(cdt:contains(?list, 2)) + FILTER(cdt:contains(?list, 2.0)) + FILTER(cdt:contains(?list, 2e0)) + + # string forms + FILTER(cdt:contains(?list, 'a')) + FILTER(cdt:contains(?list, 'b'@en)) + FILTER(!cdt:contains(?list, 'b')) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-04.rq new file mode 100644 index 00000000000..2ba84d5248d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# contains IRIs +ASK { + BIND("[,1]"^^cdt:List AS ?list) + + FILTER(cdt:contains(?list, )) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-05.rq new file mode 100644 index 00000000000..77856f16aaf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-05.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +# contains blank nodes +ASK { + BIND("[_:b,null,'_:b']"^^cdt:List AS ?list) + BIND( BNODE() AS ?b ) + BIND( cdt:contains(?list, ?b) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-06.rq new file mode 100644 index 00000000000..d731c792496 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-06.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +# contains blank nodes +ASK { + BIND("[_:b,2]"^^cdt:List AS ?list) + BIND( cdt:head(?list) AS ?elmt) + BIND( cdt:contains(?list,?elmt) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-07.rq new file mode 100644 index 00000000000..2205d51ec6e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-07.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +# nested lists +ASK { + BIND("[1,[2]]"^^cdt:List AS ?list) + BIND("[2]"^^cdt:List AS ?list2) + + FILTER(cdt:contains(?list, 1)) + FILTER(!cdt:contains(?list, 2)) + FILTER(cdt:contains(?list, ?list2)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-08.rq new file mode 100644 index 00000000000..b25666e7948 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-08.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +# nested lists given as literals +ASK { + BIND("[1,'[2]'^^]"^^cdt:List AS ?list) + BIND("[2]"^^cdt:List AS ?list2) + + FILTER(cdt:contains(?list, 1)) + FILTER(!cdt:contains(?list, 2)) + FILTER(cdt:contains(?list, ?list2)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-09.rq new file mode 100644 index 00000000000..98ab9c6cd13 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-09.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +# nested lists +ASK { + BIND("[1,{2:3}]"^^cdt:List AS ?list) + BIND("{2:3}"^^cdt:Map AS ?map) + + FILTER(cdt:contains(?list, 1)) + FILTER(!cdt:contains(?list, 2)) + FILTER(!cdt:contains(?list, 3)) + FILTER(cdt:contains(?list, ?map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-10.rq new file mode 100644 index 00000000000..19f75b7d723 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-10.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +# nested lists given as literals +ASK { + BIND("[1,'{2:3}'^^]"^^cdt:List AS ?list) + BIND("{2:3}"^^cdt:Map AS ?map) + + FILTER(cdt:contains(?list, 1)) + FILTER(!cdt:contains(?list, 2)) + FILTER(!cdt:contains(?list, 3)) + FILTER(cdt:contains(?list, ?map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-error-01.rq new file mode 100644 index 00000000000..af072ad7137 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1]" AS ?list) + BIND(cdt:contains(?list, 1) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/contains-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-null-01.rq new file mode 100644 index 00000000000..cf8c964aa6e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/contains-null-01.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +# empty lists +ASK { + BIND("[1,null,2]"^^cdt:List AS ?list) + FILTER(cdt:contains(?list, 1.0)) + FILTER(cdt:contains(?list, 2.0)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/empty.ttl b/jena-arq/testing/SPARQL-CDTs/list-functions/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-01.rq new file mode 100644 index 00000000000..1853377956e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# list with one integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:get(?list, 1) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-02.rq new file mode 100644 index 00000000000..c912a17a509 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with two integers +ASK { + BIND("[1, 3]"^^cdt:List AS ?list) + FILTER(cdt:get(?list, 1) = 1) + FILTER(cdt:get(?list, 2) = 3) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-03.rq new file mode 100644 index 00000000000..03e825ab768 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one string +ASK { + BIND("['a']"^^cdt:List AS ?list) + FILTER(cdt:get(?list, 1) = 'a') +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-04.rq new file mode 100644 index 00000000000..02d5638f84c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with two strings +ASK { + BIND("['a', 'b']"^^cdt:List AS ?list) + FILTER(cdt:get(?list, 1) = 'a') + FILTER(cdt:get(?list, 2) = 'b') +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-05.rq new file mode 100644 index 00000000000..4e93e233f3e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with two mixed types +ASK { + BIND("['a', 1]"^^cdt:List AS ?list) + FILTER(cdt:get(?list, 1) = 'a') + FILTER(cdt:get(?list, 2) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-06.rq new file mode 100644 index 00000000000..2e65a68c9ba --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-06.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested empty list +ASK { + BIND("[[]]"^^cdt:List AS ?list) + BIND((cdt:get(?list, 1)) AS ?l0) + BIND((cdt:get(?l0, 1)) AS ?l1) + FILTER(BOUND(?l0)) + FILTER(!BOUND(?l1)) + FILTER(?l0 = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-07.rq new file mode 100644 index 00000000000..b7b6ce119d2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-07.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested list with one integer +ASK { + BIND("[[1]]"^^cdt:List AS ?list) + BIND((cdt:get(?list, 1)) AS ?l0) + BIND((cdt:get(?l0, 1)) AS ?l1) + FILTER(?l1 = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-08.rq new file mode 100644 index 00000000000..a953f7996ee --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-08.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed types including nested list +ASK { + BIND("[[1], 3]"^^cdt:List AS ?list) + BIND((cdt:get(?list, 1)) AS ?l0) + BIND((cdt:get(?l0, 1)) AS ?l1) + FILTER(?l1 = 1) + FILTER(cdt:get(?list, 2) = 3) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-09.rq new file mode 100644 index 00000000000..2172c821a90 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-09.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[null, 3]"^^cdt:List AS ?list) + BIND((cdt:get(?list, 1)) AS ?l0) + FILTER(!BOUND(?l0)) + FILTER(cdt:get(?list, 2) = 3) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-10.rq new file mode 100644 index 00000000000..35c86c2a90c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-10.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "[_:b]"^^cdt:List AS ?list ) + BIND( cdt:get(?list, 1) AS ?e1 ) + + FILTER( isBLANK(?e1) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-11.rq new file mode 100644 index 00000000000..8f9d3c1019b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-11.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "[_:b]"^^cdt:List AS ?list ) + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 1) AS ?e1Again ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e1Again) ) + FILTER( SAMETERM(?e1, ?e1Again) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-12.rq new file mode 100644 index 00000000000..6157a9d7a0b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-12.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "[_:b,_:b]"^^cdt:List AS ?list ) + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( SAMETERM(?e1, ?e2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-13.rq new file mode 100644 index 00000000000..52171a40b65 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-13.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "[_:b1,_:b2]"^^cdt:List AS ?list ) + BIND( cdt:get(?list, 1) AS ?e1 ) + BIND( cdt:get(?list, 2) AS ?e2 ) + + FILTER( isBLANK(?e1) ) + FILTER( isBLANK(?e2) ) + FILTER( ! SAMETERM(?e1, ?e2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-01.rq new file mode 100644 index 00000000000..9959a1127de --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]" AS ?list) + BIND(cdt:get(?list, 1) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-02.rq new file mode 100644 index 00000000000..29c589c6b54 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:get(?list, 10) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-03.rq new file mode 100644 index 00000000000..4202ba6b119 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:get(?list, 0) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-04.rq new file mode 100644 index 00000000000..cd8ef621d84 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:get(?list, -1) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-05.rq new file mode 100644 index 00000000000..8e3a5c47d78 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:get(?list, "invalid") AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-06.rq new file mode 100644 index 00000000000..c96079980d0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-error-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:get(?list, 2.0) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-01.rq new file mode 100644 index 00000000000..76700ebedd0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[null]"^^cdt:List AS ?list) + BIND(cdt:get(?list, 1) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-02.rq new file mode 100644 index 00000000000..165dfd06166 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/get-null-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[]"^^cdt:List AS ?list) + BIND(cdt:get(?list, 1) AS ?element) + FILTER(!BOUND(?element)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-01.rq new file mode 100644 index 00000000000..bcce6665a7c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(!BOUND(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-02.rq new file mode 100644 index 00000000000..46c97d6e339 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-03.rq new file mode 100644 index 00000000000..e0ace57d432 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two integers +ASK { + BIND("[1, 2]"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-04.rq new file mode 100644 index 00000000000..e6ecbfd3ccc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one string +ASK { + BIND("['a']"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = 'a') +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-05.rq new file mode 100644 index 00000000000..1c534dcee4d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two strings +ASK { + BIND("['a', 'b']"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = 'a') +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-06.rq new file mode 100644 index 00000000000..0d48393777b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two mixed types +ASK { + BIND("['a', 1]"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = 'a') +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-07.rq new file mode 100644 index 00000000000..45a4fcdbb42 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with null +ASK { + BIND("[null]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(!BOUND(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-08.rq new file mode 100644 index 00000000000..4118dd57c08 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-08.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested empty list +ASK { + BIND("[[]]"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-09.rq new file mode 100644 index 00000000000..d2507388f70 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-09.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed types including nested list +ASK { + BIND("[[1], 2]"^^cdt:List AS ?list) + FILTER(cdt:head(?list) = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-10.rq new file mode 100644 index 00000000000..f911d8e36a5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[null, 2]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(!BOUND(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-11.rq new file mode 100644 index 00000000000..c0f34d09d97 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[_:b]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(isBLANK(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-12.rq new file mode 100644 index 00000000000..16728ec581b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-12.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[_:b]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + BIND(cdt:head(?list) AS ?headAgain) + FILTER(isBLANK(?head)) + FILTER(isBLANK(?headAgain)) + FILTER(SAMETERM(?head, ?headAgain)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-error-01.rq new file mode 100644 index 00000000000..1f1614aca5c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2]" AS ?list) + BIND(cdt:head(?list) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-01.rq new file mode 100644 index 00000000000..dfacc458a94 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[null]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(!BOUND(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-02.rq new file mode 100644 index 00000000000..80ce6919722 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/head-null-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND("[]"^^cdt:List AS ?list) + BIND(cdt:head(?list) AS ?head) + FILTER(!BOUND(?head)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-01.rq new file mode 100644 index 00000000000..9850ec55e76 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty list +ASK { + BIND(cdt:List() AS ?list) + FILTER(?list = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-02.rq new file mode 100644 index 00000000000..e779e332cc6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with one integer +ASK { + BIND(cdt:List(1) AS ?list) + FILTER(?list = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-03.rq new file mode 100644 index 00000000000..857c1533f8b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with two integers +ASK { + BIND(cdt:List(1, 2) AS ?list) + FILTER(?list = "[1, 2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-04.rq new file mode 100644 index 00000000000..3db696f8d09 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with one string +ASK { + BIND(cdt:List("a") AS ?list) + FILTER(?list = "['a']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-05.rq new file mode 100644 index 00000000000..2032858f254 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with two strings +ASK { + BIND(cdt:List("a", "b") AS ?list) + FILTER(?list = "['a', 'b']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-06.rq new file mode 100644 index 00000000000..b14d3857b46 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with two mixed types +ASK { + BIND(cdt:List("a", 1) AS ?list) + FILTER(?list = "['a', 1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-09.rq new file mode 100644 index 00000000000..50d0e648dab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with nested empty list +ASK { + BIND(cdt:List(cdt:List()) AS ?list) + FILTER(?list = "[[]]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-10.rq new file mode 100644 index 00000000000..bf4fcd7a72d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with nested list with one integer +ASK { + BIND(cdt:List(cdt:List(1)) AS ?list) + FILTER(?list = "[[1]]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-11.rq new file mode 100644 index 00000000000..48b8e9e7116 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# list with mixed types including nested list +ASK { + BIND(cdt:List(cdt:List(1), 2) AS ?list) + FILTER(?list = "[[1], 2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-12.rq new file mode 100644 index 00000000000..235f0bddd81 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-12.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +# list with mixed defined and undefined types +ASK { + BIND(cdt:List(?unbound, ) AS ?list) + + # We use a REGEX here because we can't directly test equality of lists containing null + # we could use SAMETERM, but that would likely depend on the lexical form produced by + # the system for lists, and not necessarily tell us that the expected terms were actuall + # in the resulting list. + FILTER(REGEX(STR(?list), "\\[\\s*null\\s*,\\s*\\s*\\]")) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-13.rq new file mode 100644 index 00000000000..e787aa1072f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-13.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + + +# rdf literal syntax +ASK { + BIND(cdt:List() AS ?list) + BIND("[]"^^cdt:List AS ?expected) + FILTER(?list = ?expected) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-14.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-14.rq new file mode 100644 index 00000000000..8ccb934afa7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + + +# STRDT constructor +ASK { + BIND(STRDT("[1]", cdt:List) AS ?list) + FILTER(?list = "[ 1 ]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-15.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-15.rq new file mode 100644 index 00000000000..e000a173acf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-15.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + + +# list with two integers +ASK { + BIND(3 AS ?x) + BIND(cdt:List(1+4, 1+?x) AS ?list) + FILTER(?list = "[5, 4]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-16.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-16.rq new file mode 100644 index 00000000000..b12392a8bf6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-16.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +ASK { + BIND( BNODE() AS ?b ) + BIND( cdt:List(?b) AS ?list ) + + FILTER( BOUND(?list) ) # check that there was no error + + BIND( cdt:get(?list,1) AS ?e1 ) + FILTER( isBlank(?e1) ) + FILTER( SAMETERM(?e1, ?b) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-01.rq new file mode 100644 index 00000000000..bc30ee98959 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-01.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +# list with one integer +ASK { + BIND(cdt:List(?unbound) AS ?list) + + # We use a REGEX here because we can't directly test equality of lists containing null + # we could use SAMETERM, but that would likely depend on the lexical form produced by + # the system for lists, and not necessarily tell us that the expected terms were actually + # in the resulting list. + FILTER(REGEX(STR(?list), "\\[\\s*null\\s*\\]")) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-02.rq new file mode 100644 index 00000000000..0cebf4ccb37 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-constructor-null-02.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +# list with error as null +ASK { + BIND(cdt:List(1/0) AS ?list) + + # We use a REGEX here because we can't directly test equality of lists containing null + # we could use SAMETERM, but that would likely depend on the lexical form produced by + # the system for lists, and not necessarily tell us that the expected terms were actually + # in the resulting list. + FILTER(REGEX(STR(?list), "\\[\\s*null\\s*\\]")) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-01.rq new file mode 100644 index 00000000000..21ed12b644e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("[ ]"^^cdt:List = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-02.rq new file mode 100644 index 00000000000..4e25ff13f19 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("[ 1 ]"^^cdt:List = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-03.rq new file mode 100644 index 00000000000..d1af3843a2f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("[1,2]"^^cdt:List = "[ 1, '2'^^ ]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-04.rq new file mode 100644 index 00000000000..beb3ab902df --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("[1,2]"^^cdt:List = "['+1'^^, 2.0]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-05.rq new file mode 100644 index 00000000000..d880e2e646d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER( "[]"^^cdt:List = "[ ]"^^cdt:List ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-06.rq new file mode 100644 index 00000000000..70c795ceace --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b1]"^^cdt:List = "[_:b2]"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-07.rq new file mode 100644 index 00000000000..a4613e8ced5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List = "[_:b]"^^cdt:List ) AS ?result ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-08.rq new file mode 100644 index 00000000000..0361b5e480a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-08.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:List(?x) = cdt:List(?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-09.rq new file mode 100644 index 00000000000..79f3cbb4c3c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:List(?x) = cdt:List(?x) ) AS ?result ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-01.rq new file mode 100644 index 00000000000..314bb91b10e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,null,2]"^^cdt:List = "[1,null,2]"^^cdt:List AS ?result) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-02.rq new file mode 100644 index 00000000000..ccffb90ce7d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-equals-null-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,null,2]"^^cdt:List = "[1,44,2]"^^cdt:List AS ?result) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-01.rq new file mode 100644 index 00000000000..70fb26b6d5c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ ]"^^cdt:List >= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-02.rq new file mode 100644 index 00000000000..0db477981c7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List >= "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-03.rq new file mode 100644 index 00000000000..44040d1fea9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List >= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-04.rq new file mode 100644 index 00000000000..f677858108c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ 1]"^^cdt:List >= "[1 ]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-05.rq new file mode 100644 index 00000000000..efe0db13d81 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List >= "[2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-06.rq new file mode 100644 index 00000000000..00667702c28 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[2]"^^cdt:List >= "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-07.rq new file mode 100644 index 00000000000..696e35ec102 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List >= "[1,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-08.rq new file mode 100644 index 00000000000..44b0a7c0f4d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,3]"^^cdt:List >= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-09.rq new file mode 100644 index 00000000000..9d107f74b9b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List >= "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-10.rq new file mode 100644 index 00000000000..3c8505e98b5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List >= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-11.rq new file mode 100644 index 00000000000..01af549dfff --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,2]"^^cdt:List >= "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-12.rq new file mode 100644 index 00000000000..b3c8ad78f69 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List >= "[1,1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-13.rq new file mode 100644 index 00000000000..1762d705a00 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,1]"^^cdt:List >= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-14.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-14.rq new file mode 100644 index 00000000000..02bf5e6f352 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List >= "[1,1,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-15.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-15.rq new file mode 100644 index 00000000000..1c359a379ee --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-15.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[true]"^^cdt:List >= "[false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-16.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-16.rq new file mode 100644 index 00000000000..de090e31369 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-16.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[false]"^^cdt:List >= "[true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-19.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-19.rq new file mode 100644 index 00000000000..934eede7184 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-19.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false]"^^cdt:List >= "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-20.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-20.rq new file mode 100644 index 00000000000..f58c97f74c1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-20.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List >= "[1,false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-21.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-21.rq new file mode 100644 index 00000000000..14e3b647535 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-21.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,2]"^^cdt:List >= "[1,true,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-22.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-22.rq new file mode 100644 index 00000000000..c9342d38eb3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-22.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true,1]"^^cdt:List >= "[1,false,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-23.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-23.rq new file mode 100644 index 00000000000..0f342220a5b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-23.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,true]"^^cdt:List >= "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-24.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-24.rq new file mode 100644 index 00000000000..f404b4eaf85 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-24.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List >= "[1,false,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-25.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-25.rq new file mode 100644 index 00000000000..f56080fb71f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-25.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List >= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-26.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-26.rq new file mode 100644 index 00000000000..027a88c4595 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-26.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List >= "[_:b]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-27.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-27.rq new file mode 100644 index 00000000000..5b989eaf522 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-27.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:List(?x) >= cdt:List(?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-28.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-28.rq new file mode 100644 index 00000000000..bbced570e25 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-28.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List >= "[_:b]"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-29.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-29.rq new file mode 100644 index 00000000000..f16298b3b43 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-29.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:List(?x) >= cdt:List(?x) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-31.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-31.rq new file mode 100644 index 00000000000..ade6b0bea38 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-31.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ ]"^^cdt:List >= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-03.rq new file mode 100644 index 00000000000..71ac6d6fcbc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(2) AS ?list2 ) + BIND( ( "1"^^cdt:List >= ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-04.rq new file mode 100644 index 00000000000..6a47a8e9343 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-error-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(1) AS ?list1 ) + BIND( ( ?list1 >= "2"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-01.rq new file mode 100644 index 00000000000..bd51e9b0dbb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List >= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-02.rq new file mode 100644 index 00000000000..646a58beb35 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List >= "[null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-03.rq new file mode 100644 index 00000000000..b406d1f0a19 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List >= "[null]"^^cdt:List ) AS ?result ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-04.rq new file mode 100644 index 00000000000..10843059381 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-04.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x, ?y) AS ?list1 ) + BIND( cdt:List(?z) AS ?list2 ) + BIND( ( ?list1 >= ?list2 ) AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-05.rq new file mode 100644 index 00000000000..ce5a27099c3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,null]"^^cdt:List >= "[2,null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-06.rq new file mode 100644 index 00000000000..09bce3ad7a6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-equal-null-06.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x) AS ?list1 ) + BIND( cdt:List(BNODE()) AS ?list2 ) + BIND( ( ?list1 >= ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-01.rq new file mode 100644 index 00000000000..2ff4169fd6c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ ]"^^cdt:List > "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-02.rq new file mode 100644 index 00000000000..5ea1b43b27c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List > "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-03.rq new file mode 100644 index 00000000000..041b7d1520e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List > "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-04.rq new file mode 100644 index 00000000000..4428cbc3ab2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ 1 ]"^^cdt:List > "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-05.rq new file mode 100644 index 00000000000..7ff7ee1f00c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List > "[2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-06.rq new file mode 100644 index 00000000000..2e37745b351 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[2]"^^cdt:List > "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-07.rq new file mode 100644 index 00000000000..d3c2fd96fcf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List > "[1,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-08.rq new file mode 100644 index 00000000000..91ecc4de579 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,3]"^^cdt:List > "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-09.rq new file mode 100644 index 00000000000..697ecb49fd6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List > "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-10.rq new file mode 100644 index 00000000000..3753780729a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List > "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-11.rq new file mode 100644 index 00000000000..c8992ecb204 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,2]"^^cdt:List > "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-12.rq new file mode 100644 index 00000000000..ccadc2f2fc2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List > "[1,1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-13.rq new file mode 100644 index 00000000000..84e5c673a04 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,1]"^^cdt:List > "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-14.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-14.rq new file mode 100644 index 00000000000..5af4c5deb9a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List > "[1,1,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-15.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-15.rq new file mode 100644 index 00000000000..a6e3c8019c0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-15.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[true]"^^cdt:List > "[false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-16.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-16.rq new file mode 100644 index 00000000000..70746cad555 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-16.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[false]"^^cdt:List > "[true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-19.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-19.rq new file mode 100644 index 00000000000..f9fd5923572 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-19.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false]"^^cdt:List > "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-20.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-20.rq new file mode 100644 index 00000000000..574324ba6b0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-20.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List > "[1,false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-21.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-21.rq new file mode 100644 index 00000000000..23f63a1a136 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-21.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,2]"^^cdt:List > "[1,true,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-22.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-22.rq new file mode 100644 index 00000000000..559c59b09fa --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-22.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true,1]"^^cdt:List > "[1,false,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-23.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-23.rq new file mode 100644 index 00000000000..fe3089b0b25 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-23.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,true]"^^cdt:List > "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-24.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-24.rq new file mode 100644 index 00000000000..8b60bd1c42e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-24.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List > "[1,false,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-25.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-25.rq new file mode 100644 index 00000000000..a9b680ab1df --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-25.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List > "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-26.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-26.rq new file mode 100644 index 00000000000..59eb320e36c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-26.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List > "[_:b]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-27.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-27.rq new file mode 100644 index 00000000000..ca2d5b8da60 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-27.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:List(?x) > cdt:List(?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-28.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-28.rq new file mode 100644 index 00000000000..21cbc743bec --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-28.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List > "[_:b]"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-29.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-29.rq new file mode 100644 index 00000000000..28d77bff7cb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-29.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:List(?x) > cdt:List(?x) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-31.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-31.rq new file mode 100644 index 00000000000..f116c7a54d6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-31.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ ]"^^cdt:List > "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-03.rq new file mode 100644 index 00000000000..44e6d990ec9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(2) AS ?list2 ) + BIND( ( "1"^^cdt:List > ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-04.rq new file mode 100644 index 00000000000..e54ea409619 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-error-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(1) AS ?list1 ) + BIND( ( ?list1 > "2"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-01.rq new file mode 100644 index 00000000000..49c9dee7b8e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List > "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-02.rq new file mode 100644 index 00000000000..680f4accade --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List > "[null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-03.rq new file mode 100644 index 00000000000..f4e82722c58 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List > "[null]"^^cdt:List ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-04.rq new file mode 100644 index 00000000000..1cb765ed64b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-04.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x, ?y) AS ?list1 ) + BIND( cdt:List(?z) AS ?list2 ) + BIND( ( ?list1 > ?list2 ) AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-05.rq new file mode 100644 index 00000000000..7c4b16f2459 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,null]"^^cdt:List > "[2,null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-06.rq new file mode 100644 index 00000000000..c54b5269568 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-greater-than-null-06.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x) AS ?list1 ) + BIND( cdt:List(BNODE()) AS ?list2 ) + BIND( ( ?list1 > ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-01.rq new file mode 100644 index 00000000000..c7bf15a96ae --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List <= "[ ]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-02.rq new file mode 100644 index 00000000000..fe6a120b994 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List <= "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-03.rq new file mode 100644 index 00000000000..fc4b5623e5d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List <= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-04.rq new file mode 100644 index 00000000000..bfde3249b79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List <= "[ 1 ]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-05.rq new file mode 100644 index 00000000000..263348cc0ca --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List <= "[2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-06.rq new file mode 100644 index 00000000000..0b34d18f177 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[2]"^^cdt:List <= "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-07.rq new file mode 100644 index 00000000000..6bbf34c545d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List <= "[1,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-08.rq new file mode 100644 index 00000000000..98eeb7b0936 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,3]"^^cdt:List <= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-09.rq new file mode 100644 index 00000000000..696948dd083 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List <= "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-10.rq new file mode 100644 index 00000000000..3dda8d1db89 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List <= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-11.rq new file mode 100644 index 00000000000..5afc428cbcc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,2]"^^cdt:List <= "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-12.rq new file mode 100644 index 00000000000..5b1f702a405 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List <= "[1,1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-13.rq new file mode 100644 index 00000000000..8152ba06314 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,1]"^^cdt:List <= "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-14.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-14.rq new file mode 100644 index 00000000000..c9494d4fdaf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List <= "[1,1,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-15.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-15.rq new file mode 100644 index 00000000000..b7b6e7b692f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-15.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[true]"^^cdt:List <= "[false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-16.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-16.rq new file mode 100644 index 00000000000..7f05a329216 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-16.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[false]"^^cdt:List <= "[true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-19.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-19.rq new file mode 100644 index 00000000000..2b6b3f88bde --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-19.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false]"^^cdt:List <= "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-20.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-20.rq new file mode 100644 index 00000000000..a20d7ede430 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-20.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List <= "[1,false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-21.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-21.rq new file mode 100644 index 00000000000..24750063efa --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-21.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,2]"^^cdt:List <= "[1,true,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-22.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-22.rq new file mode 100644 index 00000000000..63cc444d708 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-22.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true,1]"^^cdt:List <= "[1,false,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-23.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-23.rq new file mode 100644 index 00000000000..e73130edfee --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-23.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,true]"^^cdt:List <= "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-24.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-24.rq new file mode 100644 index 00000000000..d95dc680620 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-24.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List <= "[1,false,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-25.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-25.rq new file mode 100644 index 00000000000..c2136e74ac0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-25.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List <= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-26.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-26.rq new file mode 100644 index 00000000000..31fdfeeedb2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-26.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List <= "[_:b]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-27.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-27.rq new file mode 100644 index 00000000000..8bb4fa6f667 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-27.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:List(?x) <= cdt:List(?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-28.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-28.rq new file mode 100644 index 00000000000..452f1481c11 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-28.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List <= "[_:b]"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-29.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-29.rq new file mode 100644 index 00000000000..9240476d039 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-29.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:List(?x) <= cdt:List(?x) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-31.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-31.rq new file mode 100644 index 00000000000..a7ac105fa44 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-31.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List <= "[ ]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-03.rq new file mode 100644 index 00000000000..6cd0ea6a1fc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(2) AS ?list2 ) + BIND( ( "1"^^cdt:List <= ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-04.rq new file mode 100644 index 00000000000..bcea3634ee7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-error-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(1) AS ?list1 ) + BIND( ( ?list1 <= "2"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-01.rq new file mode 100644 index 00000000000..99ea40a1798 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List <= "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-02.rq new file mode 100644 index 00000000000..315af88e6e6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List <= "[null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-03.rq new file mode 100644 index 00000000000..1f7836889ef --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List <= "[null]"^^cdt:List ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-04.rq new file mode 100644 index 00000000000..9f234743dd0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-04.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x, ?y) AS ?list1 ) + BIND( cdt:List(?z) AS ?list2 ) + BIND( ( ?list1 <= ?list2 ) AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-05.rq new file mode 100644 index 00000000000..d48a2c8f216 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,null]"^^cdt:List <= "[2,null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-06.rq new file mode 100644 index 00000000000..873d0f08b9b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-equal-null-06.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x) AS ?list1 ) + BIND( cdt:List(BNODE()) AS ?list2 ) + BIND( ( ?list1 <= ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-01.rq new file mode 100644 index 00000000000..015346b077d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List < "[ ]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-02.rq new file mode 100644 index 00000000000..9b308f1dabb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List < "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-03.rq new file mode 100644 index 00000000000..6aa465d8de9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List < "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-04.rq new file mode 100644 index 00000000000..bf68893b12f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ 1 ]"^^cdt:List < "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-05.rq new file mode 100644 index 00000000000..483db5c7c63 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1]"^^cdt:List < "[2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-06.rq new file mode 100644 index 00000000000..986db12654a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[2]"^^cdt:List < "[1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-07.rq new file mode 100644 index 00000000000..5c07e9cdb97 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List < "[1,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-08.rq new file mode 100644 index 00000000000..d34868287eb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,3]"^^cdt:List < "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-09.rq new file mode 100644 index 00000000000..128490921a3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List < "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-10.rq new file mode 100644 index 00000000000..8125c2f6ce1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List < "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-11.rq new file mode 100644 index 00000000000..46076dba9da --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,2]"^^cdt:List < "[1,2,3]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-12.rq new file mode 100644 index 00000000000..1901a319522 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2,3]"^^cdt:List < "[1,1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-13.rq new file mode 100644 index 00000000000..237779e1048 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,1,1]"^^cdt:List < "[1,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-14.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-14.rq new file mode 100644 index 00000000000..8bc915fbcb7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,2]"^^cdt:List < "[1,1,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-15.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-15.rq new file mode 100644 index 00000000000..ad5d0c556eb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-15.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[true]"^^cdt:List < "[false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-16.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-16.rq new file mode 100644 index 00000000000..7b2dc2f56ed --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-16.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[false]"^^cdt:List < "[true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-19.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-19.rq new file mode 100644 index 00000000000..7092cde5345 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-19.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false]"^^cdt:List < "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-20.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-20.rq new file mode 100644 index 00000000000..52a449a17da --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-20.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List < "[1,false]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-21.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-21.rq new file mode 100644 index 00000000000..1b5193cee28 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-21.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,2]"^^cdt:List < "[1,true,1]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-22.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-22.rq new file mode 100644 index 00000000000..844b3466bf6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-22.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true,1]"^^cdt:List < "[1,false,2]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-23.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-23.rq new file mode 100644 index 00000000000..ed01b6f64a5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-23.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,false,true]"^^cdt:List < "[1,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-24.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-24.rq new file mode 100644 index 00000000000..8b64322aae8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-24.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,true]"^^cdt:List < "[1,false,true]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-25.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-25.rq new file mode 100644 index 00000000000..2a58b286a79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-25.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List < "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-26.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-26.rq new file mode 100644 index 00000000000..b07c7ce70ab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-26.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List < "[_:b]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-27.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-27.rq new file mode 100644 index 00000000000..a64437ae107 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-27.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:List(?x) < cdt:List(?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-28.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-28.rq new file mode 100644 index 00000000000..f0c06258b76 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-28.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[_:b]"^^cdt:List < "[_:b]"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-29.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-29.rq new file mode 100644 index 00000000000..366a422d09e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-29.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:List(?x) < cdt:List(?x) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-31.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-31.rq new file mode 100644 index 00000000000..cd2c36cad71 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-31.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[ ]"^^cdt:List < "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-03.rq new file mode 100644 index 00000000000..2f889ce9de8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(2) AS ?list2 ) + BIND( ( "1"^^cdt:List < ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-04.rq new file mode 100644 index 00000000000..9f3e62071cc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-error-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(1) AS ?list1 ) + BIND( ( ?list1 < "2"^^cdt:List ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-01.rq new file mode 100644 index 00000000000..d734a7270c4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List < "[]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-02.rq new file mode 100644 index 00000000000..7821aa350a3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[]"^^cdt:List < "[null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-03.rq new file mode 100644 index 00000000000..d8f60ba2047 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[null]"^^cdt:List < "[null]"^^cdt:List ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-04.rq new file mode 100644 index 00000000000..1f858de780d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-04.rq @@ -0,0 +1,11 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x, ?y) AS ?list1 ) + BIND( cdt:List(?z) AS ?list2 ) + BIND( ( ?list1 < ?list2 ) AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-05.rq new file mode 100644 index 00000000000..775245cd2da --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "[1,null]"^^cdt:List < "[2,null]"^^cdt:List ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-06.rq new file mode 100644 index 00000000000..d488c08ea6a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/list-less-than-null-06.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:List(?x) AS ?list1 ) + BIND( cdt:List(BNODE()) AS ?list2 ) + BIND( ( ?list1 < ?list2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/list-functions/manifest.ttl new file mode 100644 index 00000000000..9347cc46617 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/manifest.ttl @@ -0,0 +1,3226 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "Functions for cdt:List Literals" ; + mf:entries + ( + :list-constructor-01 + :list-constructor-02 + :list-constructor-03 + :list-constructor-04 + :list-constructor-05 + :list-constructor-06 + :list-constructor-09 + :list-constructor-10 + :list-constructor-11 + :list-constructor-12 + :list-constructor-13 + :list-constructor-14 + :list-constructor-15 + :list-constructor-16 + + :concat-01 + :concat-02 + :concat-03 + :concat-04 + :concat-05 + :concat-06 + :concat-07 + :concat-08 + :concat-09 + :concat-10 + + :contains-01 + :contains-02 + :contains-03 + :contains-04 + :contains-05 + :contains-06 + :contains-07 + :contains-08 + :contains-09 + :contains-10 + + :get-01 + :get-02 + :get-03 + :get-04 + :get-05 + :get-06 + :get-07 + :get-08 + :get-09 + :get-10 + :get-11 + :get-12 + :get-13 + + :head-01 + :head-02 + :head-03 + :head-04 + :head-05 + :head-06 + :head-07 + :head-08 + :head-09 + :head-10 + :head-11 + :head-12 + + :tail-01 + :tail-02 + :tail-03 + :tail-04 + :tail-05 + :tail-06 + :tail-07 + :tail-08 + :tail-09 + :tail-10 + + :reverse-01 + :reverse-02 + :reverse-03 + :reverse-04 + :reverse-05 + :reverse-06 + :reverse-07 + :reverse-08 + :reverse-09 + :reverse-10 + + :size-01 + :size-02 + :size-03 + :size-04 + :size-05 + :size-06 + :size-07 + :size-08 + :size-09 + :size-10 + :size-11 + :size-12 + + :subseq-01 + :subseq-02 + :subseq-03 + :subseq-04 + :subseq-05 + :subseq-06 + :subseq-07 + :subseq-08 + :subseq-09 + :subseq-10 + :subseq-11 + :subseq-12 + :subseq-13 + + # Null-values + + :list-constructor-null-01 + :list-constructor-null-02 + :concat-null-01 + :contains-null-01 + :get-null-01 + :get-null-02 + :head-null-01 + :head-null-02 + + # Errors + :get-error-01 # non-list argument + :get-error-02 # invalid index (greater than size) + :get-error-03 # invalid index (zero) + :get-error-04 # invalid index (negative) + :get-error-05 # (non-integer) string index + :get-error-06 # (non-integer) decimal index + :subseq-error-01 # non-list argument + :subseq-error-02 # non-integer index + :concat-error-01 # non-list argument + :concat-error-02 # non-list argument + :contains-error-01 # non-list argument + :head-error-01 # non-list argument + :tail-error-01 # non-list argument + :reverse-error-01 # non-list argument + :size-error-01 # non-list argument + + # Equality Tests for Lists + :list-equals-01 # empty list + :list-equals-02 # single-element + :list-equals-03 # multiple-element + :list-equals-04 # multiple-element, value-space comparison + :list-equals-05 # same IRI + :list-equals-06 # blank nodes + :list-equals-07 # blank nodes + :list-equals-08 # blank nodes + :list-equals-09 # blank nodes + :list-equals-null-01 + :list-equals-null-02 + + # Comparison Tests for Lists + :list-less-than-01 + :list-less-than-02 + :list-less-than-03 + :list-less-than-04 + :list-less-than-05 + :list-less-than-06 + :list-less-than-07 + :list-less-than-08 + :list-less-than-09 + :list-less-than-10 + :list-less-than-11 + :list-less-than-12 + :list-less-than-13 + :list-less-than-14 + :list-less-than-15 + :list-less-than-16 + :list-less-than-19 + :list-less-than-20 + :list-less-than-21 + :list-less-than-22 + :list-less-than-23 + :list-less-than-24 + :list-less-than-25 + :list-less-than-26 + :list-less-than-27 + :list-less-than-28 + :list-less-than-29 + :list-less-than-31 + :list-less-than-null-01 + :list-less-than-null-02 + :list-less-than-null-03 + :list-less-than-null-04 + :list-less-than-null-05 + :list-less-than-null-06 + :list-less-than-error-03 + :list-less-than-error-04 + :list-less-equal-01 + :list-less-equal-02 + :list-less-equal-03 + :list-less-equal-04 + :list-less-equal-05 + :list-less-equal-06 + :list-less-equal-07 + :list-less-equal-08 + :list-less-equal-09 + :list-less-equal-10 + :list-less-equal-11 + :list-less-equal-12 + :list-less-equal-13 + :list-less-equal-14 + :list-less-equal-15 + :list-less-equal-16 + :list-less-equal-19 + :list-less-equal-20 + :list-less-equal-21 + :list-less-equal-22 + :list-less-equal-23 + :list-less-equal-24 + :list-less-equal-25 + :list-less-equal-26 + :list-less-equal-27 + :list-less-equal-28 + :list-less-equal-29 + :list-less-equal-31 + :list-less-equal-null-01 + :list-less-equal-null-02 + :list-less-equal-null-03 + :list-less-equal-null-04 + :list-less-equal-null-05 + :list-less-equal-null-06 + :list-less-equal-error-03 + :list-less-equal-error-04 + :list-greater-than-01 + :list-greater-than-02 + :list-greater-than-03 + :list-greater-than-04 + :list-greater-than-05 + :list-greater-than-06 + :list-greater-than-07 + :list-greater-than-08 + :list-greater-than-09 + :list-greater-than-10 + :list-greater-than-11 + :list-greater-than-12 + :list-greater-than-13 + :list-greater-than-14 + :list-greater-than-15 + :list-greater-than-16 + :list-greater-than-19 + :list-greater-than-20 + :list-greater-than-21 + :list-greater-than-22 + :list-greater-than-23 + :list-greater-than-24 + :list-greater-than-25 + :list-greater-than-26 + :list-greater-than-27 + :list-greater-than-28 + :list-greater-than-29 + :list-greater-than-31 + :list-greater-than-null-01 + :list-greater-than-null-02 + :list-greater-than-null-03 + :list-greater-than-null-04 + :list-greater-than-null-05 + :list-greater-than-null-06 + :list-greater-than-error-03 + :list-greater-than-error-04 + :list-greater-equal-01 + :list-greater-equal-02 + :list-greater-equal-03 + :list-greater-equal-04 + :list-greater-equal-05 + :list-greater-equal-06 + :list-greater-equal-07 + :list-greater-equal-08 + :list-greater-equal-09 + :list-greater-equal-10 + :list-greater-equal-11 + :list-greater-equal-12 + :list-greater-equal-13 + :list-greater-equal-14 + :list-greater-equal-15 + :list-greater-equal-16 + :list-greater-equal-19 + :list-greater-equal-20 + :list-greater-equal-21 + :list-greater-equal-22 + :list-greater-equal-23 + :list-greater-equal-24 + :list-greater-equal-25 + :list-greater-equal-26 + :list-greater-equal-27 + :list-greater-equal-28 + :list-greater-equal-29 + :list-greater-equal-31 + :list-greater-equal-null-01 + :list-greater-equal-null-02 + :list-greater-equal-null-03 + :list-greater-equal-null-04 + :list-greater-equal-null-05 + :list-greater-equal-null-06 + :list-greater-equal-error-03 + :list-greater-equal-error-04 + + # sameTerm Tests for Lists + :sameterm-01 # empty list + :sameterm-02 # single-element + :sameterm-03 # multiple-element + :sameterm-04 # multiple-element, different lexical-space, same value-space elements (!sameTerm) + :sameterm-null-01 # list with null (allowed since the test is on the list lexical, not the elements) + ) . + +:list-constructor-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-01" ; + rdfs:comment "construct an empty list" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-02" ; + rdfs:comment "construct a list with a single integer element" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-03" ; + rdfs:comment "construct a list with two integer elements" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-04" ; + rdfs:comment "construct a list with a single string element" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-05" ; + rdfs:comment "construct a list with two string elements" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-06" ; + rdfs:comment "construct a list with two elements of differing type" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-09" ; + rdfs:comment "construct a list with a nested, empty list element" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-10 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-10" ; + rdfs:comment "construct a list with a nested list with a single integer element" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-11 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-11" ; + rdfs:comment "construct a list with two elements of different type, one being a nested list" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-12 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-12" ; + rdfs:comment "construct a list with two elements of different type, one being a null element produced by unbound variable error" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-13 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-13" ; + rdfs:comment "construct two equal lists, one by list constructor and the other by literal syntax" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-14 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-14" ; + rdfs:comment "construct a list using STRDT" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-15 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-15" ; + rdfs:comment "construct a list with two integer elements that are the results of evaluating sub-expression including operators" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-16 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-16" ; + rdfs:comment "construct a list with a blank node and check that the identity of the blank node is preserved" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-01 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-01" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-02 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-02" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-03 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-03" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-04 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-04" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-05 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-05" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-06 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-06" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-07 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-07" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-08 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-08" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-09 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-09" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-10 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-10" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-01 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-01" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-02 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-02" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-03 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-03" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-04 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-04" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-05 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-05" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-06 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-06" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-07 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-07" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-08 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-08" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-09 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-09" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-10 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-10" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-01" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-02 rdf:type mf:QueryEvaluationTest ; + mf:name "get-02" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-03 rdf:type mf:QueryEvaluationTest ; + mf:name "get-03" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-04 rdf:type mf:QueryEvaluationTest ; + mf:name "get-04" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-05 rdf:type mf:QueryEvaluationTest ; + mf:name "get-05" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-06 rdf:type mf:QueryEvaluationTest ; + mf:name "get-06" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-07 rdf:type mf:QueryEvaluationTest ; + mf:name "get-07" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-08 rdf:type mf:QueryEvaluationTest ; + mf:name "get-08" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-09 rdf:type mf:QueryEvaluationTest ; + mf:name "get-09" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-10 rdf:type mf:QueryEvaluationTest ; + mf:name "get-10" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-11 rdf:type mf:QueryEvaluationTest ; + mf:name "get-11" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-12 rdf:type mf:QueryEvaluationTest ; + mf:name "get-12" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-13 rdf:type mf:QueryEvaluationTest ; + mf:name "get-13" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-01 rdf:type mf:QueryEvaluationTest ; + mf:name "head-01" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-02 rdf:type mf:QueryEvaluationTest ; + mf:name "head-02" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-03 rdf:type mf:QueryEvaluationTest ; + mf:name "head-03" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-04 rdf:type mf:QueryEvaluationTest ; + mf:name "head-04" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-05 rdf:type mf:QueryEvaluationTest ; + mf:name "head-05" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-06 rdf:type mf:QueryEvaluationTest ; + mf:name "head-06" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-07 rdf:type mf:QueryEvaluationTest ; + mf:name "head-07" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-08 rdf:type mf:QueryEvaluationTest ; + mf:name "head-08" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-09 rdf:type mf:QueryEvaluationTest ; + mf:name "head-09" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-10 rdf:type mf:QueryEvaluationTest ; + mf:name "head-10" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-11 rdf:type mf:QueryEvaluationTest ; + mf:name "head-11" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-12 rdf:type mf:QueryEvaluationTest ; + mf:name "head-12" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-01 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-01" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-02 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-02" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-03 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-03" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-04 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-04" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-05 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-05" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-06 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-06" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-07 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-07" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-08 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-08" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-09 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-09" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-10 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-10" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-01 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-01" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-02 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-02" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-03 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-03" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-04 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-04" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-05 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-05" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-06 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-06" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-07 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-07" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-08 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-08" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-09 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-09" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-10 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-10" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-01 rdf:type mf:QueryEvaluationTest ; + mf:name "size-01" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-02 rdf:type mf:QueryEvaluationTest ; + mf:name "size-02" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-03 rdf:type mf:QueryEvaluationTest ; + mf:name "size-03" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-04 rdf:type mf:QueryEvaluationTest ; + mf:name "size-04" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-05 rdf:type mf:QueryEvaluationTest ; + mf:name "size-05" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-06 rdf:type mf:QueryEvaluationTest ; + mf:name "size-06" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-07 rdf:type mf:QueryEvaluationTest ; + mf:name "size-07" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-08 rdf:type mf:QueryEvaluationTest ; + mf:name "size-08" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-09 rdf:type mf:QueryEvaluationTest ; + mf:name "size-09" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-10 rdf:type mf:QueryEvaluationTest ; + mf:name "size-10" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-11 rdf:type mf:QueryEvaluationTest ; + mf:name "size-11" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-12 rdf:type mf:QueryEvaluationTest ; + mf:name "size-12" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-01 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-01" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-02 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-02" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-03 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-03" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-04 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-04" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-05 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-05" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-06 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-06" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-07 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-07" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-08 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-08" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-09 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-09" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-10 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-10" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-11 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-11" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-12 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-12" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-13 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-13" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-null-01" ; + rdfs:comment "list constructor on null argument" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-constructor-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-constructor-null-02" ; + rdfs:comment "construct a list one null element produced by expression evaluation error" ; + mf:feature cdt:list-constructor ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-null-01" ; + rdfs:comment "concat with null" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-null-01" ; + rdfs:comment "contains over list containing null" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-null-01" ; + rdfs:comment "get returning null" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "get-null-02" ; + rdfs:comment "get on empty list" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "head-null-01" ; + rdfs:comment "head returning null" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "head-null-02" ; + rdfs:comment "head on empty list" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-01" ; + rdfs:comment "get on invalid index" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-02" ; + rdfs:comment "get with non-integer index" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-03" ; + rdfs:comment "get with non-list argument" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-04" ; + rdfs:comment "get with non-list argument" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-05 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-05" ; + rdfs:comment "get with non-list argument" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-06 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-06" ; + rdfs:comment "get with non-list argument" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-error-01" ; + rdfs:comment "subseq with non-list argument" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:subseq-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "subseq-error-02" ; + rdfs:comment "subseq with non-integer index" ; + mf:feature cdt:subseq ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-error-01" ; + rdfs:comment "concat with non-list argument" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:concat-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "concat-error-02" ; + rdfs:comment "concat with non-list argument" ; + mf:feature cdt:concat ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:contains-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "contains-error-01" ; + rdfs:comment "contains with non-list argument" ; + mf:feature cdt:contains ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:head-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "head-error-01" ; + rdfs:comment "head with non-list argument" ; + mf:feature cdt:head ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:tail-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "tail-error-01" ; + rdfs:comment "tail with non-list argument" ; + mf:feature cdt:tail ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:reverse-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "reverse-error-01" ; + rdfs:comment "reverse with non-list argument" ; + mf:feature cdt:reverse ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "size-error-01" ; + rdfs:comment "size with non-list argument" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-01" ; + rdfs:comment "equals test on empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-02" ; + rdfs:comment "equals test on single-element" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-03" ; + rdfs:comment "equals test on multiple-element" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-04" ; + rdfs:comment "equals test on multiple-element, value-space comparison" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-05" ; + rdfs:comment "equals test on lists with same IRI" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-06" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-07 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-07" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-08 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-08" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-09" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-null-01" ; + rdfs:comment "equality of pairs of null within lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-equals-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-equals-null-02" ; + rdfs:comment "null is not equal to any RDF term" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-01" ; + rdfs:comment "less-than test on two empty lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-02" ; + rdfs:comment "less-than test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-03" ; + rdfs:comment "less-than test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-04" ; + rdfs:comment "less-than test with equal lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-05" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-06" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-07 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-07" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-08 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-08" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-09" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-10 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-10" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-11 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-11" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-12 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-12" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-13 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-13" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-14 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-14" ; + rdfs:comment "less-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-15 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-15" ; + rdfs:comment "less-than test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-16 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-16" ; + rdfs:comment "less-than test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-19 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-19" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-20 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-20" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-21 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-21" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-22 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-22" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-23 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-23" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-24 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-24" ; + rdfs:comment "less-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-25 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-25" ; + rdfs:comment "less-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-26 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-26" ; + rdfs:comment "less-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-27 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-27" ; + rdfs:comment "less-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-28 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-28" ; + rdfs:comment "less-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-29 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-29" ; + rdfs:comment "less-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-31 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-31" ; + rdfs:comment "less-than test with IRIs" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-01" ; + rdfs:comment "less-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-02" ; + rdfs:comment "less-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-03" ; + rdfs:comment "less-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-04" ; + rdfs:comment "less-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-05" ; + rdfs:comment "less-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-null-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-null-06" ; + rdfs:comment "less-than test with null and blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-error-03" ; + rdfs:comment "less-than test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-than-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-than-error-04" ; + rdfs:comment "less-than test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-01" ; + rdfs:comment "less-equal test on two empty lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-02" ; + rdfs:comment "less-equal test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-03" ; + rdfs:comment "less-equal test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-04" ; + rdfs:comment "less-equal test with equal lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-05" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-06" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-07 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-07" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-08 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-08" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-09" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-10 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-10" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-11 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-11" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-12 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-12" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-13 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-13" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-14 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-14" ; + rdfs:comment "less-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-15 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-15" ; + rdfs:comment "less-equal test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-16 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-16" ; + rdfs:comment "less-equal test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-19 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-19" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-20 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-20" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-21 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-21" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-22 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-22" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-23 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-23" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-24 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-24" ; + rdfs:comment "less-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-25 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-25" ; + rdfs:comment "less-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-26 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-26" ; + rdfs:comment "less-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-27 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-27" ; + rdfs:comment "less-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-28 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-28" ; + rdfs:comment "less-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-29 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-29" ; + rdfs:comment "less-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-31 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-31" ; + rdfs:comment "less-equal test with IRIs" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-01" ; + rdfs:comment "less-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-02" ; + rdfs:comment "less-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-03" ; + rdfs:comment "less-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-04" ; + rdfs:comment "less-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-05" ; + rdfs:comment "less-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-null-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-null-06" ; + rdfs:comment "less-equal test with null and blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-error-03" ; + rdfs:comment "less-equal test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-less-equal-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-less-equal-error-04" ; + rdfs:comment "less-equal test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-01" ; + rdfs:comment "greater-than test on two empty lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-02" ; + rdfs:comment "greater-than test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-03" ; + rdfs:comment "greater-than test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-04" ; + rdfs:comment "greater-than test with equal lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-05" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-06" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-07 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-07" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-08 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-08" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-09" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-10 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-10" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-11 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-11" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-12 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-12" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-13 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-13" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-14 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-14" ; + rdfs:comment "greater-than test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-15 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-15" ; + rdfs:comment "greater-than test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-16 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-16" ; + rdfs:comment "greater-than test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-19 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-19" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-20 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-20" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-21 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-21" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-22 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-22" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-23 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-23" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-24 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-24" ; + rdfs:comment "greater-than test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-25 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-25" ; + rdfs:comment "greater-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-26 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-26" ; + rdfs:comment "greater-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-27 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-27" ; + rdfs:comment "greater-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-28 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-28" ; + rdfs:comment "greater-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-29 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-29" ; + rdfs:comment "greater-than test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-31 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-31" ; + rdfs:comment "greater-than test with IRIs" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-01" ; + rdfs:comment "greater-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-02" ; + rdfs:comment "greater-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-03" ; + rdfs:comment "greater-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-04" ; + rdfs:comment "greater-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-05" ; + rdfs:comment "greater-than test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-null-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-null-06" ; + rdfs:comment "greater-than test with null and blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-error-03" ; + rdfs:comment "greater-than test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-than-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-than-error-04" ; + rdfs:comment "greater-than test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-01" ; + rdfs:comment "greater-equal test on two empty lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-02" ; + rdfs:comment "greater-equal test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-03" ; + rdfs:comment "greater-equal test with one empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-04" ; + rdfs:comment "greater-equal test with equal lists" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-05" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-06" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-07 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-07" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-08 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-08" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-09 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-09" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-10 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-10" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-11 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-11" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-12 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-12" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-13 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-13" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-14 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-14" ; + rdfs:comment "greater-equal test with integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-15 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-15" ; + rdfs:comment "greater-equal test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-16 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-16" ; + rdfs:comment "greater-equal test with booleans" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-19 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-19" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-20 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-20" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-21 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-21" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-22 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-22" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-23 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-23" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-24 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-24" ; + rdfs:comment "greater-equal test with mixed types" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-25 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-25" ; + rdfs:comment "greater-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-26 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-26" ; + rdfs:comment "greater-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-27 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-27" ; + rdfs:comment "greater-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-28 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-28" ; + rdfs:comment "greater-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-29 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-29" ; + rdfs:comment "greater-equal test with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-31 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-31" ; + rdfs:comment "greater-equal test with IRIs" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-01" ; + rdfs:comment "greater-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-02" ; + rdfs:comment "greater-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-03" ; + rdfs:comment "greater-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-04" ; + rdfs:comment "greater-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-05 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-05" ; + rdfs:comment "greater-equal test with nulls" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-null-06 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-null-06" ; + rdfs:comment "greater-equal test with null and blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-error-03" ; + rdfs:comment "greater-equal test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:list-greater-equal-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "list-greater-equal-error-04" ; + rdfs:comment "greater-equal test with ill-formed literal" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-01 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-01" ; + rdfs:comment "sameterm test on empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-02 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-02" ; + rdfs:comment "sameterm test on single-element" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-03 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-03" ; + rdfs:comment "sameterm test on multiple-element" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-04 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-04" ; + rdfs:comment "sameterm test on multiple-element, lexical-space comparison" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-null-01" ; + rdfs:comment "sameterm test on list with null (allowed since the test is on the list lexical, not the elements)" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-01.rq new file mode 100644 index 00000000000..4383d70e4fa --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = ?list) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-02.rq new file mode 100644 index 00000000000..4a3b1111c4d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = ?list) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-03.rq new file mode 100644 index 00000000000..77a4d48550d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two integers +ASK { + BIND("[1, 2]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = "[2,1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-04.rq new file mode 100644 index 00000000000..a62b3b6cc67 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one string +ASK { + BIND("['a']"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = "['a']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-05.rq new file mode 100644 index 00000000000..8c96fc10b54 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two strings +ASK { + BIND("['a', 'b']"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = "['b','a']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-06.rq new file mode 100644 index 00000000000..ed3589bb49d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two mixed types +ASK { + BIND("['a', 1]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = "[1,'a']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-07.rq new file mode 100644 index 00000000000..06e8abc644b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-07.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: +# list with null +ASK { + BIND("[null]"^^cdt:List AS ?list) + BIND(cdt:reverse(?list) AS ?result) + BIND(cdt:List(?unbound) AS ?expected) + FILTER(SAMETERM(?result, ?expected)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-08.rq new file mode 100644 index 00000000000..8f3c294e762 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-08.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested empty list +ASK { + BIND("[[]]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = ?list) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-09.rq new file mode 100644 index 00000000000..1517911b997 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-09.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed types including nested list +ASK { + BIND("[[1], 2]"^^cdt:List AS ?list) + FILTER(cdt:reverse(?list) = "[2,[1]]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-10.rq new file mode 100644 index 00000000000..4bce4827b93 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-10.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[null, 2]"^^cdt:List AS ?list) + BIND(cdt:reverse(?list) AS ?result) + BIND(cdt:List(2, ?unbound) AS ?expected) + FILTER(SAMETERM(?result, ?expected)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-error-01.rq new file mode 100644 index 00000000000..81e6110b483 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/reverse-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2]" AS ?list) + BIND(cdt:reverse(?list) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-01.rq new file mode 100644 index 00000000000..ff66bd6f2a8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("[]"^^cdt:List, "[]"^^cdt:List)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-02.rq new file mode 100644 index 00000000000..7af415de598 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("[1]"^^cdt:List, "[1]"^^cdt:List)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-03.rq new file mode 100644 index 00000000000..101083bffc9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(!SAMETERM("[1,2]"^^cdt:List, "[1,'2'^^]"^^cdt:List)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-04.rq new file mode 100644 index 00000000000..f3e7be095ca --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(!SAMETERM("[1,2,3]"^^cdt:List, "[ 1, 2, 3 ]"^^cdt:List)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-null-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-null-01.rq new file mode 100644 index 00000000000..0e1766124ef --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/sameterm-null-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("[1,null,2]"^^cdt:List, "[1,null,2]"^^cdt:List)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-01.rq new file mode 100644 index 00000000000..2d040c0141e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 0) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-02.rq new file mode 100644 index 00000000000..9633d1dce7d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-03.rq new file mode 100644 index 00000000000..a1ec15329b6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two integers +ASK { + BIND("[1, 2]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-04.rq new file mode 100644 index 00000000000..5733686eaa1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one string +ASK { + BIND("['a']"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-05.rq new file mode 100644 index 00000000000..27fe8449a0e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two strings +ASK { + BIND("['a', 'b']"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-06.rq new file mode 100644 index 00000000000..5bc7637365d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two mixed types +ASK { + BIND("['a', 1]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-07.rq new file mode 100644 index 00000000000..c39f1949ecf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with error as null +ASK { + BIND("[null]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-08.rq new file mode 100644 index 00000000000..920e6979621 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-08.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with unbound as null +ASK { + BIND("[null]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-09.rq new file mode 100644 index 00000000000..ac57087ef77 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-09.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested empty list +ASK { + BIND("[[]]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-10.rq new file mode 100644 index 00000000000..88f02e4ee47 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-10.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested list with one integer +ASK { + BIND("[[1]]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-11.rq new file mode 100644 index 00000000000..dca93e3a287 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-11.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed types including nested list +ASK { + BIND("[[1], 2]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-12.rq new file mode 100644 index 00000000000..ea68b510b8e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-12.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[null, 2]"^^cdt:List AS ?list) + FILTER(cdt:size(?list) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/size-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/size-error-01.rq new file mode 100644 index 00000000000..47db4e0b4be --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/size-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2]" AS ?list) + BIND(cdt:size(?list) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-01.rq new file mode 100644 index 00000000000..36b419f8441 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# subseq 1-1 +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 1, 1) = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-02.rq new file mode 100644 index 00000000000..44a6b730c8b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# subseq 2-3 +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 2, 3) = "[2, 3, 4]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-03.rq new file mode 100644 index 00000000000..74c14694468 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# subseq 1-arg +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 7) = "[7,8,9,10]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-04.rq new file mode 100644 index 00000000000..5c99f6d5010 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 1, 0) = ?list) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-05.rq new file mode 100644 index 00000000000..0f9b0212cbc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 1) = ?list) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-06.rq new file mode 100644 index 00000000000..6e9c696d6f8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# special case: idx = size+1 and length=0 +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 4, 0) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-07.rq new file mode 100644 index 00000000000..d91de2a7d43 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# special case: idx = size+1 and no length given +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + FILTER(cdt:subseq(?list, 4) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-08.rq new file mode 100644 index 00000000000..fed22c3a38e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# 1 arg overrun +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, 5) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-09.rq new file mode 100644 index 00000000000..5283078f477 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# 2 args overrun +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, 5, 0) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-10.rq new file mode 100644 index 00000000000..2f6bbac1999 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# 2 args overrun +ASK { + BIND("[1,2,3]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, 4, 1) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-11.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-11.rq new file mode 100644 index 00000000000..d48851f42b6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# subseq overrun 10-2 +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, 10, 2) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-12.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-12.rq new file mode 100644 index 00000000000..ded71ce53da --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# subseq underrun 0-2 +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, 0, 2) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-13.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-13.rq new file mode 100644 index 00000000000..ae90166f3ee --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: +# subseq 1-arg underrun +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, -2) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-01.rq new file mode 100644 index 00000000000..d3be2861fe4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]" AS ?list) + BIND(cdt:subseq(?list, 2, 3) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-02.rq new file mode 100644 index 00000000000..fcb525ebefe --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/subseq-error-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2,3,4,5,6,7,8,9,10]"^^cdt:List AS ?list) + BIND(cdt:subseq(?list, "invalid", 3) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-01.rq new file mode 100644 index 00000000000..b48227ccaab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# empty list +ASK { + BIND("[]"^^cdt:List AS ?list) + BIND(cdt:tail(?list) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-02.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-02.rq new file mode 100644 index 00000000000..f3a67b08c86 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one integer +ASK { + BIND("[1]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-03.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-03.rq new file mode 100644 index 00000000000..f8f53db39d3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two integers +ASK { + BIND("[1, 2]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-04.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-04.rq new file mode 100644 index 00000000000..e74541cae02 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with one string +ASK { + BIND("['a']"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-05.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-05.rq new file mode 100644 index 00000000000..c58486a46ea --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two strings +ASK { + BIND("['a', 'b']"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "['b']"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-06.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-06.rq new file mode 100644 index 00000000000..590df7ae041 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with two mixed types +ASK { + BIND("['a', 1]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-07.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-07.rq new file mode 100644 index 00000000000..857124b6ce4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with null +ASK { + BIND("[null]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-08.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-08.rq new file mode 100644 index 00000000000..acf1633c195 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-08.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with nested empty list +ASK { + BIND("[[]]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-09.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-09.rq new file mode 100644 index 00000000000..4e66669f5cc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-09.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed types including nested list +ASK { + BIND("[[1], 2]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-10.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-10.rq new file mode 100644 index 00000000000..f307c909165 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-10.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: +# list with mixed defined and undefined types +ASK { + BIND("[null, 2]"^^cdt:List AS ?list) + FILTER(cdt:tail(?list) = "[2]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/tail-error-01.rq b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-error-01.rq new file mode 100644 index 00000000000..8d2be93fae3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/tail-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("[1,2]" AS ?list) + BIND(cdt:tail(?list) AS ?result) + FILTER(!BOUND(?result)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/list-functions/true.srx b/jena-arq/testing/SPARQL-CDTs/list-functions/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/list-functions/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/manifest-all.ttl b/jena-arq/testing/SPARQL-CDTs/manifest-all.ttl new file mode 100644 index 00000000000..f352dd7c80a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/manifest-all.ttl @@ -0,0 +1,16 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . + +<> a mf:Manifest ; + rdfs:label "SPARQL Composite Datatype tests" ; + mf:include ( + + + + + + + ) ; +. diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-01.rq new file mode 100644 index 00000000000..04941676210 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-01.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +# empty map +ASK { + BIND("{}"^^cdt:Map AS ?map) + BIND(cdt:containsKey(?map, 1) AS ?result) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-02.rq new file mode 100644 index 00000000000..3734ca2c1df --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-02.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +# 1-entry map +ASK { + BIND("{1: 'one'}"^^cdt:Map AS ?map) + FILTER(cdt:containsKey(?map, 1)) + FILTER(!cdt:containsKey(?map, "01"^^xsd:integer)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-03.rq new file mode 100644 index 00000000000..ef81a3deecb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/containsKey-03.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +# 2-entry map +ASK { + BIND("{1: 'one', 2: 'two'}"^^cdt:Map AS ?map) + FILTER(cdt:containsKey(?map, 1)) + FILTER(cdt:containsKey(?map, 2)) + + FILTER(!cdt:containsKey(?map, 'one')) + FILTER(!cdt:containsKey(?map, 'two')) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/empty.ttl b/jena-arq/testing/SPARQL-CDTs/map-functions/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-01.rq new file mode 100644 index 00000000000..820a6157183 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-01.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +# list with one integer +ASK { + BIND("{'hello'@en:'there'@en,1:'one',2:'two'}"^^cdt:Map AS ?map) + FILTER(cdt:get(?map, 1) = "one") + FILTER(cdt:get(?map, 2) = "two") + FILTER(cdt:get(?map, 'hello'@en) = "there"@en) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-02.rq new file mode 100644 index 00000000000..98acf81c72a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-02.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("{1:'one', 2:'two', '02'^^: 'also two'}"^^cdt:Map AS ?map) + FILTER(cdt:get(?map, 1) = "one") + FILTER(cdt:get(?map, 2) = "two") + FILTER(cdt:get(?map, "02"^^xsd:integer) = "also two") +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-03.rq new file mode 100644 index 00000000000..69de1689d04 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-03.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ 1: _:b, 2: _:b }"^^cdt:Map AS ?map ) + BIND( cdt:get(?map, 1) AS ?v1 ) + BIND( cdt:get(?map, 2) AS ?v2 ) + + FILTER( isBLANK(?v1) ) + FILTER( isBLANK(?v2) ) + FILTER( SAMETERM(?v1, ?v2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-04.rq new file mode 100644 index 00000000000..54133e0a931 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-04.rq @@ -0,0 +1,12 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ 1: _:b1, 2: _:b2 }"^^cdt:Map AS ?map ) + BIND( cdt:get(?map, 1) AS ?v1 ) + BIND( cdt:get(?map, 2) AS ?v2 ) + + FILTER( isBLANK(?v1) ) + FILTER( isBLANK(?v2) ) + FILTER( ! SAMETERM(?v1, ?v2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-error-01.rq new file mode 100644 index 00000000000..3e755e64b2e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# list with one integer +ASK { + BIND("{1:'one',2:'two',4:'four'}"^^cdt:Map AS ?map) + BIND(cdt:get(?map, 3) AS ?null) + FILTER(!BOUND(?null)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/get-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/get-null-01.rq new file mode 100644 index 00000000000..910a4e9e066 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/get-null-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +# list with one integer +ASK { + BIND("{1:'one',2:'two',3:null,4:'four'}"^^cdt:Map AS ?map) + BIND(cdt:get(?map, 3) AS ?null) + FILTER(!BOUND(?null)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/keys-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-01.rq new file mode 100644 index 00000000000..523fde778de --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty map +ASK { + BIND("{}"^^cdt:Map AS ?map) + FILTER(cdt:keys(?map) = "[]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/keys-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-02.rq new file mode 100644 index 00000000000..d658ae5d437 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# 1-entry map +ASK { + BIND("{1: 'one'}"^^cdt:Map AS ?map) + FILTER(cdt:keys(?map) = "[1]"^^cdt:List) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/keys-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-03.rq new file mode 100644 index 00000000000..8bdfd43f815 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/keys-03.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + +# 2-entry map +ASK { + BIND("{1: 'one', 2: 'two'}"^^cdt:Map AS ?map) + BIND(cdt:keys(?map) AS ?keys) + FILTER(cdt:size(?keys) = 2) + FILTER(cdt:contains(?keys, 1)) + FILTER(cdt:contains(?keys, 2)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/map-functions/manifest.ttl new file mode 100644 index 00000000000..3496be5df22 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/manifest.ttl @@ -0,0 +1,2081 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "Functions for cdt:Map Literals" ; + mf:entries + ( + :get-01 + :get-02 + :get-03 + :get-04 + :get-null-01 + :get-error-01 + + :size-01 + :size-02 + :size-03 + :size-04 + :size-05 + + :keys-01 + :keys-02 + :keys-03 + + :containsKey-01 + :containsKey-02 + :containsKey-03 + + :map-constructor-01 + :map-constructor-02 + :map-constructor-03 + :map-constructor-04 + :map-constructor-05 + :map-constructor-06 + :map-constructor-07 + :map-constructor-08 + :map-constructor-09 + :map-constructor-10 + :map-constructor-11 + + :map-equals-01 # empty map + :map-equals-02 # single-element + :map-equals-03 # single-entry, integer shortcut syntax + :map-equals-04 # single-entry, keys with different lexical form but same value + :map-equals-05 # same IRI + :map-equals-06 # blank nodes + :map-equals-07 # blank nodes + :map-equals-08 # blank nodes + :map-equals-09 # blank nodes + :map-equals-null-01 + :map-equals-null-02 + + :map-less-than-01 + :map-less-than-02 + :map-less-than-03 + :map-less-than-04 + :map-less-than-05 + :map-less-than-06 + :map-less-than-07 + :map-less-than-08 + :map-less-than-09 + :map-less-than-10 + :map-less-than-11 + :map-less-than-12 + :map-less-than-13 + :map-less-than-14 + :map-less-than-15 + :map-less-than-16 + :map-less-than-17 + :map-less-than-18 + :map-less-than-19 + :map-less-than-20 + :map-less-than-21 + + :map-less-than-error-01 + :map-less-than-error-02 + :map-less-than-null-01 + :map-less-than-null-02 + :map-less-than-null-03 + :map-less-than-null-04 + + :map-less-equal-01 + :map-less-equal-02 + :map-less-equal-03 + :map-less-equal-04 + :map-less-equal-05 + :map-less-equal-06 + :map-less-equal-07 + :map-less-equal-08 + :map-less-equal-09 + :map-less-equal-10 + :map-less-equal-11 + :map-less-equal-12 + :map-less-equal-13 + :map-less-equal-14 + :map-less-equal-15 + :map-less-equal-16 + :map-less-equal-17 + :map-less-equal-18 + :map-less-equal-19 + :map-less-equal-20 + :map-less-equal-21 + + :map-less-equal-error-01 + :map-less-equal-error-02 + :map-less-equal-null-01 + :map-less-equal-null-02 + :map-less-equal-null-03 + :map-less-equal-null-04 + + :map-greater-than-01 + :map-greater-than-02 + :map-greater-than-03 + :map-greater-than-04 + :map-greater-than-05 + :map-greater-than-06 + :map-greater-than-07 + :map-greater-than-08 + :map-greater-than-09 + :map-greater-than-10 + :map-greater-than-11 + :map-greater-than-12 + :map-greater-than-13 + :map-greater-than-14 + :map-greater-than-15 + :map-greater-than-16 + :map-greater-than-17 + :map-greater-than-18 + :map-greater-than-19 + :map-greater-than-20 + :map-greater-than-21 + + :map-greater-than-error-01 + :map-greater-than-error-02 + :map-greater-than-null-01 + :map-greater-than-null-02 + :map-greater-than-null-03 + :map-greater-than-null-04 + + :map-greater-equal-01 + :map-greater-equal-02 + :map-greater-equal-03 + :map-greater-equal-04 + :map-greater-equal-05 + :map-greater-equal-06 + :map-greater-equal-07 + :map-greater-equal-08 + :map-greater-equal-09 + :map-greater-equal-10 + :map-greater-equal-11 + :map-greater-equal-12 + :map-greater-equal-13 + :map-greater-equal-14 + :map-greater-equal-15 + :map-greater-equal-16 + :map-greater-equal-17 + :map-greater-equal-18 + :map-greater-equal-19 + :map-greater-equal-20 + :map-greater-equal-21 + + :map-greater-equal-error-01 + :map-greater-equal-error-02 + :map-greater-equal-null-01 + :map-greater-equal-null-02 + :map-greater-equal-null-03 + :map-greater-equal-null-04 + + :merge-01 + :merge-02 + :merge-03 + :merge-04 + :merge-05 + :merge-06 + :merge-07 + :merge-08 + :merge-null-01 + :merge-null-02 + :merge-null-03 + :merge-null-04 + + :put-01 + :put-02 + :put-03 + :put-04 + :put-05 + :put-06 + :put-07 + :put-08 + :put-09 + :put-10 + :put-11 + :put-12 + :put-13 + :put-14 + :put-15 + + :put-error-01 + :put-error-02 + :put-error-03 + :put-error-04 + :put-error-05 + + :remove-01 + :remove-02 + :remove-03 + :remove-04 + :remove-05 + :remove-06 + :remove-07 + :remove-08 + :remove-09 + :remove-10 + :remove-11 + + # sameTerm Tests for Maps + :sameterm-01 # empty list + :sameterm-02 # single-pair + :sameterm-03 # single-pair, same entry, but different lexical form for integers + :sameterm-04 # single-pair, same entry, but different lexical form for whitespace + :sameterm-05 # single-pair, same entry with blank node + :sameterm-null-01 # map with null + ) . + +:get-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-01" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-02 rdf:type mf:QueryEvaluationTest ; + mf:name "get-02" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-03 rdf:type mf:QueryEvaluationTest ; + mf:name "get-03" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-04 rdf:type mf:QueryEvaluationTest ; + mf:name "get-04" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-null-01" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:get-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "get-error-01" ; + mf:feature cdt:get ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-01 rdf:type mf:QueryEvaluationTest ; + mf:name "size-01" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-02 rdf:type mf:QueryEvaluationTest ; + mf:name "size-02" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-03 rdf:type mf:QueryEvaluationTest ; + mf:name "size-03" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-04 rdf:type mf:QueryEvaluationTest ; + mf:name "size-04" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:size-05 rdf:type mf:QueryEvaluationTest ; + mf:name "size-05" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:keys-01 rdf:type mf:QueryEvaluationTest ; + mf:name "keys-01" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:keys-02 rdf:type mf:QueryEvaluationTest ; + mf:name "keys-02" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:keys-03 rdf:type mf:QueryEvaluationTest ; + mf:name "keys-03" ; + mf:feature cdt:size ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:containsKey-01 rdf:type mf:QueryEvaluationTest ; + mf:name "containsKey-01" ; + mf:feature cdt:containsKey ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:containsKey-02 rdf:type mf:QueryEvaluationTest ; + mf:name "containsKey-02" ; + mf:feature cdt:containsKey ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:containsKey-03 rdf:type mf:QueryEvaluationTest ; + mf:name "containsKey-03" ; + mf:feature cdt:containsKey ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-01" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-02" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-03" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-04" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-05" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-06" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-07" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-08" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-09" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-10 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-10" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-constructor-11 rdf:type mf:QueryEvaluationTest ; + mf:name "map-constructor-11" ; + mf:feature cdt:Map ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-01" ; + rdfs:comment "equals test on empty list" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-02" ; + rdfs:comment "equals test on single-element" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-03" ; + rdfs:comment "equals test on single-element, integer shortcut syntax" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-04" ; + rdfs:comment "equals test on single-element, keys with different lexical form but same value" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-05" ; + rdfs:comment "equals test on lists with same IRI" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-06" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-07" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-08" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-09" ; + rdfs:comment "equals test on lists with blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-null-01" ; + rdfs:comment "equality of pairs of null within maps" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-equals-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-equals-null-02" ; + rdfs:comment "null is not equal to any RDF term" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-10 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-11 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-11" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-12 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-12" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-13 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-13" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-14 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-14" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-15 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-15" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-16 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-16" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-17 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-17" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-18 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-18" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-19 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-19" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-20 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-20" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-21 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-21" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-error-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-error-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-null-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-than-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-than-null-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-10 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-11 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-11" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-12 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-12" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-13 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-13" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-14 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-14" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-15 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-15" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-16 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-16" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-17 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-17" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-18 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-18" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-19 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-19" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-20 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-20" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-21 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-21" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-error-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-error-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-null-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-less-equal-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-less-equal-null-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-10 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-11 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-11" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-12 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-12" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-13 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-13" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-14 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-14" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-15 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-15" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-16 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-16" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-17 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-17" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-18 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-18" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-19 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-19" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-20 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-20" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-21 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-21" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-error-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-error-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-null-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-than-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-than-null-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-05 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-06 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-07 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-08 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-09 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-10 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-11 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-11" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-12 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-12" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-13 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-13" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-14 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-14" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-15 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-15" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-16 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-16" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-17 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-17" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-18 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-18" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-19 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-19" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-20 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-20" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-21 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-21" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-error-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-error-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-null-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:map-greater-equal-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "map-greater-equal-null-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-01 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-01" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-02 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-02" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-03 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-03" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-04 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-04" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-05 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-05" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-06 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-06" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-07 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-07" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-08 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-08" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-null-01" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-null-02" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-null-03 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-null-03" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:merge-null-04 rdf:type mf:QueryEvaluationTest ; + mf:name "merge-null-04" ; + mf:feature cdt:merge ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-01 rdf:type mf:QueryEvaluationTest ; + mf:name "put-01" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-02 rdf:type mf:QueryEvaluationTest ; + mf:name "put-02" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-03 rdf:type mf:QueryEvaluationTest ; + mf:name "put-03" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-04 rdf:type mf:QueryEvaluationTest ; + mf:name "put-04" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-05 rdf:type mf:QueryEvaluationTest ; + mf:name "put-05" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-06 rdf:type mf:QueryEvaluationTest ; + mf:name "put-06" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-07 rdf:type mf:QueryEvaluationTest ; + mf:name "put-07" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-08 rdf:type mf:QueryEvaluationTest ; + mf:name "put-08" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-09 rdf:type mf:QueryEvaluationTest ; + mf:name "put-09" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-10 rdf:type mf:QueryEvaluationTest ; + mf:name "put-10" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-11 rdf:type mf:QueryEvaluationTest ; + mf:name "put-11" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-12 rdf:type mf:QueryEvaluationTest ; + mf:name "put-12" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-13 rdf:type mf:QueryEvaluationTest ; + mf:name "put-13" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-14 rdf:type mf:QueryEvaluationTest ; + mf:name "put-14" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-15 rdf:type mf:QueryEvaluationTest ; + mf:name "put-15" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-error-01 rdf:type mf:QueryEvaluationTest ; + mf:name "put-error-01" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-error-02 rdf:type mf:QueryEvaluationTest ; + mf:name "put-error-02" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-error-03 rdf:type mf:QueryEvaluationTest ; + mf:name "put-error-03" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-error-04 rdf:type mf:QueryEvaluationTest ; + mf:name "put-error-04" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:put-error-05 rdf:type mf:QueryEvaluationTest ; + mf:name "put-error-05" ; + mf:feature cdt:put ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-01 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-01" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-02 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-02" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-03 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-03" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-04 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-04" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-05 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-05" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-06 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-06" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-07 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-07" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-08 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-08" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-09 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-09" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-10 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-10" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:remove-11 rdf:type mf:QueryEvaluationTest ; + mf:name "remove-11" ; + mf:feature cdt:remove ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-01 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-01" ; + rdfs:comment "sameterm test on empty map" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-02 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-02" ; + rdfs:comment "sameterm test on single-pair" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-03 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-03" ; + rdfs:comment "sameterm test on same entry, but different lexical form for integers" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-04 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-04" ; + rdfs:comment "sameterm test on same entry, but different lexical form for whitespace" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-05 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-05" ; + rdfs:comment "sameterm test on same entry with blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:sameterm-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "sameterm-null-01" ; + rdfs:comment "sameterm test on list with null (allowed since the test is on the list lexical, not the elements)" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-01.rq new file mode 100644 index 00000000000..24c7ceee413 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map() AS ?map ) + FILTER( ?map = "{}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-02.rq new file mode 100644 index 00000000000..dfee4418200 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,2,3,4) AS ?map ) + FILTER( ?map = "{1:2, 3:4}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-03.rq new file mode 100644 index 00000000000..b3922cb8681 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,2,1,4) AS ?map ) + FILTER( ?map = "{1:4}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-04.rq new file mode 100644 index 00000000000..15578009929 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,"one", '01'^^xsd:integer, "also one") AS ?map ) + FILTER( ?map = "{1:'one', '01'^^: 'also one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-05.rq new file mode 100644 index 00000000000..00ce460d538 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,"one", '01'^^xsd:integer, "also one", 1,"one again") AS ?map ) + FILTER( ?map = "{1:'one again', '01'^^: 'also one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-06.rq new file mode 100644 index 00000000000..141e12a3217 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map("hello"@en,"one", "hello", "also one") AS ?map ) + FILTER( ?map = "{'hello'@en:'one', 'hello':'also one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-07.rq new file mode 100644 index 00000000000..152af33f6d9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(,"uri", "hello", ) AS ?map ) + FILTER( ?map = "{:'uri', 'hello':}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-08.rq new file mode 100644 index 00000000000..44d9c1f6335 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-08.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,2, ?unbound, 4, 5,6) AS ?map ) + FILTER( ?map = "{1:2, 5:6}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-09.rq new file mode 100644 index 00000000000..ab2f4bda758 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-09.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,2, BNODE(), 4, 5,6) AS ?map ) + FILTER( ?map = "{1:2, 5:6}"^^cdt:Map ) # a blank node is not a valid map key +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-10.rq new file mode 100644 index 00000000000..3a64f2c8dd1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-10.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( cdt:Map(1,2, 3,?unbound) AS ?map ) + + FILTER( BOUND(?map) ) # check that there was no error + FILTER( cdt:size(?map) = 2 ) + + FILTER( cdt:get(?map,1) = 2 ) + + FILTER( cdt:containsKey(?map,3) ) + BIND( cdt:get(?map,3) AS ?v2 ) + FILTER( ! BOUND(?v2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-11.rq new file mode 100644 index 00000000000..b345161045d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-constructor-11.rq @@ -0,0 +1,17 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?bnode ) + BIND( cdt:Map(1,2, 3,?bnode) AS ?map ) + + FILTER( BOUND(?map) ) # check that there was no error + FILTER( cdt:size(?map) = 2 ) + + FILTER( cdt:get(?map,1) = 2 ) + + FILTER( cdt:containsKey(?map,3) ) + BIND( cdt:get(?map,3) AS ?v2 ) + FILTER( isBlank(?v2) ) + FILTER( SAMETERM(?v2, ?bnode) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-01.rq new file mode 100644 index 00000000000..67240ba0464 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("{ }"^^cdt:Map = "{}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-02.rq new file mode 100644 index 00000000000..b0159821108 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("{ 1: 1 }"^^cdt:Map = "{1:1}"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-03.rq new file mode 100644 index 00000000000..28e6fcde60d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER("{1:2}"^^cdt:Map = "{ 1 : '2'^^ }"^^cdt:Map) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-04.rq new file mode 100644 index 00000000000..99192acfb82 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("{1:2}"^^cdt:Map = "{'+1'^^ : 2.0}"^^cdt:Map AS ?result) + FILTER( ! ?result ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-05.rq new file mode 100644 index 00000000000..e1a47e0bc88 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER( "{:true}"^^cdt:Map = "{ : true }"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-06.rq new file mode 100644 index 00000000000..4adc8e83c53 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-06.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:_:b1}"^^cdt:Map = "{1:_:b1}"^^cdt:Map ) AS ?result ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-07.rq new file mode 100644 index 00000000000..9364290b005 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-07.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:_:b1}"^^cdt:Map = "{1:_:b2}"^^cdt:Map ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-08.rq new file mode 100644 index 00000000000..528eebd5257 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-08.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( BNODE() AS ?y ) + BIND( ( cdt:Map(1, ?x) = cdt:Map(1, ?y) ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-09.rq new file mode 100644 index 00000000000..323c37be1ea --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( BNODE() AS ?x ) + BIND( ( cdt:Map(1, ?x) = cdt:Map(1, ?x) ) AS ?result ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-01.rq new file mode 100644 index 00000000000..76bc5233aec --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-01.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("{1:null}"^^cdt:Map = "{1:null}"^^cdt:Map AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-02.rq new file mode 100644 index 00000000000..a157c9f0bcb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-equals-null-02.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND("{1:null}"^^cdt:Map = "{1:44}"^^cdt:Map AS ?result) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-01.rq new file mode 100644 index 00000000000..d6070ad3e7d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map >= "{ }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-02.rq new file mode 100644 index 00000000000..cdca9fe7176 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-03.rq new file mode 100644 index 00000000000..52a9b41e02e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map >= "{}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-04.rq new file mode 100644 index 00000000000..3cd6db241d1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map >= "{ 1:42 }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-05.rq new file mode 100644 index 00000000000..8f90f42cda2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map >= "{2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-06.rq new file mode 100644 index 00000000000..5e5feae5205 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{2:42}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-07.rq new file mode 100644 index 00000000000..e7754c89c21 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map >= "{1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-08.rq new file mode 100644 index 00000000000..b5a8ad27cc7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:43}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-09.rq new file mode 100644 index 00000000000..6b25434e260 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map >= "{2:42, 1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-10.rq new file mode 100644 index 00000000000..4657dea40da --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map >= "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-11.rq new file mode 100644 index 00000000000..bc9e7749f86 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map >= "{2:42, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-12.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-12.rq new file mode 100644 index 00000000000..0b440beec75 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map >= "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-13.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-13.rq new file mode 100644 index 00000000000..5aac5cb6f6d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-14.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-14.rq new file mode 100644 index 00000000000..2d85c9c0786 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:41, 2:43}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-15.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-15.rq new file mode 100644 index 00000000000..586856eb984 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-15.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'001'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'01'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-16.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-16.rq new file mode 100644 index 00000000000..cee7618d736 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-16.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: '001'^^ }"^^cdt:Map AS ?map1 ) + BIND( "{1: '01'^^ }"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-17.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-17.rq new file mode 100644 index 00000000000..ff892fdfee0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-17.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'2'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-18.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-18.rq new file mode 100644 index 00000000000..44f4dddc6ca --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-18.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'2'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-19.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-19.rq new file mode 100644 index 00000000000..b39aa6a4b32 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-19.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-20.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-20.rq new file mode 100644 index 00000000000..cf55e6c1934 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-20.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1 : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-21.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-21.rq new file mode 100644 index 00000000000..cba0a92fc76 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-21.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-01.rq new file mode 100644 index 00000000000..d692b96d829 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-01.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared based on < +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: }"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-02.rq new file mode 100644 index 00000000000..0ab7dbd97dc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-error-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared to literals +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: 42}"^^cdt:Map AS ?map2 ) + BIND( (?map1 >= ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-01.rq new file mode 100644 index 00000000000..bf3050ee911 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map >= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-02.rq new file mode 100644 index 00000000000..b5d45b3018d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:null}"^^cdt:Map >= "{1:43, 2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-03.rq new file mode 100644 index 00000000000..de8806cd4ef --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map >= "{1:null}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-04.rq new file mode 100644 index 00000000000..c92b1faef66 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-equal-null-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map >= "{1:null, 2:42}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-01.rq new file mode 100644 index 00000000000..b7b05e788cd --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map > "{ }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-02.rq new file mode 100644 index 00000000000..ec3ec47d099 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-03.rq new file mode 100644 index 00000000000..8035cdd5de8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map > "{}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-04.rq new file mode 100644 index 00000000000..4508c72f3b5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map > "{ 1:42 }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-05.rq new file mode 100644 index 00000000000..e278f31d420 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map > "{2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-06.rq new file mode 100644 index 00000000000..d6170aade76 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{2:42}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-07.rq new file mode 100644 index 00000000000..a10c9100104 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map > "{1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-08.rq new file mode 100644 index 00000000000..6b00305ea24 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:43}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-09.rq new file mode 100644 index 00000000000..0cc5ce6d2fa --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map > "{2:42, 1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-10.rq new file mode 100644 index 00000000000..65015f81fb3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map > "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-11.rq new file mode 100644 index 00000000000..bb865cffb98 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map > "{2:42, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-12.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-12.rq new file mode 100644 index 00000000000..7661faa26b1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map > "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-13.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-13.rq new file mode 100644 index 00000000000..709105e2705 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-14.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-14.rq new file mode 100644 index 00000000000..6f0fe6ee962 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:41, 2:43}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-15.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-15.rq new file mode 100644 index 00000000000..41c1f7874e9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-15.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'001'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'01'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-16.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-16.rq new file mode 100644 index 00000000000..9d93b5ed95e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-16.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: '001'^^ }"^^cdt:Map AS ?map1 ) + BIND( "{1: '01'^^ }"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-17.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-17.rq new file mode 100644 index 00000000000..0ef9f033da5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-17.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'2'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-18.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-18.rq new file mode 100644 index 00000000000..6b446e74a00 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-18.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'2'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-19.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-19.rq new file mode 100644 index 00000000000..c93b65922a6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-19.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-20.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-20.rq new file mode 100644 index 00000000000..4cd9c949779 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-20.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1 : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-21.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-21.rq new file mode 100644 index 00000000000..08e1cd3090f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-21.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-01.rq new file mode 100644 index 00000000000..87f6638fed5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-01.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared based on < +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: }"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-02.rq new file mode 100644 index 00000000000..6d503ba87f9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-error-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared to literals +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: 42}"^^cdt:Map AS ?map2 ) + BIND( (?map1 > ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-01.rq new file mode 100644 index 00000000000..0a111216e02 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map > "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-02.rq new file mode 100644 index 00000000000..c73288ba148 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:null}"^^cdt:Map > "{1:43, 2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-03.rq new file mode 100644 index 00000000000..eb9bd83d3ab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map > "{1:null}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-04.rq new file mode 100644 index 00000000000..812e032e1f1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-greater-than-null-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map > "{1:null, 2:42}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-01.rq new file mode 100644 index 00000000000..495f5f3caef --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map <= "{ }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-02.rq new file mode 100644 index 00000000000..f7ed335f642 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-03.rq new file mode 100644 index 00000000000..732181a562c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map <= "{}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-04.rq new file mode 100644 index 00000000000..d6a1b95b9e6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map <= "{ 1:42 }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-05.rq new file mode 100644 index 00000000000..bb808d6de1d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map <= "{2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-06.rq new file mode 100644 index 00000000000..fbd0320bb58 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{2:42}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-07.rq new file mode 100644 index 00000000000..84b26d1da77 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map <= "{1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-08.rq new file mode 100644 index 00000000000..7dfdb4cf22e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:43}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-09.rq new file mode 100644 index 00000000000..fe2a2ba1456 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map <= "{2:42, 1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-10.rq new file mode 100644 index 00000000000..1d440990254 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map <= "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-11.rq new file mode 100644 index 00000000000..d8e2bb0282b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map <= "{2:42, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-12.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-12.rq new file mode 100644 index 00000000000..36bd3b10253 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map <= "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-13.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-13.rq new file mode 100644 index 00000000000..7bd85cf71dd --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-14.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-14.rq new file mode 100644 index 00000000000..0ce22f4763d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:41, 2:43}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-15.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-15.rq new file mode 100644 index 00000000000..e0fb8c36cf9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-15.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'001'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'01'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-16.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-16.rq new file mode 100644 index 00000000000..fd20e5bb825 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-16.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: '001'^^ }"^^cdt:Map AS ?map1 ) + BIND( "{1: '01'^^ }"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-17.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-17.rq new file mode 100644 index 00000000000..25a2f79833e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-17.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'2'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-18.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-18.rq new file mode 100644 index 00000000000..f51f4facbac --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-18.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'2'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-19.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-19.rq new file mode 100644 index 00000000000..6d3b223e360 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-19.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-20.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-20.rq new file mode 100644 index 00000000000..d8fa45606a2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-20.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1 : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-21.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-21.rq new file mode 100644 index 00000000000..7b3d87ec0a0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-21.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-01.rq new file mode 100644 index 00000000000..6f8d63befa0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-01.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared based on < +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: }"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-02.rq new file mode 100644 index 00000000000..e9dc57a2d7e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-error-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared to literals +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: 42}"^^cdt:Map AS ?map2 ) + BIND( (?map1 <= ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-01.rq new file mode 100644 index 00000000000..19aca09cd51 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map <= "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-02.rq new file mode 100644 index 00000000000..9733a4ee702 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:null}"^^cdt:Map < "{1:43, 2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-03.rq new file mode 100644 index 00000000000..a49505965d6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map < "{1:null}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-04.rq new file mode 100644 index 00000000000..2a9553d4a72 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-equal-null-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map < "{1:null, 2:42}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-01.rq new file mode 100644 index 00000000000..301d499820b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map < "{ }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-02.rq new file mode 100644 index 00000000000..f05c1818f0d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-03.rq new file mode 100644 index 00000000000..ae7eac4c911 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map < "{}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-04.rq new file mode 100644 index 00000000000..a458eb496bf --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map < "{ 1:42 }"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-05.rq new file mode 100644 index 00000000000..114b3fcb28d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-05.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map < "{2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-06.rq new file mode 100644 index 00000000000..3b95e73703c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-06.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{2:42}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-07.rq new file mode 100644 index 00000000000..962a21c7008 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-07.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map < "{1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-08.rq new file mode 100644 index 00000000000..98ea6502bde --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-08.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:43}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-09.rq new file mode 100644 index 00000000000..537a727c1a3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-09.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map < "{2:42, 1:43}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-10.rq new file mode 100644 index 00000000000..67c0bfce86c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-10.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:42}"^^cdt:Map < "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-11.rq new file mode 100644 index 00000000000..b847491699b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-11.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map < "{2:42, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-12.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-12.rq new file mode 100644 index 00000000000..c4bdfb35922 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-12.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42}"^^cdt:Map < "{2:43, 1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-13.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-13.rq new file mode 100644 index 00000000000..bccc0b7fa16 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-13.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:43}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-14.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-14.rq new file mode 100644 index 00000000000..ac0f834e8a7 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-14.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:41, 2:43}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-15.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-15.rq new file mode 100644 index 00000000000..5fbda080e1f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-15.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'001'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'01'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-16.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-16.rq new file mode 100644 index 00000000000..631106d40a0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-16.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: '001'^^ }"^^cdt:Map AS ?map1 ) + BIND( "{1: '01'^^ }"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-17.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-17.rq new file mode 100644 index 00000000000..24abc60d57c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-17.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'2'^^ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'^^ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-18.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-18.rq new file mode 100644 index 00000000000..c52fbf82b64 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-18.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'2'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-19.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-19.rq new file mode 100644 index 00000000000..b128fa94ebd --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-19.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{'1'@sv : 41}"^^cdt:Map AS ?map1 ) + BIND( "{'1'@en : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-20.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-20.rq new file mode 100644 index 00000000000..99b50c6efa5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-20.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1 : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-21.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-21.rq new file mode 100644 index 00000000000..dd01d5ab876 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-21.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{ : 41}"^^cdt:Map AS ?map1 ) + BIND( "{ : 41}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = false ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-01.rq new file mode 100644 index 00000000000..dbbf16c856a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-01.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared based on < +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: }"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-02.rq new file mode 100644 index 00000000000..6aa34c7b153 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-error-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +# IRIs as map values cannot be compared to literals +ASK { + BIND( "{1: }"^^cdt:Map AS ?map1 ) + BIND( "{1: 42}"^^cdt:Map AS ?map2 ) + BIND( (?map1 < ?map2 ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-01.rq new file mode 100644 index 00000000000..8abe6f4f14a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map < "{1:42}"^^cdt:Map ) AS ?result ) + FILTER( ! BOUND(?result) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-02.rq new file mode 100644 index 00000000000..9733a4ee702 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:42, 2:null}"^^cdt:Map < "{1:43, 2:42}"^^cdt:Map ) AS ?result ) + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-03.rq new file mode 100644 index 00000000000..a085d4c5d3d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map <= "{1:null}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-04.rq new file mode 100644 index 00000000000..d9a3a57b18f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/map-less-than-null-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( ( "{1:null}"^^cdt:Map <= "{1:null, 2:42}"^^cdt:Map ) AS ?result ) + + FILTER( BOUND(?result) ) + FILTER( ?result = true ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-01.rq new file mode 100644 index 00000000000..eed6a712ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-01.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{}"^^cdt:Map AS ?map1 ) + BIND( "{}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-02.rq new file mode 100644 index 00000000000..75057208ede --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-02.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one'}"^^cdt:Map AS ?map1 ) + BIND( "{}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-03.rq new file mode 100644 index 00000000000..d91a4b5101b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-03.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{}"^^cdt:Map AS ?map1 ) + BIND( "{1: 'one'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-04.rq new file mode 100644 index 00000000000..f626e35edad --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-04.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one'}"^^cdt:Map AS ?map1 ) + BIND( "{2: 'two'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one', 2: 'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-05.rq new file mode 100644 index 00000000000..fa12ec8e689 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-05.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one', 2: 'two'}"^^cdt:Map AS ?map1 ) + BIND( "{1: 'another one', 3: 'three'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one', 2: 'two', 3: 'three'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-06.rq new file mode 100644 index 00000000000..82142c1bc10 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-06.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one', 2: 'two'}"^^cdt:Map AS ?map1 ) + BIND( "{'01'^^: 'another one', 3: 'three'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one', '01'^^: 'another one', 2: 'two', 3: 'three'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-07.rq new file mode 100644 index 00000000000..2ee2f6efed4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-07.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{: 'one', 2: 'two'}"^^cdt:Map AS ?map1 ) + BIND( "{'hello'@en: }"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{: 'one', 2: 'two', 'hello'@en: }"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-08.rq new file mode 100644 index 00000000000..72326fcc44c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-08.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{: 'one', 'hello': 42}"^^cdt:Map AS ?map1 ) + BIND( "{: 'ONE', 'hello'@en: }"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{: 'one', 'hello': 42, 'hello'@en: }"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-01.rq new file mode 100644 index 00000000000..7118071d1f5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-01.rq @@ -0,0 +1,18 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: null, 2: 'two'}"^^cdt:Map AS ?map1 ) + BIND( "{3: 'three'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( cdt:size(?merged) = 3 ) + + FILTER( cdt:containsKey(?merged,1) ) + BIND( cdt:get(?merged,1) AS ?x ) + FILTER( ! BOUND(?x) ) + + FILTER( cdt:get(?merged,2) = "two" ) + + FILTER( cdt:get(?merged,3) = "three" ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-02.rq new file mode 100644 index 00000000000..5f730a2cf33 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-02.rq @@ -0,0 +1,18 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one', 2: 'two'}"^^cdt:Map AS ?map1 ) + BIND( "{3: null}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( cdt:size(?merged) = 3 ) + + FILTER( cdt:containsKey(?merged,3) ) + BIND( cdt:get(?merged,3) AS ?x ) + FILTER( ! BOUND(?x) ) + + FILTER( cdt:get(?merged,1) = "one" ) + + FILTER( cdt:get(?merged,2) = "two" ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-03.rq new file mode 100644 index 00000000000..fbc08e9e538 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-03.rq @@ -0,0 +1,14 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: null}"^^cdt:Map AS ?map1 ) + BIND( "{1: 'one'}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( cdt:size(?merged) = 1 ) + + FILTER( cdt:containsKey(?merged,1) ) + BIND( cdt:get(?merged,1) AS ?x ) + FILTER( ! BOUND(?x) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-04.rq new file mode 100644 index 00000000000..7f603d410e1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/merge-null-04.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1: 'one'}"^^cdt:Map AS ?map1 ) + BIND( "{1: null}"^^cdt:Map AS ?map2 ) + BIND( cdt:merge(?map1, ?map2) AS ?merged ) + + FILTER( ?merged = "{1: 'one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-01.rq new file mode 100644 index 00000000000..ea78bc11e12 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-01.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, "one") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-02.rq new file mode 100644 index 00000000000..4e5abd50335 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-02.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, ?unbound) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 1 ) + FILTER( cdt:containsKey(?mapOut,1) ) + BIND( cdt:get(?mapOut,1) AS ?value ) + FILTER( ! BOUND(?value) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-03.rq new file mode 100644 index 00000000000..f31aa232147 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-03.rq @@ -0,0 +1,12 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 1 ) + FILTER( cdt:containsKey(?mapOut,1) ) + BIND( cdt:get(?mapOut,1) AS ?value ) + FILTER( ! BOUND(?value) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-04.rq new file mode 100644 index 00000000000..89e32f3746b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, "one") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = ?mapIn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-05.rq new file mode 100644 index 00000000000..49508c4bd23 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-05.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, "alsoOne") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'alsoOne', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-06.rq new file mode 100644 index 00000000000..7b719b1dff6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-06.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:null, 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, "one") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-07.rq new file mode 100644 index 00000000000..30beb3727c1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-07.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1, ?unbound) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 2 ) + + FILTER( cdt:containsKey(?mapOut,1) ) + BIND( cdt:get(?mapOut,1) AS ?v1 ) + FILTER( ! BOUND(?v1) ) + + FILTER( cdt:get(?mapOut,2) = "two" ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-08.rq new file mode 100644 index 00000000000..47aa279eeea --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-08.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 1) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 2 ) + + FILTER( cdt:containsKey(?mapOut,1) ) + BIND( cdt:get(?mapOut,1) AS ?v1 ) + FILTER( ! BOUND(?v1) ) + + FILTER( cdt:get(?mapOut,2) = "two" ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-09.rq new file mode 100644 index 00000000000..d4cff7a46ad --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-09.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 2, "two") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-10.rq new file mode 100644 index 00000000000..2db72225104 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-10.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 2, ?unbound) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 2 ) + + FILTER( cdt:get(?mapOut,1) = "one" ) + + FILTER( cdt:containsKey(?mapOut,2) ) + BIND( cdt:get(?mapOut,2) AS ?v2 ) + FILTER( ! BOUND(?v2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-11.rq new file mode 100644 index 00000000000..073fd9a1aab --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-11.rq @@ -0,0 +1,15 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 2) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( cdt:size(?mapOut) = 2 ) + + FILTER( cdt:get(?mapOut,1) = "one" ) + + FILTER( cdt:containsKey(?mapOut,2) ) + BIND( cdt:get(?mapOut,2) AS ?v2 ) + FILTER( ! BOUND(?v2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-12.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-12.rq new file mode 100644 index 00000000000..727c746486c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-12.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, "01"^^xsd:integer, "alsoOne") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one', '01'^^:'alsoOne', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-13.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-13.rq new file mode 100644 index 00000000000..d956701e9fc --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-13.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{'hello'@en:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 'hello'@en, "alsoOne") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{'hello'@en:'alsoOne', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-14.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-14.rq new file mode 100644 index 00000000000..fd61141bd3c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-14.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{'hello'@en:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, 'hello', "alsoOne") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{'hello'@en:'one', 'hello':'alsoOne', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-15.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-15.rq new file mode 100644 index 00000000000..1c2b041a378 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-15.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, , "alsoOne") AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{:'alsoOne', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-01.rq new file mode 100644 index 00000000000..24ae878b51d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-01.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +ASK { + BIND( "{}" AS ?mapIn ) # not a cdt:Map literal + BIND( cdt:put(?mapIn, 1, "one") AS ?mapOut ) + + FILTER( ! BOUND(?mapOut) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-02.rq new file mode 100644 index 00000000000..109eb2c4793 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-02.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +ASK { + BIND( "{ 1 }"^^cdt:Map AS ?mapIn ) # a cdt:Map literal that is not well-formed + BIND( cdt:put(?mapIn, 1, "one") AS ?mapOut ) + + FILTER( ! BOUND(?mapOut) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-03.rq new file mode 100644 index 00000000000..2e96f878aa2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-03.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, BNODE(), "one") AS ?mapOut ) # blank nodes are not valid as map keys + + FILTER( ! BOUND(?mapOut) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-04.rq new file mode 100644 index 00000000000..7aeba3904a9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-04.rq @@ -0,0 +1,8 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:put(?mapIn, ?unbound, "one") AS ?mapOut ) # unbound map key + + FILTER( ! BOUND(?mapOut) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-05.rq new file mode 100644 index 00000000000..b1df47e9555 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/put-error-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( cdt:put(?unbound, 1, "one") AS ?mapOut ) # unbound cdt:Map literal + + FILTER( ! BOUND(?mapOut) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-01.rq new file mode 100644 index 00000000000..3dee66fb970 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-01.rq @@ -0,0 +1,11 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one',2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, BNODE()) AS ?mapOut ) # special case because a bnode is not a map key + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( SAMETERM(?mapIn,?mapOut) ) # by definition of this special case, + # the input term must be returned + # (input and output must be the same term) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-02.rq new file mode 100644 index 00000000000..463f9981097 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-02.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 1) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-03.rq new file mode 100644 index 00000000000..3684db8f60b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 1) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-04.rq new file mode 100644 index 00000000000..f42963eab23 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND( "{1:'one',2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 1) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-05.rq new file mode 100644 index 00000000000..74c653ce559 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-05.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1:'one', '02'^^:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, '02'^^xsd:integer) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-06.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-06.rq new file mode 100644 index 00000000000..80547e21329 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-06.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1:'one', '02'^^:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, '2'^^xsd:integer) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = ?mapIn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-07.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-07.rq new file mode 100644 index 00000000000..2fded4f5b69 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-07.rq @@ -0,0 +1,10 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + BIND( "{1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, '02'^^xsd:integer) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = ?mapIn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-08.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-08.rq new file mode 100644 index 00000000000..43afdcf7460 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-08.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND("{'hello'@en:'there'@en, 1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 'hello'@en) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-09.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-09.rq new file mode 100644 index 00000000000..b652047ea39 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-09.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND("{'hello'@en:'there'@en, 1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 'hello') AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = ?mapIn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-10.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-10.rq new file mode 100644 index 00000000000..c0047b98139 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-10.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND("{'hello':'there', 1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, 'hello'@en) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = ?mapIn ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/remove-11.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-11.rq new file mode 100644 index 00000000000..677a8f2ffe3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/remove-11.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND("{:'there'@en, 1:'one', 2:'two'}"^^cdt:Map AS ?mapIn ) + BIND( cdt:remove(?mapIn, ) AS ?mapOut ) + + FILTER( BOUND(?mapOut) ) # check that there was no error + FILTER( ?mapOut = "{1:'one', 2:'two'}"^^cdt:Map ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-01.rq new file mode 100644 index 00000000000..c9cdc16d575 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("{}"^^cdt:Map, "{}"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-02.rq new file mode 100644 index 00000000000..2afd488839f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("{1: 1}"^^cdt:Map, "{1: 1}"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-03.rq new file mode 100644 index 00000000000..096c9202fca --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(! SAMETERM("{1: 2}"^^cdt:Map, "{1: '2'^^}"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-04.rq new file mode 100644 index 00000000000..4c6e9c584e3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(! SAMETERM("{ 1: 1 }"^^cdt:Map, "{1:1}"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-05.rq new file mode 100644 index 00000000000..5f9c2143e40 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("{ 1: _:a }"^^cdt:Map, "{ 1: _:a }"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-null-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-null-01.rq new file mode 100644 index 00000000000..d929a63b2b1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/sameterm-null-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + FILTER(SAMETERM("{1:null}"^^cdt:Map, "{1:null}"^^cdt:Map)) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/size-01.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/size-01.rq new file mode 100644 index 00000000000..b71c7cba36f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/size-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# empty map +ASK { + BIND("{}"^^cdt:Map AS ?map) + FILTER(cdt:size(?map) = 0) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/size-02.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/size-02.rq new file mode 100644 index 00000000000..41818080b61 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/size-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# 1-entry map +ASK { + BIND("{1: 'one'}"^^cdt:Map AS ?map) + FILTER(cdt:size(?map) = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/size-03.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/size-03.rq new file mode 100644 index 00000000000..84f06e2b2c8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/size-03.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# 2-entry map +ASK { + BIND("{1: 'one', 2: 'two'}"^^cdt:Map AS ?map) + FILTER(cdt:size(?map) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/size-04.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/size-04.rq new file mode 100644 index 00000000000..f78148e0d76 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/size-04.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# 2-entry map, mixed types +ASK { + BIND("{1: 'one', 'hello'@en: 2.5}"^^cdt:Map AS ?map) + FILTER(cdt:size(?map) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/size-05.rq b/jena-arq/testing/SPARQL-CDTs/map-functions/size-05.rq new file mode 100644 index 00000000000..d6a8faa0347 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/size-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +# 2-entry map, including null value +ASK { + BIND("{1: 'one', 2: null}"^^cdt:Map AS ?map) + FILTER(cdt:size(?map) = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/map-functions/true.srx b/jena-arq/testing/SPARQL-CDTs/map-functions/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/map-functions/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/empty.ttl b/jena-arq/testing/SPARQL-CDTs/orderby/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/orderby/manifest.ttl new file mode 100644 index 00000000000..8b2b9b3bf09 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/manifest.ttl @@ -0,0 +1,291 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "ORDER BY for cdt:List and cdt:Map literals" ; + mf:entries + ( + :order-list-03 + :order-list-04 + :order-list-05 + :order-list-06 + :order-list-07 + :order-list-08 + :order-list-09 + :order-list-10 + + :order-list-null-01 + :order-list-null-02 + + :order-map-03 + :order-map-03 + :order-map-04 + :order-map-05 + :order-map-06 + :order-map-07 + :order-map-08 + :order-map-09 + :order-map-10 + :order-map-11 + :order-map-12 + :order-map-13 + :order-map-14 + :order-map-15 + :order-map-16 + :order-map-17 + + :order-map-null-01 + :order-map-null-02 + ) . + +:order-list-03 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-04 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-05 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-06 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-07 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-08 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-09 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-10 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + + +:order-list-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-list-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "order-list-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + + +:order-map-03 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-03" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-04 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-04" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-05 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-05" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-06 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-06" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-07 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-07" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-08 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-08" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-09 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-09" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-10 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-10" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-11 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-11" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-12 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-12" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-13 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-13" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-14 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-14" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-15 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-15" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-16 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-16" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-17 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-17" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + + +:order-map-null-01 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-null-01" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:order-map-null-02 rdf:type mf:QueryEvaluationTest ; + mf:name "order-map-null-02" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-03.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-03.rq new file mode 100644 index 00000000000..689416cfc51 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-03.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[1]"^^cdt:List) + (2 "[ 2]"^^cdt:List) # the space is on purpose, to make sure the comparison is not done in terms of the lexical forms + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-04.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-04.rq new file mode 100644 index 00000000000..4e67eaf17f4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-04.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "['01'^^]"^^cdt:List) + (2 "['001'^^]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER ( (?id = 1) || (?id = 2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-05.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-05.rq new file mode 100644 index 00000000000..85918ac433c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-05.rq @@ -0,0 +1,18 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[1]"^^cdt:List) + (2 "[ ]"^^cdt:List) + (3 "[ 2]"^^cdt:List) # the spaces are on purpose, to make sure the comparison is not done in terms of the lexical forms + (4 "[ ]"^^cdt:List) + (5 "[3]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER ( (?id = 2) || (?id = 4) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-06.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-06.rq new file mode 100644 index 00000000000..5782ad842f6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-06.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[ 1, 1]"^^cdt:List) # the leading space is on purpose, to make sure the comparison is not done in terms of the lexical forms + (2 "[1]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-07.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-07.rq new file mode 100644 index 00000000000..cbdf9e32700 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-07.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[1, 1]"^^cdt:List) + (2 "[2]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-08.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-08.rq new file mode 100644 index 00000000000..129cf1c96bb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-08.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[2, 1]"^^cdt:List) + (2 "[2, 2]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-09.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-09.rq new file mode 100644 index 00000000000..1754162fd2b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-09.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[, 1]"^^cdt:List) + (2 "[, 2]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-10.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-10.rq new file mode 100644 index 00000000000..755a43e616f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-10.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[, ]"^^cdt:List) + (2 "[, ]"^^cdt:List) + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-01.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-01.rq new file mode 100644 index 00000000000..d087a21fd1a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-01.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[null, 1]"^^cdt:List) + (2 "[null, 2]"^^cdt:List) # the added space is on purpose, to make sure the comparison is not done in terms of the lexical forms + } + } + ORDER BY ?list LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-02.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-02.rq new file mode 100644 index 00000000000..d3b601b0acd --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-list-null-02.rq @@ -0,0 +1,16 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?list) { + (1 "[ null , 1]"^^cdt:List) + (2 "[ 'hello', 2]"^^cdt:List) + (3 "[null , 3]"^^cdt:List) + } + } + ORDER BY DESC(?list) LIMIT 1 # attention, DESC here to check that the non-null element ordered highest + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-03.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-03.rq new file mode 100644 index 00000000000..985acd8c359 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-03.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1: 42}"^^cdt:Map) + (2 "{ 2: 42}"^^cdt:Map) # the space is on purpose, to make sure the comparison is not done in terms of the lexical forms + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-04.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-04.rq new file mode 100644 index 00000000000..b2b1c777590 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-04.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ '01'^^: 42 }"^^cdt:Map) + (2 "{ '001'^^: 42 }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-05.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-05.rq new file mode 100644 index 00000000000..87f1c02a479 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-05.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ '1'^^: 42 }"^^cdt:Map) # note, different datatype + (2 "{ '2'^^: 42 }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-06.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-06.rq new file mode 100644 index 00000000000..77b73acd231 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-06.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ : 42 }"^^cdt:Map) + (2 "{ '2'^^: 42}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-07.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-07.rq new file mode 100644 index 00000000000..6687b346ec9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-07.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ : 42 }"^^cdt:Map) + (2 "{ : 42 }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-08.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-08.rq new file mode 100644 index 00000000000..75d67c869bb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-08.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1: 42}"^^cdt:Map) + (2 "{ 1: 43}"^^cdt:Map) # the space is on purpose, to make sure the comparison is not done in terms of the lexical forms + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-09.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-09.rq new file mode 100644 index 00000000000..5556e1735a5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-09.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1: '01'^^ }"^^cdt:Map) + (2 "{ 1: '001'^^ }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER ( (?id = 1) || (?id = 2) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-10.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-10.rq new file mode 100644 index 00000000000..50c7412925e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-10.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1: 1 }"^^cdt:Map) + (2 "{ 1: }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-11.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-11.rq new file mode 100644 index 00000000000..97290bb324e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-11.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1: }"^^cdt:Map) + (2 "{ 1: }"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-12.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-12.rq new file mode 100644 index 00000000000..4e6b3685b83 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-12.rq @@ -0,0 +1,18 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1:42}"^^cdt:Map) + (2 "{ }"^^cdt:Map) + (3 "{ 2:42}"^^cdt:Map) # the spaces are on purpose, to make sure the comparison is not done in terms of the lexical forms + (4 "{ }"^^cdt:Map) + (5 "{3:42}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER ( (?id = 2) || (?id = 4) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-13.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-13.rq new file mode 100644 index 00000000000..9386a467b2b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-13.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1: 42, 3: 42}"^^cdt:Map) + (2 "{1: 42}"^^cdt:Map) # the space is on purpose, to make sure the comparison is not done in terms of the lexical forms + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-14.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-14.rq new file mode 100644 index 00000000000..b297601ce79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-14.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1: 42, 3: 42}"^^cdt:Map) + (2 "{2: 42}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-15.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-15.rq new file mode 100644 index 00000000000..7a7caccfcc8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-15.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1: 42, 3: 42}"^^cdt:Map) + (2 "{1: 43}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 1) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-16.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-16.rq new file mode 100644 index 00000000000..8815fc04996 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-16.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{1: 42, 3: 42}"^^cdt:Map) + (2 "{1: 42, 2: 42}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-17.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-17.rq new file mode 100644 index 00000000000..18fa2bdebbb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-17.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{3: 41, 1: 42, 2: 43}"^^cdt:Map) + (2 "{3: 42, 1: 42, 2: 42}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-01.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-01.rq new file mode 100644 index 00000000000..d1cadd64d79 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-01.rq @@ -0,0 +1,15 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1:null, 2:42}"^^cdt:Map) # the added space is on purpose, to make sure the comparison is not done in terms of the lexical forms + (2 "{1:null, 2:41}"^^cdt:Map) + } + } + ORDER BY ?map LIMIT 1 + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-02.rq b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-02.rq new file mode 100644 index 00000000000..0d4d90dbd1d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/order-map-null-02.rq @@ -0,0 +1,16 @@ +PREFIX cdt: +PREFIX xsd: + +ASK { + { + SELECT * WHERE { + VALUES (?id ?map) { + (1 "{ 1:null, 2:41}"^^cdt:Map) + (2 "{ 1:'hello', 2:42}"^^cdt:Map) + (3 "{ 1:null, 2:43}"^^cdt:Map) + } + } + ORDER BY DESC(?map) LIMIT 1 # attention, DESC here to check that the non-null element ordered highest + } + FILTER (?id = 2) +} diff --git a/jena-arq/testing/SPARQL-CDTs/orderby/true.srx b/jena-arq/testing/SPARQL-CDTs/orderby/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/orderby/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/empty.ttl b/jena-arq/testing/SPARQL-CDTs/unfold/empty.ttl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/manifest.ttl b/jena-arq/testing/SPARQL-CDTs/unfold/manifest.ttl new file mode 100644 index 00000000000..a829a67e6f3 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/manifest.ttl @@ -0,0 +1,483 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . +@prefix sparql: . +@prefix cdt: . + +<> rdf:type mf:Manifest ; + rdfs:label "SPARQL UNFOLD operator" ; + mf:entries + ( + :unfold-list-1var-01 + :unfold-list-1var-02 + :unfold-list-1var-03 + :unfold-list-1var-04 + :unfold-list-1var-05 + :unfold-list-1var-06 + :unfold-list-1var-07 + :unfold-list-1var-08 + :unfold-list-1var-09 + :unfold-list-1var-10 + + :unfold-get-list-1var-01 + :unfold-get-list-1var-02 + :unfold-get-list-1var-03 + :unfold-get-list-1var-04 + + :unfold-list-2vars-01 + :unfold-list-2vars-02 + :unfold-list-2vars-03 + :unfold-list-2vars-04 + :unfold-list-2vars-05 + :unfold-list-2vars-06 + :unfold-list-2vars-07 + :unfold-list-2vars-08 + :unfold-list-2vars-09 + :unfold-list-2vars-10 + + :unfold-get-list-2vars-01 + :unfold-get-list-2vars-02 + :unfold-get-list-2vars-03 + :unfold-get-list-2vars-04 + :unfold-get-list-2vars-05 + :unfold-get-list-2vars-06 + + :unfold-map-1var-01 + :unfold-map-1var-02 + :unfold-map-1var-03 + :unfold-map-1var-04 + + :unfold-map-2vars-01 + :unfold-map-2vars-02 + :unfold-map-2vars-03 + :unfold-map-2vars-04 + :unfold-map-2vars-05 + :unfold-map-2vars-06 + :unfold-map-2vars-07 + :unfold-map-2vars-08 + ) . + +:unfold-list-1var-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-01" ; + rdfs:comment "two list elements" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-02" ; + rdfs:comment "three list elements, including a duplicate" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-03" ; + rdfs:comment "two list elements, mixed datatypes" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-04" ; + rdfs:comment "two list elements, IRIs" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-05 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-05" ; + rdfs:comment "two list elements, IRI and literal" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-06 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-06" ; + rdfs:comment "two list elements, IRI and blank node" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-07 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-07" ; + rdfs:comment "three list elements, IRI and two distinct blank nodes" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-08 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-08" ; + rdfs:comment "three list elements, IRI and the same blank node twice" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-09 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-09" ; + rdfs:comment "two list elements, IRI and null value" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-1var-10 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-1var-10" ; + rdfs:comment "three list elements, IRI and two null values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + + +:unfold-get-list-1var-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-1var-01" ; + rdfs:comment "list literal with one blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-1var-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-1var-02" ; + rdfs:comment "list literal with the same blank node twice" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-1var-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-1var-03" ; + rdfs:comment "construct list with one blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-1var-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-1var-04" ; + rdfs:comment "construct list with the same blank node twice" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + + +:unfold-list-2vars-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-01" ; + rdfs:comment "two list elements" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-02" ; + rdfs:comment "three list elements, including a duplicate" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-03" ; + rdfs:comment "two list elements, mixed datatypes" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-04" ; + rdfs:comment "two list elements, IRIs" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-05 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-05" ; + rdfs:comment "two list elements, IRI and literal" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-06 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-06" ; + rdfs:comment "two list elements, IRI and blank node" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-07 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-07" ; + rdfs:comment "three list elements, IRI and two distinct blank nodes" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-08 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-08" ; + rdfs:comment "three list elements, IRI and the same blank node twice" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-09 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-09" ; + rdfs:comment "two list elements, IRI and null value" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-list-2vars-10 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-list-2vars-10" ; + rdfs:comment "three list elements, IRI and two null values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + + +:unfold-get-list-2vars-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-01" ; + rdfs:comment "list literal with one blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-2vars-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-02" ; + rdfs:comment "list literal with the same blank node twice" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-2vars-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-03" ; + rdfs:comment "construct list with one blank node" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-2vars-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-04" ; + rdfs:comment "construct list with the same blank node twice" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-2vars-05 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-05" ; + rdfs:comment "list literal with the two blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-get-list-2vars-06 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-get-list-2vars-06" ; + rdfs:comment "construct list with the two blank nodes" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + + +:unfold-map-1var-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-1var-01" ; + rdfs:comment "two entries, integer keys" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-1var-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-1var-02" ; + rdfs:comment "two entries, mixed literal keys" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-1var-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-1var-03" ; + rdfs:comment "two entries, IRI keys" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-1var-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-1var-04" ; + rdfs:comment "two entries, IRI and literal key" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + + +:unfold-map-2vars-01 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-01" ; + rdfs:comment "two entries, different values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-02 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-02" ; + rdfs:comment "two entries, same values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-03 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-03" ; + rdfs:comment "two entries, mixed types" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-04 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-04" ; + rdfs:comment "two entries, IRI keys" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-05 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-05" ; + rdfs:comment "two entries, IRI values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-06 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-06" ; + rdfs:comment "two entries, distinct blank nodes as values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-07 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-07" ; + rdfs:comment "two entries, same blank node as values" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + +:unfold-map-2vars-08 rdf:type mf:QueryEvaluationTest ; + mf:name "unfold-map-2vars-08" ; + rdfs:comment "two entries, one with a null value as value" ; + mf:feature cdt:unfold ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result . + + diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/true.srx b/jena-arq/testing/SPARQL-CDTs/unfold/true.srx new file mode 100644 index 00000000000..c187f066ab1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/true.srx @@ -0,0 +1,5 @@ + + + + true + diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-01.rq new file mode 100644 index 00000000000..e344e5588eb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( "[_:b]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-02.rq new file mode 100644 index 00000000000..2f13d6827a5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( "[_:b, _:b]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-03.rq new file mode 100644 index 00000000000..214fb1b5c59 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND ( BNODE() AS ?b ) + BIND( cdt:List(?b) AS ?list ) + + UNFOLD( ?list AS ?elmt ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-04.rq new file mode 100644 index 00000000000..5dfa74d793c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-1var-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND ( BNODE() AS ?b ) + BIND( cdt:List(?b, ?b) AS ?list ) + + UNFOLD( ?list AS ?elmt ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-01.rq new file mode 100644 index 00000000000..691b07209b8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-01.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( "[_:b]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-02.rq new file mode 100644 index 00000000000..69b8cd3d82e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-02.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( "[_:b, _:b]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-03.rq new file mode 100644 index 00000000000..19cb28e874c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-03.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND ( BNODE() AS ?b ) + BIND( cdt:List(?b) AS ?list ) + + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-04.rq new file mode 100644 index 00000000000..7aa08d91276 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-04.rq @@ -0,0 +1,9 @@ +PREFIX cdt: + +ASK { + BIND ( BNODE() AS ?b ) + BIND( cdt:List(?b, ?b) AS ?list ) + + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,1)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-05.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-05.rq new file mode 100644 index 00000000000..90dc68d5f1d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-05.rq @@ -0,0 +1,7 @@ +PREFIX cdt: + +ASK { + BIND( "[_:b1, _:b2]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,?idx)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-06.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-06.rq new file mode 100644 index 00000000000..8da24a458f6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-get-list-2vars-06.rq @@ -0,0 +1,10 @@ +PREFIX cdt: + +ASK { + BIND ( BNODE() AS ?b1 ) + BIND ( BNODE() AS ?b2 ) + BIND( cdt:List(?b1, ?b2) AS ?list ) + + UNFOLD( ?list AS ?elmt, ?idx ) + FILTER( SAMETERM(?elmt, cdt:get(?list,?idx)) ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.rq new file mode 100644 index 00000000000..ecb6d874d73 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[1,2]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.srj new file mode 100644 index 00000000000..3f575ceece9 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-01.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.rq new file mode 100644 index 00000000000..71186ea1778 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[1,1,2]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.srj new file mode 100644 index 00000000000..68ae874d37c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-02.srj @@ -0,0 +1,17 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.rq new file mode 100644 index 00000000000..1c0dbfae629 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[true,1]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.srj new file mode 100644 index 00000000000..ab85d1f1b68 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-03.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.rq new file mode 100644 index 00000000000..b3316a4fd7b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, ]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.srj new file mode 100644 index 00000000000..2c8585a9a7b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-04.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + "elmt": { "type": "uri" , "value": "http://example/2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.rq new file mode 100644 index 00000000000..7e9df68d0f8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, 1]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.srj new file mode 100644 index 00000000000..e5acb97435e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-05.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.rq new file mode 100644 index 00000000000..7135d89f768 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, _:x]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.srj new file mode 100644 index 00000000000..9c313fe0e7e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-06.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.rq new file mode 100644 index 00000000000..e13150d108a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, _:x, _:y]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.srj new file mode 100644 index 00000000000..f9a5b2ce744 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-07.srj @@ -0,0 +1,17 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" } + }, + { + "elmt": { "type": "bnode" , "value": "b1" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.rq new file mode 100644 index 00000000000..ebf055b9927 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, _:x, _:x]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.srj new file mode 100644 index 00000000000..83fd0dafd1d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-08.srj @@ -0,0 +1,17 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.rq new file mode 100644 index 00000000000..7fef59f648b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, null]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.srj new file mode 100644 index 00000000000..19199bc0eb2 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-09.srj @@ -0,0 +1,13 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.rq new file mode 100644 index 00000000000..692f520caa8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt WHERE { + BIND( "[, null, null]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.srj new file mode 100644 index 00000000000..2cd1d2cbad6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-1var-10.srj @@ -0,0 +1,15 @@ +{ "head": { + "vars": [ "elmt" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" } + }, + { + }, + { + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.rq new file mode 100644 index 00000000000..65854604678 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[1,2]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.srj new file mode 100644 index 00000000000..d72c9080627 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-01.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.rq new file mode 100644 index 00000000000..0c332c4825c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[1,1,2]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.srj new file mode 100644 index 00000000000..9c161ea7a6a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-02.srj @@ -0,0 +1,20 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.rq new file mode 100644 index 00000000000..5c0a76f1f1a --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[true,1]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.srj new file mode 100644 index 00000000000..7e3b9f7a898 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-03.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.rq new file mode 100644 index 00000000000..2538eb4660e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, ]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.srj new file mode 100644 index 00000000000..426591f50e0 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-04.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "uri" , "value": "http://example/2" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.rq new file mode 100644 index 00000000000..c9fe7cf165f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, 1]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.srj new file mode 100644 index 00000000000..0b3ff6f7685 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-05.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.rq new file mode 100644 index 00000000000..69596252c45 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, _:x]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.srj new file mode 100644 index 00000000000..45f10b33e9b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-06.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.rq new file mode 100644 index 00000000000..ccb4c466a70 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, _:x, _:y]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.srj new file mode 100644 index 00000000000..db239ce3fcb --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-07.srj @@ -0,0 +1,20 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + }, + { + "elmt": { "type": "bnode" , "value": "b1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.rq new file mode 100644 index 00000000000..5a1848d8cb1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, _:x, _:x]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.srj new file mode 100644 index 00000000000..62969f04296 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-08.srj @@ -0,0 +1,20 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + }, + { + "elmt": { "type": "bnode" , "value": "b0" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.rq new file mode 100644 index 00000000000..689a8009005 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, null]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.srj new file mode 100644 index 00000000000..d843e62a326 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-09.srj @@ -0,0 +1,15 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.rq new file mode 100644 index 00000000000..006e8a8d15d --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?elmt ?idx WHERE { + BIND( "[, null, null]"^^cdt:List AS ?list ) + UNFOLD( ?list AS ?elmt, ?idx ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.srj new file mode 100644 index 00000000000..7d7941e175c --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-list-2vars-10.srj @@ -0,0 +1,18 @@ +{ "head": { + "vars": [ "elmt", "idx" ] + } , + "results": { + "bindings": [ + { + "elmt": { "type": "uri" , "value": "http://example/1" }, + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + }, + { + "idx": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.rq new file mode 100644 index 00000000000..62435a71ca6 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k WHERE { + BIND( "{1:3, 2:4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.srj new file mode 100644 index 00000000000..ca6992e1b9e --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-01.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "k" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.rq new file mode 100644 index 00000000000..0a05a795e09 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k WHERE { + BIND( "{1:3, true:4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.srj new file mode 100644 index 00000000000..30993975398 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-02.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "k" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.rq new file mode 100644 index 00000000000..316dacb8ee1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k WHERE { + BIND( "{:3, :4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.srj new file mode 100644 index 00000000000..d0f057a71b5 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-03.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "k" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "uri" , "value": "http://example/1" } + }, + { + "k": { "type": "uri" , "value": "http://example/2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.rq new file mode 100644 index 00000000000..0fa9e06eb52 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k WHERE { + BIND( "{:3, 1:4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.srj new file mode 100644 index 00000000000..c1e2148864f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-1var-04.srj @@ -0,0 +1,14 @@ +{ "head": { + "vars": [ "k" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "uri" , "value": "http://example/1" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.rq new file mode 100644 index 00000000000..52238c08b23 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1:3, 2:4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.srj new file mode 100644 index 00000000000..5e621c74115 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-01.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "4" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.rq new file mode 100644 index 00000000000..dde67501e54 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1:3, 2:3}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.srj new file mode 100644 index 00000000000..31971149626 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-02.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.rq new file mode 100644 index 00000000000..b110c129001 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1:false, true:3}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.srj new file mode 100644 index 00000000000..4e3d16ee7e8 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-03.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.rq new file mode 100644 index 00000000000..8758a55ff08 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{:3, :4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.srj new file mode 100644 index 00000000000..6c160ec8bb4 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-04.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "uri" , "value": "http://example/1" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "3" } + }, + { + "k": { "type": "uri" , "value": "http://example/2" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "4" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.rq new file mode 100644 index 00000000000..76eccfbf022 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1:, 2:}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.srj new file mode 100644 index 00000000000..5ae65bb3595 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-05.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "uri" , "value": "http://example/1" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "uri" , "value": "http://example/2" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.rq new file mode 100644 index 00000000000..dcf0c864661 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1: _:x, 2: _:y}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.srj new file mode 100644 index 00000000000..7adf07e3132 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-06.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "bnode" , "value": "b0" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "bnode" , "value": "b1" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.rq new file mode 100644 index 00000000000..42c4c0d6b59 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1: _:x, 2: _:x}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.srj new file mode 100644 index 00000000000..74c4b0e33d1 --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-07.srj @@ -0,0 +1,16 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" }, + "v": { "type": "bnode" , "value": "b0" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "bnode" , "value": "b0" } + } + ] + } +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.rq b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.rq new file mode 100644 index 00000000000..c1a3172d47f --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.rq @@ -0,0 +1,6 @@ +PREFIX cdt: + +SELECT ?k ?v WHERE { + BIND( "{1:null, 2:4}"^^cdt:Map AS ?map ) + UNFOLD( ?map AS ?k, ?v ) +} diff --git a/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.srj b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.srj new file mode 100644 index 00000000000..e27adcb859b --- /dev/null +++ b/jena-arq/testing/SPARQL-CDTs/unfold/unfold-map-2vars-08.srj @@ -0,0 +1,15 @@ +{ "head": { + "vars": [ "k", "v" ] + } , + "results": { + "bindings": [ + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "1" } + }, + { + "k": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "2" }, + "v": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "value": "4" } + } + ] + } +} From 9cb08f1f4529c170680d5235c35ac8bf442f498e Mon Sep 17 00:00:00 2001 From: Olaf Hartig Date: Fri, 5 Jul 2024 11:39:03 +0200 Subject: [PATCH 323/323] CDT literals must be create using both their lex.form and value; otherwise SAMETERM is wrong --- .../riot/system/CDTAwareParserProfile.java | 33 +++++++++++++++++-- .../apache/jena/graph/impl/LiteralLabel.java | 22 +++++++++++++ .../jena/graph/impl/LiteralLabelFactory.java | 15 +++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java index 802362236c2..660b0c25807 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/CDTAwareParserProfile.java @@ -30,6 +30,8 @@ import org.apache.jena.datatypes.RDFDatatype; import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; +import org.apache.jena.graph.impl.LiteralLabel; +import org.apache.jena.graph.impl.LiteralLabelFactory; import org.apache.jena.irix.IRIxResolver; import org.apache.jena.sparql.util.Context; @@ -55,6 +57,14 @@ public CDTAwareParserProfile( final FactoryRDF factory, @Override public Node createTypedLiteral( final String lex, final RDFDatatype datatype, final long line, final long col ) { + // cdt:List and cdt:Map literals need to be treated in a special way + // because we need to construct their value by parsing them using this + // same parser profile; this is necessary to make sure that blank node + // identifiers inside the lexical forms of multiple of these literals + // within the same file are all mapped to the same blank node, and so + // are all blank node identifers that occur directly in the file (i.e., + // ourside of CDT literals). + if ( datatype.equals(CompositeDatatypeList.type) ) { return createListLiteral(lex); } @@ -72,6 +82,7 @@ protected Node createListLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. + // parse the given lexical form using this same parser profile final List value; try { value = ParserForCDTLiterals.parseListLiteral(this, lex); @@ -80,7 +91,21 @@ protected Node createListLiteral( final String lex ) { throw new DatatypeFormatException(lex, CompositeDatatypeList.type, ex); } - return NodeFactory.createLiteralByValue(value, CompositeDatatypeList.type); + // At this point we have both the lexical form (which, after the + // parsing, we now know is well formed) and the corresponding value + // of the literal. We create a LiteralLabel with both of them, for + // the following reasons. + // If we were to create the LiteralLabel with the lexical form only, + // then the LiteralLabel implementation would parse that lexical form + // again, which gives us an unnecessary performance penalty (in + // particular for huge lists). + // If we were to create the LiteralLabel with the value only, then the + // LiteralLabel implementation would reproduce the lexical form, which + // may not be identical to the lexical form with which we have created + // the value here. The issue with that is that a SAMETERM comparison + // would incorrectly return false. + final LiteralLabel ll = LiteralLabelFactory.createIncludingValue(lex, value, CompositeDatatypeList.type); + return NodeFactory.createLiteral(ll); } protected Node createMapLiteral( final String lex ) { @@ -89,6 +114,7 @@ protected Node createMapLiteral( final String lex ) { // a checkLiteral check because that would parse the lexical form of the // literal already once before doing the other parse to obtain the value. + // parse the given lexical form using this same parser profile final Map value; try { value = ParserForCDTLiterals.parseMapLiteral(this, lex); @@ -97,7 +123,10 @@ protected Node createMapLiteral( final String lex ) { throw new DatatypeFormatException(lex, CompositeDatatypeMap.type, ex); } - return NodeFactory.createLiteralByValue(value, CompositeDatatypeMap.type); + // We create a LiteralLabel with both the lexical form and the value, + // for the same reasons as described above in createListLiteral(). + final LiteralLabel ll = LiteralLabelFactory.createIncludingValue(lex, value, CompositeDatatypeMap.type); + return NodeFactory.createLiteral(ll); } } diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java index 06b5adb0ec7..809edfa21a2 100644 --- a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java +++ b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java @@ -177,6 +177,28 @@ private static String indexingLang(String lang) { hash = calcHashCode(); } + /** + * Create a typed literal for which both the lexical form and the value + * form are already available. This constructor does not attempt any + * validation of the given lexical form, nor any check that the given + * lexical form does indeed represent the given value. Use with care! + * + * @param lex the lexical form of the literal (assumed to be well-formed + * for the given datatype) + * @param value the value of the literal (assumed to be the value obtained + * when applying the lexical-to-value mapping of the the given + * datatype to the given lexical form) + * @param dtype the datatype of the literal + */ + /*package*/ LiteralLabel(String lex, Object value, RDFDatatype dtype) throws DatatypeFormatException { + this.dtype = Objects.requireNonNull(dtype); + this.lexicalForm = Objects.requireNonNull(lex); + this.value = Objects.requireNonNull(value); + this.lang = ""; + this.wellformed = true; + hash = calcHashCode(); + } + /** * Internal function to set the object value from the lexical form. * Requires datatype to be set. Return true if it succeeded else false. diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabelFactory.java b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabelFactory.java index ee5793f0591..8621c4c9ce3 100644 --- a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabelFactory.java +++ b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabelFactory.java @@ -108,6 +108,21 @@ public static LiteralLabel createByValue(Object value, RDFDatatype dtype) throws return new LiteralLabel(value, dtype); } + /** + * Create a typed literal for which both the lexical form and the value + * form are already available. Use with care! + * + * @param lex the lexical form of the literal (assumed to be well-formed + * for the given datatype) + * @param value the value of the literal (assumed to be the value obtained + * when applying the lexical-to-value mapping of the the given + * datatype to the given lexical form) + * @param dtype the datatype of the literal + */ + public static LiteralLabel createIncludingValue(String lex, Object value, RDFDatatype dtype) { + return new LiteralLabel(lex, value, dtype); + } + /** * Build a typed literal label from its value form using * whatever datatype is currently registered as the default