Package edu.isi.karma.rep

Examples of edu.isi.karma.rep.Node


      ArrayList<Row> rows = table.getRows(0, table.getNumRows(), selection);
   
        for (Row row : rows) {
          String id = row.getId();
          row.getNode(hNodeId);
          Node node = row.getNeighbor(hNodeId);
          String value = node.getValue().asString();
          JSONObject obj = new JSONObject();
          System.out.println(value);
 
          obj.put("rowId", id);
          obj.put("text", value);
View Full Code Here


  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    RepFactory factory = workspace.getFactory();
    for (String rowID: newRowValueMap.keySet()) {
      Row row = factory.getRow(rowID);
      Node existingNode = row.getNode(hNodeID);
      if (existingNode.hasNestedTable()) {
        logger.error("Existing node has a nested table. Cannot overwrite such node with new value. NodeID: " + existingNode.getId());
        continue;
      }
      String existingCellValue = existingNode.getValue().asString();
      oldRowValueMap.put(rowID, existingCellValue);
      String newCellValue = newRowValueMap.get(rowID);
      row.setValue(hNodeID, newCellValue, factory);
    }
    return WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(this.worksheetId, SuperSelectionManager.DEFAULT_SELECTION);
View Full Code Here

  public UpdateContainer undoIt(Workspace workspace) {
    RepFactory factory = workspace.getFactory();
    for (String rowID: oldRowValueMap.keySet()) {
      Row row = factory.getRow(rowID);
     
      Node existingNode = row.getNode(hNodeID);
      if (existingNode.hasNestedTable()) {
        logger.error("Existing node has a nested table. Cannot overwrite such node with new value. NodeID: " + existingNode.getId());
        continue;
      }
      String oldCellValue = oldRowValueMap.get(rowID);
      row.setValue(hNodeID, oldCellValue, factory);
    }
View Full Code Here

        SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
            simpleFeatureTypeWithCRS);
        featureBuilder.add(JTSGeometry);

        for (String hNodeId : geomHNodeIdList) {
          Node node = row.getNode(hNodeId);
          if (node.hasNestedTable())
            featureBuilder.add("Nested table");
          else {
            String colValue = node.getValue().asString();
            featureBuilder.add(colValue);
          }
        }
        SimpleFeature feature = featureBuilder.buildFeature(null);
        features.add(feature);
View Full Code Here

    List<Table> tables = new ArrayList<Table>();
   
    CloneTableUtils.getDatatable(worksheet.getDataTable(), ht, tables, selection);
    for (Table t : tables) {
      for (Row r : t.getRows(0, t.getNumRows(), selection)) {
        Node newNode = r.getNeighbor(newhNodeId);
        newNode.getNestedTable().removeAllRows();
      }
    }
  }
View Full Code Here

        CSVReader reader = new CSVReader(new StringReader(orgValue),
            delimiterChar);
        String[] rowValues = reader.readNext();
        reader.close();
        if(rowValues != null) {
          Node newNode = r.getNeighbor(newhNodeId);
          for (int i = 0; i < rowValues.length; i++) {
            Row dest = newNode.getNestedTable().addRow(factory);
            Node destNode = dest.getNeighborByColumnName("Values", factory);
            destNode.setValue(rowValues[i], NodeStatus.original, factory);
          }
        }
      }
    }
  }
View Full Code Here

    return previousValue;
  }

  @Override
  public UpdateContainer doIt(Workspace workspace) throws CommandException {
    Node node = workspace.getFactory().getNode(nodeIdArg);
    SuperSelection sel = getSuperSelection(workspace);
    inputColumns.clear();
    outputColumns.clear();
    inputColumns.add(node.getHNodeId());
    outputColumns.add(node.getHNodeId());
    previousValue = node.getValue();
    previousStatus = node.getStatus();
    if (node.hasNestedTable()) {
      throw new CommandException(this, "Cell " + nodeIdArg
          + " has a nested table. It cannot be edited.");
    }   
    node.setValue(newValueArg, Node.NodeStatus.edited,
        workspace.getFactory());
    WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, sel);
    uc.add(new NodeChangedUpdate(worksheetId,
        nodeIdArg, newValueArg, Node.NodeStatus.edited));
View Full Code Here

    return uc;
  }

  @Override
  public UpdateContainer undoIt(Workspace workspace) {
    Node node = workspace.getFactory().getNode(nodeIdArg);
    SuperSelection sel = getSuperSelection(workspace);
    node.setValue(previousValue, previousStatus, workspace.getFactory());
    UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, sel);
    uc.add(new NodeChangedUpdate(worksheetId,
        nodeIdArg, previousValue, previousStatus));
    return uc;
  }
View Full Code Here

    Worksheet worksheet = factory.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    boolean flag = true;
    if (table != null) {
      for (Row r : table.getRows(0, table.getNumRows(), selection)) {
        Node n = r.getNeighbor(node.getHNodeId());
        if (n.getValue() != null && n.getValue().asString().compareTo(value) == 0) {
          flag = false;
          break;
        }
      }
    }
View Full Code Here

    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);
        if(n != null && n.getValue() != null && !n.getValue().isEmptyValue() && n.getValue().asString() != null && !n.getValue().asString().trim().isEmpty() ) {
          String value = n.getValue().asString().trim().replace(" ", "");
          String baseURI = worksheet.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.baseURI);
          try {
            URI uri = new URI(value);
            if (!uri.isAbsolute() && baseURI != null) {
              value = baseURI + value;
View Full Code Here

TOP

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

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.