Package edu.isi.karma.controller.history

Examples of edu.isi.karma.controller.history.WorksheetCommandHistoryExecutor


  }

  private Command generateCommandFromJSON(Workspace workspace, JSONObject obj) {
    JSONArray inputParamArr = (JSONArray) obj.get(HistoryArguments.inputParameters.name());
    String commandName = (String)obj.get(HistoryArguments.commandName.name());
    WorksheetCommandHistoryExecutor ex = new WorksheetCommandHistoryExecutor(worksheetId, workspace);
    ex.normalizeCommandHistoryJsonInput(workspace, worksheetId, inputParamArr, commandName, true);
    try {
      Command c = new OperateSelectionCommandFactory().createCommand(inputParamArr, workspace);
      return c;
    } catch (Exception e) {
      return null;
View Full Code Here


      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!"));
View Full Code Here

    return getClass().getClassLoader().getResource(name);
  }
 
  private void applyHistoryToWorksheet(Workspace workspace, Worksheet worksheet,
      KR2RMLMapping mapping) throws JSONException {
    WorksheetCommandHistoryExecutor wchr = new WorksheetCommandHistoryExecutor(worksheet.getId(), workspace);
    try
    {
      List<CommandTag> tags = new ArrayList<CommandTag>();
      tags.add(CommandTag.Transformation);
      wchr.executeCommandsByTags(tags, mapping.getWorksheetHistory());
    }
    catch (CommandException | KarmaException e)
    {
      logger.error("Unable to execute column transformations", e);
    }
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
   
    try {
      JSONArray historyJSON = CommandHistory.getHistorySaver(workspace.getId()).loadHistory(historyFile.getAbsolutePath());
      WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor(worksheetId, workspace);
      histExecutor.executeAllCommands(historyJSON);
    } catch (Exception e) {
      String msg = "Error occured while applying history!";
      logger.error(msg, e);
      return new UpdateContainer(new ErrorUpdate(msg));
    }
View Full Code Here

      WorkspaceRegistry.getInstance().deregister(workspace.getId());
  }

  protected void applyHistoryToWorksheet(Workspace workspace, Worksheet worksheet,
      KR2RMLMapping mapping) throws JSONException {
    WorksheetCommandHistoryExecutor wchr = new WorksheetCommandHistoryExecutor(worksheet.getId(), workspace);
    try
    {
      List<CommandTag> tags = new ArrayList<CommandTag>();
      tags.add(CommandTag.Transformation);
      wchr.executeCommandsByTags(tags, mapping.getWorksheetHistory());
    }
    catch (CommandException | KarmaException e)
    {
      logger.error("Unable to execute column transformations", e);
    }
View Full Code Here

      JSONArray historyJson  = extractHistoryFromModel(workspace, c);
      HistoryJSONEditor editor = new HistoryJSONEditor(new JSONArray(historyJson.toString()), workspace, worksheetId);
      if (null == historyJson || historyJson.length() == 0) {
        return new UpdateContainer(new ErrorUpdate("No history found in R2RML Model!"));
      }
      WorksheetCommandHistoryExecutor histExecutor = new WorksheetCommandHistoryExecutor(
          worksheetId, workspace);
      AlignmentManager alignMgr = AlignmentManager.Instance();
      Alignment alignment = alignMgr.getAlignment(workspace.getId(), worksheetId);
      if (override || alignment == null || alignment.GetTreeRoot() == null) {
        String alignmentId = alignMgr.constructAlignmentId(workspace.getId(), worksheetId);
        alignMgr.removeAlignment(alignmentId);
        alignMgr.getAlignmentOrCreateIt(workspace.getId(), worksheetId, workspace.getOntologyManager());
        editor.deleteExistingTransformationCommands();
        historyJson = editor.getHistoryJSON();
      }
      else {
        editor.deleteExistingTransformationAndModelingCommands();
        historyJson = editor.getHistoryJSON();
      }
      System.out.println(editor.getHistoryJSON().toString(4));
      UpdateContainer hc = histExecutor.executeAllCommands(historyJson);
      if(hc != null) {
        hc.removeUpdateByClass(HistoryAddCommandUpdate.class);
        hc.removeUpdateByClass(InfoUpdate.class);
        hc.removeUpdateByClass(ErrorUpdate.class);
        hc.removeUpdateByClass(AlignmentSVGVisualizationUpdate.class);
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.history.WorksheetCommandHistoryExecutor

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.