How to define type of object in Redland R RDF triples

97 Views Asked by At

I'm trying to use the Redland R RDF implementation to construct a simple RDF store but am having problems writing non-literal triples. In code, after setting up world and model, whilst the literal triple

addStatement(model,
             new("Statement",world,
                 "a:John","b:likes","a:Jane"))

gives the expected

<a:John> <b:likes> "a:Jane"

the code

addStatement(model,
             new("Statement",world,
                 "a:Sian","b:likes","a:John",objectType="blank"))

gives _:a:John instead of <a:John>

<a:Sian> <b:likes> _:a:John

which does not match in the fold in the SPARQL

select ?a ?b where {?a <b:likes> ?x. ?x <b:likes> ?b.}

What am I doing wrong here? Note that this application does not per se look at any delegated databases as I'm just using the triples to exploit the logical power of a SPARQL query. Had originally done this in another package but am trying to move to Redland for technical reasons.

1

There are 1 best solutions below

0
On

With many thanks to Stanislav's comment above, the answer is simply to set objectType to "uri". This is not well documented in the R, but looking at the definition of a Statement object, line 68 on Github, gives the relevant options and defaults.