Class: Wikidatum::DataType::WikibaseItem
- Inherits:
-
Object
- Object
- Wikidatum::DataType::WikibaseItem
- Defined in:
- lib/wikidatum/data_type/wikibase_item.rb
Overview
The Wikibase Item type JSON looks like this:
{
"property": {
"id": "P963",
"data-type": "wikibase-item"
},
"value": {
"type": "value",
"content": "Q524026"
}
}
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
In the format “Q123”.
Class Method Summary collapse
Instance Method Summary collapse
-
#humanized ⇒ String
The content of the data value object.
- #initialize(id:) ⇒ void constructor
- #to_h ⇒ Hash
-
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
Constructor Details
#initialize(id:) ⇒ void
25 26 27 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 25 def initialize(id:) @id = id end |
Instance Attribute Details
#id ⇒ String (readonly)
Returns in the format “Q123”.
21 22 23 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 21 def id @id end |
Class Method Details
.symbolized_name ⇒ Symbol
52 53 54 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 52 def self.symbolized_name :wikibase_item end |
Instance Method Details
#humanized ⇒ String
The content of the data value object. Use this to get a more sensible representation of the statement’s contents.
47 48 49 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 47 def humanized @id end |
#to_h ⇒ Hash
30 31 32 33 34 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 30 def to_h { id: @id } end |
#wikibase_type ⇒ String
The “type” value used by Wikibase, for use when creating/updating statements.
39 40 41 |
# File 'lib/wikidatum/data_type/wikibase_item.rb', line 39 def wikibase_type 'wikibase-item' end |