Skip to content

Commit a26bb8d

Browse files
committed
Added improved lateral polyfill - supports concurrent + bulk requests.
1 parent 282ff3f commit a26bb8d

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

rdf-processing-toolkit-cli/src/main/java/org/aksw/sparql_integrate/cli/cmd/CmdSparqlIntegrateMain.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import org.aksw.jenax.arq.picocli.CmdMixinArq;
1414
import org.aksw.jenax.arq.picocli.CmdMixinSparqlPaginate;
15+
import org.aksw.jenax.dataaccess.sparql.polyfill.datasource.RdfDataSourceWithLocalLateral.PolyfillLateralConfig;
1516
import org.aksw.rdf_processing_toolkit.cli.cmd.CmdCommonBase;
1617
import org.aksw.rdf_processing_toolkit.cli.cmd.VersionProviderRdfProcessingToolkit;
1718
import org.aksw.sparql_integrate.cli.main.SparqlIntegrateCmdImpls;
@@ -21,6 +22,7 @@
2122
import picocli.CommandLine.ArgGroup;
2223
import picocli.CommandLine.Command;
2324
import picocli.CommandLine.IParameterConsumer;
25+
import picocli.CommandLine.ITypeConverter;
2426
import picocli.CommandLine.Mixin;
2527
import picocli.CommandLine.Model.ArgSpec;
2628
import picocli.CommandLine.Model.CommandSpec;
@@ -206,8 +208,18 @@ public static class OutputSpec {
206208
negatable = true, defaultValue = "true", fallbackValue = "true")
207209
public boolean graphQlAutoConfigure;
208210

209-
@Option(names = { "--polyfill-lateral" }, description = "Polyfill LATERAL by evaluating it on the client (may transmit large volumes of data).")
210-
public boolean polyfillLateral;
211+
@Option(names = { "--polyfill-lateral" },
212+
description = "Polyfill LATERAL by evaluating it on the client (may transmit large volumes of data). Format: [{bulkSize}[-{concurrentThreadCount}]]",
213+
converter = TypeConverterPolyfillLateralConfig.class,
214+
fallbackValue = "10-0")
215+
public PolyfillLateralConfig polyfillLateral = null;
216+
217+
public static class TypeConverterPolyfillLateralConfig implements ITypeConverter<PolyfillLateralConfig> {
218+
@Override
219+
public PolyfillLateralConfig convert(String s) {
220+
return PolyfillLateralConfig.parse(s);
221+
}
222+
}
211223

212224
/**
213225
* --jq may be followed by an integer - picocli seems to greedily parse any argument even if it is not an integer

rdf-processing-toolkit-cli/src/main/java/org/aksw/sparql_integrate/cli/main/SparqlIntegrateCmdImpls.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ public class SparqlIntegrateCmdImpls {
137137
private static final Logger logger = LoggerFactory.getLogger(SparqlIntegrateCmdImpls.class);
138138

139139
public static RdfDataEngine setupRdfDataEngine(CmdSparqlIntegrateMain cmd) throws Exception {
140-
141140
String sourceType = Optional.ofNullable(cmd.engine).orElse("mem");
142-
143141
RdfDataEngineFactory factory = RdfDataEngineFactoryRegistry.get().getFactory(sourceType);
144142
if (factory == null) {
145143
throw new RuntimeException("No RdfDataSourceFactory registered under name " + sourceType);
@@ -803,8 +801,8 @@ public void afterExec() {
803801
dataSource = RdfDataSources.execQueryViaSelect(dataSource, query -> query.isConstructQuad());
804802
}
805803

806-
if (cmd.polyfillLateral) {
807-
dataSource = RdfDataSourceWithLocalLateral.wrap(dataSource);
804+
if (cmd.polyfillLateral != null) {
805+
dataSource = RdfDataSourceWithLocalLateral.wrap(dataSource, cmd.polyfillLateral);
808806
}
809807

810808
RdfDataSource finalDataSource = dataSource;

0 commit comments

Comments
 (0)