Examples of HNode


Examples of edu.isi.karma.rep.HNode

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

Examples of edu.isi.karma.rep.HNode

    return flag;
  }

  @SuppressWarnings("unchecked")
  private boolean addJSONObjectValues(JSONObject obj, Worksheet worksheet, HTable htable, RepFactory factory, Row row, String newHNodeId) {
    HNode ndid = htable.getHNode(newHNodeId);
    HTable nestedHTable = ndid.getNestedTable();
    if (nestedHTable == null)
      nestedHTable = ndid.addNestedTable("Table for test",
          worksheet, factory);
    Table nestedTable = row.getNode(newHNodeId).getNestedTable();
    Row r = nestedTable.addRow(factory);
    boolean flag = false;
    for (Object key : new TreeSet<Object>(obj.keySet())) {
      Object value = obj.get(key.toString());
      HNode h = nestedHTable.getHNodeFromColumnName(key.toString());
      if ( h == null) {   
        h = nestedHTable.addHNode(key.toString(), type, worksheet, factory);
      }
      outputColumns.add(h.getId());
      //
      if (value instanceof String)
        flag |= addValues(r.getNode(h.getId()), (String)value, factory, nestedTable);
      if (value instanceof JSONObject)
        flag |= addJSONObjectValues((JSONObject)value, worksheet, nestedHTable, factory, r, h.getId());
      if (value instanceof JSONArray)
        flag |= addJSONArrayValues((JSONArray) value, worksheet, nestedHTable, factory,r, h.getId());
    }
    if (!flag)
      nestedTable.removeRow(r);
    return flag;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    for (String hNodeId:hNodeToContextUriMap.keySet()) {
      getColumnContextTriples(hNodeId);


      // Generate wasDerivedFrom property if required
      HNode hNode = factory.getHNode(hNodeId);
      if (hNode.isDerivedFromAnotherColumn()) {
        HNode originalHNode = factory.getHNode(hNode.getOriginalColumnHNodeId());
        if (originalHNode != null) {
          getColumnContextTriples(originalHNode.getId());

          for(KR2RMLRDFWriter outWriter : outWriters)
          {
            outWriter.outputTripleWithURIObject(
                hNodeToContextUriMap.get(hNodeId), Uris.PROV_WAS_DERIVED_FROM_URI,
                getColumnContextUri(originalHNode.getId()));
          }

        }
      }
    }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

      outWriter.outputTripleWithURIObject("<" + colUri + ">", Uris.RDF_TYPE_URI,
          "<" + Uris.PROV_ENTITY_URI + ">");


      // Generate the label
      HNode hNode = factory.getHNode(hNodeId);
      outWriter.outputTripleWithLiteralObject("<" + colUri + ">", Uris.RDFS_LABEL_URI,
          hNode.getColumnName(), "");
    }

  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

      AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
    }
 
//    List<HNodePath> paths = new ArrayList<>();
    for (HNodePath path : worksheet.getHeaders().getAllPaths()) {
      HNode node = path.getLeaf();
      String hNodeId = node.getId();
      Node n = alignment.getNodeById(hNodeId);
      if (n == null) {
//        paths.add(path);
        alignment.addColumnNode(hNodeId, node.getColumnName(), null);
//      } else if (n instanceof ColumnNode) {
//        ColumnNode c =  ((ColumnNode)n);
//        if (c.getSuggestedSemanticTypes() == null || c.getSuggestedSemanticTypes().isEmpty())
//          paths.add(path);
      }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

 
  public static Map<String, String> cloneHTable(HTable oldht, HTable newht, Worksheet newws, RepFactory factory, List<HNode> hnodes, SuperSelection sel) {
    Collections.sort(hnodes);
    Map<String, String> tmp = new HashMap<String, String>();
    for (HNode hnode : hnodes) {
      HNode newhnode = null;
      if (newht.getHNodeFromColumnName(hnode.getColumnName()) == null)
        newhnode = newht.addHNode(hnode.getColumnName(), HNodeType.Transformation, newws, factory);
      else
        newhnode = newht.addHNode(newht.getNewColumnName(hnode.getColumnName()), HNodeType.Transformation, newws, factory);
      tmp.put(hnode.getId(), newhnode.getId());
      if (hnode.hasNestedTable()) {
        HTable oldnested = hnode.getNestedTable();
        HTable newnested = newhnode.addNestedTable(hnode.getNestedTable().getTableName(), newws, factory);   
        tmp.putAll(cloneHTable(oldnested, newnested, newws, factory, new ArrayList<HNode>(oldnested.getHNodes()), sel));
      }
    }
    return tmp;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

  }

  public static Row cloneDataTable(Row oldRow, Table newDataTable, HTable oldHTable, HTable newHTable, List<HNode> hnodes, RepFactory factory, SuperSelection sel) {
    Row newrow = newDataTable.addRow(factory);
    for (HNode hnode : hnodes) {
      HNode newHNode = newHTable.getHNodeFromColumnName(hnode.getColumnName());
      if (newHNode == null)
        continue;
     
      Node oldNode = oldRow.getNode(hnode.getId());
      Node newNode = newrow.getNode(newHNode.getId());
      if (oldNode == null)
        continue;
      if (!oldNode.hasNestedTable()) {
        newNode.setValue(oldNode.getValue(), oldNode.getStatus(), factory);
      }
      else {         
        cloneDataTable(oldNode.getNestedTable(), newNode.getNestedTable(), hnode.getNestedTable(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
      }
    }
    return newrow;
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    return newrow;
  }
 
  public static void cloneDataTableExistingRow(Row oldRow, Row newRow, Table newDataTable, HTable oldHTable, HTable newHTable, List<HNode> hnodes, RepFactory factory, Map<String, String> mapping, SuperSelection sel) {
    for (HNode hnode : hnodes) {
      HNode newHNode = factory.getHNode(mapping.get(hnode.getId()));
      Node oldNode = oldRow.getNode(hnode.getId());
      Node newNode = newRow.getNode(newHNode.getId());
      if (oldNode == null)
        continue;
      if (!oldNode.hasNestedTable()) {
        newNode.setValue(oldNode.getValue(), oldNode.getStatus(), factory);
      }
      else {         
        cloneDataTable(oldNode.getNestedTable(), newNode.getNestedTable(), hnode.getNestedTable(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
      }
    }
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

  public static void cloneDataTable(Table oldDataTable, Table newDataTable, HTable oldHTable, HTable newHTable, List<HNode> hnodes, RepFactory factory, SuperSelection sel) {
    ArrayList<Row> rows = oldDataTable.getRows(0, oldDataTable.getNumRows(), sel);
    for (Row row : rows) {
      Row newrow = newDataTable.addRow(factory);
      for (HNode hnode : hnodes) {
        HNode newHNode = newHTable.getHNodeFromColumnName(hnode.getColumnName());
        Node oldNode = row.getNode(hnode.getId());
        Node newNode = newrow.getNode(newHNode.getId());
        if (!oldNode.hasNestedTable()) {
          newNode.setValue(oldNode.getValue(), oldNode.getStatus(), factory);
        }
        else {         
          cloneDataTable(oldNode.getNestedTable(), newNode.getNestedTable(), hnode.getNestedTable(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
        }
      }
    }
  }
View Full Code Here

Examples of edu.isi.karma.rep.HNode

    outputColumns.clear();
    inputColumns.add(hNodeId);
    outputColumns.add(hNodeId);
    logCommand(logger, workspace);
    try {
      HNode hn = workspace.getFactory().getHNode(hNodeId);
      labelName = hn.getColumnName();
    }catch(Exception e) {
     
    }
    /*** Get the Alignment for this worksheet ***/
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
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.