[][src]Struct wikibase::Entity

pub struct Entity { /* fields omitted */ }

Wikibase entity (item or property)

Items and properties are very similar in Wikibase. They have a prefix followed by an ID, labels, descriptions, aliases. Both items and properties have statements that may have qualifiers. Statements can also contain references, in which case they are called statements, but are handled the same way in the API.

Items can also have sitelinks to various projects. On Wikidata for example an item can link to Wikpedia, Wikisource, Wiktionary in various languages. The actual wiki-pages attached to an item or property can't be accessed at the moment. This includes the edit-history, the talk page and the pages various settings (protection, locked, ...).

Entities can be created manually or from a JSON that needs to have the same structure as the Wikibase API.

Example

let item = wikibase::Entity::new("Q2807".to_string(), vec![], vec![], vec![], vec![], None, false);

Methods

impl Entity[src]

pub fn new(
    id: String,
    labels: Vec<LocaleString>,
    descriptions: Vec<LocaleString>,
    aliases: Vec<LocaleString>,
    claims: Vec<Statement>,
    sitelinks: Option<Vec<SiteLink>>,
    missing: bool
) -> Entity
[src]

pub fn new_from_id<S: Into<String>>(
    id: S,
    configuration: &Configuration
) -> Result<Entity, WikibaseError>
[src]

Takes a single Q-Id or P-Id and returns an item result.

Example

let configuration = wikibase::Configuration::new("Automatic-Testing/1.0").unwrap();
let item = wikibase::Entity::new_from_id("Q47532594", &configuration);

pub fn new_from_ids(
    ids: Vec<String>,
    configuration: &Configuration
) -> Result<Entity, WikibaseError>
[src]

Takes a vector of Q-Ids or P-Ids and returns an item result.

pub fn new_from_query(
    query: &EntityQuery,
    configuration: &Configuration
) -> Result<Entity, WikibaseError>
[src]

Takes a entity query and returns an item.

pub fn aliases(&self) -> &Vec<LocaleString>[src]

pub fn label_in_locale(&self, locale: &str) -> Option<&str>[src]

pub fn description_in_locale(&self, locale: &str) -> Option<&str>[src]

pub fn claims(&self) -> &Vec<Statement>[src]

pub fn id(&self) -> &str[src]

pub fn missing(&self) -> &bool[src]

Trait Implementations

impl Debug for Entity[src]

Auto Trait Implementations

impl Send for Entity

impl Sync for Entity

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]