Hi Juan,
Presumably you get the error at:
>> accessor.add
and on the sending side? I'm not clear as the set up - it's not the
remote server giving that error is it?
It is at this point that things become RDF/XML (the plain vanilla form -
safest default choice). You can set the setOutboundSyntax on the
DatasetGraphAccessorHTTP -- tricky to get to at the DatasetAccessor
level (hmm ...).
At:
>> Model m = getModelFromSomewhere();
you should read the data with a base URI - all the Jena read methods
(model.read, RDFdataMgr.read) have variants for providing the base URI.
Jena, like RDF, assumes absolute URIs.
It is possible to read in relative URIs, especially from
N-triples/N-quads (much less checking on that route specifically so you
can do nasty things - caveat emptor).
If that's not it, could you show some data?
Andy
On 05/12/14 01:05, Juan Sequeda wrote:
I resolved my issue by making sure that all URIs are absolute.
Nevertheless, I'm still curious about how to address this issue.
Juan Sequeda
+1-575-SEQ-UEDA
www.juansequeda.com
On Thu, Dec 4, 2014 at 3:18 PM, Juan Sequeda <[email protected]> wrote:
Andy, all,
I have RDF in turtle syntax, which has relative URIs (e.g. <#Foo>) and no
base define.
If I do the following,
curl -X POST -d @rdfWithRelativeURI.ttl -H "Content-Type: text/turtle"
http://localhost:3030/ds/data?graph=http%3A%2F%2Ffoo.com%2Ftest
everything works fine and the absolute URI is now: <
http://localhost:3030/ds/data?graph=http%3A%2F%2Ffoo.com%2Ftest#Foo>
Now I have the following code:
Model m = getModelFromSomewhere(); //This model has a relative URI (same
data as in rdfWithRelativeURI.ttl)
DatasetAccessor accessor = DatasetAccessorFactory.createHTTP("
http://localhost:3030/ds/data");
accessor.add("http://foo.com/test", m);
And I'm getting a BadURIException:
com.hp.hpl.jena.shared.BadURIException: Only well-formed absolute URIrefs
can be included in RDF/XML output: <#Foo> Code:
57/REQUIRED_COMPONENT_MISSING in SCHEME: A component that is required by
the scheme is missing.
What's the best way of dealing with this?
Is there a way that I can add the content type in the header so it knows
it is Turtle and not RDF/XML?
Or can I change the default syntax of the model to Turtle from RDF/XML (is
that even possible)?
Or can I just add a base somehow?
Thanks for the pointers. I usually never deal with relative URIs so that's
why this is new to me.
Thanks!
Juan