Cleanup and UI tweaks
This commit is contained in:
parent
165ff41469
commit
ddceec4d27
@ -9,20 +9,13 @@ function init() {
|
||||
RefineServlet.registerClassMapping(
|
||||
"org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange",
|
||||
"org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange");
|
||||
RefineServlet.registerClassMapping(
|
||||
"org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange",
|
||||
"org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange");
|
||||
|
||||
RefineServlet.cacheClass(Packages.org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange);
|
||||
RefineServlet.cacheClass(Packages.org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange);
|
||||
|
||||
/*
|
||||
* Context Initialization. This is mainly to allow testability. a simple attempt to mimic dependency injection
|
||||
*/
|
||||
|
||||
/*
|
||||
var initializer = new Packages.org.deri.grefine.rdf.app.InitilizationCommand();
|
||||
RefineServlet.registerCommand(module, "initialize", initializer);
|
||||
var ctxt = new Packages.org.deri.grefine.rdf.app.ApplicationContext();
|
||||
initializer.initRdfExportApplicationContext(ctxt);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Attach a Wikibase schema to each project.
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@
|
||||
</p>
|
||||
<div class="wikibase-user-management-area">
|
||||
<div class="wikibase-user-login" bind="loginArea">
|
||||
<div bind="invalidCredentials"></div>
|
||||
<div bind="invalidCredentials" class="wikibase-invalid-credentials"></div>
|
||||
<form bind="loginForm" class="wikibase-login-form" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
@ -21,7 +21,7 @@
|
||||
</table>
|
||||
</form>
|
||||
<div class="wikibase-login-buttons">
|
||||
<button class="button button-primary cancel-button">Close</button>
|
||||
<button class="button cancel-button">Close</button>
|
||||
<button class="button button-primary" bind="loginButton">Log in</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,6 +24,7 @@ ManageAccountDialog.launch = function(logged_in_username, callback) {
|
||||
});
|
||||
|
||||
elmts.loginButton.click(function() {
|
||||
frame.hide();
|
||||
$.post(
|
||||
"command/wikidata/login",
|
||||
elmts.loginForm.serialize(),
|
||||
@ -32,6 +33,7 @@ ManageAccountDialog.launch = function(logged_in_username, callback) {
|
||||
dismiss();
|
||||
callback(data.username);
|
||||
} else {
|
||||
frame.show();
|
||||
elmts.invalidCredentials.text("Invalid credentials.");
|
||||
}
|
||||
});
|
||||
|
@ -9,6 +9,7 @@
|
||||
<div id="schema-alignment-tabs" class="refine-tabs">
|
||||
<ul>
|
||||
<li><a href="#schema-alignment-tabs-schema">Schema</a></li>
|
||||
<li><a href="#schema-alignment-tabs-warnings">Warnings</a></li>
|
||||
<li><a href="#schema-alignment-tabs-preview-qs">QuickStatements preview</a></li>
|
||||
</ul>
|
||||
<div id="schema-alignment-tabs-schema">
|
||||
@ -23,6 +24,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="schema-alignment-tabs-warnings" style="display: none;">
|
||||
<div class="invalid-schema-warning">Your schema is incomplete, fix it to see the warnings.</div>
|
||||
<div class="schema-alignment-dialog-warnings"></div>
|
||||
</div>
|
||||
<div id="schema-alignment-tabs-preview-qs" style="display: none;">
|
||||
<div class="invalid-schema-warning">Your schema is incomplete, fix it to see the preview.</div>
|
||||
<div class="schema-alignment-dialog-preview"></div>
|
||||
|
@ -347,9 +347,11 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
|
||||
referencesToggle.click(function () {
|
||||
referenceContainer.toggle(100);
|
||||
});
|
||||
referenceContainer.hide();
|
||||
var right2 = $('<div></div>').addClass('wbs-right').appendTo(right);
|
||||
var toolbar3 = $('<div></div>').addClass('wbs-toolbar').appendTo(right2);
|
||||
$('<a></a>').addClass('wbs-add-reference').text('add reference').click(function() {
|
||||
referenceContainer.show();
|
||||
SchemaAlignmentDialog._addReference(referenceContainer, null);
|
||||
SchemaAlignmentDialog._updateReferencesNumber(referenceContainer);
|
||||
}).appendTo(toolbar3);
|
||||
@ -487,7 +489,7 @@ SchemaAlignmentDialog._getPropertyType = function(pid, callback) {
|
||||
|
||||
SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContainer, initialValue) {
|
||||
var input = $('<input></input>').appendTo(inputContainer);
|
||||
input.attr("placeholder", "Wikidata property");
|
||||
input.attr("placeholder", "property");
|
||||
|
||||
if (this._reconService !== null) {
|
||||
endpoint = this._reconService.suggest.property;
|
||||
@ -505,6 +507,7 @@ SchemaAlignmentDialog._initPropertyField = function(inputContainer, targetContai
|
||||
label: data.name,
|
||||
datatype: datatype,
|
||||
});
|
||||
console.log(datatype);
|
||||
SchemaAlignmentDialog._addStatement(targetContainer, datatype, null);
|
||||
var addValueButtons = targetContainer.parent().find('.wbs-add-statement');
|
||||
addValueButtons.show();
|
||||
@ -532,7 +535,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue)
|
||||
var input = $('<input></input>').appendTo(inputContainer);
|
||||
|
||||
if (this._reconService !== null && mode === "wikibase-item") {
|
||||
input.attr("placeholder", "Wikidata item or reconciled column");
|
||||
input.attr("placeholder", "item or reconciled column");
|
||||
var endpoint = null;
|
||||
endpoint = this._reconService.suggest.entity;
|
||||
var suggestConfig = $.extend({}, endpoint);
|
||||
@ -549,6 +552,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue)
|
||||
SchemaAlignmentDialog._hasChanged();
|
||||
});
|
||||
} else if (mode === "time") {
|
||||
input.attr("placeholder", "YYYY(-MM(-DD))...");
|
||||
var propagateValue = function(val) {
|
||||
// TODO add validation here
|
||||
inputContainer.data("jsonValue", {
|
||||
@ -561,7 +565,8 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue)
|
||||
propagateValue($(this).val());
|
||||
SchemaAlignmentDialog._hasChanged();
|
||||
});
|
||||
} else if (mode === "globecoordinates") {
|
||||
} else if (mode === "globe-coordinate") {
|
||||
input.attr("placeholder", "lat/lon");
|
||||
var propagateValue = function(val) {
|
||||
// TODO add validation here
|
||||
inputContainer.data("jsonValue", {
|
||||
@ -609,7 +614,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue)
|
||||
wbVariableType = "wbitemvariable";
|
||||
} else if (mode === "time") {
|
||||
wbVariableType = "wbdatevariable";
|
||||
} else if (mode === "globecoordinates") {
|
||||
} else if (mode === "globe-coordinate") {
|
||||
wbVariableType = "wblocationvariable";
|
||||
}
|
||||
|
||||
|
@ -41,3 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.wikibase-invalid-credentials {
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
@ -34,16 +34,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@import-less url("../theme.less");
|
||||
|
||||
.schema-alignment-dialog-canvas {
|
||||
height: 400px;
|
||||
overflow: auto;
|
||||
padding: 0px
|
||||
margin-top: 3px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
|
||||
.schema-alignment-dialog-statements-area {
|
||||
padding: 10px;
|
||||
min-height: 200px;
|
||||
max-height: 350px;
|
||||
min-height: 250px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.schema-alignment-dialog-columns-area {
|
||||
@ -142,10 +142,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
.wbs-qualifier, .wbs-reference {
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.wbs-qualifier .wbs-right {
|
||||
width: 70%;
|
||||
width: 71%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
margin-left: 100px;
|
||||
@ -192,67 +193,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
|
||||
table.schema-alignment-table-layout {
|
||||
border-collapse: collapse;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
table.schema-alignment-table-layout .padded {
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
div.schema-alignment-detail-container {
|
||||
border-left: 3px solid #eee;
|
||||
}
|
||||
|
||||
td.schema-alignment-node-main, td.schema-alignment-link-main {
|
||||
white-space: pre;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
td.schema-alignment-node-toggle, td.schema-alignment-link-toggle {
|
||||
white-space: pre;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
td.schema-alignment-node-toggle img, td.schema-alignment-link-toggle img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
td.schema-alignment-node-details, td.schema-alignment-link-details {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
a.schema-alignment-node-tag {
|
||||
padding: 3px 6px;
|
||||
background: #ddd;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
-moz-border-radius: 10px;
|
||||
}
|
||||
a.schema-alignment-node-tag:hover {
|
||||
background: #888;
|
||||
color: white;
|
||||
}
|
||||
.schema-alignment-node-column {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.schema-alignment-link-tag {
|
||||
padding: 3px 6px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
a.schema-alignment-link-tag:hover {
|
||||
color: #88f;
|
||||
}
|
||||
div.schema-alignment-dialog-warnings {
|
||||
min-height: 340px;
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
div.schema-alignment-dialog-preview {
|
||||
height: 400px;
|
||||
min-height: 340px;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
background: white;
|
||||
padding: 10px;
|
||||
@ -260,41 +208,4 @@ div.schema-alignment-dialog-preview {
|
||||
white-space: pre;
|
||||
font-family: monospace;
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
.schema-alignment-status-indicator {
|
||||
color: #red;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
* Node dialog
|
||||
*--------------------------------------------------
|
||||
*/
|
||||
|
||||
.schema-align-node-dialog-node-type {
|
||||
padding: 0.25em;
|
||||
background: #ddf;
|
||||
}
|
||||
.schema-align-node-dialog-node-type input {
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
.schema-alignment-node-dialog-column-list {
|
||||
height: 300px;
|
||||
width: 200px;
|
||||
overflow: auto;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
* Link dialog
|
||||
*--------------------------------------------------
|
||||
*/
|
||||
|
||||
.schema-alignment-link-menu-section {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.schema-alignment-link-menu-section-last {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package org.openrefine.wikidata.exporters;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.google.refine.browsing.Engine;
|
||||
@ -137,6 +138,7 @@ public class QuickStatementsExporter implements WriterExporter {
|
||||
@Override
|
||||
public String visit(GlobeCoordinatesValue value) {
|
||||
return String.format(
|
||||
Locale.US,
|
||||
"@%f/%f",
|
||||
value.getLatitude(),
|
||||
value.getLongitude());
|
||||
@ -158,6 +160,7 @@ public class QuickStatementsExporter implements WriterExporter {
|
||||
return null; // QuickStatements only accepts Qids as units
|
||||
String unitID = "U"+unit.substring(unitPrefix.length());
|
||||
return String.format(
|
||||
Locale.US,
|
||||
"[%f,%f]%s",
|
||||
value.getLowerBound(),
|
||||
value.getUpperBound(),
|
||||
|
@ -94,6 +94,8 @@ public class PerformWikibaseEditsOperation extends EngineDependentOperation {
|
||||
writer.value(strategy.name());
|
||||
writer.key("duplicate_action");
|
||||
writer.value(duplicateAction.name());
|
||||
writer.key("engineConfig");
|
||||
writer.value(getEngineConfig());
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,22 @@ public class WbLocationConstant extends WbLocationExpr {
|
||||
public static GlobeCoordinatesValue parse(String expr) throws ParseException {
|
||||
double lat = 0;
|
||||
double lng = 0;
|
||||
double precision = 0;
|
||||
return Datamodel.makeGlobeCoordinatesValue(lat, lng, precision,
|
||||
GlobeCoordinatesValue.GLOBE_EARTH);
|
||||
double precision = GlobeCoordinatesValue.PREC_TEN_MICRO_DEGREE;
|
||||
String[] parts = expr.split("[,/]");
|
||||
if (parts.length >= 2 && parts.length <= 3) {
|
||||
try {
|
||||
lat = Double.parseDouble(parts[0]);
|
||||
lng = Double.parseDouble(parts[1]);
|
||||
if (parts.length == 3) {
|
||||
precision = Double.parseDouble(parts[2]);
|
||||
}
|
||||
return Datamodel.makeGlobeCoordinatesValue(lat, lng, precision,
|
||||
GlobeCoordinatesValue.GLOBE_EARTH);
|
||||
} catch(NumberFormatException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
throw new ParseException("Invalid globe coordinates", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user