Query Error in EDG but not in TBC

8 views
Skip to first unread message

Tim Smith

unread,
Jul 23, 2021, 1:07:20 PM7/23/21
to topbrai...@googlegroups.com
Hi,

Could someone please check this query in EDG?

SELECT COUNT(*)
WHERE {
    ?s rdfs:label ?slabel .
}

Using TBC 7.0.3, I start TBC, after closing all browsers, open EDG , open the Kennedy Family Data Graph, open a SPARQL panel and type in the query above.

EDG thinks there is an error in the query:

image.png

Remove the COUNT, and it will work.

Using the same query in TBC, it executes as expected.  I've reset the SPARQL panel to the default query and re-typed the query several times with the same error message.

Am I missing something obvious? 

Thanks,

Tim

Pat Doyle

unread,
Jul 23, 2021, 4:15:51 PM7/23/21
to TopBraid Suite Users
If I recall correctly, this is a consequence of the third party sparql query editor library we use in the browser being a bit more picky about syntax than we are in Composer itself. 

I think I worked around it in the past by changing any instance of SELECT COUNT(*) to SELECT (COUNT(*) as ?count), or something similar. 

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAF0WbnJLQdHzNR%3Dczy%2BTKXfbJMm8aaUdcLfBB7ZcSeAhXMEP7g%40mail.gmail.com.

Steve Ray

unread,
Jul 23, 2021, 4:20:09 PM7/23/21
to TopBraid Suite Users
Just to chime in, that second syntax is exactly what I always use.

Steve




Tim Smith

unread,
Jul 23, 2021, 4:55:17 PM7/23/21
to topbrai...@googlegroups.com
Thanks Pat & Steve,

I will give it a try.

Tim

Tim Smith

unread,
Jul 23, 2021, 7:30:06 PM7/23/21
to topbrai...@googlegroups.com
Another question... any thoughts on the correct syntax of NOT EXISTS in the EDG SPARQL editor?  Also, is this editor documented somewhere such that I can read-up on the correct syntax?  I have a lot of "querying" to do and I need to do it within EDG unless I open the XDB graph in Composer.  I'm hesitant to do that as I have had it cause corruption issues in the past.

Thanks!

Tim

image.png

Irene Polikoff

unread,
Jul 23, 2021, 8:08:57 PM7/23/21
to topbrai...@googlegroups.com
Use FILTER NOT EXISTS

Correct syntax is in the SPARQL spec e.g., https://www.w3.org/TR/sparql11-query/#neg-pattern. When in doubt, simply check the spec.

As Pat said, TBC (and Jena, I think) support syntax as per the spec as well as certain shortcuts, but SPARQL editor in EDG only supports syntax as per the spec:

- EXISTS and NOT EXISTS should always be preceded by the FILTER.

- Aggregate functions (count, min, avg, etc.) in the SELECT clause should always be stated as follows (F(?var1) AS ?var2) - see https://www.w3.org/TR/sparql11-query/#aggregates

I think these are the two main items.

On Jul 23, 2021, at 7:30 PM, Tim Smith <smith...@gmail.com> wrote:

Another question... any thoughts on the correct syntax of NOT EXISTS in the EDG SPARQL editor?  Also, is this editor documented somewhere such that I can read-up on the correct syntax?  I have a lot of "querying" to do and I need to do it within EDG unless I open the XDB graph in Composer.  I'm hesitant to do that as I have had it cause corruption issues in the past.

Thanks!

Tim

<image.png>

On Fri, Jul 23, 2021 at 4:55 PM Tim Smith <smith...@gmail.com> wrote:
Thanks Pat & Steve,

I will give it a try.

Tim

On Fri, Jul 23, 2021, 4:20 PM Steve Ray <st...@steveray.com> wrote:
Just to chime in, that second syntax is exactly what I always use.

Steve




On Fri, Jul 23, 2021 at 1:15 PM Pat Doyle <pdo...@topquadrant.com> wrote:
If I recall correctly, this is a consequence of the third party sparql query editor library we use in the browser being a bit more picky about syntax than we are in Composer itself. 

I think I worked around it in the past by changing any instance of SELECT COUNT(*) to SELECT (COUNT(*) as ?count), or something similar. 

On Fri, Jul 23, 2021 at 1:07 PM Tim Smith <smith...@gmail.com> wrote:
Hi,

Could someone please check this query in EDG?

SELECT COUNT(*)
WHERE {
    ?s rdfs:label ?slabel .
}

Using TBC 7.0.3, I start TBC, after closing all browsers, open EDG , open the Kennedy Family Data Graph, open a SPARQL panel and type in the query above.

EDG thinks there is an error in the query:

<image.png>

Remove the COUNT, and it will work.

Using the same query in TBC, it executes as expected.  I've reset the SPARQL panel to the default query and re-typed the query several times with the same error message.

Am I missing something obvious? 

Thanks,

Tim

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAF0WbnJLQdHzNR%3Dczy%2BTKXfbJMm8aaUdcLfBB7ZcSeAhXMEP7g%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CA%2B5SJmHv8VgbZ-qquztor4sD0CSfE_2UvO9UfC0%3DrMpwkD4SbQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep85%3DP%2BLs7xqzrRveX1ZBHM7Eyo75piVbMaK8SEXuZQ-4nw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.

Tim Smith

unread,
Jul 23, 2021, 8:20:06 PM7/23/21
to topbrai...@googlegroups.com
Thanks Irene!  TBC has spoiled me for so long, I've forgotten the official syntax. 



Holger Knublauch

unread,
Jul 24, 2021, 3:05:33 AM7/24/21
to topbrai...@googlegroups.com

As a bit of technical background, we use the Apache Jena SPARQL engine, known as ARQ [1]. This engine has been around for a long time and was mainly written by Andy Seaborne who used it to explore the evolution of the original SPARQL standard and beyond with various extensions. In some features it still goes beyond SPARQL 1.1, but with others the official standard caught up or created small differences from the original implementations. One such example is the LET keyword that later became BIND, another is NOT EXISTS which must be wrapped into a FILTER clause. Yet ARQ still understands the old syntax unless deactivated.

To align with the official syntax also from TBC, use this setting

Holger

[1] https://jena.apache.org/documentation/query/

Reply all
Reply to author
Forward
0 new messages