typedb-osi / typedb-loader

TypeDB Loader - Data Migration Tool for TypeDB
https://github.com/typedb-osi/typedb-loader
Apache License 2.0
58 stars 17 forks source link

Imported nested attributes #66

Open andy-symonds opened 1 year ago

andy-symonds commented 1 year ago

Hi TypeDB-Loaders, Thank you for open-sourcing such a great tool!

I cannot find any documentation on importing attributes of attributes. The appendAttribute functionality only is documented to work for entities and relations (that I can see). Please could you tell me if this is possible or if it is on the road map?

Thinking if something like the below is possible in the TypeDB-Loader config file, where entityA owns attributeA, and attributeA owns attributeB.

"entities": {
    "entityA": {
        "data": [
            "mydata.csv"
        ],
        "insert": {
            "entity": "entityA",
            "ownerships": [
                {
                    "attribute": "attributeA",
                    "column": "attributeA",
                    "ownerships": [
                        {
                            "attribute": "attributeB",
                            "column": "attributeB"
                        }
                    ]
                }
            ]
        }
    }

This is of course possible directly in TypeQL, with something like (if the entityA and attributeA are already loaded in):

match $a isa attributeA; $a "Foo";
insert $a has attributeB "Bar";

It would just be lovely to do it all using TypeDB Loader :)

Many thanks in advance! Andy

flyingsilverfin commented 1 year ago

Hi - There's no reason it shouldn't be done, we'll have to get around to implementing it :) the syntax should already support it in the "attributes" section actually...

andy-symonds commented 1 year ago

Hi @flyingsilverfin, Thanks for confirming that it is possible :) Interested that the syntax should already be supported in "attributes" section.

I am continuing to play around with the syntax to see if I can match and then insert attributes of attributes (no luck so far). If you have any pointers/suggestions please let me know :)