【问题标题】:rdfland rdfproc: adding a RDF literalrdfland rdfproc:添加 RDF 文字
【发布时间】:2015-09-17 13:54:10
【问题描述】:

在 rdfproc/redland 中如何添加类型化文字?手册页说:

   add-typed SUBJECT PREDICATE OBJECT OBJECT-LANG OBJECT-URI [CONTEXT]
          Add the triple with the datatyped literal object to the graph, in the optional Redland context if  CONTEXT  is given.

我的 rdf 文件:

$ xmllint test.rdf
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
</rdf:RDF>

我试过了:

$ rdfproc  --storage file test.rdf  add-typed "http://my/subject" "http://my/predicate" "2015-50-17T15:50:00"  "fr" "http://www.w3.org/2001/XMLSchema#dateTime"

但出现以下错误:

rdfproc: cannot have missing triple parts for add-typed

一个简单的“添加”就可以了。

$ rdfproc  --storage file test.rdf  add "http://my/subject" "http://my/predicate" "2015-50-17T15:50:00"  && xmllint test.rdf
rdfproc: Added triple to the graph
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xml:base="file:///home/lindenb/path/test.rdf">
  <rdf:Description rdf:about="http://my/subject">
    <ns0:predicate xmlns:ns0="http://my/">2015-50-17T15:50:00</ns0:predicate>
  </rdf:Description>
</rdf:RDF>

版本:

$ rdfproc -version
1.0.14

【问题讨论】:

  • 我不知道您正在使用的工具,但数据类型文字没有语言标签,所以我认为您不应该同时指定“fr”和“xsd: dateTime”,虽然我不确定你会用什么替换“fr”
  • 是的,我知道 lang+type: 但我尝试了很多组合。我尝试了空字符串,但没有尝试“-”。检查:输出现在是:`rdfproc --storage file test.rdf add-typed "my/subject" "my/predicate" "2015-50-17T15:50:00" "-" "w3.org/2001/XMLSchema#dateTime" rdfproc:警告 - 模型不支持上下文 rdfproc:无法将三元组添加到图表 `

标签: rdf redland


【解决方案1】:

您不能同时指定语言和数据类型。

要省略其中任何一个,请在命令行中提供 -。例如:

rdfproc -n --storage sqlite test.sq add-typed "http://my/subject" "http://my/predicate" "2015-50-17T15:50:00" - "http://www.w3.org/2001/XMLSchema#dateTime"

我将存储类型更改为 sqlite 并添加了创建新存储 -n 的选项 - 文件存储产生另一个错误 rdfproc: Warning - Model does not support contexts rdfproc: Failed to add triple to the graph 并且我没有阅读足够多的源来弄清楚如何解决这个问题。

【讨论】:

  • 这不起作用(v 1.0.16):rdfproc: Warning - Model does not support contexts rdfproc: Failed to add triple to the graph
  • 是的 - 这是另一个问题。它适用于其他一些存储。
猜你喜欢
  • 1970-01-01
  • 2015-08-02
  • 1970-01-01
  • 1970-01-01
  • 2023-03-16
  • 2013-07-02
  • 1970-01-01
  • 1970-01-01
  • 2017-11-14
相关资源
最近更新 更多