JSON-LD on google.com

JSON-LD is designed around the concept of a “context” to provide additional mappings from JSON to an  RDF model. The context links object properties in a JSON document to concepts in an Ontology. In order to map the JSON-LD syntax to RDF, JSON-LD allows values to be coerced to a specified type or to be tagged with a language. A context can be embedded directly in a JSON-LD document or put into a separate file and referenced from different documents (from traditional JSON documents via an HTTP Link header.

 

json-ld

 

Specifications

JSON-LD has been designed to be a modular set of specifications. It consists of two base specifications: The JSON-LD Syntax and the JSON-LD API. All other JSON-LD specifications are layered upon the previous two specifications, allowing the community to build experimental extensions on top of the base specifications.

The JSON-LD Syntax

Defines JSON-LD, a JSON-based format to serialize Linked Data. The syntax is designed to easily integrate into deployed systems that already use JSON, and provides a smooth upgrade path from JSON to JSON-LD. It is primarily intended to be a way to use Linked Data in Web-based programming environments, to build interoperable Web services, and to store Linked Data in JSON-based storage engines.

Links to JSON-LD specifications: Latest, 20140116, 20131105, 20130910, 20130630, 20130411, 20130328, 20130222, 20130202, 20121225, 20120930, 20120830, 20120712,20120626, 20120522, 20120426, 20120318, 20120122, 20120112, 20111023, 20111016, 20110911, 20110817, 20110808, 20110803, 20110615, 20110507, 20110201, 20101128,20101024, 20101014, 20100823, 20100529

The JSON-LD API

An Application Programming Interface (API) and a set of algorithms for programmatic transformations of JSON-LD documents. This API defines algorithms for applying and removing JSON-LD contexts.

Links to JSON-LD API specifications: Latest, 20140116, 20131105, 20130910, 20130516, 20130514, 20130411, 20130328, 20121225, 20120930, 20120830, 20120712, 20120626,20120524, 20120426, 20120112, 20111023, 20111016

JSON-LD Framing

JSON-LD Framing allows developers to perform query by example and force a specific tree layout to a JSON-LD document. It allows developers to restructure data retrieved from the Web according to the specific needs of their application. Restructuring JSON-LD data before your application processes it leads to simpler code when processing data from external sources.

Links to JSON-LD Framing specifications: Latest, 20120830

RDF Graph Normalization

RDF describes a graph-based data model for making claims about the world and provides the foundation for reasoning upon that graph of information. At times, it becomes necessary to compare the differences between graphs, digitally sign graphs, or generate short identifiers for graphs via hashing algorithms. This document outlines an algorithm for normalizing RDF graphs such that these operations can be performed on the normalized graphs.

Links to RDF Graph Normalization specifications: Latest, 20111016

JSON-LD RDF API

JSON-LD RDF API describes access methods for transforming and abstract RDF represention into JSON-LD and back.

Links to JSON-LD RDF API specifications: Latest

example Code SPARQL

Example code SPARQL

following below :


PREFIX dcterms: http://purl.org/dc/terms/>
PREFIX owl: http://www.w3.org/2002/07/owl#>
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: http://www.w3.org/2001/XMLSchema#>
PREFIX geo: http://aims.fao.org/aos/geopolitical.owl#>


SELECT * WHERE { ?s rdf:type geo:self_governing . }


PREFIX dcterms: <http://purl.org/dc/terms/&gt;
PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;
PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#&gt;

SELECT * WHERE { ?s rdf:type geo:self_governing . ?s geo:codeISO3 ?code }

PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#&gt;
PREFIX dcterms: <http://purl.org/dc/terms/&gt;
PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;

SELECT ?x WHERE { ?x rdf:type geo:non_self_governing . }

PREFIX abc: <http://aims.fao.org/aos/geopolitical.owl#&gt;
PREFIX dcterms: <http://purl.org/dc/terms/&gt;
PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;

SELECT ?x ?code WHERE { ?x rdf:type abc:non_self_governing . ?x abc:codeGAUL ?code }

PREFIX abc: <http://aims.fao.org/aos/geopolitical.owl#&gt;
PREFIX dcterms: <http://purl.org/dc/terms/&gt;
PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;

SELECT * WHERE { ?s rdf:type abc:non_self_governing . ?s abc:isAdministeredBy ?is }

 

About SPARQL not SQL

query language SPARQL (pronounced “sparkle”)

SPARQL in an SQL -like query language for RDF data, spesified by the RDF Data Acess working group of W3C. it differs from SQL in the following aspects:

  • SPARQL does not contain spesific Data Definition Language (DLL) provisions  because the schemas are represented in both RDFS and OWL as standard RDF graphs, thus requiring no specific language to deal with them.
  • SPARQL is not a Data Modification Language (DML), that is, one cannot insert, delete and update RDF graphs using SPARQL. the major reason for this is that there is still no consensus on the optimal DML design for RDF.

SPARQL support four types of queries:

  1. SELECT queries – return n-tuples of results just like the SELECT queries in SQL
  2. DESCRIBE queries – return an RDF graph. the resulting graph describe the resource, which match the query contraints. Usually, a description of  a resource is considered an RDF-molocule, forming the immediate neighborhood of an URI.
  3. ASK queries- provide positive or negative answer indicating whether or not the query pattern can be satisfied.
  4. CONSTRUCT queries – return an RDF graph constructed by means of the substitution of the variables in the graph template and combining the triples into a single RDF graph by set union.

named graph, is an RDf graph with assigned name in the form of a URI reference. in an extended RDF model, one can deal with multiple named graphs  and describe  the graphs, making statement about them, putting their URIs in subject position. while the original definition of named graphs leaves plenty of room for interpretation, a more concrete definition is provided in the specification of SPARQL.

a SPARQL query is composedof five parts zero or more prefix declarations, a query result clause, zero or more FROM or FROM NAMED clauses, a WHERE clause, and zero or more query modifiers. the optional PREFIX declarations introduce shorcuts for  long IRIs as normally done when working with XML namespace. such prefixes can be used in the WHERE clause.

a SPARQL query can take four forms: SELECT, ASK, CONSTRUCT and DESCRIBE.

The WHERE clause is the core of a SPARQL query. It is specified in terms of a set of triple
patterns. As extensively explained in the following sections, these triple patterns are used
to select the triples composing the result.