Package edu.isi.karma.rep

Examples of edu.isi.karma.rep.HTable


    rdfGen.generateRDF(false);
  }
 
  private List<String> addHeaders (Worksheet wk, List<String> columnNames,
      RepFactory factory) {
    HTable headers = wk.getHeaders();
    ArrayList<String> headersList = new ArrayList<String>();
        for(int i=0; i< columnNames.size(); i++){
          HNode hNode = null;
          hNode = headers.addHNode(columnNames.get(i), HNodeType.Regular, wk, factory);
          headersList.add(hNode.getId());
        }
        return headersList;
  }
View Full Code Here


    ArrayList<VHNode> vNodes = new ArrayList<>();
    for(String hNodeId : table.getOrderedNodeIds()) {
      HNode node = table.getHNode(hNodeId);
      VHNode vNode = new VHNode(node.getId(), node.getColumnName());
      if(node.hasNestedTable()) {
        HTable nestedTable = node.getNestedTable();
        ArrayList<VHNode> nestedNodes = initHeaderViewNodes(nestedTable);
        for(VHNode nestedVNode : nestedNodes) {
          vNode.addNestedNode(nestedVNode);
        }
      }
View Full Code Here

    updateRows(table.getValues(), table.getRowIds(), worksheet, factory, oldHNodeIdList, hNodeIdList, dataTable, sel);

  }
 
  private static List<String> addHeaders(List<Attribute> tableHeader, Worksheet worksheet, RepFactory factory) {
    HTable headers = worksheet.getHeaders();
    List<String> headersList = new ArrayList<String>();
   
    for (int i = 0; i < tableHeader.size(); i++) {
      Attribute att = tableHeader.get(i);
      HNode hNode = headers.addHNode(att.getName(), HNodeType.Regular, worksheet, factory);
      headersList.add(hNode.getId());
     
      // very important
      // update the hNodeId of the input/output attributes
      att.sethNodeId(hNode.getId());
View Full Code Here

        return new BufferedReader(isr);
  }

    private Map<Integer, String> addHeaders(Worksheet worksheet, RepFactory fac,
            String line, BufferedReader br) throws IOException {
        HTable headers = worksheet.getHeaders();
        Map<Integer, String> headersMap = new HashMap<Integer, String>();
        CSVReader reader = new CSVReader(new StringReader(line), delimiter,
                quoteCharacter, escapeCharacter);
        String[] rowValues = null;
        rowValues = reader.readNext();

        if (rowValues == null || rowValues.length == 0) {
            reader.close();
            return addEmptyHeaders(worksheet, fac, br);
        }

        for (int i = 0; i < rowValues.length; i++) {
            HNode hNode = null;
            if (headerRowIndex == 0) {
              if (isVisible("Column_" + (i + 1)))
                hNode = headers.addHNode("Column_" + (i + 1), HNodeType.Regular, worksheet, fac);
            } else {
              if (isVisible(rowValues[i]))
                hNode = headers.addHNode(rowValues[i], HNodeType.Regular, worksheet, fac);
            }
            if (hNode != null)
              headersMap.put(i, hNode.getId());
        }
        reader.close();
View Full Code Here

        reader.close();
        return true;
    }
    private Map<Integer, String> addEmptyHeaders(Worksheet worksheet,
            RepFactory fac, BufferedReader br) throws IOException {
        HTable headers = worksheet.getHeaders();
        Map<Integer, String> headersMap = new HashMap<Integer, String>();

       
        br.mark(1000000);
        br.readLine();
       
        // Use the first data row to count the number of columns we need to add
        int rowCount = 0;
        String line = null;
        while (null != (line = br.readLine())) {
            if (rowCount + 1 == dataStartRowIndex) {
                line = br.readLine();
                CSVReader reader = new CSVReader(new StringReader(line),
                        delimiter, quoteCharacter, escapeCharacter);
                String[] rowValues = null;
                try {
                    rowValues = reader.readNext();
                } catch (IOException e) {
                    logger.error("Error reading Line:" + line, e);
                }
                for (int i = 0; i < rowValues.length; i++) {
                 
                    HNode hNode = null;
                    if (isVisible("Column_" + (i + 1)))
                      hNode = headers.addHNode("Column_" + (i + 1), HNodeType.Regular,
                            worksheet, fac);
                    if (hNode != null)
                      headersMap.put(i, hNode.getId());
                }
                reader.close();
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.