sparql.anything icon indicating copy to clipboard operation
sparql.anything copied to clipboard

Read from STDIN

Open mielvds opened this issue 2 years ago • 0 comments

From a prior discussion:

aha I see! Well too bad you can't do fx -q imma-artists.sparql -o imma-artists.xml -f xml | fx -q imma-artist.sparql - -p "artists/?artistNickname.jsonld" -f json :)

I haven't thought of getting STDIN, not impossible, but it would probably look more like:

fx -q imma-artists.sparql -f xml | fx -q imma-artist.sparql -i -p "artists/?artistNickname.jsonld" -f json` -- where -i without argument would attempt to catch STDIN...

Originally posted by @enridaga in https://github.com/SPARQL-Anything/sparql.anything/discussions/213#discussioncomment-2525256

Could stdin be implemented, for instance for piping JSON into SA?

Expected behaviour:

  • other that the source of input, it should behave the same as reading the data from file
  • an empty -i means reading from stdin
  • when -i is empty,-f is mandatory and the CLI should complain if it's missing.

And I don't know how useful this is, but perhaps something like

    SERVICE <x-sparql-anything:> {
        fx:properties fx:location <x-sparql-anything:stdin> .
        ?tvSeries xyz:name ?seriesName .
        ?tvSeries xyz:stars ?star .
        ?star fx:anySlot "Courteney Cox" .
    }

mielvds avatar Apr 13 '22 14:04 mielvds