I have an ontology that defines a subject area, and have used that to help construct an rdflib graph of object instances, and their interrelating properties.
I'm using python, owlready2
and rdflib
libraries. I had tried constructing the instances directly in the owlready2 ontology in memory, but I need strict control over the final IRIs (per this question), hence the rdflib construction.
What I want to do next, is run a reasoner over the rdflib graph, and extract any inferred relationships that might be so generated.
Ultimately, I'll prepare a curated set of triples for entry into a final knowledge store, having run them through this process.
Per the docs, I could save my rdflib graph to disk, and then reload it:
But this workflow might be repeated 1000 or more times in a given job, so it would be helpful to perform this step in memory.
So, is there a way I can wrap my rdflib graph such that it looks like a file and is loadable (or more strictly importable) by owlready2 into a unified ontology containing the class/property model and these new individual instances I've created - without having to dump it to disk, only to immediately reload it again?
Alternately (and this appears to have been asked as a separate question) given an rdflib graph, what options do I have for running a reasoner over it, informed by a separate owl ontology?