From b8ad56c6db4baca02c764290c06e0a2a18d0a420 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Thu, 5 Aug 2010 00:53:08 +0000 Subject: [PATCH] Made sure in the schema skeleton dialog, in the dialog box for a node, in the "cell-as-topic" section, the type is always recorded. In the triple loader transposed node factory, use the column's recon config to generate new topics' type. git-svn-id: http://google-refine.googlecode.com/svn/trunk@1135 7d457c2a-affb-35e4-300a-418c747d4874 --- .../protograph/transpose/Transposer.java | 36 ++++++++++--------- .../TripleLoaderTransposedNodeFactory.java | 10 +++++- .../protograph/schema-alignment-ui-node.js | 24 ++++++------- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/main/src/com/google/gridworks/protograph/transpose/Transposer.java b/main/src/com/google/gridworks/protograph/transpose/Transposer.java index 46f74c6b9..642e83621 100644 --- a/main/src/com/google/gridworks/protograph/transpose/Transposer.java +++ b/main/src/com/google/gridworks/protograph/transpose/Transposer.java @@ -105,25 +105,27 @@ public class Transposer { if (node instanceof CellNode) { CellNode node2 = (CellNode) node; Column column = project.columnModel.getColumnByName(node2.columnName); - Cell cell = row.getCell(column.getCellIndex()); - if (cell != null && ExpressionUtils.isNonBlankData(cell.value)) { - if (node2 instanceof CellTopicNode && - (cell.recon == null || cell.recon.judgment == Judgment.None)) { + if (column != null) { + Cell cell = row.getCell(column.getCellIndex()); + if (cell != null && ExpressionUtils.isNonBlankData(cell.value)) { + if (node2 instanceof CellTopicNode && + (cell.recon == null || cell.recon.judgment == Judgment.None)) { + return; + } + + context.count++; + if (context.limit > 0 && context.count > context.limit) { return; + } + + tnode = nodeFactory.transposeCellNode( + parentNode, + link, + node2, + rowIndex, + cell + ); } - - context.count++; - if (context.limit > 0 && context.count > context.limit) { - return; - } - - tnode = nodeFactory.transposeCellNode( - parentNode, - link, - node2, - rowIndex, - cell - ); } } else { if (node instanceof AnonymousNode) { diff --git a/main/src/com/google/gridworks/protograph/transpose/TripleLoaderTransposedNodeFactory.java b/main/src/com/google/gridworks/protograph/transpose/TripleLoaderTransposedNodeFactory.java index c37c66bef..61722e78b 100644 --- a/main/src/com/google/gridworks/protograph/transpose/TripleLoaderTransposedNodeFactory.java +++ b/main/src/com/google/gridworks/protograph/transpose/TripleLoaderTransposedNodeFactory.java @@ -360,7 +360,15 @@ public class TripleLoaderTransposedNodeFactory implements TransposedNodeFactory id = "$" + node.columnName.replaceAll("\\W+", "_") + "_" + var; - writeLine(id, "type", node.type.id, project, rowIndex, cellIndex, cell, -1, -1, (Cell) null, !load); + String typeID = node.type.id; + + Column column = project.columnModel.getColumnByName(node.columnName); + ReconConfig reconConfig = column.getReconConfig(); + if (reconConfig instanceof StandardReconConfig) { + typeID = ((StandardReconConfig) reconConfig).typeID; + } + + writeLine(id, "type", typeID, project, rowIndex, cellIndex, cell, -1, -1, (Cell) null, !load); writeLine(id, "name", cell.value, project, -1, -1, (Cell) null, -1, -1, (Cell) null, !load); if (cell.recon != null) { diff --git a/main/webapp/modules/core/scripts/protograph/schema-alignment-ui-node.js b/main/webapp/modules/core/scripts/protograph/schema-alignment-ui-node.js index f2c0da273..91334c5fe 100644 --- a/main/webapp/modules/core/scripts/protograph/schema-alignment-ui-node.js +++ b/main/webapp/modules/core/scripts/protograph/schema-alignment-ui-node.js @@ -542,21 +542,17 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() { node.columnName = $("input[name='schema-align-node-dialog-column']:checked")[0].value; if (node.nodeType == "cell-as-topic") { - if (elmts.radioNodeTypeCellAsTopicCreate[0].checked) { - node.createForNoReconMatch = true; - - var t = elmts.cellAsTopicNodeTypeInput.data("data.suggest"); - if (!(t)) { - alert("For creating a new graph node, you need to specify a type for it."); - return null; - } - node.type = { - id: t.id, - name: t.name - }; - } else { - node.createForNoReconMatch = false; + node.createForNoReconMatch = elmts.radioNodeTypeCellAsTopicCreate[0].checked; + + var t = elmts.cellAsTopicNodeTypeInput.data("data.suggest"); + if (!(t) && node.createForNoReconMatch) { + alert("For creating a new graph node, you need to specify a type for it."); + return null; } + node.type = { + id: t.id, + name: t.name + }; } else if (node.nodeType == "cell-as-value") { node.valueType = elmts.cellAsValueTypeSelect[0].value;