Ecore 派生的 XMI 实例中的引用使用什么查询/路径语言?

发布于 2024-08-06 06:56:37 字数 586 浏览 6 评论 0原文

假设我有一个 Ecore 模型,其中包含一个包和一些相互引用的类。如果我创建一个“动态实例”,Eclipse 会生成一个 XMI 文件,我可以实例化一些类。包含关系直接序列化为 XMI 中的 XML 树(示例中的 children 元素)。但是,如果我实例化对已包含在树中某处的元素的引用,则编辑器会为 currentChild 属性编写如下所示的路径表达式:

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

据我所知,这不是 XPath,因为:

  1. childrens”是元素而不是属性,不必通过“@”引用
  2. XPath 使用例如 elem[1] 和不是 elem.1 来获取例如列表的第二个 elem

它是什么以及在哪里可以找到有关它的信息?我已经尝试浏览 EMF 页面/规格,但找不到。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沫尐诺 2024-08-13 06:56:37

这是一个 EMF 片段路径。 Javadoc 是这样描述的:

String org.eclipse.emf.ecore.InternalEObject.eURIFragmentSegment(EStructuralFeature eFeature, EObject eObject)
返回片段片段,当传递给 eObjectForURIFragmentSegment 时,该片段片段将解析为该对象的给定功能中的给定对象。

特征参数可能为空,在这种情况下,如果可能的话,将推断出该特征。默认结果的形式为:

“@feature-name[.index]”

该索引仅用于多值特征;它代表列表中的位置。

参数:
eFeature 将给定对象与该对象相关的特征,或者为 null。
eObject 待识别的对象。
返回:
在该对象的给定特征中解析为给定对象的片段段。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文