Data Classes

Data Classes #

This page contains the following content:

Data Classes in ProCAKE #

ProCAKE provides several data classes. Please refer to the following sections for more details:

The following figures show the hierarchy of the built-in system data classes.

Basic Data Classes #

Data-Class-Hierarchy-1

Please note that not all system classes can be instantiated. Such abstract classes must first be subclassed (by user classes) to be able to create objects. For example, the URI class can be subclassed as follows:

Wiki_DataClassesTest.java

    URIClassImpl customUriClass = (URIClassImpl) ModelFactory.getDefaultModel().getURISystemClass().createSubclass("MyURI");
    customUriClass.setOntologyName("MyOnto");
    customUriClass.setAbstract(false);
    customUriClass.finishEditing();

Analogous to the Java perspective, data objects in ProCAKE represent the concrete data. In addition, each data object has its own data class implementation in ProCAKE that is implemented itself as a Java class. By this means, we explicitly model the relationship between data objects and the respective system and user classes.

NEST Graph Data Classes #

The following figure depicts specific data classes for representing arbitrary graphs as well as for representing processes or workflows as graphs:

Data-Class-Hierarchy-2

Object-Oriented Workflow Data Classes #

The following figure depicts specific data classes for representing processes or workflows in an object-oriented fashion:

Data-Class-Hierarchy-3

Properties #

In ProCAKE it’s possible to add properties to data classes. These properties store information about the object, which are additionally to the main value of a data object. ProCAKE knows several predefined properties, but user-defined ones are also possible.

A property is a key-value pair, whereby the key as well as the value must be a string. This restriction is necessary to be able to embed the properties into XML. If another data type has to be handled an encoding to and from string must be realized. It’s also possible to create a property, which extends further more properties.

For example, a property for an atomic class can be created as follows:

model.xml

    <StringClass name="customStringClass">
        <Property name="testProperty">
            <Property name="valueOne">1</Property>
            <Property name="valueTwo" value="2"/>
        </Property>
    </StringClass>
Here, a property TestProperty is added, which contains two more properties: The property valueOne contains the value 1, the property valueTwo contains the value 2. It’s possible, to set a value using the parameter value. Otherwise, the value can be written in the inner tags. It’s not possible to set both values. In this case, an exception will be thrown.

If a property contains other properties, a value for this property can only be given by using the value parameter. Other inputs will be ignored.

To create this property during runtime, the following code would be used:

Wiki_DataClassesTest.java

    StringClass stringClass = ModelFactory.getDefaultModel().getClass(StringClass.CLASS_NAME);
    StringClass customStringClass = (StringClass) stringClass.createSubclass("customStringClass");

    customStringClass.addProperty("testProperty", null);
    customStringClass.addProperty("valueOne", "1");
    customStringClass.addProperty("valueTwo", "2");

    customStringClass.finishEditing();

To get the value of a property afterwards, the command getProperty(String propertyName) can be used. The value of the property can be changed by removing and then adding it again. This can look like:

Wiki_DataClassesTest.java

    customStringClass.removeProperty("valueOne");
    customStringClass.addProperty("valueOne", "5");

There is also the possibility to set properties for aggregate classes. This is described here.