NAME
WQS::SPARQL::Query::Select - Simple SPARQL select query.
SYNOPSIS
my
$obj
= WQS::SPARQL::Query::Select->new;
my
$sparql
=
$obj
->select_value(
$property_pairs_hr
);
METHODS
new
my
$obj
= WQS::SPARQL::Query::Select->new;
Constructor.
Returns instance of class.
select_value
my
$sparql
=
$obj
->select_value(
$property_pairs_hr
);
Construct SPARQL command and return it. Input is reference to hash with pairs property => value.
Value could be in forms:
Q__number__
QID identifier.
Example output: Q42
__string__@__lang__
String with language.
'lang' is 2 character language code.
Example output: 'string'@en
__string__
String without language.
Example output: 'string'
Returns string.
ERRORS
new():
From Class::Utils::set_params():
Unknown parameter
'%s'
.
select_value():
Bad property
'%s'
.
EXAMPLE
use
strict;
use
warnings;
my
$obj
= WQS::SPARQL::Query::Select->new;
my
$property
=
'P957'
;
my
$isbn
=
'80-239-7791-1'
;
my
$sparql
=
$obj
->select_value({
$property
=>
$isbn
});
"Property: $property\n"
;
"ISBN: $isbn\n"
;
"SPARQL:\n"
;
$sparql
;
# Output:
# Property: P957
# ISBN: 80-239-7791-1
# SPARQL:
# SELECT ?item WHERE {
# ?item wdt:P957 '80-239-7791-1'.
# }
DEPENDENCIES
SEE ALSO
- WQS::SPARQL::Query
-
Useful Wikdata Query Service SPARQL queries.
- WQS::SPARQL::Query::Count
-
Simple SPARQL count query.
REPOSITORY
https://github.com/michal-josef-spacek/WQS-SPARQL-Query
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2020-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.03