wikibaseintegrator.datatypes.quantity
- class wikibaseintegrator.datatypes.quantity.Quantity(amount=None, upper_bound=None, lower_bound=None, unit='1', wikibase_url=None, **kwargs)[source]
Bases:
BaseDataType
Implements the Wikibase data type for quantities
- Parameters:
amount (str | int | float | None) –
upper_bound (str | int | float | None) –
lower_bound (str | int | float | None) –
unit (str | int) –
wikibase_url (str | None) –
kwargs (Any) –
- DTYPE = 'quantity'
- __init__(amount=None, upper_bound=None, lower_bound=None, unit='1', wikibase_url=None, **kwargs)[source]
Constructor, calls the superclass BaseDataType
- Parameters:
amount (
Union
[str
,int
,float
,None
]) – The amount valueupper_bound (
Union
[str
,int
,float
,None
]) – Upper bound of the value if it exists, e.g. for standard deviationslower_bound (
Union
[str
,int
,float
,None
]) – Lower bound of the value if it exists, e.g. for standard deviationsunit (
Union
[str
,int
]) – The unit item URL or the QID a certain amount has been measured in (https://www.wikidata.org/wiki/Wikidata:Units). The default is dimensionless, represented by a ‘1’wikibase_url (
Optional
[str
]) – The default wikibase URL, used when the unit is only an ID like ‘Q2’. Use wbi_config[‘WIKIBASE_URL’] by default.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:
- get_json()
- Return type:
Dict
[str
,Any
]
- property id: str | None
- property qualifiers: Qualifiers
- property qualifiers_order: List[str]
- property rank: WikibaseRank
- property references: References
- static refs_equal(olditem, newitem)
tests for exactly identical references
- remove(remove=True)
- Return type:
None
- property removed: bool
- set_value(amount=None, upper_bound=None, lower_bound=None, unit='1', wikibase_url=None)[source]
- Parameters:
amount (str | int | float | None) –
upper_bound (str | int | float | None) –
lower_bound (str | int | float | None) –
unit (str | int) –
wikibase_url (str | None) –
- property type: str | Dict