[ https://issues.apache.org/jira/browse/JENA-1523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16437595#comment-16437595 ]
ASF GitHub Bot commented on JENA-1523: -------------------------------------- GitHub user afs opened a pull request: https://github.com/apache/jena/pull/398 JENA-1523: Allow internal variables names in variable parsing. You can merge this pull request into a Git repository by running: $ git pull https://github.com/afs/jena var-databag Alternatively you can review and apply these changes as the patch at: https://github.com/apache/jena/pull/398.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #398 ---- commit 6a9ad3401cb3cf3326489adc2be4d89d2dc40b8e Author: Andy Seaborne <andy@...> Date: 2018-04-13T16:53:48Z JENA-1523: Allow internal variables names in variable parsing. ---- > "VARS requires a list of variables" exception w/spilling and renamed vars > ------------------------------------------------------------------------- > > Key: JENA-1523 > URL: https://issues.apache.org/jira/browse/JENA-1523 > Project: Apache Jena > Issue Type: Bug > Components: ARQ > Affects Versions: Jena 3.7.0 > Reporter: Shawn Smith > Priority: Major > > Spilling a {{DistinctDataBag}} or {{SortedDataBag}} when executing SPARQL > queries that are modified by {{TransformScopeRename}} can result in the > following: > {noformat} > org.apache.jena.riot.RiotException: [line: 1, col: 7 ] VARS requires a list > of variables (found '[SLASH]') > at > org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:147) > at org.apache.jena.riot.lang.LangEngine.raiseException(LangEngine.java:148) > at org.apache.jena.riot.lang.LangEngine.exceptionDirect(LangEngine.java:143) > at org.apache.jena.riot.lang.LangEngine.exception(LangEngine.java:137) > at > org.apache.jena.sparql.engine.binding.BindingInputStream.access$1900(BindingInputStream.java:64) > at > org.apache.jena.sparql.engine.binding.BindingInputStream$IteratorTuples.directiveVars(BindingInputStream.java:227) > at > org.apache.jena.sparql.engine.binding.BindingInputStream$IteratorTuples.directives(BindingInputStream.java:140) > at > org.apache.jena.sparql.engine.binding.BindingInputStream$IteratorTuples.<init>(BindingInputStream.java:129) > at > org.apache.jena.sparql.engine.binding.BindingInputStream.<init>(BindingInputStream.java:99) > at > org.apache.jena.sparql.engine.binding.BindingInputStream.<init>(BindingInputStream.java:78) > at > org.apache.jena.sparql.engine.binding.BindingInputStream.<init>(BindingInputStream.java:73) > at > org.apache.jena.riot.system.SerializationFactoryFinder$1.createDeserializer(SerializationFactoryFinder.java:56) > at > org.apache.jena.atlas.data.SortedDataBag.getInputIterator(SortedDataBag.java:190) > at org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:235) > at org.apache.jena.atlas.data.SortedDataBag.iterator(SortedDataBag.java:206) > at > org.apache.jena.atlas.data.DistinctDataBag.iterator(DistinctDataBag.java:94){noformat} > The problem is that renaming variables prepends a "/" so that, for example, > the first line of the spill file might look like the following which > {{BindingInputStream.directiveVars()}} can't parse: > {noformat} > VARS ?/.1 ?/.0 ?v_2 ?v_21 ?v_1 .{noformat} > Here's a test case that reproduces the exception: > {noformat} > @Test > public void testWithRenamedVars() { > ExprVar expr = (ExprVar) Rename.renameVars(new ExprVar("1"), > Collections.emptySet()); > BindingMap binding = BindingFactory.create(); > binding.add(expr.asVar(), NodeFactory.createLiteral("foo")); > SortedDataBag<Binding> dataBag = BagFactory.newSortedBag( > new ThresholdPolicyCount<>(0), > SerializationFactoryFinder.bindingSerializationFactory(), > new BindingComparator(new ArrayList<>())); > try { > dataBag.add(binding); > dataBag.flush(); > // Spill file looks like the following: > // VARS ?/1 . > // "foo" . > Binding actual = dataBag.iterator().next(); > assertEquals(binding, actual); > } finally { > dataBag.close(); > } > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)