Package edu.isi.karma.rep

Examples of edu.isi.karma.rep.HTable


      throw new Error("Cannot handle " + key + " yet.");
    }
  }

  public void addEmptyRow(Table nestedTable, HNode hNode) {
    HTable headersNestedTable = hNode.getNestedTable();
    Row emptyRow = nestedTable.addRow(factory);
    numObjects++;
    if (maxNumLines > 0 && numObjects >= maxNumLines)
      return;

    for (HNode nestedHNode : headersNestedTable.getHNodes()) {
      if (nestedHNode.hasNestedTable()) {
        addEmptyRow(emptyRow.getNode(nestedHNode.getId())
            .getNestedTable(), nestedHNode);
      } else {
        emptyRow.setValue(nestedHNode.getId(), "", factory);
View Full Code Here


        String hNodeId = hNode.getId();
        Row row = dataTable.addRow(factory);
        numObjects++;
        if (maxNumLines > 0 && numObjects >= maxNumLines)
          return;
        HTable nestedHTable = addNestedHTable(hNode,
            "nested array values", row);
        Table nestedTable = row.getNode(hNodeId).getNestedTable();
        JSONArray a = (JSONArray) listValue;
        for (int i = 0; i < a.length(); i++) {
          addListElement(a.get(i), nestedHTable, nestedTable);
View Full Code Here

          if (hNodeId != null) {
            Row row = dataTable.addRow(factory);
            numObjects++;
            if (maxNumLines > 0 && numObjects >= maxNumLines)
              return;
            HTable nestedHTable = addNestedHTable(hNode,
                "nested array values", row);
            Table nestedTable = row.getNode(hNodeId).getNestedTable();
            addListElement(token, nestedHTable, nestedTable);
          }
          else
View Full Code Here

        || value instanceof Integer || value instanceof Double
        || value instanceof Long;
  }

  public HTable addNestedHTable(HNode hNode, String key, Row row) {
    HTable ht = hNode.getNestedTable();
    if (ht == null) {
      ht = hNode.addNestedTable(createNestedTableName(key),
          worksheet, factory);

      // Check for all the nodes that have value and nested tables
View Full Code Here

      List<String> model_Contexts = metadata.get("model_contexts");
      List<String> model_inputColumns = metadata.get("model_inputcolumns");
      final List<JSONObject> list = new ArrayList<JSONObject>();
      Set<String> worksheetcolumns = new HashSet<String>();
      if (worksheetId != null && !worksheetId.trim().isEmpty()) {
        HTable htable = factory.getWorksheet(worksheetId).getHeaders();
        getHNodesForWorksheet(htable, worksheetcolumns, factory);
      }
      Iterator<String> nameitr = model_Names.iterator();
      Iterator<String> urlitr = model_Urls.iterator();
      Iterator<String> timeitr = model_Times.iterator();
View Full Code Here

    hNodeName.clear();
    RepFactory factory = workspace.getFactory();
    Worksheet oldws = workspace.getWorksheet(worksheetId);
    List<HNode> hnodes = new ArrayList<HNode>();
    JSONArray checked = new JSONArray(hNodeIdList);
    HTable ht;
    if (hNodeId.compareTo("") != 0)
      ht = factory.getHTable(factory.getHNode(hNodeId).getHTableId());
    else
      ht = oldws.getHeaders();
    for (int i = 0; i < checked.length(); i++) {
      JSONObject t = (checked.getJSONObject(i));
      HNode hNode = ht.getHNode(t.getString("value"));
      if (hNode != null) {
        hnodes.add(hNode);
        hNodeName.add(hNode.getColumnName());
      }     
    }
View Full Code Here

  @Override
  public UpdateContainer undoIt(Workspace workspace) {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    UpdateContainer uc = new UpdateContainer();
    HNode ndid = workspace.getFactory().getHNode(newhNodeId);
    HTable currentTable = workspace.getFactory().getHTable(ndid.getHTableId());
    ndid.removeNestedTable();
    //remove the new column
    currentTable.removeHNode(newhNodeId, worksheet);
    uc.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet)));
    uc.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
    return uc;
  }
View Full Code Here

    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) {
      for (Row row : tmp.getRows(0, tmp.getNumRows(), selection)) {
        parentRows.add(row);
      }
    }
    HNode newNode = ht.addHNode(ht.getNewColumnName("Glue"), HNodeType.Transformation, oldws, factory);
    outputColumns.add(newNode.getId());
    newhNodeId = newNode.getId();
    HTable newht = newNode.addNestedTable(newNode.getColumnName(), oldws, factory);
    List<HNode> childHNodes = new ArrayList<HNode>();
    for (HNode hnode : hnodes) {
      if (hnode.hasNestedTable()) {
        for (HNode hn : hnode.getNestedTable().getHNodes()) {
          childHNodes.add(hn);
View Full Code Here

    }
  }

  private void glueTopLevel(Worksheet oldws, Workspace workspace, List<HNode> hnodes, RepFactory factory) {
    HTable parentHT = oldws.getHeaders();
    SuperSelection selection = getSuperSelection(oldws);
    HNode newNode = parentHT.addHNode(parentHT.getNewColumnName("Glue"), HNodeType.Transformation, oldws, factory);
    newhNodeId = newNode.getId();
    outputColumns.add(newhNodeId);
    HTable newht = newNode.addNestedTable(newNode.getColumnName(), oldws, factory);
    List<HNode> childHNodes = new ArrayList<HNode>();
    for (HNode hnode : hnodes) {
      if (hnode.hasNestedTable()) {
        for (HNode hn : hnode.getNestedTable().getHNodes()) {
          childHNodes.add(hn);
View Full Code Here

 
  private static boolean checkSelection(Selection sel, Command command, RepFactory factory) {
    Set<String> selectedRowsColumns = sel.getSelectedRowsColumns();
    Set<String> outputColumns = command.getOutputColumns();
    for (String parent : selectedRowsColumns) {
      HTable parentHT = factory.getHTable(factory.getHNode(parent).getHTableId());
      for (String child : outputColumns) {
        HTable childHT = factory.getHTable(factory.getHNode(child).getHTableId());
        if (isChildHTable(parentHT, childHT, factory))
          return true;
      }
    }
    return false;
View Full Code Here

TOP

Related Classes of edu.isi.karma.rep.HTable

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.