Integrate Ontop CLI in Python App

15 views
Skip to first unread message

Alberto Forlenza

unread,
Mar 29, 2025, 7:40:30 AMMar 29
to ontop4obda
Hi guys. I am developing a python app for my degree project at university. I'd like to know if it's possible to call ontop as subprocess. I can run command as ontop --version but when i try to create an endpoint i am getting some error on the property file. If i run the ontop command using powershell everything is ok. 

I really appreciate your help and i can share or show you code etc.

Eseguendo il comando: "C:\Users\alber\Desktop\ALBERTO\TESI_DEFINITIVA\PYTHON\WaterSystemApp\bin\ontop-cli\ontop.bat" endpoint --ontology=input//OntoWaterSys.rdf --mapping=input//OntoWaterSys.obda --properties=input//OntoWaterSys.properties --xml-catalog=input//catalog-v001.xml
-------------------------------------------

    ####    #   #   #####    ####    #####
   #    #   ##  #     #     #    #   #    #
   #    #   # # #     #     #    #   #####
   #    #   #  ##     #     #    #   #
    ####    #   #     #      ####    #

   v5.2.1
   (Java 24, Windows 11 10.0)
-------------------------------------------




12:38:16.442 |-INFO  in i.u.i.o.e.OntopEndpointApplication - Starting OntopEndpointApplication v5.2.1 using Java 24 on DellNeca with PID 16956 (C:\Users\alber\Desktop\ALBERTO\TESI_DEFINITIVA\PYTHON\WaterSystemApp\bin\ontop-cli\lib\ontop-endpoint-5.2.1.jar started by alber in C:\Users\alber\Desktop\ALBERTO\TESI_DEFINITIVA\PYTHON\WaterSystemApp\src)
12:38:16.444 |-INFO  in i.u.i.o.e.OntopEndpointApplication - No active profile set, falling back to 1 default profile: "default"
12:38:17.448 |-INFO  in o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
12:38:17.453 |-INFO  in o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
12:38:17.455 |-INFO  in o.a.catalina.core.StandardService - Starting service [Tomcat]
12:38:17.455 |-INFO  in o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.91]
12:38:17.623 |-INFO  in o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
12:38:17.623 |-INFO  in o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1136 ms
12:38:17.848 |-WARN  in o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sparqlQueryController' defined in URL [jar:file:/C:/Users/alber/Desktop/ALBERTO/TESI_DEFINITIVA/PYTHON/WaterSystemApp/bin/ontop-cli/lib/ontop-endpoint-5.2.1.jar!/it/unibz/inf/ontop/endpoint/controllers/SparqlQueryController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'setupVirtualRepository' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Unsatisfied dependency expressed through method 'setupVirtualRepository' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupOntopConfiguration' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [it.unibz.inf.ontop.injection.OntopSystemConfiguration]: Factory method 'setupOntopConfiguration' threw exception; nested exception is it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
12:38:17.853 |-INFO  in o.a.catalina.core.StandardService - Stopping service [Tomcat]
12:38:17.870 |-INFO  in o.s.b.a.l.ConditionEvaluationReportLoggingListener -

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
12:38:17.894 |-ERROR in o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sparqlQueryController' defined in URL [jar:file:/C:/Users/alber/Desktop/ALBERTO/TESI_DEFINITIVA/PYTHON/WaterSystemApp/bin/ontop-cli/lib/ontop-endpoint-5.2.1.jar!/it/unibz/inf/ontop/endpoint/controllers/SparqlQueryController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'setupVirtualRepository' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Unsatisfied dependency expressed through method 'setupVirtualRepository' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupOntopConfiguration' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [it.unibz.inf.ontop.injection.OntopSystemConfiguration]: Factory method 'setupOntopConfiguration' threw exception; nested exception is it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:929)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289)
at it.unibz.inf.ontop.endpoint.OntopEndpointApplication.main(OntopEndpointApplication.java:20)
at it.unibz.inf.ontop.cli.OntopEndpoint.run(OntopEndpoint.java:152)
at it.unibz.inf.ontop.cli.Ontop.main(Ontop.java:19)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'setupVirtualRepository' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Unsatisfied dependency expressed through method 'setupVirtualRepository' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupOntopConfiguration' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [it.unibz.inf.ontop.injection.OntopSystemConfiguration]: Factory method 'setupOntopConfiguration' threw exception; nested exception is it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:536)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 21 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupOntopConfiguration' defined in class path resource [it/unibz/inf/ontop/endpoint/beans/OntopVirtualRepositoryBean.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [it.unibz.inf.ontop.injection.OntopSystemConfiguration]: Factory method 'setupOntopConfiguration' threw exception; nested exception is it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:633)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 35 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [it.unibz.inf.ontop.injection.OntopSystemConfiguration]: Factory method 'setupOntopConfiguration' threw exception; nested exception is it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
... 49 common frames omitted
Caused by: it.unibz.inf.ontop.exception.InvalidOntopConfigurationException: Cannot reach the property file: input\OntoWaterSys.properties
at it.unibz.inf.ontop.injection.impl.OntopModelConfigurationImpl.extractProperties(OntopModelConfigurationImpl.java:236)
at it.unibz.inf.ontop.injection.impl.OntopModelConfigurationImpl$DefaultOntopModelBuilderFragment.propertyFile(OntopModelConfigurationImpl.java:161)
at it.unibz.inf.ontop.injection.impl.OntopModelConfigurationImpl$DefaultOntopModelBuilderFragment.propertyFile(OntopModelConfigurationImpl.java:156)
at it.unibz.inf.ontop.injection.impl.OntopKGQueryConfigurationImpl$OntopKGQueryBuilderMixin.propertyFile(OntopKGQueryConfigurationImpl.java:106)
at it.unibz.inf.ontop.injection.impl.OntopSQLOWLAPIConfigurationImpl$BuilderImpl.propertyFile(OntopSQLOWLAPIConfigurationImpl.java:158)
at it.unibz.inf.ontop.injection.impl.OntopKGQueryConfigurationImpl$OntopKGQueryBuilderMixin.propertyFile(OntopKGQueryConfigurationImpl.java:59)
at it.unibz.inf.ontop.endpoint.beans.OntopVirtualRepositoryBean.setupOntopConfiguration(OntopVirtualRepositoryBean.java:34)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 50 common frames omitted
Reply all
Reply to author
Forward
0 new messages