"search for match" links in data table cells now use recon service's entity suggest options.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1041 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
40c5fb8ff1
commit
76c8cd77eb
@ -38,13 +38,13 @@ public class ReconJudgeOneCellCommand extends Command {
|
|||||||
Judgment judgment = Recon.stringToJudgment(request.getParameter("judgment"));
|
Judgment judgment = Recon.stringToJudgment(request.getParameter("judgment"));
|
||||||
|
|
||||||
ReconCandidate match = null;
|
ReconCandidate match = null;
|
||||||
String topicID = request.getParameter("topicID");
|
String id = request.getParameter("id");
|
||||||
if (topicID != null) {
|
if (id != null) {
|
||||||
String scoreString = request.getParameter("score");
|
String scoreString = request.getParameter("score");
|
||||||
|
|
||||||
match = new ReconCandidate(
|
match = new ReconCandidate(
|
||||||
topicID,
|
id,
|
||||||
request.getParameter("topicName"),
|
request.getParameter("name"),
|
||||||
request.getParameter("types").split(","),
|
request.getParameter("types").split(","),
|
||||||
scoreString != null ? Double.parseDouble(scoreString) : 100
|
scoreString != null ? Double.parseDouble(scoreString) : 100
|
||||||
);
|
);
|
||||||
|
@ -23,13 +23,13 @@ public class ReconJudgeSimilarCellsCommand extends EngineDependentCommand {
|
|||||||
Judgment judgment = Recon.stringToJudgment(request.getParameter("judgment"));
|
Judgment judgment = Recon.stringToJudgment(request.getParameter("judgment"));
|
||||||
|
|
||||||
ReconCandidate match = null;
|
ReconCandidate match = null;
|
||||||
String topicID = request.getParameter("topicID");
|
String id = request.getParameter("id");
|
||||||
if (topicID != null) {
|
if (id != null) {
|
||||||
String scoreString = request.getParameter("score");
|
String scoreString = request.getParameter("score");
|
||||||
|
|
||||||
match = new ReconCandidate(
|
match = new ReconCandidate(
|
||||||
topicID,
|
id,
|
||||||
request.getParameter("topicName"),
|
request.getParameter("name"),
|
||||||
request.getParameter("types").split(","),
|
request.getParameter("types").split(","),
|
||||||
scoreString != null ? Double.parseDouble(scoreString) : 100
|
scoreString != null ? Double.parseDouble(scoreString) : 100
|
||||||
);
|
);
|
||||||
|
@ -169,14 +169,28 @@ DataTableCellUI.prototype._render = function() {
|
|||||||
|
|
||||||
$('<span>').text("(New topic)").appendTo(liNew);
|
$('<span>').text("(New topic)").appendTo(liNew);
|
||||||
|
|
||||||
$('<a href="javascript:{}"></a>')
|
if (service) {
|
||||||
.addClass("data-table-recon-search")
|
var suggestOptions;
|
||||||
.click(function(evt) {
|
var addSuggest = false;
|
||||||
self._searchForMatch();
|
|
||||||
return false;
|
if ((service.suggest) && (service.suggest.entity)) {
|
||||||
})
|
suggestOptions = service.suggest.entity;
|
||||||
.text("search for match")
|
addSuggest = true;
|
||||||
.appendTo($('<div>').appendTo(divContent));
|
} else if (ReconciliationManager.isFreebaseId(service.identifierSpace)) {
|
||||||
|
addSuggest = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addSuggest) {
|
||||||
|
$('<a href="javascript:{}"></a>')
|
||||||
|
.addClass("data-table-recon-search")
|
||||||
|
.click(function(evt) {console.log(suggestOptions);
|
||||||
|
self._searchForMatch(suggestOptions);
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
.text("search for match")
|
||||||
|
.appendTo($('<div>').appendTo(divContent));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +250,7 @@ DataTableCellUI.prototype._doJudgmentForSimilarCells = function(judgment, params
|
|||||||
this._postProcessSeveralCells("recon-judge-similar-cells", params, true);
|
this._postProcessSeveralCells("recon-judge-similar-cells", params, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableCellUI.prototype._searchForMatch = function() {
|
DataTableCellUI.prototype._searchForMatch = function(suggestOptions) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var frame = DialogSystem.createDialog();
|
var frame = DialogSystem.createDialog();
|
||||||
frame.width("400px");
|
frame.width("400px");
|
||||||
@ -260,41 +274,28 @@ DataTableCellUI.prototype._searchForMatch = function() {
|
|||||||
var match = null;
|
var match = null;
|
||||||
var commit = function() {
|
var commit = function() {
|
||||||
if (match !== null) {
|
if (match !== null) {
|
||||||
var query = {
|
var params = {
|
||||||
"id" : match.id,
|
judgment: "matched",
|
||||||
"type" : []
|
id: match.id,
|
||||||
|
name: match.name,
|
||||||
|
types: $.map(match.type, function(elmt) {
|
||||||
|
return typeof elmt == "string" ? elmt : elmt.id;
|
||||||
|
}).join(",")
|
||||||
};
|
};
|
||||||
var baseUrl = "http://api.freebase.com/api/service/mqlread";
|
|
||||||
var url = baseUrl + "?" + $.param({ query: JSON.stringify({ query: query }) }) + "&callback=?";
|
|
||||||
|
|
||||||
$.getJSON(
|
if (elmts.checkSimilar[0].checked) {
|
||||||
url,
|
params.similarValue = self._cell.v;
|
||||||
null,
|
params.columnName = Gridworks.cellIndexToColumn(self._cellIndex).name;
|
||||||
function(o) {
|
|
||||||
var types = "result" in o ? o.result.type : [];
|
|
||||||
var params = {
|
|
||||||
judgment: "matched",
|
|
||||||
topicID: match.id,
|
|
||||||
topicGUID: match.guid,
|
|
||||||
topicName: match.name,
|
|
||||||
types: $.map(types, function(elmt) { return elmt.id; }).join(",")
|
|
||||||
};
|
|
||||||
if (elmts.checkSimilar[0].checked) {
|
|
||||||
params.similarValue = self._cell.v;
|
|
||||||
params.columnName = Gridworks.cellIndexToColumn(self._cellIndex).name;
|
|
||||||
|
|
||||||
self._postProcessSeveralCells("recon-judge-similar-cells", params, true);
|
self._postProcessSeveralCells("recon-judge-similar-cells", params, true);
|
||||||
} else {
|
} else {
|
||||||
params.row = self._rowIndex;
|
params.row = self._rowIndex;
|
||||||
params.cell = self._cellIndex;
|
params.cell = self._cellIndex;
|
||||||
|
|
||||||
self._postProcessOneCell("recon-judge-one-cell", params, true);
|
self._postProcessOneCell("recon-judge-one-cell", params, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogSystem.dismissUntil(level - 1);
|
DialogSystem.dismissUntil(level - 1);
|
||||||
},
|
|
||||||
"jsonp"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -307,7 +308,9 @@ DataTableCellUI.prototype._searchForMatch = function() {
|
|||||||
|
|
||||||
elmts.input
|
elmts.input
|
||||||
.attr("value", this._cell.v)
|
.attr("value", this._cell.v)
|
||||||
.suggest({})
|
.suggest(suggestOptions || {
|
||||||
|
all_types: true
|
||||||
|
})
|
||||||
.bind("fb-select", function(e, data) {
|
.bind("fb-select", function(e, data) {
|
||||||
match = data;
|
match = data;
|
||||||
commit();
|
commit();
|
||||||
|
Loading…
Reference in New Issue
Block a user