JSON-LD (JSON for Linked data) refer to the recommendations of the W3C, embedded linked data in the lightweight JSON Format. We already talked about JSON or JavaScript Object Notation. JSONP is JSON with padding. With JSON, we can easily fetch data and display in format we want, for example here is working feed of my Twitter. Possibly it is known to the reader that we can develop RESTful API for WordPress to get Posts, Post Excerpt as JSON. JSON-LD is used for representing Linked Data, Linked Data describes a method of publishing structured data to allow the web services and web applications to embed their data JSON format usually within HTML, for building Semantic Web.
Table of Contents |
Introduction to JSON-LD
Development of JSON-LD began in 2010 and in January 2014 adoption of the first version was published in documents. For the web publishing industry, embedding JSON data into HTML is interesting because it so the associated with simple usage of toolkit to retrieve data from databases. The developers tried to orient it as JSON is been used for data exchange. This is the conversion of software from JSON to JSON-LD intended to be as simple as possible.
---
JSON-LD behaves similar to JSON, HTML + RDFa, HTML Microdata or a micro format, programs which uses the conventional JSON are practically not affected by the extension to JSON-LD. At the same time it also allows for the enrichment (to become machine-interpretable), importance stands as the other method for semantic annotation.
However, the traditional of use of JSON is not the interface between man and machine, but the machine between each other. The separation of (typographic) markup and semantic data can even represent a simplification. JSON replaced XML off to XHTML. XML – Parser, RDF storage and SPARQL – are sometimes referred to as “overhead perceived in the Web environment”. Even handy formats from the RDF environment are hardly used as a base format in web protocols. JSON-LD is intended to solve the problems that could not be resolved with the other formats.
Definition and Classification of JSON-LD
Unlike the other serialization formats for Linked Data and RDF, JSON-LD remains in its flat shape preference entity. JSON-LD includes (compared with JSON) a standard convention for using IRIs (external) references and easy links (similar to extensions such as JSON Reference, but without the interpretation of the fragment identifier as JSON Pointer; JSON-LD follows RDF practices from this point of usage. It can also represent standardized data types and schema information from the RDF environment. It is true that JSON-LD has no own language or HTTP applications are available (such as JSON HAL or JSON Hyper Schema). However, such vocabularies for service or interface description includable. JSON-LD is not compatible with (the older) RDF / JSON. See also: Section predecessors and alternatives. Example :
1 2 3 4 5 6 7 8 9 10 11 | { "id": "Subject (IRI)", "Predicate (IRI)": { "id": "Object (IRI)" } "Predicate (IRI)": Object (literal), "Predicate (IRI)": [ Object, ... ] } |
Syntax of JSON-LD
Regarding the syntax of JSON applies – each JSON-LD-text is a valid JSON text (according to RFC 4627 ). Representing JSON texts conversely valid JSON-LD, the subject is mainly the first document. A JSON-LD-text must include a JSON object or a JSON array of such objects while newer versions of JSON and JSON parser also allow other JSON values ‹.
All names and key the name-value pairs must be unique per object. It must also be dispensed with the empty string as a name, because not all JSON implementations can handle this. All other syntax elements of JSON-LD can be realized via special JSON strings (called keywords ) that contains the character @
and thirteen previously (context,id,value,language, @ type,container,list,set,reverse,Index,Base,vocal,graph) known keywords. Particular importance is the “:” character string to predict the location (thus context-dependent than compact IRIs can be interpreted as an absolute IRI or as long as a custom definition for the string as a whole, this does not override).
In principle, the order of the pairs does not matter. Based on this, grammar includes various types of JSON objects (node ‹‹object, object value, object list, set object, language map, index map and context definition).
The basic and advanced concepts of JSON-LD in non-normative sections introduced by means of examples. The most formal definition consists of about eighty normative sentences in English.
Processing of JSON-LD
Regardless of the source of a JSON-LD-text, the same data can be interpreted as JSON-LD (in compact form) and expanded before being processed or parsed only as a simple JSON (as before migrating from JSON by JSON-LD). Various modules can also handle this differently. Example of a JavaScript environment (e.g. web browser ) :
1 2 3 4 5 | // JSON text in the variable data // Module A (original app without awareness of Linked Data) var legacy = JSON. parse ( data ) // Module B (later extension for Semantic Web) var advanced = ( new JsonLdProcessor ) . expand ( JSON. parse ( data )) |
To embed JSON-LD in the HTML script element is recommended:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <script type="application/ld+json" id="json-ld-data"> { "@context": { "name": "http://xmlns.com/foaf/0.1/name", "homepage": { "@id": "http://xmlns.com/foaf/0.1/workplaceHomepage", "@type": "@id" }, "Person": "http://xmlns.com/foaf/0.1/Person" }, "@id": "http://abhishekghosh.pro", "@type": "Person", "name": "Abhishek Ghosh", "homepage": "https://thecustomizewindows.com/" } </script> |
As for the vocabularies, we can use FOAF, Schema.org.
Tagged With json hyper schema alternatives , json-ld