You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Bob DuCharme <bo...@snee.com> on 2013/02/01 01:15:26 UTC
comments in Turtle files PUT or POSTed to Fuseki
When I tried the SPARQL Graph Store HTTP Protocol commands with Fuseki,
they worked great, even better than with Sesame as described at
http://www.snee.com/bobdc.blog/2012/03/playing-with-sparql-graph-stor.html.
One small issue was that if I PUT or POSTed a data file that began with
a comment line, nothing got added; is this because line breaks are
ignored when it's transmitted, so in effect the whole thing got
commented out? A commented-out line at the end of the transmitted data
file was not a problem.
Thanks,
Bob
Re: comments in Turtle files PUT or POSTed to Fuseki
Posted by Bob DuCharme <bo...@snee.com>.
--data-binary did the trick!
Thanks,
Bob
On 2/1/2013 9:43 AM, Andy Seaborne wrote:
> On 01/02/13 13:50, Bob DuCharme wrote:
>> curl -X PUT -d @test.ttl -H "Content-Type: text/turtle"
>> "http://localhost:3030/myDataset/data?graph=default"
>
> -d is HTML form format
>
> try --data-binary @file
>
> -d expects "name=value" pairs (or "name"?) and makes the body of an
> HTML form. curl removes the NLs.
>
> The server receives something without any NLs hence the start comment
> is commenting the whole file.
>
> Andy
Re: comments in Turtle files PUT or POSTed to Fuseki
Posted by Andy Seaborne <an...@apache.org>.
On 01/02/13 13:50, Bob DuCharme wrote:
> curl -X PUT -d @test.ttl -H "Content-Type: text/turtle"
> "http://localhost:3030/myDataset/data?graph=default"
-d is HTML form format
try --data-binary @file
-d expects "name=value" pairs (or "name"?) and makes the body of an HTML
form. curl removes the NLs.
The server receives something without any NLs hence the start comment is
commenting the whole file.
Andy
Re: comments in Turtle files PUT or POSTed to Fuseki
Posted by Bob DuCharme <bo...@snee.com>.
Thanks Andy! When I tried this variation on your curl command
(jena-fuseki-0.2.5 under Windows 7) it worked even when the first line
was commented:
curl -T test.ttl --header "Content-type: text/turtle"
"http://localhost:3030/myDataset/data?default"
This was the command I had been trying:
curl -X PUT -d @test.ttl -H "Content-Type: text/turtle"
"http://localhost:3030/myDataset/data?graph=default"
This is test.ttl:
# here is a comment
@prefix d: <http://learningsparql.com/ns/data#> .
@prefix dm: <http://learningsparql.com/ns/demo#> .
d:x dm:tag "ten" .
d:x dm:tag "eleven" .
These are the log message I got, whether the -X PUT command was used
with a test.ttl file that had the comment at the first line (in which
case the content didn't get sent) or at the last line (in which case it
did):
08:15:14 INFO Fuseki :: [2] PUT
http://localhost:3030/myDataset/data?graph=default
08:15:14 INFO Fuseki :: [2] 204 No Content
So, it looks like when using curl to PUT, I should use your syntax and
not mine. My follow-up question: how do you POST with curl? I was doing
commands like the following, and had a similar story to the one above
(it worked if test.ttl had a comment in the last line, but not if it had
one in the first line):
curl -X POST -d @test.ttl -H "Content-Type: application/x-turtle"
"http://localhost:3030/myDataset/data?graph=http%3A%2F%2Flearningsparql.com%2Fns%2Fdata%23g2"
(curl -X DELETE works fine, as does curl with no parameters for a GET.)
thanks,
Bob
On 2/1/2013 4:09 AM, Andy Seaborne wrote:
> On 01/02/13 00:15, Bob DuCharme wrote:
>> When I tried the SPARQL Graph Store HTTP Protocol commands with Fuseki,
>> they worked great, even better than with Sesame as described at
>> http://www.snee.com/bobdc.blog/2012/03/playing-with-sparql-graph-stor.html.
>>
>>
>> One small issue was that if I PUT or POSTed a data file that began with
>> a comment line, nothing got added; is this because line breaks are
>> ignored when it's transmitted, so in effect the whole thing got
>> commented out? A commented-out line at the end of the transmitted data
>> file was not a problem.
>>
>> Thanks,
>>
>> Bob
>>
>
> Bob,
>
> Could you give a complete example?
>
> I just tested with PUT:
>
> s-put http://localhost:3030/ds/data default D.ttl
> s-get http://localhost:3030/ds/data default
>
> and also
>
> curl -T D.ttl --header 'Content-type: text/turtle'
> 'http://localhost:3030/ds/data?default'
>
> curl 'http://localhost:3030/ds/data?default'
>
> and they worked (latest version).
>
> What did the server log say?
>
> Andy
>
> D.ttl -----------------
>
> # Foo
> @prefix : <http://example/> .
>
> :s1 a :T . :s2 a :T . :s3 a :T .
>
> :s1 :name1 "s11" .
> :s1 :name2 "s12" .
>
> :s2 :name2 "s22" .
>
> :s3 :name1 "s31" .
Re: comments in Turtle files PUT or POSTed to Fuseki
Posted by Andy Seaborne <an...@apache.org>.
On 01/02/13 00:15, Bob DuCharme wrote:
> When I tried the SPARQL Graph Store HTTP Protocol commands with Fuseki,
> they worked great, even better than with Sesame as described at
> http://www.snee.com/bobdc.blog/2012/03/playing-with-sparql-graph-stor.html.
>
> One small issue was that if I PUT or POSTed a data file that began with
> a comment line, nothing got added; is this because line breaks are
> ignored when it's transmitted, so in effect the whole thing got
> commented out? A commented-out line at the end of the transmitted data
> file was not a problem.
>
> Thanks,
>
> Bob
>
Bob,
Could you give a complete example?
I just tested with PUT:
s-put http://localhost:3030/ds/data default D.ttl
s-get http://localhost:3030/ds/data default
and also
curl -T D.ttl --header 'Content-type: text/turtle'
'http://localhost:3030/ds/data?default'
curl 'http://localhost:3030/ds/data?default'
and they worked (latest version).
What did the server log say?
Andy
D.ttl -----------------
# Foo
@prefix : <http://example/> .
:s1 a :T . :s2 a :T . :s3 a :T .
:s1 :name1 "s11" .
:s1 :name2 "s12" .
:s2 :name2 "s22" .
:s3 :name1 "s31" .