Examples of ErrorUpdate


Examples of edu.isi.karma.controller.update.ErrorUpdate

    // Get the HNode
    HNode hNode = workspace.getFactory().getHNode(hNodeId);
    columnName = hNode.getColumnName();
    // The column should not have a nested table but check to make sure!
    if (hNode.hasNestedTable()) {
      c.add(new ErrorUpdate("Cannot split column with nested table!"));
      return c;
    }
   
    if (columnName.equals(newColName)) {
      splitCommaCommand = new SplitByCommaCommand(workspace.getFactory().getNewId("C"), worksheetId, hNodeId, delimiter, selectionId);
      return splitCommaCommand.doIt(workspace);
    }

    logger.info("SplitValuesCommand:" + newColName + ", columnName:" + columnName);
   
    HNode newhNode = null;
    if(newHNodeId != null && newHNodeId.length() > 0)
      newhNode = workspace.getFactory().getHNode(newHNodeId);
    boolean isUpdate = false;
    if(newhNode == null) {
      HTable hTable = workspace.getFactory().getHTable(hNode.getHTableId());
      newhNode = hTable.getHNodeFromColumnName(newColName);
      if(newhNode == null)
      {
        newhNode = hTable.addHNode(newColName, HNodeType.Transformation, wk, workspace.getFactory());
      }
      if(newhNode.getNestedTable() == null)
      {
        HTable newTable = newhNode.addNestedTable("Comma Split Values", wk, workspace.getFactory());
        newTable.addHNode("Values", HNodeType.Transformation, wk, workspace.getFactory());
      }
      newHNodeId = newhNode.getId();
      hNode.addAppliedCommand("SplitValuesCommand", newhNode);
    } else {
      logger.info("Column names are same, re-compute the split values");
      isUpdate = true;
    }
   
   
   
    SplitColumnByDelimiter split = new SplitColumnByDelimiter(hNodeId, newhNode.getId(), wk, delimiter, workspace, selection);
    try {
      if(isUpdate)
        split.empty();
      split.split();
    } catch (IOException e) {
      c.add(new ErrorUpdate("Cannot split column! csv reader error"));
      return c;
    }
    c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, selection));

    /** Add the alignment update **/
 
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

     
      JSONArray bindings = res.getJSONObject(sparqlKeys.results.name())
          .getJSONArray(sparqlKeys.bindings.name());
     
      if (bindings.length() == 0) {
        return new UpdateContainer(new ErrorUpdate("No history found in the " +
            "selected model!"));
      }
     
      String history = bindings.getJSONObject(0).getJSONObject(
          sparqlKeys.history.name()).getString(sparqlKeys.value.name());
     
 
      // Execute the history
      WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor(
          worksheetId, workspace);


      if (history.isEmpty()) {
        return new UpdateContainer(new ErrorUpdate("No history found in R2RML Model!"));
      }
     
      JSONArray historyJson = new JSONArray(history);
      histExecutor.executeAllCommands(historyJson);
     
      // Add worksheet updates that could have resulted out of the transformation commands
      UpdateContainer c = WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, SuperSelectionManager.DEFAULT_SELECTION);
      c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
      c.add(new InfoUpdate("Model successfully applied!"));
      return c;
     
    } catch (Exception e) {
      logger.error("Error applying model from triple store!", e);
      return new UpdateContainer(new ErrorUpdate("Error applying model from triple store!"));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

  }

  private String getErrorMessage(VWorkspace vWorkspace, Throwable e) {
    e.printStackTrace();
    UpdateContainer updateContainer = new UpdateContainer();
    updateContainer.add(new ErrorUpdate("Error:" + e.getMessage()));
    return updateContainer.generateJson(vWorkspace);
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

    SuperSelection selection = getSuperSelection(wk);
    // Get the HNode
    hNode = workspace.getFactory().getHNode(hNodeId);
    // The column should not have a nested table but check to make sure!
    if (hNode.hasNestedTable()) {
      c.add(new ErrorUpdate("Cannot split column with nested table!"));
      return c;
    }
    columnName = hNode.getColumnName();
   
    SplitColumnByDelimiter split = new SplitColumnByDelimiter(hNodeId, wk, delimiter, workspace, selection);
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

    uc.add(new WorksheetSuperSelectionListUpdate(worksheetId));
    return uc;
  }
 
  public UpdateContainer getErrorUpdate(String msg) {
    return new UpdateContainer(new ErrorUpdate(msg));
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

    OntologyManager om= workspace.getOntologyManager();
    WorksheetToFeatureCollection geo = new WorksheetToFeatureCollection(worksheet, om, selection);//ying
    //WorksheetToFeatureCollections geo = new WorksheetToFeatureCollections(worksheet);
    // Send an error update if no geospatial data found!
    if (geo.hasNoGeospatialData()) {
      return new UpdateContainer(new ErrorUpdate(
          "No geospatial data found in the worksheet!"));
    }

    try {
      //final File file = geo.SaveSpatialData();
      // Transfer the file to a public server
      final String kmlFileName = geo.SaveSpatialDataAndReturnKMLString();//new RandomGUID().toString(); // save this line for using networkLink in GE plugin (see geospatial.js)
      final String zippedSpatialDataPath = geo.getZippedSpatialDataPath();
      final boolean transfer = true;//transferFileToPublicServer(kmlFileName,file); // save this line for using networkLink in GE plugin (see geospatial.js)
      //if (!transfer) { // save this line for using networkLink in GE plugin (see geospatial.js)
      //  logger.error("Published KML file could not be moved to a public server to display on Google Maps!");
      //}

      return new UpdateContainer(new AbstractUpdate() {
        @Override
        public void generateJson(String prefix, PrintWriter pw,
            VWorkspace vWorkspace) {
          JSONObject outputObject = new JSONObject();
          try {
            outputObject.put(JsonKeys.updateType.name(),
                "PublishKMLUpdate");
            outputObject.put(JsonKeys.fileName.name(),
                kmlFileName);
                //publicKMLAddress + kmlFileName+".kml"); // save this line for using networkLink in GE plugin (see geospatial.js)
            outputObject.put(JsonKeys.transferSuccessful.name(),
                transfer);
            outputObject.put(JsonKeys.localFileName.name(),
                "publish/SpatialData/" + zippedSpatialDataPath);
            pw.println(outputObject.toString(4));
          } catch (JSONException e) {
            logger.error("Error occured while generating JSON!");
          }
        }
      });
    } catch (FileNotFoundException e) {
      logger.error("KML File not found!", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occurred while publishing KML layer!"));
    } catch (Exception shapfileException) {
      // TODO Auto-generated catch block
      shapfileException.printStackTrace();
      return new UpdateContainer(new ErrorUpdate(
          "Error occurred while saving Shapefile!"));
    }
   
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

    OntologyManager om= workspace.getOntologyManager();
    WorksheetToFeatureCollection geo = new WorksheetToFeatureCollection(worksheet, om, selection);//ying
   
    // Send an error update if no geospatial data found!
    if (geo.hasNoGeospatialData()) {
      return new UpdateContainer(new ErrorUpdate(
          "No geospatial data found in the worksheet!"));
    }

    try {
     
      geo.SaveSpatialDataAndReturnKMLString();
      final String zippedSpatialDataPath = geo.getZippedSpatialDataPath();

      return new UpdateContainer(new AbstractUpdate() {
        @Override
        public void generateJson(String prefix, PrintWriter pw,
            VWorkspace vWorkspace) {
          JSONObject outputObject = new JSONObject();
          try {
            outputObject.put(JsonKeys.updateType.name(),
                "PublishSpatialDataUpdate");
            outputObject.put(JsonKeys.fileUrl.name(),
                "publish/SpatialData/" + zippedSpatialDataPath);
            outputObject.put(JsonKeys.worksheetId.name(),
                worksheetId);
            pw.println(outputObject.toString(4));
           
          } catch (JSONException e) {
            logger.error("Error occured while generating JSON!");
          }
        }
      });
    } catch (FileNotFoundException e) {
      logger.error("Spatial data folder not found!", e);
      return new UpdateContainer(new ErrorUpdate(
          "Error occurred while exporting spatial data!"));
    }catch (Exception shapfileException) {
      // TODO Auto-generated catch block
      shapfileException.printStackTrace();
      return new UpdateContainer(new ErrorUpdate(
          "Error occurred while saving Shapefile!"));
    }
   
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

            writer.endObject();
 
            pw.print(writer.toString());
          } catch (JSONException e) {
            logger.error("Error occured while writing to JSON!", e);
            uc.add(new ErrorUpdate("Error occured while writing to JSON"));
          }
        }
       
      });
    } else {
      uc.add(new ErrorUpdate("Node does not exist in the Alignment"));
    }

    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

          pw.println(obj.toString());
        }
       
      });
    } else {
      uc.add(new ErrorUpdate("Karma home could not be changed. The specified directory does not exist"));
    }
    return uc;
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
   
    boolean result = TripleStoreUtil.clearContexts(tripleStoreUrl, graphUrl);
    if (!result) {
      return new UpdateContainer(new ErrorUpdate("Error occured while clearing R2RML model!"));
    }
    UpdateContainer uc = new UpdateContainer();
    uc.add(new AbstractUpdate() {
      public void generateJson(String prefix, PrintWriter pw, 
          VWorkspace vWorkspace) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.