外壳采用SPARQL选择数据并上传到炫技 [英] Shell select data with SPARQL and upload to virtuoso

查看:226
本文介绍了外壳采用SPARQL选择数据并上传到炫技的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行下面的脚本到RDF数据加载到炫技的商店。该脚本运行正常,但现在看来,没有什么是上传到炫技,因为SPARQL查询不显示任何结果。任何想法,为什么?

 #!/斌/庆典
在/ usr /本地/演奏家,开源/斌/ ISQL 1111 DBA DBA<< EOF
 SPARQL CREATE GRAPH<免费取代;
 ld_dir('/家庭/纳吉,term.rdf','自由');
 rdf_loader_run();
 SPARQL SELECT * FROM<免费>其中{???S 0 p};
 EOF


解决方案

引用您的定界符 EOF

 #!/斌/庆典
在/ usr /本地/演奏家,开源/斌/ ISQL 1111 DBA DBA<<'EOF'
SPARQL CREATE GRAPH<免费取代;
ld_dir('/家庭/纳吉,term.rdf','自由');
rdf_loader_run();
SPARQL SELECT * FROM<免费>其中{???S 0 p};
EOF

男人庆典


  

没有参数扩展,命令替换,算术
  扩张或扩张路径进行
         上一句话。如果word中任何字符被引用,分隔符是引用删除对词的结果,
         与此文档中的行不会被扩展。 如果字是带引号的,此时此地,文档中的所有行
         换货受到参数扩展,命令替换和算术扩展。
在LAT-
         之三的情况下,该字符序列\\被忽略,和\\必须使用来引用字符\\,$,
         和`。


PS:同时确保没有关闭之前没有空格 EOF

I am trying to run the following script to load RDF data into a Virtuoso store. The script runs fine, but it appears that nothing is uploaded to Virtuoso, as the SPARQL query does not display any results. Any ideas why?

#!/bin/bash
/usr/local/virtuoso-opensource/bin/isql 1111 dba dba <<EOF
 SPARQL CREATE GRAPH <free>;
 ld_dir('/home/najib', 'term.rdf', 'free');
 rdf_loader_run();
 SPARQL SELECT * FROM <free> WHERE {?s ?o ?p};
 EOF

解决方案

Quote your heredoc EOF:

#!/bin/bash
/usr/local/virtuoso-opensource/bin/isql 1111 dba dba <<'EOF'
SPARQL CREATE GRAPH <free>;
ld_dir('/home/najib', 'term.rdf', 'free');
rdf_loader_run();
SPARQL SELECT * FROM <free> WHERE {?s ?o ?p};
EOF

As per man bash:

No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-docu‐ ment are subjected to parameter expansion, command substitution, and arithmetic expansion. In the lat‐ ter case, the character sequence \ is ignored, and \ must be used to quote the characters \, $, and `.

PS: Also make sure there is no space before closing EOF

这篇关于外壳采用SPARQL选择数据并上传到炫技的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆