JSON-LD

See RDF Serialisation.

JSON-LD is a format for expressing semantic, machine-readable data using a JSON syntax. It's used to represent RDF data on the web, making it easy for applications and search engines to understand and integrate linked data.

Example: Book Recrod

Step 1. JSON-LD Representation

{
    "@context": {
        "schema": "https://schema.org/",
         "name": "schema:name",
         "author": "schema:author",
         "Book": "schema:Book",
    },
    "@type": "Book",
    "name": "The Great Gatsby",
    "author": {
        "@type": "schema:Person",
        "name": "F. Scott Fitzgerald"
    }
}

The @context tells us how to interpret as Linked Data.

Step 2. RDF Triples

When loaded into a semantic datbase, the JSON-LD is turned into RDF Triples (subject -> predicate -> object): 1. _:book1 -> rdf:type -> schema:Book 2. _:book1 -> schema:name -> "The Great Gatsby" 3.:book1->schema:author->:author14.:author1->rdf:type->schema:Person5.:author1->schema:name->"F. Scott Fitzgerald"`

_:book1 and _:author are blank nodes because we didn't give explicitly URIs.

Step 3. Stored in Semantic Database

In a triple store (like GraphDB and Fuseki). * Each triple is stored in the graph. * You can query it with SPARQL.

For example:

SELECT ?book ?authorName WHERE {
    ?book a schema:Book ;
        schema:name "The Great Gatsby" ;
        schema:author ?author .
    ?author schema:name ?authorName.
}

Result:

book authorName
_:book1 F. Scott Fitzgerald