Bash Datalog
Answering Datalog Queries with Unix Shell Commands

SPARQL query

OWL ontology

N-Triple input file

Bash script

How to try it:

  1. Enter a SPARQL query in the first textbox.
  2. Optional: Enter an OWL ontology in the second textbox
  3. Enter the path to an N-Triples file into the third textbox.
  4. Click on the Convert to bash script button
  5. Copy the content of the "Bash script" textbox into a file named in the folder with the .tsv files (or click on Download script)
  6. Run it with bash
Note: the script uses a folder tmp for temporary files and removes its contents afterwards


You can also use bashlog from the command line, without a browser. For details, see API.


You can try the examples on this dataset (source).
  • Find people that died in the city where they were born BASE <> SELECT ?X WHERE { ?X <wasBornIn> ?Y. ?X <diedIn> ?Y. }
  • Living people BASE <> SELECT ?X WHERE { { ?X <wasBornIn> []. } UNION { ?X <wasBornOnDate> []. } MINUS { ?X <diedIn> []. } MINUS { ?X <diedOnDate> []. } }
  • All people BASE <> PREFIX rdf: <> SELECT ?X WHERE { ?X rdf:type/rdfs:subClassOf* <wordnet_person_100007846>. }
  • Facts in the query

    SPARQL BASE <> SELECT ?X WHERE { ?X <type> . }

    OWL @prefix kb: <> . kb:albert kb:type kb:person. kb:marie kb:type kb:person.