[ 
https://issues.apache.org/jira/browse/STANBOL-877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13559634#comment-13559634
 ] 

Rupert Westenthaler commented on STANBOL-877:
---------------------------------------------

Hi Florent,

I think this patch tries to correctly apply SPARQL grammarEscapes [1] to parsed 
texts. If this is the case, than those changes should not be made in the 
TextConstraint, because this would affect all FieldQuery implementation with 
possible other escape requirements.

Those changes need to be applied directly in the 
SparqlQueryUtils#addTextConstraint(..) method. So my suggestion would be to add 
an utility method to the SparqlQueryUtils that encodes strings used in SPARQL 
queries and than use this method to correctly escape Strings parsed by 
TextConstraints (and ValueConstraints)



[1] http://www.w3.org/TR/rdf-sparql-query/#grammarEscapes
                
> Double quote in query text cause sparql query to fail
> -----------------------------------------------------
>
>                 Key: STANBOL-877
>                 URL: https://issues.apache.org/jira/browse/STANBOL-877
>             Project: Stanbol
>          Issue Type: Bug
>          Components: Entityhub
>            Reporter: Florent ANDRE
>         Attachments: escape-quote-877.patch
>
>
> With the use of NLP engines and some content with quoted text inside, quotes 
> can be in the string searched by the entityhub.
> Associated with a RDF store, the generated sparql query is not legal as the 
> double quote is not escaped.
> Patch submitted as I'm actually stick to rev 1420034.
> This patch contains :
> * A unit test at the 
> query/clerezza/src/test/java/org/apache/stanbol/entityhub/query/clerezza/SparqlQueryUtilsTest.java
>  level
> * A quote escape in 
> generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/TextConstraint.java
>  for escaping in all query generation cases
> * a remove in 
> generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/util/PatternUtils.java
>  as this double escape something already escaped that lead to not still 
> escape the characters during regex part generation.
> All the project compile with this patch at this rev.
> ++

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to