[−][src]Struct wikibase::Entity
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]
id: String,
labels: Vec<LocaleString>,
descriptions: Vec<LocaleString>,
aliases: Vec<LocaleString>,
claims: Vec<Statement>,
sitelinks: Option<Vec<SiteLink>>,
missing: bool
) -> Entity
pub fn new_from_id<S: Into<String>>(
id: S,
configuration: &Configuration
) -> Result<Entity, WikibaseError>
[src]
id: S,
configuration: &Configuration
) -> Result<Entity, WikibaseError>
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]
ids: Vec<String>,
configuration: &Configuration
) -> Result<Entity, WikibaseError>
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]
query: &EntityQuery,
configuration: &Configuration
) -> Result<Entity, WikibaseError>
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 set_sitelinks(&mut self, sitelinks: Option<Vec<SiteLink>>)
[src]
pub fn sitelinks(&self) -> &Option<Vec<SiteLink>>
[src]
pub fn claims(&self) -> &Vec<Statement>
[src]
pub fn id(&self) -> &str
[src]
pub fn missing(&self) -> &bool
[src]
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,