Discussion Forum

Importing schema to a schema

Hi.
Is there a way to import a schema in order to base it in a new schema?
Of course, importing entities and put new relations on them must need a possibility to extend the entity with a new role.
However, handling each time with only one tql file seems very constrained, isn’t it?

Hi Adista
You can use how many files you want. I you want to keep track of your changes in separate files it is possible. TypeDB will not notice which file you used for a change. And the most noticeable fact in this story is that TypeDB will noch undefine anything except you want this and define this in your file you apply.

HTH Frank

Hi.
I understand from your answer that I can use multiple tql files as sources(I guess I define some “source… .tql” in the console). Is this what you meant?
I meant something else: Can those graphs interact with each other? E.g., how one can add a schematic relation between entities from schemata stored in two different tqls?
Thanks.

Hi
you can imagine that every time you add some schema detail to the database you add new features. Maybe an example will help you to understand what I mean.
file_1.tql define person sub entity, owns name; and only this.
file_2.tql define organization sub entity, owns name; and only this
In the database it will exist as:

define
   name sub attribute, value string;
   person sub entity, 
          owns name; 
   organisation sub entity,
           owns name;

If you define a third file with:

define 
   membership isa relation,
       relates member,
       relates organisation;
   person sub entity,
       plays membership:member:
   organisation sub entity,
       plays membership:organisation;

This will lead you to the schema in the database as following:

    define 
   membership isa relation,
       owns name; 
       relates member,
       relates organisation;
   person sub entity,
       owns name; 
       plays membership:member:
   organisation sub entity,
       plays membership:organisation;

I hope now its more clear how you can deal with more than one file managing the schema in the database. If you want delete something from the schema in the database you have to secure that no data are connected with the item you want delete. Then you can use the command undefine to do this.

HTH Frank