Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\ParserOutput\GeoDataDataUpdater Class Reference

Extracts and stashes coordinates from Statement main snaks and adds to ParserOutput for use by the GeoData extension. More...

+ Inheritance diagram for Wikibase\Repo\ParserOutput\GeoDataDataUpdater:
+ Collaboration diagram for Wikibase\Repo\ParserOutput\GeoDataDataUpdater:

Public Member Functions

 __construct (PropertyDataTypeMatcher $propertyDataTypeMatcher, array $preferredPropertiesIds, array $globeUris)
 
 processStatement (Statement $statement)
 Extract globe-coordinate DataValues for storing in ParserOutput for GeoData.
 
 updateParserOutput (ParserOutput $parserOutput)
 Update extension data, properties or other data in ParserOutput.
 

Private Member Functions

 findPrimaryCoordinateKey ()
 
 getCoordinatesGroupCount ( $key)
 
 addPrimaryCoordinate (CoordinatesOutput $coordinatesOutput, $primaryCoordKey)
 
 addSecondaryCoordinates (CoordinatesOutput $coordinatesOutput, $primaryCoordKey)
 
 makeCoordinateKey ( $propertyIdString, $rank)
 
 extractMainSnakCoord (Statement $statement)
 

Private Attributes

 $propertyDataTypeMatcher
 
 $preferredPropertiesIds
 
 $globeUris
 
 $coordinates = []
 

Detailed Description

Extracts and stashes coordinates from Statement main snaks and adds to ParserOutput for use by the GeoData extension.

GeoData populates the geo_tags table, and if using the 'elastic' backend, also adds coordinates to CirrusSearch. GeoData then provides API modules to get coordinates for pages, and to find nearby pages to a requested location.

This class uses the Coord and CoordinatesOutput classes from the GeoData extension.

Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::__construct ( PropertyDataTypeMatcher $propertyDataTypeMatcher,
array $preferredPropertiesIds,
array $globeUris )
Parameters
PropertyDataTypeMatcher$propertyDataTypeMatcher
string[]$preferredPropertiesIds
string[]$globeUris
Exceptions
RuntimeException

Member Function Documentation

◆ addPrimaryCoordinate()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::addPrimaryCoordinate ( CoordinatesOutput $coordinatesOutput,
$primaryCoordKey )
private
Parameters
CoordinatesOutput$coordinatesOutput
string$primaryCoordKey

◆ addSecondaryCoordinates()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::addSecondaryCoordinates ( CoordinatesOutput $coordinatesOutput,
$primaryCoordKey )
private
Parameters
CoordinatesOutput$coordinatesOutput
string | null$primaryCoordKey

◆ extractMainSnakCoord()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::extractMainSnakCoord ( Statement $statement)
private
Parameters
Statement$statement
Returns
Coord|null

◆ findPrimaryCoordinateKey()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::findPrimaryCoordinateKey ( )
private
Returns
string|null Array key for Coord selected as primary.

◆ getCoordinatesGroupCount()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::getCoordinatesGroupCount ( $key)
private
Parameters
string$key
Returns
int

◆ makeCoordinateKey()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::makeCoordinateKey ( $propertyIdString,
$rank )
private
Parameters
string$propertyIdString
int$rank
Returns
string

◆ processStatement()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::processStatement ( Statement $statement)

Extract globe-coordinate DataValues for storing in ParserOutput for GeoData.

Parameters
Statement$statement

Implements Wikibase\Repo\ParserOutput\StatementDataUpdater.

◆ updateParserOutput()

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::updateParserOutput ( ParserOutput $parserOutput)

Update extension data, properties or other data in ParserOutput.

These updates are invoked when EntityContent::getParserOutput is called.

Parameters
ParserOutput$parserOutput

Implements Wikibase\Repo\ParserOutput\StatementDataUpdater.

Member Data Documentation

◆ $coordinates

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::$coordinates = []
private

◆ $globeUris

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::$globeUris
private

◆ $preferredPropertiesIds

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::$preferredPropertiesIds
private

◆ $propertyDataTypeMatcher

Wikibase\Repo\ParserOutput\GeoDataDataUpdater::$propertyDataTypeMatcher
private

The documentation for this class was generated from the following file: