Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Maintenance\AddUnitConversions Class Reference

Generate dump-like RDF for newly added units without running full dump. More...

+ Inheritance diagram for Wikibase\Repo\Maintenance\AddUnitConversions:
+ Collaboration diagram for Wikibase\Repo\Maintenance\AddUnitConversions:

Public Member Functions

 __construct ()
 
 execute ()
 Do the actual work. More...
 
 initializeWriter ( $baseUri, $format)
 Initialize RDF writer. More...
 
 initializeBuilder ()
 Initialize quantity builder. More...
 
 processUnit ( $unit)
 Generate all statements for a specific unit. More...
 
 startDocument ()
 Kick off the document. More...
 

Protected Member Functions

 writeOut ()
 Write data to the output. More...
 

Protected Attributes

 $rdfWriter
 
 $unitConverter
 
 $client
 
 $builder
 

Private Member Functions

 getNormalized ( $id, $unit, array $value)
 Normalize unit and return the hash of the normalized node. More...
 
 processStatements ( $values, $map)
 Process statements for particular set of values. More...
 
 createRdfVocabulary ( $baseUri, $typeUris)
 Get vocabulary instance. More...
 
 createRdfWriter ( $format)
 

Private Attributes

const MAX_QUERY_CHUNK = 100
 Max chunk of values processed by one query. More...
 
 $rdfVocabulary
 
 $out
 
 $normMap
 
 $valueURI
 
 $normalizedNames
 
 $dryRun
 

Detailed Description

Generate dump-like RDF for newly added units without running full dump.

Author
Stas Malyshev

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Maintenance\AddUnitConversions::__construct ( )

Member Function Documentation

◆ createRdfVocabulary()

Wikibase\Repo\Maintenance\AddUnitConversions::createRdfVocabulary (   $baseUri,
  $typeUris 
)
private

Get vocabulary instance.

Parameters
string$baseUri
string[]$typeUris
Returns
RdfVocabulary

◆ createRdfWriter()

Wikibase\Repo\Maintenance\AddUnitConversions::createRdfWriter (   $format)
private
Parameters
string$formatFile extension or MIME type of the output format.
Returns
RdfWriter

◆ execute()

Wikibase\Repo\Maintenance\AddUnitConversions::execute ( )

Do the actual work.

All child classes will need to implement this

◆ getNormalized()

Wikibase\Repo\Maintenance\AddUnitConversions::getNormalized (   $id,
  $unit,
array  $value 
)
private

Normalize unit and return the hash of the normalized node.

Parameters
string$idOriginal value ID (hash)
string$unitShort ID of the unit
string[]$valueValue data array
Returns
string Hash of the normalized node

◆ initializeBuilder()

Wikibase\Repo\Maintenance\AddUnitConversions::initializeBuilder ( )

Initialize quantity builder.

◆ initializeWriter()

Wikibase\Repo\Maintenance\AddUnitConversions::initializeWriter (   $baseUri,
  $format 
)

Initialize RDF writer.

Parameters
string$baseUri
string$formatFile extension or MIME type of the output format.

◆ processStatements()

Wikibase\Repo\Maintenance\AddUnitConversions::processStatements (   $values,
  $map 
)
private

Process statements for particular set of values.

Will scan through the triples which use each of the values and add appropriate normalized triple referring to the normalized value. E.g. <s123> psv:P345 wdv:xys -> <s123> psn:P345 wdv:xyznorm

Parameters
string[]$valuesValue hashes
string[]$mapMap old id -> normalized id

◆ processUnit()

Wikibase\Repo\Maintenance\AddUnitConversions::processUnit (   $unit)

Generate all statements for a specific unit.

Parameters
string$unitUnit Q-id

◆ startDocument()

Wikibase\Repo\Maintenance\AddUnitConversions::startDocument ( )

Kick off the document.

◆ writeOut()

Wikibase\Repo\Maintenance\AddUnitConversions::writeOut ( )
protected

Write data to the output.

Member Data Documentation

◆ $builder

Wikibase\Repo\Maintenance\AddUnitConversions::$builder
protected

◆ $client

Wikibase\Repo\Maintenance\AddUnitConversions::$client
protected

◆ $dryRun

Wikibase\Repo\Maintenance\AddUnitConversions::$dryRun
private

◆ $normalizedNames

Wikibase\Repo\Maintenance\AddUnitConversions::$normalizedNames
private

◆ $normMap

Wikibase\Repo\Maintenance\AddUnitConversions::$normMap
private

◆ $out

Wikibase\Repo\Maintenance\AddUnitConversions::$out
private

◆ $rdfVocabulary

Wikibase\Repo\Maintenance\AddUnitConversions::$rdfVocabulary
private

◆ $rdfWriter

Wikibase\Repo\Maintenance\AddUnitConversions::$rdfWriter
protected

◆ $unitConverter

Wikibase\Repo\Maintenance\AddUnitConversions::$unitConverter
protected

◆ $valueURI

Wikibase\Repo\Maintenance\AddUnitConversions::$valueURI
private

◆ MAX_QUERY_CHUNK

const Wikibase\Repo\Maintenance\AddUnitConversions::MAX_QUERY_CHUNK = 100
private

Max chunk of values processed by one query.


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