vaticle / typedb

TypeDB: the polymorphic database powered by types
https://typedb.com
Mozilla Public License 2.0
3.72k stars 337 forks source link

Typedb 3.0 wishlist #6945

Open lveillard opened 7 months ago

lveillard commented 7 months ago

Hello! Here is a little compendium of features we are building in our abstraction layer (www.blitznocode.com) that would be nice to have in typeDB natively:

TOP 3 Key features: optional mutations, hooks and structs

1. Batched & optional mutations

Functions

Cardinality

5.1. Validations

Ordered & repeated attributes & vectors

Cardinality reasoning

insert $myRelation (boss: $bigBoss, employees: [$everyoneElse] isa myrelation, has id 1; #this is run only Once. Not once per item in $everyoneElse as we packed them into an array


### Array Functions
5.5. 

Example:

match $people isa Person, has id in [1,2,3,4,12]

Extra

6. Orphan attributes

insert $newManager isa Person, has id 8;

replace $management( manager: $newManager); #Removes all current managers if any , replaces by new one



### 9. native geo-spatial types (point, polygon...)
- https://dgraph.io/docs/graphql/schema/types/
maydanw commented 7 months ago

Rule scoping - Sending the list of rules to apply (or exclude) when running a query (an alternative to reduce transmission costs is being able to set tags to rules during their definition and send the tags as part of the query). Example: There is a need for inference but no need for permission check when running this query or no need to check if the information was reviewed and approved as correct (as it is used for training or the user has a curator role, etc.,). These scenarios are where queries run frequently and repeatedly and redundant operations is more apparent.

maydanw commented 7 months ago

Atomic increase and decrease - This allows putting a counter on entities and impacts many algorithms that use probabilities.

maydanw commented 7 months ago

Private/local attributes - Most attributes are local and private to the entity there is no need to search every entity with this attribute value. Allowing defining attributes to be local to the entity simplifies the basic CRUD operation on entities and saves mistakes. Example: Most boolean attributes (e.g., Gender, ActiveUser, ...)

maydanw commented 7 months ago

OnWrite/Mutating Rules - When a certain change in the graph occurs also do this and that. It keeps the data integrity inside the database and does not rely on external application level. If you want, think about the current situation as if I would make a class with data properties but make the process of keeping data integrity in other classes maintained by other groups of developers. It is possible but not the best practice (post-hooks is also a sort of solution here). Eqvivantly when I define my schema I want to define, as best as I can, various change consequences as part of my data layout view and definitions and not worry on every step if a developer is going to know and maintain it.

maydanw commented 6 months ago

I think it would be beneficial to have a "list" and a "set" attributes types with their basic operations management in rust. It means I can define an attribute that is of type list (we can begin with simple values like int and string and maybe later allow structs and entities). To these attributes I would like to do the expected operation (e.g., add, remove, check containment, for list by indexes) in a single query along with the match operation.

This will allow adding metrics and accumulating data attached to the entity or relation and retrieving it without multiple roundtrips and/or complex rules or inefficient driver-side processing. The consequence is lowering the entrance bar for many users and use-cases as well as supplying superior performance in many common use-cases.

Another point I want to add is that one of TypeDB strengths is reducing the gap between the programming logic and the data storage engine and any programming language has these basic types so it is aligned with the vision.

brettforbes commented 1 month ago

Also,

Structs must support time, so that one can input a datetime object, but in the background it gets broken into elements (i.e. integers or day, month, year, hour, min, sec, millisecs, microsecs, nanosecs, timezone). Then all datetime retrieval by default uses these indexes, so time query's, retrievals etc become super fast. Further date maths also uses these elements.

Making time fast, and including date maths, is an essential advantage for winning competitive deals against Elastic search or other db's

brettforbes commented 1 month ago

Also, Vector support (ala LLM vectors) would also be a huge win, and at the moment it is a negative for TypeDB, as most vendors support it

sjpritchard commented 3 weeks ago

Vector support (ala LLM vectors) would also be a huge win, and at the moment it is a negative for TypeDB, as most vendors

Can't emphasise this enough. You are missing a HUGE opportunity here. Graph databases are enormously useful combined with LLMs, and TypeDB is nowhere to be seen.