rdfland rdfproc:添加RDF文字

时间:2015-09-17 13:54:11

标签: rdf redland

在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

简单的添加&#39;工作正常。

$ 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

1 个答案:

答案 0 :(得分:0)

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

要省略,请在命令行上提供-。例如:

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并且我没有阅读足够的来源来弄清楚如何解决这个问题。