2

In rdfproc/redland how can I add a typed literal ? The man page says:

   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.

my rdf file:

$ 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>

I tried:

$ 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"

but got the following error:

rdfproc: cannot have missing triple parts for add-typed

a simple 'add' works fine.

$ 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>

version:

$ rdfproc -version
1.0.14
Pierre
  • 34,472
  • 31
  • 113
  • 192
  • I don't know the tool you're using, but a datatyped literal doesn't have a language tag, so I don't think you should be specifying both "fr" and "xsd:dateTime", though I'm not sure what you'd replace "fr" with – Joshua Taylor Sep 18 '15 at 17:43
  • yes I know about lang+type: but I tried many combinations., I tried the empty string but not "-". Checking: The ouput is now: ` rdfproc --storage file test.rdf add-typed "http://my/subject" "http://my/predicate" "2015-50-17T15:50:00" "-" "http://www.w3.org/2001/XMLSchema#dateTime" rdfproc: Warning - Model does not support contexts rdfproc: Failed to add triple to the graph ` – Pierre Sep 18 '15 at 19:54

1 Answers1

0

You cannot specify both language and datatype at the same time.

To omit either, supply - on the command line. For example:

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"

I changed the storage type to sqlite and added the option to create a new storage -n - the file storage produces another error rdfproc: Warning - Model does not support contexts rdfproc: Failed to add triple to the graph and I didn't read enough of the source to figure out how to fix that.

laalto
  • 150,114
  • 66
  • 286
  • 303
  • that doesn't work (v 1.0.16 ): `rdfproc: Warning - Model does not support contexts rdfproc: Failed to add triple to the graph` – Pierre Sep 27 '15 at 20:31
  • Yes - that's another problem. It works on some other storages. – laalto Sep 27 '15 at 21:20