Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor error handling when storing a provenance-agent without rdf_type #33

Open
Dryocopus opened this issue Oct 12, 2021 · 0 comments
Open

Comments

@Dryocopus
Copy link

This is for opensilex 1.0.0-rc and the current version of opensilexClientToolsPython. Most likely the origin is in phis-ws, but I’ll add it here because this is the interface that is used

When I try to store a provenance_creation_dto as follows (shown as a dict that is the input for the constructor):

{'description': '',
  'name':     'MaxiMarvin_ImageAcquisition_NPEC.G1_PotNr.86_Genotype.GardenersDelight_Replicate.1_Position.AC16_2021-07-02T14:51:24.003000',
 'prov_activity': [
   {
     'end_date': '2021-07-02T14:51:24.003000',
     'rdf_type': 'http://www.opensilex.org/vocabulary/oeso#ImageAcquisition',
     'settings': {
       'FileCount': 1.0,
       'ImagingSettings': 0.0,
       'Interval': 500.0,
       'StabilizationTime': 2000.0
     },
     'start_date': '2021-07-02T14:51:24.003000',
     'timezone': 'UTC+01:00',
     'uri': None
   }
 ],
 'prov_agent': [
    {
      'rdf_type': None,
      'settings': {},
      'uri': 'npec:set/devices/imaging-cabin-maxi-marvin'}
 ],
 'uri': None
}

I get the following error:

Exception calling PHIS: (500)
Reason:
HTTP response headers: HTTPHeaderDict({'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'origin, content-type, accept, authorization', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS, HEAD', 'Vary': 'accept-encoding,accept-encoding', 'Content-Type': 'application/json', 'Content-Length': '6457', 'Date': 'Tue, 12 Oct 2021 10:04:21 GMT', 'Connection': 'close'})
HTTP response body: {
  "metadata" : {
    "pagination" : {
      "pageSize" : 0,
      "currentPage" : 0,
      "totalCount" : 0,
      "totalPages" : 0
    },
    "status" : [ ],
    "datafiles" : [ ]
  },
  "result" : {
    "title" : "Unexpected internal error - org.eclipse.rdf4j.query.MalformedQueryException",
    "message" : "Lexical error at line 30, column 8.  Encountered: \" \" (32), after : \"ANY\"",
    "stack" : [ "org.opensilex.sparql.rdf4j.RDF4JConnection.executeAskQuery(RDF4JConnection.java:88)", "org.opensilex.sparql.service.SPARQLService.executeAskQuery(SPARQLService.java:179)", "org.opensilex.core.provenance.api.ProvenanceAPI.checkAgents(ProvenanceAPI.java:406)", "org.opensilex.core.provenance.api.ProvenanceAPI.createProvenance(ProvenanceAPI.java:126)" ],
    "fullstack" : [ "org.eclipse.rdf4j.http.client.SPARQLProtocolSession.execute(SPARQLProtocolSession.java:1050)", "org.eclipse.rdf4j.http.client.SPARQLProtocolSession.executeOK(SPARQLProtocolSession.java:993)", "org.eclipse.rdf4j.http.client.SPARQLProtocolSession.sendBooleanQueryViaHttp(SPARQLProtocolSession.java:981)", "org.eclipse.rdf4j.http.client.SPARQLProtocolSession.getBoolean(SPARQLProtocolSession.java:931)", "org.eclipse.rdf4j.http.client.SPARQLProtocolSession.sendBooleanQuery(SPARQLProtocolSession.java:435)", "org.eclipse.rdf4j.repository.http.HTTPBooleanQuery.evaluate(HTTPBooleanQuery.java:44)", "org.opensilex.sparql.rdf4j.RDF4JConnection.executeAskQuery(RDF4JConnection.java:88)", "org.opensilex.sparql.service.SPARQLService.executeAskQuery(SPARQLService.java:179)", "org.opensilex.core.provenance.api.ProvenanceAPI.checkAgents(ProvenanceAPI.java:406)", "org.opensilex.core.provenance.api.ProvenanceAPI.createProvenance(ProvenanceAPI.java:126)", "java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)", "java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.base/java.lang.reflect.Method.invoke(Method.java:566)", "org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)", "org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)", "org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)", "org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)", "org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)", "org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)", "org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)", "org.glassfish.jersey.internal.Errors.process(Errors.java:292)", "org.glassfish.jersey.internal.Errors.process(Errors.java:274)", "org.glassfish.jersey.internal.Errors.process(Errors.java:244)", "org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)", "org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)", "org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)", "org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)", "org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)", "org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)", "org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)", "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)", "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)", "org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)", "org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)", "org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)", "org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)", "org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:295)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)", "org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:552)", "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)", "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)", "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)", "org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)", "org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)", "org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)", "org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)", "org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)", "org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)", "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)", "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)", "org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)", "java.base/java.lang.Thread.run(Thread.java:829)" ]
  }
}

Saving works ok after filling the rdf_type:

{'description': '',
  'name': 'MaxiMarvin_ImageAcquisition_NPEC.G1_PotNr.86_Genotype.GardenersDelight_Replicate.1_Position.AC16_2021-07-02T14:51:24.003000',
 'prov_activity': [
    {  
      'end_date': '2021-07-02T14:51:24.003000',
      'rdf_type': 'http://www.opensilex.org/vocabulary/oeso#ImageAcquisition',
      'settings':  {
        'FileCount': 1.0,
        'ImagingSettings': 0.0,
        'Interval': 500.0,
        'StabilizationTime': 2000.0
      },
      'start_date': '2021-07-02T14:51:24.003000',
      'timezone': 'UTC+01:00',
      'uri': None
    }
  ],
  'prov_agent': [
    {
      'rdf_type': 'http://www.opensilex.org/vocabulary/oeso#SensingDevice',
      'settings': {},
      'uri': 'npec:set/devices/imaging-cabin-maxi-marvin'
    }
  ],
  'uri': None
}

Assuming that rdf_type is indeed mandatory, problem and solution are clear, but the error handling can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant