# JSON-LD JSON-LD stands for [[JSON]] - [[Linked Data]], and it tries to connect and organize data as machine readable data. > [!quote] JSON-LD is a lightweight Linked Data format. It is easy for humans to read and write. It is based on the already successful JSON format and provides a way to help JSON data interoperate at Web-scale. JSON-LD is an ideal data format for programming environments, REST Web services, and unstructured databases such as Apache CouchDB and MongoDB. > [JSON-LD - JSON for Linking Data](https://json-ld.org) ## Overview JSON-LD brings a few things to JSON. - context (which is like a schema describing the structure and type of the body of the JSON document) - aliasing (you can refer to other attributes and other objects, through URL) - it makes it possible to share vocabularies (shared schemas) and thus has a short terminology / concise means of sharing information (since there is a shared context and vocabulary) - global identifiers (basically URLs) It also has the concept of compaction, expansion and framing. These are ways of representing the data in a JSON-LD document. Expansion is basically expanding every alias and type until the the document is in a canonical form, while compaction compressing everything it can using aliases and the context. Framing is a way to transform a flattened JSON-LD document, which is basically in triple form, back into a structure and nested JSON object. ## Studying the actual spec These are rough notes while reading the spec on [[2022-12-28]]: IRI: Internationalized Resource Identifiers - meant to replace URIs in identifying reousrces for protocols, formats and software components JSON-LD introduces: - mapping keys to IRIs via a context to disambiguate - refer to external resources withing a JSON document - datatypes such as date and time - express directed graphs in a single document Interoperates with RDF (see [[RWISE - The Origins of JSON-LD]] and [[RWISE - JSON-LD and Why I Hate the Semantic Web]] about the rift between [[Semantic Web]] people and the [[JSON-LD]] take on things). Nitty gritty details: - null in a map use to "remove" a key - arrays are unordered collections unless specified - number is either long or double - there's nodes: - either subject or object or at least one triple in an RDF graph - every property is a directed arc, labeled with an IRI - there's something called blank nodes - support for multiple languages Contexts apply to: - nodes - values - a graph object (how is that different from a node ?) - list - set - nested values ## Log [[2022-12-28]] Studying the actual spec [[2022-12-27]] I read much more about JSON-LD today, and it's been quite inspiring. It basically is a more lightweight way to provide schema information to [[JSON]], similarly to [[JSON schema]] a bit, and to me more reminiscent of [[XSchema]] (to which it is affiliated!) and XML. I like [[ManuSporny]]'s critique, mentioning how he didn't bring up [[RDF]] at all in the JSON-LD spec because it's not necessary for the reader to bring it up. Apparently, there was a lot of pushback against it. The specification (which I still have to read, and didn't print out, sadly) builds up by using examples. His story about the [[W3C]] in [[RWISE - JSON-LD and Why I Hate the Semantic Web]] makes me more interested into how it all works, and what you get to do to participate, and how that impacts the [[Fediverse]] in general. He fought hard to make the JSON-LD work happen in the open, withohut closed door sessions. He has strong words for [[RDF]]. He wanted to get away from needing a quad store, [[SPARQL]], libraries. This makes sense for adoption (and in general, really), and it indeed puts into perspective the [[JSON]] part of it. There is export and import to/from RDF, but I'm not sure if I need to look that much more into [[Semantic Web]] stuff, since there seems to be a rift. As [[ManuSporny]] says it in the end of [[RWISE - JSON-LD and Why I Hate the Semantic Web]], > [!quote] To this day I assert that we could rip the data model section out of the JSON-LD specification and it wouldn’t really affect the people using JSON-LD in any significant way > [[RWISE - JSON-LD and Why I Hate the Semantic Web]] I've been thinking about the uses for JSON-LD for [[PROJ - GO GO GOLEMS - GLAZED]], what I can gain from using it (and where), and how to make it easy for people to export data to JSON-LD and [[Linked Data]] in particular. Giving data the additional context that the application knows internally is exactly one of the goals of my project. [[2022-10-31]] I don't know what JSON-LD is, but I encountered it while reading the sourcecode to [[writefreely]], especially while looking at the used module `writeas/activity`. I found more documentation about it from [ActivityPub Rocks!](https://activitypub.rocks) and its [Guide for new ActivityPub implementers - SocialHub](https://socialhub.activitypub.rocks/pub/guide-for-new-activitypub-implementers), so it does seem to have emerged (or at least heavily influenced) the [[Activitypub]] specifications. Is this the JSON version of [[Semantic Web]] and the XML ontologies of old? Is it actually taking off this time? ## Links A "critique" by [[ManuSporny]], which has a lot of interesting content. - [JSON-LD and Why I Hate the Semantic Web | The Beautiful, Tormented Machine](http://manu.sporny.org/2014/json-ld-origins-2/) See my [[RWISE - JSON-LD and Why I Hate the Semantic Web]] annotations. [[ManuSporny]] also has some pretty nice youtube videos: - [Linked Data](http://www.youtube.com/watch?v=4x_xzT5eF5Q) - [JSON LD Introduction](http://www.youtube.com/watch?v=vioCbTo3C-4) Minutes of the [[W3C]] [[W3C Working Group|Working Group]]. Quite interesting, it's fun to look into the process behind such things and how all these things came to be. It's a step forward for me to potentially become more involved in some bigger project at some point? It feels that I've been so incredibly naive to always take all these protocols for granted and never look behind the scenes. - [JSON-LD Community Group](https://json-ld.org/minutes/) A primer. - [JSON-LD Primer](https://json-ld.org/primer/latest/)