Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Problem with namespaces(read attributes from different namespaces)
Problem with namespaces [message #890000] Wed, 20 June 2012 14:16 Go to next message
Lukas Baron is currently offline Lukas BaronFriend
Messages: 10
Registered: June 2012
Junior Member
Hi there,

I want to read the xmi:id s of objects in my model. In case such an object does not have an attribute or reference called id, everything works fine by use of this code:
aui!`InterfaceType`.allInstances().first().`id`.println();

But if there is an Object which defines an id-attribute in its own namespace, I cannot read the xmi:id:
aui!`GroupingType`.allInstances().first().`id`.println();


So the first statement resolves to: "_9oArcHgFEeGEQaFIIY_fFA"
and the second to: "Visualisierung"

I use this model:
<InterfaceType ... xmi:id="_9oArcHgFEeGEQaFIIY_fFA" ...>
...
<grouping xmi:id="_EGHXUHgGEeGEQaFIIY_fFA" id="Visualisierung">
...


Is there any way to choose an attribute from a specific namespace?

Thanks in advance.
Lukas
Re: Problem with namespaces [message #890017 is a reply to message #890000] Wed, 20 June 2012 15:15 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 919
Registered: July 2009
Senior Member
Hi,

I suspect that calling the id() operation instead will solve this i.e.

aui!InterfaceType.allInstances().first().id().println();

On a side note, identifiers need to be placed between `` only when they they are keywords e.g. b.`var` = 5;

Cheers,
Dimitris
Re: Problem with namespaces [message #890018 is a reply to message #890017] Wed, 20 June 2012 15:27 Go to previous messageGo to next message
Lukas Baron is currently offline Lukas BaronFriend
Messages: 10
Registered: June 2012
Junior Member
Hi and thanks a lot. That works.
By the way. Is there any possibility to inspect an object, maybe to get all operations and properties of it?

Cheers,
Lukas

Re: Problem with namespaces [message #891233 is a reply to message #890018] Sun, 24 June 2012 11:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 919
Registered: July 2009
Senior Member
Hi Lukas,

You can retrieve all the properties of an EObject using its eClass() method e.g.

for (sf in x.eClass().eStructuralFeatures) {
sf.name.println();
}

There is no direct way to retrieve all the operations applicable to an EObject but if you really need to do this, you can create a Java tool [1] to interrogate the Epsilon runtime context. Please let me know if you'd like to do this and I can provide more details.

Cheers,
Dimitris

[1] http://www.eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.tools (see sayHelloAsVariable method)
Re: Problem with namespaces [message #892894 is a reply to message #891233] Sun, 01 July 2012 15:03 Go to previous messageGo to next message
Lukas Baron is currently offline Lukas BaronFriend
Messages: 10
Registered: June 2012
Junior Member
Hi Dimitris,
this already helped me alot, but I have one problem, I cannot solve.

By use of the structural features, I can get properties of an object, by use of the property name as a string.

This is the code.

property = object.eClass().dynamicGet(sf.featureId);

This often works, but if a certain property is marked as derived (or volatile) this method does not work, property won't be defined.

How can I get the value of such a derived feature?

Greetings
Lukas

[update]
It turns out, that nothing changes when I set markers derived, volatile, transient in the ecore-model to false.

Where can be the difference between my method above to access the property and the method, which is used in epsilon?
Just before someone asks. The property, I try to read is definitely existent in the model.

[Updated on: Sun, 01 July 2012 15:31]

Report message to a moderator

Re: Problem with namespaces [message #892912 is a reply to message #892894] Sun, 01 July 2012 20:01 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 919
Registered: July 2009
Senior Member
Hi Lukas,

Could you please put together a minimal example[1] so that I can investigate?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Previous Topic:Global Variables in imported EOL
Next Topic:[EOL] Adapter Error The value of type
Goto Forum:
  


Current Time: Mon Dec 22 04:24:05 GMT 2014

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

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