\documentclass[a4paper,10pt]{scrartcl} \RequirePackage[hyperindex]{hyperref} \usepackage[pdftex]{graphicx} \usepackage{amssymb} \usepackage{amsmath} \newcommand\cI{{\cal I}} \newcommand\cT{{\cal T}} \newcommand\cA{{\cal A}} \newcommand\cK{{\cal K}} \newcommand\cC{{\cal C}} \newcommand\cL{{\cal L}} \newcommand\fluffy{{\mathit{fluffy}}} \newenvironment{example}{}{} \newenvironment{definition}{}{} \begin{document} \title{TRILL on SWISH Manual} \maketitle \input{syntax} \input{semantics} \input{inference} \input{inf_goals} \section{Using TRILL on your Machine} To use TRILL without the need of an Internet connection, you must install it on your machine. Please, read the \href{https://github.com/rzese/trill/blob/master/doc/manual.pdf}{TRILL manual} for detailed information. \section{Download Query Results through an API} The results of queries can also be downloaded programmatically by directly approaching the Pengine API. Example client code is \href{https://github.com/friguzzi/trill-on-swish/tree/master/client}{available}. For example, the \verb|swish-ask.sh| client can be used with bash to download the results for a query in CSV. The call below downloads a CSV file for the coin example. \begin{verbatim} $ bash swish-ask.sh --server=http://trill-sw.eu \ example/trill/peoplePets.pl \ Prob "prob_instanceOf('natureLover','Kevin',Prob)" \end{verbatim} The script can ask queries against Prolog scripts stored in \url{http://trill-sw.eu} by specifying the script on the command line. User defined files stored in TRILL on SWISH (locations of type \url{http://trill-sw.eu/p/johnEmployee_user.pl}) can be directly used, for example: \begin{verbatim} $ bash swish-ask.sh --server=http://trill-sw.eu \ johnEmployee_user.pl Expl "instanceOf(person,john,Expl)" \end{verbatim} Example programs can be used by specifying the folder portion of the url of the example, as in the first johnEmployee example above where the url for the program is \url{http://trill-sw.eu/example/trill/johnEmployee.pl}. You can also use an url for the program as in \begin{verbatim} $ bash swish-ask.sh --server=http://trill-sw.eu \ https://raw.githubusercontent.com/friguzzi/trill-on-swish/ master/examples/trill/peoplePets.pl \ Prob "prob_instanceOf('natureLover','Kevin',Prob)" \end{verbatim} Results can be downloaded in JSON using the option \verb|--json-s| or \verb|--json-html|. With the first the output is in a simple string format where Prolog terms are sent using quoted write, the latter serialize responses as HTML strings. E.g. \begin{verbatim} $ bash swish-ask.sh --json-s --server=http://trill-sw.eu \ johnEmployee_user.pl Expl "instanceOf(person,john,Expl)" \end{verbatim} The JSON format can also be modified. See \url{http://www.swi-prolog.org/pldoc/doc_for?object=pengines%3Aevent_to_json/4}. Prolog can exploit the Pengine API directly. For example, the above can be called as: \begin{verbatim} ?- [library(pengines)]. ?- pengine_rpc('http://trill-sw.eu', prob_instanceOf('natureLover','Kevin',Prob), [ src_url('https://raw.githubusercontent.com/friguzzi/trill-on-swish/\ master/example/trill/peoplePets.pl'), application(swish) ]). Prob = 0.51. ?- \end{verbatim} \section{Manual in PDF} A PDF version of this help in PDF is available at \url{https://github.com/rzese/trill/blob/master/doc/help-trill.pdf}. A manual for the standalone version of TRILL is available at \url{https://github.com/rzese/trill/blob/master/doc/manual.pdf} \bibliographystyle{plain} \bibliography{bib} \appendix \input{appendix} \end{document}