ERROR: The system cannot find the owl file specified

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ERROR: The system cannot find the owl file specified

yashodasw
Hi,

I'm using owlready2 to query the ontology. while I'm running the code it gives me following errors though the .owl file is already exists. I'm using python. I'm looking for immediate response since I have only one week for my final evaluation.

Traceback (most recent call last):
  File "E:/Level-4/Project/Ontology/MovieOntology/FlaskApp/app.py", line 2, in <module>
    from FlaskApp.src.SparqlQueries import runQuery
  File "E:\Level-4\Project\Ontology\MovieOntology\FlaskApp\src\SparqlQueries.py", line 84, in <module>
    runQuery = SparqlQueries()
  File "E:\Level-4\Project\Ontology\MovieOntology\FlaskApp\src\SparqlQueries.py", line 9, in __init__
    my_world.get_ontology("file://FlaskApp/src/MovieOnto.owl").load()
  File "C:\Users\Yashoda\AppData\Roaming\Python\Python36\site-packages\owlready2\namespace.py", line 448, in load
    if os.path.getmtime(f) <= self.graph.get_last_update_time():
  File "C:\Users\Yashoda\AppData\Local\Programs\Python\Python36\lib\genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'FlaskApp/src/MovieOnto.owl'

Best Regards,
Yashoda Weeratunga
University Of Moratuwa, SriLanka
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: The system cannot find the owl file specified

Frack
Hi,

Could you please update the piece of your code that load the .owl file?

Frack.
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: The system cannot find the owl file specified

yashodasw
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: The system cannot find the owl file specified

Frack
OK, maybe you're missing some slash, try that and tell if it's working:

class SparqlQueries:
    def __init__(self):
        my_world = World()

Here is the modification -->        my_world.get_ontology("file://FlaskApp/src/Ontology.owl").load()

        sync_reasoner(my_world)
        self.graph = my_world.as_rdflib_graph()
Reply | Threaded
Open this post in threaded view
|

Re: ERROR: The system cannot find the owl file specified

yashodasw
Thank you Frack... I missed that slashes in the screenshot. with that also I got the same error.

Then I added this line => owlready2.JAVA_EXE = 'C:/Program Files/Java/jdk1.8.0_66/bin/java.exe'  

Now It's working.

Thank you so much for your consideration.