Package edu.isi.karma.controller.update

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


      if (t != null)
        history._getHistory().add(t);
      history._getHistory().addAll(tmp);
    }
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, superSel);
    uc.add(new HistoryUpdate(history));
    return uc;
  }
View Full Code Here


      } catch (Exception e) {
       
      }
    }
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, currentSel);
    uc.add(new HistoryUpdate(workspace.getCommandHistory()));
    return uc;
  }
View Full Code Here

   
    UpdateContainer update = new UpdateContainer();
    update.add(new WorksheetListUpdate());
    if(worksheetExists) {
      update.add(new WorksheetDeleteUpdate(worksheetId));
      update.add(new HistoryUpdate(workspace.getCommandHistory()));
    }
    return update;
  }
View Full Code Here

      uc.append(historyUtil.replayHistory());
      uc.removeUpdateByClass(HistoryAddCommandUpdate.class);
      uc.removeUpdateByClass(InfoUpdate.class);
      uc.removeUpdateByClass(ErrorUpdate.class);
      historyUtil.consolidateHistory();
      uc.add(new HistoryUpdate(workspace.getCommandHistory()));

    }
    Set<String> inputColumns = historyUtil.generateInputColumns();
    Set<String> outputColumns = historyUtil.generateOutputColumns();
    JSONArray inputColumnsArray = new JSONArray();
    JSONArray outputColumnsArray = new JSONArray();
    for (String hNodeId : inputColumns) {
      HNode hnode = workspace.getFactory().getHNode(hNodeId);
      JSONArray hNodeRepresentation = hnode.getJSONArrayRepresentation(workspace.getFactory());
      inputColumnsArray.put(hNodeRepresentation);
    }

    for (String hNodeId : outputColumns) {
      HNode hnode = workspace.getFactory().getHNode(hNodeId);
      JSONArray hNodeRepresentation = hnode.getJSONArrayRepresentation(workspace.getFactory());
      outputColumnsArray.put(hNodeRepresentation);
    }
    worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(
        Property.inputColumns, inputColumnsArray.toString());
    worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(
        Property.outputColumns, outputColumnsArray.toString());   
    this.worksheetName = worksheet.getTitle();
    String graphLabel = worksheet.getMetadataContainer().getWorksheetProperties().
        getPropertyValue(Property.graphLabel);

    if (graphLabel == null || graphLabel.isEmpty()) {
      worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(
          Property.graphLabel, worksheet.getTitle());
      graphLabel = worksheet.getTitle();
      worksheet.getMetadataContainer().getWorksheetProperties().setPropertyValue(
          Property.graphName, WorksheetProperties.createDefaultGraphName(graphLabel))
    }
    // Prepare the model file path and names
    final String modelFileName = graphLabel + "-model.ttl";
    final String modelFileLocalPath = ServletContextParameterMap.getParameterValue(
        ContextParameter.R2RML_PUBLISH_DIR) +  modelFileName;

    // Get the alignment for this Worksheet
    Alignment alignment = AlignmentManager.Instance().getAlignment(AlignmentManager.
        Instance().constructAlignmentId(workspace.getId(), worksheetId));

    if (alignment == null) {
      logger.info("Alignment is NULL for " + worksheetId);
      return new UpdateContainer(new ErrorUpdate(
          "Please align the worksheet before generating R2RML Model!"));
    }
    Set<LabeledLink> links = new HashSet<LabeledLink>();
    if (alignment.getSteinerTree() != null) {
      for (LabeledLink link : alignment.getSteinerTree().edgeSet()) {
        if ((link.getStatus() == LinkStatus.Normal || link.getStatus() == LinkStatus.PreferredByUI) && (link.getType() == LinkType.ObjectPropertyLink)) {
          links.add(link);
        }
      }
    }
    JSONArray newEdges = new JSONArray();
    JSONArray initialEdges = new JSONArray();
    ChangeInternalNodeLinksCommandFactory cinlcf = new ChangeInternalNodeLinksCommandFactory();
    for (LabeledLink link : links) {
      JSONObject newEdge = new JSONObject();
      JSONObject initialEdge = new JSONObject();
      newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeSourceId.name(), link.getSource().getId());
      newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeTargetId.name(), link.getTarget().getId());
      newEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeId.name(), link.getUri());
      initialEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeSourceId.name(), link.getSource().getId());
      initialEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeTargetId.name(), link.getTarget().getId());
      initialEdge.put(ChangeInternalNodeLinksCommand.JsonKeys.edgeId.name(), link.getUri());
      newEdges.put(newEdge);
      initialEdges.put(initialEdge);
    }
    JSONArray inputJSON = new JSONArray();
    JSONObject t = new JSONObject();
    t.put("name", "worksheetId");
    t.put("type", HistoryJsonUtil.ParameterType.worksheetId.name());
    t.put("value", worksheetId);
    inputJSON.put(t);
    t = new JSONObject();
    t.put("name", "initialEdges");
    t.put("type", HistoryJsonUtil.ParameterType.other.name());
    t.put("value", initialEdges);
    inputJSON.put(t);
    t = new JSONObject();
    t.put("name", "newEdges");
    t.put("type", HistoryJsonUtil.ParameterType.other.name());
    t.put("value", newEdges);
    inputJSON.put(t);
    if (newEdges.length() > 0 || initialEdges.length() > 0) {
      try {
        Command changeInternalNodeLinksCommand = cinlcf.createCommand(inputJSON, workspace);
        workspace.getCommandHistory().doCommand(changeInternalNodeLinksCommand, workspace);
        uc.add(new HistoryUpdate(workspace.getCommandHistory()));
        uc.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet)));
        uc.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
      }catch(Exception e)
      {
        e.printStackTrace();
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    UpdateContainer undoEffects = workspace.getCommandHistory().undoOrRedoCommandsUntil(
        workspace, commandIdArg);
    UpdateContainer result = new UpdateContainer(new HistoryUpdate(
        workspace.getCommandHistory()));
    result.append(undoEffects);
    return result;
  }
View Full Code Here

    if (command.getCommandType() != CommandType.notInHistory) {
      redoStack.clear();

      // Send the history before the command we just executed.
      if (lastCommandWasUndo && !(instanceOf(command, "UndoRedoCommand"))) {
        effects.append(new UpdateContainer(new HistoryUpdate(this)));
      }
      lastCommandWasUndo = false;

      history.add(command);
      effects.add(new HistoryAddCommandUpdate(command));
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.update.HistoryUpdate

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.