rashedul
rashedul

Reputation: 11

How to solve Sparql Query parse exception error?

Following my sparql code:

enter code here    PREFIX wn20schema:<http://www.w3.org/2006/03/wn/wn20/schema/>"  
                + "SELECT *"  
                + "WHERE {"  
                + "  wn20instances:synset-"+input+"-"+"noun-"+" %sensenr%"+ "  ^wn20schema:hyponymOf*  ?hypo . " 
                + " }";

I got following error:

enter code here    Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 289.  Encountered: "%" (37), after : ""

How i can solve this problem?

Upvotes: 0

Views: 1068

Answers (1)

AndyS
AndyS

Reputation: 16700

1/ Put newlines in the query to better see where the parse error report refers to

2/ Print the query after construction to see exactly what it is.

3/ It seems to put the string " %sensenr%" into the query string.

There is a space, so that ends the prefix name at "noun-"

Then there is the space.

Then "%sensenr%"

which is illegal.

Just removing the space alone will not fix your problems.

% is illegal except for %XX hex sequences and the XX must be legal hex. "se" is not.

Upvotes: 2

Related Questions