I don't know, if it is correct to use IANA relations in this way and to add custom relations.
But these examples are parsed in the same way.
inlined relations
{
"http://www.iana.org/assignments/relation/self": {
"@id": "https://api.example.com/users/1"
},
"https://rel.example.com/mother": {
"@id": "https://api.example.com/users/2"
},
"https://rel.example.com/father": {
"@id": "https://api.example.com/users/3"
},
"id": "1",
"name": "Jon Doe"
}
relations in @context
{
"@context": {
"self": {
"@id": "http://www.iana.org/assignments/relation/self",
"@type": "@id"
},
"mother": {
"@id": "https://rel.example.com/mother",
"@type": "@id"
},
"father": {
"@id": "https://rel.example.com/father",
"@type": "@id"
}
},
"self": "https://api.example.com/users/1",
"mother": "https://api.example.com/users/2",
"father": "https://api.example.com/users/3",
"id": "1",
"name": "Jon Doe"
}
relations with compact URIs
Similar to CURIEs in HAL.
{
"@context": {
"iana": "http://www.iana.org/assignments/relation/",
"ex": "https://rel.example.com/",
"self": {
"@id": "iana:self",
"@type": "@id"
},
"mother": {
"@id": "ex:mother",
"@type": "@id"
},
"father": {
"@id": "ex:father",
"@type": "@id"
}
},
"self": "https://api.example.com/users/1",
"mother": "https://api.example.com/users/2",
"father": "https://api.example.com/users/3",
"id": "1",
"name": "Jon Doe"
}
compacted view
Just to show they are parsed in the same way. This is the compacted view (from JSON-LD playground) for all of them:
{
"http://www.iana.org/assignments/relation/self": {
"@id": "https://api.example.com/users/1"
},
"https://rel.example.com/father": {
"@id": "https://api.example.com/users/3"
},
"https://rel.example.com/mother": {
"@id": "https://api.example.com/users/2"
}
}