Entity: NamedElement 103 30 null * abstract name String 3 false false false Entity: Relationship 549 34 NamedElement * abstract Entity: Feature 6 125 NamedElement * abstract Entity: Type 261 133 NamedElement * abstract typeId String 3 false true false Operation: defaultInitialValue Type String query abstract true true Operation: isPrimitiveType Type boolean s String query static true ( s = "double" => result = true ) & ( s = "long" => result = true ) & ( s = "String" => result = true ) & ( s = "boolean" => result = true ) & ( s = "int" => result = true ) Type: UMLKind 789 846 value attribute role variable constant function queryop operation classid Entity: Association 603 345 Relationship * addOnly boolean 3 false false false aggregation boolean 3 false false false Entity: Generalization 509 248 Relationship * Entity: Classifier 28 258 Type * abstract Entity: DataType 15 346 Classifier * abstract Entity: PrimitiveType 5 422 DataType * Operation: defaultInitialValue PrimitiveType String query true ( name = "double" => result = "0.0" ) & ( name = "String" => result = "\"\"" ) & ( name = "boolean" => result = "False" ) & ( true => result = "0" ) Operation: toPython PrimitiveType String query true ( name = "double" => result = "float" ) & ( name = "long" => result = "int" ) & ( name = "String" => result = "str" ) & ( name = "boolean" => result = "bool" ) & ( true => result = name ) Entity: Entity 138 314 Classifier * isAbstract boolean 3 false false false isInterface boolean 3 false false false Operation: allLeafSubclasses Entity Set(Entity) query true ( specialization.size = 0 => result = Set{self} ) & ( specialization.size > 0 => result = specialization->unionAll(specific.allLeafSubclasses()) ) Operation: allProperties Entity Set(Property) query true ( generalization.size = 0 => result = ownedAttribute ) & ( generalization.size > 0 => result = ownedAttribute->union(generalization.general.allProperties()) ) Operation: allOperations Entity Set(Operation) query true oonames = self.ownedOperation.name & ( ( generalization.size = 0 => result = self.ownedOperation ) & ( generalization.size > 0 => result = self.ownedOperation->union(generalization.general.allOperations()->select( op | op.name /: oonames )) ) ) Operation: isSingleValued Entity boolean d String query true allProperties()->exists( p | p.name = d & p.lower = 1 & p.upper = 1 ) => result = true Operation: isSetValued Entity boolean d String query true allProperties()->exists( p | p.name = d & ( p.lower /= 1 or p.upper /= 1 ) & p.isOrdered = false ) => result = true Operation: isSequenceValued Entity boolean d String query true allProperties()->exists( p | p.name = d & ( p.lower /= 1 or p.upper /= 1 ) & p.isOrdered = true ) => result = true Operation: defaultInitialValue Entity String query true result = "None" Operation: initialisations Entity String query true result = allProperties()->select( a | a.isStatic = false )->collect( x | x.initialisation() )->sum() Operation: generalisationString Entity String query true ( generalization.size = 0 => result = "" ) & ( generalization.size > 0 => result = "(" + generalization.any.general.name + ")" ) Operation: classHeader Entity String query true result = "class " + name + ":" Operation: allStaticCaches Entity String query true result = ownedOperation->select( x | x.isStatic & x.isCached & x.parameters.size = 1 )->collect( y | " " + y.name + "_cache = dict({})" + "\n" )->sum() Operation: allInstanceCaches Entity String query true result = ownedOperation->select( x | x.isStatic = false & x.isCached & x.parameters.size = 1 )->collect( y | " self." + y.name + "_cache = dict({})" + "\n" )->sum() Operation: staticAttributes Entity String query true result = " " + name.toLowerCase() + "_instances = []\n" + " " + name.toLowerCase() + "_index = dict({})\n" + allProperties()->select( x | x.isStatic )->collect( y | " " + y.name + " = " + y.type.defaultInitialValue() + "\n" )->sum() + allStaticCaches() Operation: classConstructor Entity String query true result = " def __init__(self):\n" + initialisations() + " " + name + "." + name.toLowerCase() + "_instances.append(self)\n" + allInstanceCaches() + "\n" Operation: abstractClassConstructor Entity String query true result = " def __init__(self):\n" + " " + name + "." + name.toLowerCase() + "_instances.append(self)\n" Operation: createOp Entity String query true result = "def create" + name + "():\n" + " " + name.toLowerCase() + " = " + name + "()\n" + " return " + name.toLowerCase() + "\n" Operation: createPKOp Entity String key String query true result = "def createByPK" + name + "(_value):\n" + " result = get" + name + "ByPK(_value)\n" + " if (result != None) : \n" + " return result\n" + " else :\n" + " result = " + name + "()\n" + " result." + key + " = _value\n" + " " + name + "." + name.toLowerCase() + "_index[_value] = result\n" + " return result\n" Operation: deleteOp Entity String query static true result = "def free(x):\n" + " del x\n\n" Operation: instancesOps Entity String leafs Set(Entity) query static true ( leafs.size = 1 => result = "allInstances_" + leafs.first.name + "()" ) & ( leafs.size > 1 => result = "ocl.union(allInstances_" + leafs.first.name + "(), " + Entity.instancesOps(leafs.tail) + ")" ) Operation: allInstancesOp Entity String query true ( specialization.size = 0 => result = "def allInstances_" + name + "():\n" + " return " + name + "." + name.toLowerCase() + "_instances\n" ) & ( specialization.size > 0 => result = "def allInstances_" + name + "():\n" + " return " + Entity.instancesOps(allLeafSubclasses()) ) Operation: displayOps Entity String query static true result = "def displayint(x):\n" + " print(str(x))\n\n" + "def displaylong(x):\n" + " print(str(x))\n\n" + "def displaydouble(x):\n" + " print(str(x))\n\n" + "def displayboolean(x):\n" + " print(str(x))\n\n" + "def displayString(x):\n" + " print(x)\n\n" Entity: CollectionType 139 397 DataType * Operation: defaultInitialValue CollectionType String query true ( name = "Sequence" => result = "[]" ) & ( name = "Set" => result = "set({})" ) & ( name = "Map" => result = "dict({})" ) Entity: Expression 268 -110 null * abstract needsBracket boolean 3 false false false umlKind UMLKind 3 false false false expId String 3 false true false isStatic boolean 3 false false false Operation: tolist Expression String s Sequence(String) query static true ( s.size = 0 => result = "" ) & ( s.size = 1 => result = s->first() ) & ( s.size > 1 => result = s->first() + "," + Expression.tolist(s->tail()) ) Operation: maptolist Expression String s Sequence(String) query static true ( s.size = 0 => result = "" ) & ( s.size = 1 => result = s->first() ) & ( s.size > 1 => result = s->first() + "," + Expression.maptolist(s->tail()) ) Operation: indexstring Expression String ax Set(Expression) aind Set(String) query static true ( aind.size > 0 & ax.any.type.name = "String" => result = "[" + aind->any() + "]" ) & ( aind.size > 0 & ax.any.type.name /= "String" => result = "[" + aind->any() + " -1]" ) & ( aind.size = 0 => result = "" ) Operation: parstring Expression String pars Sequence(String) query static true ( pars.size = 1 => result = "(" + pars->first() + ")" ) & ( pars.size > 1 => result = "(" + pars->first() + pars->tail()->collect( p | ", " + p )->sum() + ")" ) & ( pars.size = 0 => result = "()" ) Operation: leftBracket Expression String tn String query static true ( tn = "Set" => result = "set({" ) & ( tn = "Sequence" => result = "[" ) & (tn = "Map" => result = "dict({") Operation: rightBracket Expression String tn String query static true ( tn = "Set" => result = "})" ) & ( tn = "Sequence" => result = "]" ) & (tn = "Map" => result = "})") Operation: addReference Expression Expression x BasicExpression abstract true true Operation: isMathFunction Expression boolean fname String query static true ( fname = "sqrt" or fname = "exp" or fname = "log" or fname = "sin" or fname = "cos" or fname = "tan" or fname = "pow" or fname = "log10" or fname = "cbrt" or fname = "tanh" or fname = "cosh" or fname = "sinh" or fname = "asin" or fname = "acos" or fname = "atan" or fname = "ceil" or fname = "round" or fname = "floor" or fname = "abs" => result = true ) Operation: isComparitor Expression boolean fname String query static true ( fname = "=" or fname = "/=" or fname = "<" or fname = ">" or fname = "<=" or fname = ">=" => result = true ) Operation: isInclusion Expression boolean fname String query static true ( fname = ":" or fname = "->includes" or fname = "<:" or fname = "->includesAll" => result = true ) Operation: isExclusion Expression boolean fname String query static true ( fname = "/:" or fname = "/<:" or fname = "->excludes" or fname = "->excludesAll" => result = true ) Operation: isBooleanOp Expression boolean fname String query static true ( fname = "&" or fname = "or" or fname = "=>" or fname = "->exists" or fname = "->forAll" or fname = "->exists1" => result = true ) Operation: isStringOp Expression boolean fname String query static true ( fname = "->indexOf" or fname = "->count" or fname = "->hasPrefix" or fname = "->hasSuffix" => result = true ) Operation: isUnaryStringOp Expression boolean fname String query static true ( fname = "->size" or fname = "->first" or fname = "->last" or fname = "->front" or fname = "->tail" or fname = "->reverse" or fname = "->display" or fname = "->toUpperCase" or fname = "->toLowerCase" or fname = "->toInteger" or fname = "->toReal" or fname = "->toLong" or fname = "->isInteger" or fname = "->isReal" or fname = "->isLong" => result = true ) Operation: isCollectionOp Expression boolean fname String query static true ( fname = "->including" or fname = "->excluding" or fname = "->append" or fname = "->prepend" or fname = "->count" or fname = "->indexOf" or fname = "->union" or fname = "->intersection" or fname = "^" or fname = "->isUnique" or fname = "->at" ) => result = true Operation: isDistributedIteratorOp Expression boolean fname String query static true ( fname = "->sortedBy" or fname = "->unionAll" or fname = "->concatenateAll" or fname = "->intersectAll" or fname = "->selectMinimals" or fname = "->selectMaximals" => result = true ) Operation: isCollection Expression boolean query true ( type.name = "Set" or type.name = "Sequence" => result = true ) Operation: isMap Expression boolean query true ( type.name = "Map" => result = true ) Operation: isNumeric Expression boolean query true ( type.name = "int" or type.name = "long" or type.name = "double" => result = true ) Operation: isString Expression boolean query true ( type.name = "String" => result = true ) Operation: isUnaryCollectionOp Expression boolean fname String query static true ( fname = "->size" or fname = "->any" or fname = "->reverse" or fname = "->front" or fname = "->tail" or fname = "->first" or fname = "->last" or fname = "->sort" or fname = "->asSet" or fname = "->asSequence" ) => result = true Operation: isIteratorOp Expression boolean fname String query static true ( fname = "->collect" or fname = "->select" or fname = "->reject" ) => result = true Operation: isReduceOp Expression boolean fname String query static true ( fname = "->min" or fname = "->max" or fname = "->sum" or fname = "->prd" ) => result = true Operation: toPython Expression String query abstract true true Entity: BinaryExpression 57 10 Expression * operator String 3 false false false variable String 3 false false false Operation: mapNumericExpression BinaryExpression String ls String rs String query true ( operator = "/" & type.name = "int" => result = ls + "//" + rs ) & ( operator = "/" & type.name = "long" => result = ls + "//" + rs ) & ( operator = "mod" => result = ls + " % " + rs ) & ( operator = "=" => result = ls + " == " + rs ) & ( operator = "/=" => result = ls + " != " + rs ) & ( operator = "->pow" => result = "math.pow(" + ls + ", " + rs + ")" ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapComparitorExpression BinaryExpression String ls String rs String query true ( operator = "=" => result = ls + " == " + rs ) & ( operator = "/=" => result = ls + " != " + rs ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapStringExpression BinaryExpression String ls String rs String query true ( operator = "=" => result = ls + " == " + rs ) & ( operator = "/=" => result = ls + " != " + rs ) & ( operator = ":" => result = ls + " in " + rs ) & ( operator = "/:" => result = ls + " not in " + rs ) & ( operator = "->includes" => result = rs + " in " + ls ) & ( operator = "->excludes" => result = rs + " not in " + ls ) & ( operator = "-" => result = "ocl.subtractString(" + ls + ", " + rs + ")" ) & ( operator = "->hasPrefix" => result = ls + ".startswith(" + rs + ")" ) & ( operator = "->hasSuffix" => result = ls + ".endswith(" + rs + ")" ) & ( operator = "->indexOf" => result = "(" + ls + ".find(" + rs + ") + 1)" ) & ( operator = "->count" => result = ls + ".count(" + rs + ")" ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapStringPlus BinaryExpression String ls String rs String query true ( left.isString() => result = ls + " + str(" + rs + ")" ) & ( right.isString() => result = "str(" + ls + ") + " + rs ) Operation: mapBooleanExpression BinaryExpression String ls String rs String query true ( operator = "&" => result = ls + " and " + rs ) & ( operator = "=>" => result = "((" + rs + ") if (" + ls + ") else (True))" ) & ( operator = "or" => result = ls + " or " + rs ) & ( operator = "->exists" => result = "ocl.exists(" + ls + ", lambda " + variable + " : " + rs + ")" ) & ( operator = "->forAll" => result = "ocl.forAll(" + ls + ", lambda " + variable + " : " + rs + ")" ) & ( operator = "->exists1" => result = "ocl.exists1(" + ls + ", lambda " + variable + " : " + rs + ")" ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapBinaryCollectionExpression BinaryExpression String ls String rs String lt String rt String query true ( operator = ":" => result = ls + " in " + rs ) & ( operator = "->includes" => result = rs + " in " + ls ) & ( operator = "=" => result = ls + " == " + rs ) & ( operator = "/=" => result = ls + " != " + rs ) & ( operator = "/:" => result = ls + " not in " + rs ) & ( operator = "->excludes" => result = rs + " not in " + ls ) & ( operator = "<:" => result = "ocl.includesAll(" + rs + ", " + ls + ")" ) & ( operator = "/<:" => result = "(not ocl.includesAll(" + rs + ", " + ls + "))" ) & ( operator = "->includesAll" => result = "ocl.includesAll(" + ls + ", " + rs + ")" ) & ( operator = "->excludesAll" => result = "ocl.excludesAll(" + rs + ", " + ls + ")" ) & ( operator = "->including" => result = "ocl.including" + lt + "(" + ls + ", " + rs + ")" ) & ( operator = "->excluding" => result = "ocl.excluding" + lt + "(" + ls + ", " + rs + ")" ) & ( operator = "->union" => result = "ocl.union" + lt + "(" + ls + ", " + rs + ")" ) & ( operator = "->intersection" => result = "ocl.intersection" + lt + "(" + ls + ", " + rs + ")" ) & ( operator = "^" => result = "ocl.concatenate(" + ls + ", " + rs + ")" ) & ( operator = "->prepend" => result = "ocl.prepend(" + ls + ", " + rs + ")" ) & ( operator = "->append" => result = "ocl.append(" + ls + ", " + rs + ")" ) & ( operator = "-" => result = "ocl.excludeAll" + lt + "(" + ls + ", " + rs + ")" ) & ( operator = "->indexOf" => result = "((" + ls + ").index(" + rs + ") + 1)" ) & ( operator = "->count" => result = "(" + ls + ").count(" + rs + ")" ) & ( operator = "->at" & right.type.name = "String" => result = "(" + ls + ")[" + rs + "]" ) & ( operator = "->at" & right.type.name /= "String" => result = "(" + ls + ")[" + rs + " - 1]" ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapBinaryMapExpression BinaryExpression String ls String rs String query true ( operator = ":" => result = "ocl.includesMap(" + rs + ", " + rs + ")" ) & ( operator = "->includes" => result = "ocl.includesMap(" + rs + ", " + ls + ")") & ( operator = "=" => result = ls + " == " + rs ) & ( operator = "/=" => result = ls + " != " + rs ) & ( operator = "/:" => result = "(not ocl.includesMap(" + rs + ", " + ls + "))" ) & ( operator = "->excludes" => result = "(not ocl.includesMap(" + ls + ", " + rs + "))") & ( operator = "<:" => result = "ocl.includesAllMap(" + rs + ", " + ls + ")" ) & ( operator = "/<:" => result = "(not ocl.includesAllMap(" + rs + ", " + ls + "))" ) & ( operator = "->includesAll" => result = "ocl.includesAllMap(" + ls + ", " + rs + ")" ) & ( operator = "->excludesAll" => result = "ocl.excludesAllMap(" + ls + ", " + rs + ")" ) & ( operator = "->including" => result = "ocl.includingMap(" + ls + ", " + rs + ", " + variable + ")" ) & ( operator = "->excluding" => result = "ocl.excludingMapValue(" + ls + ", " + rs + ")" ) & ( operator = "->union" => result = "ocl.unionMap(" + ls + ", " + rs + ")" ) & ( operator = "->intersection" => result = "ocl.intersectionMap(" + ls + ", " + rs + ")" ) & ( operator = "-" => result = "ocl.excludeAllMap(" + ls + ", " + rs + ")" ) & ( operator = "->at" => result = "(" + ls + ")[" + rs + "]" ) & ( true => result = ls + " " + operator + " " + rs ) Operation: mapDistributedIteratorExpression BinaryExpression String ls String rs String rexp Expression query true ( operator = "->sortedBy" => result = "sorted(" + ls + ", key = lambda " + expId + " : " + rexp.toPython() + ")" ) & ( operator = "->concatenateAll" => result = "ocl.concatenateAll([" + rexp.toPython() + " for " + expId + " in " + ls + "])" ) & ( operator = "->unionAll" & type.name = "Sequence" => result = "ocl.concatenateAll([" + rexp.toPython() + " for " + expId + " in " + ls + "])" ) & ( operator = "->unionAll" & type.name = "Set" => result = "ocl.unionAll([" + rexp.toPython() + " for " + expId + " in " + ls + "])" ) & ( operator = "->intersectAll" => result = "ocl.intersectAll" + type.name + "([" + rexp.toPython() + " for " + expId + " in " + ls + "])" ) & ( operator = "->selectMaximals" => result = "ocl.selectMaximals" + left.type.name + "(" + ls + ", lambda " + expId + " : " + rexp.toPython() + ")" ) & ( operator = "->selectMinimals" => result = "ocl.selectMinimals" + left.type.name + "(" + ls + ", lambda " + expId + " : " + rexp.toPython() + ")" ) Operation: mapMapIteratorExpression BinaryExpression String ls String rs String query true ( operator = "->select" => result = "ocl.selectMap(" + ls + ", lambda " + variable + " : " + rs + ")" ) & ( operator = "->reject" => result = "ocl.rejectMap(" + ls + ", lambda " + variable + " : " + rs + ")" ) & ( operator = "->collect" => result = "ocl.collectMap(" + ls + ", lambda " + variable + " : " + rs + ")" ) Operation: mapIteratorExpression BinaryExpression String ls String rs String tn String query true lbracket = Expression.leftBracket(tn) & rbracket = Expression.rightBracket(tn) & (tn = "Map" => result = mapMapIteratorExpression(ls,rs)) & ( operator = "->select" => result = lbracket + variable + " for " + variable + " in " + ls + " if " + rs + rbracket ) & ( operator = "->reject" => result = lbracket + variable + " for " + variable + " in " + ls + " if not " + rs + rbracket ) & ( operator = "->collect" => result = lbracket + rs + " for " + variable + " in " + ls + rbracket ) Operation: mapBinaryExpression BinaryExpression String ls String rs String query true ( operator = "->oclAsType" & Type.isPrimitiveType(rs) => result = type.toPython() + "(" + ls + ")" ) & ( operator = "->oclAsType" & not(Type.isPrimitiveType(rs)) => result = ls ) & ( Expression.isComparitor(operator) => result = mapComparitorExpression(ls,rs) ) & ( Expression.isDistributedIteratorOp(operator) => BasicExpression->exists( be | be.data = expId & be.expId = expId + "_variable" & result = mapDistributedIteratorExpression(ls,rs,right.addReference(be)) ) ) & ( ( left.isNumeric() & right.isNumeric() ) => result = mapNumericExpression(ls,rs) ) & ( ( left.isString() & right.isString() ) => result = mapStringExpression(ls,rs) ) & ( Expression.isIteratorOp(operator) => result = mapIteratorExpression(ls,rs,type.name) ) & ( Expression.isBooleanOp(operator) => result = mapBooleanExpression(ls,rs) ) & ( operator = "+" & ( left.isString() or right.isString() ) => result = mapStringPlus(ls,rs) ) & ( ( left.isCollection() or right.isCollection() ) => result = mapBinaryCollectionExpression(ls,rs,left.type.name,right.type.name) ) & ( ( left.isMap() or right.isMap() ) => result = mapBinaryMapExpression(ls,rs) ) & ( true => result = ls + " " + operator + " " + rs ) Operation: toPython BinaryExpression String query true ( needsBracket = true => result = "(" + mapBinaryExpression(left.toPython(),right.toPython()) + ")" ) & (needsBracket = false => result = mapBinaryExpression(left.toPython(),right.toPython())) Operation: addReference BinaryExpression Expression x BasicExpression x.data /= self.variable BinaryExpression->exists( e | e.expId = expId + "_" + x.data & e.operator = operator & e.variable = variable & e.umlKind = umlKind & e.left = left.addReference(x) & e.right = right.addReference(x) & result = e ) Entity: UnaryExpression 654 -38 Expression * operator String 3 false false false Operation: mapNumericExpression UnaryExpression String arg String query true ( operator = "->sqrt" => result = "math.sqrt(" + arg + ")" ) & ( operator = "->sin" => result = "math.sin(" + arg + ")" ) & ( operator = "->tan" => result = "math.tan(" + arg + ")" ) & ( operator = "->cos" => result = "math.cosin(" + arg + ")" ) & ( operator = "->sqr" => result = "ocl.sqr(" + arg + ")" ) & ( operator = "->floor" => result = "int(math.floor(" + arg + "))" ) & ( operator = "->ceil" => result = "int(math.ceil(" + arg + "))" ) & ( operator = "->round" => result = "round(" + arg + ")" ) & ( operator = "->cbrt" => result = "ocl.cbrt(" + arg + ")" ) & ( operator = "->display" => result = "print(str(" + arg + "))" ) & ( operator = "->abs" => result = "math.fabs(" + arg + ")" ) & ( operator = "->exp" => result = "math.exp(" + arg + ")" ) & ( operator = "->log" => result = "math.log(" + arg + ")" ) & ( operator = "->log10" => result = "math.log10(" + arg + ")" ) & ( operator = "->asin" => result = "math.asin(" + arg + ")" ) & ( operator = "->acos" => result = "math.acos(" + arg + ")" ) & ( operator = "->atan" => result = "math.atan(" + arg + ")" ) & ( operator = "->sinh" => result = "math.sinh(" + arg + ")" ) & ( operator = "->cosh" => result = "math.cosh(" + arg + ")" ) & ( operator = "->tanh" => result = "math.tanh(" + arg + ")" ) Operation: mapStringExpression UnaryExpression String arg String query true ( operator = "->size" => result = "len(" + arg + ")" ) & ( operator = "->front" => result = "(" + arg + ")[0:-1]" ) & ( operator = "->tail" => result = "(" + arg + ")[1:]" ) & ( operator = "->first" => result = "(" + arg + ")[0:1]" ) & ( operator = "->last" => result = "(" + arg + ")[-1:]" ) & ( operator = "->toLowerCase" => result = "ocl.toLowerCase(" + arg + ")" ) & ( operator = "->toUpperCase" => result = "ocl.toUpperCase(" + arg + ")" ) & ( operator = "->characters" => result = "ocl.characters(" + arg + ")" ) & ( operator = "->reverse" => result = "ocl.reverseString(" + arg + ")" ) & ( operator = "->display" => result = "print(" + arg + ")" ) & ( operator = "->isInteger" => result = "isdigit(" + arg + ")" ) & ( operator = "->isLong" => result = "isdigit(" + arg + ")" ) & ( operator = "->isReal" => result = "isdecimal(" + arg + ")" ) & ( operator = "->toInteger" => result = "int(" + arg + ")" ) & ( operator = "->toLong" => result = "int(" + arg + ")" ) & ( operator = "->toReal" => result = "float(" + arg + ")" ) Operation: mapReduceExpression UnaryExpression String arg String tn String query true ( operator = "->sum" => result = "ocl.sum(" + arg + ")" ) & ( operator = "->prd" => result = "ocl.prd(" + arg + ")" ) & ( operator = "->max" => result = "ocl.max" + tn + "(" + arg + ")" ) & ( operator = "->min" => result = "ocl.min" + tn + "(" + arg + ")" ) Operation: mapUnaryCollectionExpression UnaryExpression String arg String tn String query true ( operator = "->size" => result = "len(" + arg + ")" ) & ( operator = "->isEmpty" => result = "(len(" + arg + ") == 0)" ) & ( operator = "->notEmpty" => result = "(len(" + arg + ") > 0)" ) & ( operator = "->asSet" => result = "set(" + arg + ")" ) & ( operator = "->asSequence" => result = "list(" + arg + ")" ) & ( operator = "->isUnique" => result = "ocl.isUnique(" + arg + ")" ) & ( operator = "->isDeleted" => result = "(del " + arg + ")") & ( operator = "->any" => result = "ocl.any(" + arg + ")" ) & ( operator = "->reverse" => result = "ocl.reverse" + tn + "(" + arg + ")" ) & ( operator = "->front" => result = "(" + arg + ")[0:-1]" ) & ( operator = "->tail" => result = "(" + arg + ")[1:]" ) & ( operator = "->first" => result = "(" + arg + ")[0]" ) & ( operator = "->last" => result = "(" + arg + ")[-1]" ) & ( operator = "->sort" => result = "ocl.sort" + tn + "(" + arg + ")" ) Operation: mapUnaryExpression UnaryExpression String arg String query true ( operator = "-" => result = "-" + arg ) & ( operator = "not" => result = "(not " + arg + ")") & ( operator = "->isDeleted" => result = "(del " + arg + ")" ) & ( operator = "->oclIsUndefined" => result = "(" + arg + " == None)" ) & ( argument.isNumeric() => result = mapNumericExpression(arg) ) & ( argument.isString() => result = mapStringExpression(arg) ) & ( Expression.isReduceOp(operator) => result = mapReduceExpression(arg,argument.type.name) ) & ( argument.isCollection() => result = mapUnaryCollectionExpression(arg,argument.type.name) ) Operation: toPython UnaryExpression String query true result = mapUnaryExpression(argument.toPython()) Operation: addReference UnaryExpression Expression x BasicExpression true UnaryExpression->exists( e | e.expId = expId + "_" + x.data & e.operator = operator & e.umlKind = umlKind & e.argument = argument.addReference(x) & result = e ) Entity: CollectionExpression 646 -112 Expression * isOrdered boolean 3 false false false Operation: mapCollectionExpression CollectionExpression String elems Sequence(String) tn String query true ( tn = "Set" => result = "set({" + Expression.tolist(elems) + "})" ) & ( tn = "Sequence" => result = "[" + Expression.tolist(elems) + "]" ) & ( tn = "Map" => result = "dict({" + Expression.maptolist(elems) + "})") Operation: toPython CollectionExpression String query true result = mapCollectionExpression(elements.toPython(),type.name) Operation: addReference CollectionExpression Expression x BasicExpression true CollectionExpression->exists( e | e.expId = expId + "_" + x.data & e.isOrdered = isOrdered & e.umlKind = umlKind & e.elements = elements.addReference(x) & result = e ) Entity: BasicExpression 284 78 Expression * data String 3 false false false prestate boolean 3 false false false Operation: mapTypeExpression BasicExpression String query true ( data = "long" => result = "int" ) & ( data = "double" => result = "float" ) & ( data = "boolean" => result = "bool" ) & ( data = "String" => result = "str" ) & ( true => result = data ) Operation: mapValueExpression BasicExpression String aind Set(String) query true ( data = "true" => result = "True" ) & ( data = "false" => result = "False" ) & ( data = "null" => result = "None" ) & ( aind.size > 0 => result = data + Expression.indexstring(arrayIndex,aind) ) & ( aind.size = 0 => result = data ) Operation: mapVariableExpression BasicExpression String aind Set(String) query true ( aind.size = 0 => result = data ) & ( aind.size > 0 => result = data + Expression.indexstring(arrayIndex,aind) ) Operation: mapStaticAttributeExpression BasicExpression String obs Set(String) aind Set(String) pars Sequence(String) query true ( obs.size = 0 => result = data + Expression.indexstring(arrayIndex,aind) ) & ( obs.size > 0 => result = objectRef.any.data + "." + data + Expression.indexstring(arrayIndex,aind) ) Operation: mapAttributeExpression BasicExpression String obs Set(String) aind Set(String) pars Sequence(String) query true ( isStatic = true => result = mapStaticAttributeExpression(obs,aind,pars) ) & ( context.size = 0 & obs.size = 0 => result = data + Expression.indexstring(arrayIndex,aind) ) & ( context.size > 0 & obs.size = 0 => result = "self." + data + Expression.indexstring(arrayIndex,aind) ) & ( context.size > 0 & obs.size > 0 & objectRef.any.type /: CollectionType => result = obs->any() + "." + data + Expression.indexstring(arrayIndex,aind) ) & ( context.size > 0 & obs.size > 0 & objectRef.any.type : CollectionType & type.name = "Sequence" => result = "[ _x." + data + Expression.indexstring(arrayIndex,aind) + " for _x in " + obs->any() + "]" ) & ( context.size > 0 & obs.size > 0 & objectRef.any.type : CollectionType & type.name = "Set" => result = "set({ _x." + data + Expression.indexstring(arrayIndex,aind) + " for _x in " + obs->any() + "})" ) Operation: mapOperationExpression BasicExpression String obs Set(String) aind Set(String) pars Sequence(String) query true ( isStatic = true & obs.size > 0 => result = objectRef.any.data + "." + data + Expression.parstring(pars) + Expression.indexstring(arrayIndex,aind) ) & ( context.size = 0 & obs.size = 0 => result = data + Expression.parstring(pars) + Expression.indexstring(arrayIndex,aind) ) & ( context.size > 0 & obs.size = 0 => result = "self." + data + Expression.parstring(pars) + Expression.indexstring(arrayIndex,aind) ) & ( context.size > 0 & obs.size > 0 => result = obs->any() + "." + data + Expression.parstring(pars) + Expression.indexstring(arrayIndex,aind) ) Operation: mapFunctionExpression BasicExpression String obs Set(String) aind Set(String) pars Sequence(String) query obs.size > 0 arg = obs->any() & ( data = "allInstances" => result = arg ) & ( "Integer" = objectRef.any.data & "subrange" = data => result = "range(" + pars->first() + ", " + pars->at(2) + " +1)" ) & ( "Integer" = objectRef.any.data & "Sum" = data => result = "ocl.sum([(" + pars[4] + ") for " + pars[3] + " in range(" + pars[1] + ", " + pars[2] + " + 1)])" ) & ( "Integer" = objectRef.any.data & "Prd" = data => result = "ocl.prd([(" + pars[4] + ") for " + pars[3] + " in range(" + pars[1] + ", " + pars[2] + " + 1)])" ) & ( data = "ceil" or data = "floor" => result = "int(math." + data + "(" + arg + "))" ) & ( data = "sqr" or data = "cbrt" => result = "ocl." + data + "(" + arg + ")" ) & ( Expression.isMathFunction(data) => result = "math." + data + "(" + arg + ")" ) & ( data = "subrange" => result = arg + "[(" + pars[1] + "-1): (" + pars[2] + ")]" ) & ( data = "insertAt" & type.name = "String" => result = "ocl.insertAtString(" + arg + ", " + pars[1] + ", " + pars[2] + ")" ) & ( data = "insertAt" & type.name /= "String" => result = "ocl.insertAt(" + arg + ", " + pars[1] + ", " + pars[2] + ")" ) & ( data = "oclIsUndefined" => result = "(" + arg + " == None)" ) & ( data = "oclAsType" => result = pars->first() + "(" + arg + ")" ) & ( data = "sum" => result = "ocl.sum(" + arg + ")" ) & ( data = "prd" => result = "ocl.prd(" + arg + ")" ) & ( data = "max" => result = "ocl.max" + type.name + "(" + arg + ")" ) & ( data = "min" => result = "ocl.min" + type.name + "(" + arg + ")" ) & ( data = "front" => result = "(" + arg + ")[0:-1]" ) & ( data = "tail" => result = "(" + arg + ")[1:]" ) & ( data = "first" => result = "(" + arg + ")[0]" ) & ( data = "last" => result = "(" + arg + ")[-1]" ) & ( data = "sort" => result = "ocl.sort" + type.name + "(" + arg + ")" ) & ( data = "size" => result = "len(" + arg + ")" ) & ( true => result = data + "(" + arg + ")" ) Operation: mapClassExpression BasicExpression String obs Set(String) aind Set(String) pars Sequence(String) query umlKind = classid ( arrayIndex.size > 0 & arrayIndex.any.type : CollectionType => result = "get" + elementType.name + "ByPKs(" + aind->any() + ")" ) & ( arrayIndex.size > 0 & arrayIndex.any.type /: CollectionType => result = "get" + elementType.name + "ByPK(" + aind->any() + ")" ) & ( arrayIndex.size = 0 => result = "allInstances_" + data + "()" ) Operation: mapBasicExpression BasicExpression String ob Set(String) aind Set(String) pars Sequence(String) query true ( Type.isPrimitiveType(data) => result = mapTypeExpression() ) & ( umlKind = value => result = mapValueExpression(aind) ) & ( umlKind = variable => result = mapVariableExpression(aind) ) & ( (umlKind = attribute or umlKind = role) => result = mapAttributeExpression(ob,aind,pars) ) & ( (umlKind = operation or umlKind = queryop) => result = mapOperationExpression(ob,aind,pars) ) & ( umlKind = function => result = mapFunctionExpression(ob,aind,pars) ) & ( umlKind = classid => result = mapClassExpression(ob,aind,pars) ) Operation: toPython BasicExpression String query true result = mapBasicExpression(objectRef.toPython(),arrayIndex.toPython(),parameters.toPython()) Operation: addReference BasicExpression Expression x BasicExpression true ( umlKind = classid => BasicExpression->exists( e | e.expId = expId + "_" + x.data & e.data = data & e.prestate = prestate & e.umlKind = umlKind & e.objectRef = objectRef & e.arrayIndex = arrayIndex.addReference(x) & e.parameters = parameters.addReference(x) & result = e ) ) & ( objectRef.size = 0 => BasicExpression->exists( e | e.expId = expId + "_" + x.data & e.data = data & e.prestate = prestate & e.umlKind = umlKind & e.objectRef = Set{x} & e.arrayIndex = arrayIndex.addReference(x) & e.parameters = parameters.addReference(x) & result = e ) ) & ( objectRef.size > 0 & "self" = objectRef->any() + "" => BasicExpression->exists( e | e.expId = expId + "_" + x.data & e.data = data & e.prestate = prestate & e.umlKind = umlKind & e.objectRef = Set{x} & e.arrayIndex = arrayIndex.addReference(x) & e.parameters = parameters.addReference(x) & result = e ) ) & ( true => BasicExpression->exists( e | e.expId = expId + "_" + x.data & e.data = data & e.prestate = prestate & e.umlKind = umlKind & e.objectRef = objectRef.addReference(x) & e.arrayIndex = arrayIndex.addReference(x) & e.parameters = parameters.addReference(x) & result = e ) ) Entity: Property 828 127 null * name String 3 false false false lower int 3 false false false upper int 3 false false false isOrdered boolean 3 false false false isUnique boolean 3 false false false isDerived boolean 3 false false false isReadOnly boolean 3 false false false isStatic boolean 3 false false false Operation: initialisation Property String query true ( qualifier.size > 0 => result = " self." + name + " = dict({})\n" ) & ( qualifier.size = 0 => result = " self." + name + " = " + type.defaultInitialValue() + "\n" ) Operation: getPKOp Property String ent String query true e = ent.toLowerCase & result = "def get" + ent + "ByPK(_ex) :\n" + " if (_ex in " + ent + "." + e + "_index) :\n" + " return " + ent + "." + e + "_index[_ex]\n" + " else :\n" + " return None\n\n" Operation: getPKOps Property String ent String query true e = ent.toLowerCase & result = "def get" + ent + "ByPKs(_exs) :\n" + " result = []\n" + " for _ex in _exs :\n" + " if (_ex in " + ent + "." + e + "_index) :\n" + " result.append(" + ent + "." + e + "_index[_ex])\n" + " return result\n\n" Entity: Statement 366 968 null * abstract statId String 3 false true false Operation: tab Statement String indent int query static true ( indent <= 0 => result = "" ) & ( indent > 0 => result = " " + Statement.tab(indent - 1) ) Operation: toPython Statement String indent int query abstract true true Entity: ReturnStatement 272 1025 Statement * Operation: toPython ReturnStatement String indent int query true ( returnValue.size = 0 => result = Statement.tab(indent) + "return" + "\n" ) & ( returnValue.size > 0 => result = Statement.tab(indent) + "return " + returnValue.any.toPython() + "\n" ) Entity: Operation 388 377 BehaviouralFeature * isQuery boolean 3 false false false isAbstract boolean 3 false false false isCached boolean 3 false false false Operation: displayStaticCachedOperation Operation void indent int p String obj String true (Statement.tab(indent) + "def " + name + "(" + p + ") :")->display() & (Statement.tab(indent+2) + "if str(" + p + ") in " + obj + "." + name + "_cache :")->display() & (Statement.tab(indent + 4) + "return " + obj + "." + name + "_cache[str(" + p + ")]")->display() & (Statement.tab(indent+2) + "result = " + obj + "." + name + "_uncached(" + p + ")")->display() & (Statement.tab(indent+2) + obj + "." + name + "_cache[str(" + p + ")] = result")->display() & (Statement.tab(indent+2) + "return result")->display() & "\n"->display() & (Statement.tab(indent) + "def " + name + "_uncached(" + p + ") :")->display() & activity.toPython(indent + 2)->display() & "\n"->display() Operation: displayInstanceCachedOperation Operation void indent int p String obj String true (Statement.tab(indent) + "def " + name + "(self, " + p + ") :")->display() & (Statement.tab(indent+2) + "if str(" + p + ") in " + obj + "." + name + "_cache :")->display() & (Statement.tab(indent + 4) + "return " + obj + "." + name + "_cache[str(" + p + ")]")->display() & (Statement.tab(indent+2) + "result = " + obj + "." + name + "_uncached(" + p + ")")->display() & (Statement.tab(indent+2) + obj + "." + name + "_cache[str(" + p + ")] = result")->display() & (Statement.tab(indent+2) + "return result")->display() & "\n"->display() & (Statement.tab(indent) + "def " + name + "_uncached(self, " + p + ") :")->display() & activity.toPython(indent + 2)->display() & "\n"->display() Operation: displayOperation Operation void indent int true (isStatic = true & isCached = true & parameters.size = 1 => displayStaticCachedOperation(indent,parameters[1].name,owner.name)) & (isStatic = false & isCached = true & parameters.size = 1 => displayInstanceCachedOperation(indent,parameters[1].name,"self")) & ( isStatic = false & (isCached = false or parameters.size /= 1) => ( Statement.tab(indent) + "def " + name + "(self" + parameters->collect( p | ", " + p.name )->sum() + ") :" )->display() & activity.toPython(indent + 2)->display() ) & ( isStatic = true & ( isCached = false or parameters.size /= 1 ) => ( Statement.tab(indent) + "def " + name + "(" + Expression.tolist(parameters.name) + ") :" )->display() & activity.toPython(indent + 2)->display() ) Entity: UseCase 539 857 null * name String 3 false false false Operation: mapUseCase UseCase String query true ( classifierBehaviour->oclIsUndefined() = false => result = "def " + name + "(" + Expression.tolist(parameters.name) + ") :\n" + classifierBehaviour.toPython(2) + "\n" ) Entity: BreakStatement 289 1059 Statement * Operation: toPython BreakStatement String indent int query true result = Statement.tab(indent) + "break" + "\n" Entity: OperationCallStatement 248 1216 Statement * assignsTo String 3 false false false Operation: toPython OperationCallStatement String indent int query true result = Statement.tab(indent) + callExp.toPython() + "\n" Entity: ImplicitCallStatement 305 1263 Statement * assignsTo String 3 false false false Operation: toPython ImplicitCallStatement String indent int query true result = Statement.tab(indent) + callExp.toPython() + "\n" Entity: LoopStatement 509 1154 Statement * abstract Entity: BoundedLoopStatement 501 1250 LoopStatement * Operation: toPython BoundedLoopStatement String indent int query true result = Statement.tab(indent) + "for " + test.toPython() + " :\n" + body.toPython(indent + 2) Entity: UnboundedLoopStatement 543 1204 LoopStatement * Operation: toPython UnboundedLoopStatement String indent int query true result = Statement.tab(indent) + "while " + test.toPython() + " :\n" + body.toPython(indent + 2) Entity: AssignStatement 28 872 Statement * Operation: toPython AssignStatement String indent int query true result = Statement.tab(indent) + left.toPython() + " = " + right.toPython() + "\n" Entity: SequenceStatement 683 973 Statement * kind int 3 false false false Operation: toPython SequenceStatement String indent int query true ( statements.size = 0 => result = Statement.tab(indent) + "pass\n" ) & ( statements.size > 0 => result = statements->collect( s | s.toPython(indent) )->sum() ) Entity: ConditionalStatement 135 913 Statement * Operation: elsecode ConditionalStatement String indent int query true ( elsePart.size = 0 => result = "" ) & ( elsePart.size > 0 => result = Statement.tab(indent) + "else :\n" + elsePart.any.toPython(indent + 2) ) Operation: toPython ConditionalStatement String indent int query true result = Statement.tab(indent) + "if " + test.toPython() + " :\n" + ifPart.toPython(indent + 2) + elsecode(indent) Entity: CreationStatement 286 1095 Statement * createsInstanceOf String 3 false false false assignsTo String 3 false false false Operation: toPython CreationStatement String indent int query true ( type : Entity => result = Statement.tab(indent) + assignsTo + " = None\n" ) & ( type /: Entity => result = Statement.tab(indent) + assignsTo + " = " + type.defaultInitialValue() + "\n" ) Entity: BehaviouralFeature 310 -141 Feature * abstract isStatic boolean 3 false false false Association: Feature Type 0 210 130 262 140 1 type null Association: Feature Type 0 220 130 272 140 1 elementType null Association: Association Property -1 604 394 248 392 0 memberEnd null ordered Association: Property Property -1 176 414 186 423 -1 qualifier null Association: BehaviouralFeature Property -1 166 474 186 423 0 parameters null ordered Association: Entity Generalization 1 362 143 511 101 0 generalization specific Association: Generalization Entity 0 579 123 523 175 1 general specialization Association: Entity Operation 1 326 196 208 380 0 ownedOperation owner ordered Association: Operation Entity 0 211 359 326 196 0 definers null ordered Association: Property Type 0 830 130 42 110 1 type null Association: CollectionType Type 0 203 398 108 144 1 elementType null Association: Expression Type 0 270 -84 27 105 1 type null Association: Expression Type 0 268 -60 108 107 1 elementType null Association: CollectionExpression Expression 0 647 -93 516 -82 0 elements null Association: BinaryExpression Expression 0 124 10 267 -39 1 left null 125 -22 Association: BinaryExpression Expression 0 208 22 293 -35 1 right null 221 31 Association: BasicExpression Expression 0 427 83 471 -35 0 parameters null ordered Association: UnaryExpression Expression -1 657 -35 513 -58 1 argument null Association: BasicExpression Property 0 588 87 627 129 -1 referredProperty null Association: BasicExpression Entity 0 588 87 627 129 0 context null Association: BasicExpression Expression -1 287 184 339 208 -1 arrayIndex null 227 183 227 246 307 247 Association: Property Expression -1 664 128 485 -34 1 initialValue null 665 76 514 72 Association: BasicExpression Expression -1 490 203 408 212 -1 objectRef null 552 203 551 252 443 253 Association: Property Entity 0 674 148 364 359 1 owner ownedAttribute 672 362 Association: Entity Entity 0 300 142 333 156 -1 superclass subclasses Association: UseCase Property -1 664 900 246 271 0 parameters null ordered Association: UseCase Type 0 545 -122 148 72 1 resultType null Association: AssignStatement Type 0 27 916 27 105 -1 type null Association: CreationStatement Type 0 270 1116 27 105 1 type null Association: CreationStatement Type 0 268 1129 108 107 1 elementType null Association: BehaviouralFeature Statement -1 424 -118 430 966 1 activity null Association: ReturnStatement Expression -1 275 1028 200 35 -1 returnValue null Association: UseCase Statement -1 545 878 448 972 1 classifierBehaviour null Association: OperationCallStatement Expression -1 254 1218 175 59 1 callExp null 201 1159 Association: ImplicitCallStatement Expression -1 309 1284 110 56 1 callExp null 180 1250 Association: LoopStatement Expression -1 510 1165 201 48 1 test null 267 1159 Association: AssignStatement Expression -1 32 893 106 48 1 left null Association: AssignStatement Expression -1 118 894 124 30 1 right null Association: ConditionalStatement Expression -1 179 937 179 27 1 test null Association: ConditionalStatement Statement -1 302 934 367 972 1 ifPart null 303 -30 Association: ConditionalStatement Statement -1 218 935 367 989 -1 elsePart null 217 989 Association: SequenceStatement Statement -1 687 1009 453 980 0 statements null ordered Association: LoopStatement Statement -1 627 1155 451 991 1 body null 625 1025 Association: BoundedLoopStatement Expression -1 515 1165 211 48 1 loopRange null Association: BoundedLoopStatement Expression -1 520 1165 221 48 1 loopVar null Generalisation: NamedElement Relationship 552 40 261 35 Generalisation: NamedElement Type 278 135 243 68 Generalisation: Relationship Association 731 348 650 58 Generalisation: Relationship Generalization 588 247 583 56 Generalisation: Type Classifier 56 259 52 143 Generalisation: DataType PrimitiveType 32 424 27 370 Generalisation: Classifier Entity 37 353 36 281 Generalisation: Classifier DataType 139 351 106 278 Generalisation: DataType CollectionType 142 402 98 369 Generalisation: Expression UnaryExpression 655 -11 511 -40 Generalisation: Expression BasicExpression 357 76 357 -37 Generalisation: Expression BinaryExpression 57 68 288 -112 23 69 24 -132 288 -134 Generalisation: Expression CollectionExpression 722 -111 475 -113 722 -127 474 -128 Generalisation: BehaviouralFeature Operation 385 378 335 -127 Generalisation: Statement ReturnStatement 383 1029 380 990 Generalisation: Statement BreakStatement 417 1063 414 993 Generalisation: Statement OperationCallStatement 439 1215 429 993 Generalisation: Statement ImplicitCallStatement 467 1266 439 994 Generalisation: Statement LoopStatement 515 1157 447 994 Generalisation: LoopStatement BoundedLoopStatement 522 1254 519 1178 Generalisation: LoopStatement UnboundedLoopStatement 635 1206 634 1177 Generalisation: Statement SequenceStatement 686 978 451 974 Generalisation: Statement ConditionalStatement 312 918 385 969 383 917 Generalisation: Statement AssignStatement 164 884 408 970 403 897 Generalisation: Statement CreationStatement 427 1094 422 992 Generalisation: NamedElement Feature 53 127 105 67 Generalisation: Feature BehaviouralFeature 12 472 14 165 GeneralUseCase: printcode false Constraint: null true "import ocl"->display() & "import math"->display() & ""->display() & ""->display() & Entity.deleteOp()->display() & Entity.displayOps()->display() null printcode false Constraint: null specialization.size > 0 classHeader()->display() & staticAttributes()->display() & abstractClassConstructor()->display() Entity printcode false Constraint: null specialization.size = 0 classHeader()->display() & staticAttributes()->display() & classConstructor()->display() & self.allOperations()->forAll( op | op.displayOperation(2)) Entity printcode false Constraint: null specialization.size = 0 createOp()->display() & allInstancesOp()->display() & ""->display() Entity printcode false Constraint: null specialization.size > 0 allInstancesOp()->display() & ""->display() Entity printcode false Constraint: null allProperties()->exists( k | k.isUnique ) & key = allProperties()->select(isUnique)->any() key.getPKOp(name)->display() & key.getPKOps(name)->display() & self.createPKOp(key.name)->display() Entity printcode false Constraint: isStatic = true owner->oclIsUndefined() self.displayOperation(0) & ""->display() Operation printcode false Constraint: null true mapUseCase()->display() & ""->display() & ""->display() & ""->display() UseCase printcode false