WQS::SPARQL::Query::Select - Simple SPARQL select query.
use WQS::SPARQL::Query::Select; my $obj = WQS::SPARQL::Query::Select->new; my $sparql = $obj->select_value($property_pairs_hr);
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.
new(): From Class::Utils::set_params(): Unknown parameter '%s'. select_value(): Bad property '%s'.
use strict; use warnings; use WQS::SPARQL::Query::Select; my $obj = WQS::SPARQL::Query::Select->new; my $property = 'P957'; my $isbn = '80-239-7791-1'; my $sparql = $obj->select_value({$property => $isbn}); print "Property: $property\n"; print "ISBN: $isbn\n"; print "SPARQL:\n"; print $sparql; # Output: # Property: P957 # ISBN: 80-239-7791-1 # SPARQL: # SELECT ?item WHERE { # ?item wdt:P957 '80-239-7791-1'. # }
Class::Utils, Error::Pure.
Useful Wikdata Query Service SPARQL queries.
Simple SPARQL count query.
https://github.com/michal-josef-spacek/WQS-SPARQL-Query
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2020-2023 Michal Josef Špaček
BSD 2-Clause License
0.01
To install WQS::SPARQL::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WQS::SPARQL::Query
CPAN shell
perl -MCPAN -e shell install WQS::SPARQL::Query
For more information on module installation, please visit the detailed CPAN module installation guide.