Callidon / sparql-engine

🚂 A framework for building SPARQL query engines in Javascript/Typescript
https://callidon.github.io/sparql-engine
MIT License
99 stars 14 forks source link

Aggregates #29

Closed dwhitney closed 4 years ago

dwhitney commented 5 years ago

Do aggregates actually work? I have tested them out and they don't seem to really do what's advertised. If this is not a known issue, I can provide some examples, but otherwise, are there plans to build this in?

TIA!

Callidon commented 5 years ago

Hi Aggregates do work, but they require you to add a GROUP BY clause to the query. Otherwise, the framework will not return correct results.

So, for example, If you want to count all distinct subjects in a RDF dataset, you can use the following query:

SELECT (COUNT(DISTINCT ?s) AS ?c)
WHERE {
  ?s ?p ?o
}
GROUP BY ?s

I've planned to do a few more work on this project next week, I will put the "aggregates without group by" feature on my todo list ;)

Callidon commented 5 years ago

Well, I've just pushed some modifications on the master branch that should allow SPARQL aggregates to work without adding a GROUP BY clause.

I will be glad if you could try it and provide some feedback.

dwhitney commented 5 years ago

Really appreciate it! I will check it out and provide feedback

On Sat, Aug 31, 2019 at 12:08 PM Thomas Minier notifications@github.com wrote:

Well, I've just pushed some modifications on the master branch that should allow SPARQL aggregates to work without adding a GROUP BY clause.

I will be glad if you could try it and provide some feedback.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Callidon/sparql-engine/issues/29?email_source=notifications&email_token=AAAIFIPWSED475OL4H2FF7LQHKJRPA5CNFSM4ISRHB4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TPVSY#issuecomment-526842571, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAIFIKIK5XXG7WR332NMQTQHKJRPANCNFSM4ISRHB4A .

dwhitney commented 4 years ago

AWESOME! I will try it out some time this week. Thanks!

dwhitney commented 4 years ago

oh ha - old comment :)