samples/uml2sql.yml2
author Volker Birk <vb@pep-project.org>
Thu, 21 Jan 2021 01:46:34 +0100
changeset 70 58043c7bcc51
parent 0 76005e62091d
permissions -rw-r--r--
renamed in Python 3
define operator "†(\w+)" as call "printType" with "name", "%1";
define operator "“(.*?)”" as call "ucase" with "text", "%1";

function "ucase" {
    param "text";

    > «translate(substring($text, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')»
    > «substring($text, 2)»
}

function "printType" {
    param "name";

    choose {
        when '$name/@href = "http://schema.omg.org/spec/UML/2.1/uml.xml#UnlimitedNatural"'
            > INTEGER
        when '$name/@href = "http://schema.omg.org/spec/UML/2.1/uml.xml#String"'
            > VARCHAR
    }
}