Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

BadURIException when adding a Model to DatasetAccessor

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

Viewing all articles
Browse latest Browse all 5648

Trending Articles