cimug-org / CIMTool

CIMug's CIMTool for the Common Information Model (CIM).
http://cimtool.ucaiug.io/
GNU Lesser General Public License v2.1
44 stars 5 forks source link

Newer CIM domain primitives should be added as needed to the CIMTool `Translator.selectXSDType()` method. #116

Closed tviegut closed 1 month ago

tviegut commented 6 months ago

With the recent introduction of UUID and URI, and other newer domain primitives the selectXSDType() method in the CIMTool Translator class should be evaluated to determine if and if so what XSDType(s) should be added to the results returned. Note that MonthDay and Duration primitives types are both ISO-8601 and should also be evaluated as well. Below is the current state of this method:

    /**
     * Select XSD datatypes for UML attributes.
     * 
     * @param l A simple name for the datatype received from the UML. 
     * @return A resource representing one of the XSD datatypes recommended for OWL.
     */
    protected FrontsNode selectXSDType(String l) {
        // TODO: add more XSD datatypes here
        if( l.equalsIgnoreCase("integer"))
            return XSD.integer;
        else if( l.equalsIgnoreCase("int"))
            return XSD.xint;
        else if( l.equalsIgnoreCase("unsigned"))
            return XSD.unsignedInt;
        else if( l.equalsIgnoreCase("ulong") ||
                l.equalsIgnoreCase("ulonglong"))
            return XSD.unsignedLong;
        else if( l.equalsIgnoreCase("short"))
            return XSD.xshort;
        else if( l.equalsIgnoreCase("long")||
                l.equalsIgnoreCase("longlong"))
            return XSD.xlong;
        else if( l.equalsIgnoreCase("string") ||
                l.equalsIgnoreCase("char"))
            return XSD.xstring;
        else if( l.equalsIgnoreCase("float"))
            return XSD.xfloat;
        else if( l.equalsIgnoreCase("double") ||
                l.equalsIgnoreCase("longdouble"))
            return XSD.xdouble;
        else if( l.equalsIgnoreCase("boolean")  ||
                l.equalsIgnoreCase("bool"))
            return XSD.xboolean;
        else if( l.equalsIgnoreCase("decimal"))
            return XSD.decimal;
        else if( l.equalsIgnoreCase("nonNegativeInteger"))
            return XSD.nonNegativeInteger;
        else if( l.equalsIgnoreCase("date"))
            return XSD.date;
        else if( l.equalsIgnoreCase("time"))
            return XSD.time;
        else if( l.equalsIgnoreCase("datetime"))
            return XSD.dateTime;
        else if( l.equalsIgnoreCase("absolutedatetime"))
            return XSD.dateTime;
        else if( l.equalsIgnoreCase("absolutetime"))
            return XSD.time;
        else if( l.equalsIgnoreCase("absolutedate"))
            return XSD.date;
        else
            return null;
    }