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
_fetcher
protected QAWarningStore
_store
protected org.wikidata.wdtk.wikibaseapi.ApiConnection
connection
protected boolean
enableSlowChecks
protected Manifest
manifest
-
Constructor Summary
Constructors Constructor Description EditScrutinizer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addIssue(String type, String aggregationId, QAWarning.Severity severity, int count, boolean facetable)
protected void
addIssue(QAWarning warning)
Emits an issue that will be reported to the user, after merging with other issues of the same kind.void
batchIsBeginning()
Called before an edit batch is scrutinized.void
batchIsFinished()
Method called once the edit batch has been read entirelyprotected void
critical(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 qualifiersString
getConstraintsRelatedId(String name)
protected void
important(String type)
Helper to be used by subclasses to emit simple important warningsprotected void
info(String type)
Helper to be used by subclasses to emit simple INFO warningsprotected void
infoNotFacetable(String type)
Helper to be used by subclasses to emit simple INFO warnings, which are not facetableabstract boolean
prepareDependencies()
Prepare the dependencies(i.e. constraint-related pids and qids) needed by the scrutinizer.void
scrutinize(EntityEdit edit)
Reads the candidate edit and emits warnings in the storeabstract void
scrutinize(ItemEdit edit)
Reads the candidate edit and emits warnings in the storeabstract void
scrutinize(MediaInfoEdit edit)
Reads the candidate edit and emits warnings in the storevoid
setApiConnection(org.wikidata.wdtk.wikibaseapi.ApiConnection connection)
void
setEnableSlowChecks(boolean enableSlowChecks)
False by default.void
setFetcher(ConstraintFetcher fetcher)
The fetcher will be set to null if 'property_constraint_pid' is missing in the manifest.void
setManifest(Manifest manifest)
void
setStore(QAWarningStore store)
protected void
warning(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
- : theEntityEdit
to scrutinize
-
scrutinize
public abstract void scrutinize(ItemEdit edit)
Reads the candidate edit and emits warnings in the store- Parameters:
edit
- : theItemEdit
to scrutinize
-
scrutinize
public abstract void scrutinize(MediaInfoEdit edit)
Reads the candidate edit and emits warnings in the store- Parameters:
edit
- : theItemEdit
to 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
-
-