Search code examples
javaneo4joslc

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


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?


Solution

  • 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, 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.