Examples of HNodePath


Examples of edu.isi.karma.rep.HNodePath

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    // TODO Auto-generated method stub
    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;
      }
    }
    Collection<Node> nodes = new ArrayList<Node>();
    workspace.getFactory().getWorksheet(worksheetId).getDataTable()
        .collectNodes(selectedPath, nodes, selection);

   
    try {
      JSONArray requestJsonArray = new JSONArray()
      for (Node node : nodes) {
       
        String originalVal = node.getValue().asString();
        originalVal = originalVal == null ? "" : originalVal;
         requestJsonArray.put(originalVal);
      }
     
      JSONObject json =  new JSONObject(worksheet.getJsonAnnotation().toString());

      String mainId = json.getString("id");
      String mainWorksheetId = json.getString("worksheetId");
      String mainHNodeId = json.getString("hNodeId");
     
     
      Worksheet mainWorksheet = workspace.getWorksheet(mainWorksheetId);

      HNodePath mainSelectedPath = null;
      List<HNodePath> mainColumnPaths = mainWorksheet.getHeaders().getAllPaths();
      for (HNodePath path : mainColumnPaths) {
        if (path.getLeaf().getId().equals(mainHNodeId)) {
          mainSelectedPath = path;
        }
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    uc.add(new AbstractUpdate() {

      @Override
      public void generateJson(String prefix, PrintWriter pw,
          VWorkspace vWorkspace) {
        HNodePath currentColumnPath = null;
        Worksheet worksheet = workspace.getWorksheet(worksheetId);
        List<HNodePath> paths = worksheet.getHeaders().getAllPaths();
        for (HNodePath path : paths) {
          if (path.getLeaf().getId().equals(hNodeId)) {
            currentColumnPath = path;
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    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;
      }
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

  @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

Examples of edu.isi.karma.rep.HNodePath

    return ndid;
  }

  private void populateRowsWithDefaultValues(Worksheet worksheet, RepFactory factory, JSONArray array, HTable htable) {
    SuperSelection selection = getSuperSelection(worksheet);
    HNodePath selectedPath = null;
    List<HNodePath> columnPaths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : columnPaths) {
      if (path.contains(factory.getHNode(newHNodeId))) { 
        if (path.getLeaf().getId().compareTo(newHNodeId) != 0) {
          HNodePath hp = new HNodePath();
          HNode hn = path.getFirst();
          while (hn.getId().compareTo(newHNodeId) != 0) {
            hp.addHNode(hn);
            path = path.getRest();
            hn = path.getFirst();
          }
          hp.addHNode(hn);
          selectedPath = hp;
        }
        else
          selectedPath = path;
      }
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    TemplateTermSetPopulatorStrategy {

  private HNodePath relativePath;
  public DynamicTemplateTermSetPopulatorStrategy(HNodePath targetPath, HNodePath parentPath)
  {
    relativePath = new HNodePath();
    relativePath = HNodePath.findPathBetweenLeavesWithCommonHead(parentPath, targetPath);
   
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    }
    return subset;
  }
 
  public void trainOnColumn(Workspace workspace, Worksheet worksheet, SemanticType newType, SuperSelection sel) {
    HNodePath currentColumnPath = null;
    List<HNodePath> paths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : paths) {
      if (path.getLeaf().getId().equals(newType.getHNodeId())) {
        currentColumnPath = path;
        break;
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    String label = newType.getModelLabelString();
    modelHandler.addType(label, examples);
  }
 
  public SemanticTypeColumnModel predictColumnSemanticType(Workspace workspace, Worksheet worksheet, String hNodeId, int numSuggestions, SuperSelection sel) {
    HNodePath currentColumnPath = null;
    List<HNodePath> paths = worksheet.getHeaders().getAllPaths();
    for (HNodePath path : paths) {
      if (path.getLeaf().getId().equals(hNodeId)) {
        currentColumnPath = path;
        break;
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    }
  }

  @Override
  public boolean isValidFor(HNodePath a, HNodePath b) {
    HNodePath commonPath = HNodePath.findCommon(a, b);
    if(commonPath.length() == a.length() && b.length() > a.length())
    {
      return true;
    }
    return false;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNodePath

    return -1;
  }

  @Override
  public boolean isValidFor(HNodePath a, HNodePath b) {
    HNodePath commonPath = HNodePath.findCommon(a, b);
    if(commonPath == null)
      return false;
    int commonPathLength = commonPath.length();
    return commonPathLength +1 == a.length() && commonPathLength +1 == b.length();
  }
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.