wikibaseintegrator.datatypes.time

class wikibaseintegrator.datatypes.time.Time(time=None, before=0, after=0, precision=None, timezone=0, calendarmodel=None, wikibase_url=None, **kwargs)[source]

Bases: BaseDataType

Implements the Wikibase data type with date and time values

Parameters:
  • time (str | None) –

  • before (int) –

  • after (int) –

  • precision (int | WikibaseDatePrecision | None) –

  • timezone (int) –

  • calendarmodel (str | None) –

  • wikibase_url (str | None) –

  • kwargs (Any) –

DTYPE = 'time'
__init__(time=None, before=0, after=0, precision=None, timezone=0, calendarmodel=None, wikibase_url=None, **kwargs)[source]

Constructor, calls the superclass BaseDataType

Parameters:
  • time (Optional[str]) – Explicit value for point in time, represented as a timestamp resembling ISO 8601. You can use the keyword ‘now’ to get the current UTC date.

  • prop_nr – The property number for this claim

  • before (int) – explicit integer value for how many units after the given time it could be. The unit is given by the precision.

  • after (int) – explicit integer value for how many units before the given time it could be. The unit is given by the precision.

  • precision (Union[int, WikibaseDatePrecision, None]) – Precision value for dates and time as specified in the Wikibase data model (https://www.wikidata.org/wiki/Special:ListDatatypes#time)

  • timezone (int) – The timezone which applies to the date and time as specified in the Wikibase data model

  • calendarmodel (Optional[str]) – The calendar model used for the date. URL to the Wikibase calendar model item or the QID.

  • wikibase_url (str | None) –

  • kwargs (Any) –

equals(that, include_ref=False, fref=None)

Tests for equality of two statements. If comparing references, the order of the arguments matters!!! self is the current statement, the next argument is the new statement. Allows passing in a function to use to compare the references ‘fref’. Default is equality. fref accepts two arguments ‘oldrefs’ and ‘newrefs’, each of which are a list of references, where each reference is a list of statements

Return type:

bool

Parameters:
  • that (Claim) –

  • include_ref (bool) –

  • fref (Callable | None) –

from_json(json_data)
Parameters:

json_data (Dict[str, Any]) – a JSON representation of a Claim

Return type:

Claim

get_day()[source]
Return type:

int

get_json()
Return type:

Dict[str, Any]

get_month()[source]
Return type:

int

get_sparql_value()[source]
Return type:

str

get_year()[source]
Return type:

int

has_equal_qualifiers(other)
Return type:

bool

Parameters:

other (Claim) –

property id: str | None
property mainsnak: Snak
parse_sparql_value(value, type='literal', unit='1')
Return type:

bool

property qualifiers: Qualifiers
property qualifiers_order: List[str]
property rank: WikibaseRank
property references: References
static refs_equal(olditem, newitem)

tests for exactly identical references

Return type:

bool

Parameters:
remove(remove=True)
Return type:

None

property removed: bool
set_value(time=None, before=0, after=0, precision=None, timezone=0, calendarmodel=None, wikibase_url=None)[source]
Parameters:
  • time (str | None) –

  • before (int) –

  • after (int) –

  • precision (int | WikibaseDatePrecision | None) –

  • timezone (int) –

  • calendarmodel (str | None) –

  • wikibase_url (str | None) –

property type: str | Dict
update(claim)
Return type:

None

Parameters:

claim (Claim) –