gpt4 book ai didi

jena - N-triples IRI 前缀 jena

转载 作者:行者123 更新时间:2023-12-05 06:40:16 32 4
gpt4 key购买 nike

我想用前缀来表示这个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" .

但它报告相同的错误,我不知道如何修复它。

我应该怎样修改才可以呢?

任何帮助将不胜感激。谢谢!

最佳答案

N-triples 没有前缀。

乌龟有前缀。尝试将您的数据放入扩展名为“.ttl”的文件中。

您可以使用命令行工具 riot 测试您的数据。

关于jena - N-triples IRI 前缀 jena,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42966555/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com