예제 #1
0
파일: JavaCPN.java 프로젝트: OldBao/mozart
  private String internal_call(String ws, String[] values) {
    logger.info("#" + index + "请求调用web service: " + ws);
    OWLValue output;
    try {
      mKB = OWLFactory.createKB();
      mKB.createOntology(null);
      Service service = mKB.readService(URI.create(ws));

      ValueMap<Input, OWLValue> inputs = new ValueMap<Input, OWLValue>();

      for (int i = 0; i < values.length; i++) {
        Input input = service.getProcess().getInputs().get(i);
        inputs.setValue(input, mKB.createDataValue(values[i]));
        logger.info("\t" + input.getLocalName() + "  :  " + values[i]);
      }

      ProcessExecutionEngine exec = OWLSFactory.createExecutionEngine();
      ValueMap<Output, OWLValue> outputs;
      outputs = exec.execute(service.getProcess(), inputs, mKB);

      output = outputs.getDataValue(service.getProcess().getOutput().getName());
      logger.info("Result : " + output);
      return output.toString();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ExecutionException e) {
      e.printStackTrace();
    }
    return "";
  }
예제 #2
0
 /** @param constantValue The constantValue to set. */
 public void setConstantValue(OWLValue value) {
   if (value.isDataValue()) setProperty(OWLS.Process.valueData, (OWLDataValue) value);
   else setProperty(OWLS.Process.valueData, ((OWLIndividual) value).toRDF(false));
 }