Discussion:
parse error in fuseki UI when typing a query
Vincent Ventresque
2018-11-28 11:28:30 UTC
Permalink
Hello,

Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }' doesn't
work at first. N.B.: I hadn't pasted the string from other software,
everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type 'delete'
again, this time it works.
-- Nothing in log file


I get this error with fuseki 3.9.0 and 3.5.0.

I've uploaded a screenshot of the UI + a .txt file where you can see the
infos (install version, terminal output) :
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors

Do you have encountered this problem? Do you know where it comes from?

Thanks in advance,

Vincent

--
Andy Seaborne
2018-11-28 13:53:54 UTC
Permalink
Vincent,

It's a parse because DELETE is SPARQL Update and the query editor is for
query. In SPARQL, they are different languages.

There is some way (IIRC) to use the UI with update but I can't remember
how - maybe someone else can answer that part.

Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }' doesn't
work at first. N.B.: I hadn't pasted the string from other software,
everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type 'delete'
again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can see the
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Vincent Ventresque
2018-11-28 20:16:41 UTC
Permalink
Thanks Andy.

I don't understand : 'update' queries work in UI most of the time (and
when I re-write this 'delete' query, it works... Of course I have to
give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).

Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).

BUT the error message (see here :
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors )
says

Encountered " "delete" "delete "" at line 19, column 1.
Was expecting one of:
    "base" ...
    "prefix" ...
    "select" ...
    "json" ...
    "describe" ...
    "construct" ...
    "ask" ...
     (7 ms)

and not 'delete', 'insert', so maybe the parser doesn't like updates as
you said.

-- Another case, maybe irrelevant for this problem, where I get errors :
I often try a query in the UI first, and then copy-paste the string in a
custom script to reuse it with command-line tools (the script passes the
query string to other scripts such as s-query, tdbquery, s-update). I
noticed that the 'auto-formatting' (indentation, spaces, code folds,
etc) in the UI dialog box inserts 'special characters' and sometimes I
have to chop them to get the script working. Maybe there's something
wrong with a special character in this 'delete' query too? (N.B. : I
don't remember if the error message is 'lexical error' or 'parse error'
in this case)

-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem could
be linked to javascript or some other piece of the web interface in
firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can see
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Vincent Ventresque
2018-11-28 20:13:15 UTC
Permalink
Thanks Andy.

I don't understand : 'update' queries work in UI most of the time (and
when I re-write this 'delete' query, it works... Of course I have to
give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).

Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).

BUT the error message (see here :
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says

Encountered " "delete" "delete "" at line 19, column 1.
Was expecting one of:
    "base" ...
    "prefix" ...
    "select" ...
    "json" ...
    "describe" ...
    "construct" ...
    "ask" ...
     (7 ms)

and not 'delete', 'insert', so maybe the parser doesn't like updates as
you said.

-- Another case, maybe irrelevant for this problem, where I get errors :
I often try a query in the UI first, and then copy-paste the string in a
custom script to reuse it with command-line tools (the script passes the
query string to other scripts such as s-query, tdbquery, s-update). I
noticed that the 'auto-formatting' (indentation, spaces, code folds,
etc) in the UI dialog box inserts 'special characters' and sometimes I
have to chop them to get the script working. Maybe there's something
wrong with a special character in this 'delete' query too? (N.B. : I
don't remember if the error message is 'lexical error' or 'parse error'
in this case)

-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem could
be linked to javascript or some other piece of the web interface in
firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can see
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Andy Seaborne
2018-11-28 23:02:36 UTC
Permalink
The /MyDataset/ is slightly magic.

Fuseki inspects the request and determines if it is a query or an update.

It is a query if:
1/ The URL query string of the request URI has ?query= in it. (GET or
HTML form)
2/ The content type is application/sparql-query (POST)

and an update if:

3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)

The code is in ServiceRouter.chooseOperation(HttpAction,DataService)

It returns the determines operation which then is used to direct to the
request to the right code - query or update.

If sent to /query or /update the Fuseki knows it is a query or update
directly. There is still checking.

The logs shows the system the system detected the request as a POSTed
query (from YASQE - Fuseki uses a 3rd part SPARQL javascript editor)
because it logs "Query =" then parses it as query where DELETE is not
allowed.

This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.

s-update will send it as an update using POST with the right content type.

This is not to do with browsers.

Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time (and
when I re-write this 'delete' query, it works... Of course I have to
give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
    "base" ...
    "prefix" ...
    "select" ...
    "json" ...
    "describe" ...
    "construct" ...
    "ask" ...
     (7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like updates as
you said.
I often try a query in the UI first, and then copy-paste the string in a
custom script to reuse it with command-line tools (the script passes the
query string to other scripts such as s-query, tdbquery, s-update). I
noticed that the 'auto-formatting' (indentation, spaces, code folds,
etc) in the UI dialog box inserts 'special characters' and sometimes I
have to chop them to get the script working. Maybe there's something
wrong with a special character in this 'delete' query too? (N.B. : I
don't remember if the error message is 'lexical error' or 'parse error'
in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem could
be linked to javascript or some other piece of the web interface in
firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can see
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Vincent Ventresque
2018-11-29 08:03:47 UTC
Permalink
Thanks a lot for all these elements Andy.

However, I still don't understand /why the parser works most of the time
and fails sometimes/. Any clue about what's happening? I find it very
strange that re-typing the same query can solve the problem (I don't
change anything but the query string : the endpoint url is the same,
etc). Could it be linked to some http connection problem?

Another point I'd like to understand : what is exactly the difference
between 'lexical error' and 'parse error' in Fuseki?
Post by Andy Seaborne
The /MyDataset/ is slightly magic.
Fuseki inspects the request and determines if it is a query or an update.
1/ The URL query string of the request URI has ?query= in it. (GET or
HTML form)
2/ The content type is application/sparql-query (POST)
3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)
The code is in ServiceRouter.chooseOperation(HttpAction,DataService)
It returns the determines operation which then is used to direct to
the request to the right code - query or update.
If sent to /query or /update the Fuseki knows it is a query or update
directly. There is still checking.
The logs shows the system the system detected the request as a POSTed
query (from YASQE - Fuseki uses a 3rd part SPARQL javascript editor)
because it logs "Query =" then parses it as query where DELETE is not
allowed.
This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.
s-update will send it as an update using POST with the right content type.
This is not to do with browsers.
    Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time
(and when I re-write this 'delete' query, it works... Of course I
have to give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
     "base" ...
     "prefix" ...
     "select" ...
     "json" ...
     "describe" ...
     "construct" ...
     "ask" ...
      (7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like updates
as you said.
-- Another case, maybe irrelevant for this problem, where I get
errors : I often try a query in the UI first, and then copy-paste the
string in a custom script to reuse it with command-line tools (the
script passes the query string to other scripts such as s-query,
tdbquery, s-update). I noticed that the 'auto-formatting'
(indentation, spaces, code folds, etc) in the UI dialog box inserts
'special characters' and sometimes I have to chop them to get the
script working. Maybe there's something wrong with a special
character in this 'delete' query too? (N.B. : I don't remember if the
error message is 'lexical error' or 'parse error' in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem
could be linked to javascript or some other piece of the web
interface in firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Marco Neumann
2018-11-29 11:04:23 UTC
Permalink
one seems to be the jetty error + jena error message and the other is the
specific jena 'lexical error' message. keep in mind fuseki uses jetty to
serve http requests in the standard configuration.

since jena is open source you can inspect the error handle in more detail
yourself, show more detailed logging or roll your own.

https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java




On Thu, Nov 29, 2018 at 8:04 AM Vincent Ventresque <
Post by Vincent Ventresque
Thanks a lot for all these elements Andy.
However, I still don't understand /why the parser works most of the time
and fails sometimes/. Any clue about what's happening? I find it very
strange that re-typing the same query can solve the problem (I don't
change anything but the query string : the endpoint url is the same,
etc). Could it be linked to some http connection problem?
Another point I'd like to understand : what is exactly the difference
between 'lexical error' and 'parse error' in Fuseki?
Post by Andy Seaborne
The /MyDataset/ is slightly magic.
Fuseki inspects the request and determines if it is a query or an update.
1/ The URL query string of the request URI has ?query= in it. (GET or
HTML form)
2/ The content type is application/sparql-query (POST)
3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)
The code is in ServiceRouter.chooseOperation(HttpAction,DataService)
It returns the determines operation which then is used to direct to
the request to the right code - query or update.
If sent to /query or /update the Fuseki knows it is a query or update
directly. There is still checking.
The logs shows the system the system detected the request as a POSTed
query (from YASQE - Fuseki uses a 3rd part SPARQL javascript editor)
because it logs "Query =" then parses it as query where DELETE is not
allowed.
This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.
s-update will send it as an update using POST with the right content type.
This is not to do with browsers.
Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time
(and when I re-write this 'delete' query, it works... Of course I
have to give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
"base" ...
"prefix" ...
"select" ...
"json" ...
"describe" ...
"construct" ...
"ask" ...
(7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like updates
as you said.
-- Another case, maybe irrelevant for this problem, where I get
errors : I often try a query in the UI first, and then copy-paste the
string in a custom script to reuse it with command-line tools (the
script passes the query string to other scripts such as s-query,
tdbquery, s-update). I noticed that the 'auto-formatting'
(indentation, spaces, code folds, etc) in the UI dialog box inserts
'special characters' and sometimes I have to chop them to get the
script working. Maybe there's something wrong with a special
character in this 'delete' query too? (N.B. : I don't remember if the
error message is 'lexical error' or 'parse error' in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem
could be linked to javascript or some other piece of the web
interface in firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
--
---
Marco Neumann
KONA
Vincent Ventresque
2018-11-29 11:10:02 UTC
Permalink
Hello Marco,

Thanks for the link, I'll have a look.

Also opened a few javascript files this morning : I wonder if the
problem could be linked to 'sparql.js' or 'codemirror.js' ( in
webapp/js/lib/ and webapp/js/lib/mode/ )
Post by Marco Neumann
one seems to be the jetty error + jena error message and the other is the
specific jena 'lexical error' message. keep in mind fuseki uses jetty to
serve http requests in the standard configuration.
since jena is open source you can inspect the error handle in more detail
yourself, show more detailed logging or roll your own.
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/lang/arq/TokenMgrError.java
On Thu, Nov 29, 2018 at 8:04 AM Vincent Ventresque <
Post by Vincent Ventresque
Thanks a lot for all these elements Andy.
However, I still don't understand /why the parser works most of the time
and fails sometimes/. Any clue about what's happening? I find it very
strange that re-typing the same query can solve the problem (I don't
change anything but the query string : the endpoint url is the same,
etc). Could it be linked to some http connection problem?
Another point I'd like to understand : what is exactly the difference
between 'lexical error' and 'parse error' in Fuseki?
Post by Andy Seaborne
The /MyDataset/ is slightly magic.
Fuseki inspects the request and determines if it is a query or an update.
1/ The URL query string of the request URI has ?query= in it. (GET or
HTML form)
2/ The content type is application/sparql-query (POST)
3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)
The code is in ServiceRouter.chooseOperation(HttpAction,DataService)
It returns the determines operation which then is used to direct to
the request to the right code - query or update.
If sent to /query or /update the Fuseki knows it is a query or update
directly. There is still checking.
The logs shows the system the system detected the request as a POSTed
query (from YASQE - Fuseki uses a 3rd part SPARQL javascript editor)
because it logs "Query =" then parses it as query where DELETE is not
allowed.
This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.
s-update will send it as an update using POST with the right content type.
This is not to do with browsers.
Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time
(and when I re-write this 'delete' query, it works... Of course I
have to give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
"base" ...
"prefix" ...
"select" ...
"json" ...
"describe" ...
"construct" ...
"ask" ...
(7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like updates
as you said.
-- Another case, maybe irrelevant for this problem, where I get
errors : I often try a query in the UI first, and then copy-paste the
string in a custom script to reuse it with command-line tools (the
script passes the query string to other scripts such as s-query,
tdbquery, s-update). I noticed that the 'auto-formatting'
(indentation, spaces, code folds, etc) in the UI dialog box inserts
'special characters' and sometimes I have to chop them to get the
script working. Maybe there's something wrong with a special
character in this 'delete' query too? (N.B. : I don't remember if the
error message is 'lexical error' or 'parse error' in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem
could be linked to javascript or some other piece of the web
interface in firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Andy Seaborne
2018-11-29 11:47:33 UTC
Permalink
Post by Vincent Ventresque
Thanks a lot for all these elements Andy.
However, I still don't understand /why the parser works most of the time
and fails sometimes/.
Can you provide repeatable examples? Ideally, not using YASQE.
(BTW YASQE retains internal state like last query). YASQE could do with
version upgrade if anyone wants to put in a PR.

As far as the information in this thread goes, it seems different ways
to send request means they are different at Fuseki (e.g Content-type).
Post by Vincent Ventresque
Any clue about what's happening? I find it very
strange that re-typing the same query can solve the problem (I don't
change anything but the query string : the endpoint url is the same,
etc). Could it be linked to some http connection problem?
If you are getting 400's from Fuseki (Bad request) the HTTP connection
is working just fine.
Post by Vincent Ventresque
Another point I'd like to understand : what is exactly the difference
between 'lexical error' and 'parse error' in Fuseki?
Examples?

Your txt file has "400 Parse error" sent back by Fuseki.
Post by Vincent Ventresque
Post by Andy Seaborne
The /MyDataset/ is slightly magic.
Fuseki inspects the request and determines if it is a query or an update.
1/ The URL query string of the request URI has ?query= in it. (GET or
HTML form)
2/ The content type is application/sparql-query (POST)
3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)
The code is in ServiceRouter.chooseOperation(HttpAction,DataService)
It returns the determines operation which then is used to direct to
the request to the right code - query or update.
If sent to /query or /update the Fuseki knows it is a query or update
directly. There is still checking.
The logs shows the system the system detected the request as a POSTed
query (from YASQE - Fuseki uses a 3rd part SPARQL javascript editor)
because it logs "Query =" then parses it as query where DELETE is not
allowed.
This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.
s-update will send it as an update using POST with the right content type.
This is not to do with browsers.
    Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time
(and when I re-write this 'delete' query, it works... Of course I
have to give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above dialog
box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or other
'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
     "base" ...
     "prefix" ...
     "select" ...
     "json" ...
     "describe" ...
     "construct" ...
     "ask" ...
      (7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like updates
as you said.
-- Another case, maybe irrelevant for this problem, where I get
errors : I often try a query in the UI first, and then copy-paste the
string in a custom script to reuse it with command-line tools (the
script passes the query string to other scripts such as s-query,
tdbquery, s-update). I noticed that the 'auto-formatting'
(indentation, spaces, code folds, etc) in the UI dialog box inserts
'special characters' and sometimes I have to chop them to get the
script working. Maybe there's something wrong with a special
character in this 'delete' query too? (N.B. : I don't remember if the
error message is 'lexical error' or 'parse error' in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem
could be linked to javascript or some other piece of the web
interface in firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor is
for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from other
software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete', type
'construct' instead), it's ok. Then I cut 'construct' and type
'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Vincent Ventresque
2018-11-29 12:40:22 UTC
Permalink
Many thanks for your patience, these are very useful details.
Can you provide *repeatable examples*? Ideally, not using YASQE.
-- unfortunately not... but if I have the same problem, I'll try to
configure Jetty and/or Jena error handling (as Marco suggested) to get
some more information if I have time.

-- thanks for mentioning YASQE, I found the 'codemirror.js' file but
didn't know about Yasgui/Yasque.
BTW *YASQE retains internal state like last query* (...) it seems
different ways to send request means they are different at Fuseki (e.g
Content-type).

-- So, let me translate in my newbie language : you mean that if my
/previous query/ has been parsed as 'query', the /next query string/
('update') is sent with the previous (wrong) content-type, and this
might be the cause of parse error? Therefore, nothing to do with special
characters. This sounds very interesting.
If you are getting 400's from Fuseki (Bad request) the *HTTP
connection * is working just fine.

-- Good news (that's what I thought but wanted to be sure to understand)
Post by Vincent Ventresque
Thanks a lot for all these elements Andy.
However, I still don't understand /why the parser works most of the
time and fails sometimes/.
Can you provide repeatable examples? Ideally, not using YASQE.
(BTW YASQE retains internal state like last query). YASQE could do
with version upgrade if anyone wants to put in a PR.
As far as the information in this thread goes, it seems different ways
to send request means they are different at Fuseki (e.g Content-type).
Post by Vincent Ventresque
Any clue about what's happening? I find it very strange that
re-typing the same query can solve the problem (I don't change
anything but the query string : the endpoint url is the same, etc).
Could it be linked to some http connection problem?
If you are getting 400's from Fuseki (Bad request) the HTTP connection
is working just fine.
Post by Vincent Ventresque
Another point I'd like to understand : what is exactly the difference
between 'lexical error' and 'parse error' in Fuseki?
Examples?
Your txt file has "400 Parse error" sent back by Fuseki.
Post by Vincent Ventresque
Post by Andy Seaborne
The /MyDataset/ is slightly magic.
Fuseki inspects the request and determines if it is a query or an update.
1/ The URL query string of the request URI has ?query= in it. (GET
or HTML form)
2/ The content type is application/sparql-query (POST)
3/ The URL update string is ?update= (GET or HTML form - GET wil be
bounced later on).
4/ The content type is application/sparql-update (POST)
The code is in ServiceRouter.chooseOperation(HttpAction,DataService)
It returns the determines operation which then is used to direct to
the request to the right code - query or update.
If sent to /query or /update the Fuseki knows it is a query or
update directly. There is still checking.
The logs shows the system the system detected the request as a
POSTed query (from YASQE - Fuseki uses a 3rd part SPARQL javascript
editor) because it logs "Query =" then parses it as query where
DELETE is not allowed.
This becomes more important at Fuseki 3.10 because the next version
supports access control so query vs update matters more.
s-update will send it as an update using POST with the right content type.
This is not to do with browsers.
    Andy
Post by Vincent Ventresque
Thanks Andy.
I don't understand : 'update' queries work in UI most of the time
(and when I re-write this 'delete' query, it works... Of course I
have to give http://localhost:3030/MyDataset or
http://localhost:3030/MyDataset/update as endpoint url (above
dialog box), not http://localhost:3030/MyDataset/query).
Besides, I'm not sure the problem didn't occur with 'select' or
other 'read-only' queries (I'll report the case if it happens).
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors ) says
Encountered " "delete" "delete "" at line 19, column 1.
     "base" ...
     "prefix" ...
     "select" ...
     "json" ...
     "describe" ...
     "construct" ...
     "ask" ...
      (7 ms)
and not 'delete', 'insert', so maybe the parser doesn't like
updates as you said.
-- Another case, maybe irrelevant for this problem, where I get
errors : I often try a query in the UI first, and then copy-paste
the string in a custom script to reuse it with command-line tools
(the script passes the query string to other scripts such as
s-query, tdbquery, s-update). I noticed that the 'auto-formatting'
(indentation, spaces, code folds, etc) in the UI dialog box inserts
'special characters' and sometimes I have to chop them to get the
script working. Maybe there's something wrong with a special
character in this 'delete' query too? (N.B. : I don't remember if
the error message is 'lexical error' or 'parse error' in this case)
-- a final point (don't know if it's relevant either) : I use only
Firefox, didn't try with other browsers. Do you think the problem
could be linked to javascript or some other piece of the web
interface in firefox (maybe a bug in firefox itself) ?
Post by Andy Seaborne
Vincent,
It's a parse because DELETE is SPARQL Update and the query editor
is for query. In SPARQL, they are different languages.
There is some way (IIRC) to use the UI with update but I can't
remember how - maybe someone else can answer that part.
    Andy
Post by Vincent Ventresque
Hello,
Sometimes I have a '400 Parse error' when typing a query in Fuseki UI.
-- Here, the query string 'delete {?s ?p ?o } where {?s ?p ?o }'
doesn't work at first. N.B.: I hadn't pasted the string from
other software, everything had been typed in the query dialog box.
-- If I change the string for a construct query (cut 'delete',
type 'construct' instead), it's ok. Then I cut 'construct' and
type 'delete' again, this time it works.
-- Nothing in log file
I get this error with fuseki 3.9.0 and 3.5.0.
I've uploaded a screenshot of the UI + a .txt file where you can
https://sourceforge.net/projects/ffl-misc/files/fuseki_strange_errors
Do you have encountered this problem? Do you know where it comes from?
Thanks in advance,
Vincent
Loading...