ArangoDB does not require that you use graph methods in your query, nor does it really penalize you if you choose not to. It is possible to keep a "primary key" and/or "foreign key" attribute in each document (as is done with normalized SQL tables) and use the FOR ... IN ... FILTER mechanism to "join" collections - no edges required (just be sure you have indexes - use explain <https://www.arangodb.com/docs/3.7/aql/execution-and-performance-explaining-queries.html> to see if they're being used!). There are performance gains to be had when using graphs because there are some optimizations built into the engine, but they may be minor enough that you can forge ahead without.
To use edges instead of "joins," you will have to create individual edge documents for each relation. Obviously, this would be ridiculous to do by hand, so scripting is necessary prior to or after import. Just iterate over each document in collection A, find a match in collection B, then insert an edge with those from/to attributes. Also, I recommend defining a named graph <https://www.arangodb.com/docs/3.7/graphs.html#named-graphs> so the engine knows that edge collection C contains edges that go from collection A to collection B. You can also use an anonymous graph <https://www.arangodb.com/docs/3.7/graphs.html#anonymous-graphs> if you want to sacrifice integrity and flexibility for some speed. On Wed, Aug 26, 2020 at 9:36 AM Marcela Guerrero < [email protected]> wrote: > It happens that I am doing a migration process from Mysql to ArangoDB for > academic reasons. Against this, in reading I have found that ArangoDb is > quite flexible. However, I have doubts about passing the data from my > tables to documents, mainly when I come from a schema with one-to-many and > many-to-many relationships. > I found that for one to many you can work directly in this way > https://www.arangodb.com/docs/stable/aql/examples-join.html However, it > is not clear to me how to work many to many if I must necessarily work it > as edges or documents > > El miércoles, 26 de agosto de 2020 a las 11:21:43 UTC-5, > [email protected] escribió: > >> Edges can only be one-to-one, and are directional (to/from). But that >> doesn’t mean you can’t create lots of edges that connect a single node to >> many others. >> >> The challenge is not in creating the relationships, but in how you >> query. Making sure you are not creating loops, or more specifically, loops >> that leads to loops. This would increase traversal complexity by orders of >> magnitude, rendering even simple queries impossible. >> >> There are options to ensure a path is only traversed once, but those are >> really for handling special cases, not every-day queries. It is MUCH more >> important to model your data appropriately. >> >> Having lots of edges is not a problem - a poor data model *is* (and >> missing indexes, too). >> >> — Kerry >> >> On Wed, Aug 26, 2020 at 9:07 AM Marcela Guerrero <[email protected]> >> wrote: >> >>> Can edges only be used for the graph data model? Or I can use it >>> similarly as if it were a many-to-many relationship in the relational >>> model. >>> What happens to many-to-many relationships in ArangoDB in the event that >>> there are more than two involved tables as evidenced in a relational model >>> ? >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> -- >>> >>> >>> You received this message because you are subscribed to the Google >>> Groups "ArangoDB" group. >>> >>> >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >>> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/arangodb/6bfb59ce-375a-441e-8521-53688f879effn%40googlegroups.com >>> <https://groups.google.com/d/msgid/arangodb/6bfb59ce-375a-441e-8521-53688f879effn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "ArangoDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/arangodb/1b0b0f78-263a-4caf-8c0a-de69d8025888n%40googlegroups.com > <https://groups.google.com/d/msgid/arangodb/1b0b0f78-263a-4caf-8c0a-de69d8025888n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "ArangoDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/arangodb/CANR2gX1FHu49si2yq7RqUwcOp0m%2BRMemwTAOW8UbTP01uut-1w%40mail.gmail.com.
