glitter icon indicating copy to clipboard operation
glitter copied to clipboard

Confusing s==v(o) full DSL-mode

Open lvaudor opened this issue 2 years ago • 2 comments

Hi!

As a tribute to your work (@maelle) on going full DSL-mode I wanted to include an example in the RR2023 talk and (as I still kind of struggle with it) I went to fetch one in your internals.Rmd. I'm afraid it didn't go very well as I'm actually even more confused than before.

One of your examples is:

spq_init() %>%
  spq_filter(item == wdt::P31(wd::Q13442814))

which translates into a "?item wdt:P31 wd:Q13442814" triple pattern.

But I rather see the y=f(x) R syntax as an equivalent of object=verb(subject) So the way you write that would be something like subject==verb(object), hence putting the property/verb "in reverse"? I guess part of the problem here is that the object is known and not the subject, and although the use of o=v(s) is natural when subject is the input and object the output it is kind of tricky to write it that way when it's the other way around? It's probably why you're using "==" rather than = but honestly the rationale of subject==verb(object) still kind of eludes me.

lvaudor avatar Jun 19 '23 07:06 lvaudor

right, we could change it if you think that makes more sense.

"?s ?v ?o"

is either

spq_mutate(o = v(s)) # "creating the s variable

or

spq_filter(s == v(o)) -- devrait-ce être spq_filter(v(s) == o)

maelle avatar Jun 20 '23 08:06 maelle

opinions at this stage?

maelle avatar Oct 12 '23 12:10 maelle