Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Newbie question
Newbie question [message #7457] Sun, 25 December 2005 01:39 Go to next message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

Hello!
Can anybody tell me how to work with EMFT?
I can check out org.eclipse.emft in the CVS, but
how to I start the examples and install the plugins in there?
The plugins are not displayed in an eclipse runtime configuration.
THX
Re: Newbie question [message #7469 is a reply to message #7457] Mon, 26 December 2005 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

I meanwhile figured it out, but not downloaded something of
the EMFT CVS projects but used org.eclipse.emf.ocl
already delivered with emf.
(I just could not get it run with CVS EMFT).

In the library example, I select an EAuthor object
in the sample editor. Now following query fails:

books->collect(pages | pages>=100)

with message
AnyType: source for operation (greaterThanEqual) must have compatible
method: compareTo


I just have no overview over expressions which would work.
Can anyone post an example how to do a normal SQL
select * from .. where .. in this OCL grammar?
Tried to interpret OCLGrammar.g, but this was to complex finally.

Another example would be helpful how to declare local variables:
Set {Book b | b in books}

does not work:

unexpected token: Book

Another question is: How do I
create instances for the library example with only having library.ecore
available (so without java-implementation classes, only using
some kind of reflective API) and how can I pass such instances (stored as
XMI-files) to the ocl-parser?
Re: Newbie question [message #9754 is a reply to message #7469] Wed, 28 December 2005 18:11 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jrg,

Regarding the OCL expression that you tried to formulate: if you want to
select the author's books that have more than 100 pages, then you need:

books->select(pages >= 100)

because

books->collect(pages >= 100)

will give you a collection of booleans indicating for each book whether it
has more than 100 pages.

You can also specify an iterator variable to assign to each book via:

books->select(b | b.pages >= 100)

or even

books->select(b : Book | b.pages >= 100)

OCL does not resemble SQL in any way nor have any like capabilities. For
the definitive reference on OCL, see the language specification at

http://www.omg.org/technology/documents/modeling_spec_catalo g.htm#UML

(click on the "UML 2 OCL Available Specification" link). There may be other
resources on the Internet to help you familiarize yourself with the OCL
language.

Regarding your other question: the OCL parser works equally well with
dynamic EObjects as it does with EObjects from generated package
implementations. Just load the library.ecore model, register the EPackage
that it contains in the global package registry
(EPackage.Registry.INSTANCE), and use its factory
(epackage.getEFactoryInstance()) to instantiate the various EClasses. The
resulting dynamic EObjects can be used as the context for parsing OCL
expressions in the IOclHelper API.

HTH,

Christian


Jrg wrote:

> I meanwhile figured it out, but not downloaded something of
> the EMFT CVS projects but used org.eclipse.emf.ocl
> already delivered with emf.
> (I just could not get it run with CVS EMFT).
>
> In the library example, I select an EAuthor object
> in the sample editor. Now following query fails:
>
> books->collect(pages | pages>=100)
>
> with message
> AnyType: source for operation (greaterThanEqual) must have compatible
> method: compareTo
>
>
> I just have no overview over expressions which would work.
> Can anyone post an example how to do a normal SQL
> select * from .. where .. in this OCL grammar?
> Tried to interpret OCLGrammar.g, but this was to complex finally.
>
> Another example would be helpful how to declare local variables:
> Set {Book b | b in books}
>
> does not work:
>
> unexpected token: Book
>
> Another question is: How do I
> create instances for the library example with only having library.ecore
> available (so without java-implementation classes, only using
> some kind of reflective API) and how can I pass such instances (stored as
> XMI-files) to the ocl-parser?
Re: Newbie question [message #562194 is a reply to message #7457] Mon, 26 December 2005 20:32 Go to previous message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

I meanwhile figured it out, but not downloaded something of
the EMFT CVS projects but used org.eclipse.emf.ocl
already delivered with emf.
(I just could not get it run with CVS EMFT).

In the library example, I select an EAuthor object
in the sample editor. Now following query fails:

books->collect(pages | pages>=100)

with message
AnyType: source for operation (greaterThanEqual) must have compatible
method: compareTo


I just have no overview over expressions which would work.
Can anyone post an example how to do a normal SQL
select * from .. where .. in this OCL grammar?
Tried to interpret OCLGrammar.g, but this was to complex finally.

Another example would be helpful how to declare local variables:
Set {Book b | b in books}

does not work:

unexpected token: Book

Another question is: How do I
create instances for the library example with only having library.ecore
available (so without java-implementation classes, only using
some kind of reflective API) and how can I pass such instances (stored as
XMI-files) to the ocl-parser?
Re: Newbie question [message #562320 is a reply to message #7469] Wed, 28 December 2005 18:11 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jrg,

Regarding the OCL expression that you tried to formulate: if you want to
select the author's books that have more than 100 pages, then you need:

books->select(pages >= 100)

because

books->collect(pages >= 100)

will give you a collection of booleans indicating for each book whether it
has more than 100 pages.

You can also specify an iterator variable to assign to each book via:

books->select(b | b.pages >= 100)

or even

books->select(b : Book | b.pages >= 100)

OCL does not resemble SQL in any way nor have any like capabilities. For
the definitive reference on OCL, see the language specification at

http://www.omg.org/technology/documents/modeling_spec_catalo g.htm#UML

(click on the "UML 2 OCL Available Specification" link). There may be other
resources on the Internet to help you familiarize yourself with the OCL
language.

Regarding your other question: the OCL parser works equally well with
dynamic EObjects as it does with EObjects from generated package
implementations. Just load the library.ecore model, register the EPackage
that it contains in the global package registry
(EPackage.Registry.INSTANCE), and use its factory
(epackage.getEFactoryInstance()) to instantiate the various EClasses. The
resulting dynamic EObjects can be used as the context for parsing OCL
expressions in the IOclHelper API.

HTH,

Christian


Jrg wrote:

> I meanwhile figured it out, but not downloaded something of
> the EMFT CVS projects but used org.eclipse.emf.ocl
> already delivered with emf.
> (I just could not get it run with CVS EMFT).
>
> In the library example, I select an EAuthor object
> in the sample editor. Now following query fails:
>
> books->collect(pages | pages>=100)
>
> with message
> AnyType: source for operation (greaterThanEqual) must have compatible
> method: compareTo
>
>
> I just have no overview over expressions which would work.
> Can anyone post an example how to do a normal SQL
> select * from .. where .. in this OCL grammar?
> Tried to interpret OCLGrammar.g, but this was to complex finally.
>
> Another example would be helpful how to declare local variables:
> Set {Book b | b in books}
>
> does not work:
>
> unexpected token: Book
>
> Another question is: How do I
> create instances for the library example with only having library.ecore
> available (so without java-implementation classes, only using
> some kind of reflective API) and how can I pass such instances (stored as
> XMI-files) to the ocl-parser?
Previous Topic:Newbie question
Next Topic:[Announce] New EMFT Subproject: Transaction
Goto Forum:
  


Current Time: Fri Apr 19 21:03:04 GMT 2024

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

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

Back to the top