fluree / db

Fluree database library
https://fluree.github.io/db/
Other
337 stars 21 forks source link

support transaction functions #232

Open dpetran opened 1 year ago

dpetran commented 1 year ago
dpetran commented 1 year ago

Do we have a complete list of transaction functions we intend to support?

bplatz commented 1 year ago

I think they should be in the spirit, or similar, to the SPARQL function list. Then we extend those for whatever we don't cover, and some won't be applicable likely in a transactional context.

But I sort of feel like that's the place to start, and then here adjust what is supported there ideally after we implement them in query.

Also, using delete and update (which isn't in there yet, only delete is thus far) eliminate the need for at least CAS/compare and swap.

I'm basically saying there is still a good amount of work here to spec, and it should closely align with query functions. https://www.w3.org/TR/sparql11-query/#SparqlOps

bplatz commented 1 year ago

now was one we used to use I think a decent amount... this does have a SPARQL version: https://www.w3.org/TR/sparql11-query/#func-now

zonotope commented 1 year ago

I think most if not all of these are/can be supported with the new update ({:delete ..., :insert ..., :where ...}) operation syntax in combination of a :bind or :filter pattern within the :where clause. Here are the currently supported bind/filter functions

cas is supported implicitly by the update syntax, and we can trivially add functions like inc, dec, etc to the compiler.

mpoffald commented 1 year ago

Removing the "needs specification" label, the task is to make this list of functions work: https://www.w3.org/TR/sparql11-query/#SparqlOps

Per @zonotope , several of these should be largely trivial, and based on the existing method of supporting bind/filter functions.

dpetran commented 1 year ago

Here's what's not implemented yet:

Functional forms:

Scalar functions:

String functions:

Numeric functions

Date/time functions

Hash functions

I think it may be worthwhile to break this into separate tickets, maybe for each class of functions.

zonotope commented 1 year ago

ciel, floor, and rand are already implemented, and they've also been added to the compiler

zonotope commented 1 year ago

It might make sense to split exists out into it's own ticket. That one will be a little tricky because it involves trying to match the pattern against an existing solution instead of operating wholly on the solution itself, so this will have to be implemented outside of the infrastructure defined in the fluree.db.query.exec.eval namespace.

dpetran commented 1 year ago

Splitting the following functions out into a new ticket because they require more substantical changes:

https://github.com/fluree/db/issues/512 https://github.com/fluree/db/issues/513