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;

 # Object.
 my $obj = Wikibase::Datatype::Reference->new(
         'snaks' => [
                 Wikibase::Datatype::Snak->new(
                         'datatype' => 'string',
                         'datavalue' => Wikibase::Datatype::Value::String->new(
                                 'value' => 'text',
                         ),
                         'property' => 'P11',
                 ),
         ],
 );

 # Get value.
 my $snaks_ar = $obj->snaks;

 # Print out number of snaks.
 print "Number of snaks: ".@{$snaks_ar}."\n";

 # Output:
 # Number of snaks: 1

DEPENDENCIES

Error::Pure, Mo, Mo::utils.

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

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2022 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.23