-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On the Nature of Rels #16
Comments
Hi @smizell! Just a minor note - it is As to your question, did you get a chance to read the spec's section on Link Relation Types? I could be mistaken, but that section - I think - addresses your questions on what link relations exist. For example, assume the following document from your example: {
"meta": { "href": "http://example.io/foo" },
"user": {
"meta": { "href": "https://example.io/users/1", "rels": ["user"] },
"firstName": "Bob",
"lastName": "Smith",
"birthDate": "1980-01-23"
}
} The Does this make sense/answer your questions? Cheers! |
So, as I look at this discussion, unless I am mistaken, meta object in a json object with an href MUST implicitly imply {
"meta": { "href": "http://example.io/foo" },
"user": {
"meta": { "href": "https://example.io/users/1", "rel": ["user"] },
"firstName": "Bob",
"lastName": "Smith",
"birthDate": "1980-01-23"
}
} {
"meta": { "href": "http://example.io/foo" },
"user": {
"meta": { "href": "https://example.io/users/1", "rel": ["self", "user"] },
"firstName": "Bob",
"lastName": "Smith",
"birthDate": "1980-01-23"
}
} {
"meta": { "href": "http://example.io/foo" },
"user": {
"meta": { "href": "https://example.io/users/1", "rel": ["self"] },
"firstName": "Bob",
"lastName": "Smith",
"birthDate": "1980-01-23"
}
} {
"meta": { "href": "http://example.io/foo" },
"user": {
"meta": { "href": "https://example.io/users/1" },
"firstName": "Bob",
"lastName": "Smith",
"birthDate": "1980-01-23"
}
} Some wording may be necessary to clarify, but I think in principle this should be true. A link in an Ion Object in top-level should have a relation to itself as self. Ok. So, as I write these examples, I think I now see @smizell's point. The rel of an embedded ion object should be the relation to the parent object. Hm. This is interesting from a transclusion standpoint, which is what I think the point is. It may warrant some wording to clarify that |
Mark, yes, I think you're following me here. I do think what you said that "the rel of an embedded ion object should be the relation to the parent object" is most of my struggle here, but also some of the magic around For example, the root object has the implied self, but when transcluded, it loses that link implied relation. Also, as a root object, the This also means—as I think you're mentioning Mark—there is no way to explicitly use the {
"meta": { "href": "http://example.com/bar" },
"foo": {
"meta": { "href": "http://example.com/foo" },
"self": {
"meta": {
"href": "http://example.com/foo"
}
}
}
} Not that it is bad to do that, but just saying there is a difference here. In all of this, I think my internal struggles boil down to the Beware: thinking out loud here. I'm wondering if the root object should not use Also, you can alleviate the Hope that all makes sense! |
Also, as a side note Mark, I wanted to comment on your examples. As @lhazlewood mentioned, the implicit (I missed this, thanks for clarifying, Les) |
There seems also to be an implication that the If that is the case, then assuming that |
There is one small detail that I have been unable to unify in my head. In some
(many) cases, my head is to blame for this inability, but every once in a while
something is actually a tad off. I add this disclaimer so that everyone feels
totally free in telling me I'm crazy when they reach the end. Of course this
can be true no matter the outcome of this note.
Ion Object and HREF
Let's start with the Ion object. An Ion object by definition has a
meta
member. You can add an
href
member as an "IRI location of the resource" (asdefined in section 6.1).
For one, is there any implied link relation here, such as
self
? Second, if Iwere to add a
self
link relation here, would this link relation be fromthe current resource?
As per the spec, it appears that an Ion object with an
href
is also an Ionlink. And here, the
rels
for the Ion link are related from itself to anotherresource.
Ion Link
Now let's check out an Ion link.
I have added an explicit link relation of
user
here. But for theuser
link,the link relation is from the root Ion object to the Ion link. This is a
different pattern than with the first example.
Ion Collections
Another example is how the collection link relation is used. It is a slightly
different than the previous two examples. To recap, the first link relation
appears to relate from itself to another resource. The second appears to relate
from the parent object to the link.
With an Ion collection, the
collection
relation determines the nature of theobject itself. It is not necessarily a link from itself to a resource or some
self
or canonical link. It is rather defines how the object should behandled, which is slightly different than a normal Ion object.
Why does this even matter, Stephen?
Good question! Hopefully I can put some value to my ramblings.
First, if a link relation acts differently depending on if it's nested or not,
then you can run into some strange situations where you nest an existing
resource with some incorrect link relations.
Take this for example:
And embed it in some other object, as shown here:
Here you see the nature of link relation changes. I hope that makes sense :)
The collection link relation is another one that has additional meaning. When a
Ion collection is embedded into another Ion object, the
rels
defines both therelation and the nature of the collection itself. This may also not be an
issue, but I bring this one up mostly to show the ways that
rels
worksdepending on the context.
Final Observation
As a final note, to think out loud, it is almost as if an Ion object that is
the root object should not have an
href
, and should rather use aself
linkrelation (or related relation).
I am not sure I have any recommendation for the Ion collection and what to do
about the
rels
there. This may be necessary thing. My point is that, in thecase where the Ion collection is the root object, the link relation is used in
a way that does not fit with how Ion links work.
The text was updated successfully, but these errors were encountered: