Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » JET: EMF Resources & References in EMF Models
JET: EMF Resources & References in EMF Models [message #52697] Mon, 25 September 2006 19:06 Go to next message
Eclipse UserFriend
Originally posted by: zx.us.ibm.com

Say you have an EMF model like...

....
<incomingTokenType tokenTypeName="ivcred">
<additionalAttributes name="tagvalue_empid"/>
<additionalAttributes name="tagvalue_phone"/>
<principalAttributes name="name"/>
<groupAttributes name="group1"/>
</incomingTokenType>
<outgoingTokenType tokenTypeName="saml1x">
<additionalAttributes name="empid"/>
<additionalAttributes name="phone"/>
<additionalAttributes name="username"/>
<principalAttributes name="principal"/>
<groupAttributes name="test"/>
</outgoingTokenType>
<mappings source="//@incomingTokenType/@additionalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.0"/ >
....

And I have some JET expressions...

<c:iterate select="//mappings" var="node" >
<c:setVariable select="$node/@source" var="sourceXpath"/>
<c:get select="$sourceXpath" default="no dice :(" />

I just get the string, //@incomingTokenType/@additionalAttributes.0
instead of resolving the reference and giving back the proper attribute.

If I do a

<c:get select="//incomingTokenType/additionalAttributes/@name"
default="no dice ;(" />

I get a 'tagvalue_empid' which is correct?

Why don't I get the same? Am I just being silly here?

Cheers,

~ Chris
Re: EMF Resources & References in EMF Models [message #52724 is a reply to message #52697] Mon, 25 September 2006 19:35 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Chris:

Try:

<c:setVariable select="$node/source/@name" var="sourceXpath"/>

Although the generated Java code for Mapping has a AdditionalAttributes
getSource() method, which makes 'source' appear to be an attribute, it is
declared as an EReference feature, and JET will properly interpret it if you
leave off the @.

I am surprised that the XPath parser is resolving $node/@source at all.

Paul


"Chris Aniszczyk" <zx@us.ibm.com> wrote in message
news:ef99at$4mj$1@utils.eclipse.org...
> Say you have an EMF model like...
>
> ...
> <incomingTokenType tokenTypeName="ivcred">
> <additionalAttributes name="tagvalue_empid"/>
> <additionalAttributes name="tagvalue_phone"/>
> <principalAttributes name="name"/>
> <groupAttributes name="group1"/>
> </incomingTokenType>
> <outgoingTokenType tokenTypeName="saml1x">
> <additionalAttributes name="empid"/>
> <additionalAttributes name="phone"/>
> <additionalAttributes name="username"/>
> <principalAttributes name="principal"/>
> <groupAttributes name="test"/>
> </outgoingTokenType>
> <mappings source="//@incomingTokenType/@additionalAttributes.0"
> destination="//@outgoingTokenType/@additionalAttributes.0"/ >
> ...
>
> And I have some JET expressions...
>
> <c:iterate select="//mappings" var="node" >
> <c:setVariable select="$node/@source" var="sourceXpath"/>
> <c:get select="$sourceXpath" default="no dice :(" />
>
> I just get the string, //@incomingTokenType/@additionalAttributes.0
> instead of resolving the reference and giving back the proper attribute.
>
> If I do a
>
> <c:get select="//incomingTokenType/additionalAttributes/@name" default="no
> dice ;(" />
>
> I get a 'tagvalue_empid' which is correct?
>
> Why don't I get the same? Am I just being silly here?
>
> Cheers,
>
> ~ Chris
Re: EMF Resources & References in EMF Models [message #52752 is a reply to message #52724] Mon, 25 September 2006 19:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zx.us.ibm.com

What a test jet file of:
<?xml version="1.0" encoding="utf-8"?>

<c:get select="//incomingTokenType/additionalAttributes/@name"
default="not found" />

<c:iterate select="//mappings" var="node" >
<c:setVariable select="$node/source" var="sourceXpath"/>
<c:setVariable select="$node/source" var="destXpath"/>

<c:get select="$sourceXpath/@name" default="not found" />

Source = <c:get select="$sourceXpath" default="not found"/>
Destination = <c:get select="$destXpath" default = "not found"/>
</c:iterate>

and an input of:

<?xml version="1.0" encoding="UTF-8"?>
<com.tivoli.am.fim.idmaptool:IDMapRoot xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.tivoli.am.fim.idmaptool="http:///idmap.ecore">
<incomingTokenType tokenTypeName="ivcred">
<additionalAttributes name="tagvalue_empid"/>
<additionalAttributes name="tagvalue_phone"/>
<principalAttributes name="name"/>
<groupAttributes name="group1"/>
</incomingTokenType>
<outgoingTokenType tokenTypeName="saml1x">
<additionalAttributes name="empid"/>
<additionalAttributes name="phone"/>
<additionalAttributes name="username"/>
<principalAttributes name="principal"/>
<groupAttributes name="test"/>
</outgoingTokenType>
<mappings source="//@incomingTokenType/@additionalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.0"/ >
<mappings source="//@incomingTokenType/@additionalAttributes.1"
destination="//@outgoingTokenType/@additionalAttributes.1"/ >
<mappings source="//@incomingTokenType/@groupAttributes.0"
destination="//@outgoingTokenType/@groupAttributes.0"/>
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@principalAttributes.0"/ >
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.2"/ >
</com.tivoli.am.fim.idmaptool:IDMapRoot>

I get output of:

<?xml version="1.0" encoding="utf-8"?>

tagvalue_empid


not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

Any further thoughts?

Cheers,

~ Chris
Re: EMF Resources & References in EMF Models [message #52779 is a reply to message #52752] Mon, 25 September 2006 20:17 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Summary of an offline conversation with Chris:

* Chris has an instance of the model in his workspace that a buddy sent him.
* He does not have the ECore model, nor any of the Java code.

Unfortunately, JET is trying to load the model and detects it is likely an
ECore package. It attempts to find a registered EPackage (as is created when
the EMF generated plug-in is installed in the workbench), and fails. As a
fall back, JET is trying (and succeeding) in loading the model as an XML
document.

The resulting in memory model looks a lot like the EMF model, but isn't. In
particular, the XPath expressions do not resolve $node/source (there is no
child element source), and the treat $node/@source as an attribute
reference - no special semantics applied.

Chris will be submitting a bugzilla suggesting that in the event that the
EMF EPackage cannot be found, that JET should fail with an informative
message, rather than attempt to the load as an XML document.

Paul
Re: EMF Resources & References in EMF Models [message #591979 is a reply to message #52697] Mon, 25 September 2006 19:35 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Chris:

Try:

<c:setVariable select="$node/source/@name" var="sourceXpath"/>

Although the generated Java code for Mapping has a AdditionalAttributes
getSource() method, which makes 'source' appear to be an attribute, it is
declared as an EReference feature, and JET will properly interpret it if you
leave off the @.

I am surprised that the XPath parser is resolving $node/@source at all.

Paul


"Chris Aniszczyk" <zx@us.ibm.com> wrote in message
news:ef99at$4mj$1@utils.eclipse.org...
> Say you have an EMF model like...
>
> ...
> <incomingTokenType tokenTypeName="ivcred">
> <additionalAttributes name="tagvalue_empid"/>
> <additionalAttributes name="tagvalue_phone"/>
> <principalAttributes name="name"/>
> <groupAttributes name="group1"/>
> </incomingTokenType>
> <outgoingTokenType tokenTypeName="saml1x">
> <additionalAttributes name="empid"/>
> <additionalAttributes name="phone"/>
> <additionalAttributes name="username"/>
> <principalAttributes name="principal"/>
> <groupAttributes name="test"/>
> </outgoingTokenType>
> <mappings source="//@incomingTokenType/@additionalAttributes.0"
> destination="//@outgoingTokenType/@additionalAttributes.0"/ >
> ...
>
> And I have some JET expressions...
>
> <c:iterate select="//mappings" var="node" >
> <c:setVariable select="$node/@source" var="sourceXpath"/>
> <c:get select="$sourceXpath" default="no dice :(" />
>
> I just get the string, //@incomingTokenType/@additionalAttributes.0
> instead of resolving the reference and giving back the proper attribute.
>
> If I do a
>
> <c:get select="//incomingTokenType/additionalAttributes/@name" default="no
> dice ;(" />
>
> I get a 'tagvalue_empid' which is correct?
>
> Why don't I get the same? Am I just being silly here?
>
> Cheers,
>
> ~ Chris
Re: EMF Resources & References in EMF Models [message #591995 is a reply to message #52724] Mon, 25 September 2006 19:58 Go to previous message
Chris Aniszczyk is currently offline Chris AniszczykFriend
Messages: 674
Registered: July 2009
Senior Member
What a test jet file of:
<?xml version="1.0" encoding="utf-8"?>

<c:get select="//incomingTokenType/additionalAttributes/@name"
default="not found" />

<c:iterate select="//mappings" var="node" >
<c:setVariable select="$node/source" var="sourceXpath"/>
<c:setVariable select="$node/source" var="destXpath"/>

<c:get select="$sourceXpath/@name" default="not found" />

Source = <c:get select="$sourceXpath" default="not found"/>
Destination = <c:get select="$destXpath" default = "not found"/>
</c:iterate>

and an input of:

<?xml version="1.0" encoding="UTF-8"?>
<com.tivoli.am.fim.idmaptool:IDMapRoot xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.tivoli.am.fim.idmaptool="http:///idmap.ecore">
<incomingTokenType tokenTypeName="ivcred">
<additionalAttributes name="tagvalue_empid"/>
<additionalAttributes name="tagvalue_phone"/>
<principalAttributes name="name"/>
<groupAttributes name="group1"/>
</incomingTokenType>
<outgoingTokenType tokenTypeName="saml1x">
<additionalAttributes name="empid"/>
<additionalAttributes name="phone"/>
<additionalAttributes name="username"/>
<principalAttributes name="principal"/>
<groupAttributes name="test"/>
</outgoingTokenType>
<mappings source="//@incomingTokenType/@additionalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.0"/ >
<mappings source="//@incomingTokenType/@additionalAttributes.1"
destination="//@outgoingTokenType/@additionalAttributes.1"/ >
<mappings source="//@incomingTokenType/@groupAttributes.0"
destination="//@outgoingTokenType/@groupAttributes.0"/>
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@principalAttributes.0"/ >
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.2"/ >
</com.tivoli.am.fim.idmaptool:IDMapRoot>

I get output of:

<?xml version="1.0" encoding="utf-8"?>

tagvalue_empid


not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

not found

Source = not found
Destination = not found

Any further thoughts?

Cheers,

~ Chris
Re: EMF Resources & References in EMF Models [message #592002 is a reply to message #52752] Mon, 25 September 2006 20:17 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Summary of an offline conversation with Chris:

* Chris has an instance of the model in his workspace that a buddy sent him.
* He does not have the ECore model, nor any of the Java code.

Unfortunately, JET is trying to load the model and detects it is likely an
ECore package. It attempts to find a registered EPackage (as is created when
the EMF generated plug-in is installed in the workbench), and fails. As a
fall back, JET is trying (and succeeding) in loading the model as an XML
document.

The resulting in memory model looks a lot like the EMF model, but isn't. In
particular, the XPath expressions do not resolve $node/source (there is no
child element source), and the treat $node/@source as an attribute
reference - no special semantics applied.

Chris will be submitting a bugzilla suggesting that in the event that the
EMF EPackage cannot be found, that JET should fail with an informative
message, rather than attempt to the load as an XML document.

Paul
Previous Topic:JET: EMF Resources & References in EMF Models
Next Topic:Markers and JET Trenasformation
Goto Forum:
  


Current Time: Fri Apr 26 07:42:26 GMT 2024

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

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

Back to the top