Made extend data from freebase command available on columns not officially reconciled, since some columns might contain reconciled data copied from other columns.
More error checking in the extend data utility. git-svn-id: http://google-refine.googlecode.com/svn/trunk@583 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
d303adc48e
commit
9641f28fe0
@ -61,6 +61,10 @@ public class PreviewExtendDataCommand extends Command {
|
|||||||
topicNames.add(cell.recon.match.topicName);
|
topicNames.add(cell.recon.match.topicName);
|
||||||
topicGuids.add(cell.recon.match.topicGUID);
|
topicGuids.add(cell.recon.match.topicGUID);
|
||||||
guids.add(cell.recon.match.topicGUID);
|
guids.add(cell.recon.match.topicGUID);
|
||||||
|
} else {
|
||||||
|
topicNames.add(null);
|
||||||
|
topicGuids.add(null);
|
||||||
|
guids.add(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +105,7 @@ public class PreviewExtendDataCommand extends Command {
|
|||||||
String guid = topicGuids.get(r);
|
String guid = topicGuids.get(r);
|
||||||
String topicName = topicNames.get(r);
|
String topicName = topicNames.get(r);
|
||||||
|
|
||||||
if (map.containsKey(guid)) {
|
if (guid != null && map.containsKey(guid)) {
|
||||||
DataExtension ext = map.get(guid);
|
DataExtension ext = map.get(guid);
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
|
|
||||||
@ -134,7 +138,14 @@ public class PreviewExtendDataCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer.array();
|
writer.array();
|
||||||
writer.value(topicName);
|
if (guid != null) {
|
||||||
|
writer.object();
|
||||||
|
writer.key("id"); writer.value("/guid/" + guid.substring(1));
|
||||||
|
writer.key("name"); writer.value(topicName);
|
||||||
|
writer.endObject();
|
||||||
|
} else {
|
||||||
|
writer.value("<not reconciled>");
|
||||||
|
}
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
}
|
}
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
|
@ -70,6 +70,7 @@ public class FreebaseDataExtensionJob {
|
|||||||
JSONObject o = ParsingUtilities.evaluateJsonStringToObject(s);
|
JSONObject o = ParsingUtilities.evaluateJsonStringToObject(s);
|
||||||
|
|
||||||
Map<String, FreebaseDataExtensionJob.DataExtension> map = new HashMap<String, FreebaseDataExtensionJob.DataExtension>();
|
Map<String, FreebaseDataExtensionJob.DataExtension> map = new HashMap<String, FreebaseDataExtensionJob.DataExtension>();
|
||||||
|
if (o.has("result")) {
|
||||||
JSONArray a = o.getJSONArray("result");
|
JSONArray a = o.getJSONArray("result");
|
||||||
int l = a.length();
|
int l = a.length();
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ public class FreebaseDataExtensionJob {
|
|||||||
map.put(guid, ext);
|
map.put(guid, ext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
} finally {
|
} finally {
|
||||||
@ -284,8 +286,10 @@ public class FreebaseDataExtensionJob {
|
|||||||
jsonWriter.key("guid|=");
|
jsonWriter.key("guid|=");
|
||||||
jsonWriter.array();
|
jsonWriter.array();
|
||||||
for (String guid : guids) {
|
for (String guid : guids) {
|
||||||
|
if (guid != null) {
|
||||||
jsonWriter.value(guid);
|
jsonWriter.value(guid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
jsonWriter.endArray();
|
jsonWriter.endArray();
|
||||||
|
|
||||||
formulateQueryNode(node.getJSONArray("properties"), jsonWriter);
|
formulateQueryNode(node.getJSONArray("properties"), jsonWriter);
|
||||||
|
@ -53,8 +53,9 @@ function ExtendDataPreviewDialog(column, columnIndex, rowIndices, onDone) {
|
|||||||
}).appendTo(footer);
|
}).appendTo(footer);
|
||||||
|
|
||||||
var dismissBusy = DialogSystem.showBusy();
|
var dismissBusy = DialogSystem.showBusy();
|
||||||
|
var type = "reconConfig" in column && "type" in column.reconConfig ? column.reconConfig.type.id : "/common/topic";
|
||||||
|
|
||||||
ExtendDataPreviewDialog.getAllProperties(column.reconConfig.type.id, function(properties) {
|
ExtendDataPreviewDialog.getAllProperties(type, function(properties) {
|
||||||
dismissBusy();
|
dismissBusy();
|
||||||
self._show(properties);
|
self._show(properties);
|
||||||
});
|
});
|
||||||
@ -131,12 +132,14 @@ ExtendDataPreviewDialog.prototype._show = function(properties) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var suggestConfig = {
|
var suggestConfig = {
|
||||||
type: '/type/property',
|
type: '/type/property'
|
||||||
schema: this._column.reconConfig.type.id
|
|
||||||
};
|
};
|
||||||
|
if ("reconConfig" in this._column && "type" in this._column.reconConfig) {
|
||||||
|
suggestConfig.schema = this._column.reconConfig.type.id
|
||||||
|
}
|
||||||
|
|
||||||
this._elmts.addPropertyInput.suggestP(suggestConfig).bind("fb-select", function(evt, data) {
|
this._elmts.addPropertyInput.suggestP(suggestConfig).bind("fb-select", function(evt, data) {
|
||||||
var expected = data["/type/property/expected_type"];
|
var expected = data["expected_type"];
|
||||||
self._addProperty({
|
self._addProperty({
|
||||||
id : data.id,
|
id : data.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
|
@ -866,7 +866,6 @@ DataTableColumnHeaderUI.prototype._doAddColumn = function(initialExpression) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DataTableColumnHeaderUI.prototype._doAddColumnFromFreebase = function() {
|
DataTableColumnHeaderUI.prototype._doAddColumnFromFreebase = function() {
|
||||||
if ("reconConfig" in this._column && "type" in this._column.reconConfig) {
|
|
||||||
var o = DataTableView.sampleVisibleRows(this._column);
|
var o = DataTableView.sampleVisibleRows(this._column);
|
||||||
var self = this;
|
var self = this;
|
||||||
new ExtendDataPreviewDialog(
|
new ExtendDataPreviewDialog(
|
||||||
@ -887,9 +886,6 @@ DataTableColumnHeaderUI.prototype._doAddColumnFromFreebase = function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
alert("This column has not been reconciled yet.");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableColumnHeaderUI.prototype._doRemoveColumn = function() {
|
DataTableColumnHeaderUI.prototype._doRemoveColumn = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user