Package edu.isi.karma.controller.command.selection

Examples of edu.isi.karma.controller.command.selection.SuperSelection


    //save the preferences
    savePreferences(workspace);

    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    this.worksheetName = worksheet.getTitle();
    SuperSelection selection = getSuperSelection(worksheet);
    // Prepare the file path and names
    final String rdfFileName = workspace.getCommandPreferencesId() + worksheetId + ".ttl";
    final String rdfFileLocalPath = ServletContextParameterMap.getParameterValue(ContextParameter.RDF_PUBLISH_DIR)
        rdfFileName;
View Full Code Here


    }catch(Exception e) {
     
    }
    /*** Get the Alignment for this worksheet ***/
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    OntologyManager ontMgr = workspace.getOntologyManager();
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(
        workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(
        alignmentId);
View Full Code Here

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    RepFactory Repfactory = workspace.getFactory();
    Worksheet worksheet = workspace.getWorksheet(
        worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    inputColumns.clear();
    outputColumns.clear();
    Object para = JSONUtil.createJson(this.getInputParameterJson());
    HTable htable;
    if (hNodeId.compareTo("") != 0)
      htable = Repfactory.getHTable(Repfactory.getHNode(hNodeId).getHTableId());
    else
      htable = worksheet.getHeaders();
    hnodes.clear();
    //List<String> HNodeIds = new ArrayList<String>();
    JSONArray checked = (JSONArray) JSONUtil.createJson(CommandInputJSONUtil.getStringValue("values", (JSONArray)para));
    for (int i = 0; i < checked.length(); i++) {
      JSONObject t = (checked.getJSONObject(i));
      hnodes.add(htable.getHNode((String) t.get("value")));
      inputColumns.add(t.getString("value"));
    }
    ArrayList<Row> rows = worksheet.getDataTable().getRows(0, worksheet.getDataTable().getNumRows(), selection);
    if (htable != worksheet.getHeaders()) {
      HTable parentHT = htable.getParentHNode().getHTable(Repfactory);
      List<Table> parentTables = new ArrayList<Table>();
      CloneTableUtils.getDatatable(worksheet.getDataTable(), parentHT,parentTables, selection);
      ArrayList<Row> parentRows = new ArrayList<Row>();
      rows.clear();
      for (Table tmp : parentTables) {
        for (Row row : tmp.getRows(0, tmp.getNumRows(), selection)) {
          parentRows.add(row);
        }
      }
      for (Row parentRow : parentRows) {
        Table t = null;
        for (Node node : parentRow.getNodes()) {
          if (node.hasNestedTable() && node.getNestedTable().getHTableId().compareTo(htable.getId()) == 0) {
            t = node.getNestedTable();
            break;
         
        }
        ArrayList<Row> tmpRows = t.getRows(0, t.getNumRows(), selection);
        for (Row r : tmpRows) {
          rows.add(r);
        }
      }
    }
    //System.out.println("HNodeID: " + htable.getHNodeIdFromColumnName("homeworks"));
    //HNodeIds.add(htable.getHNodeIdFromColumnName("homeworks"));
   
    //HashValueManager.getHashValue(rows.get(0), HNodeIds);
    //hnodes.add(htable.getHNode("HN5"));
    //hnodes.add(htable.getHNode("HN7"));
    JSONArray array = new JSONArray();
    JSONArray input = new JSONArray();
    for (Row row : rows) {
      String id = row.getId();
      JSONArray t = new JSONArray();
      for (HNode hnode : hnodes) {
        Node node = row.getNode(hnode.getId());
        String name = hnode.getColumnName();
        Object value = CloneTableUtils.cloneNodeToJSON(hnode, node, selection);
        JSONObject obj = new JSONObject();
        JSONObject obj2 = new JSONObject();
        if (value instanceof String)
          obj2.put("values", value);
        else
          obj2.put(worksheet.getHeaders().getNewColumnName("nested"), value);
        obj.put("values", obj2);
        obj.put("names", name);
        t.put(obj);     
      }
      JSONObject obj = new JSONObject();
      obj.put("rowId", id);
      obj.put("rowIdHash", "");
      obj.put("values", t);
      array.put(obj);   
    }
    JSONObject obj = new JSONObject();
    obj.put("name", "AddValues");
    obj.put("value", array.toString());
    obj.put("type", "other");
    input.put(obj);
    try{
      AddValuesCommandFactory factory = new AddValuesCommandFactory();
      //hNodeId = hnodes.get(0).getId();
      cmd = factory.createCommand(input, workspace, hNodeId, worksheetId, hTableId, worksheet.getHeaders().getNewColumnName("fold"), HNodeType.Transformation, selection.getName());
      cmd.doIt(workspace);
      outputColumns.addAll(cmd.getOutputColumns());
      WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
      UpdateContainer c =  new UpdateContainer();   
      c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet)));
View Full Code Here

  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    logger.info("Entered ExportJSONCommand");


    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    RepFactory f = workspace.getFactory();
    Alignment alignment = AlignmentManager.Instance().getAlignment(
        AlignmentManager.Instance().constructAlignmentId(workspace.getId(),
            worksheetId));
    OntologyManager ontMgr = workspace.getOntologyManager();
View Full Code Here

  public UpdateContainer doIt(Workspace workspace) throws CommandException {
   

   
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    RepFactory f = workspace.getFactory();
    Alignment alignment = AlignmentManager.Instance().getAlignment(
        AlignmentManager.Instance().constructAlignmentId(workspace.getId(),
            worksheetId));
    OntologyManager ontMgr = workspace.getOntologyManager();
View Full Code Here

      return new UpdateContainer(new ErrorUpdate(e.getMessage()));
    }
  }

  private void populateRowsWithDefaultValues(Worksheet worksheet, RepFactory factory) {
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.getLeaf().getId().equals(newHNodeId)) {
        selectedPath = path;
View Full Code Here

    return c;
  }

  protected void saveColumnValues(Workspace workspace) {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    RepFactory f = workspace.getFactory();
    HNode hNode = f.getHNode(pythonNodeId);

    this.originalColumnValues = new ArrayList<String>();
    Collection<Node> nodes = new ArrayList<Node>();
View Full Code Here

  }

  public void resetColumnValues(Workspace workspace) {
    if(this.originalColumnValues != null) {
      Worksheet worksheet = workspace.getWorksheet(worksheetId);
      SuperSelection selection = getSuperSelection(worksheet);
      RepFactory f = workspace.getFactory();
      HNode hNode = f.getHNode(pythonNodeId);

      worksheet.getDataTable().setCollectedNodeValues(hNode.getHNodePath(f), this.originalColumnValues, f, selection);
    }
View Full Code Here

  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    UpdateContainer uc = new UpdateContainer();
    SuperSelection sel = this.getSuperSelection(workspace);
    for(int i=0; i<updates.length(); i++) {
      String update = updates.getString(i);
      switch(update) {
        case "headers": uc.add(new WorksheetHeadersUpdate(worksheetId, sel));
                break;
View Full Code Here

    uc.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
    return uc;
  }

  private void glueNestedTable(Worksheet oldws, Workspace workspace, HTable ht, List<HNode> hnodes, RepFactory factory) {
    SuperSelection selection = getSuperSelection(oldws);
    HTable parentHT = ht.getParentHNode().getHTable(factory);
    List<Table> parentTables = new ArrayList<Table>();
    CloneTableUtils.getDatatable(oldws.getDataTable(), parentHT,parentTables, selection);
    ArrayList<Row> parentRows = new ArrayList<Row>();
    for (Table tmp : parentTables) {
View Full Code Here

TOP

Related Classes of edu.isi.karma.controller.command.selection.SuperSelection

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.