Package edu.isi.karma.rep.sources

Examples of edu.isi.karma.rep.sources.WebService


        return;
      }
    }
   
    if (getResourceType() == ResourceType.Input || getResourceType() == ResourceType.Output) {
      WebService s = WebServiceLoader.getInstance().getSourceByUri(getServiceUri());
      if (s == null) {
        getResponse().setContentType(MimeType.TEXT_PLAIN);
        pw.write("Could not find the service " + getServiceId() + " in service repository");
        return;
      }
     
      edu.isi.karma.rep.model.Model inputModel = s.getInputModel();
      edu.isi.karma.rep.model.Model outputModel = s.getOutputModel();
      String sparql;
     
      WebServicePublisher servicePublisher = new WebServicePublisher(s);
      if (getResourceType() == ResourceType.Input) {
        if (getFormat().equalsIgnoreCase(SerializationLang.SPARQL)) {
View Full Code Here


//      new JsonImport(json, wk, ws.getFactory());
//      logger.debug(json);


     
      WebService service = invocatioManager.getInitialServiceModel(null);
      MetadataContainer metaData = wk.getMetadataContainer();
      if (metaData == null) {
        metaData = new MetadataContainer();
        wk.setMetadataContainer(metaData);
      }
View Full Code Here

        "Error occured while populating the source. Cannot find any services to be invoked according to this source model."));
    }
   
    // For now, we just use the first service,
    // later we can suggest the user a list of available services and user select among them
    WebService service = null;
    Iterator<WebService> itr = servicesAndMappings.keySet().iterator();
    if (itr != null && itr.hasNext()) {
      service = itr.next();
    }
   
    if (service == null) {
      logger.error("Cannot find any services to be invoked according to this source model.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. Cannot find any services to be invoked according to this source model."));
    }
   
    List<String> requestIds = new ArrayList<String>();
    Map<String, String> serviceToSourceAttMapping =  servicesAndMappings.get(service);
    List<String> requestURLStrings = getUrlStrings(service, source, wk, serviceToSourceAttMapping, requestIds);
    if (requestURLStrings == null || requestURLStrings.size() == 0) {
      logger.error("Data table does not have any row.");
      return new UpdateContainer(new ErrorUpdate("Data table does not have any row."))
    }
   
   
    InvocationManager invocatioManager;
    try {
      String encoding = wk.getEncoding();
      invocatioManager = new InvocationManager(getUrlColumnName(wk), requestIds, requestURLStrings, encoding);
      logger.info("Requesting data with includeURL=" + true + ",includeInput=" + true + ",includeOutput=" + true);
      Table serviceTable = invocatioManager.getServiceData(false, false, true);
//      logger.debug(serviceTable.getPrintInfo());
      ServiceTableUtil.populateWorksheet(serviceTable, wk, workspace.getFactory(), selection);
      logger.info("The service " + service.getUri() + " has been invoked successfully.");


    } catch (MalformedURLException e) {
      logger.error("Malformed service request URL.");
      return new UpdateContainer(new ErrorUpdate("Malformed service request URL."));
View Full Code Here

   
    Model m = Repository.Instance().getNamedModel(uri);
    if (m == null)
      return null;

    WebService service = importSourceFromJenaModel(m);
    return service;
  }
View Full Code Here

        logger.debug("service name: " + service_name);
        if (address != null && address.isLiteral()) service_address = address.asLiteral().getString();
        logger.debug("service address: " + service_address);
       
        if (service_id.trim().length() > 0)
          serviceList.add(new WebService(service_id, service_name, service_address));
        else
          logger.info("length of service id is zero.");
      }
     
      return serviceList;
View Full Code Here

    String uri = getServiceUriByServiceAddress(address);
    Model m = Repository.Instance().getNamedModel(uri);
    if (m == null)
      return null;

    WebService service = importSourceFromJenaModel(m);
    return service;
  }
View Full Code Here

      outputAttributes = getAttributes(model, node.asResource(), IOType.OUTPUT );
      outputModel = getSemanticModel(model, node.asResource());
    } else
      logger.info("service does not have an output.");
   
    WebService service = new WebService(service_id, service_name, service_address);
    service.setMethod(service_method);
    service.setVariables(variables);
    service.setInputAttributes(inputAttributes);
    service.setOutputAttributes(outputAttributes);
    service.setInputModel(inputModel);
    service.setOutputModel(outputModel);

   
    return service;
  }
View Full Code Here

      return false;
  }
 
  private static void testGetServiceByUri() {
    String uri = "http://isi.edu/integration/karma/services/CDA81BE4-DD77-E0D3-D033-FC771B2F4800#";
    WebService service = WebServiceLoader.getInstance().getSourceByUri(uri);
   
    if (service != null) {
//      System.out.println(service.getInputModel().getSPARQLConstructQuery());
//      System.out.println(service.getOutputModel().getSPARQLConstructQuery());
      service.print();
    }
  }
View Full Code Here

      service.print();
    }
  }
  private static void testGetServiceByAddress() {
    String address = "http://api.geonames.org/";
    WebService service = WebServiceLoader.getInstance().getServiceByAddress(address);
    if (service != null) service.print();
  }
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
   
    Worksheet wk = workspace.getWorksheet(worksheetId);

    WebService service = null;
    DataSource source = null;
   
    if (!wk.containService()) {
      logger.info("The worksheet does not have a service object.");
//      return new UpdateContainer(new ErrorUpdate(
//        "Error occured while publishing the model. The worksheet does not have a service object."));
    } else
      service = wk.getMetadataContainer().getService();
   
    AlignmentManager mgr = AlignmentManager.Instance();
    String alignmentId = mgr.constructAlignmentId(workspace.getId(), worksheetId);
    Alignment al = mgr.getAlignment(alignmentId);
   
    if (al == null) {
      logger.error("The alignment model is null.");
      if (service == null)
        return new UpdateContainer(new ErrorUpdate(
          "Error occured while publishing the source. The alignment model is null."));
    }
   
    DirectedWeightedMultigraph<Node, LabeledLink> tree = null;
    if (al != null)
      tree = al.getSteinerTree();
   
    if (tree == null) {
      logger.error("The alignment tree is null.");
      if (service == null)
        return new UpdateContainer(new ErrorUpdate(
          "Error occured while publishing the source. The alignment tree is null."));
    }
   
    if (service != null) service.updateModel(tree);
    else {
      source = new DataSource(wk.getTitle(), tree);
      MetadataContainer metaData = wk.getMetadataContainer();
      if (metaData == null) {
        metaData = new MetadataContainer();
        wk.setMetadataContainer(metaData);
      }
      metaData.setSource(source);
      logger.info("Source added to the Worksheet.");
    }
   
    try {
      if (service != null) {
        WebServicePublisher servicePublisher = new WebServicePublisher(service);
        servicePublisher.publish(Repository.Instance().LANG, true);
        logger.info("Service model has successfully been published to repository: " + service.getId());
        return new UpdateContainer(new InfoUpdate(
        "Service model has successfully been published to repository: " + service.getId()));
      } else { //if (source != null) {
        DataSourcePublisher sourcePublisher = new DataSourcePublisher(source, workspace.getFactory(), wk.getMetadataContainer().getSourceInformation());
        sourcePublisher.publish(Repository.Instance().LANG, true);
        logger.info("Source model has successfully been published to repository: " + source.getId());
        return new UpdateContainer(new InfoUpdate(
View Full Code Here

TOP

Related Classes of edu.isi.karma.rep.sources.WebService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.