La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Introducción a JSON-LD Miguel Ángel García Delgado, Daniel Vila-Suero Facultad de Informática Universidad Politécnica.

Presentaciones similares


Presentación del tema: "Introducción a JSON-LD Miguel Ángel García Delgado, Daniel Vila-Suero Facultad de Informática Universidad Politécnica."— Transcripción de la presentación:

1 Introducción a JSON-LD Miguel Ángel García Delgado, Daniel Vila-Suero magarcia@fi.upm.es, dvila@fi.upm.es Facultad de Informática Universidad Politécnica de Madrid Campus de Montegancedo s/n 28660 Boadilla del Monte, Madrid, Spain Este obra está bajo una licencia de Creative Commons Reconocimiento-NoComercial- CompartirIgual 4.0 Internacional.

2 Contenidos 1.Introducción a JSON-LD 2.De JSON a JSON-LD 3.De RDF a JSON-LD 2

3 Contenidos 1.Introducción a JSON-LD 2.De JSON a JSON-LD 3.De RDF a JSON-LD 3

4 Introducción a JSON-LD (I) JSON-LD es una serialización Linked Data basado en JSON Recomendación de W3C dentro del RDF Working Group Ligero, fácil de entender por los desarrolladores Idea principal: define un contexto que permite interpretar la información del documento { "@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" }, "name": "Manu Sporny", "homepage": "http://manu.sporny.org/" }

5 Introducción a JSON-LD (II) Elementos principales:  @context  @id  @type  @value  @language

6 Contenidos 1.Introducción a JSON-LD 2.De JSON a JSON-LD 3.De RDF a JSON-LD 6

7 De JSON a JSON-LD (I) Para el ejemplo, utilizaremos la definición de un punto wifi con su punto geométrico { "id":79, "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

8 De JSON a JSON-LD (II) El primer paso es añadir el contexto y definir la prefijo base del mismo, en este caso, "zar" { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/" }, "id":79, "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

9 De JSON a JSON-LD (III) Después definimos la uri del recurso y su tipo { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

10 De JSON a JSON-LD (IV) Vamos a definir los campos title y tipo como rdfs:label y el campo estado como rdfs:comment { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

11 De JSON a JSON-LD (V) Ahora definimos el campo lastUpdated como vcard:rev { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment ", "lastUpdated":"vcard:rev" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

12 De JSON a JSON-LD (V) Por último, definimos la relación geometría { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment ", "lastUpdated":"vcard:rev", "geometry" : "geo:geometry", "coordinates" : "geo:lat" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "@id":"http://www.zaragoza.es/api/recurso/geometria/676107.8_4613387.37", "@type":"geo:Point", "coordinates":[676107.8,4613387.37] }

13 De JSON a JSON-LD (VI) JSON vs JSON-LD { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment ", "lastUpdated":"vcard:rev", "geometry" : "geo:geometry", "coordinates" : "geo:lat" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "@id":"http://www.zaragoza.es/api/recurso/geometria/676107.8_4613387.37", "@type":"geo:Point", "coordinates":[676107.8,4613387.37] } { "id":79, "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "type":"Point", "coordinates":[676107.8,4613387.37] }

14 Contenidos 1.Introducción a JSON-LD 2.De JSON a JSON-LD 3.De RDF a JSON-LD 14

15 De RDF a JSON-LD (I) Para el ejemplo, utilizaremos la definición de un punto wifi con su punto geométrico <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" > 79 AvdCesarAugusto-RamonYCajal Rap En servicio","servicios":"<p>SSID. \"Wizi de Milla Digital\"</p><ul><li>Básico: 512 Kbps / 256 Kbps</li><li>Premium: 1 Mbps / 256 Kbps</li></ul> 2012-10-05 4613387.37 676107.8

16 De RDF a JSON-LD (II) Empezamos creando el contexto básico con los prefijos del RDF, creamos el campo id del recurso y definimos el tipo. { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/" }

17 De RDF a JSON-LD (III) Añadimos los campos rdfs:label como title y tipo y el campo rdfs:comment como estado. { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps " }

18 De RDF a JSON-LD (IV) Añadimos el campo vcard:rev como lastUpdated. { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment", "lastUpdated":"vcard:rev" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z" }

19 De RDF a JSON-LD (V) Añadimos el recurso geometría y la relación con el recurso principal { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment", "lastUpdated":"vcard:rev", "geometry" : "geo:geometry", "lat" : "geo:lat", "long" : "geo:long" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia-tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "@id":"http://www.zaragoza.es/api/recurso/geometria/676107.8_4613387.37", “@type":“geo:Point", "lat":676107.8, "long":4613387.37 }

20 De RDF a JSON-LD (VI) Añadimos el recurso geometría y la relación con el recurso principal { "@context": { "zar": "http://www.zaragoza.es/api/catalogo/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "vcard": "http://www.w3.org/2006/vcard/ns#", "geo":"http://www.w3.org/2003/01/geo/wgs84_pos#", "title": "rdfs:label", "tipo": "rdfs:label", "estado": "rdfs:comment", "lastUpdated":"vcard:rev", "geometry" : "geo:geometry", "lat" : "geo:lat", "long" : "geo:long" }, "@id": "http://www.zaragoza.es/api/recurso/ciencia- tecnologia/punto-wifi/79", "@type": "zar:ciencia-tecnologia/punto-wifi/", "title":"AvdCesarAugusto-RamonYCajal", "tipo":"Rap", "estado":"En servicio","servicios":" SSID. \"Wizi de Milla Digital\" Básico: 512 Kbps / 256 Kbps Premium: 1 Mbps / 256 Kbps ", "lastUpdated":"2011-10-31T00:00:00Z", "geometry":{ "@id":"http://www.zaragoza.es/api/recurso/geometria/67 6107.8_4613387.37", “@type":“geo:Point", "lat":676107.8, "long":4613387.37 } <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" > 79 AvdCesarAugusto-RamonYCajal Rap En servicio","servicios":"<p>SSID. \"Wizi de Milla Digital\"</p><ul><li>Básico: 512 Kbps / 256 Kbps</li><li>Premium: 1 Mbps / 256 Kbps</li></ul> 2012-10-05 4613387.37 676107.8

21 ¿Dudas? ¿Preguntas? Muchas gracias. Miguel Ángel García Delgado magarcia@fi.upm.es Facultad de Informática Universidad Politécnica de Madrid Campus de Montegancedo s/n 28660 Boadilla del Monte, Madrid, Spain


Descargar ppt "Introducción a JSON-LD Miguel Ángel García Delgado, Daniel Vila-Suero Facultad de Informática Universidad Politécnica."

Presentaciones similares


Anuncios Google