Juna,
Yes - making the URI absolute is the best way. Writing using a base URI
should create
The only class of use case I know of that demand relative URIs is
preparing data for publication; most extreme is the LDP (Link Data
Platform) case where the server chooses the URI for publication, not the
client, when you add a LDP-resource to a container.
That can be done but there is a trick - create with a known identifiable
base (e.g. http://base/) and write out using that as base URI. For
Turtle, it will put in the @base line which needs removing but the line
is always first.
If there is sufficient demand and use cases, I'll put in the missing
RDFDataMgr calls, and suppress @base.
Andy
On 05/12/14 17:03, Juan Sequeda wrote:
Andy,
On Fri, Dec 5, 2014 at 3:53 AM, Andy Seaborne <[email protected]> wrote:
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 ...).
This is helpful. But I agree that going down this route would be tricky
(and hacky IMO) because you would be addressing the issue of RDF not having
absolute URIs.
54.84.58.65
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.
I understand. That is why I made sure that the all the URIs were absolute.
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