在OSLC4J中,我如何向具有七个关联属性的资源添加属性?

huangapple go评论68阅读模式
英文:

In OSLC4J, how can I add a property to a Resource which has seven associated properties?

问题

我正在尝试从Neo4j数据库反向生成等效的OSLC AM资源。在这个数据库中,有一些节点彼此之间有关联,并且这些关系具有不属于任何节点的属性。在OSLC翻译中,创建节点和属性是直接的,但我没有看到如何向属性添加属性的方法。有一些示例XML显示了如何使用rdf:Description语句来实现这一点,但我没有看到如何从OSLC4J对象中获取这种输出。具体资源只允许在可以使用的情况下添加单个值,而我需要至少七个。我漏掉了什么?

英文:

I'm trying to work backwards from a Neo4j database to some equivalent OSLC AM resources. In this database, there are some nodes which have relationships to each other, and those relationships have attributes that don't belong to either of the nodes. In the OSLC translation, it's straightforward to create the nodes and properties, but I don't see any way to add properties to the properties. There is sample XML that shows how to do that with rdf:Description statements, but I'm not seeing now to obtain that output from OSLC4J objects. Reified resources only allow adding a single value, in situations where those can be used, and I need a minimum of seven. What am I missing?

答案1

得分: 2

如果你想要实现具体化,可以从OSLC4J中Link类(https://github.com/eclipse/lyo.core/blob/master/oslc4j-core/src/main/java/org/eclipse/lyo/oslc4j/core/model/Link.java)的实现方式获取灵感。

也就是说,创建一个扩展AbstractReifiedResource<URI>的类,并在该类上定义你的7个属性。
Link类只有一个String标签属性,但我相信你可以定义尽可能多的属性。

英文:

If you are after reification, you can take inspiration from how the Link class (https://github.com/eclipse/lyo.core/blob/master/oslc4j-core/src/main/java/org/eclipse/lyo/oslc4j/core/model/Link.java) is implemented in OSLC4J.

That is, create a class that extends AbstractReifiedResource<URI>, and define your 7 attributes on that class.
Link has only a single String label attribute, but I believe you can define as many properties as possible.

huangapple
  • 本文由 发表于 2020年8月6日 00:49:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/63269863.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定