JSON-LD Official Website Documentation

repository·main·Indexed 21 days ago

https://github.com/json-ld/json-ld.org

Source code and documentation for the official JSON-LD website. Includes specifications for JSON-LD 1.1, a JSON-LD Test Suite for processor conformance, performance benchmarks, and guides for the interactive playground. Provides resources for Linked Data concepts, implementation algorithms (compact, expand, frame, normalize), and assets for official logos and buttons.

Tokens
3.8K
Snippets
10
Records
29
Agent score
76%

What's inside json-ld.org

  1. What is JSON-LD?

    main
    JSON-LD (JavaScript Object Notation for Linked Data) is a lightweight Linked Data format designed for human readability and machine parsability. It extends the standard JSON format to enable data interoperability at Web-scale by providing a way to uniquely identify objects and properties on the Web. It is particularly suited for JavaScript environments, Web services, and unstructured databases like CouchDB and MongoDB.
  2. Understand the purpose of the Development Playground

    main

    The Development Playground is an experimental environment used specifically to test UI updates and new features of jsonld.js.

    Warning: This environment is not intended for general use. It shares most files with the stable playground but operates using a non-revision-controlled version of jsonld.js, meaning it may contain unstable or experimental code.

  3. Use JSON-LD Framing to restructure data

    main

    JSON-LD Framing allows you to perform query by example and force a specific tree layout on a JSON-LD document.

    Developers use Framing to restructure data retrieved from the Web to match the specific needs of their application. By restructuring the data before your application processes it, you can write simpler code for handling data from external sources.

  4. Understand the JSON-LD modular specification architecture

    main

    JSON-LD is designed as a modular set of specifications. It is built upon two core base specifications, with all other features acting as layered extensions.

    To use JSON-LD effectively, you should understand the relationship between these layers:

    1. The JSON-LD Syntax: The foundation that defines the JSON-based format for serializing Linked Data.
    2. The JSON-LD API: The programmatic layer providing algorithms for document transformations, such as applying or removing contexts.
    3. Extensions: Higher-level specifications like Framing or the RDF API that build upon the Syntax and API to provide specialized functionality.
  5. Understand the JSON-LD Test Suite design

    main

    The test suite verifies JSON-LD Processor conformance by categorizing tests into specific sections. Each section uses a different data structure and comparison method:

    • compact: Uses input, expected, and context documents. Results are compared via JSON object comparison.
    • expand: Uses input and expected documents. Results are compared via JSON object comparison.
    • frame: Uses input, frame, and expected documents. Results are compared via JSON object comparison.
    • normalize: Uses input and expected documents. Results are compared via string comparison.
    • rdf: Uses input and sparql documents. The processor performs an RDF conversion, and the result is tested by executing an ASK query (contained in the sparql document) against a SPARQL endpoint. The test passes if the expected triples are extracted.

    Version Compatibility: Unless processingMode is explicitly set in a test entry, tests are compatible with both json-ld-1.0 and json-ld-1.1. If processingMode is specified, a json-ld-1.0 processor should only run tests marked json-ld-1.0, and a json-ld-1.1 processor should only run tests marked json-ld-1.1.

  6. Set up local website development

    main

    The website is built with Eleventy and deployed via Cloudflare Pages. To develop the site locally, use the following commands:

    1. Install dependencies: npm i
    2. Build static files to _site/: npm run build
    3. Rebuild files on changes (watch mode): npm run watch
    4. Serve the site with Cloudflare Pages feature support: npm run pages (available at http://localhost:8788/)
    # install dependencies
    npm i
    
    # to just build the static files to `_site/`
    npm run build
    
    # to rebuild the files on changes
    npm run watch
    
    # to serve `_site/` with Cloudflare Pages feature support
    npm run pages
  7. How to add a new unit test

    main

    To add a new unit test to the suite, follow these steps:

    1. Assign a number: Pick the next available unit test number (e.g., 250).
    2. Create the markup file: Create a .jsonld file in the tests/ directory using your chosen number (e.g., tests/rdf-250.jsonld).
    3. Create the query file (for RDF tests): Create a .jsonld or .sparql file in the tests/ directory (e.g., tests/rdf-250.sparql).
    4. Register the test: Add the new test entry to manifest.jsonld.
  8. Read JSON-LD blog posts and use cases

    main

    For practical perspectives and real-world application discussions, refer to blog posts such as:

    • Building Meaningful Data APIs: Insights into using JSON-LD for API design.
    • Webizing Databases: Using Linked Data in JSON-LD on Cloudant to expose database content as Linked Data.
  9. Build JSON-LD icons from SVGs

    main

    You can generate PNG versions of the icons from the source SVGs using the provided Makefile. Use make to build the assets and make clean to remove old PNG files.

    # To create the icons from SVG
    $ make
    
    # To clean up old pngs
    $ make clean
  10. Contribute to the JSON-LD Test Suite

    main

    To contribute a new test or a fix to an existing one:

    1. Notify the community: Email the JSON-LD mailing list at public-linked-json@w3.org to announce your intention and the purpose of the change.
    2. Clone the repository:
      git://github.com/json-ld/json-ld.org.git
    3. Submit changes: Submit your changes via GitHub pull request or via git format-patch to the public-linked-json@w3.org mailing list.
  11. Create a multi-size favicon.ico

    main

    To create a favicon.ico containing multiple sizes, follow these steps after running make to generate the PNGs:

    1. Open the largest file (json-ld-data-64.png) in GIMP.
    2. Go to File > Open as Layers...
    3. Select the 32px and 16px files.
    4. Export the result as favicon.ico.