#* ## ???? Add standard header ## ## UML/SysML to OWL schema generator ## ## ## ## ## ???? generate one schema file per package, to properly support viewpoints ## $file.silentCreate(template, outputFileName, importObject) ## *# ## XML shortcuts ]> ## http://projects.baesystems.com/META/ontology/2011/6/meta #foreach ($class in $Block) $class.name #set($baseClassifier = $class.baseClassifier) #set($size = $baseClassifier.size()) #if($baseClassifier.size() > 0) #foreach($super in $sorter.humanSort($baseClassifier)) #end #end## has supertypes #foreach ($attr in $class.attribute) #if($attr.association) #set($association = $attribute.association) #foreach($member in $attr.association.memberEnd) ## #end ## ## generate default role names - myClassName ## #set($roleName = $attr.name) #if ($attr.name == "") #set($roleName = "my" + ${attr.type.name}) #end ## ## 0..1 0..* 1 1..* #if($attr.multiplicity == "0..1") 0 ##???? 1 #elseif ($attr.multiplicity == "0..*" || $attr.multiplicity == "") 0 #elseif ($attr.multiplicity == "1") 1 #elseif ($attr.multiplicity == "1..*") 1 #end #end## if attr association #end## foreach class attributes ## factor out ports - only want descriptive properties in the schema #foreach ($attr in $class.attribute) #if(!$attr.association && ($attr.elementType == "property" || $attr.elementType == "attribute" || $attr.elementType == "valueproperty")) #end #end##attributes #foreach ($attr in $class.attribute) #if($attr.association) #set($association = $attribute.association) #foreach($member in $attr.association.memberEnd) ## #end ## ## generate default role names - myClassName ## #set($roleName = $attr.name) #if ($attr.name == "") #set($roleName = "my" + ${attr.type.name}) #end #end #end## end Block #end ## generates the base OWL data type for the model type ## ???? enumerations, base data types, filter out Classes ## ???? May need Java support to support hash lookup to map ## SysML unit extensions to OWL data types #macro (gen_type $type) #set ($typeMap = $map.createHashMap()) #set ($tmp = $typeMap.put("Integer", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("integer", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("long", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("short", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("void", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("int", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("byte", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("char", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("Number", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("Complex", "http://www.w3.org/2001/XMLSchema#string")) #set ($tmp = $typeMap.put("String", "http://www.w3.org/2001/XMLSchema#string")) #set ($tmp = $typeMap.put("date", "http://www.w3.org/2001/XMLSchema#string")) #set ($tmp = $typeMap.put("Quantity", "http://www.w3.org/2001/XMLSchema#doube")) #set ($tmp = $typeMap.put("Rational", "http://www.w3.org/2001/XMLSchema#double")) #set ($tmp = $typeMap.put("Boolean", "http://www.w3.org/2001/XMLSchema#boolean")) #set ($tmp = $typeMap.put("boolean", "http://www.w3.org/2001/XMLSchema#boolean")) #set ($tmp = $typeMap.put("Real", "http://www.w3.org/2001/XMLSchema#double")) #set ($tmp = $typeMap.put("double", "http://www.w3.org/2001/XMLSchema#double")) #set ($tmp = $typeMap.put("float", "http://www.w3.org/2001/XMLSchema#double")) #set ($tmp = $typeMap.put("UnlimitedNatural", "http://www.w3.org/2001/XMLSchema#integer")) #set ($tmp = $typeMap.put("", "http://www.w3.org/2001/XMLSchema#string")) ## Assume any type with a QuantityKind is a double #if ($type.quantityKind) #set ($otype = "http://www.w3.org/2001/XMLSchema#double") #else #if ($typeMap.containsKey($type.name)) #set ($otype = $typeMap.get($type.name)) #elseif ($type) #set ($otype = $type.name) debug2 <$otype> #else #set ($otype = "http://www.w3.org/2001/XMLSchema#string") #end #end $otype#end ##