[CDO] Using a Resource (URI) direct for M2M Transformation with ATL [message #639625] |
Wed, 17 November 2010 03:59  |
Eclipse User |
|
|
|
Originally posted by: polzer.embedded.rwth-aachen.de
Hi,
i did the tutorial and followed the webinar. There i see
several accessing a CDO resource. But with the URI
described there i am only able to access the folders.
Is it possible to create an URI that has direct access to a
resource and can be used by an transformation language like
ATL?
Thanks
Andreas
|
|
|
|
|
Re: [CDO] Using a Resource (URI) direct for M2M Transformation with ATL [message #639711 is a reply to message #639680] |
Wed, 17 November 2010 09:45  |
Eclipse User |
|
|
|
Am 17.11.2010 13:58, schrieb Andreas Polzer:
> Hi,
>
>> Can you give an example of such URI?
> I used the example given by Bernd Kolb (CDO Quickstart)
> I registered an toy metamodel and added a folder:
>
> CDO Server
> +-> folder
> +->Res1
> | +-> Node1
> +-> Res2
> +-> Node2
> +-> Node3
>
> Node1, Node2 and Node3 are root Notes of my models. So the
> thing i have to access
I see.
>>> i am only able to access the folders.
>> What happens if you do it?
> So try to access the NodeX via a Ant skript:
> <atl.loadModel
> modelhandler="EMF"
> metamodel="MM"
> name="IN_M"
> uri=" cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1/Node1"
> />
> But i do not know how to access Node1 (name of root note)
Generally you access an object within a resource through the URI fragment, the stuff appended to the hash sign "#".
In CDO the URI fragments are made of the CDOID (id type + id value), e.g. #L4711. Hence you must know this id before you ask for the object. If you submit an enhancement request we yould eventually try to provide a positional fragment format in addition.
> if
> i try it as written above:
> [atl.loadModel] Loading model IN_M from
> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1/Node1
> [atl.loadModel] org.eclipse.m2m.atl.core.ATLCoreException: Error loading
> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1/Node1 :
> org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI
> " cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1/Node1":
> org.eclipse.emf.cdo.common.util.CDOException: Expected folder for id = OID16
Correct, all segments of the URI path preceding the last segment must resolve to folders.
> so how can i load such a Node. If I use
> <atl.loadModel
> modelhandler="EMF"
> metamodel="MM"
> name="IN_M"
> uri="cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1"
> />
That should correctly load resource Res1.
> i've got no error but the resource IN_M is empty.
How did you find out that it's empty? The debugger can fool you as CDOResourceImpl is not a regular EObjectImpl, i.e. it does not store its state in instance fields.
> What can i do?
a) The easiest approach would be to determine the CDOID and then use uri="cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/folder/Res1#Lnnn". Try System.out.println(EcoreUtil.getURI(node1));
b) Submit the bugzilla mentioned above and provide a patch or wait until we find time ;-)
>> CDOTransaction tx = session.openTransaction(resourceSet);
>> // work with the resource set
>> tx.commit();
>> session.close();
>>
> Is it necessary to write a new Function which get access to
> an resource?
Not sure I understand this question...
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.28387 seconds