Made data upload dialog shows only limited preview of triples, but made actual uploading process and the tripleloader exporter generate all triples. Added spinner busy dialog during uploading process.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@582 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
b6ed5a3df5
commit
d303adc48e
@ -27,7 +27,7 @@ public class UploadDataCommand extends Command {
|
|||||||
Project project = getProject(request);
|
Project project = getProject(request);
|
||||||
Engine engine = getEngine(request, project);
|
Engine engine = getEngine(request, project);
|
||||||
TripleloaderExporter exporter = new TripleloaderExporter();
|
TripleloaderExporter exporter = new TripleloaderExporter();
|
||||||
StringWriter triples = new StringWriter(1024 * 10);
|
StringWriter triples = new StringWriter(10 * 1024 * 1024);
|
||||||
exporter.export(project, new Properties(), engine, triples);
|
exporter.export(project, new Properties(), engine, triples);
|
||||||
|
|
||||||
String source_name = request.getParameter("source_name");
|
String source_name = request.getParameter("source_name");
|
||||||
|
@ -33,7 +33,7 @@ public class TripleloaderExporter implements Exporter {
|
|||||||
|
|
||||||
TripleLoaderTransposedNodeFactory nodeFactory = new TripleLoaderTransposedNodeFactory(writer);
|
TripleLoaderTransposedNodeFactory nodeFactory = new TripleLoaderTransposedNodeFactory(writer);
|
||||||
|
|
||||||
Transposer.transpose(project, protograph, protograph.getRootNode(0), nodeFactory);
|
Transposer.transpose(project, protograph, protograph.getRootNode(0), nodeFactory, -1);
|
||||||
nodeFactory.flush();
|
nodeFactory.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,21 @@ import com.metaweb.gridworks.protograph.ValueNode;
|
|||||||
public class Transposer {
|
public class Transposer {
|
||||||
static public void transpose(
|
static public void transpose(
|
||||||
Project project,
|
Project project,
|
||||||
Protograph protograph,
|
Protograph protograph,
|
||||||
Node rootNode,
|
Node rootNode,
|
||||||
TransposedNodeFactory nodeFactory
|
TransposedNodeFactory nodeFactory
|
||||||
) {
|
) {
|
||||||
Context rootContext = new Context(rootNode, null, null, 20);
|
transpose(project, protograph, rootNode, nodeFactory, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void transpose(
|
||||||
|
Project project,
|
||||||
|
Protograph protograph,
|
||||||
|
Node rootNode,
|
||||||
|
TransposedNodeFactory nodeFactory,
|
||||||
|
int limit
|
||||||
|
) {
|
||||||
|
Context rootContext = new Context(rootNode, null, null, limit);
|
||||||
|
|
||||||
for (Row row : project.rows) {
|
for (Row row : project.rows) {
|
||||||
descend(project, protograph, nodeFactory, row, rootNode, rootContext);
|
descend(project, protograph, nodeFactory, row, rootNode, rootContext);
|
||||||
|
@ -116,22 +116,11 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var show_triples = function(cont) {
|
var show_triples = function(cont) {
|
||||||
$.post("/command/export-rows",
|
$.post(
|
||||||
{
|
"/command/preview-protograph?" + $.param({ project: theProject.id }),
|
||||||
project: theProject.id,
|
{ protograph: JSON.stringify(theProject.protograph) },
|
||||||
format : "tripleloader"
|
|
||||||
},
|
|
||||||
function(data) {
|
function(data) {
|
||||||
if (data == null || data == "") {
|
if ("tripleloader" in data) {
|
||||||
body.html(
|
|
||||||
'<div class="freebase-loading-tripleloader-message">'+
|
|
||||||
'<h2>This dataset has no triples</h2>' +
|
|
||||||
'<p>Have you aligned it with the Freebase schemas yet?</p>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
self._elmts = DOM.bind(frame);
|
|
||||||
self._end();
|
|
||||||
} else {
|
|
||||||
body.html(
|
body.html(
|
||||||
'<div class="freebase-loading-tripleloader-info"><table><tr>' +
|
'<div class="freebase-loading-tripleloader-info"><table><tr>' +
|
||||||
'<td><div>Name this data load ¬ <sup style="color: red">required</sup></div>' +
|
'<td><div>Name this data load ¬ <sup style="color: red">required</sup></div>' +
|
||||||
@ -139,7 +128,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
|||||||
'<td><div>Source ID ¬ <sup style="color: #888">optional</sup></div>' +
|
'<td><div>Source ID ¬ <sup style="color: #888">optional</sup></div>' +
|
||||||
'<input type="text" size="60" id="freebase-loading-source-id" bind="source_id"></td>' +
|
'<input type="text" size="60" id="freebase-loading-source-id" bind="source_id"></td>' +
|
||||||
'</tr></table></div>' +
|
'</tr></table></div>' +
|
||||||
'<div class="freebase-loading-tripleloader-data">' + data + '</div>'
|
'<div class="freebase-loading-tripleloader-data">' + data.tripleloader + '</div>'
|
||||||
);
|
);
|
||||||
self._elmts = DOM.bind(frame);
|
self._elmts = DOM.bind(frame);
|
||||||
|
|
||||||
@ -161,10 +150,19 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (typeof cont == "function") cont();
|
if (typeof cont == "function") cont();
|
||||||
|
} else {
|
||||||
|
body.html(
|
||||||
|
'<div class="freebase-loading-tripleloader-message">'+
|
||||||
|
'<h2>This dataset has no triples</h2>' +
|
||||||
|
'<p>Have you aligned it with the Freebase schemas yet?</p>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
self._elmts = DOM.bind(frame);
|
||||||
|
self._end();
|
||||||
}
|
}
|
||||||
|
|
||||||
self._level = DialogSystem.showDialog(frame);
|
self._level = DialogSystem.showDialog(frame);
|
||||||
}
|
},
|
||||||
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,6 +186,8 @@ FreebaseLoadingDialog.prototype._load = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var doLoad = function() {
|
var doLoad = function() {
|
||||||
|
var dismissBusy = DialogSystem.showBusy();
|
||||||
|
|
||||||
$.post("/command/upload-data",
|
$.post("/command/upload-data",
|
||||||
{
|
{
|
||||||
project: theProject.id,
|
project: theProject.id,
|
||||||
@ -196,6 +196,8 @@ FreebaseLoadingDialog.prototype._load = function() {
|
|||||||
"source_id" : self._elmts.source_id.val()
|
"source_id" : self._elmts.source_id.val()
|
||||||
},
|
},
|
||||||
function(data) {
|
function(data) {
|
||||||
|
dismissBusy();
|
||||||
|
|
||||||
var body = $(".dialog-body");
|
var body = $(".dialog-body");
|
||||||
if ("status" in data && typeof data.status == "object" && "code" in data.status && data.status.code == 200) {
|
if ("status" in data && typeof data.status == "object" && "code" in data.status && data.status.code == 200) {
|
||||||
body.html(
|
body.html(
|
||||||
|
Loading…
Reference in New Issue
Block a user