Works in the current system. Try it at

http://www.sparql.org/query-validator.html

Looking at:

com.hp.hpl.jena.query.QueryParseException: Encountered " "select" "SELECT "" at line 8, column 1.
Was expecting one of:
    "prefix" ...
    "insert" ...
    "delete" ...
    <INSERT_DATA> ...
    <DELETE_DATA> ...
    <DELETE_WHERE> ...
    "modify" ...
    "load" ...
    "clear" ...
    "create" ...
    "add" ...
    "move" ...
    "copy" ...
    "drop" ...
    "with" ...

Line 8 is about where the first SELECT is.

Those are errors from the update parser, not query.

Line 8 of the first query is:

SELECT ?res ?value1 ?value4

and a long way from the IN. Parsing is one-pass, top-to-bottom. An error at line 8 will be due to something around line 8.

> arq-2.8.7.jar
> jena-2.6.4.jar
> tdb.0.8.9.jar

While those are several versions ago, I don't recall any bug that would lead to what you are seeing. The error message is from a different parser (update, not query).

        Andy

On 31/08/12 09:34, Milorad Tosic wrote:
Andy,

Sorry for the lack of details in the initial posting. Here are more details:

This is a query that works fine:

PREFIX os: 
<http://www.tagleen.com/ontologies/2012/1/MetaServiceArchitecture.owl#>
PREFIX ActionItem: <http://www.tagleen.com/ontologies/2012/7/ActionItem.owl#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?res ?value1 ?value4

WHERE {
     BIND (dct:title as ?prop1) .
     BIND (ActionItem:hasPriority as ?prop4) .

{
     SELECT DISTINCT ?res  {
     ?res a ActionItem:ActionItem .

     OPTIONAL {
         ?res ?prop1 ?1 .
     } .
     OPTIONAL {
         ?res ?prop4 ?v4 .
     } .

     FILTER ( ?v4 = os:HighPriority  ) .
    }
ORDER BY ?v1
OFFSET 0
LIMIT 1
}
     OPTIONAL {
         ?res ?prop1 ?value1 .
     } .
     OPTIONAL {
         ?res ?prop4 ?value4 .
     } .
#    FILTER ( ?value4 IN (os:HighPriority) ) .
}


However, if the "=" in FILTER in sub-query is replaced with "IN", as in the 
following query:

SELECT ?res ?value1 ?value4

WHERE {
     BIND (dct:title as ?prop1) .
     BIND (ActionItem:hasPriority as ?prop4) .

{
     SELECT DISTINCT ?res  {
     ?res a ActionItem:ActionItem .

     OPTIONAL {
         ?res ?prop1 ?1 .
     } .
     OPTIONAL {
         ?res ?prop4 ?v4 .
     } .

     FILTER ( ?value4 IN (os:HighPriority) ) .
    }
ORDER BY ?v1
OFFSET 0
LIMIT 1
}
     OPTIONAL {
         ?res ?prop1 ?value1 .
     } .
     OPTIONAL {
         ?res ?prop4 ?value4 .
     } .
#    FILTER ( ?value4 IN (os:HighPriority) ) .
}


then, I get the following error:

com.hp.hpl.jena.query.QueryParseException: c "" at line 8, column 1.
Was expecting one of:
     "prefix" ...
     "insert" ...
     "delete" ...
     <INSERT_DATA> ...
     <DELETE_DATA> ...
     <DELETE_WHERE> ...
     "modify" ...
     "load" ...
     "clear" ...
     "create" ...
     "add" ...
     "move" ...
     "copy" ...
     "drop" ...
     "with" ...

Note that if the same FILTER is defined within the main query (commented line 
in previous queries), then it works in both cases.

My configuration is like follows:

arq-2.8.7.jar
jena-2.6.4.jar
tdb.0.8.9.jar

Thanks,
Milorad



________________________________
From: Andy Seaborne <[email protected]>
To: [email protected]
Sent: Thursday, August 30, 2012 7:42 PM
Subject: Re: FILTER with IN clause in subqueries

On 30/08/12 15:37, Milorad Tosic wrote:
Hi,

If clause IN is found in filter in a subquery the main query fails.
However, if IN is replaced with = as well as if filter with IN clause
is found in main query then the main query executes successfully.
Looks like a bug?

Looks like an incomplete report!

Can you provide a complete, minimal example?

And the version number of the software?

     Andy


Milorad






Reply via email to