On 27/12/12 20:13, Elli Schwarz wrote:
Andy,
Thanks for the tip to start Fuseki with the -v option. Looking at the log now,
it looks like the API translates my query to this (using the same snippet of
Java code as below!):
14:58:32 INFO Fuseki :: [1] Update = WITH <urn:testing:uuidTest> INSERT {
<urn:test:s1> <urn:test:p1> ?o . } WHER
E { BIND(uri(concat("http://example.org/", uuid())) AS ?o) }
In other words, apparently the API replaces STRUUID with UUID, which explains
why I needed the STR(). It also explains why my literal ?o looks
http://example.org/urn:uuid... when looking at the data. The problem appears
to be with the API and not the Fuseki build (my jars are coming from the maven
repo latest releases: ARQ 2.9.4 and Fuseki 0.2.5 which are from late October).
Recently, I reported a problem where [ ] wasn't being interpreted properly by
ARQ, even though Fuseki itself worked properly (JENA-361). It seems that ARQ
tries to do some of its own translation for whatever reason, even if the query
is going directly to a SPARQL endpoint. Could there be a similar problem where
ARQ is translating the SPARQL incorrectly?
OK - located and fixed.
> UpdateRequest update = UpdateFactory.create(queryString);
> UpdateRemote.execute(update, "http://localhost:3030/ds/update");
Your code passes the parsed update to the UpdateRemote.execute, which
needs a string. The parsed structure does not carry the original string
around.
So ARQ turns the parsed structure back into a string ... and struuid
gets truned into uuid. I think we can guess that "someone" (not hard
to guess who :-) copied E_UUID to E_StrUUID and forgot to change the
internal name.
The advantage of parsing-and-converting-back-to-a-string is that parse
errors show up locally.
Fixed in SVN and in tonight's development build of jena 2.10.0
Note - there are many internal changes in 2.10.0 - you need a consistent
set of jars from the same build.
Thanks,
Andy
-Elli
________________________________
From: Andy Seaborne <[email protected]>
To: [email protected]
Sent: Thursday, December 27, 2012 2:36 PM
Subject: Re: Problem with STRUUID
On 27/12/12 15:57, Elli Schwarz wrote:
The following Update script:
with <urn:testing:uuidTest>
insert {<urn:test:s1> <urn:test:p1> ?o} where {
BIND (URI( CONCAT("http://example.org/", STRUUID() )) as ?o)
}
works fine when run from the Fuseki query Editor. As you would expect, I can
see a triple with a UUID as the literal. However, when run the same query
through the SPARQL endpoint API like this:
String queryString = "with <urn:testing:uuidTest> insert {<urn:test:s1>
<urn:test:p1> ?o} where { "
+ " BIND (URI( CONCAT(\"http://example.org/\", STRUUID() )) as
?o) "
You can use '...' for strings as well.
+ "} ";
UpdateRequest update = UpdateFactory.create(queryString);
UpdateRemote.execute(update, "http://localhost:3030/ds/update");
there are no triples in <urn:testing:uuidTest>. However, if I wrap the call to
STRUUID() in STR():
... " BIND (URI( CONCAT(\"http://example.org/\", STR(STRUUID()) )) as ?o) " ...
STR should not make a difference - STRUUID is a string already.
then everything works properly. Why do I need the STR when using the API and
not in Fuseki? I wouldn't expect to need it in either case.
I'm using Fuseki server built from the SVN trunk, revision 1409883 (a bit
behind); and the API is using Jena ARQ 2.9.4 and Fuseki 0.2.5 (from the maven
repo with the latest releases).
All works fine for me (current development). I don't recall any fixes
around STUUID or any other functions since 2012-11 (r1409883 is
2012-11-15 14:05:16 +0000, I think).
Is there anything in the fuseki server log? Can you run with "-v" which
outputs more details? If there is nothing then update is not enabled
(but I thought you'd get a 404).
Andy
Thank you for your help!
-Elli