wikidata.entity
— Wikidata entities¶
-
class
wikidata.entity.
Entity
¶ 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
Hashable
protocol and==
/=
operators for equality test.-
getlist
(key: wikidata.entity.Entity) → typing.Sequence[object]¶ Return all values associated to the given
key
property in sequence.Parameters: key ( Entity
) – The property entity.Returns: A sequence of all values associated to the given key
property. It can be empty if nothing is associated to the property.Return type: Sequence
[object
]
-
lists
() → typing.Sequence[typing.Tuple[typing.Entity, typing.Sequence[object]]]¶ Similar to
items()
except the returning pairs have each list of values instead of each single value.Returns: The pairs of (key, values) where values is a sequence. Return type: Sequence
[Tuple
[Entity
,Sequence
[object
]]]
-
type
¶ (
EntityType
) The type of entity,item
orproperty
.New in version 0.2.0.
-
-
class
wikidata.entity.
EntityType
¶ The enumerated type which consists of two possible values:
New in version 0.2.0.
-
item
= 'item'¶ (
EntityType
) Items areEntity
objects 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 areEntity
objects that describe a relationship between items (or otherEntity
objects) 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.
-