[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [henshin-dev] Question about Henshins wrap model and GUI
|
Am 30.09.2013 21:21, schrieb Christian Krause:
Hi Jens,
could you give us some more details about your example? Specifically:
How many objects does your input graph have?
About 17436.
I think the problem here may be the same I had some time ago when trying
to save transformed UML models. The problem then was that I saved the
whole UML metamodel and removed it from EMF-storage at the same time.
I try to avoid this issue by creating a new resouce and adding only the
the contents of the UML-model. On the one hand, this doesn't really help
because even the "filtered" graph is that big. On the other hand, the
wrapper-objects seem to be genereated correctly, because the map has
only few objects.
I attached the sourcecode.
> Are wrappers generated for
all these objects? You should have exactly one wrapper for every object.
It seems that if the wrappers are created correctly. I attached the
output of
System.out.println(wrappers.toString);
Did you try to run one of the wrapper examples? Maybe there is a problem
with the UML models.
This would be a bit more complex because I 'd have to adapt my tool to
load the models ;)
Thanks in advance,
Jens
--
Dipl.-Inf. Jens Bürger
Technische Universität Dortmund
Lehrstuhl 14 AG SECSE
Otto-Hahn-Straße 14
44227 Dortmund
Raum 332
Tel.: +49 231 755-2690
Fax: +49 231 755-7936
{org.eclipse.uml2.uml.internal.impl.ModelImpl@70ce7c29 (name: DefaultNameModel, visibility: <unset>) (viewpoint: <unset>)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@6f929696 (synchronize: true),
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@3cc206dd (eClass: org.eclipse.emf.ecore.impl.EClassImpl@6cd408b1 (name: Internet) (instanceClassName: null) (abstract: false, interface: false))=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@dc8b14 (synchronize: true),
org.eclipse.uml2.uml.internal.impl.PackageImpl@439a19b (name: DefaultNamePackage, visibility: <unset>)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@f2ece7d (synchronize: true), org.eclipse.uml2.uml.internal.impl.NodeImpl@50fe876a (name: Node1, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@49f67854 (synchronize: true),
org.eclipse.uml2.uml.internal.impl.NodeImpl@766c69b0 (name: Node2, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@5455f8bb (synchronize: true),
org.eclipse.uml2.uml.internal.impl.CommunicationPathImpl@478ede8d (name: CommunicationPath1, visibility: <unset>) (isLeaf: false, isAbstract: false) (isDerived: false)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@583ce83e (synchronize: true),
org.eclipse.uml2.uml.internal.impl.ProfileApplicationImpl@4a1ccad6 (isStrict: false)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@6b36bb4 (synchronize: true),
org.eclipse.uml2.uml.internal.impl.PropertyImpl@74b51fae (name: source, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (isDerived: false, isDerivedUnion: false, aggregation: none)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@6d63f9db (synchronize: true),
org.eclipse.uml2.uml.internal.impl.PropertyImpl@5c6212cd (name: target, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (isDerived: false, isDerivedUnion: false, aggregation: none)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@3ea8d0f8 (synchronize: true),
org.eclipse.emf.ecore.impl.EAnnotationImpl@2848cd9d (source: http://www.eclipse.org/uml2/2.0.0/UML)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@3d2f69eb (synchronize: true),
org.eclipse.uml2.uml.internal.impl.LiteralUnlimitedNaturalImpl@1f33145e (name: <unset>, visibility: <unset>) (value: 1)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@73d2e2ae (synchronize: true),
org.eclipse.uml2.uml.internal.impl.LiteralIntegerImpl@527e3752 (name: <unset>, visibility: <unset>) (value: 1)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@1a2048ea (synchronize: true),
org.eclipse.uml2.uml.internal.impl.LiteralUnlimitedNaturalImpl@2ac0801d (name: <unset>, visibility: <unset>) (value: 1)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@3d93080c (synchronize: true),
org.eclipse.uml2.uml.internal.impl.LiteralIntegerImpl@441b05d8 (name: <unset>, visibility: <unset>) (value: 1)=org.eclipse.emf.henshin.wrap.impl.WObjectImpl@7ff56b68 (synchronize: true)}
EPackage.Registry.INSTANCE
.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
// Create a resource set with a base directory:
resourceSet = new HenshinResourceSet(null);
// Load the module:
model.setTransformationModule(resourceSet.getModule(
model.getHenshinFile(), false));
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE); resourceSet.registerXMIResourceFactories("uml");
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
// Load the model into an EGraph:
Resource resource = resourceSet.getResource(model.getModelFile());
for (EObject o : resource.getContents()){
if (o instanceof Model) {modelRef=o;}
}
EGraph derGraf=new EGraphImpl(resource);
model.setModelGraph(derGraf);
Resource freshResource = resourceSet.createResource(URI.createFileURI(model.getModelFile().replace(".uml", "_WRAP.uml")));
for (EObject o : model.getModelGraph().getRoots()){
if (o instanceof Model && o==modelRef) {freshResource.getContents().add(o);}
if (UMLsec.contains(o.eClass().getName())) {freshResource.getContents().add(o);}
}
Engine transformationEngine = new EngineImpl();
System.out.println(freshResource+" ::: ");
List<EObject> modell = freshResource.getContents();
// Build the wrap model:
Map<EObject,WObject> wrappers = WrapFactory.eINSTANCE.createWModelTree(modell, true);
System.out.println(wrappers.toString());
//System.out.println(wf.createWModelTree(model.getTransformationModule().getUnit("testrule_orig").eContents(),false).toString());
System.out.println("test2");
EGraph graph = new EGraphImpl(wrappers.values());
Engine engine = new EngineImpl();
for (Match match : engine.findMatches((Rule) model.getTransformationModule().getUnit("testrule_wrap"), graph, null)) {
System.out.println(match.toString());