The protocol used for access remote RDF is a use of HTTP GET. A query returns the smallest subgraph that matches the query (i.e. the subgraph that gives the same results as the query on the original graph).
Joseki comes with a client application that allows use of the WebAPI from the command line. The command line application assumes the Joseki server supports RDQL as a query language.
Also, any program that can issue HTTP GETs, such as wget, can also be used.
Joseki comes with a command line application, very similar to the command line interface to the RDQL local query system (jena.rdfquery).
java -cp ... rdfserver.rdfqueryremote [--model URI] {--query file | queryString}
In particular, you can put all the information in the query using the FROM clause of RDQL:
SELECT ?x FROM <http://localhost:2020/testdata> WHERE (?x, ?y, "LITERAL-2")
so the command:
java -cp ... rdfserver.rdfqueryremote --query SomeFile
will work for the default installation with its test data.
Specifying the "--model URL" parameter overrides the URL specified in the FROM clause of a query if any was present.