Reputation: 1
I am trying to execute ontology code which is mentioned in the documentation https://owlready2.readthedocs.io/en/latest/reasoning.html . I have also mentioned the Java path for the reasoner part but still I am getting access denied error. Since I am a beginner in this domain could you please help me where I am going wrong.
Code:
from owlready2 import *
import owlready2
owlready2.JAVA_EXE = "C:\\Program Files\\Java\\jdk-19\\bin"
from owlready2 import *
onto = get_ontology("http://test.org/onto.owl")
with onto:
class Drug(Thing):
def take(self): print("I took a drug")
class ActivePrinciple(Thing):
pass
class has_for_active_principle(Drug >> ActivePrinciple):
python_name = "active_principles"
class Placebo(Drug):
equivalent_to = [Drug & Not(has_for_active_principle.some(ActivePrinciple))]
def take(self): print("I took a placebo")
class SingleActivePrincipleDrug(Drug):
equivalent_to = [Drug & has_for_active_principle.exactly(1, ActivePrinciple)]
def take(self): print("I took a drug with a single active principle")
class DrugAssociation(Drug):
equivalent_to = [Drug & has_for_active_principle.min(2, ActivePrinciple)]
def take(self): print("I took a drug with %s active principles" % len(self.active_principles))
acetaminophen = ActivePrinciple("acetaminophen")
amoxicillin = ActivePrinciple("amoxicillin")
clavulanic_acid = ActivePrinciple("clavulanic_acid")
AllDifferent([acetaminophen, amoxicillin, clavulanic_acid])
drug1 = Drug(active_principles = [acetaminophen])
drug2 = Drug(active_principles = [amoxicillin, clavulanic_acid])
drug3 = Drug(active_principles = [])
close_world(Drug)
sync_reasoner()`
[error image](https://i.sstatic.net/bq6OO.png)
Not sure why I am getting access denied error after using sync_reasoner() it has to check the consistency of class and reassign but I am getting error
Upvotes: 0
Views: 275
Reputation: 10198
owlready2.JAVA_EXE
should be set to the path to the Java executable (java.exe
), not to the directory containing it. See Configuration in the Owlready2 documentation.
Upvotes: 0