本文整理了Java中edu.isi.karma.rep.Node.getValue()
方法的一些代码示例,展示了Node.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getValue()
方法的具体详情如下:
包路径:edu.isi.karma.rep.Node
类名称:Node
方法名:getValue
暂无
代码示例来源:origin: usc-isi-i2/Web-Karma
public static String getHashValue(Worksheet worksheet, String NodeId, RepFactory factory) {
Node node = factory.getNode(NodeId);
if (node != null) {
return DigestUtils.shaHex(node.getValue().asString());
}
return null;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
String value = rows.get(i).getNode(hNodeId).getValue().asString().trim();
代码示例来源:origin: usc-isi-i2/Web-Karma
HashMap<String, String> vals = new HashMap<>();
for (Node n : r.getNodes()) {
vals.put(n.getHNodeId(), n.getValue().asString());
代码示例来源:origin: usc-isi-i2/Web-Karma
@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
RepFactory factory = workspace.getFactory();
for (Map.Entry<String, String> stringStringEntry : newRowValueMap.entrySet()) {
Row row = factory.getRow(stringStringEntry.getKey());
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(stringStringEntry.getKey(), existingCellValue);
String newCellValue = stringStringEntry.getValue();
row.setValue(hNodeID, newCellValue, factory);
}
return WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(this.worksheetId, SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId());
}
代码示例来源:origin: usc-isi-i2/Web-Karma
if(columnName == null || columnName.length() == 0)
continue;
nodeObj.put(columnName, rowNode.getValue().asString());
String str = nodeObj.toString();
pw.print(rowSep);
代码示例来源:origin: usc-isi-i2/Web-Karma
private boolean addValues(Node node, String value, RepFactory factory, Table table) {
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;
}
}
}
if (flag)
node.setValue(value, NodeStatus.original, factory);
return flag;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
String nodeVal = node.getValue().asString();
if (nodeVal != null && !nodeVal.equals("")) {
examples.add(nodeVal);
代码示例来源:origin: usc-isi-i2/Web-Karma
private void populatePolygons(List<String> coordinateHNodeIds,
ArrayList<Row> rows, Map<String, String> columnNameMap) {
for (Row row : rows) {
try {
String posList = row.getNode(coordinateHNodeIds.get(0))
.getValue().asString();
WKTReader reader = new WKTReader();
Polygon JTSPolygon = (Polygon)reader.read(posList);
if(JTSPolygon == null) continue;
polygons.add(JTSPolygon);
FeatureTable featureTable = new FeatureTable();
Collection<Node> nodes = row.getNodes();
for (Node node : nodes) {
if (!(coordinateHNodeIds.contains(node.getHNodeId()))
&& !(node.hasNestedTable())) {
featureTable.addColumnToDescription(columnNameMap.get(node
.getHNodeId()), node.getValue().asString());
}
}
polygonTable.add(featureTable);
} catch (Exception e) {
logger.error("Error creating line! Skipping it.", e);
continue;
}
}
}
private void populateLines(List<String> coordinateHNodeIds,
代码示例来源:origin: usc-isi-i2/Web-Karma
protected Map<String, String> gatherTransformedResults(Workspace workspace, String hNodeId) {
Map<String, String> rowToValueMapping = new HashMap<>();
HNodePath hNodePath = workspace.getFactory().getHNode(hNodeId).getHNodePath(workspace.getFactory());
List<Node> nodes = new ArrayList<>();
workspace.getWorksheet(worksheetId).getDataTable().collectNodes(hNodePath, nodes, getSuperSelection(workspace));
for (Node node : nodes) {
rowToValueMapping.put(node.getBelongsToRow().getId(), node.getValue().asString());
node.clearValue(NodeStatus.original);
affectedNodes.add(node);
}
return rowToValueMapping;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
public static Object cloneNodeToJSON(HNode hNode, Node node, SuperSelection sel) {
if (node.hasNestedTable()) {
HTable nestHT = hNode.getNestedTable();
Table dataTable = node.getNestedTable();
JSONArray array = new JSONArray();
for (Row row : dataTable.getRows(0, dataTable.getNumRows(), sel)) {
JSONObject obj = new JSONObject();
for (HNode hnode : nestHT.getHNodes()) {
Node n = row.getNode(hnode.getId());
obj.put(hnode.getColumnName(),cloneNodeToJSON(hnode, n, sel));
}
array.put(obj);
}
return array;
}
else
return node.getValue().asString();
}
代码示例来源:origin: usc-isi-i2/Web-Karma
public void addNestedTableToDataTable(HNode hNode, Table table,
RepFactory factory) {
Node node = getNode(hNode.getId());
if (node != null) {
// This table does contain this hNode.
Table nestedTable = factory.createTable(hNode.getNestedTable()
.getId(), getWorksheetId());
node.setNestedTable(nestedTable, factory);
// If the node has a value, we have to move the value to the
// nestedTable given that we cannot have both.
if (!node.getValue().isEmptyValue()) {
logger.info("While adding nested table, found that column '"
+ factory.getColumnName(hNode.getId())
+ "' has a value: '" + node.getValue().asString()
+ "'.");
logger.info("Emptying value in node and trying to move it to the nested table.");
nestedTable.addOrphanValue(node.getValue(), node.getHNodeId(),
factory);
}
} else {
// The node may be in one of the nested tables. We have to look for
// it.
for (Node n : nodes.values()) {
Table nestedTable = n.getNestedTable();
if (nestedTable != null) {
nestedTable.addNestedTableToDataTable(hNode, factory);
}
}
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private static void computeHashValue(Row row, List<String> HNodeIds) {
for (String HNodeid : HNodeIds) {
Node n = row.getNode(HNodeid);
if (n.hasNestedTable()) {
Table nestedTable = n.getNestedTable();
for (Row nestedRow : nestedTable.getRows(0, nestedTable.getNumRows(), SuperSelectionManager.DEFAULT_SELECTION)) {
List<String> ids = new ArrayList<>();
for (Node node : nestedRow.getNodes()) {
ids.add(node.getHNodeId());
}
computeHashValue(nestedRow, ids);
}
}
else {
Map<String, String> tmp = hashTable.get(row.getId());
if (tmp == null)
tmp = new ConcurrentHashMap<>();
String value = n.getValue().asString();
value = DigestUtils.shaHex(value);
tmp.put(n.getId(), value);
hashTable.put(row.getId(), tmp);
}
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
public Object serializeToJSON(SuperSelection selection, RepFactory factory) {
if (this.hasNestedTable()) {
JSONArray array = new JSONArray();
Table t = this.getNestedTable();
HTable ht = factory.getHTable(t.getHTableId());
for (Row r : t.getRows(0, t.getNumRows(), selection)) {
JSONObject obj = new JSONObject();
for (HNode hNode : ht.getHNodes()) {
obj.put(hNode.getColumnName(), r.getNeighbor(hNode.getId()).serializeToJSON(selection, factory));
}
array.put(obj);
}
return array;
}
else {
return this.getValue().asString();
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
try {
String posList = row.getNode(coordinateHNodeIds.get(0))
.getValue().asString();
&& !(node.hasNestedTable())) {
line.addColumnToDescription(columnNameMap.get(node
.getHNodeId()), node.getValue().asString());
代码示例来源:origin: usc-isi-i2/Web-Karma
String nodeVal = rowNode.getValue().asString();
nodeVal = (nodeVal == null) ? "" : nodeVal;
String displayVal = (nodeVal.length() > maxDataDisplayLength)
代码示例来源:origin: usc-isi-i2/Web-Karma
@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, workspace.getContextId());
uc.add(new NodeChangedUpdate(worksheetId,
nodeIdArg, newValueArg, Node.NodeStatus.edited));
return uc;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
for (Table t : tables) {
for (Row r : t.getRows(0, t.getNumRows(), selection)) {
String orgValue = r.getNeighbor(hNodeId).getValue().asString();
String[] rowValues;
int startIndex = 0;
代码示例来源:origin: usc-isi-i2/Web-Karma
public static void cloneDataTableExistingRow(Row oldRow, Row newRow, 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(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
}
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
public static Row cloneDataTable(Row oldRow, Table newDataTable, 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(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
}
}
return newRow;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
public static void cloneDataTable(Table oldDataTable, Table newDataTable, 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(), newHNode.getNestedTable(), hnode.getNestedTable().getSortedHNodes(), factory, sel);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!