Add unsourced scrutinizer

This commit is contained in:
Antonin Delpeuch 2018-01-09 11:01:53 +00:00
parent 665585add9
commit 142eeabfeb
3 changed files with 35 additions and 12 deletions

View File

@ -19,40 +19,40 @@
"body": "Please make sure that these items do not exist yet and are suitable for inclusion in Wikidata." "body": "Please make sure that these items do not exist yet and are suitable for inclusion in Wikidata."
}, },
"new-item-without-labels-or-aliases": { "new-item-without-labels-or-aliases": {
"title": "Some new items will be 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, so that others can understand what the item is about."
}, },
"new-item-without-descriptions": { "new-item-without-descriptions": {
"title": "Some new items will be 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 will make it easier to disambiguate the items from namesakes."
}, },
"new-item-with-deleted-statements": { "new-item-with-deleted-statements": {
"title": "You are trying to delete statements on new items.", "title": "Deleting statements on new items.",
"body": "There is probably something wrong in your schema or project." "body": "There is probably something wrong in your schema or project."
}, },
"new-item-without-P31-or-P279": { "new-item-without-P31-or-P279": {
"title": "Some new items will be 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."
}, },
"statement-without-reference": {
"title": "Some statements are not referenced.",
"body": "Please provide references for the statements that you add."
},
"add-statements-with-invalid-format": { "add-statements-with-invalid-format": {
"title": "Invalid format for some text statements.", "title": "Text statements with invalid format.",
"body": "Please consult the documentation of the properties to find out the correct format for their values." "body": "Please consult the documentation of the properties to find out the correct format for their values."
}, },
"remove-statements-with-invalid-format": { "remove-statements-with-invalid-format": {
"title": "Statements with invalid format will be removed.", "title": "Removed statements with invalid format.",
"body": "If these statements currently exist on Wikidata, this will solve constraint violations." "body": "If these statements currently exist on Wikidata, this will solve constraint violations."
}, },
"missing-inverse-statements": { "missing-inverse-statements": {
"title": "Inverse statements will not be added.", "title": "Missing inverse statements.",
"body": "Some of the properties that you are using require inverse statements. You should add them in your schema." "body": "Some of the properties that you are using require inverse statements. You should add them in your schema."
}, },
"self-referential-statements": { "self-referential-statements": {
"title": "Some statements are self-referential.", "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 could have reconciliation issues."
},
"unsourced-statements": {
"title": "Statements without references.",
"body": "Most statements should have references. You can add them easily in the schema."
} }
} }
} }

View File

@ -9,6 +9,7 @@ import org.openrefine.wikidata.qa.scrutinizers.FormatConstraintScrutinizer;
import org.openrefine.wikidata.qa.scrutinizers.InverseConstraintScrutinizer; import org.openrefine.wikidata.qa.scrutinizers.InverseConstraintScrutinizer;
import org.openrefine.wikidata.qa.scrutinizers.NewItemScrutinizer; import org.openrefine.wikidata.qa.scrutinizers.NewItemScrutinizer;
import org.openrefine.wikidata.qa.scrutinizers.SelfReferentialScrutinizer; import org.openrefine.wikidata.qa.scrutinizers.SelfReferentialScrutinizer;
import org.openrefine.wikidata.qa.scrutinizers.UnsourcedScrutinizer;
import org.openrefine.wikidata.schema.ItemUpdate; import org.openrefine.wikidata.schema.ItemUpdate;
/** /**
@ -29,6 +30,7 @@ public class EditInspector {
register(new FormatConstraintScrutinizer()); register(new FormatConstraintScrutinizer());
register(new InverseConstraintScrutinizer()); register(new InverseConstraintScrutinizer());
register(new SelfReferentialScrutinizer()); register(new SelfReferentialScrutinizer());
register(new UnsourcedScrutinizer());
} }
/** /**

View File

@ -0,0 +1,21 @@
package org.openrefine.wikidata.qa.scrutinizers;
import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue;
import org.wikidata.wdtk.datamodel.interfaces.Statement;
/**
* A scrutinizer checking for unsourced statements
*
* @author antonin
*
*/
public class UnsourcedScrutinizer extends StatementScrutinizer {
@Override
public void scrutinize(Statement statement, EntityIdValue entityId, boolean added) {
if(statement.getReferences().isEmpty() && added) {
warning("unsourced-statements");
}
}
}