Giter Club home page Giter Club logo

Comments (4)

ray6080 avatar ray6080 commented on September 26, 2024 1

Hi @d33bs , this is a good topic. I've got one input here: One work around we have right now is REL TABLE GROUP, which can life some limitation of "each REL table in Kuzu may only contain one node type for the FROM and TO specification".

Edit: Oh wasn't aware that @andyfengHKU has a more detailed answer. Pleaser refer to his one for more details. 😄

from kuzu.

andyfengHKU avatar andyfengHKU commented on September 26, 2024 1

Hi @d33bs, thanks for trying us out!

Indeed for some graph databases, a relationship (REL table) can be defined over multiple node tables, e.g. the following is doable in Neo4j

CREATE (:A)-[e:R]->(:B);
CREATE (:C)-[e:R]->(:D);
MATCH ()-[e:R]->() RETURN e;

Here we define a relationship R over FROM A TO B and FROM C TO D. The above statements can also be rewritten as with multi-label query which is exactly the same as your second workaround suggestion.

CREATE (:A)-[e:R_AB]->(:B);
CREATE (:C)-[e:R_CD]->(:D);
MATCH ()-[e:R_AB|:R_CD]->() RETURN e;

Back in the day, we thought since there was a workaround, we could just go for a simpler modelling which also benefits bulk-loading performance, data compression and other system level optimizations. So we chose to constraint REL table to be defined over one pair of FROM TO node tables.

Though slowly we indeed receive feedbacks about the limitation of this constraint in practice. So we introduced REL GROUP as an experimental feature where you can define a rel group and use it as a union of multiple relationship tables during querying.

CREATE REL TABLE GROUP R (FROM A TO B, FROM C TO D);
MATCH ()-[e:R]->() RETURN e;

This feature is quite experimental so it comes with many limitations, e.g. you can not bulk-load into a rel group. Any feedback over this feature is highly appreciated.

As for the workarounds

Generalize all NODE types to a single table of type

I don't recommend this one because it will definitely hurt performance because a node table scan will be a lot more costly.

Create specific REL tables for each kind of relationship by distinct FROM, TO node pairs

This idea aligns with our initial thoughts and I believe it will work fine.

from kuzu.

d33bs avatar d33bs commented on September 26, 2024

Thank you so much @ray6080 and @andyfengHKU ! I'll give REL GROUP's a try and follow up with any feedback.

from kuzu.

semihsalihoglu-uw avatar semihsalihoglu-uw commented on September 26, 2024

I'm closing this issue for now assuming RelGroup will do for now. Please re-open if your feedback has a request for a feature we should consider.

from kuzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.