コード例 #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;
  }
コード例 #2
0
  public void runDictionary() throws Exception {
    OWLKnowledgeBase kb = OWLFactory.createKB();
    service = kb.readService("http://www.mindswap.org/2004/owl-s/1.1/Dictionary.owl");
    process = service.getProcess();

    // initialize the input values to be empty
    values = new ValueMap();

    inValue = "hello";
    values.setDataValue(process.getInput("InputString"), inValue);
    values = exec.execute(process, values);

    // get the output
    OWLDataValue out = (OWLDataValue) values.getValue(process.getOutput());

    // display the results
    System.out.println("Executed service '" + service + "'");
    System.out.println(
        "Grounding WSDL: " + ((AtomicProcess) process).getGrounding().getDescriptionURL());
    System.out.println("Input  = " + inValue);
    System.out.println("Output = " + out.toString());
    System.out.println();
  }
コード例 #3
0
ファイル: WrappedIndividual.java プロジェクト: OldBao/mozart
 /**
  * @param prop
  * @param lang
  * @return
  */
 protected String getPropertyAsString(final OWLDataProperty prop, final String lang) {
   final OWLDataValue value = individual.getProperty(prop, lang);
   return (value == null) ? null : value.toString();
 }