Jump to content

Extension:WikibaseMediaInfo/Lua

From mediawiki.org

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

[edit]

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

mw.wikibase.mediainfo.getEntity

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

This function is an alias for getLabel.

mw.wikibase.mediainfo.getCaptionWithLang

[edit]

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

This function is an alias for getLabelWithLang.

mw.wikibase.mediainfo.getCaptionByLang

[edit]

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

This function is an alias for getLabelByLang.

mw.wikibase.mediainfo.getDescription

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

entity:getCaption()
entity:getCaption( langCode )

This method is an alias for getLabel.

entity:getDescription

[edit]

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

[edit]

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

[edit]

entity:getCaptionWithLang()
entity:getCaptionWithLang( langCode )

This method is an alias for getCaptionWithLang.

entity:getDescriptionWithLang

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]

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

[edit]