Struct wikidata::Entity

source ·
pub struct Entity {
    pub id: WikiId,
    pub claims: Vec<(Pid, ClaimValue)>,
    pub entity_type: EntityType,
    pub descriptions: BTreeMap<Lang, String>,
    pub labels: BTreeMap<Lang, String>,
    pub aliases: BTreeMap<Lang, Vec<String>>,
    pub sitelinks: BTreeMap<SiteName, SitelinkValue>,
}
Expand description

A Wikibase entity: this could be an entity, property, or lexeme.

Fields§

§id: WikiId

Unique identifier

§claims: Vec<(Pid, ClaimValue)>

All of the claims on the entity.

§entity_type: EntityType

The type of the entity.

§descriptions: BTreeMap<Lang, String>

All of the descriptions in all known languages.

§labels: BTreeMap<Lang, String>

All of the labels in all known languages.

§aliases: BTreeMap<Lang, Vec<String>>

Known aliases of the item.

§sitelinks: BTreeMap<SiteName, SitelinkValue>

site links (e.g. to wikipedia, wikivoyage, …)

Implementations§

source§

impl Entity

source

pub fn instances(&self) -> Vec<Qid>

All of the values of “instance of” on the entity.

source

pub fn start_time(&self) -> Option<DateTime<Utc>>

When the entity started existing.

source

pub fn end_time(&self) -> Option<DateTime<Utc>>

When the entity stopped existing.

source

pub fn from_json(json: Value) -> Result<Self, EntityError>

Construct an entity from the Wikibase JSON repersentation. The input can either be an object directly containing the Wikibase entity representation, or a multi-entity object returned by some endpoints such as Special:EntityData. Multi-entity objects must only contain one entity.

§Errors

If the JSON reperesntation can’t be parsed to an Entity, an EntityError will be returned.

Trait Implementations§

source§

impl Clone for Entity

source§

fn clone(&self) -> Entity

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Entity

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Entity

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Entity

source§

fn eq(&self, other: &Entity) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Entity

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Entity

Auto Trait Implementations§

§

impl Freeze for Entity

§

impl RefUnwindSafe for Entity

§

impl Send for Entity

§

impl Sync for Entity

§

impl Unpin for Entity

§

impl UnwindSafe for Entity

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,