Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Apply rules recursively to children
[ATL] Apply rules recursively to children [message #69824] Mon, 17 December 2007 18:35
Eclipse UserFriend
Originally posted by: mmelia.computing.dcu.ie

Hi,

I am a bit of a newbie to ATL, so please bear with me. I am trying to
Transform particular aspects of a RDFS XML document into ECore classes.
The ATL code is below. What I want is to create an RDFS!Graph which
contains all rdfs:Classes, but this only creates one RDFS:Class. I have
looked through the XMI and it seems that the rest of the RDFS:Class
definition are deeper in the children heirarchy (i.e. not direct children
of r) Is there anyway to recursivly look not only at the children of r,
but its children etc?

If you have any questions regarding my problem please ask. Thanks for your
help.

Mark

rule Model2Graph {
from
r: XML!Root (

)
to
rdfs : RDFS!Graph (
graphName <- r.children->select(
e|e.name='rdfs:Class')->collect(e|thisModule.Class2Class(e)))
)



}


lazy rule Class2Class {
from
pt: XML!Element(
pt.name = 'rdfs:Class'
)
to

c : RDFS!Class(uriRef <-uri),
uri : RDFS!URIReference ( uri <- u_r_i ),
u_r_i : RDFS!UniformResourceIdentifier ( name <- pt.children->select( e
| e.name = 'rdf:ID')->first().value)
do{
thisModule.tag<- pt.children->select( e | e.name =
'rdf:ID')->first().value.toString();
thisModule.getBaseNSSchema().toString().println();--.concat( ':').concat(thisModule.tag).println();
}

}
Previous Topic:[ATL]Problem running an ant file
Next Topic:[ATL] *Important* CVS changes
Goto Forum:
  


Current Time: Fri Apr 26 06:14:31 GMT 2024

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

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

Back to the top