jena icon indicating copy to clipboard operation
jena copied to clipboard

arq: multiple input files without repeating --data

Open tpluscode opened this issue 1 year ago • 3 comments

Version

4.8.0

Feature

When executing queries with arq it is possible to provide multiple input files by repeating the --data option

This is a not shell-friendly, where I would like to glob a path to load multiple sources in one go

arq --query test.rq --data data/*.ttl

To make that work, it would be necessary to allow multiple values of --data

arq --query test.rq --data data/1.ttl data/2.ttl data/3.ttl

Can this be implemented?

Are you interested in contributing a solution yourself?

None

tpluscode avatar May 02 '23 10:05 tpluscode

A plain argument is a query string.

arq --query test.rq --data data/1.ttl --data data/2.ttl "SELECT (Count(*) AS ?C) { ?s ?p ?o }"

afs avatar May 02 '23 20:05 afs

I see. Some CLI tools allow variadic arguments and if they are not last, they would be delimited by a double dash

-arq --data data/1.ttl --data data/2.ttl "SELECT (Count(*) AS ?C) { ?s ?p ?o }"
+arq --data data/*.ttl -- "SELECT (Count(*) AS ?C) { ?s ?p ?o }"

For example commander lets one author CLIs in that fashion

tpluscode avatar May 03 '23 06:05 tpluscode

you could also simply do this with your shell :

datafiles=(data/*.ttl)
arq "${datafiles[@]/#/--data=}" --query etc...

SimonBin avatar Jul 20 '23 15:07 SimonBin