Macros
•
Transform information
•
Add @id to data
•
Other programatic
transformations
{
"type": "User",
"followers": 35,
"name": "Gregg Kellogg",
"email": "
[email protected]",
"url": "https://api.github.com/users/
gkellogg",
"avatar_url": "...",
"id": 46296,
"login": "gkellogg"
}
* json-ld-macros courtesy of Antonio Garrote
{
"https://api.github.com/users/*": {
"$": {
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"foaf:depiction": {"@type": "@id"},
"gh": "https://api.github.com/vocabulary#"
},
"@id": [{"f:valueof": "login"},
{"f:prefix": "http://github.com/"}],
"@ns": {
"ns:default": "gh",
"ns:replace": {"avatar_url": "foaf:depiction", "name":
"foaf:name"}
},
"@only": ["avatar_url", "name", "followers"],
"@type": ["gh:User", "foaf:Person"]
}
}
}
+
{
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"foaf:depiction": {"@type": "@id"},
"gh": "https://api.github.com/
vocabulary#"
},
"@id": "https://api.github.com/users/
gkellogg",
"@type": ["gh:User", “foaf:Person”],
"foaf:name": "Gregg Kellogg",
"foaf:depiction": "http://...",
“gh:followers”: 35