[ 
https://issues.apache.org/jira/browse/JENA-2205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rob Vesse updated JENA-2205:
----------------------------
    Description: 
When doing the following:

{noformat}
final String pquerys = "select * { VALUES ?l {?lrepl} ?l ?p ?o }";}}
final List<Literal> vlist = new ArrayList<>();
vlist.add(ResourceFactory.createStringLiteral("a"));
vlist.add(ResourceFactory.createStringLiteral("b"));
final ParameterizedSparqlString pquery = new ParameterizedSparqlString(pquerys);
pquery.setValues("lrepl", vlist);
final String res = pquery.toString();
System.out.println(res);
{noformat}


the result is the following syntaxically incorrect query:

{noformat}
select * { VALUES ?l {("a") ("b")} ?l ?p ?o }
{noformat}

which should be

{noformat}
select * { VALUES ?l {"a" "b"} ?l ?p ?o }
{noformat}

I think this can be fixed in a relatively straightforward way by removing the 
addition of parentheses in

https://github.com/apache/jena/blob/0a96c6fd1ecac9ffd68d33b536b2d1ce7fd334b6/jena-arq/src/main/java/org/apache/jena/query/ParameterizedSparqlString.java#L1977

  was:
When doing the following:

final String pquerys = "select * { VALUES ?l {?lrepl} ?l ?p ?o }";}}
final List<Literal> vlist = new ArrayList<>();
vlist.add(ResourceFactory.createStringLiteral("a"));
vlist.add(ResourceFactory.createStringLiteral("b"));
final ParameterizedSparqlString pquery = new ParameterizedSparqlString(pquerys);
pquery.setValues("lrepl", vlist);
final String res = pquery.toString();
System.out.println(res);


the result is the following syntaxically incorrect query:

select * { VALUES ?l {("a") ("b")} ?l ?p ?o }

which should be

select * { VALUES ?l {"a" "b"} ?l ?p ?o }

I think this can be fixed in a relatively straightforward way by removing the 
addition of parentheses in

https://github.com/apache/jena/blob/0a96c6fd1ecac9ffd68d33b536b2d1ce7fd334b6/jena-arq/src/main/java/org/apache/jena/query/ParameterizedSparqlString.java#L1977


> buggy values replacement in ParameterizedSparqlString
> -----------------------------------------------------
>
>                 Key: JENA-2205
>                 URL: https://issues.apache.org/jira/browse/JENA-2205
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 4.2.0
>            Reporter: Elie Roux
>            Priority: Major
>
> When doing the following:
> {noformat}
> final String pquerys = "select * { VALUES ?l {?lrepl} ?l ?p ?o }";}}
> final List<Literal> vlist = new ArrayList<>();
> vlist.add(ResourceFactory.createStringLiteral("a"));
> vlist.add(ResourceFactory.createStringLiteral("b"));
> final ParameterizedSparqlString pquery = new 
> ParameterizedSparqlString(pquerys);
> pquery.setValues("lrepl", vlist);
> final String res = pquery.toString();
> System.out.println(res);
> {noformat}
> the result is the following syntaxically incorrect query:
> {noformat}
> select * { VALUES ?l {("a") ("b")} ?l ?p ?o }
> {noformat}
> which should be
> {noformat}
> select * { VALUES ?l {"a" "b"} ?l ?p ?o }
> {noformat}
> I think this can be fixed in a relatively straightforward way by removing the 
> addition of parentheses in
> https://github.com/apache/jena/blob/0a96c6fd1ecac9ffd68d33b536b2d1ce7fd334b6/jena-arq/src/main/java/org/apache/jena/query/ParameterizedSparqlString.java#L1977



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to