Examples of HNode


Examples of edu.isi.karma.rep.HNode

    return hNodeIdToColumnName.get(hNodeId);
  }
 
  public String translateHNodeIdToColumnName(String hNodeId)
  {
    HNode hNode = factory.getHNode(hNodeId);
    String colNameStr = "";
    try {
      JSONArray colNameArr = hNode.getJSONArrayRepresentation(factory);
      if (colNameArr.length() == 1) {
        colNameStr = (String)
            (((JSONObject)colNameArr.get(0)).get("columnName"));
      } else {
        JSONArray colNames = new JSONArray();
        for (int i=0; i<colNameArr.length();i++) {
          colNames.put((String)
              (((JSONObject)colNameArr.get(i)).get("columnName")));
        }
        colNameStr = colNames.toString();
      }
      return colNameStr;
    } catch (JSONException e) {
      logger.debug("unable to find hnodeid to column name mapping for hnode: " + hNode.getId() + " " + hNode.getColumnName(), e);
    }
    return null;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

        JSONArray strArr = new JSONArray(colTermVal);
        for (int i=0; i<strArr.length(); i++) {
        String cName = (String) strArr.get(i);
       
        logger.debug("Column being normalized: "+ cName);
        HNode hNode = hTable.getHNodeFromColumnName(cName);
        if(hNode == null || hTable == null) {
          logger.error("Error retrieving column: " + cName);
          return null;
        }
       
        if (i == strArr.length()-1) {    // Found!
          return hNode.getId();
        } else {
          hTable = hNode.getNestedTable();
        }
        }
      } else {
        HNode hNode = hTable.getHNodeFromColumnName(colTermVal);
      if(hNode == null) {
        logger.error("Error retrieving column: " + colTermVal);
        return null;
      }
        logger.debug("Column" +colTermVal);
        return hNode.getId();
      }
      return null;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

  private void findNewHNodeIdAndHNodeAsDerived(Workspace workspace,
      HNodePath selectedPath) {
    this.newHNodeId = selectedPath.getLeaf().getId();
    // Set the new column as derived from original column
    HNode newHNode = workspace.getFactory().getHNode(newHNodeId);
    if (newHNode != null) {
      newHNode.setAsDerivedFromAnotherColumn(hNodeId);
    }
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

        public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) {
          pw.print(array.toString());
        }
      });
    }
    HNode hnode = factory.getHNode(hNodeId);
    List<Table> dataTables = new ArrayList<Table>();
    CloneTableUtils.getDatatable(worksheet.getDataTable(), factory.getHTable(hnode.getHTableId()), dataTables, selection);
    KR2RMLBloomFilter uris = new KR2RMLBloomFilter(KR2RMLBloomFilter.defaultVectorSize, KR2RMLBloomFilter.defaultnbHash, Hash.JENKINS_HASH);
    Set<String> uriSet = new HashSet<String>();
    for(Table t : dataTables) {
      for(Row r : t.getRows(0, t.getNumRows(), selection)) {
        Node n = r.getNode(hNodeId);
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    return CommandType.undoable;
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    HNode columnNode = workspace.getFactory().getHNode(hNodeId);
    oldColumnName = columnNode.getColumnName();
   
    // Change the column name
    columnNode.setColumnName(newColumnName);
   
    CommandHistory history = workspace.getCommandHistory();
    List<ICommand>  allCommands = history._getHistory();
    for(ICommand command : allCommands) {
      String json = command.getInputParameterJson();
View Full Code Here

Examples of edu.isi.karma.rep.HNode

   
  }
 
  @Override
  public UpdateContainer undoIt(Workspace workspace) {
    HNode columnNode = workspace.getFactory().getHNode(hNodeId);
    // Change the column name
    columnNode.setColumnName(oldColumnName);
   
    // Prepare the output to be sent
 
    UpdateContainer c = WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, SuperSelectionManager.DEFAULT_SELECTION);
    c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
View Full Code Here

Examples of edu.isi.karma.rep.HNode

      terminalColumns.addAll(c.getInputColumns());
    else {
      for (Command t : parents) {
        terminalColumns.addAll(getParents(t, dag));
        for (String hNodeId : c.getInputColumns()) {
          HNode hn = workspace.getFactory().getHNode(hNodeId);
          if (hn.getHNodeType() == HNodeType.Regular)
            terminalColumns.add(hNodeId);
        }
      }
    }
    return terminalColumns;
View Full Code Here

Examples of edu.isi.karma.rep.HNode

      c.add(new WorksheetListUpdate());
      c.add(new WorksheetDeleteUpdate(newWorksheetId));
    }
    if (this.newHNodeId != null) {
      Worksheet worksheet = workspace.getWorksheet(worksheetId);
      HNode ndid = workspace.getFactory().getHNode(newHNodeId);
      HTable currentTable = workspace.getFactory().getHTable(ndid.getHTableId());
      ndid.removeNestedTable();
      //remove the new column
      currentTable.removeHNode(newHNodeId, worksheet);
      c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet)));
      c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
    }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    for (Table tmp : parentTables) {
      for (Row row : tmp.getRows(0, tmp.getNumRows(), selection)) {
        parentRows.add(row);
      }
    }
    HNode newNode = parentHT.addHNode(parentHT.getNewColumnName("GroupBy"), HNodeType.Transformation, oldws, factory);
    newHNodeId = newNode.getId();
    outputColumns.add(newNode.getId());
    HTable newht = newNode.addNestedTable(newNode.getColumnName(), oldws, factory);
    for (Entry<String, String> entry : CloneTableUtils.cloneHTable(ht, newht, oldws, factory, keyhnodes, selection).entrySet()) {
      outputColumns.add(entry.getValue());
    }
    outputColumns.add(newht.addHNode("Values", HNodeType.Transformation, oldws, factory).getId());
    HTable newValueTable = newht.getHNodeFromColumnName("Values").addNestedTable("Table for values", oldws, factory);
    for (Entry<String, String> entry : CloneTableUtils.cloneHTable(ht, newValueTable, oldws, factory, valuehnodes, selection).entrySet()) {
      outputColumns.add(entry.getValue());
    }
    for (Row parentRow : parentRows) {
      Table t = null;
      for (Node node : parentRow.getNodes()) {
        if (node.hasNestedTable() && node.getNestedTable().getHTableId().compareTo(ht.getId()) == 0) {
          t = node.getNestedTable();
          break;
       
      }
      ArrayList<Row> rows = t.getRows(0, t.getNumRows(), selection);
      Map<String, ArrayList<String>> hash = new TreeMap<String, ArrayList<String>>();
      for (Row row : rows) {
        String hashValue = HashValueManager.getHashValue(row, hnodeIDs);
        ArrayList<String> ids = hash.get(hashValue);
        if (ids == null)
          ids = new ArrayList<String>();
        ids.add(row.getId());
        hash.put(hashValue, ids);
     
     
      for (String key : hash.keySet()) {
        ArrayList<String> r = hash.get(key);
        Node node = parentRow.getNeighbor(newNode.getId());
        Row lastRow = CloneTableUtils.cloneDataTable(factory.getRow(r.get(0)), node.getNestedTable(), ht, newht, keyhnodes, factory, selection);
        for (String rowid : r) {
          Row cur = factory.getRow(rowid);
          Table dataTable = lastRow.getNeighborByColumnName("Values", factory).getNestedTable();
          CloneTableUtils.cloneDataTable(cur, dataTable, ht, newValueTable, valuehnodes, factory, selection);
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    String columnName = hNode.getColumnName();
   
    hNodeObj.put(JsonKeys.columnName.name(), columnName);
    hNodeObj.put(JsonKeys.columnClass.name(), getColumnClass(hNode.getId()));
    hNodeObj.put(JsonKeys.hNodeId.name(), hNode.getId());
    HNode t = workspace.getFactory().getHNode(hNode.getId());
    if (t.hasNestedTable()) {
      Selection sel = selection.getSelection(t.getNestedTable().getId());
      if (sel != null)
        hNodeObj.put(JsonKeys.status.name(), sel.getStatus().name());
    }
    hNodeObj.put(JsonKeys.hNodeType.name(), t.getHNodeType().name());
    Integer colLength = colMeta.getColumnPreferredLength(hNode.getId());
    if (colLength == null || colLength == 0) {
      hNodeObj.put(JsonKeys.characterLength.name(), WorksheetCleaningUpdate.DEFAULT_COLUMN_LENGTH);
    } else {
      hNodeObj.put(JsonKeys.characterLength.name(), colLength.intValue());
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.