RubenVerborgh / SPARQL.js

A parser for the SPARQL query language in JavaScript
Other
342 stars 66 forks source link

Named Subqueries #43

Open JonasKress opened 7 years ago

JonasKress commented 7 years ago

It would be nice if Named Subqueries would be supported, even though they are not part of the SPARQL spec: https://wiki.blazegraph.com/wiki/index.php/NamedSubquery

RubenVerborgh commented 7 years ago

Thanks for the suggestion. Are these used often? I haven't encountered them myself.

fnielsen commented 7 years ago

We are using WITH quite often in Scholia: If the labeling SERVICE is included in the first SELECT we get a slow performance. It is possible that multiple selects perform just as well.

There are a few on this page, for instance: https://tools.wmflabs.org/scholia/organization/Q1137665

lucaswerkmeister commented 7 years ago

Yes, in general, named subqueries are a more reliable optimization than regular subqueries (BlazeGraph executes the named subqueries only once, before the rest of the query, whereas it sometimes seems to do strange things for regular subqueries).

RubenVerborgh commented 7 years ago

Thanks for the info. I'm reluctant to implement a non-standard feature, but I'll leave this issue open so it can be taken into consideration.

JonasKress commented 7 years ago

This is very important for us and I have seen that there are other non standard features already part of this library.

RubenVerborgh commented 7 years ago

The issue you linked to is about the non-standard feature DEFINE, which is not part of this library.

RubenVerborgh commented 7 years ago

That said, I'm willing to consider a pull request for named subqueries, on the condition that it is configurable and switched off by default.