将Sparql结果保存到virtuoso指挥中

时间:2014-12-22 14:27:55

标签: save sparql virtuoso

我想保存Sparql查询的结果:

SELECT ?items ?head 
FROM <http://localhost:8890/diplomatiki#>
WHERE {
?exeiId <http://localhost:8890/schemas/diplomatiki/itemid> ?items;
             <http://localhost:8890/schemas/diplomatiki/headid> ?head
}

进入一个表或作为本地链接数据(virtuoso指挥),怎么做呢。

1 个答案:

答案 0 :(得分:0)

你可以创建自己的程序。

像:

create procedure
INSERT_SPARQL_RESULT
(
in query VARCHAR
)
{
DECLARE state, msg, descs, rows any;
exec('SPARQL ' || query, state, msg, vector (), 0, descs, rows);

declare i INTEGER;
for(i:=0;i<LENGTH(rows);i:=i+1){
INSERT INTO tablename VALUES (rows[i][0], rows[i][1]);
}
};

添加&#39; SPARQL&#39;在你的查询之前。

成功创建程序后:

CALL INSERT_SPARQL_RESULT('
SELECT ?items ?head 
FROM <http://localhost:8890/diplomatiki#>
WHERE {
?exeiId <http://localhost:8890/schemas/diplomatiki/itemid> ?items;
             <http://localhost:8890/schemas/diplomatiki/headid> ?head
}');