Using separator with group_concat

13 views
Skip to first unread message

metaf...@gmail.com

unread,
Feb 18, 2015, 3:49:47 AM2/18/15
to sta...@clarkparsia.com
Hi there,

I am trying to use the group-concat function in one of my SPARQL queries. I would like to specify a separator using the clause "separator".
The query works fine via the web interface but it becomes problematic when using stardog.js.

Here is the query I am trying to run :
query: 'SELECT ?evt ?type ?subtype ?begin (group_concat(DISTINCT  ?subject; separator = ";") as ?subjects) (group_concat(DISTINCT  ?subjectName; separator = ";") as ?subjectsNames) (group_concat(DISTINCT  ?object; separator = ";") as ?objects) (group_concat(DISTINCT  ?objectName; separator = ";") as ?objectsNames) WHERE {'
       
+'?evt a sadfc:Event. '
       
+'?evt sadfc:hasEventType ?type. '
       
+'?evt sadfc:hasEventSubtype ?subtype. '
       
+'?evt sadfc:hasDateTime ?date. '
       
+'?date time:hasBeginning ?beginDate . '
       
+'?beginDate time:inXSDDateTime ?begin . '
       
+'?subject ?propSubject ?evt. '
       
+'?propSubject rdfs:subPropertyOf* sadfc:tookPartIn .'
         
+'OPTIONAL'
         
+'{?subject sadfc:hasPseudo ?subjectName .}'
         
+'OPTIONAL'
         
+'{?subject sadfc:hasName ?subjectName .}'
       
+'?evt ?propObject ?object . '
       
+'?propObject rdfs:subPropertyOf* sadfc:interacts '
       
+'OPTIONAL'
         
+'{?object sadfc:hasLocation ?loc .'
         
+'?loc sadfc:hasFilename ?objectName .}'
         
+'OPTIONAL'
         
+'{?object sadfc:hasLocation ?loc .'
         
+'?loc sadfc:hasURL ?objectName .}'
         
+'OPTIONAL'
         
+'{?object sadfc:hasName ?objectName .}'
       
+'} '
       
+'GROUP BY ?evt ?type ?subtype ?begin'

It seems like the semi colon before the keyword "separator" is interpreted as EOF:

400 Encountered "<EOF>" at line 1, column
66.  Was expecting one of:      ")" ...      ";" ...      "=" ...      
"!=" ...      ">" ...      "<" ...      "<=" ...      ">="
...      "||" ...      "&&" ...      "+" ...      "-" ...      
"*" ...      "/" ...      "in" ...      "not in" ...      
<INTEGER_POSITIVE> ...      <INTEGER_NEGATIVE> ...      
<DECIMAL_POSITIVE> ...      <DECIMAL_NEGATIVE> ...      
<DOUBLE_POSITIVE> ...      <DOUBLE_NEGATIVE> ...      

The problem has already been reported here ==> https://github.com/clarkparsia/stardog.js/issues/39

Thanks.
Have a good day


Edgar Rodriguez

unread,
Feb 18, 2015, 10:49:30 AM2/18/15
to sta...@clarkparsia.com
Hi,

I added a test case for the issue in the stardog.js repo. I wasn't able to reproduce the behavior by using the latest stardog.js 1.6 and stardog 2.2.4 with your query.
Which version of stardog and stardog.js are you using?

You can try to run the test case, by following the steps described in the github issue https://github.com/clarkparsia/stardog.js/issues/39

Best,
Edgar

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Message has been deleted

metaf...@gmail.com

unread,
Feb 20, 2015, 3:09:31 AM2/20/15
to sta...@clarkparsia.com
Hi Edgar,

Thanks for your help ;)

I was using an older version of Stardog (2.2.2) and stardog.js 0.1.5 (which is the latest version available on this website ==> http://clarkparsia.github.io/stardog.js/docs/stardog.html).
After updating, I tried to run your test on the repository nodedb but I still get the same error unfortunately...

Edgar Rodriguez

unread,
Feb 20, 2015, 11:45:09 AM2/20/15
to sta...@clarkparsia.com
On Fri, Feb 20, 2015 at 3:09 AM, <metaf...@gmail.com> wrote:
Hi Edgar,

Thanks for your help ;)

I was using an older version of Stardog (2.2.2) and stardog.js 0.1.5 (which is the latest version available on this website ==> http://clarkparsia.github.io/stardog.js/docs/stardog.html).

It seems like the docs were not updated for the latest version, I'll fix that, but if you grab the package via npm or bower you should be able to get the latest version.
 
After updating, I tried to run your test on the repository nodedb but I still get the same error unfortunately...

Did you also upgrade stardog?

I'll try to reproduce with your original environment.

Cheers,
Edgar

metaf...@gmail.com

unread,
Feb 23, 2015, 1:56:15 AM2/23/15
to sta...@clarkparsia.com
Hi ;)

Yes, I have updated Stardog.js and Stardog.

Have a good day
Reply all
Reply to author
Forward
0 new messages