Beruflich Dokumente
Kultur Dokumente
Septiembre 2014
License
This work is licensed under the Creative Commons
Attribution Non Commercial Share Alike License
You are free:
- to Share to copy, distribute and transmit the work
- to Remix to adapt the work
CC BY-NC-SA
Septiembre 2014
ndice
Introduccin general
RDF
- Componentes de RDF
- Serializacin de RDF
RDF Schema
- Componentes de RDFS
- Serializacin de RDFS
XML
Esquema
Datos
RDF(S)
RDF Schema
RDF
CC BY-NC-SA
Septiembre 2014
Source: http://w3.org/DesignIssues/diagrams/sweb-stack/2006a.png
ndice
Introduccin general
RDF
- Componentes de RDF
- Serializacin de RDF
RDF Schema
- Componentes de RDFS
- Serializacin de RDFS
CC BY-NC-SA
Septiembre 2014
Componentes de RDF
is member of
26 December 1975
http://www.oeg-upm.net/
7
26 December 1975
Ral
is member of
has web page
http://www.oeg-upm.net/
CC BY-NC-SA
Septiembre 2014
Literales RDF
Los objetos de las tripletas pueden ser literales (cadenas de
caracteres)
- El sujeto y el predicado son siempre recursos
1975-12-26^^xsd:date
Ral
is member of
has web page
http://www.oeg-upm.net/
10
CC BY-NC-SA
Septiembre 2014
11
Authority
Path
Query
Fragment
http://www.oeg-upm.net/People#Raul
http://www.oeg-upm.net/Properties#hasBirthDate 1975-12-26^^xsd:date
http://www.oeg-upm.net/Properties#isMemberOf
http://www.oeg-upm.net/Properties#hasWebPage
http://www.oeg-upm.net/Organization#OEG
http://www.oeg-upm.net/
12
CC BY-NC-SA
Septiembre 2014
URI
people
http://www.oeg-upm.net/People#
organization
http://www.oeg-upm.net/Organization#
properties
http://www.oeg-upm.net/Properties#
rdf
http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs
http://www.w3.org/2000/01/rdf-schema#
xsd
http://www.w3.org/2001/XMLSchema#
properties:hasFullName
people:Raul
1975-12-26^^xsd:date
properties:hasBirthDate
properties:isMemberOf
organization:OEG
properties:hasWebPage
http://www.oeg-upm.net/
13
Clasificando recursos
La propiedad rdf:type se usa para clasificar recursos
en categoras/clases
category:Person
rdf:type
people:Raul
Clases
category:Animal
rdf:type
people:Oscar
rdf:type
people:Missy
rdf:type
people:Fantasma
Instancias
properties:hasFullName
rdf:type
rdf:type
14
CC BY-NC-SA
Septiembre 2014
Nodos en blanco
Valores de propiedades estructuradas
En ocasiones, se utilizan estructuras de datos ms
complejas que las tripletas (aunque todo se sigue
reduciendo a tripletas)
Esta URI intermedia
realmente no necesita
tener un nombre especfico
properties:hasFullName
people:Raul
properties:firstName
properties:lastName
Ral
Garca Castro
15
Contenedores RDF
Describen grupos de cosas
- Un libro fue creado por varios autores
- Una clase es impartida por varias personas
- etc.
rdf:type
people:Raul
rdf:Seq
rdf:_1
rgarcia@fi.upm.es
rdf:_2
r.garcia@upm.es
16
CC BY-NC-SA
Septiembre 2014
Colecciones en RDF
Grupos de cosas representadas como una lista
estructurada
- A container with limits
rdf:first
university:Course1
people:Raul
rdf:next
rdf:first
people:Oscar
rdf:next
rdf:nil
17
Reificacin en RDF
Tripletas en RDF sobre otras tripletas en RDF
- Ral cree que la fecha de nacimiento de Oscar es el 2 de febrero de
1976 y que su direccin de correo electrnico es ocorcho@fi.upm.es
people:Raul
properties:hasEmailAddress
ocorcho@fi.upm.es
properties:hasBirthDate
1976-02-02^^xsd:date
Reificacin en RDF
- Permite expresar creencias (y otras modalidades)
- Permite expresar modelos de confianza, firmas digitales, etc.
- Permite expresar metadatos sobre metadatos
18
CC BY-NC-SA
Septiembre 2014
product:hasWeight
product:Item1
rdf:value
2.4^^xsd:float
units:hasWeightUnit
units:Kilogram
19
Propiedades
Individuos
Classification
rdf:Property
rdf:type
Containers
rdf:Bag
rdf:Seq
rdf:Alt
Collections
rdf:List
rdf:first
rdf:nil
rdf:rest
Reification
rdf:Statement
rdf:subject
rdf:predicate
rdf:object
Values
rdf:XMLLiteral
rdf:value
20
CC BY-NC-SA
10
Septiembre 2014
Serializaciones en RDF
RDF/XML (www.w3.org/TR/rdf-syntax-grammar/)
Turtle (http://www.w3.org/TR/turtle/)
N-Triples (http://www.w3.org/TR/n-triples/)
TriG (http://www.w3.org/TR/trig/)
RDFa (http://www.w3.org/TR/xhtml-rdfa-primer/)
JSON-LD (http://www.w3.org/TR/json-ld/)
N-Quads (http://www.w3.org/TR/n-quads/)
21
people:Oscar
people:hasName
people:hasColleague
people:Asun
people:Raul
people:hasHomePage
http://www.oeg-upm.net/
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:person="http://www.ontologies.org/ontologies/people#"
xmlns="http://www.oeg-upm.net/ontologies/people#"
xml:base="http://www.oeg-upm.net/ontologies/people">
<rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasHomePage"/>
<rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasColleague"/>
<rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasName"/>
<rdf:Description rdf:about="#Raul"/>
<rdf:Description rdf:about="#Asun">
<person:hasColleague rdf:resource="#Raul"/>
<person:hasHomePage>http://www.fi.upm.es</person:hasHomePage>
</rdf:Description>
<rdf:Description rdf:about="#Oscar">
<person:hasColleague rdf:resource="#Asun"/>
<person:hasName>Oscar Corcho Garca</person:hasName>
</rdf:Description>
</rdf:RDF>
22
CC BY-NC-SA
11
Septiembre 2014
people:Oscar
people:hasName
people:hasColleague
people:Asun
people:Raul
people:hasHomePage
http://www.oeg-upm.net/
23
24
CC BY-NC-SA
12
Septiembre 2014
Exercise
Objective
Get used to the different syntaxes of RDF
Tasks
Take the text of an RDF file and create its corresponding graph
Take an RDF graph and create its corresponding RDF/XML and Turtle files
Note: you can use http://rdf.greggkellogg.net/distiller to check them
25
26
CC BY-NC-SA
13
Septiembre 2014
Measurement8401
Sensor029
hasTemperature
Class01
includes
29
atTime
2010-06-12T12:00:12
Computer101
hasOwner
User10A
hasName
Pedro
28
ndice
Introduccin general
RDF
- Componentes de RDF
- Serializacin de RDF
RDF Schema
- Componentes de RDFS
- Serializacin de RDFS
30
CC BY-NC-SA
14
Septiembre 2014
RDF Schema
Ampla RDF
Permite la descripcin de clases de recursos y sus propiedades
Aade restricciones a los modelos
rdfs:member
rdfs:seeAlso
rdfs:isDefinedBy
rdf:value
rdfs:label
rdfs:comment
rdfs:Resource
rdf:first
rdf:subject
rdf:predicate
rdf:object
rdf:rest
rdf:type
rdfs:subclassOf
rdfs:subPropertyOf
rdf:List
rdf:Statement
rdfs:Container
rdf:Property
rdfs:Class
rdfs:Literal
rdfs:domain
rdfs:range
rdf:Bag
rdf:Seq
rdf:Alt
rdf:nil
rdfs:ContainerMembershipProperty
rdfs:Datatype
rdf:XMLLiteral
rdfs:member
rdf:_1
rdf:_2
rdf:_3
31
Descripcin de clases
RDF(S)
rdfs:Class
rdf:type
Vocabulario
person:Person
rdfs:subClassOf
person:Professor
rdfs:subClassOf
person:FullProfessor
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
Datos
person:hasColleague
data:Oscar
person:hasName
person:hasColleague
data:Asun
data:Raul
person:hasHomePage
http://www.oeg-upm.net/
32
CC BY-NC-SA
15
Septiembre 2014
Descripcin de individuos
RDF(S)
rdfs:Class
rdf:type
Vocabulario
person:Person
rdfs:subClassOf
person:Professor
rdfs:subClassOf
person:FullProfessor
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
rdf:type
Datos
rdf:type
person:hasColleague
data:Oscar
rdf:type
person:hasColleague
data:Asun
person:hasHomePage
person:hasName
data:Raul
http://www.oeg-upm.net/
33
Descripcin de propiedades
RDF(S)
rdf:Property
rdfs:Class
rdf:type
Vocabulario
rdfs:range
rdfs:Literal
rdf:type
rdfs:domain
person:Person
person:hasName
rdfs:subClassOf
rdfs:domain
rdfs:range
person:Professor
person:hasColleague
rdfs:subClassOf
rdfs:domain
person:FullProfessor
person:hasHomePage
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
rdf:type
Datos
rdf:type
person:hasColleague
data:Oscar
person:hasName
rdf:type
person:hasColleague
data:Asun
data:Raul
person:hasHomePage
http://www.oeg-upm.net/
34
CC BY-NC-SA
16
Septiembre 2014
Anotacin de recursos
rdfs:label
rdfs:label
data:Raul
rdfs:comment
Ral Garca
Ral
rdfs:seeAlso
http://delicias.dia.fi.upm.es/~rgarcia/
rdfs:isDefinedBy
http://delicias.dia.fi.upm.es/~rgarcia/foaf.rdf
35
Propiedades
Individuos
Classification
rdfs:Resource
rdfs:subClassOf
rdfs:Class
Properties
rdfs:domain
rdfs:range
rdfs:subPropertyOf
Datatypes
rdfs:Literal
rdfs:Datatype
Containers
rdfs:Container
rdfs:member
rdfs:ContainerMembershipProperty
Annotation
rdfs:label
rdfs:comment
rdfs:seeAlso
rdfs:isDefinedBy
36
CC BY-NC-SA
17
Septiembre 2014
37
38
CC BY-NC-SA
18
Septiembre 2014
a is equivalent to rdf:type
39
:Person a rdfs:Class .
:Professor a rdfs:Class ;
rdfs:subClassOf :Person .
:FullProfessor a rdfs:Class ;
rdfs:subClassOf :Professor .
:AssociateProfessor a rdfs:Class ;
rdfs:subClassOf :Professor .
:InterimAssociateProfessor a rdfs:Class ;
rdfs:subClassOf :AssociateProfessor .
:Asun a :FullProfessor ;
:hasHomePage "http://www.fi.upm.es" ;
:hasColleague :Raul .
:Oscar a :AssociateProfessor ;
:hasName "Oscar Corcho Garca" ;
:hasColleague :Asun .
:Raul a :InterimAssociateProfessor .
a is equivalent to rdf:type
40
CC BY-NC-SA
19
Septiembre 2014
41
42
CC BY-NC-SA
20
Septiembre 2014
Clases
Instancias
Podemos hacer instancias de instancias?
Subclase de
Propiedades de instancia
Propiedades de clase
Dominios y rangos (asociados a clases o generales)
Conocimiento disjunto
Conocimiento exhaustivo
Reificacin para relaciones n-arias
Negacin
43
RDF(S) limitations
RDFS too weak to describe resources in sufficient detail
- No localised range and domain constraints
Cant say that the range of hasChild is person when applied to
persons and elephant when applied to elephants
- No existence/cardinality constraints
Cant say that all instances of person have a mother that is also a
person, or that persons have exactly 2 parents
- No boolean operators
Cant say or, not, etc.
44
CC BY-NC-SA
21
Septiembre 2014
Multilenguaje:
- Redland RDF Libraries (C, Perl, PHP, Python and Ruby):
http://librdf.org
Java:
- Jena: http://jena.apache.org/
- Sesame: http://openrdf.callimachus.net/
PHP:
Python:
- RDFLib: https://github.com/RDFLib
- Pyrple: http://infomesh.net/pyrple/
45
Ejercicio
Objetivo
Entender las caractersticas de RDF(S) para implementar
vocabularios y datos, incluyendo sus limitaciones
Tareas
A partir de una descripcin de dominio, crear el grafo RDF(S)
Primero incluir slo el vocabulario del dominio
Despus incluir referencias a RDF y a los vocabularios RDFS
46
CC BY-NC-SA
22
Septiembre 2014
El Lenguaje de Consultas
SPARQL 1.1
Ral Garca-Castro, Oscar Corcho
Facultad de Informtica, Universidad Politcnica de Madrid
Campus de Montegancedo sn, 28660 Boadilla del Monte, Madrid
http://www.oeg-upm.net
ocorcho@fi.upm.es
CC BY-NC-SA
23
Septiembre 2014
Aplicacin
Consultas en SQL
Consultas en SPARQL
Base de
datos
relacional
RDF(S)
OWL
50
data:Oscar
person:hasColleague
data:Asun
person:hasName
data:Raul
person:hasHomePage
http://www.oeg-upm.net/
data:Raul
- Resultado: data:Asun
51
CC BY-NC-SA
24
Septiembre 2014
data:Asun
data:Oscar
- Resultado: person:hasColleague
data:Oscar
person:hasHomePage
- Resultado: http://www.oeg-upm.net/
52
... Y un Protocolo
http://.../qps?query-lang=http://www.w3.org/TR/rdf-sparql-query/
&graph-id=http://planetrdf.com/bloggers.rdf&query=PREFIXfoaf:
<http://xmlns.com/foaf/0.1/...
54
CC BY-NC-SA
25
Septiembre 2014
Conclusiones SPARQL
Servicios del protocolo SPARQL
Ejemplos:
Proyecto
Conclusin
DBpedia
http://dbpedia.org/sparql
AragoDBpedia
http://opendata.aragon.es/sparql
Biblioteca Nacional
http://datos.bne.es/
http://environment.data.gov.uk/lab/
sparql.html
Musicbrainz
http://dbtune.org/musicbrainz/snorql/
55
56
CC BY-NC-SA
26
Septiembre 2014
57
58
CC BY-NC-SA
27
Septiembre 2014
Query result:
title
"SPARQL Tutorial"
foaf:name
foaf:mbox
foaf:name
foaf:mbox
foaf:mbox
PREFIX
SELECT
WHERE
{ ?x
?x
<http://xmlns.com/foaf/0.1/> .
"Johnny Lee Outlaw" .
<mailto:jlow@example.com> .
"Peter Goodguy" .
<mailto:peter@example.org> .
<mailto:carol@example.org> .
foaf:
<http://xmlns.com/foaf/0.1/>
?name ?mbox
foaf:name ?name .
foaf:mbox ?mbox }
name
mbox
<mailto:jlow@example.com>
"Peter Goodguy"
<mailto:peter@example.org>
60
CC BY-NC-SA
28
Septiembre 2014
Literales RDF
@prefix
@prefix
@prefix
@prefix
:x
:y
:z
dt:
ns:
:
xsd:
ns:p
ns:p
ns:p
<http://example.org/datatype#> .
<http://example.org/ns#> .
<http://example.org/ns#> .
<http://www.w3.org/2001/XMLSchema#> .
"cat"@en .
"42"^^xsd:integer .
"abc"^^dt:specialDatatype .
<http://example.org/ns#x>
v
SELECT ?v WHERE { ?v ?p 42 }
<http://example.org/ns#y>
SELECT ?v WHERE { ?v ?p "abc"^^<http://example.org/datatype#specialDatatype> }
v
<http://example.org/ns#z>
61
Nodos en blanco
@prefix foaf:
_:a
_:b
foaf:name
foaf:name
<http://xmlns.com/foaf/0.1/> .
"Alice" .
"Bob" .
PREFIX foaf:
<http://xmlns.com/foaf/0.1/>
SELECT ?x ?name
WHERE { ?x foaf:name ?name }
name
_:c
"Alice"
_:d
"Bob"
name
_:r
"Alice"
_:s
"Bob"
62
CC BY-NC-SA
29
Septiembre 2014
Grupos de patrones
PREFIX foaf:
<http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox
WHERE { { ?x foaf:name ?name . }
{ ?x foaf:mbox ?mbox . }
}
SELECT ?x
WHERE {}
PREFIX foaf:
<http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox
WHERE { { ?x foaf:name ?name . }
{ ?x foaf:mbox ?mbox . FILTER regex(?name, "Smith")}
}
63
<http://xmlns.com/foaf/0.1/> .
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
_:a
_:a
_:a
_:a
rdf:type
foaf:name
foaf:mbox
foaf:mbox
foaf:Person .
"Alice" .
<mailto:alice@example.com> .
<mailto:alice@work.example> .
_:b
_:b
rdf:type
foaf:name
foaf:Person .
"Bob" .
name
mbox
"Alice"
<mailto:alice@example.com>
"Alice"
<mailto:alice@work.example>
Bob"
64
CC BY-NC-SA
30
Septiembre 2014
<http://xmlns.com/foaf/0.1/> .
_:a
_:a
foaf:name
foaf:homepage
"Alice" .
<http://work.example.org/alice/> .
_:b
_:b
foaf:name
foaf:mbox
"Bob" .
<mailto:bob@work.example> .
name
mbox
hpage
"Alice"
<http://work.example.org/alice/>
Bob"
<mailto:bob@work.example>
65
Patrones de alternativas
@prefix dc10:
@prefix dc11:
_:a
_:a
_:b
_:b
_:c
_:c
PREFIX
PREFIX
SELECT
WHERE
<http://purl.org/dc/elements/1.0/> .
<http://purl.org/dc/elements/1.1/> .
dc10:title
dc10:creator
dc11:title
dc11:creator
dc10:title
dc11:title
dc10: <http://purl.org/dc/elements/1.0/>
dc11: <http://purl.org/dc/elements/1.1/>
?title
{ { ?book dc10:title ?title } UNION
{ ?book dc11:title ?title } }
title
"SPARQL Protocol Tutorial"
"SPARQL"
"SPARQL (updated)"
"SPARQL Query Language Tutorial"
SELECT ?x ?y
WHERE { { ?book dc10:title ?x } UNION
{ ?book dc11:title ?y } }
y
"SPARQL (updated)"
"SPARQL Protocol Tutorial"
"SPARQL"
"SPARQL Query Language Tutorial"
title
"SPARQL Protocol Tutorial"
"SPARQL Query Language Tutorial"
66
CC BY-NC-SA
31
Septiembre 2014
graph: http://example.org/foaf/aliceFoaf
foaf:<http://.../foaf/0.1/> .
rdf:<http://.../1999/02/22-rdf-syntax-ns#> .
rdfs:<http://.../2000/01/rdf-schema#> .
_:a
_:a
_:a
foaf:name
foaf:mbox
foaf:knows
"Alice" .
<mailto:alice@work.example> .
_:b .
_:b
_:b
_:b
_:b
foaf:name
foaf:mbox
foaf:nick
rdfs:seeAlso
"Bob" .
<mailto:bob@work.example> .
"Bobby" .
<http://example.org/foaf/bobFoaf> .
<http://example.org/foaf/bobFoaf>
rdf:type
foaf:PersonalProfileDocument .
# Named
@prefix
@prefix
@prefix
_:z
_:z
_:z
graph: http://example.org/foaf/bobFoaf
foaf:<http://.../foaf/0.1/> .
rdf:<http://.../1999/02/22-rdf-syntax-ns#> .
rdfs:<http://.../2000/01/rdf-schema#> .
foaf:mbox
rdfs:seeAlso
foaf:nick
<mailto:bob@work.example> .
<http://example.org/foaf/bobFoaf> .
"Robert" .
<http://example.org/foaf/bobFoaf>
rdf:type
foaf:PersonalProfileDocument .
67
src
bobNick
<http://example.org/foaf/aliceFoaf>
"Bobby"
<http://example.org/foaf/bobFoaf>
"Robert"
nick
"Robert"
68
CC BY-NC-SA
32
Septiembre 2014
Filtros y restricciones
@prefix dc:
@prefix :
@prefix ns:
<http://purl.org/dc/elements/1.1/> .
<http://example.org/book/> .
<http://example.org/ns#> .
:book1
:book1
:book2
:book2
dc:title
ns:price
dc:title
ns:price
"SPARQL Tutorial" .
42 .
"The Semantic Web" .
23 .
PREFIX
SELECT
WHERE
dc: <http://purl.org/dc/elements/1.1/>
?title
{ ?x dc:title ?title
FILTER regex(?title, "^SPARQL")
}
PREFIX
SELECT
WHERE
dc: <http://purl.org/dc/elements/1.1/>
?title
{ ?x dc:title ?title
FILTER regex(?title, "web", "i" )
}
PREFIX
PREFIX
SELECT
WHERE
dc: <http://purl.org/dc/elements/1.1/>
ns: <http://example.org/ns#>
?title ?price
{ ?x ns:price ?price .
FILTER (?price < 30.5)
?x dc:title ?title . }
title
"SPARQL Tutorial"
title
"The Semantic Web"
title
price
23
69
Tests de valores
Basado en funciones y operadores XQuery 1.0 y
XPath 2.0
XSD boolean, string, integer, decimal, float, double,
dateTime
Anotaciones <, >, =, <=, >= y != para comparacin de
valores
Aplicable a cualquier tipo
BOUND, isURI, isBLANK, isLITERAL
REGEX, LANG, DATATYPE, STR ()
Cualquier funcin extendida
70
CC BY-NC-SA
33
Septiembre 2014
Modificadores
SELECT ?name
WHERE { ?x foaf:name ?name ; :empId ?emp }
ORDER BY ?name DESC(?emp)
Modificador de proyeccin:
selecciona ciertas variables
SELECT ?name
WHERE
{ ?x foaf:name ?name }
SELECT ?name
WHERE { ?x foaf:name ?name }
LIMIT 20
71
Ejercicio 2
Objetivo
Comprender cmo trabajar con consultas SPARQL
Tareas
Crear un conjunto de consultas SPARQL sobre un vocabulario de ejemplo
http://sandbox.linkeddata.es/sparql
En el grafo: http://sandbox.linkeddata.es/Grado_20122013
76
CC BY-NC-SA
34
Septiembre 2014
Ejemplo de vocabulario
SpatialThing
hasInhabitantNumber
rdfs:Literal
hasNumber
hasStreet
Location
isPlacedIn
rdfs:Literal
Locality
inProvince
PostalAddress
hasAddress
LocationOfInterest
Village
TouristicLocation
Palace
Church
Chapel
Town
City
Establishment
Cathedral
Hotel
Hostel
GuestHouse
77
78
CC BY-NC-SA
35
Septiembre 2014
PhysicalPoint
TransportMedium
Train
hasStop
hasDestination
hasOrigin
SpacialThing
City
isPlacedIn
Locality
inProvince
isCon
Location
hasStreet
hasNumber
Ca
r
Bus
Bycicle
isSupportedBy
through
hasPostalCode
TransportInfrastructure
PostalAddress
Village
hasStretch
Literal
LocationOf
International
Literal
hasBegining
hasEnd
hasSurface
hasInhabitantNumber
OnFoot
Stage
nected
By
Town
Route
Railway
Path
hasAddress
Road
Stretch
Establistioment
Hostel
Touristic
Location
Trach
hasDistance
GuestHouse
Literal
hasDenomination
Literal
Hotel
Service
isProvidedBy
Chapel
Palace
Restauration
Service
providesService
BankService
PostalService
Cathedral
Church
HealthService
SecurityService
84
Ejercicio 2
Objetivo
Comprender cmo trabajar con consultas SPARQL algo ms complejas
Tareas
Crear un conjunto de consultas SPARQL sobre Dbpedia
http://dbpedia.org/sparql
En el grafo por defecto
85
CC BY-NC-SA
36
Septiembre 2014
Consultas a realizar
1. Dame todas las propiedades aplicables a las instancias de la clase Politician
(<http://dbpedia.org/ontology/Politician>)
2. Dame todas las propiedades, exceptuando rdf:type, aplicables a las instancias
de la clase Politician
3. Cuntos valores distintos se pueden encontrar para las propiedades,
exceptuando rdf:type, de las instancias de la clase Politician)?
4. Para cada una de las propiedades, exceptuando rdf:type, aplicables a las
instancias de la clase Politician, dime cuntos valores distintos toman en dichas
instancias.
5. Para cada una de las propiedades, exceptuando rdf:type, aplicables a las
instancias de la clase Politician, dime la media de valores distintos que toman
en dichas instancias.
6. Para cada una de las propiedades, exceptuando rdf:type, aplicables a las
instancias de la clase Politician, dime el mximo nmero de valores distintos
que toman entre todas sus instancias, ordenado de mayor a menor
<<Dicho de otro modo, dime qu propiedades son las ms comunes entre las
instancias de la clase Politician>>
86
Ejercicio 3
Objetivo
Aprender a realizar consultas SPARQL complejas
Tareas
Crear un conjunto de consultas SPARQL sobre un vocabulario real
http://es.dbpedia.org/sparql
90
CC BY-NC-SA
37
Septiembre 2014
Queries avanzadas
1.
2.
3.
4.
5.
6.
Main References
SPARQL 1.1 Overview
http://www.w3.org/TR/sparql11-overview/
SPARQL validator:
http://www.sparql.org/query-validator.html
http://yasgui.laurensrietveld.nl/
SPARQL implementations:
http://esw.w3.org/topic/SparqlImplementations
92
CC BY-NC-SA
38