Package org.openrefine.wikibase.schema
Class WbMediaInfoEditExpr
- java.lang.Object
-
- org.openrefine.wikibase.schema.WbMediaInfoEditExpr
-
- All Implemented Interfaces:
WbExpression<MediaInfoEdit>
public class WbMediaInfoEditExpr extends Object implements WbExpression<MediaInfoEdit>
The representation of an item edit, which can contain variables both for its own id and in its contents.- Author:
- Antonin Delpeuch
-
-
Field Summary
Fields Modifier and Type Field Description static String
INVALID_SUBJECT_WARNING_TYPE
static Pattern
normalizedFileNameChars
static String
REPLACED_CHARACTERS_IN_FILENAME
-
Constructor Summary
Constructors Constructor Description WbMediaInfoEditExpr(WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.EntityIdValue> subjectExpr, List<WbNameDescExpr> nameDescExprs, List<WbStatementGroupExpr> statementGroupExprs, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> filePath, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> fileName, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> wikitext, boolean overrideWikitext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
MediaInfoEdit
evaluate(ExpressionContext ctxt)
Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim.WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue>
getFileName()
The filename at which the file should be uploaded (if new), or moved (if existing).WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue>
getFilePath()
The path to the file that should be uploaded, either to replace the current file if the subject already exists, or to create a new file on the MediaWiki instance if the subject does not exist yet.List<WbNameDescExpr>
getNameDescs()
The captions edited on the mediainfo entity.List<WbStatementGroupExpr>
getStatementGroups()
The statements edited on the mediainfo entity.WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.EntityIdValue>
getSubject()
The Mid for the entity.WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue>
getWikitext()
The wikitext to be added to the file (or edited)int
hashCode()
boolean
isOverridingWikitext()
Whether the provided wikitext should override any existing wikitext.void
validate(ValidationState validation)
Check that this expression is fully formed and ready to be evaluated.
-
-
-
Field Detail
-
normalizedFileNameChars
public static final Pattern normalizedFileNameChars
-
INVALID_SUBJECT_WARNING_TYPE
public static final String INVALID_SUBJECT_WARNING_TYPE
- See Also:
- Constant Field Values
-
REPLACED_CHARACTERS_IN_FILENAME
public static final String REPLACED_CHARACTERS_IN_FILENAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WbMediaInfoEditExpr
public WbMediaInfoEditExpr(WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.EntityIdValue> subjectExpr, List<WbNameDescExpr> nameDescExprs, List<WbStatementGroupExpr> statementGroupExprs, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> filePath, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> fileName, WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> wikitext, boolean overrideWikitext)
-
-
Method Detail
-
validate
public void validate(ValidationState validation)
Description copied from interface:WbExpression
Check that this expression is fully formed and ready to be evaluated.- Specified by:
validate
in interfaceWbExpression<MediaInfoEdit>
- Parameters:
validation
- the state in which to log any validation errors
-
evaluate
public MediaInfoEdit evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException, QAWarningException
Description copied from interface:WbExpression
Evaluates the value expression in a given context, returns a Wikibase value suitable to be the target of a claim. As a premise to calling that method, we assume that callingWbExpression.validate(ValidationState)
did not log any error in the validation state.- Specified by:
evaluate
in interfaceWbExpression<MediaInfoEdit>
- Throws:
SkipSchemaExpressionException
QAWarningException
-
getSubject
public WbExpression<? extends org.wikidata.wdtk.datamodel.interfaces.EntityIdValue> getSubject()
The Mid for the entity. If marked as new, a new file will be uploaded, otherwise the existing MediaInfo entity will be edited.
-
getNameDescs
public List<WbNameDescExpr> getNameDescs()
The captions edited on the mediainfo entity.
-
getStatementGroups
public List<WbStatementGroupExpr> getStatementGroups()
The statements edited on the mediainfo entity.
-
getFilePath
public WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> getFilePath()
The path to the file that should be uploaded, either to replace the current file if the subject already exists, or to create a new file on the MediaWiki instance if the subject does not exist yet. Can be null if editing existing entities only (in which case the files' contents are not changed)
-
getFileName
public WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> getFileName()
The filename at which the file should be uploaded (if new), or moved (if existing). Can be null if editing existing entities only (in which case the files will not be moved)
-
getWikitext
public WbExpression<org.wikidata.wdtk.datamodel.interfaces.StringValue> getWikitext()
The wikitext to be added to the file (or edited)- Returns:
-
isOverridingWikitext
public boolean isOverridingWikitext()
Whether the provided wikitext should override any existing wikitext.
-
-