英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论