0

Here's my SWRL rule. It states that if an operation exists and has an action, it needs to create a new variable h of type Hold, that hold the same action value as the operation:

Operation(?op) ^ hasAction(?op, ?action)^ makeOWLThing(?h, ?op)->Hold(?h)^hold_action(?h, ?action))

I use OWLapi to create owl individuals. Here's what I did so far:

for (int j=0; j < operations_true.size(); j++) {
            
    OWLNamedIndividual hold = factory.getOWLNamedIndividual(IRI.create(ontologyIRI + "#hold"+ j));
    hold_set.add(hold); 
    OWLAxiom hActionax = factory.getOWLObjectPropertyAssertionAxiom(hold_action, hold, actionTrue);
    ontologyManager.addAxiom(ontology, hActionax); 
}

actionTrue is an already defined variable with a defined value. I have trouble seeing how I could fetch the value of each action depending on each Operation.

Thank you in advance.

PS: the reason I do this is because Pellet (unlike SWRLApi) does not support "makeOWLThing", therefore I need to manually write a function that does the same job

kerbermeister
  • 2,985
  • 3
  • 11
  • 30
user93804
  • 83
  • 8
  • you first have to find all `?op` bindings and for each create a new OWL individual - that is basically all `makeOWLThing(?h, ?op) does in your rule. So, iterate over all individuals that are an operation and have an action, create a new individual `i` and assert it to class `Hold` and add the `hold_action`. Getting all individuals matching `Operation(?op) ^ hasAction(?op, ?action)` should be done via the Pellet reasoner. You can ask the reasoner for all instances of the class expression `Operation and hasAction some Thing` – UninformedUser Mar 11 '23 at 07:27

0 Answers0