Skip to content

Add a class to represent the primary resource and any number of resources to be inlined #145

@berezovskyi

Description

@berezovskyi

I have a need to return an object of a certain class (the one that corresponds to the resource attached to a given capability). However, I need to inline a bunch of other resources in a response. This is a legit use case for OSLC requests, as shapes explicitly allow non-local resources to be inlined.

The solution I am currently using is a pair of custom classes that are then transformed into a simple Object[] (see eclipse-lyo/lyo.core#21; blocked by eclipse-lyo/lyo.core#22). I believe Lyo Core can do the transformation behind the scenes. Also, I cannot solve eclipse/lyo.core#30 myself but if the transformation happens in the JMH, it can keep a mapping between the System.identityHashCode(Object) and the org.apache.jena.graph.BlankNodeId (I had to stop using RDF BNodes / OSLC LocalResources completely as a workaround).

The classes I use right now (warning, Kotlin ahead):

data class InstanceWithResources<T : IResource>(val instance: T,
                                                val resources: Collection<IResource>)

data class InstanceMultiWithResources<T : IResource>(val instance: Collection<T>,
                                                val resources: Collection<IResource>)

Please comment on the proposal and I will switch the Status to PR Welcome or Abandoned (and remove you from assignees).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions