WQS::SPARQL::Query::Count - Simple SPARQL count query.
use WQS::SPARQL::Query::Count; my $obj = WQS::SPARQL::Query::Count->new; my $sparql = $obj->count_item($property, $item); my $sparql = $obj->count_value($property, $value);
new
my $obj = WQS::SPARQL::Query::Count->new;
Constructor.
Returns instance of class.
count_item
my $sparql = $obj->count_item($property, $item);
Construct SPARQL command and return it.
Returns string.
count_value
my $sparql = $obj->count_value($property, $value);
new(): From Class::Utils::set_params(): Unknown parameter '%s'. count_item(): Bad item '%s'. Bad property '%s'. count_value(): Bad property '%s'.
use strict; use warnings; use WQS::SPARQL::Query::Count; my $obj = WQS::SPARQL::Query::Count->new; my $property = 'P957'; my $item = 'Q62098524'; my $sparql = $obj->count_item($property, $item); print "Property: $property\n"; print "Item: $item\n"; print "SPARQL:\n"; print $sparql; # Output: # Property: P957 # ISBN: 80-239-7791-1 # SPARQL: # SELECT (COUNT(?item) as ?count) WHERE { # ?item wdt:P957 wd:Q62098524 # }
use strict; use warnings; use WQS::SPARQL::Query::Count; my $obj = WQS::SPARQL::Query::Count->new; my $property = 'P957'; my $isbn = '80-239-7791-1'; my $sparql = $obj->count_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 (COUNT(?item) as ?count) WHERE { # ?item wdt:P957 '80-239-7791-1' # }
Class::Utils, Error::Pure.
Useful Wikdata Query Service SPARQL queries.
Simple SPARQL select 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.