Hi,
I came across this thread since I want to use newly inferred object_properties derived from using Pellet with an ontology containing SWRL rules.
I was poking through the source code and wondered if changing the 'realize' argument of the pellet call (line 228 of reasoning.py -
https://bitbucket.org/jibalamy/owlready2/src/default/reasoning.py) to 'extract' instead, and then just load that in somehow? (I haven't looked into how this could be done all within owlready2).
For what I'm using right now, I'm planning to do the following:
1. run pellet via the command line in a similar fashion to line 228 of reasoning.py except two differences:
Difference 1: replace 'realize' with 'extract'
Difference 2: write the results to a new file representing the new ontology, something like '> InferredOntology.owl'
2. Then I just load the new ontology using owlready2.get_ontology('InferredOntology.owl')
I have SWRL rules in my original ontology and the InferredOntology contains the results of applying the SWRL rules. Perhaps it could solve the original problem posted on this thread?