Add explanations on remaining scrutinizers

This commit is contained in:
Antonin Delpeuch 2018-01-10 17:37:39 +00:00
parent 024c8cd6a5
commit 1cf9378523
6 changed files with 76 additions and 27 deletions

View File

@ -23,11 +23,11 @@
}, },
"new-item-without-labels-or-aliases": { "new-item-without-labels-or-aliases": {
"title": "New items created without any label or alias.", "title": "New items created without any label or alias.",
"body": "You should at least provide one label, so that others can understand what the item is about." "body": "You should at least provide one label for new items such as {example_entity}, so that others can understand what the item is about."
}, },
"new-item-without-descriptions": { "new-item-without-descriptions": {
"title": "New items created without any description.", "title": "New items created without any description.",
"body": "Adding descriptions will make it easier to disambiguate the items from namesakes." "body": "Adding descriptions on new items such as {example_entity} will make it easier to disambiguate the items from namesakes."
}, },
"new-item-with-deleted-statements": { "new-item-with-deleted-statements": {
"title": "Deleting statements on new items.", "title": "Deleting statements on new items.",
@ -35,7 +35,7 @@
}, },
"new-item-without-P31-or-P279": { "new-item-without-P31-or-P279": {
"title": "New items created without any type.", "title": "New items created without any type.",
"body": "You should provide an \"instance of\" (P31) or \"subclass of\" (P279) statement for each item that you create." "body": "You should provide an \"instance of\" (P31) or \"subclass of\" (P279) statement for each item that you create, such as {example_entity}."
}, },
"add-statements-with-invalid-format": { "add-statements-with-invalid-format": {
"title": "{property_entity} statements with invalid format.", "title": "{property_entity} statements with invalid format.",
@ -51,35 +51,35 @@
}, },
"self-referential-statements": { "self-referential-statements": {
"title": "Self-referential statements.", "title": "Self-referential statements.",
"body": "While not forbidden, self-referential statements are generally suspicious. You could have reconciliation issues." "body": "While not forbidden, self-referential statements are generally suspicious. You have some on {example_entity}."
}, },
"unsourced-statements": { "unsourced-statements": {
"title": "Statements without references.", "title": "Statements without references.",
"body": "Most statements should have references. You can add them easily in the schema." "body": "Most statements should have references. You can add them easily in the schema."
}, },
"property-restricted-to-reference-found-in-mainsnak": { "property-restricted-to-reference-found-in-mainsnak": {
"title": "Reference-only property used as statement.", "title": "{property_entity} used as statement.",
"body": "You are using in a statement a property that was designed to be used in references only." "body": "You are using {property_entity} in a statement but it is designed to be used in references only."
}, },
"property-restricted-to-reference-found-in-qualifier": { "property-restricted-to-reference-found-in-qualifier": {
"title": "Reference-only property used as qualifier.", "title": "{property_entity} used as qualifier.",
"body": "You are using in a qualifier a property that was designed to be used in references only." "body": "You are using in {property_entity} in a qualifier but it is designed to be used in references only."
}, },
"property-restricted-to-qualifier-found-in-mainsnak": { "property-restricted-to-qualifier-found-in-mainsnak": {
"title": "Qualifier-only property used as statement.", "title": "{property_entity} used as statement.",
"body": "You are using in a statement a property that was designed to be used in qualifiers only." "body": "You are using {property_entity} in a statement but it is designed to be used in qualifiers only."
}, },
"property-restricted-to-qualifier-found-in-reference": { "property-restricted-to-qualifier-found-in-reference": {
"title": "Qualifier-only property used as reference.", "title": "{property_entity} used as reference.",
"body": "You are using in a reference a property that was designed to be used in qualifiers only." "body": "You are using {property_entity} in a reference but it is designed to be used in qualifiers only."
}, },
"property-restricted-to-mainsnak-found-in-qualifier": { "property-restricted-to-mainsnak-found-in-qualifier": {
"title": "Statement-only property used as qualifier.", "title": "{property_entity} used as qualifier.",
"body": "You are using in a qualifier a property that was designed to be used as a statement only." "body": "You are using {property_entity} in a qualifier but it is designed to be used as a statement only."
}, },
"property-restricted-to-mainsnak-found-in-reference": { "property-restricted-to-mainsnak-found-in-reference": {
"title": "Statement-only property used as reference.", "title": "{property_entity} used as reference.",
"body": "You are using in a reference a property that was designed to be used as a statement only." "body": "You are using {property_entity} in a reference but it is designed to be used as a statement only."
}, },
"missing-mandatory-qualifiers": { "missing-mandatory-qualifiers": {
"title": "{statement_property_entity} is missing a {missing_property_entity} qualifier.", "title": "{statement_property_entity} is missing a {missing_property_entity} qualifier.",
@ -90,8 +90,8 @@
"body": "Statements using {statement_property_entity} such as the one on {example_item_entity} should not have a {disallowed_property_entity} qualifier as they are incompatible." "body": "Statements using {statement_property_entity} such as the one on {example_item_entity} should not have a {disallowed_property_entity} qualifier as they are incompatible."
}, },
"single-valued-property-added-more-than-once": { "single-valued-property-added-more-than-once": {
"title": "Single valued property added more than once.", "title": "{property_entity} added more than once on the same item.",
"body": "A property that is expected to be used at most once on each item has been added multiple times on the same item." "body": "This property is expected to be used at most once on each item but has been added multiple times on the same item, for instance on {example_entity}."
}, },
"no-edit-generated": { "no-edit-generated": {
"title": "No edit was generated.", "title": "No edit was generated.",

View File

@ -89,8 +89,8 @@ public class InverseConstraintScrutinizer extends StatementScrutinizer {
1); 1);
issue.setProperty("added_property_entity", ourProperty); issue.setProperty("added_property_entity", ourProperty);
issue.setProperty("inverse_property_entity", missingProperty); issue.setProperty("inverse_property_entity", missingProperty);
issue.setProperty("source_entity", idValue); issue.setProperty("source_entity", itemLinks.getKey());
issue.setProperty("target_entity", itemLinks.getKey()); issue.setProperty("target_entity", idValue);
addIssue(issue); addIssue(issue);
} }
} }

View File

@ -1,5 +1,6 @@
package org.openrefine.wikidata.qa.scrutinizers; package org.openrefine.wikidata.qa.scrutinizers;
import org.openrefine.wikidata.qa.QAWarning;
import org.openrefine.wikidata.schema.ItemUpdate; import org.openrefine.wikidata.schema.ItemUpdate;
import org.wikidata.wdtk.datamodel.interfaces.StatementGroup; import org.wikidata.wdtk.datamodel.interfaces.StatementGroup;
@ -15,15 +16,33 @@ public class NewItemScrutinizer extends ItemEditScrutinizer {
info("new-item-created"); info("new-item-created");
if (update.getLabels().isEmpty() && update.getAliases().isEmpty()) { if (update.getLabels().isEmpty() && update.getAliases().isEmpty()) {
critical("new-item-without-labels-or-aliases"); QAWarning issue = new QAWarning(
"new-item-without-labels-or-aliases",
null,
QAWarning.Severity.CRITICAL,
1);
issue.setProperty("example_entity", update.getItemId());
addIssue(issue);
} }
if (update.getDescriptions().isEmpty()) { if (update.getDescriptions().isEmpty()) {
warning("new-item-without-descriptions"); QAWarning issue = new QAWarning(
"new-item-without-descriptions",
null,
QAWarning.Severity.WARNING,
1);
issue.setProperty("example_entity", update.getItemId());
addIssue(issue);
} }
if (! update.getDeletedStatements().isEmpty()) { if (! update.getDeletedStatements().isEmpty()) {
warning("new-item-with-deleted-statements"); QAWarning issue = new QAWarning(
"new-item-with-deleted-statements",
null,
QAWarning.Severity.WARNING,
1);
issue.setProperty("example_entity", update.getItemId());
addIssue(issue);
} }
// Try to find a "instance of" or "subclass of" claim // Try to find a "instance of" or "subclass of" claim
@ -36,7 +55,13 @@ public class NewItemScrutinizer extends ItemEditScrutinizer {
} }
} }
if (!typeFound) { if (!typeFound) {
warning("new-item-without-P31-or-P279"); QAWarning issue = new QAWarning(
"new-item-without-P31-or-P279",
null,
QAWarning.Severity.WARNING,
1);
issue.setProperty("example_entity", update.getItemId());
addIssue(issue);
} }
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.openrefine.wikidata.qa.QAWarning;
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue; import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue; import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
import org.wikidata.wdtk.datamodel.interfaces.Reference; import org.wikidata.wdtk.datamodel.interfaces.Reference;
@ -81,7 +82,14 @@ public class RestrictedPositionScrutinizer extends StatementScrutinizer {
if (restriction != null && position != restriction) { if (restriction != null && position != restriction) {
String positionStr = position.toString().toLowerCase(); String positionStr = position.toString().toLowerCase();
String restrictionStr = restriction.toString().toLowerCase(); String restrictionStr = restriction.toString().toLowerCase();
warning("property-restricted-to-"+restrictionStr+"-found-in-"+positionStr);
QAWarning issue = new QAWarning(
"property-restricted-to-"+restrictionStr+"-found-in-"+positionStr,
snak.getPropertyId().getId(),
QAWarning.Severity.IMPORTANT,
1);
issue.setProperty("property_entity", snak.getPropertyId());
addIssue(issue);
} }
} }

View File

@ -1,5 +1,6 @@
package org.openrefine.wikidata.qa.scrutinizers; 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.EntityIdValue;
import org.wikidata.wdtk.datamodel.interfaces.Snak; import org.wikidata.wdtk.datamodel.interfaces.Snak;
@ -15,7 +16,13 @@ public class SelfReferentialScrutinizer extends SnakScrutinizer {
@Override @Override
public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) { public void scrutinize(Snak snak, EntityIdValue entityId, boolean added) {
if (entityId.equals(snak.getValue())) { if (entityId.equals(snak.getValue())) {
warning("self-referential-statements"); QAWarning issue = new QAWarning(
"self-referential-statements",
null,
QAWarning.Severity.WARNING,
1);
issue.setProperty("example_entity", entityId);
addIssue(issue);
} }
} }

View File

@ -3,6 +3,7 @@ package org.openrefine.wikidata.qa.scrutinizers;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.openrefine.wikidata.qa.QAWarning;
import org.openrefine.wikidata.schema.ItemUpdate; import org.openrefine.wikidata.schema.ItemUpdate;
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue; import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
import org.wikidata.wdtk.datamodel.interfaces.Statement; import org.wikidata.wdtk.datamodel.interfaces.Statement;
@ -22,7 +23,15 @@ public class SingleValueScrutinizer extends ItemEditScrutinizer {
for(Statement statement : update.getAddedStatements()) { for(Statement statement : update.getAddedStatements()) {
PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId(); PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId();
if (seenSingleProperties.contains(pid)) { if (seenSingleProperties.contains(pid)) {
warning("single-valued-property-added-more-than-once");
QAWarning issue = new QAWarning(
"single-valued-property-added-more-than-once",
pid.getId(),
QAWarning.Severity.WARNING,
1);
issue.setProperty("property_entity", pid);
issue.setProperty("example_entity", update.getItemId());
addIssue(issue);
} else if (_fetcher.hasSingleValue(pid)) { } else if (_fetcher.hasSingleValue(pid)) {
seenSingleProperties.add(pid); seenSingleProperties.add(pid);
} }