Example #1
0
  /**
   * @param viskoService
   * @param inputDataURL
   * @param serviceIndex
   * @return
   * @throws ExecutionException
   */
  private String executeService(
      edu.utep.trustlab.visko.ontology.viskoService.Service viskoService,
      String inputDataURL,
      int serviceIndex)
      throws ExecutionException {

    OWLKnowledgeBase kb = OWLFactory.createKB();
    Service service = viskoService.getOWLSService().getIndividual();
    Process process = service.getProcess();

    ValueMap<Input, OWLValue> inputs =
        OWLSParameterBinder.buildInputValueMap(
            process, inputDataURL, job.getPipeline().getParameterBindings(), kb);

    String outputDataURL = null;

    if (inputs != null) {
      ValueMap<Output, OWLValue> outputs;

      if (job.isSimulated()) outputDataURL = ServiceSimulator.exec();
      else {
        outputs = exec.execute(process, inputs, kb);
        OWLDataValue out = (OWLDataValue) outputs.getValue(process.getOutput());
        outputDataURL = out.toString();
      }

      if (job.getProvenanceLogging()) {
        pmlLogger.recordServiceInvocation(viskoService, inputDataURL, outputDataURL, inputs);
        provLogger.recordServiceInvocation(viskoService, inputDataURL, outputDataURL, inputs);
      }
    }
    return outputDataURL;
  }
Example #2
0
  private void executePipeline() throws ExecutionException {

    if (job.getProvenanceLogging()) {
      provLogger.recordPipelineStart();
      pmlLogger.recordPipelineStart();
    }

    job.getJobStatus().setPipelineState(PipelineExecutorJobStatus.PipelineState.RUNNING);
    String resultURL = job.getPipeline().getArtifactURL();

    System.out.println(job.getJobStatus());

    for (int i = 0; i < job.getPipeline().size(); i++) {

      edu.utep.trustlab.visko.ontology.viskoService.Service viskoService =
          job.getPipeline().getService(i);

      // Capture initial dataset
      if (job.getProvenanceLogging() && i == 0) {
        pmlLogger.recordInitialDataset(resultURL, job.getPipeline().getService(i));
        provLogger.recordInitialDataset(resultURL, job.getPipeline().getService(i));
      }

      job.getJobStatus().setCurrentService(viskoService.getOWLSService().getURI(), i);
      System.out.println(job.getJobStatus());

      resultURL = executeService(viskoService, resultURL, i);

      if (isScheduledForTermination) {
        System.out.println("This thread's execution was interrupted and will quit!");
        job.getJobStatus().setPipelineState(PipelineExecutorJobStatus.PipelineState.INTERRUPTED);
        break;
      }
    }

    job.setFinalResultURL(resultURL);

    if (job.getProvenanceLogging()) {
      provLogger.recordPipelineEnd(job);
      pmlLogger.recordPipelineEnd(job);

      // Set URIs on Job
      job.setPMLQueryURI(pmlLogger.finish());
      job.setProvQueryURI(provLogger.finish());
    }
  }