[ATL] Apply rules recursively to children [message #69824] |
Mon, 17 December 2007 13:35 |
Eclipse User |
|
|
|
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();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03267 seconds