Charta Software
Back to the base
E-mail:
Wachtwoord:
Aangemaakt door op 2009-05-08 08:43:44
Laatst gewijzigd op 2009-05-11 13:30:46

Sharing code and data

When starting a new database within Charta it is quite difficult to use parts of other databases. The end goal is to use version control to create a Charta repository. The first step to get to this goal is to make it possible to import and export branches of a whole Charta tree, including an easy way to solve the problems that arise (e.g. redundant objects).

Introduction

The Charta environment works on a database, Charta.data. Lots of projects have very valuable data and code within its database. Functions like querying an SQL database, drawing objects, calculating statistics, etc. Or data like country information, postal codes, etc. This data can be saved by exporting the database to an XML file.

Now you start a new project and create a new Charta.data. In this new project you want to use some functionality or data from another database. You can do this by importing the XML file of the database that contains the functionality or data. But then two problems arise:

  1. Overkill:
    You get everything from the other database (which might be a lot more than the needed functionality/data)
  2. Redundancy:
    There might be objects in the other database that are the same as objects in your database, and they are not matched (you will get redundant objects).

How to solve the overkill

It is already possible to prevent importing too much from another database: by hand. You can make a clean version of a database that only contains the data and functionality that you need. Then you export it to an XML file, which can be imported in your own database.

This way of solving the problem is in essence what you want. But Charta should be able to do it for you. This means that the export functionality is to be extended. The following describes the new export process:

  1. When you click the export button you will get a view of the Charta tree containing all the objects present in the database.
  2. You select the objects that you want to export.
  3. When selecting an object it will automatically select all the (grand)child objects, which you can deselect again if you want.
  4. You choose a name and directory for your XML file.
  5. You confirm the export and the objects in your selection (including the objects they depend on) will be exported to your XML file.

How to solve the redundancy

When importing an XML file in your database, all the new objects are just added to the end of the tree. But it could be that you already have an object in your database that matches one of the new objects. And you want it to replace the newly imported object.

For example, you have a class Point and the imported objects also contain a class Point. Every time the new Point is used, you want your Point to be used instead.

It is already possible to solve this problem: by hand again. You rename the newly imported object. You lookup all the references to the object. And you replace the reference by a reference to your own object.

Instead of doing this work afterwards, you want to tell the import that two objects are the same and that the new object should be replaced by the object of your choice. Therefore, the import functionality should be extended. The following describes the new import process:

  1. When you click the import button, you select the XML file to import.
  2. You will get a view of the object tree that is to be added to your Charta tree and you will get a view of your Charta tree itself.
    Underneath the two views you will get a table with two columns: one column for the import objects and one column for the original objects.
  3. For every match you will insert a row into the table. In the first cell of the row you select the import object you want to replace. In the second cell of the row you select the original object you want to replace the import object with.
  4. You confirm the import.

Conclusion

In the end we would like to have one big Charta repository in which each and everyone can put its contribution to Charta. And which is version controlled so that you can always get to a good working environment. The above is a first step to this end goal.

Berichten

"Granularity" instead of "Overkill"?
Aangemaakt door op 2009-05-11 14:11:14
I think it is better to talk in terms of import/export granularity instead of overkill.
Solving the overkill
Aangemaakt door op 2009-05-11 14:09:21
Laatst gewijzigd op 2009-05-11 14:19:30
I do not think we need the proposed procedure to solve the overkill. Also it seems to be a bit complex to implement right now. I think it would be the easiest to add a context menu to the explorer tree which allows exporting individual nodes. We could start with allowing a database node and a global node to be exported. In a following step we can allow to export any node. Adding the context menu would remove the need of the global button "Export to XML". Making a good export would come down to organizing code and data in such a way which makes sharing at the desired level easy. Please note that although we talk about tree nodes to be exported here, in fact the context menu should show up everywhere in the user interface when a database, global or any object is right clicked.
Conclusion
Aangemaakt door op 2009-05-11 13:48:47
The proposed steps to reduce overkill and redundancy do not seem to be steps towards a versioned shared database which is indeed the end goal. The approach only facilitates manually copying and merging of data by automating specific parts of those processes.
Solving the redundancy
Aangemaakt door op 2009-05-11 13:37:56
Solving the redundancy at import time might be a very tedious task. Also, redundancy can easily arise in other situations. Therefore I would suggest to not modify the import functionality but instead add tools that solve specific parts of the redundancy. For instance, if the code base contains two classes Point which are essentially the same it should be possible to merge one class with the other.