glitter icon indicating copy to clipboard operation
glitter copied to clipboard

Allow for blank nodes

Open lvaudor opened this issue 2 years ago • 3 comments

Hi,

Maybe we should allow the use of blank nodes e.g.

spq_add("?value obo:IAO_0000039 [rdfs:label ?unit]", .required=FALSE)

(I'll put a Wikidata-based example below soon I promise ;-) ).

Maybe it would particularly interesting in our case since we get all variables as output as default with glitter (i.e. we do not have to write explicitly SELECT var1 var2 var3 as long as we have used any of them in the triple patterns)...

lvaudor avatar May 09 '23 14:05 lvaudor

OK, an example... This query

SELECT DISTINCT ?wikisourceSitelink WHERE {
  ?wikisourceSitelink schema:isPartOf ?thing.
  ?thing wikibase:wikiGroup "wikisource".
}
LIMIT 10

is be a bit faster to write with a blank node:

SELECT DISTINCT ?wikisourceSitelink WHERE {
  ?wikisourceSitelink schema:isPartOf [wikibase:wikiGroup "wikisource"].
}
LIMIT 10

To me, a blank node is a bit equivalent to a "proposition relative" (pardon my french): Le site fait partie d'un truc. Le truc est le groupe "wikisource". vs Le site fait partie d'un [truc qui est le groupe "wikisource"].

I can't find an instance where the use of a blank node would really change the nature of the query, for me it's basically just a shortcut. If that is so, not sure it's necessary to implement blank nodes in glitter.

lvaudor avatar May 10 '23 09:05 lvaudor

Anyway, maybe we could think of a vignette for more advanced SPARQL users (I'm thinking of our first and only external user ;-) ) who might have a few notions of SPARQL (but still find glitter useful) and will look for certain features (like blank nodes). This vignette could warn them explicitly that we chose not to include the possibility of blank nodes (well, that remains to be decided but, hypothetically) or that we ruled out the possibility to send very complex SPARQL queries (and that we keep the complexity in R: joins, iterations etc.).

lvaudor avatar May 10 '23 09:05 lvaudor

thinking of this as like OPTIONAL it'd be an extension of the current syntax. what interface would make sense? an argument of spq_add()? something else?

maelle avatar Oct 12 '23 12:10 maelle