如何使用Perl进行SPARQL UPDATE?

时间:2018-07-23 09:56:18

标签: perl sparql

我的理解是 AtteanX::Store::SPARQL 仅支持查询,不支持更新。

所以我想我会用 RDF::Query::Client, 与较旧的RDF::Trine保持一致。

1 个答案:

答案 0 :(得分:1)

use constant UPDATE => "https://.../update";
my $ua = LWP::UserAgent->new();
use constant DEBUG => 7; # dump SPARQL POST: 0 off, 1 uri, 2 status, 3 title, 4 params, 5 headers, 6 cookies, 7 text, 8 content
if (DEBUG) {use LWP::ConsoleLogger::Easy qw(debug_ua)}

my $update = RDF::Query::Client->new("insert {...} where {...}");
debug_ua ($ua, DEBUG) if DEBUG;
$update->execute(UPDATE, {UserAgent => $ua, QueryParameter=>"update", QueryMethod =>"POST", AuthUsername=>USER, AuthPassword=>PASS});
# no way to check success