representing a "home" bookmark resource with CJ

15 views
Skip to first unread message

Howard Dierking

unread,
Feb 8, 2016, 12:05:37 AM2/8/16
to Collection+JSON
Hi all - I'm building a resource set in a couple different formats to compare/contrast and I'm having a little trouble expressing one in CJ. 

The scenario is an issue management system - think Jira or GitHub. I want to create a "home page" resource which will have both specific data values as well as some top level collections (issues assigned to you, open issues, users, etc.). A basic example of vanilla JSON is: 


You can imagine that there would, over time, be a desire to include more data than just the link. Plus, I want to preserve the link relationship type "bugs" - therefore, I don't think it makes sense to leverage collection/links. 

Another option would be to have a single item with a data array (e.g. collection/items[0]/data/[name=bugs]). However, it doesn't seem like it's possible to have the value of a data item be an array.

So it seems like in order to be true to form in a CJ world, I would need to create another resource for my "home page collection of type X" and then include it as a link. Is this right? It doesn't seem right in that I would now have a media type (e.g. a representation concern) dictating my resource modeling - so hoping that someone here can show me what I'm missing.

TIA,

_howard

Howard Dierking

unread,
Feb 8, 2016, 12:31:20 AM2/8/16
to Collection+JSON
Another approach I could take here, assuming that there is no uniqueness constraint with CJ or with common implementations of it, would be to include multiple links objects with the same rel value (frankly this is how I modeled my RDF in the first place). Is this doable? Is it a commonly used strategy for CJ? Is it going against the spirit of the media type?

mca

unread,
Feb 8, 2016, 12:32:48 AM2/8/16
to collect...@googlegroups.com
yes, Cj doesn't constraint rel values. that's why they are not keys, just properties.


--
You received this message because you are subscribed to the Google Groups "Collection+JSON" group.
To unsubscribe from this group and stop receiving emails from it, send an email to collectionjso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mca

unread,
Feb 8, 2016, 12:34:00 AM2/8/16
to collect...@googlegroups.com
keep in mind that rel values allow a series of space-separated strings. like HTML rel and class. this allows you to use several identifiers for a single rel property.

Howard Dierking

unread,
Feb 8, 2016, 12:37:49 AM2/8/16
to Collection+JSON
Makes sense - just feels like I'm abusing the spirit of the type a bit by using this feature to effectively specify a collection. Also, this approach would clearly stop working the second I wanted to optimize the request flow by elevating a data element behind one of those links into this resource. Any other approaches or obvious aspects of CJ that I could be missing here?

mca

unread,
Feb 8, 2016, 12:45:39 AM2/8/16
to collect...@googlegroups.com
lots of options. i wouldn't worry about "abuse" here, either.

i've used the "items" to carry link collections ("links" but no "data")
i've used queries to hold links w/ no arguments

i've used the item collection to hold heterogeneous collections -- and used a data property to name the "type" of each item in the mixed collection.

finally, i've used multiple Cj documents in a single "screen" to handle the "dashboard" experience for an app. 

there are other possibilities including creating backward-compatible extensions some are already registered in the Cj repos.


Glenn Block

unread,
Feb 8, 2016, 3:04:55 AM2/8/16
to collect...@googlegroups.com
Howard, there's a few extensions you might be interested in. One allows inlining documents: https://github.com/collection-json/extensions/blob/master/inline.md within items the other allows arrays: https://github.com/collection-json/extensions/blob/master/value-types.md
Reply all
Reply to author
Forward
0 new messages