Merge branch 'master' into issue1781
This commit is contained in:
commit
b83044d5fd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -65,6 +65,15 @@
|
||||
"remember-credentials-label": "Ricorda questi dati (verranno mantenuti in forma criptata nelle preferenze di OpenRefine",
|
||||
"close": "Chiudi",
|
||||
"log-in": "Entra",
|
||||
"logged-in-as": "Sei registrato come:"
|
||||
"logged-in-as": "Sei registrato come:",
|
||||
"log-out": "Scollegati",
|
||||
"connecting-to-wikidata": "Connessione a Wikidata in corso..."
|
||||
},
|
||||
"perform-wikidata-edits": {
|
||||
"dialog-header": "Carica le tue modifiche su Wikidata",
|
||||
"review-your-edits": "Stai per caricare {nb_edits} modifiche su Wikidata. Per favore, controllale per bene. Ricorda che grossi caricamenti di dati devono <a href=\"https://www.wikidata.org/wiki/Wikidata:Requests_for_permissions/Bot\" target=\"_blank\">essere validati</a> prima del caricamento.",
|
||||
"logged-in-as": "Sei registrato come",
|
||||
"edit-summary-label": "Oggetto delle modifiche:",
|
||||
"edit-summary-placeholder": "qualche parola per descrivere le tue modifiche"
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,15 @@
|
||||
<div class="perform-edits-warnings-area" bind="warningsArea">
|
||||
</div>
|
||||
<div class="wikibase-perform-edits-area">
|
||||
<p><span bind="loggedInAs"></span> <a bind="loggedInUsername" target="_blank"></a>.</p>
|
||||
<p><span bind="editSummaryLabel"></span> <input type="text" name="editSummary" bind="editSummary" class="edit-summary" value="" /></p>
|
||||
<div class="wikibase-login-buttons">
|
||||
<button class="button cancel-button" bind="cancelButton"></button>
|
||||
<button class="button button-primary" bind="performEditsButton"></button>
|
||||
</div>
|
||||
<form id="wikibase-perform-edits-form" onsubmit="return false;" bind="performEditsForm" autocomplete="on">
|
||||
<p><span bind="loggedInAs"></span> <a bind="loggedInUsername" target="_blank"></a>.</p>
|
||||
<p><span bind="editSummaryLabel"></span> <input type="text" name="editSummary" bind="editSummary" class="edit-summary" value="" /></p>
|
||||
<div class="wikibase-login-buttons">
|
||||
<button class="button cancel-button" bind="cancelButton"></button>
|
||||
<button class="button button-primary" bind="performEditsButton"></button>
|
||||
</div>
|
||||
</form>
|
||||
<iframe id="hiddeniframe" src="javascript:false" class="hidden" bind="hiddenIframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,10 +30,17 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
|
||||
dismiss();
|
||||
});
|
||||
|
||||
var hiddenIframe = $('#hiddenIframe').contents();
|
||||
|
||||
if (max_severity === 'CRITICAL') {
|
||||
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
|
||||
} else {
|
||||
elmts.performEditsButton.click(function() {
|
||||
hiddenIframe.find('body').append(
|
||||
elmts.performEditsForm.clone());
|
||||
var formCopy = hiddenIframe.find("#wikibase-perform-edits-form");
|
||||
formCopy.submit();
|
||||
|
||||
if(elmts.editSummary.val().length == 0) {
|
||||
elmts.editSummary.focus();
|
||||
} else {
|
||||
@ -51,6 +58,7 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
|
||||
}
|
||||
});
|
||||
}
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -572,7 +572,7 @@ SchemaAlignmentDialog._addStatement = function(container, datatype, json) {
|
||||
var referencesToggle = $('<a></a>').appendTo(referencesToggleContainer);
|
||||
right = $('<div></div>').addClass('wbs-right').appendTo(statement);
|
||||
var referenceContainer = $('<div></div>').addClass('wbs-reference-container').appendTo(right);
|
||||
referencesToggle.click(function(e) {
|
||||
referencesToggleContainer.click(function(e) {
|
||||
triangle.toggleClass('pointing-down');
|
||||
triangle.toggleClass('pointing-right');
|
||||
referenceContainer.toggle(100);
|
||||
@ -643,6 +643,8 @@ SchemaAlignmentDialog._addQualifier = function(container, json) {
|
||||
SchemaAlignmentDialog._initPropertyField(inputContainer, statementContainer, property);
|
||||
if (value && property) {
|
||||
SchemaAlignmentDialog._addStatement(statementContainer, property.datatype, {value:value});
|
||||
} else {
|
||||
inputContainer.find('input').focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,45 +95,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-wdtk-datamodel</id>
|
||||
<phase>process-resources</phase>
|
||||
<configuration>
|
||||
<file>${basedir}/lib-local/wdtk-datamodel-0.9.0-SNAPSHOT-jar-with-dependencies.jar</file>
|
||||
<repositoryLayout>default</repositoryLayout>
|
||||
<groupId>org.wikidata.wdtk</groupId>
|
||||
<artifactId>wdtk-datamodel</artifactId>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<generatePom>true</generatePom>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>install-file</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>install-wdtk-wikibaseapi</id>
|
||||
<phase>process-resources</phase>
|
||||
<configuration>
|
||||
<file>${basedir}/lib-local/wdtk-wikibaseapi-0.9.0-SNAPSHOT.jar</file>
|
||||
<repositoryLayout>default</repositoryLayout>
|
||||
<groupId>org.wikidata.wdtk</groupId>
|
||||
<artifactId>wdtk-wikibaseapi</artifactId>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<generatePom>true</generatePom>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>install-file</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
@ -165,12 +126,12 @@
|
||||
<dependency>
|
||||
<groupId>org.wikidata.wdtk</groupId>
|
||||
<artifactId>wdtk-wikibaseapi</artifactId>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wikidata.wdtk</groupId>
|
||||
<artifactId>wdtk-datamodel</artifactId>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- testing dependencies -->
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
package org.openrefine.wikidata.commands;
|
||||
|
||||
import static org.openrefine.wikidata.commands.CommandUtilities.respondError;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
@ -36,7 +38,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONWriter;
|
||||
import org.openrefine.wikidata.qa.EditInspector;
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
@ -45,10 +46,7 @@ import org.openrefine.wikidata.schema.WikibaseSchema;
|
||||
import org.openrefine.wikidata.updates.ItemUpdate;
|
||||
import org.openrefine.wikidata.updates.scheduler.WikibaseAPIUpdateScheduler;
|
||||
|
||||
import static org.openrefine.wikidata.commands.CommandUtilities.respondError;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import com.google.refine.browsing.Engine;
|
||||
import com.google.refine.commands.Command;
|
||||
import com.google.refine.model.Project;
|
||||
|
@ -31,6 +31,7 @@ import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.wikidata.wdtk.wikibaseapi.ApiConnection;
|
||||
import org.wikidata.wdtk.wikibaseapi.BasicApiConnection;
|
||||
import org.wikidata.wdtk.wikibaseapi.LoginFailedException;
|
||||
|
||||
import com.google.refine.ProjectManager;
|
||||
|
@ -28,9 +28,9 @@ import java.util.Locale;
|
||||
|
||||
import org.openrefine.wikidata.schema.entityvalues.ReconEntityIdValue;
|
||||
import org.openrefine.wikidata.updates.scheduler.QuickStatementsUpdateScheduler;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.QuantityValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
@ -50,12 +50,6 @@ import org.wikidata.wdtk.datamodel.interfaces.ValueVisitor;
|
||||
*/
|
||||
public class QSValuePrinter implements ValueVisitor<String> {
|
||||
|
||||
@Override
|
||||
public String visit(DatatypeIdValue value) {
|
||||
// impossible case (this is actually a bug in WDTK, DatatypeIdValue should not subclass Value)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visit(EntityIdValue value) {
|
||||
if (ReconEntityIdValue.class.isInstance(value) && ((ReconEntityIdValue) value).isNew()) {
|
||||
@ -76,12 +70,10 @@ public class QSValuePrinter implements ValueVisitor<String> {
|
||||
|
||||
@Override
|
||||
public String visit(QuantityValue value) {
|
||||
String unitPrefix = "http://www.wikidata.org/entity/Q";
|
||||
String unitIri = value.getUnit();
|
||||
ItemIdValue unit = value.getUnitItemId();
|
||||
String unitRepresentation = "", boundsRepresentation = "";
|
||||
if (!unitIri.isEmpty()) {
|
||||
if (!unitIri.startsWith(unitPrefix)) return null; // QuickStatements only accepts Qids as units
|
||||
unitRepresentation = "U" + unitIri.substring(unitPrefix.length());
|
||||
if (unit != null) {
|
||||
unitRepresentation = "U" + unit.getId().substring(1);
|
||||
}
|
||||
if (value.getLowerBound() != null) {
|
||||
// bounds are always null at the same time so we know they are both not null
|
||||
|
@ -38,11 +38,14 @@ import org.slf4j.LoggerFactory;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Claim;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.NoValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Reference;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.SomeValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueVisitor;
|
||||
|
||||
import com.google.refine.browsing.Engine;
|
||||
@ -180,9 +183,16 @@ public class QuickStatementsExporter implements WriterExporter {
|
||||
if (reference) {
|
||||
pid = pid.replace('P', 'S');
|
||||
}
|
||||
Value val = s.getValue();
|
||||
ValueVisitor<String> vv = new QSValuePrinter();
|
||||
String valStr = val.accept(vv);
|
||||
String valStr = "";
|
||||
if (s instanceof ValueSnak) {
|
||||
Value val = ((ValueSnak)s).getValue();
|
||||
ValueVisitor<String> vv = new QSValuePrinter();
|
||||
valStr = val.accept(vv);
|
||||
} else if (s instanceof NoValueSnak) {
|
||||
valStr = "novalue";
|
||||
} else if (s instanceof SomeValueSnak) {
|
||||
valStr = "somevalue";
|
||||
}
|
||||
if (valStr != null) {
|
||||
writer.write("\t" + pid + "\t" + valStr);
|
||||
}
|
||||
|
@ -39,8 +39,10 @@ import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StatementGroup;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StatementRank;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* This class provides an abstraction over the way constraint definitions are
|
||||
@ -290,7 +292,8 @@ public class WikidataConstraintFetcher implements ConstraintFetcher {
|
||||
*/
|
||||
protected Stream<Statement> getConstraintsByType(PropertyIdValue pid, String qid) {
|
||||
Stream<Statement> allConstraints = getConstraintStatements(pid).stream()
|
||||
.filter(s -> ((EntityIdValue) s.getValue()).getId().equals(qid));
|
||||
.filter(s -> s.getValue() != null && ((EntityIdValue) s.getValue()).getId().equals(qid))
|
||||
.filter(s -> !StatementRank.DEPRECATED.equals(s.getRank()));
|
||||
return allConstraints;
|
||||
}
|
||||
|
||||
@ -327,7 +330,11 @@ public class WikidataConstraintFetcher implements ConstraintFetcher {
|
||||
for (SnakGroup group : groups) {
|
||||
if (group.getProperty().getId().equals(pid)) {
|
||||
for (Snak snak : group.getSnaks())
|
||||
results.add(snak.getValue());
|
||||
if (snak instanceof ValueSnak) {
|
||||
results.add(((ValueSnak)snak).getValue());
|
||||
} else {
|
||||
results.add(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
@ -29,8 +29,10 @@ import java.util.Map;
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that checks for properties using the same value on different
|
||||
@ -53,7 +55,11 @@ public class DistinctValuesScrutinizer extends StatementScrutinizer {
|
||||
public void scrutinize(Statement statement, EntityIdValue entityId, boolean added) {
|
||||
PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId();
|
||||
if (_fetcher.hasDistinctValues(pid)) {
|
||||
Value mainSnakValue = statement.getClaim().getMainSnak().getValue();
|
||||
Snak mainSnak = statement.getClaim().getMainSnak();
|
||||
if(!(mainSnak instanceof ValueSnak)) {
|
||||
return;
|
||||
}
|
||||
Value mainSnakValue = ((ValueSnak)mainSnak).getValue();
|
||||
Map<Value, EntityIdValue> seen = _seenValues.get(pid);
|
||||
if (seen == null) {
|
||||
seen = new HashMap<Value, EntityIdValue>();
|
||||
|
@ -3,7 +3,7 @@ package org.openrefine.wikidata.qa.scrutinizers;
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
|
||||
public class EntityTypeScrutinizer extends SnakScrutinizer {
|
||||
@ -11,7 +11,7 @@ public class EntityTypeScrutinizer extends SnakScrutinizer {
|
||||
public final static String type = "invalid-entity-type";
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
PropertyIdValue pid = snak.getPropertyId();
|
||||
if(!_fetcher.usableOnItems(pid)) {
|
||||
QAWarning issue = new QAWarning(type, null, QAWarning.Severity.WARNING, 1);
|
||||
|
@ -30,8 +30,8 @@ import java.util.regex.Pattern;
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that detects incorrect formats in text values (mostly
|
||||
@ -73,7 +73,7 @@ public class FormatScrutinizer extends SnakScrutinizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
if (StringValue.class.isInstance(snak.getValue())) {
|
||||
String value = ((StringValue) snak.getValue()).getString();
|
||||
PropertyIdValue pid = snak.getPropertyId();
|
||||
|
@ -33,8 +33,10 @@ import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that checks for missing inverse statements in edit batches.
|
||||
@ -81,7 +83,11 @@ public class InverseConstraintScrutinizer extends StatementScrutinizer {
|
||||
return; // TODO support for deleted statements
|
||||
}
|
||||
|
||||
Value mainSnakValue = statement.getClaim().getMainSnak().getValue();
|
||||
Snak mainSnak = statement.getClaim().getMainSnak();
|
||||
if(! (mainSnak instanceof ValueSnak)) {
|
||||
return;
|
||||
}
|
||||
Value mainSnakValue = ((ValueSnak)mainSnak).getValue();
|
||||
if (ItemIdValue.class.isInstance(mainSnakValue)) {
|
||||
PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId();
|
||||
PropertyIdValue inversePid = getInverseConstraint(pid);
|
||||
|
@ -1,15 +1,13 @@
|
||||
package org.openrefine.wikidata.qa.scrutinizers;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.helpers.Datamodel;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.QuantityValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* Scrutinizer checking for units and bounds in quantities.
|
||||
@ -25,7 +23,7 @@ public class QuantityScrutinizer extends SnakScrutinizer {
|
||||
public static final String noUnitProvidedType = "no-unit-provided";
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
if (QuantityValue.class.isInstance(snak.getValue()) && added) {
|
||||
PropertyIdValue pid = snak.getPropertyId();
|
||||
QuantityValue value = (QuantityValue)snak.getValue();
|
||||
@ -45,22 +43,19 @@ public class QuantityScrutinizer extends SnakScrutinizer {
|
||||
addIssue(issue);
|
||||
}
|
||||
Set<ItemIdValue> allowedUnits = _fetcher.allowedUnits(pid);
|
||||
String currentUnit = null;
|
||||
if (value.getUnit() != null && !value.getUnit().equals("")) {
|
||||
currentUnit = value.getUnit();
|
||||
ItemIdValue currentUnit = null;
|
||||
if (value.getUnit() != null) {
|
||||
currentUnit = value.getUnitItemId();
|
||||
}
|
||||
if(allowedUnits != null &&
|
||||
!allowedUnits.stream().map(u -> u != null ? u.getIri() : null)
|
||||
.collect(Collectors.toSet()).contains(currentUnit)) {
|
||||
!allowedUnits.contains(currentUnit)) {
|
||||
String issueType = currentUnit == null ? noUnitProvidedType : invalidUnitType;
|
||||
QAWarning issue = new QAWarning(issueType, pid.getId(), QAWarning.Severity.IMPORTANT, 1);
|
||||
issue.setProperty("property_entity", pid);
|
||||
issue.setProperty("example_value", value.getNumericValue().toString());
|
||||
issue.setProperty("example_item_entity", entityId);
|
||||
if (currentUnit != null) {
|
||||
issue.setProperty("unit_entity",
|
||||
// this is a hack but it will not be needed anymore in the upcoming version of Wikidata-Toolkit
|
||||
Datamodel.makeWikidataItemIdValue(currentUnit.substring(currentUnit.indexOf("Q"))));
|
||||
issue.setProperty("unit_entity", currentUnit);
|
||||
}
|
||||
addIssue(issue);
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import java.util.Set;
|
||||
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.NoValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.SomeValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
|
||||
public class RestrictedValuesScrutinizer extends SnakScrutinizer {
|
||||
@ -14,10 +16,23 @@ public class RestrictedValuesScrutinizer extends SnakScrutinizer {
|
||||
public static String type = "forbidden-value";
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
PropertyIdValue pid = snak.getPropertyId();
|
||||
Value value = snak.getValue();
|
||||
|
||||
scrutinizeValue(value, pid, entityId, added);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrutinize(SomeValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
scrutinizeValue(null, snak.getPropertyId(), entityId, added);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrutinize(NoValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
scrutinizeValue(null, snak.getPropertyId(), entityId, added);
|
||||
}
|
||||
|
||||
public void scrutinizeValue(Value value, PropertyIdValue pid, EntityIdValue entityId, boolean added) {
|
||||
Set<Value> allowedValues = _fetcher.allowedValues(pid);
|
||||
Set<Value> disallowedValues = _fetcher.disallowedValues(pid);
|
||||
if((allowedValues != null && !allowedValues.contains(value)) ||
|
||||
|
@ -25,7 +25,7 @@ package org.openrefine.wikidata.qa.scrutinizers;
|
||||
|
||||
import org.openrefine.wikidata.qa.QAWarning;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that checks for self-referential statements. These statements
|
||||
@ -39,7 +39,7 @@ public class SelfReferentialScrutinizer extends SnakScrutinizer {
|
||||
public static final String type = "self-referential-statements";
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
if (entityId.equals(snak.getValue())) {
|
||||
QAWarning issue = new QAWarning(type, null, QAWarning.Severity.WARNING, 1);
|
||||
issue.setProperty("example_entity", entityId);
|
||||
|
@ -26,9 +26,12 @@ package org.openrefine.wikidata.qa.scrutinizers;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.NoValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Reference;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.SomeValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that inspects snaks individually, no matter whether they appear
|
||||
@ -49,8 +52,46 @@ public abstract class SnakScrutinizer extends StatementScrutinizer {
|
||||
* @param added:
|
||||
* whether this snak is going to be added or deleted
|
||||
*/
|
||||
public abstract void scrutinize(Snak snak, EntityIdValue entityId, boolean added);
|
||||
public abstract void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added);
|
||||
|
||||
/**
|
||||
* Scrutinizes a novalue snak
|
||||
*
|
||||
* @param snak:
|
||||
* the snak to inspect
|
||||
* @param entityId:
|
||||
* the item on which it is going to (dis)appear
|
||||
* @param added:
|
||||
* whether this snak is going to be added or deleted
|
||||
*/
|
||||
public void scrutinize(NoValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrutinizes a somevalue snak
|
||||
*
|
||||
* @param snak:
|
||||
* the snak to inspect
|
||||
* @param entityId:
|
||||
* the item on which it is going to (dis)appear
|
||||
* @param added:
|
||||
* whether this snak is going to be added or deleted
|
||||
*/
|
||||
public void scrutinize(SomeValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
|
||||
}
|
||||
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
if(snak instanceof ValueSnak) {
|
||||
scrutinize((ValueSnak)snak, entityId, added);
|
||||
} else if(snak instanceof NoValueSnak) {
|
||||
scrutinize((NoValueSnak)snak, entityId, added);
|
||||
} else if(snak instanceof SomeValueSnak) {
|
||||
scrutinize((SomeValueSnak)snak, entityId, added);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrutinize(Statement statement, EntityIdValue entityId, boolean added) {
|
||||
// Main snak
|
||||
|
@ -26,8 +26,8 @@ package org.openrefine.wikidata.qa.scrutinizers;
|
||||
import org.openrefine.wikidata.updates.ItemUpdate;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
|
||||
/**
|
||||
* A scrutinizer that inspects the values of snaks and terms
|
||||
@ -55,7 +55,7 @@ public abstract class ValueScrutinizer extends SnakScrutinizer {
|
||||
public abstract void scrutinize(Value value);
|
||||
|
||||
@Override
|
||||
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
|
||||
public void scrutinize(ValueSnak snak, EntityIdValue entityId, boolean added) {
|
||||
scrutinize(snak.getValue());
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ package org.openrefine.wikidata.schema;
|
||||
import org.jsoup.helper.Validate;
|
||||
import org.openrefine.wikidata.schema.entityvalues.FullyPropertySerializingValueSnak;
|
||||
import org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException;
|
||||
import org.wikidata.wdtk.datamodel.helpers.Datamodel;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Snak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
|
@ -58,7 +58,11 @@ public class WbStringVariable extends WbVariableExpr<StringValue> {
|
||||
public StringValue fromCell(Cell cell, ExpressionContext ctxt)
|
||||
throws SkipSchemaExpressionException {
|
||||
if (!cell.value.toString().isEmpty()) {
|
||||
return Datamodel.makeStringValue(cell.value.toString().trim());
|
||||
String stringValue = cell.value.toString();
|
||||
if (cell.value instanceof Double && ((Double)cell.value) % 1 == 0) {
|
||||
stringValue = Integer.toString(((Double)cell.value).intValue());
|
||||
}
|
||||
return Datamodel.makeStringValue(stringValue.trim());
|
||||
}
|
||||
throw new SkipSchemaExpressionException();
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.openrefine.wikidata.schema.entityvalues.ReconItemIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.DatatypeIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
|
||||
@ -40,6 +39,7 @@ import org.wikidata.wdtk.datamodel.interfaces.Statement;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.TimeValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.Value;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueSnak;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.ValueVisitor;
|
||||
|
||||
/**
|
||||
@ -101,7 +101,9 @@ public class PointerExtractor implements ValueVisitor<Set<ReconItemIdValue>> {
|
||||
public Set<ReconItemIdValue> extractPointers(Snak snak) {
|
||||
Set<ReconItemIdValue> result = new HashSet<>();
|
||||
result.addAll(extractPointers(snak.getPropertyId()));
|
||||
result.addAll(extractPointers(snak.getValue()));
|
||||
if (snak instanceof ValueSnak) {
|
||||
result.addAll(extractPointers(((ValueSnak)snak).getValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -122,11 +124,6 @@ public class PointerExtractor implements ValueVisitor<Set<ReconItemIdValue>> {
|
||||
return pointers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ReconItemIdValue> visit(DatatypeIdValue value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ReconItemIdValue> visit(EntityIdValue value) {
|
||||
if (ReconItemIdValue.class.isInstance(value)) {
|
||||
|
@ -33,7 +33,6 @@ import org.wikidata.wdtk.datamodel.helpers.Datamodel;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.QuantityValue;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class WbQuantityExprTest extends WbExpressionTest<QuantityValue> {
|
||||
|
||||
|
@ -27,6 +27,8 @@ import org.testng.annotations.Test;
|
||||
import org.wikidata.wdtk.datamodel.helpers.Datamodel;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
|
||||
import com.google.refine.model.Cell;
|
||||
|
||||
public class WbStringVariableTest extends WbVariableTest<StringValue> {
|
||||
|
||||
@Override
|
||||
@ -51,6 +53,23 @@ public class WbStringVariableTest extends WbVariableTest<StringValue> {
|
||||
public void testTrailingWhitespace() {
|
||||
evaluatesTo(Datamodel.makeStringValue("dirty"), "dirty \t");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that integers are correctly converted to strings
|
||||
*/
|
||||
@Test
|
||||
public void testInteger() {
|
||||
evaluatesTo(Datamodel.makeStringValue("45"), new Cell(45,null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that floating point numbers with no decimal part are also converted
|
||||
*/
|
||||
@Test
|
||||
public void testDoubleInteger() {
|
||||
evaluatesTo(Datamodel.makeStringValue("45"), new Cell(45.0,null));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLeadingWhitespace() {
|
||||
|
@ -52,8 +52,6 @@ import org.wikidata.wdtk.datamodel.interfaces.StatementRank;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.StringValue;
|
||||
import org.wikidata.wdtk.datamodel.interfaces.TimeValue;
|
||||
|
||||
import com.fasterxml.jackson.databind.exc.InvalidDefinitionException;
|
||||
|
||||
import com.google.refine.browsing.Engine;
|
||||
import com.google.refine.browsing.EngineConfig;
|
||||
import com.google.refine.model.Project;
|
||||
|
@ -25,8 +25,6 @@ package org.openrefine.wikidata.testing;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -66,7 +66,6 @@ public class PointerExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testExtractDatavalues() {
|
||||
assertEmpty(Datamodel.makeDatatypeIdValue("string"));
|
||||
assertEmpty(Datamodel.makeGlobeCoordinatesValue(1.34, 2.354, 0.1, GlobeCoordinatesValue.GLOBE_EARTH));
|
||||
assertEmpty(Datamodel.makeStringValue("est"));
|
||||
assertEmpty(Datamodel.makeMonolingualTextValue("srtu", "en"));
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
Copyright 2012, Thomas F. Morris
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
package com.google.refine.importers;
|
||||
|
||||
|
||||
public class RdfJsonldTripleImporter extends RdfTripleImporter {
|
||||
|
||||
public RdfJsonldTripleImporter() {
|
||||
super(RdfTripleImporter.Mode.JSONLD);
|
||||
}
|
||||
|
||||
}
|
@ -62,7 +62,8 @@ public class RdfTripleImporter extends ImportingParserBase {
|
||||
RDFXML,
|
||||
NT,
|
||||
N3,
|
||||
TTL
|
||||
TTL,
|
||||
JSONLD
|
||||
}
|
||||
|
||||
public RdfTripleImporter() {
|
||||
@ -85,9 +86,14 @@ public class RdfTripleImporter extends ImportingParserBase {
|
||||
model.read(input, null, "NT");
|
||||
break;
|
||||
case N3:
|
||||
model.read(input, null, "N3");
|
||||
break;
|
||||
case TTL:
|
||||
model.read(input, null, "TTL");
|
||||
break;
|
||||
case JSONLD:
|
||||
model.read(input, null, "JSON-LD");
|
||||
break;
|
||||
case RDFXML:
|
||||
model.read(input, null);
|
||||
break;
|
||||
|
@ -233,5 +233,95 @@ public class RdfTripleImporterTests extends ImporterTest {
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(1).value, "http://meetings.example.com/cal#m1");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(2).value, "mailto:fred@example.com");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(3).value, "Fred");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseTtl() throws UnsupportedEncodingException {
|
||||
String sampleRdf = "@prefix p: <http://www.example.org/personal_details#> .\n" +
|
||||
"@prefix m: <http://www.example.org/meeting_organization#> .\n\n" +
|
||||
"<http://www.example.org/people#fred>\n" +
|
||||
"p:GivenName \"Fred\";\n" +
|
||||
"p:hasEmail <mailto:fred@example.com>;\n" +
|
||||
"m:attending <http://meetings.example.com/cal#m1> .\n";
|
||||
|
||||
InputStream input = new ByteArrayInputStream(sampleRdf.getBytes("UTF-8"));
|
||||
|
||||
SUT = new RdfTripleImporter(RdfTripleImporter.Mode.TTL);
|
||||
parseOneFile(SUT, input);
|
||||
|
||||
Assert.assertEquals(project.columnModel.columns.size(), 4);
|
||||
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "subject");
|
||||
Assert.assertEquals(project.columnModel.columns.get(1).getName(), "http://www.example.org/meeting_organization#attending");
|
||||
Assert.assertEquals(project.columnModel.columns.get(2).getName(), "http://www.example.org/personal_details#hasEmail");
|
||||
Assert.assertEquals(project.columnModel.columns.get(3).getName(), "http://www.example.org/personal_details#GivenName");
|
||||
Assert.assertEquals(project.rows.size(), 1);
|
||||
Assert.assertEquals(project.rows.get(0).cells.size(), 4);
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "http://www.example.org/people#fred");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(1).value, "http://meetings.example.com/cal#m1");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(2).value, "mailto:fred@example.com");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(3).value, "Fred");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseNTriples() throws UnsupportedEncodingException {
|
||||
String sampleRdf = "<http://www.example.org/people#fred> <http://www.example.org/meeting_organization#attending> <http://meetings.example.com/cal#m1> . \n" +
|
||||
"<http://www.example.org/people#fred> <http://www.example.org/personal_details#hasEmail> <mailto:fred@example.com> . \n" +
|
||||
"<http://www.example.org/people#fred> <http://www.example.org/personal_details#GivenName> \"Fred\" . ";
|
||||
|
||||
InputStream input = new ByteArrayInputStream(sampleRdf.getBytes("UTF-8"));
|
||||
|
||||
SUT = new RdfTripleImporter(RdfTripleImporter.Mode.NT);
|
||||
parseOneFile(SUT, input);
|
||||
|
||||
Assert.assertEquals(project.columnModel.columns.size(), 4);
|
||||
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "subject");
|
||||
Assert.assertEquals(project.columnModel.columns.get(1).getName(), "http://www.example.org/personal_details#GivenName");
|
||||
Assert.assertEquals(project.columnModel.columns.get(2).getName(), "http://www.example.org/personal_details#hasEmail");
|
||||
Assert.assertEquals(project.columnModel.columns.get(3).getName(), "http://www.example.org/meeting_organization#attending");
|
||||
|
||||
Assert.assertEquals(project.rows.size(), 1);
|
||||
Assert.assertEquals(project.rows.get(0).cells.size(), 4);
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "http://www.example.org/people#fred");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(1).value, "Fred");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(2).value, "mailto:fred@example.com");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(3).value, "http://meetings.example.com/cal#m1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseJsonld() throws UnsupportedEncodingException {
|
||||
String sampleJsonld = "{\n "+
|
||||
" \"@context\": {\n "+
|
||||
" \"m\": \"http://www.example.org/meeting_organization#\",\n "+
|
||||
" \"p\": \"http://www.example.org/personal_details#\",\n "+
|
||||
" \"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\n "+
|
||||
" \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\",\n "+
|
||||
" \"xsd\": \"http://www.w3.org/2001/XMLSchema#\"\n "+
|
||||
" },\n "+
|
||||
" \"@id\": \"http://www.example.org/people#fred\",\n "+
|
||||
" \"m:attending\": {\n "+
|
||||
" \"@id\": \"http://meetings.example.com/cal#m1\"\n "+
|
||||
" },\n "+
|
||||
" \"p:GivenName\": \"Fred\",\n "+
|
||||
" \"p:hasEmail\": {\n "+
|
||||
" \"@id\": \"mailto:fred@example.com\"\n "+
|
||||
" }\n "+
|
||||
"}";
|
||||
|
||||
InputStream input = new ByteArrayInputStream(sampleJsonld.getBytes("UTF-8"));
|
||||
|
||||
SUT = new RdfTripleImporter(RdfTripleImporter.Mode.JSONLD);
|
||||
parseOneFile(SUT, input);
|
||||
|
||||
Assert.assertEquals(project.columnModel.columns.size(), 4);
|
||||
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "subject");
|
||||
Assert.assertEquals(project.columnModel.columns.get(1).getName(), "http://www.example.org/personal_details#hasEmail");
|
||||
Assert.assertEquals(project.columnModel.columns.get(2).getName(), "http://www.example.org/personal_details#GivenName");
|
||||
Assert.assertEquals(project.columnModel.columns.get(3).getName(), "http://www.example.org/meeting_organization#attending");
|
||||
Assert.assertEquals(project.rows.size(), 1);
|
||||
Assert.assertEquals(project.rows.get(0).cells.size(), 4);
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(0).value, "http://www.example.org/people#fred");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(1).value, "mailto:fred@example.com");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(2).value, "Fred");
|
||||
Assert.assertEquals(project.rows.get(0).cells.get(3).value, "http://meetings.example.com/cal#m1");
|
||||
}
|
||||
}
|
||||
|
@ -213,13 +213,18 @@ function registerImporting() {
|
||||
IM.registerFormat("text/line-based/fixed-width", "Fixed-width field text files", "FixedWidthParserUI",
|
||||
new Packages.com.google.refine.importers.FixedWidthImporter());
|
||||
|
||||
IM.registerFormat("text/rdf+n3", "RDF/N3 files", "RdfTriplesParserUI",
|
||||
IM.registerFormat("text/rdf/nt", "RDF/N-Triples files", "RdfTriplesParserUI",
|
||||
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.NT));
|
||||
IM.registerFormat("text/rdf/n3", "RDF/N3 files", "RdfTriplesParserUI",
|
||||
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.N3));
|
||||
IM.registerFormat("text/rdf/ttl", "RDF/Turtle files", "RdfTriplesParserUI",
|
||||
new Packages.com.google.refine.importers.RdfTripleImporter(Packages.com.google.refine.importers.RdfTripleImporter.Mode.TTL));
|
||||
IM.registerFormat("text/rdf/xml", "RDF/XML files", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfXmlTripleImporter());
|
||||
IM.registerFormat("text/rdf/ld+json", "JSON-LD files", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfJsonldTripleImporter());
|
||||
|
||||
IM.registerFormat("text/xml", "XML files", "XmlParserUI", new Packages.com.google.refine.importers.XmlImporter());
|
||||
IM.registerFormat("binary/text/xml/xls/xlsx", "Excel files", "ExcelParserUI", new Packages.com.google.refine.importers.ExcelImporter());
|
||||
IM.registerFormat("text/xml/ods", "Open Document Format spreadsheets (.ods)", "ExcelParserUI", new Packages.com.google.refine.importers.OdsImporter());
|
||||
IM.registerFormat("text/xml/rdf", "RDF/XML files", "RdfTriplesParserUI", new Packages.com.google.refine.importers.RdfXmlTripleImporter());
|
||||
IM.registerFormat("text/json", "JSON files", "JsonParserUI", new Packages.com.google.refine.importers.JsonImporter());
|
||||
IM.registerFormat("text/marc", "MARC files", "XmlParserUI", new Packages.com.google.refine.importers.MarcImporter());
|
||||
IM.registerFormat("text/wiki", "Wikitext", "WikitextParserUI", new Packages.com.google.refine.importers.WikitextImporter());
|
||||
@ -236,7 +241,6 @@ function registerImporting() {
|
||||
IM.registerExtension(".tsv", "text/line-based/*sv");
|
||||
|
||||
IM.registerExtension(".xml", "text/xml");
|
||||
IM.registerExtension(".rdf", "text/xml/rdf");
|
||||
|
||||
IM.registerExtension(".json", "text/json");
|
||||
IM.registerExtension(".js", "text/json");
|
||||
@ -246,7 +250,11 @@ function registerImporting() {
|
||||
|
||||
IM.registerExtension(".ods", "text/xml/ods");
|
||||
|
||||
IM.registerExtension(".n3", "text/rdf+n3");
|
||||
IM.registerExtension(".nt", "text/rdf/nt");
|
||||
IM.registerExtension(".n3", "text/rdf/n3");
|
||||
IM.registerExtension(".ttl", "text/rdf/ttl");
|
||||
IM.registerExtension(".jsonld", "text/rdf/ld+json");
|
||||
IM.registerExtension(".rdf", "text/rdf/xml");
|
||||
|
||||
IM.registerExtension(".marc", "text/marc");
|
||||
IM.registerExtension(".mrc", "text/marc");
|
||||
@ -263,7 +271,12 @@ function registerImporting() {
|
||||
|
||||
IM.registerMimeType("text/fixed-width", "text/line-based/fixed-width");
|
||||
|
||||
IM.registerMimeType("text/rdf+n3", "text/rdf+n3");
|
||||
IM.registerMimeType("application/n-triples", "text/rdf/nt");
|
||||
IM.registerMimeType("text/n3", "text/rdf/n3");
|
||||
IM.registerMimeType("text/rdf+n3", "text/rdf/n3");
|
||||
IM.registerMimeType("text/turtle", "text/rdf/ttl");
|
||||
IM.registerMimeType("application/rdf+xml", "text/rdf/xml");
|
||||
IM.registerMimeType("application/ld+json", "text/rdf/ld+json");
|
||||
|
||||
IM.registerMimeType("application/msexcel", "binary/text/xml/xls/xlsx");
|
||||
IM.registerMimeType("application/x-msexcel", "binary/text/xml/xls/xlsx");
|
||||
@ -279,8 +292,6 @@ function registerImporting() {
|
||||
IM.registerMimeType("application/javascript", "text/json");
|
||||
IM.registerMimeType("text/json", "text/json");
|
||||
|
||||
IM.registerMimeType("application/rdf+xml", "text/xml/rdf");
|
||||
|
||||
IM.registerMimeType("application/marc", "text/marc");
|
||||
|
||||
IM.registerUrlRewriter(new Packages.com.google.refine.model.metadata.DataPackageUrlRewriter());
|
||||
|
@ -22,7 +22,18 @@
|
||||
"name": "Nombre del proyecto:",
|
||||
"edit": "Editar",
|
||||
"value": "Valor",
|
||||
"delete": "Borrar"
|
||||
"delete": "Borrar",
|
||||
"change-metadata-value": "Cambiar el valor de la clave de metadatos",
|
||||
"created": "Fecha de creación:",
|
||||
"modified": "Fecha de la última modificación:",
|
||||
"creator": "Creador:",
|
||||
"contributors": "Contribuyentes:",
|
||||
"subject": "Tema:",
|
||||
"description": "Descripción:",
|
||||
"rowCount": "Número de filas:",
|
||||
"customMetadata": "Metadata personalizada (JSON):",
|
||||
"id": "ID del proyecto:",
|
||||
"importOptionMetadata": "Opción de importación *metadata(*JSON):"
|
||||
},
|
||||
"core-index-create": {
|
||||
"almost-done": "casi listo ...",
|
||||
@ -30,7 +41,7 @@
|
||||
"create-proj": "Crear proyecto",
|
||||
"from": "Obtener datos de",
|
||||
"memory-usage": "Uso de memoria:",
|
||||
"question": "Cree un proyecto importando datos. Los puede importar en los formatos:",
|
||||
"question": "Crear un proyecto importando datos. ¿Qué tipo de archivos puedo importar?",
|
||||
"sec-remaining": "seconds restantes",
|
||||
"done": "Listo.",
|
||||
"formats": "TSV, CSV, *SV, Excel (.xls y .xlsx), JSON, XML, RDF como XML. Datos en Documentos de Google también son compatibles. \nCompatibilidad para otros formatos puede ser añadida con las extensiones de OpenRefine.",
|
||||
@ -82,10 +93,12 @@
|
||||
"error": "Error:",
|
||||
"downloading-data": "Descargando datos ...",
|
||||
"parse-as": "Abrir archivo como",
|
||||
"unknown-err": "Error desconocido"
|
||||
"unknown-err": "Error desconocido",
|
||||
"project-tags": "Tags",
|
||||
"data-package": "Paquete de datos (JSON URL)"
|
||||
},
|
||||
"core-index-open": {
|
||||
"rename": "renombrar",
|
||||
"rename": "Renombrar",
|
||||
"del-body": "¿Está seguro de eliminar este proyecto \"",
|
||||
"open-proj": "Abrir proyecto",
|
||||
"browse": "Examinar el directorio de trabajo",
|
||||
@ -95,7 +108,17 @@
|
||||
"warning-data-file": "Debe especificar un archivo o una URL para cargar los datos.",
|
||||
"warning-rename": "Error al renombrar el proyecto:",
|
||||
"new-title": "Nuevo nombre del proyecto:",
|
||||
"last-mod": "Última modificación"
|
||||
"last-mod": "Última modificación",
|
||||
"edit-meta-data": "Acerca de",
|
||||
"edit-data-package": "Paquete de datos",
|
||||
"creator": "Creador",
|
||||
"contributors": "Colaboradores",
|
||||
"subject": "Tema",
|
||||
"description": "Descripción",
|
||||
"row-count": "Número de filas",
|
||||
"tags": "Tags",
|
||||
"edit-tags": "Editar etiquetas de proyecto",
|
||||
"edit-tags-desc": "Editar las etiquetas del proyecto (el espacio y las comas son delimitadores):"
|
||||
},
|
||||
"core-index-lang": {
|
||||
"label": "Seleccione el idioma de preferencia",
|
||||
@ -115,7 +138,7 @@
|
||||
"ignore-first": "Ignorar primera(s)",
|
||||
"store-nulls": "Cargar celdas en blanco como nulas",
|
||||
"lines-into-row": "lineas a una fila",
|
||||
"custom": "otro",
|
||||
"custom": "personalizado:",
|
||||
"quotation-mark": "Las comillas se usan<br/>para agrupar celdas que<br/>contienen separadores de columna",
|
||||
"json-parser": "Haga clic en el primer nodo JSON { } que corresponde al primer registro a cargar.",
|
||||
"parse-every": "Asignar cada",
|
||||
@ -126,7 +149,16 @@
|
||||
"lines-beg": "linea(s) al inicio del archivo",
|
||||
"preserve-empty": "Mantener las celdas vacías",
|
||||
"rows-data": "fila(s) de datos",
|
||||
"load-at-most": "Cargar al menos"
|
||||
"load-at-most": "Cargar al menos",
|
||||
"blank-spanning-cells": "Células de almohadilla que se extienden sobre múltiples filas o columnas con nulos",
|
||||
"include-raw-templates": "Incluir plantillas e imágenes como wikicode en bruto",
|
||||
"parse-references": "Extraer referencias en columnas adicionales",
|
||||
"wiki-base-url": "Reconciliar a wiki con URL base:",
|
||||
"invalid-wikitext": "No se pudo analizar ninguna tabla. ¿Estás seguro de que es una tabla wiki válida?",
|
||||
"use-quote": "Usar carácter",
|
||||
"quote-delimits-cells": "para encerrar celdas que contengan separadores de columnas",
|
||||
"column-names-label": "Nombres de columna (separados por comas)",
|
||||
"column-names-optional": "separado por comas"
|
||||
},
|
||||
"core-dialogs": {
|
||||
"help": "Ayuda",
|
||||
@ -215,7 +247,7 @@
|
||||
"language": "Lenguaje",
|
||||
"linear-plot": "Gráfica lineal",
|
||||
"excel-xml": "Excel en XML (.xlsx)",
|
||||
"custom-tab-exp": "Configurar exportación",
|
||||
"custom-tab-exp": "Exportador Tabular Personalizado",
|
||||
"error": "Error",
|
||||
"template-suffix": "Sufijo",
|
||||
"history": "Historial",
|
||||
@ -229,7 +261,7 @@
|
||||
"distance-fun": "Function ",
|
||||
"opt-code-applied": "Código de opción aplicado con éxito.",
|
||||
"excel": "Excel (.xls)",
|
||||
"error-apply-code": "Error aplicando código de opción.",
|
||||
"error-apply-code": "Error aplicando código de opción",
|
||||
"full-format": "Formato local completo",
|
||||
"scatterplot-matrix": "Matriz de gráficas",
|
||||
"upload-to": "Cargar a",
|
||||
@ -244,7 +276,22 @@
|
||||
"choices-in-cluster": "# Valores en la agrupación",
|
||||
"filtered-from": "filtrado de <b>",
|
||||
"big-dot": "Puntos grandes",
|
||||
"rotated-counter-clock": "Girar 45° en dirección contraria a las manecillas de reloj"
|
||||
"rotated-counter-clock": "Girar 45° en dirección contraria a las manecillas de reloj",
|
||||
"sql-exporter": "Exportador SQL",
|
||||
"select-columns-dialog": "Seleccionar columnas",
|
||||
"columnType": "Tipo de SQL",
|
||||
"for-include-structure-checkbox": "Incluir Schema",
|
||||
"for-include-drop-statement-checkbox": "Incluir Drop Statement",
|
||||
"for-include-content-checkbox": "Incluir Content",
|
||||
"tableNameLabel": "Nombre de tabla:",
|
||||
"sqlExporterTrimColumns": "Recortar Nombres de Columnas",
|
||||
"sqlExporterIgnoreFacets": "Ignorar facetas y filtros y exportar todas las filas",
|
||||
"sqlExporterOutputEmptyRows": "Producir fila vacía (es decir, todas las celdas nulas)",
|
||||
"for-include-if-exist-drop-stmt-checkbox": "Incluir'IF EXISTS' en la sentencia DROP",
|
||||
"for-null-cell-value-to-empty-str-label": "Convertir valor nulo a NULL en INSERT",
|
||||
"choose-export-destination": "Por favor, elija el destino para la exportación del proyecto",
|
||||
"export-to-local": "Exportar a local",
|
||||
"export-to-google-drive": "Exportar a Google Drive"
|
||||
},
|
||||
"core-facets": {
|
||||
"regular-dot": "Puntos regulares",
|
||||
@ -270,7 +317,7 @@
|
||||
"edit-based-col": "Editar la expresión de la faceta basandose en la columna",
|
||||
"facet-choices": "Facetas como valores separados por tabulaciones",
|
||||
"change": "cambiar",
|
||||
"case-sensitive": "Detectar may./min.",
|
||||
"case-sensitive": "Distingue mayúsculas y minúsculas",
|
||||
"reset": "restaurar",
|
||||
"logar-plot": "Gráfica logaritmica",
|
||||
"name": "A-Z",
|
||||
@ -325,7 +372,7 @@
|
||||
"not-sure": "¿Problemas para comenzar?",
|
||||
"permalink": "Enlace permanente",
|
||||
"learn-more": "Aprenda más »",
|
||||
"starting": "Iniciando ...",
|
||||
"starting": "Iniciando",
|
||||
"excel-xml": "Excel en XML (.xlsx)",
|
||||
"custom-tabular": "Configurar exportación ...",
|
||||
"filter": "Filtrar:",
|
||||
@ -333,7 +380,9 @@
|
||||
"other-processes": "otros procesos pendientes",
|
||||
"use-facets": "Usar facetas y filtros",
|
||||
"paste-json": "Pegue un historial de operaciones extraido en JSON para que sea ejecutado:",
|
||||
"undo-history": "Historial de deshacer infinito"
|
||||
"undo-history": "Historial de deshacer infinito",
|
||||
"project-data-package": "Paquete de datos del proyecto",
|
||||
"sql-export": "Exportador de SQL...."
|
||||
},
|
||||
"core-recon": {
|
||||
"error-contact": "Error contactando al servicio",
|
||||
@ -419,7 +468,7 @@
|
||||
"apply-to-cell": "Aplicar a celdas con parámetros",
|
||||
"matched": "Emparejado",
|
||||
"move-to-beg": "Mover columna al principio",
|
||||
"case-sensitive": "Detectar may./min.",
|
||||
"case-sensitive": "Distingue mayúsculas y minúsculas",
|
||||
"times-chang": "veces hasta que no haya cambios",
|
||||
"facets": "Facetas",
|
||||
"choose-match": "Escoger nueva coincidencia",
|
||||
@ -437,7 +486,7 @@
|
||||
"best-name": "Por el emparejamiento del nombre",
|
||||
"collapse-expand": "Puede contraer/expandir columnas para hacer la visualización más agradable",
|
||||
"val-col": "Columna Valor",
|
||||
"uppercase": "A MAYÚSC.",
|
||||
"uppercase": "A mayúsculas",
|
||||
"re-trans": "Re-transformar hasta",
|
||||
"warning-no-length": "No se especificó un valor de longitud.",
|
||||
"discard-judg": "Descartar parámetros de cotejo",
|
||||
@ -537,7 +586,7 @@
|
||||
"spec-new-val": "Por favor indique el nombre de columna para el nuevo valor.",
|
||||
"edit-cells": "Editar celdas",
|
||||
"sort": "Ordenar",
|
||||
"match-all-cells": "Coincidir este valor en todas las celdas identicas",
|
||||
"match-all-cells": "Emparejar este artículo con esta y todas las celdas idénticas",
|
||||
"warning-sel-judg": "Por favor seleccione algún tipo de parámetro a copiar.",
|
||||
"remove-sort": "Quitar orden",
|
||||
"common-transform": "Transformaciones comunes",
|
||||
@ -575,9 +624,9 @@
|
||||
"copy-to-col": "Copiar a columnas",
|
||||
"key-col": "Columna Clave",
|
||||
"on-error": "En error",
|
||||
"match-this-cell": "Coincidir este valor en esta celda",
|
||||
"match-this-cell": "Emparejar este artículo con esta celda",
|
||||
"not-valid-date": "No es una fecha valida.",
|
||||
"create-topic-cells": "Create un nuevo elemento en todas las celdas identicas",
|
||||
"create-topic-cells": "Crear un nuevo elemento para esta y todas las celdas idénticas",
|
||||
"warning-no-property": "Seleccione primero una propiedad.",
|
||||
"contain-names": "(conteniendo los nombres originales de las columnas)",
|
||||
"best-cand-score": "por el puntaje del mejor candidato",
|
||||
@ -594,7 +643,7 @@
|
||||
"transp-cell": "Transponer Celdas de Columnas a Filas",
|
||||
"best-cand-name": "¿El emparejamiento del nombre del mejor candidato encaja?",
|
||||
"blanks": "Blancos",
|
||||
"lowercase": "A minúsc.",
|
||||
"lowercase": "A minúsculas",
|
||||
"transp-into": "Transponer dentro",
|
||||
"facet-star": "Faceta por estrellas",
|
||||
"collapse-all": "Contraer todas las columnas",
|
||||
@ -618,7 +667,22 @@
|
||||
"prepend-name": "Anteponer el nombre original de columna en cada celda",
|
||||
"first": "primera",
|
||||
"recon-text-fb": "Coincidir texto en esta columna con valores de Freebase",
|
||||
"collapse-this": "Contraer esta columna"
|
||||
"collapse-this": "Contraer esta columna",
|
||||
"reconcile-tooltip": "Emparejar las celdas de esta columna con elementos de bases de datos externas",
|
||||
"extend-not-reconciled": "Esta operación sólo está disponible en columnas reconciliadas.",
|
||||
"extend-not-supported": "Este servicio de reconciliación no soporta la extensión de datos. Intenta eliminar el servicio y volver a añadirlo. Si el problema persiste, ponte en contacto con el proveedor de servicios.",
|
||||
"http-headers": "Cabeceras HTTP que se utilizarán cuando se obtengan URLs:",
|
||||
"how-split-cells": "Cómo dividir celdas de varios valores",
|
||||
"table-schema-validate": "Validar",
|
||||
"display-null": "Mostrar/ocultar valores ' null ' en celdas",
|
||||
"blank-out-empty": "A la cadena vacia",
|
||||
"replace": "Reemplazar",
|
||||
"hide": "Ocultar",
|
||||
"text-to-find": "Buscar:",
|
||||
"replacement-text": "Reemplazar con:",
|
||||
"case-insensitive": "insensible a mayúsculas y minúsculas",
|
||||
"whole-word": "palabra entera",
|
||||
"finding-info2": "Usa \"expresion regular\" para encontrar caracteres especiales (nuevas líneas, Tabulaciones...) o patrones complejos."
|
||||
},
|
||||
"core-buttons": {
|
||||
"unselect-all": "Seleccionar ninguno",
|
||||
|
Loading…
Reference in New Issue
Block a user