Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Rdf\DateTimeValueCleaner Class Reference

Very basic cleaner that assumes the date is Gregorian and only ensures it looks OK. More...

+ Inheritance diagram for Wikibase\Repo\Rdf\DateTimeValueCleaner:

Public Member Functions

 __construct ( $xsd11=true)
 
 getStandardValue (TimeValue $value)
 Get standardized dateTime value, compatible with xsd:dateTime If the value cannot be converted to it, returns null. More...
 

Protected Member Functions

 cleanupGregorianValue ( $dateValue, $precision)
 Clean up Wikidata date value in Gregorian calendar. More...
 
 parseDateValue ( $dateValue)
 Parse date value and fix weird numbers there. More...
 

Protected Attributes

 $xsd11 = true
 

Detailed Description

Very basic cleaner that assumes the date is Gregorian and only ensures it looks OK.

Author
Stas Malyshev
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Rdf\DateTimeValueCleaner::__construct (   $xsd11 = true)
Parameters
bool$xsd11Should we use XSD 1.1 standard?

Member Function Documentation

◆ cleanupGregorianValue()

Wikibase\Repo\Rdf\DateTimeValueCleaner::cleanupGregorianValue (   $dateValue,
  $precision 
)
protected

Clean up Wikidata date value in Gregorian calendar.

  • remove + from the start - not all data stores like that
  • validate month and date value
Parameters
string$dateValue
int$precisionDate precision constant (e.g. TimeValue::PRECISION_SECOND)
Returns
string|null Value compatible with xsd:dateTime type, null if we failed to parse

◆ getStandardValue()

Wikibase\Repo\Rdf\DateTimeValueCleaner::getStandardValue ( TimeValue  $value)

Get standardized dateTime value, compatible with xsd:dateTime If the value cannot be converted to it, returns null.

Parameters
TimeValue$value
Returns
string|null

Reimplemented in Wikibase\Repo\Rdf\JulianDateTimeValueCleaner.

◆ parseDateValue()

Wikibase\Repo\Rdf\DateTimeValueCleaner::parseDateValue (   $dateValue)
protected

Parse date value and fix weird numbers there.

Parameters
string$dateValue
Exceptions
IllegalValueExceptionif the input is an illegal XSD 1.0 timestamp
Returns
array Parsed value in parts: $minus, $y, $m, $d, $time

Member Data Documentation

◆ $xsd11

Wikibase\Repo\Rdf\DateTimeValueCleaner::$xsd11 = true
protected

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