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 query.sh in the folder with the .tsv files (or click on Download script)
  6. Run it with bash query.sh
Note: the script uses a folder tmp for temporary files and removes its contents afterwards

API

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

Examples:

You can try the examples on this dataset (source).
  • Find people that died in the city where they were born BASE <http://yago-knowledge.org/resource/> SELECT ?X WHERE { ?X <wasBornIn> ?Y. ?X <diedIn> ?Y. }
  • Living people BASE <http://yago-knowledge.org/resource/> SELECT ?X WHERE { { ?X <wasBornIn> []. } UNION { ?X <wasBornOnDate> []. } MINUS { ?X <diedIn> []. } MINUS { ?X <diedOnDate> []. } }
  • All people BASE <http://yago-knowledge.org/resource/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?X WHERE { ?X rdf:type/rdfs:subClassOf* <wordnet_person_100007846>. }
  • Facts in the query

    SPARQL BASE <http://yago-knowledge.org/resource/> SELECT ?X WHERE { ?X <type> . }

    OWL @prefix kb: <http://yago-knowledge.org/resource/> . kb:albert kb:type kb:person. kb:marie kb:type kb:person.