Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Help with baseType null when validating assignments
icon5.gif  [QVTo] Help with baseType null when validating assignments [message #637004] Wed, 03 November 2010 17:52 Go to next message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi all,

as I don't understand what is causing the error I reported in thread ( http://www.eclipse.org/forums/index.php?t=msg&th=199440& amp;start=0&S=aa481cbaab00990d41a8b4e921ce5507), I have downloaded the source code of QVTo from CVS Repository, in order to trace it and determine what is causing the problem.

I have traced the code and I have arrived at the validateAssignment method iin org.eclipse.m2m.internal.qvt.oml.ast.parser.QvtOperationalPa rserUtil.java class, and I have written some log code in the isIncremental part of the method, in order to see what is happening. The log code I have included is marked in red below:

public static boolean validateAssignment(boolean isProperty, String leftName, EClassifier leftType,
EClassifier rightType, boolean isIncremental, CSTNode cstNode,
Environment<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter,
EObject, CallOperationAction, SendSignalAction, Constraint, EClass, EObject> env) {

if (isIncremental) {
System.out.println("Entering into isIncremental..."+leftName+"..."+leftType.getInstanceClassName());
if (leftType instanceof CollectionType == false) {
QvtOperationalUtil.reportError(env, NLS.bind(ValidationMessages.SemanticUtil_3, new Object[] { leftName }), cstNode);
return false;
}

EClassifier baseType = ((CollectionType) leftType).getElementType();
EClassifier actualType = rightType;
if (actualType instanceof CollectionType) {
actualType = ((CollectionType) actualType).getElementType();
}


System.out.println("baseType - getInstanceClassName: "+ baseType.getInstanceClassName()+" getInstanceTypeName: " + baseType.getInstanceTypeName() + " getName: " +baseType.getName());
System.out.println("actualType - getInstanceClassName: "+ actualType.getInstanceClassName()+" getInstanceTypeName: " + actualType.getInstanceTypeName() + " getName: " +actualType.getName());
System.out.println("isAssignableFrom: "+ QvtOperationalParserUtil.isAssignableToFrom(env, baseType, actualType));

if (!QvtOperationalParserUtil.isAssignableToFrom(env, baseType, actualType)) {
QvtOperationalUtil.reportError(env, NLS.bind(ValidationMessages.SemanticUtil_5,
new Object[] { leftName, QvtOperationalTypesUtil.getTypeFullName(baseType),
QvtOperationalTypesUtil.getTypeFullName(actualType) }), cstNode);
return false;
}
}


The console shows the following log:


Entering into isIncremental...ownedElements...java.util.LinkedHashSet
baseType - getInstanceClassName: null getInstanceTypeName: null getName: null
actualType - getInstanceClassName: null getInstanceTypeName: null getName: Node


Part of the original QVTO is

modeltype swcmm uses 'http://org.mwacsl.swc';
modeltype jspmm uses 'http://www.eclipse.org/MoDisco/JSP/0.1.incubation/jsp';
modeltype xmlmm uses 'http://www.eclipse.org/MoDisco/Xml/0.1.incubation/XML';

transformation SWC2JSP(in inModel:swcmm, out outModel: jspmm);

configuration property PROJECT_DIR:String;

main() {
inModel.rootObjects()[swcmm::WebFlow]->map toModel();
}


mapping SWC::WebFlow::toModel(): jsp::Model{

pages+= self.nodes->select(oclIsTypeOf(SWC::FrontEndView))->collect(oclAsType(SWC::FrontEndView))- >map toPage();
}

--
mapping SWC::FrontEndView::toPage(): jsp::Page{

xmlDeclaration:="";
doctype:="";
name:=self.getOriginalFilePath();
pageOwner:= null;
originalFilePath:=PROJECT_DIR+"\\"+name;

ownedElements+= self.createContentTypeDirective().oclAsType(xml::Node);
log('metaclase', result.ownedElements.metaClassName());
log('metaclase', result.metaClassName());
}


The target metamodel is ( http://wiki.eclipse.org/MoDisco/Components/JSP/Documentation /0.9#JSP_Metamodel). I think the source metamodel has no influence on the error, so I have not posted it.

As far as I have understood, the problem is that QVTo is not able to calculate the type of ownedElements (as you can see, in the printed log messages baseType.getName() is null)
It's seem as if the xml metamodel has not been well loaded. Remember that the jsp metamodel has been defined as an extension of the xml metamodel. Why is this happening, it is supposed that if you configure the metamodel mappings and you include the metamodels (the source metamodel, the xml metamodel and the jsp metamodel), they should be loaded.

Any idea?

Best regards,
Toñi
Re: [QVTo] Help with baseType null when validating assignments [message #637562 is a reply to message #637004] Sat, 06 November 2010 17:38 Go to previous message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi all,

I think this problem is due to working with .ecore files instead of using the generated code and load the metamodels as plugins.

I don`t know why, but it seems there are problems when a metamodel references other metamodel and you are working with the .ecore files instead of the plugins. In this case, the jsp metamodel references the xml metamodel.

Regards,

Toñi
Previous Topic:[QVTo] Bug in type checking in QVTo 2.1.0??
Next Topic:[Xtend] XtendFacade debugging
Goto Forum:
  


Current Time: Mon Jun 17 11:35:20 GMT 2019

Powered by FUDForum. Page generated in 0.01737 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top