Skip to content
Snippets Groups Projects
Commit 61a83b24 authored by Erlend Stav's avatar Erlend Stav
Browse files

Updated transformation to use Int, Float, Double, and Long restrictions...

Updated transformation to use Int, Float, Double, and Long restrictions instead of old BundingValueRestriction
parent 8b10dcdc
No related branches found
No related tags found
No related merge requests found
......@@ -210,7 +210,10 @@ public class Activator implements BundleActivator {
}
uml.Package::generatMainOntologyClassStaticImports() {
'import org.universAAL.middleware.owl.BoundingValueRestriction;
'import org.universAAL.middleware.owl.IntRestriction;
import org.universAAL.middleware.owl.FloatRestriction;
import org.universAAL.middleware.owl.DoubleRestriction;
import org.universAAL.middleware.owl.LongRestriction;
import org.universAAL.middleware.owl.DataRepOntology;
import org.universAAL.middleware.owl.ManagedIndividual;
import org.universAAL.middleware.owl.MergedRestriction;
......@@ -410,11 +413,15 @@ public final class ' ontologyName.firstToUpper() 'Ontology extends Ontology {
else if (!prop.type.name.trim().equals("") ) { //this is a datatype property that has been set.
' ' oci '.addRestriction(MergedRestriction\n'
' .getAllValuesRestrictionWithCardinality(' c.name '.PROP_' prop.toUpperFormat() ', \n'
' 'self.getURIExpressionForType(prop.type.name.trim())', ' prop.lower ', ' prop.upper ')'
if (prop.defaultValue.name.equals("values")) { //TODO: this is a temporary solution. See doc for more info
if (prop.defaultValue.name.equals("values")) {
' ' prop.getBoundingRestriction(c.name) ', ' prop.lower ', ' prop.upper ')'
} else {
' 'self.getURIExpressionForType(prop.type.name.trim())', ' prop.lower ', ' prop.upper ')'
}
/* if (prop.defaultValue.name.equals("values")) { //TODO: this is a temporary solution. See doc for more info
//TODO: must check for property type. Now supporting Integer only
'\n ' prop.getBoundingRestriction(c.name)
}
}*/
');\n'
' \n'
} //else if
......@@ -598,16 +605,29 @@ public class ' ontologyName.firstToUpper() 'Factory extends ResourceFactoryImpl
var txt:String
var res:String
var typeName:String
//get the default value string specification. This string holds the range - min, max.
//TODO: add support for more ranges and sets.
txt = self.defaultValue.value.trim()
res = ""
typeName = self.type.name
if (typeName.equals("UnlimitedNatural")) {
typeName = "Long"
}
//currently only integer is supported
if (self.type.name.equals("Integer")) {
res = ".addRestriction(new BoundingValueRestriction(" + className + ".PROP_" + self.toUpperFormat()
res = res + ", new Integer(" + txt.substringBefore("..") + "), true, new Integer(" + txt.substringAfter("..")+ "), true))"
res = "new IntRestriction(new Integer(" + txt.substringBefore("..") + "), true, new Integer(" + txt.substringAfter("..")+ "), true)"
// res = ".addRestriction(new BoundingValueRestriction(" + className + ".PROP_" + self.toUpperFormat()
// res = res + ", new Integer(" + txt.substringBefore("..") + "), true, new Integer(" + txt.substringAfter("..")+ "), true))"
}
else if (typeName.equals("Float") || typeName.equals("Double") || typeName.equals("Long")) {
res = "new " + typeName + "Restriction(new " + typeName + "(" + txt.substringBefore("..") + "), true, new " + typeName + "(" + txt.substringAfter("..")+ "), true)"
}
return res //empty or a boundingrestriction.
......
......@@ -12,7 +12,7 @@ texttransformation OntologyUML2Java_1_2_0 (in uml:"http://www.eclipse.org/uml2/3
uml.Package::processOntologyPackage() {
super.processOntologyPackage()
}
/*
uml.Package::generatMainOntologyClassStaticImports() {
'import org.universAAL.middleware.owl.BoundedValueRestriction;
import org.universAAL.middleware.owl.DataRepOntology;
......@@ -26,7 +26,7 @@ import org.universAAL.middleware.service.owl.ServiceBusOntology;
import org.universAAL.ontology.location.LocationOntology;
'
}
*/
uml.Model::generateActivator(ontNameList:Hashtable) {
StdOut.println("Generating activator for MW 1.2.0")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment