NAME
Wikibase::Datatype::Reference - Wikibase reference datatype.
SYNOPSIS
use Wikibase::Datatype::Reference;
my $obj = Wikibase::Datatype::Reference->new(%params);
my $snaks_ar = $obj->snaks;
DESCRIPTION
This datatype is reference class for all references in claim.
METHODS
new
my $obj = Wikibase::Datatype::Reference->new(%params);
Constructor.
Returns instance of object.
snaks
Reference to array with Wikibase::Datatype::Snak instances. Parameter is required.
snaks
my $snaks_ar = $obj->snaks;
Get snaks.
Returns reference to array of Wikibase::Datatype::Snak instances.
ERRORS
new():
From Mo::utils::check_array_object():
Parameter 'snaks' must be a array.
Snak isn't 'Wikibase::Datatype::Snak' object.
From Mo::utils::check_required():
Parameter 'snaks' is required.
EXAMPLE
use strict;
use warnings;
use Wikibase::Datatype::Reference;
use Wikibase::Datatype::Snak;
use Wikibase::Datatype::Value::String;
use Wikibase::Datatype::Value::Time;
# Object.
my $obj = Wikibase::Datatype::Reference->new(
'snaks' => [
Wikibase::Datatype::Snak->new(
'datatype' => 'url',
'datavalue' => Wikibase::Datatype::Value::String->new(
'value' => 'https://skim.cz',
),
'property' => 'P854',
),
Wikibase::Datatype::Snak->new(
'datatype' => 'time',
'datavalue' => Wikibase::Datatype::Value::Time->new(
'value' => '+2013-12-07T00:00:00Z',
),
'property' => 'P813',
),
],
);
# Get value.
my $snaks_ar = $obj->snaks;
# Print out number of snaks.
print "Number of snaks: ".@{$snaks_ar}."\n";
# Output:
# Number of snaks: 2
DEPENDENCIES
SEE ALSO
- Wikibase::Datatype
-
Wikibase datatypes.
- Wikibase::Datatype::Snak
-
Wikibase snak datatype.
REPOSITORY
https://github.com/michal-josef-spacek/Wikibase-Datatype
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2020-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.32