dasch124 / modeller

a quick and dirty generic data modelling workfow
MIT License
0 stars 0 forks source link

allow mapping of dataTypes to technology specific implementations of these dataTypes #4

Open sennierer opened 1 year ago

sennierer commented 1 year ago

It would be nice to include in the schema the exact class/URI/datatype used for a specific implementation of the datamodel in a tool. E.g. if we convert the datamodel described in the model.xml to a Django model it would be good to have shortText mapped to django.db.models.CharField. We could even add the possibility to set certain attributes of that field.

In relation to #1 and #3

dasch124 commented 1 year ago

we could re-use the existing mapping structure for this:

<datatype ID="shortText">
      <name>short text</name>
      <mapping targetLanguage="django" level="exactMatch" version="4.1.2">
                <className>django.db.models.CharField</className>
       </mapping>
</datatype>

which assumes that there exists a <reference> element with the ID django in the reference section

<reference ID="django">
            <name>Django</name>
            <citation key="django4.2.2">Django Software Foundation. (2022). Django Version 4.1.2</citation>
</reference>
sennierer commented 1 year ago

is this already implemented?

dasch124 commented 1 year ago

as of 7170135e534a9 it is ;-)

dasch124 commented 1 year ago

and as of d015afe10b1ce895794337e1e6ad195a920d9709 it should also get rendered in the output

sennierer commented 1 year ago

for some reason this does not validate at the moment (might be my validation library though). When using a similar snippet as shown above, it says tag not allowed here 'mapping'