Closed Superraptor closed 1 year ago
Doing this with Protege sounds a bit like torture. I'm wondering if ROBOT, which uses the same underlying APIs as Protege might be better for your neeeds.
I can't believe I didn't know this existed! So many rad features to work with! Thank you so much! I'll include my quick Python implementation for running things here, just in case anyone comes across things in the future:
robot.jar
and robot.bat
as instructed.icacls robot.bat /grant Users:RX /T
to test the install.subprocess
or os.system
in Python to run a command of the form `robot --input owlready2
(if that's what you want).It still required a little manual finagling for my file since owlready2
is stricter than robot with formatting (which is good, but my file is just of really questionable quality; oh well, it's out of my hands). But it's finally done!
I'm glad ROBOT was useful @Superraptor. Just a quick note for anyone reading this: your example should read robot convert --input <INPUT_FILE> --format <FORMAT> --output <OUTPUT_FILE>
. See the docs at http://robot.obolibrary.org/convert.
Yes, you're right, thank you for the correction!
This isn't a bug but rather more of a general query or feature request.
Relevant Software
Background
Essentially, I've been handed a really-not-so-great Turtle file that I don't have much control over. It needs to be able to be converted programmatically to OWL for a subsequent pipeline. It can be read into rdflib, but not owlready2, due to numerous wonky statements. I've tried writing a script to fix all of these issues programmatically, but the script is getting a little aggressive in length (600+ lines).
With that in mind, Protege has no problem opening the file and saving it. That spawned the idea of "hey, why don't I just use Protege for this?" So I began trying to get Protege to work in the script I'm writing.
I've managed to get Protege to open the file from a Python script using
os.system
, combining approaches discussed here and here; i.e.This opens a new Protege Window with file_name.ttl loaded.
Request
It would be a life-saver to be able to save file_name.ttl as file_name.owl from the Python script I have. Looking at the command-line log output Protege outputs when saving, it looks like this:
While the copy and remove commands are simple enough to implement in a script, I can't wrap my head around how to perform the save command, and even if I did figure it out, I'm not sure if the format would default to something indecipherable. As well, I'm not sure how temporary files are allocated, and so if there are multiple ontologytempfiles with similar names, it may become difficult to determine which is "correct".
Open Questions
With that being said, I just have a couple questions:
Thank you so much for your time!