BaseDataType#
- class wikibaseintegrator.datatypes.basedatatype.BaseDataType(prop_nr=None, **kwargs)[source]#
Bases:
ClaimThe base class for all Wikibase data types, they inherit from it
Constructor, will be called by all data types.
- Parameters:
prop_nr (
int|str|None, default:None) – The property number a Wikibase snak belongs to
- classmethod get_datatype_class(datatype)[source]#
Find the data type class handling a datatype, as named by the Wikibase API.
- Parameters:
datatype (
str) – The datatype, e.g. ‘wikibase-item’ or WikibaseDatatype.ITEM- Return type:
- Returns:
The data type class, e.g. Item
- Raises:
UnknownDatatypeError – If no data type class handles this datatype
- from_sparql_value(sparql_value)[source]#
Parse data returned by a SPARQL endpoint and set the value to the object
This generic implementation covers the data types whose RDF representation is the literal value itself (external identifiers, musical notation…). The data types backed by a URI (entities, media files) override it to extract the value from that URI, since storing the raw URI would silently never match a local claim.
- DTYPE = 'base-data-type'#
- PTYPE = 'property-data-type'#