Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] taggedvalues(accessing tagged values)
[QVTO] taggedvalues [message #503498] Mon, 14 December 2009 14:14 Go to next message
Siegfried Nolte is currently offline Siegfried NolteFriend
Messages: 48
Registered: August 2009
Member
Hello QVTO-World,

I'm sure, I got something wrong with UML tagged values. I defined a stereotype "A" with tags
"aint : Integer [1]",
"astr : String[1]",
"astrarr : String[*]".
With applying A to a class, I tagged the values with aint = 1,
astr = "Hello",
astrarr = "Hello", "World, "how", "are", "you".
Now I want to analyse that class with QVTO:

query Class::checkStereotype(str : String) : Boolean
{
log ('checkStereotype:');
var st := self.getAppliedStereotype( str );

log ( ' stereotype ' + st.name );
var tvint := self.getValue ( st, 'aint' );
log ( ' tvint as it is ', tvint );
-- this is OK

var tvstr := self.getValue ( st, 'astr' );
log ( ' tvstr as it is ', tvstr );
log ( ' tvstr as String ' + tvstr.oclAsType(String));
self.setValue ( st, 'astr', 'HelloWorld' );
tvstr := self.getValue ( st, 'astr' );
log ( ' tvstr as String ' + tvstr.oclAsType(String));
-- this is OK

var tvstrarr := self.getValue ( st, 'astrarr' );
log ( ' tvstrarr as it is ', tvstrarr );
printTaggedValues(tvstrarr.oclAsType(Sequence(String)));
/*
this is not; the log delivers "Hello"; I expect something like "Hello", "World", ...
The function call printTaggedValeus results with "invalid value"
*/
return true;
}

Any help? Thanks for it,
Siegfried

[Updated on: Mon, 14 December 2009 09:15]

Report message to a moderator

Re: [QVTO] taggedvalues [message #503651 is a reply to message #503498] Tue, 15 December 2009 03:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dvorak.radek.gmail.com

Hi Siegfried,

When trying to reproduce, I saw that getValue(...)
for a String[*] type value gives an empty list which is converted
due to a strange repeated value coercion in OCL into invalid.

Could you please raise a bugzilla and attach your models and
relevant QVT code please?

https://bugs.eclipse.org/bugs/enter_bug.cgi?assigned_to=dvor ak.radek%40gmail.com&blocked=&bug_file_loc=http%3A%2 F%2F&bug_severity=normal&bug_status=NEW&comment= &component=QVT_OML-Engine&contenttypeentry=&cont enttypemethod=autodetect&contenttypeselection=text%2Fpla in&data=&dependson=&description=&flag_type-1 =X&flag_type-10=X&flag_type-2=X&flag_type-4=X&am p;flag_type-6=X&flag_type-7=X&flag_type-8=X&flag _type-9=X&form_name=enter_bug&keywords=&maketemp late=Remember%20values%20as%20bookmarkable%20template&op _sys=Mac%20OS%20X&product=M2M&qa_contact=&rep_pl atform=PC&short_desc=&version=2.0

Also, I'm just curious if you get a correct value when you access it in
Java,
I wonder whether I had a correct setup for this scenario.

Regards,
/Radek



On Mon, 14 Dec 2009 15:14:30 +0100, Siegfried
<siegfried@siegfried-nolte.de> wrote:

> Hello QVTO-World,
>
> I'm sure, I got something wrong with UML tagged values. I defined a
> stereotype "A" with tags "aint : Integer [1]", "astr : String[1]",
> "astrarr : Strign[*]". With applying A to a class, I tagged the values
> with aint = 1, astr = "Hello", astrarr = "Hello", "World, "how", "are",
> "you". Now I want to analyse that class with QVTO:
>
> query Class::checkStereotype(str : String) : Boolean
> { log ('checkStereotype:');
> var st := self.getAppliedStereotype( str );
>
> log ( ' stereotype ' + st.name ); var tvint := self.getValue
> ( st, 'aint' );
> log ( ' tvint as it is ', tvint );
> -- this is OK
>
> var tvstr := self.getValue ( st, 'astr' );
> log ( ' tvstr as it is ', tvstr );
> log ( ' tvstr as String ' + tvstr.oclAsType(String));
> self.setValue ( st, 'astr', 'HelloWorld' );
> tvstr := self.getValue ( st, 'astr' );
> log ( ' tvstr as String ' + tvstr.oclAsType(String));
> -- this is OK
>
> var tvstrarr := self.getValue ( st, 'astrarr' );
> log ( ' tvstrarr as it is ', tvstrarr );
> printTaggedValues(tvstrarr.oclAsType(Sequence(String))); /*
> this is not; tho log delivers "Hello"; I expect something like "Hello",
> "World", ...
> The function call results with "invalid value"
> */
> return true; }
>
> Any help? Thanks for it,
> Siegfried
Re: [QVTO] taggedvalues [message #503664 is a reply to message #503651] Tue, 15 December 2009 09:20 Go to previous messageGo to next message
Siegfried Nolte is currently offline Siegfried NolteFriend
Messages: 48
Registered: August 2009
Member
Hello Radek,

I forgot to mention, yes, I allways get an empty list for that [*] tag, though there are tagged values. I will raise a bug.

Thanks,
Siegfried
Re: [QVTO] taggedvalues [message #530514 is a reply to message #503651] Thu, 29 April 2010 21:29 Go to previous message
Eclipse UserFriend
Originally posted by: vanbeerst.gmail.com

Hi,

I was wondering if there was any progress on this issue. Are there other
ways to get the values of a multivalued tagged value?

Dear regards,
Tony.
Previous Topic:[QVTO] Setting tagged value that is a multivalue
Next Topic:Problem running example
Goto Forum:
  


Current Time: Thu Mar 28 14:30:10 GMT 2024

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

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

Back to the top