Added options for omitting error and blank choices in list facets, and use them in the various recon facets.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@227 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-07 22:54:02 +00:00
parent 694f09fb0a
commit 80e6111a92
4 changed files with 27 additions and 15 deletions

View File

@ -16,17 +16,23 @@ import com.metaweb.gridworks.browsing.filters.RowFilter;
import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser;
import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.util.JSONUtilities;
public class ListFacet implements Facet {
protected List<NominalFacetChoice> _selection = new LinkedList<NominalFacetChoice>();
// If true, then facet won't show the blank and error choices
protected boolean _omitBlank;
protected boolean _omitError;
protected boolean _selectBlank;
protected boolean _selectError;
protected String _name;
protected String _expression;
protected String _columnName;
protected String _columnName;
protected int _cellIndex;
protected Evaluable _eval;
protected Evaluable _eval;
// computed
protected List<NominalFacetChoice> _choices = new LinkedList<NominalFacetChoice>();
@ -50,14 +56,14 @@ public class ListFacet implements Facet {
}
writer.endArray();
if (_selectBlank || _blankCount > 0) {
if (!_omitBlank && (_selectBlank || _blankCount > 0)) {
writer.key("blankChoice");
writer.object();
writer.key("s"); writer.value(_selectBlank);
writer.key("c"); writer.value(_blankCount);
writer.endObject();
}
if (_selectError || _errorCount > 0) {
if (!_omitError && (_selectError || _errorCount > 0)) {
writer.key("errorChoice");
writer.object();
writer.key("s"); writer.value(_selectError);
@ -98,12 +104,11 @@ public class ListFacet implements Facet {
_selection.add(nominalFacetChoice);
}
if (o.has("selectBlank")) {
_selectBlank = o.getBoolean("selectBlank");
}
if (o.has("selectError")) {
_selectError = o.getBoolean("selectError");
}
_omitBlank = JSONUtilities.getBoolean(o, "omitBlank", false);
_omitError = JSONUtilities.getBoolean(o, "omitError", false);
_selectBlank = JSONUtilities.getBoolean(o, "selectBlank", false);
_selectError = JSONUtilities.getBoolean(o, "selectError", false);
}
public RowFilter getRowFilter() {

View File

@ -30,7 +30,7 @@ import com.metaweb.gridworks.process.LongRunningProcess;
import com.metaweb.gridworks.process.Process;
public class ReconOperation extends EngineDependentOperation {
final protected String _columnName;
final protected String _columnName;
final protected ReconConfig _reconConfig;
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
@ -130,6 +130,7 @@ public class ReconOperation extends EngineDependentOperation {
writer.key("name"); writer.value(_columnName + ": judgment");
writer.key("columnName"); writer.value(_columnName);
writer.key("expression"); writer.value("cell.recon.judgment");
writer.key("omitError"); writer.value(true);
writer.endObject();
writer.key("facetOptions");
writer.object();

View File

@ -38,6 +38,8 @@ ListFacet.prototype.getJSON = function() {
name: this._config.name,
columnName: this._config.columnName,
expression: this._config.expression,
omitBlank: "omitBlank" in this._config ? this._config.omitBlank : false,
omitError: "omitError" in this._config ? this._config.omitError : false,
selection: [],
selectBlank: this._blankChoice != null && this._blankChoice.s,
selectError: this._errorChoice != null && this._errorChoice.s

View File

@ -301,7 +301,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
{
"name" : self._column.name + ": judgment",
"columnName" : self._column.name,
"expression" : "cell.recon.judgment"
"expression" : "cell.recon.judgment",
"omitError" : true
},
{
"scroll" : false
@ -334,7 +335,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
{
"name" : self._column.name + ": best candidate's type match",
"columnName" : self._column.name,
"expression" : "cell.recon.features.typeMatch"
"expression" : "cell.recon.features.typeMatch",
"omitError" : true
},
{
"scroll" : false
@ -350,7 +352,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
{
"name" : self._column.name + ": best candidate's name match",
"columnName" : self._column.name,
"expression" : "cell.recon.features.nameMatch"
"expression" : "cell.recon.features.nameMatch",
"omitError" : true
},
{
"scroll" : false
@ -400,7 +403,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
{
"name" : self._column.name + ": best candidate's types",
"columnName" : self._column.name,
"expression" : "cell.recon.best.type"
"expression" : "cell.recon.best.type",
"omitError" : true
}
);
}