tags:

views:

159

answers:

1

Assume that I have an Ecore-model containing a package and some classes that make reference to each other. If i create a "Dynamic Instance", Eclipse produces an XMI-file and I can instantiate some classes. Containment-relations are directly serialized to an XML-tree in the XMI (the children elements in the example). But if I instantiate references to elements that are already contained somewhere in the tree, the Editor writes Path-Expressions like in the following, for the currentChild attribute:

<parent currentChild="//@parent/@children.1">
  <children/>
  <children/>
</parent>

As far as I know this is not XPath, because:

  1. The "childrens" are elements not attributes and have not to be referenced via "@"
  2. XPath uses the e.g., elem[1] and not elem.1 to get e.g., the second elem of a list

What is it and where can I find a information on it? I already tried to browse the EMF pages/specs but could not find it.

A: 

It's an EMF Fragment Path. The Javadoc describes it like this:

String org.eclipse.emf.ecore.InternalEObject.eURIFragmentSegment(EStructuralFeature eFeature, EObject eObject) Returns the fragment segment that, when passed to eObjectForURIFragmentSegment, will resolve to the given object in this object's given feature.

The feature argument may be null in which case it will be deduced, if possible. The default result will be of the form:

"@feature-name[.index]"

The index is used only for many-valued features; it represents the position within the list.

Parameters: eFeature the feature relating the given object to this object, or null. eObject the object to be identified. Returns: the fragment segment that resolves to the given object in this object's given feature.

Thanks! That helps a lot.
Juve
Here is a link to a related Javadoc:http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.emf.doc/references/javadoc/org/eclipse/emf/ecore/impl/EModelElementImpl.htmlsearch for: eURIFragmentSegment
Juve