-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement query operation #24
Comments
Should this cover cases where a sparql query is used to enforce a build constraint, exiting with a non-zero code if some condition is not met? Or is that best folded into the rest of the ontology unit test framework? |
Good idea. If it's a binary condition, we could use "ask" instead of "select", with an option like I suggest another option: |
For constraints we may prefer something like SHACL, see @balhoff's experiments: https://github.com/balhoff/shacl-tests As for the main SELECT use case, the simplest way to do this would be to write the OWL to a ttl file, and then run the query via Jena. Kind of hacky... could also try the bridge layer in the OWLAPI? |
I would be happy to attempt an implementation of As @jamesaoverton suggests above an |
Hmm, I'd like to avoid the need for another repo We use code.berkeleybop.org for OWLTools, but we really messed people up when that was down for a few days. I'm torn between having ROBOT be a simple one-stop-shop for their release pipelines vs keeping things more modular. Maybe we should start with a standalone tool? |
That makes sense. I'll clean up the SHACL runner I have now so that we can get some experience with in release pipelines. |
- load ontology into default graph of Jena Arq DatasetGraph - run select queries, write to CSV - add command, include it in the CLI - add test
Meanwhile, for the basic query option, looks like robot has |
Yes, I haven't properly documented |
Closing this as the feature has been implemented, some discussion continuing here: #150 |
The query operation should allow arbitrary SPARQL select and update queries to be run against the ontology, saving the results to files. I'm most familiar with Apache Jena, so I plan to use that. Things will be simpler if we load the ontology into the default RDF graph, and don't use named graphs.
We may want to run multiple queries, but we only want to load the ontology into an RDF graph once. The current chaining implementation passes state as an OWLOntology, and I'd like to stick with that simple solution as long as possible. So I propose this command-line interface:
--select INPUT OUTPUT
(-s
) take an input SPARQL file, run the select query, and save to a file; the output format will be determined by the file extension--update INPUT
(-u
) take an input SPARQL file, run the update queryYou can specify these options multiple times. Apache CLI should keep them in the right order. When all queries have been run, we'll load the default RDF graph into an ontology for further processing. Suggestions for the best way to do this are appreciated!
Jena supports these output file formats, and we'll use these file extensions:
.txt
.csv
.tsv
.xml
.js
or.json
Note that the text format is close to some of the table formats accepted by various Markdown parsers: http://pandoc.org/README.html#tables
Example:
The text was updated successfully, but these errors were encountered: