Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346920 - In a stereotyped uml2 model the uml2.stereotype function does not return a list of xpath elements but only the first
Summary: In a stereotyped uml2 model the uml2.stereotype function does not return a li...
Status: RESOLVED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Jet (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Paul Elder CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 20:17 EDT by Andreas Brandt CLA
Modified: 2020-05-01 16:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Brandt CLA 2011-05-23 20:17:45 EDT
Build Identifier: 20100917-0705

It is not possible to retrieve all subelements from the annotation of a uml2 model.

It is possible to get the first (of many) src element with (for example) the following code:
uml2.stereotype($prop, 'Annotation::@field')/@src

But this code:
uml2.stereotype($prop, 'Annotation::@field')/src
fails to return the set of all src elements like one would expect from a xpath expression

Reproducible: Always

Steps to Reproduce:
1. Create a stereotyped uml2 model which has an element with several subelements like this:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Annotation="http:///schemas/Annotation/_251QsF-ZEeCpw_IcgN3SyA/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xsi:schemaLocation="http:///schemas/Annotation/_251QsF-ZEeCpw_IcgN3SyA/0 ./resources/Annotation.profile.uml#_25_owF-ZEeCpw_IcgN3SyA">
  ...
<uml:Model xmi:id="_BjRMsHu2EeCRLJRuz6xI2Q" name="m3o-API">
  ...
</uml:Model>
  ...
<Annotation:_field xmi:id="_BtDa03u2EeCRLJRuz6xI2Q">
  <src>classifiesSubject.AppliedMethodRole</src>
  <src>classifiesObject.Method</src>
  <src>satisfiesObject.Description</src>
  <src>isRelatedToConceptSubject.MethodConcept</src>
</Annotation:_field>
  ...

2. Run the JET transformation and try to extract the src elements via uml2.stereotype (where $prop is the correct property of the stereotype):
something like this:
<c:setVariable var="propSrc" select="string(uml2.stereotype($prop, 'Annotation::@field')/@src)" />
will provide "classifiesSubject.AppliedMethodRole", i.e. the first value of the src elements.

It is _not_ possible to retrieve a list of the src elements with something like this:
<c:setVariable var="propSrc" select="uml2.stereotype($prop, 'Annotation::@field')/src" />
(or several variations that i can't remember)
Comment 1 Paul Elder CLA 2011-05-26 10:31:50 EDT
This is not a problem with uml2.stereotype. Rather, it is a limitation of the XPath language (or perhaps JET's implementation of it). The XPath implementation does not expect attributes to be multi-valued.

See:

http://wiki.eclipse.org/JET_FAQ/How_do_I_access_multi-valued_attributes%3F

for ideas on working around this.