
How the type system in Dipforge works
Dipforge types are define using RDF (Resource Description Framework), this is an open standard maintained by W3C (World Wide Web Consortium). Types in RDF are defined using an Ontology, this enables you to infer a structure on the data stored in an RDF store. Ontology definitions are hard to work with as they are aimed at computer systems and not humans. To simplify the process of creating types Dipforge provides a simple XML format that when published generates the more complex Ontology definitions.
Types for a project are maintained through the project_types.xml file found in the config directory of the project. Types are not restricted to a single project, and the RAD environment enables developers to instantiate and query any types defined and published, this means Dipforge provides a define once use anywhere methodology. Dipforge will auto generate Groovy objects based on the Ontology definition, as a result it is very simple to work with the defined types, no stub code, no extra compile phases, simply define and use.

project_types.xml
<types project="project_name"> <type name="Example" namespace="http://example.net/Example"> <property name="id" datatype="http://www.w3.org/2001/XMLSchema#string"/> <property name="value" datatype="http://www.w3.org/2001/XMLSchema#string"/> </type> <type name="Example2" namespace="http://example.net/Example2"> <property name="id" datatype="http://www.w3.org/2001/XMLSchema#string"/> <property name="value" datatype="http://www.w3.org/2001/XMLSchema#string"/> <link name="example" datatype="http://example.net/Example#Example"/> </type> </types>
The elements of the project_types.xml file are as follows:
- types: This denotes the grouping of types within a project and per file there can only be one grouping.
- type: This brackets the definition of a single type and it includes the following information within the element:
name: The name of the type being defined.
namespace: The namespace that the type will be found in. Same as a package in java. - property: A property defines an element of a type. A property is part of a type and when its value is changed the type instance will be changed. A property consists of the following parts:
name: The name of property, per type there can be only one entry with a given name.
datatype: The data type that will be used for this property. This can either be a basic type defined using the standard XML types or a reference to another type. - link: A link to another type. If the value of the referenced type is changed it will not affect the referrer. As with a property a link consists of the following:
name: The name of the link within the type.
datatype: The type of object that is being referenced.
ID
All data type definition must have an ID property, it must be unique and consist of Alphanumeric characters. If an id needs to be generated and cannot be assigned the RandomGuid.getInstance().getGuid() utility can be used alternatively a standard Java GUID should be sufficient.
Supported Datatypes
Dipforge supports the following basic types:
- http://www.w3.org/2001/XMLSchema#string
- http://www.w3.org/2001/XMLSchema#boolean
- http://www.w3.org/2001/XMLSchema#float
- http://www.w3.org/2001/XMLSchema#double
- http://www.w3.org/2001/XMLSchema#decimal
- http://www.w3.org/2001/XMLSchema#integer
- http://www.w3.org/2001/XMLSchema#long
- http://www.w3.org/2001/XMLSchema#int
- http://www.w3.org/2001/XMLSchema#short
- http://www.w3.org/2001/XMLSchema#byte
- http://www.w3.org/2001/XMLSchema#date
- http://www.w3.org/2001/XMLSchema#datatype

Groovy Mapping
The Enterprise RAD(Rapid Application Development) environment in Dipforge automatically creates the appropriate mappings for the defined type. This means it will create an object that has all the necessary getters and setters required to manage the data defined by the RDF object. This definition is extracted from the published Ontology, and any updates to the Ontology will be reflected in seconds.
Example:
// setup the rdf type def message = RDF.create("http://example.net/Example#Example") message.setId("id") message.setValue("value")
Groovy Mapping Rules
- First letter of the name will be capitalized
- A setter will be produced, example: setName
- A getter will be produced, example: getName