Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error due to not escaped single quotes #51

Open
patrickwestphal opened this issue May 25, 2014 · 0 comments
Open

SQL error due to not escaped single quotes #51

patrickwestphal opened this issue May 25, 2014 · 0 comments

Comments

@patrickwestphal
Copy link
Member

In case literals (or resources) in the Construct part contain single quotes, as in

Prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Create View err As
  Construct {
    <http://ex.org/sth>
        a <http://ex.org/Cls> ;
        rdfs:label "A label containing 'single quotes'" .
  }

the following error is raised:

2014-05-25 22:42:16,699 DEBUG org.aksw.sparqlify.core.algorithms.SparqlSqlStringRewriterImpl: Sql Query:
    SELECT 'http://ex.org/Cls'::text "C_8", NULL::text "C_9", 'urn:x-arq:DefaultGraphNode'::text "C_5", 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'::text "C_6", 'http://ex.org/sth'::text "C_7"
    FROM
      (SELECT 1) a_1
  UNION ALL
    SELECT NULL::text "C_8", 'A label containing 'single quotes''::text "C_9", 'urn:x-arq:DefaultGraphNode'::text "C_5", 'http://www.w3.org/2000/01/rdf-schema#label'::text "C_6", 'http://ex.org/sth'::text "C_7"
    FROM
      (SELECT 1) a_2

Exception in thread "main" java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: syntax error at or near "quotes"
  Position: 299
    at org.aksw.sparqlify.core.sparql.QueryExecutionSelect.execSelect(QueryExecutionSelect.java:59)
    at org.aksw.jena_sparql_api.core.QueryExecutionBaseSelect.executeCoreSelect(QueryExecutionBaseSelect.java:146)
    at org.aksw.sparqlify.core.sparql.QueryExecutionSparqlify.executeCoreSelect(QueryExecutionSparqlify.java:182)
    at org.aksw.jena_sparql_api.core.QueryExecutionBaseSelect.executeConstructStreaming(QueryExecutionBaseSelect.java:342)
    at org.aksw.jena_sparql_api.core.QueryExecutionBaseSelect.execConstructTriples(QueryExecutionBaseSelect.java:371)
    at org.aksw.jena_sparql_api.core.utils.QueryExecutionUtils.createIteratorDumpTriples(QueryExecutionUtils.java:65)

I used the 0.6.9-SNAPSHOT version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant