vnadgir-ft / sparkle-g

Automatically exported from code.google.com/p/sparkle-g
Apache License 2.0
0 stars 0 forks source link

count Issue #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Change the content of input.rq to this:

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX p: <http://dbpedia.org/property/>

select distinct ?uri ?label count(?artist)
where {
     <http://dbpedia.org/resource/Alternative_rock> p:associatedActs ?uri .
     ?artist p:associatedActs ?uri .
     ?uri rdfs:label ?label .
     FILTER (lang(?label)='en') .
}

2. Run Sparql main  

What is the expected output? What do you see instead?

The output is this:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX p: <http://dbpedia.org/property/>

SELECT DISTINCT ?uri ?label (?artist) AS )
WHERE {
   <http://dbpedia.org/resource/Alternative_rock> p:associatedActs ?uri .
   ?artist p:associatedActs ?uri .
   ?uri rdfs:label ?label
   FILTER (lang(?label) = 'en') 
}

The "count(?artist)" has been changed to "(?artist) AS )"  --> syntax error 
(too many ')')

What version of the product are you using? On what operating system?
sparkle-pretty-printer-all-4.0-prerelease-0.6.jar on Windows 7

Original issue reported on code.google.com by mariano....@gmail.com on 14 Aug 2012 at 10:12

GoogleCodeExporter commented 9 years ago
Sorry for the delay in answering your problem report. The mail with your issue 
report had been moved by an automatic rule into a wrong mail folder.

When trying to reproduce the problem by passing the query containing the 
"count(?artist)" segment to the sparkle-g processor, the following error 
message is emitted:

line 4:28 extraneous input 'count' expecting {FROM, WHERE, VAR1, VAR2, '(', '{'}
line 4:41 mismatched input ')' expecting AS

The SPARQL grammar definition for the select clause is defined as

SelectClause ::=  'SELECT' ( 'DISTINCT' | 'REDUCED' )? ( ( Var | ( '(' 
Expression 'AS' Var ')' ) )+ | '*' )

The "count(?artist)" part of the query should therefore be written as 
"(count(?artist) AS ?artistCount)". 
This query is accepted by the sparkle-g processor and emitted reformatted 
without error.

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX p: <http://dbpedia.org/property/>

SELECT DISTINCT ?uri
                ?label
                (Count(?artist) AS ?artistCount)
WHERE {
   <http://dbpedia.org/resource/Alternative_rock> p:associatedActs ?uri .
   ?artist p:associatedActs ?uri .
   ?uri rdfs:label ?label
   FILTER(Lang(?label) = 'en')
}

Nevertheless the relevant source code for this issue had been restructured.

Any remarks or questions are welcome!

Original comment by Juergen....@gmail.com on 26 Aug 2012 at 12:24