Extension:WikibaseMediaInfo/Lua

From Linux Web Expert

WikibaseMediaInfo provides a Lua Scribunto interface to access MediaInfo entities. It does so by:

  1. integrating with the existing mw.wikibase methods, making MediaInfo entities accessible alongside other Wikibase entities.
  2. exposing a new set of methods under mw.wikibase.mediainfo, that is mostly identical to the mw.wikibase methods, but has been adapted to be more MediaInfo specific:
    1. getCaption* functions - an alias for getLabel* functions - have been added
    2. getEntityIdForTitle doesn't support the globalSiteId argument

mw.wikibase.mediainfo

mw.wikibase.mediainfo has general Lua functionality for working with MediaInfo data.

mw.wikibase.mediainfo.getEntity

mw.wikibase.mediainfo.getEntity()
mw.wikibase.mediainfo.getEntity( id )

This function is identical to the more generic mw.wikibase.getEntity provided by Wikibase, but will return MediaInfo entity objects. Please refer to Wikibase Lua documentation for mw.wikibase.getEntity.

mw.wikibase.mediainfo.getEntityIdForCurrentPage

mw.wikibase.mediainfo.getEntityIdForCurrentPage()

This function is identical to the more generic mw.wikibase.getEntityIdForCurrentPage provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getEntityIdForCurrentPage.

mw.wikibase.mediainfo.getEntityIdForTitle

mw.wikibase.mediainfo.getEntityIdForTitle( pageTitle )

This function is identical to the more generic mw.wikibase.getEntityIdForTitle provided by Wikibase, except that there is no support for a second argument: globalSiteId - entities are only accessible on the local wiki that acts as the MediaInfo repository. Please refer to Wikibase Lua documentation for mw.wikibase.getEntityIdForTitle.

mw.wikibase.mediainfo.getEntityUrl

mw.wikibase.mediainfo.getEntityUrl()
mw.wikibase.mediainfo.getEntityUrl( id )

This function is identical to the more generic mw.wikibase.getEntityUrl provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getEntityUrl.

mw.wikibase.mediainfo.getLabel

mw.wikibase.mediainfo.getLabel()
mw.wikibase.mediainfo.getLabel( id )

This function is identical to the more generic mw.wikibase.getLabel provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getLabel.

mw.wikibase.mediainfo.getLabelWithLang

mw.wikibase.mediainfo.getLabelWithLang()
mw.wikibase.mediainfo.getLabelWithLang( id )

This function is identical to the more generic mw.wikibase.getLabelWithLang provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getLabelWithLang.

mw.wikibase.mediainfo.getLabelByLang

mw.wikibase.mediainfo.getLabelByLang( id, languageCode )

This function is identical to the more generic mw.wikibase.getLabelByLang provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getLabelByLang.

mw.wikibase.mediainfo.getCaption

mw.wikibase.mediainfo.getCaption()
mw.wikibase.mediainfo.getCaption( id )

This function is an alias for getLabel.

mw.wikibase.mediainfo.getCaptionWithLang

mw.wikibase.mediainfo.getCaptionWithLang()
mw.wikibase.mediainfo.getCaptionWithLang( id )

This function is an alias for getLabelWithLang.

mw.wikibase.mediainfo.getCaptionByLang

mw.wikibase.mediainfo.getCaptionByLang( id, languageCode )

This function is an alias for getLabelByLang.

mw.wikibase.mediainfo.getDescription

mw.wikibase.mediainfo.getDescription()
mw.wikibase.mediainfo.getDescription( id )

This function is identical to the more generic mw.wikibase.getDescription provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getDescription.

mw.wikibase.mediainfo.getDescriptionWithLang

mw.wikibase.mediainfo.getDescriptionWithLang()
mw.wikibase.mediainfo.getDescriptionWithLang( id )

This function is identical to the more generic mw.wikibase.getDescriptionWithLang provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getDescriptionWithLang.

mw.wikibase.mediainfo.isValidEntityId

mw.wikibase.mediainfo.isValidEntityId( entityIdSerialization )

This function is identical to the more generic mw.wikibase.isValidEntityId provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.isValidEntityId.

mw.wikibase.mediainfo.entityExists

mw.wikibase.mediainfo.entityExists( id )

This function is identical to the more generic mw.wikibase.entityExists provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entityExists.

mw.wikibase.mediainfo.renderSnak

mw.wikibase.mediainfo.renderSnak( snakSerialization )

This function is identical to the more generic mw.wikibase.renderSnak provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.renderSnak.

mw.wikibase.mediainfo.formatValue

mw.wikibase.mediainfo.formatValue( snakSerialization )

This function is identical to the more generic mw.wikibase.formatValue provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.formatValue.

mw.wikibase.mediainfo.renderSnaks

mw.wikibase.mediainfo.renderSnaks( snaksSerialization )

This function is identical to the more generic mw.wikibase.renderSnaks provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.renderSnaks.

mw.wikibase.mediainfo.formatValues

mw.wikibase.mediainfo.formatValues( snaksSerialization )

This function is identical to the more generic mw.wikibase.formatValues provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.formatValues.

mw.wikibase.mediainfo.resolvePropertyId

mw.wikibase.mediainfo.resolvePropertyId( propertyLabelOrId )

This function is identical to the more generic mw.wikibase.resolvePropertyId provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.resolvePropertyId.

mw.wikibase.mediainfo.getPropertyOrder

mw.wikibase.mediainfo.getPropertyOrder()

This function is identical to the more generic mw.wikibase.getPropertyOrder provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getPropertyOrder.

mw.wikibase.mediainfo.orderProperties

mw.wikibase.mediainfo.orderProperties( tableOfPropertyIds )

This function is identical to the more generic mw.wikibase.orderProperties provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.orderProperties.

mw.wikibase.mediainfo.getBestStatements

mw.wikibase.mediainfo.getBestStatements( entityId, propertyId )

This function is identical to the more generic mw.wikibase.getBestStatements provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getBestStatements.

mw.wikibase.mediainfo.getAllStatements

mw.wikibase.mediainfo.getAllStatements( entityId, propertyId )

This function is identical to the more generic mw.wikibase.getAllStatements provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getAllStatements.

mw.wikibase.mediainfo.getReferencedEntityId

mw.wikibase.mediainfo.getReferencedEntityId( fromEntityId, propertyId, toIds )

This function is identical to the more generic mw.wikibase.getReferencedEntityId provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getReferencedEntityId.

mw.wikibase.mediainfo.getGlobalSiteId

mw.wikibase.mediainfo.getGlobalSiteId()

This function is identical to the more generic mw.wikibase.getGlobalSiteId provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.getGlobalSiteId.

MediaInfo entity object

mw.wikibase.mediainfo.getEntity (and mw.wikibase.getEntity , when invoked for a MediaInfo entity) will return a MediaInfo object representing the requested entity.

Like mw.wikibase.mediainfo and mw.wikibase, these MediaInfo entity objects are essentially pretty much the same as mw.wikibase.entity objects, except for:

  1. the addition of getCaption* methods as an alias for getLabel* methods
  2. the removal of the getSitelink* method, which is a concept that doesn't apply to MediaInfo entities

entity:getId

entity:getId()

This function is identical to the more generic mw.wikibase.entity:getId provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getId.

entity:getLabel

entity:getLabel()
entity:getLabel( langCode )

This function is identical to the more generic mw.wikibase.entity:getLabel provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getLabel.

entity:getCaption

entity:getCaption()
entity:getCaption( langCode )

This method is an alias for getLabel.

entity:getDescription

entity:getDescription()
entity:getDescription( langCode )

This function is identical to the more generic mw.wikibase.entity:getDescription provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getDescription.

entity:getLabelWithLang

entity:getLabelWithLang()
entity:getLabelWithLang( langCode )

This function is identical to the more generic mw.wikibase.entity:getLabelWithLang provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getLabelWithLang.

entity:getCaptionWithLang

entity:getCaptionWithLang()
entity:getCaptionWithLang( langCode )

This method is an alias for getCaptionWithLang.

entity:getDescriptionWithLang

entity:getDescriptionWithLang()
entity:getDescriptionWithLang( langCode )

This function is identical to the more generic mw.wikibase.entity:getDescriptionWithLang provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getDescriptionWithLang.

entity:getProperties

entity:getProperties()

This function is identical to the more generic mw.wikibase.entity:getProperties provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getProperties.

entity:getBestStatements

entity:getBestStatements( propertyIdOrLabel )

This function is identical to the more generic mw.wikibase.entity:getBestStatements provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getBestStatements.

entity:getAllStatements

entity:getAllStatements( propertyIdOrLabel )

This function is identical to the more generic mw.wikibase.entity:getAllStatements provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:getAllStatements.

entity:formatPropertyValues

entity:formatPropertyValues( propertyLabelOrId )
entity:formatPropertyValues( propertyLabelOrId, acceptableRanks )

This function is identical to the more generic mw.wikibase.entity:formatPropertyValues provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:formatPropertyValues.

entity:formatStatements

entity:formatStatements( propertyLabelOrId )
entity:formatStatements( propertyLabelOrId, acceptableRanks )

This function is identical to the more generic mw.wikibase.entity:formatStatements provided by Wikibase. Please refer to Wikibase Lua documentation for mw.wikibase.entity:formatStatements.

Further reading