[
https://issues.apache.org/jira/browse/JENA-1523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Advertising
Andy Seaborne resolved JENA-1523.
---------------------------------
Resolution: Fixed
Assignee: Andy Seaborne
Fix Version/s: Jena 3.8.0
> "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
> Assignee: Andy Seaborne
> Priority: Major
> Fix For: Jena 3.8.0
>
>
> 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)