Package edu.isi.karma.rep

Examples of edu.isi.karma.rep.Worksheet


    return null;
  }
 
  protected Worksheet generateWorksheet(String sourceName, BufferedInputStream is, InputType inputType,
      Workspace workspace, int maxNumLines) throws IOException, KarmaException {
    Worksheet worksheet = null;
    try{
      is.mark(Integer.MAX_VALUE);
      String encoding = null;
      if(inputType == null) {
        Metadata metadata = new Metadata();
View Full Code Here


 
 
  private Worksheet generateWorksheetFromDelimitedStream(String sourceName, InputStream is,
      Workspace workspace, String encoding, int maxNumLines) throws IOException,
      KarmaException, ClassNotFoundException {
    Worksheet worksheet;
    Import fileImport = new CSVImport(1, 2, ',', '\"', encoding, maxNumLines,
        sourceName, is, workspace, null);

    worksheet = fileImport.generateWorksheet();
    return worksheet;
View Full Code Here

  }

  private Worksheet generateWorksheetFromXMLStream(String sourceName, InputStream is,
      Workspace workspace, String encoding, int maxNumLines)
      throws IOException {
    Worksheet worksheet;
    String contents = IOUtils.toString(is, encoding);
    JSONObject json = XML.toJSONObject(contents);
    JsonImport imp = new JsonImport(json, sourceName, workspace, encoding, maxNumLines);
    worksheet = imp.generateWorksheet();
    return worksheet;
View Full Code Here

  }

  private Worksheet generateWorksheetFromJSONStream(String sourceName, InputStream is,
      Workspace workspace, String encoding, int maxNumLines)
      throws IOException {
    Worksheet worksheet;
    Reader reader = EncodingDetector.getInputStreamReader(is, encoding);
    Object json = JSONUtil.createJson(reader);
    JsonImport imp = new JsonImport(json, sourceName, workspace, encoding, maxNumLines);
    worksheet = imp.generateWorksheet();
    return worksheet;
View Full Code Here

    return worksheet;
  }
  private Worksheet generateWorksheetFromAvroStream(String sourceName, InputStream is,
      Workspace workspace, String encoding, int maxNumLines)
      throws IOException, JSONException, KarmaException {
    Worksheet worksheet;
    AvroImport imp = new AvroImport(is, sourceName, workspace, encoding, maxNumLines);
    worksheet = imp.generateWorksheet();
    return worksheet;
  }
View Full Code Here

    return inds;
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet wk = workspace.getWorksheet(worksheetId);
    wk.clearSessionData();
    SuperSelection selection = getSuperSelection(wk);
    String Msg = String.format("begin, Time,%d, Worksheet,%s",
        System.currentTimeMillis(), worksheetId);
    logger.info(Msg);
    // Get the HNode
    HashMap<String, HashMap<String, String>> rows = new HashMap<String, HashMap<String, String>>();
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = wk.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.getLeaf().getId().equals(hNodeId)) {
        selectedPath = path;
      }
    }
    // random nodes
    Collection<Node> nodes = new ArrayList<Node>();
    wk.getDataTable().collectNodes(selectedPath, nodes, selection);
    HashSet<Integer> indSet = this.obtainIndexs(nodes.size());
    int index = 0;
    for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext();) {
      Node node = iterator.next();
      if (indSet.contains(index)) {
View Full Code Here

            }
          fw.close();
          buf.close();
          logger.info("Created : " + fileName + " by worksheet Id : " this.worksheetId) ;
          Import impCSV = new CSVFileImport(1, 2, ',', ' ', "UTF-8", -1, new File(fileName), workspace, null);
          Worksheet wsht = impCSV.generateWorksheet();
          uc = new UpdateContainer();
            uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION));
            new File(fileName).delete();

        } catch (Exception e1) {
          logger.error(e1.getMessage(), e1);
          uc = new UpdateContainer(new ErrorUpdate(e1.getMessage()));
View Full Code Here

            }
          fw.close();
          buf.close();
         
      Import impJson = new JsonImport(new File(fileName), fName, workspace, "UTF-8", -1, null);
            Worksheet wsht = impJson.generateWorksheet();
//            Worksheet wsht2, wsht3;
            logger.info("Creating worksheet with json : " + wsht.getId());
            uc = new UpdateContainer();
            uc.add(new WorksheetListUpdate());
            uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION));
         
          logger.info("Created : " + fileName);
            new File(fileName).delete();

        } catch (Exception e1) {
View Full Code Here

    return CommandType.notInHistory;
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    final String wkName = worksheet.getTitle();
   
   
    String sparqlQuery = "PREFIX km-dev:<http://isi.edu/integration/karma/dev#> " +
        "SELECT ?modelName ?sourceName WHERE " +
        "{ ?x km-dev:modelName ?modelName ." +
View Full Code Here

    return CommandType.notInHistory;
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.getLeaf().getId().equals(hNodeId)) {
        selectedPath = path;
      }
    }
View Full Code Here

TOP

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

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.