wikidata.entity — Wikidata entities¶
- class wikidata.entity.Entity(id: EntityId, client: Client)¶
Wikidata entity. Can be an item or a property. Its attrributes can be lazily loaded.
To get an entity use
Client.get()method instead of the constructor ofEntity.Note
Although it implements
Mapping[EntityId,object], it actually is multidict. See alsogetlist()method.Changed in version 0.2.0: Implemented
Mapping[EntityId,object] protocol for easy access of statement values.Changed in version 0.2.0: Implemented
Hashableprotocol and==/=operators for equality test.- state¶
(
EntityState) The loading state.Added in version 0.7.0.
- getlist(key: Entity) Sequence[object]¶
Return all values associated to the given
keyproperty in sequence.
- lists() Sequence[Tuple[Entity, Sequence[object]]]¶
Similar to
items()except the returning pairs have each list of values instead of each single value.
- property type: EntityType¶
(
EntityType) The type of entity,itemorproperty.Added in version 0.2.0.
- class wikidata.entity.EntityState(*values)¶
Define state of
Entity.Added in version 0.7.0.
- loaded = 'loaded'¶
(
EntityState) The entity exists and is already loaded.
- non_existent = 'non_existent'¶
(
EntityState) The entity does not exist.
- not_loaded = 'not_loaded'¶
(
EntityState) Not loaded yet. Unknown whether the entity does exist or not.
- class wikidata.entity.EntityType(*values)¶
The enumerated type which consists of two possible values:
Added in version 0.2.0.
- item = 'item'¶
(
EntityType) Items areEntityobjects that are typically represented by Wikipage (at least in some Wikipedia languages). They can be viewed as “the thing that a Wikipage is about,” which could be an individual thing (the person Albert Einstein), a general class of things (the class of all Physicists), and any other concept that is the subject of some Wikipedia page (including things like History of Berlin).See also
- Items — Wikibase Data Model
The data model of Wikibase describes the structure of the data that is handled in Wikibase.
- property = 'property'¶
(
EntityType) Properties areEntityobjects that describe a relationship between items (or otherEntityobjects) and values of the property. Typical properties are population (using numbers as values), binomial name (using strings as values), but also has father and author of (both using items as values).See also
- Properties — Wikibase Data Model
The data model of Wikibase describes the structure of the data that is handled in Wikibase.