Class EditScrutinizer
- java.lang.Object
-
- org.openrefine.wikibase.qa.scrutinizers.EditScrutinizer
-
- Direct Known Subclasses:
ConflictsWithScrutinizer,DescriptionScrutinizer,DifferenceWithinRangeScrutinizer,FileNameScrutinizer,ItemRequiresScrutinizer,MultiValueScrutinizer,NewEntityScrutinizer,NoEditsMadeScrutinizer,SingleValueScrutinizer,StatementScrutinizer,UnsourcedScrutinizer,UseAsQualifierScrutinizer
public abstract class EditScrutinizer extends Object
Inspects an edit batch and emits warnings.- Author:
- Antonin Delpeuch
-
-
Field Summary
Fields Modifier and Type Field Description protected ConstraintFetcher_fetcherprotected QAWarningStore_storeprotected org.wikidata.wdtk.wikibaseapi.ApiConnectionconnectionprotected booleanenableSlowChecksprotected Manifestmanifest
-
Constructor Summary
Constructors Constructor Description EditScrutinizer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddIssue(String type, String aggregationId, QAWarning.Severity severity, int count, boolean facetable)protected voidaddIssue(QAWarning warning)Emits an issue that will be reported to the user, after merging with other issues of the same kind.voidbatchIsBeginning()Called before an edit batch is scrutinized.voidbatchIsFinished()Method called once the edit batch has been read entirelyprotected voidcritical(String type)Helper to be used by subclasses to emit simple critical warningsprotected List<org.wikidata.wdtk.datamodel.interfaces.Value>findValues(List<org.wikidata.wdtk.datamodel.interfaces.SnakGroup> groups, String pid)Returns the values of a given property in qualifiersStringgetConstraintsRelatedId(String name)protected voidimportant(String type)Helper to be used by subclasses to emit simple important warningsprotected voidinfo(String type)Helper to be used by subclasses to emit simple INFO warningsprotected voidinfoNotFacetable(String type)Helper to be used by subclasses to emit simple INFO warnings, which are not facetableabstract booleanprepareDependencies()Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer.voidscrutinize(EntityEdit edit)Reads the candidate edit and emits warnings in the storeabstract voidscrutinize(ItemEdit edit)Reads the candidate edit and emits warnings in the storeabstract voidscrutinize(MediaInfoEdit edit)Reads the candidate edit and emits warnings in the storevoidsetApiConnection(org.wikidata.wdtk.wikibaseapi.ApiConnection connection)voidsetEnableSlowChecks(boolean enableSlowChecks)False by default.voidsetFetcher(ConstraintFetcher fetcher)The fetcher will be set to null if 'property_constraint_pid' is missing in the manifest.voidsetManifest(Manifest manifest)voidsetStore(QAWarningStore store)protected voidwarning(String type)Helper to be used by subclasses to emit simple warnings
-
-
-
Field Detail
-
_store
protected QAWarningStore _store
-
_fetcher
protected ConstraintFetcher _fetcher
-
connection
protected org.wikidata.wdtk.wikibaseapi.ApiConnection connection
-
manifest
protected Manifest manifest
-
enableSlowChecks
protected boolean enableSlowChecks
-
-
Method Detail
-
setStore
public void setStore(QAWarningStore store)
-
setFetcher
public void setFetcher(ConstraintFetcher fetcher)
The fetcher will be set to null if 'property_constraint_pid' is missing in the manifest.
-
setManifest
public void setManifest(Manifest manifest)
-
setApiConnection
public void setApiConnection(org.wikidata.wdtk.wikibaseapi.ApiConnection connection)
-
setEnableSlowChecks
public void setEnableSlowChecks(boolean enableSlowChecks)
False by default.- Parameters:
enableSlowChecks- whether this scrutinizer is allowed to run more expensive checks (typically, those requesting to fetch external resources, make extra queries to an online serviceā¦).
-
prepareDependencies
public abstract boolean prepareDependencies()
Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer. Called beforebatchIsBeginning().- Returns:
- false if any necessary dependency is missing, true otherwise.
-
batchIsBeginning
public void batchIsBeginning()
Called before an edit batch is scrutinized.
-
scrutinize
public void scrutinize(EntityEdit edit)
Reads the candidate edit and emits warnings in the store- Parameters:
edit- : theEntityEditto scrutinize
-
scrutinize
public abstract void scrutinize(ItemEdit edit)
Reads the candidate edit and emits warnings in the store- Parameters:
edit- : theItemEditto scrutinize
-
scrutinize
public abstract void scrutinize(MediaInfoEdit edit)
Reads the candidate edit and emits warnings in the store- Parameters:
edit- : theItemEditto scrutinize
-
batchIsFinished
public void batchIsFinished()
Method called once the edit batch has been read entirely
-
addIssue
protected void addIssue(QAWarning warning)
Emits an issue that will be reported to the user, after merging with other issues of the same kind.- Parameters:
warning- the issue to report
-
addIssue
protected void addIssue(String type, String aggregationId, QAWarning.Severity severity, int count, boolean facetable)
-
info
protected void info(String type)
Helper to be used by subclasses to emit simple INFO warnings
-
infoNotFacetable
protected void infoNotFacetable(String type)
Helper to be used by subclasses to emit simple INFO warnings, which are not facetable
-
warning
protected void warning(String type)
Helper to be used by subclasses to emit simple warnings
-
important
protected void important(String type)
Helper to be used by subclasses to emit simple important warnings
-
critical
protected void critical(String type)
Helper to be used by subclasses to emit simple critical warnings
-
-