我想用前缀来表示这个 nt 文件:
<www.test.com/a/yan-dang-shan> <www.test.com/a/zhongwenming> <www.test.com/a/yan-dang-shan> .
<www.test.com/a/yan-dang-shan> <http://www.w3.org/2000/01/rdf-schema#label> "a" .
<www.test.com/a/zhongwenming> <http://www.w3.org/2000/01/rdf-schema#label> "b" .
<www.test.com/a/yan-dang-shan> <http://www.w3.org/2000/01/rdf-schema#label> "c" .
我写入一个新的 nt 文件是:
@prefix sp: <www.test.com/a/> .
<sp:yan-dang-shan> <sp:zhongwenming> <sp:yan-dang-shan> .
<sp:yan-dang-shan> <http://www.w3.org/2000/01/rdf-schema#label> "a" .
<sp:zhongwenming> <http://www.w3.org/2000/01/rdf-schema#label> "b" .
<sp:yan-dang-shan> <http://www.w3.org/2000/01/rdf-schema#label> "c" .
但是当我在cmd中使用它来sparql时:
SELECT ?x ?y ?z
WHERE
{ ?x ?y ?z . }
cmd中显示错误:
D:\>sparql --data=ceshi.nt --query=ceshi.rq
11:01:42 ERROR riot :: [line: 1, col: 1 ] Expected BNode or IRI:
Got: [DIRECTIVE:prefix]
Failed to load data
我也试过这个:
@prefix sp: <www.test.com/a/> .
sp:yan-dang-shan sp:zhongwenming sp:yan-dang-shan .
sp:yan-dang-shan <http://www.w3.org/2000/01/rdf-schema#label> "a" .
sp:zhongwenming <http://www.w3.org/2000/01/rdf-schema#label> "b" .
sp:yan-dang-shan <http://www.w3.org/2000/01/rdf-schema#label> "c" .
但它报告了相同的错误,我不知道如何解决它。
我应该如何修改才能正常?
任何帮助将不胜感激。谢谢!