3. Summary
Introduction
Ontologies
OWL and RDF.
QualiPSo: Information management
Semantic Queries
04/09/12 Ontologies and Semantic 3
4. Introduction
Definition:
“ Ontology is the philosophical study of the nature of being,
existence or reality in general, as well as of the basic
categories of being and their relations. Traditionally listed
as a part of the major branch of philosophy known as
metaphysics, ontology deals with questions concerning
what entities exist or can be said to exist, and how such
entities can be grouped, related within a hierarchy, and
subdivided according to similarities and differences.” -
Wikipedia
04/09/12 Ontologies and Semantic 4
5. Introduction
Computers engineering vision:
“Ontology is a formal representation of a set of
concepts within a domain and the relationships
between those concepts. It is used to reason
about the properties of that domain, and may be
used to define the domain.” - Wikipedia
How to make an standard, in order to define the parts of
a concept.
04/09/12 Ontologies and Semantic 5
6. Ontologies
Vocabularies to define entities and concepts.
For example, the ontology of an email or a a tree.
Knowledge representation.
Knowledge understandable by machines and
computer programs.
Similar to object orientation paradigm.
04/09/12 Ontologies and Semantic 6
7. Ontologies
This is not understandable by a machine:
Car Colour Price
Ford Fiesta Blue 30
Ferrari F40 Red 10
04/09/12 Ontologies and Semantic 7
8. Ontologies
Information clasified and structured:
I want to rent a Ford Fiesta car by 60€
Class car -> Model -> Ford Fiesta
Class car -> Colour -> Blue
Class Money -> Type -> Coin
Class Money -> Value -> 60
Class Money -> Coin -> euro
04/09/12 Ontologies and Semantic 8
9. Ontologies
Something understandable by a machine:
<rdf:RDF
xmlns:rdf="http://w.o/1999/02/22-rdf-
syntax-ns#"
xmlns:coche="http://car/spec/">
<rdf:Description
rdf:about="http://car/FordFiesta”>
<car:colour> blue </car:colour>
<car:price> 30 </car:price>
</rdf:Description>
</rdf:RDF>
04/09/12 Ontologies and Semantic 9
10. Ontologies
And relations...
<rdf:RDF
xmlns:rdf="http://w.o/1999/02/22-rdf-
syntax-ns#"
xmlns:coche="http://car/spec/">
<rdf:Description
rdf:about="http://car/FordFiesta”>
<car:colour> blue </car:colour>
<car:price> 30 </car:price>
<manufacturer:id>
http://manufacturer/FordSpain
</manufacturer:id>
</rdf:Description>
</rdf:RDF>
04/09/12 Ontologies and Semantic 10
11. Ontologies
An ontology should allow to define all the
information of a concept:
Is this possible?
Standards -> Competency vs Community
Different persons will define concepts in very different
ways.
Are we able to define the world around us?
Specific concepts
Tree: { Root, Trunk, type... }
Difficult to define abstract concepts
04/09/12 Ontologies and Semantic 11
12. Ontologies
Ontologies are useful when...
You can define enough information about a concept.
Used by many people/projects/communities
Widely spread <-> Standard <-> Community
04/09/12 Ontologies and Semantic 12
13. Ontologies: FOAF
Friend of a Friend: http://www.foaf-project.org/
People
Activities
People relations: People living in Europe, common
friends
<foaf:Person rdf:ID=”PeterParker”>
<foaf:name>Peter Parker</foaf:name>
<foaf:gender> Male </foaf:gender>
<foaf:title> Mr </foaf:title>
<foaf:givenname>Pet</foaf:givenname>
<foaf:knows rdf:nodeID="harry"/>
</foaf:Person>
04/09/12 Ontologies and Semantic 13
15. Ontologies: SIOC
<sioc:Post rdf:about="http://..../post/7#post">
<dc:title>Example post</dc:title>
<sioc:has_creator>
<sioc:User rdf:about="person/pepe">
<sioc:name>John</sioc:name>
</sioc:User>
</sioc:has_creator>
<sioc:content>there was a time</sioc:content>
<sioc:has_reply>
<sioc:Post rdf:about="post/3#post" />
</sioc:has_reply>
</sioc:Post>
04/09/12 Ontologies and Semantic 15
16. Ontologies: Mixing
To define a concept (resource), usually, you dont
have enough with only one ontology
<foaf:Person rdf:ID=”PeterParker”>
<foaf:name>Peter Parker</foaf:name>
<foaf:gender> Male </foaf:gender>
<foaf:title> Mr </foaf:title>
<foaf:givenname> Peter </foaf:givenname>
<foaf:knows rdf:nodeID="harry"/>
<sioc:email>spiderman@gmail.com</sioc:email>
</foaf:Person>
04/09/12 Ontologies and Semantic 16
17. RDF
Resource Description Framework
Classes
A ressource with the property rdf:type Class
OOP and abstract charcteristics of an object,
properties and behaviors
RDF class does not define behaviors. It is a data
model
Resource Description Framework
Subject, predicate y object
Subject -> Resource (Jose)
04/09/12 Ontologies and Semantic 17
20. RDF: Schemas
Schemas to define the namespaces of the
resources
Property names must be associated to schemas
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description about="http://www.cs.vassar.edu/~ide/rdf/">
<dc:creator>Nancy Ide</dc:creator>
</rdf:Description>
</rdf:RDF>
04/09/12 Ontologies and Semantic 20
22. RDF/XML
Foaf: friend of a friend ontology:
http://http://xmlns.com/foaf/spec/
<rdf:RDF
xmlns:rdf="http://w.o/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<rdf:Description rdf:about="http://es.person/jose">
<rdf:type>http://xmlns.com/foaf/spec/#Person</rdf:type>
<foaf:has> car </foaf:has>
<foaf:friend_of> http://es.person/jose
</foaf:friend_of>
</rdf:Description>
</rdf:RDF>
04/09/12 Ontologies and Semantic 22
23. RDF/XML
You can use the resource type as an element name.
Abbreviated RDF syntax
<rdf:RDF
xmlns:rdf="http://w.o/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Person rdf:about="http://es.person/jose">
<foaf:has> car </foaf:has>
<foaf:friend_of> http://es.person/jose
</foaf:friend_of>
</foaf:Person>
</rdf:RDF>
04/09/12 Ontologies and Semantic 23
24. RDF/XML... but triplets
Where are the triplets?
<foaf:Group rdf:about="http://groups/ILRT">
<foaf:name>ILRT staff</foaf:name>
<foaf:member>
<foaf:Person>
<foaf:name>Martin Poulter</foaf:name>
<foaf:workplaceHomepage
rdf:resource="http://www.ilrt.bris.ac.uk/"/>
</foaf:Person>
</foaf:member>
</foaf:Group>
04/09/12 Ontologies and Semantic 24
27. RDF
Extensibility!!!!!! How do you extend the
properties in your data model?
If you have a DDBB? Change tables, queries, inserts,
update and modify. A nightmare.
OOP. New properties in your class, incompatibility.
RDF: add new triplets to the resources using new
properties. Nothing changes.
See example of Tutorial Ivan Herman (pag 55)
04/09/12 Ontologies and Semantic 27
29. OWL
Ontology Web Language
Markup language in order to publish and share
information using ontologies.
Extension of RDF/XML
Classes and relations
Terminology
Instance: object
Class: collection of objects. Description concept. All
classes maybe a subclass of another (base: Thing)
04/09/12 Ontologies and Semantic 29
Properties: A property is a directed binary relation
30. OWL
Terminology
Classes
Descriptions: property restrictions, intersections, unions,
constraints...
Axioms: subClassOf, equivalentClass
have a range which is the class Person
04/09/12 Ontologies and Semantic 30
36. OWL
Terminology
Properties: A property is a directed binary relation
that specifies class characteristics
Datatype properties: modelName (String datatype) is the
property of Manufacturer class
Object properties: ownedBy may be an object type
property of the Vehicle class and may have a range
which is the class Person
04/09/12 Ontologies and Semantic 36
39. QualiPSo
“Issues” in OpenSource projects
Huge amount of data in different information sources
Heterogeneous information
Information neither classified nor structured
No relations between data in different information
sources
Outdated forges
04/09/12 Ontologies and Semantic 39
40. QualiPSo – Information
management
Relations between different information sources.
Extractors searching for relations and then they put
marks of meta-info using ontologies.
Relations searching for patterns: #bug 396
Some relations:
Bugs -> commits -> lines of code
Bugs -> emails
Docs -> emails
04/09/12 Ontologies and Semantic 40
41. Semantic Queries (SPARQL)
SPARQL:
SPARQL Protocol and RDF Query Language
Queries language
http://sparql.org/query.html
PREFIX dc:
<http://purl.org/dc/elements/1.1/>
SELECT ?title
WHERE
{
<http://example.org/books> dc:title ?title
}
04/09/12 Ontologies and Semantic 41
42. Examples
Commit related with bugs:
PREFIX rdf: <http://.../-rdf-syntax-ns#>
PREFIX
relation:<"http://www.q.org/ont/qr#">
PREFIX qvc:<"http://www.q.org/ont/qvc#">
SELECT ?resource
WHERE
{
?resource relation:commitAboutIssue ?bugID
.
}
04/09/12 Ontologies and Semantic 42
43. Examples
Commit related with the bug #252:
PREFIX rdf: <http://.../-rdf-syntax-ns#>
PREFIX
relation:<"http://www.q.org/ont/qr#">
PREFIX qvc:<"http://www.q.org/ont/qvc#">
SELECT ?resource ?message
WHERE
{
?resource relation:commitAboutIssue “252”
.
?resource qvc:message ?message .
}
04/09/12 Ontologies and Semantic 43
44. "Introduction to the Semantic Web" - Ivan Herman -
http://www.w3.org/2009/Talks/0829-Nanjing-IH/
04/09/12 Ontologies and Semantic 44
45. Play with SPARQL
http://dbpedia.org/snorql/
Extract all the films
PREFIX ont: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd:
<http://www.w3.org/2001/XMLSchema#>
SELECT ?e WHERE {
?e rdf:type ont:Film .
}
04/09/12 Ontologies and Semantic 45
46. Play with SPARQL
http://dbpedia.org/snorql/
Extract all the films starred by cruise from the year
1990
PREFIX ont: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?e WHERE {
?e rdf:type ont:Film .
?e ont:starring <http://dbpedia.org/resource/Tom_Cruise> .
?e ont:releaseDate ?date.
?e ont:producer ?producer
?producer
FILTER (?date >= "1990"^^xsd:date)
}
04/09/12 Ontologies and Semantic 46
47. Play with SPARQL
http://dbpedia.org/snorql/
Extract all the films (and producer's name) starred by
cruise from the year 1990
PREFIX ont: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?e ?producer ?productor_name WHERE {
?e rdf:type ont:Film .
?e ont:starring <http://dbpedia.org/resource/Tom_Cruise> .
?e ont:releaseDate ?date.
?e ont:producer ?producer .
?producer dbpedia2:name ?productor_name
FILTER (?date >= "1990-01-01"^^xsd:date)
}
04/09/12 Ontologies and Semantic 47
48. Play with SPARQL
http://dbpedia.org/snorql/
Abstracts of movies starring Tom Cruise, released
before 1999
SELECT ?subject ?label ?released ?abstract WHERE {
?subject rdf:type <http://dbpedia.org/ontology/Film>.
?subject dbpedia2:starring
<http://dbpedia.org/resource/Tom_Cruise>.
?subject rdfs:comment ?abstract.
?subject rdfs:label ?label.
FILTER(lang(?abstract) = "en" && lang(?label) = "en").
?subject <http://dbpedia.org/ontology/releaseDate> ?released.
FILTER(xsd:date(?released) < "2000-01-01"^^xsd:date).
} ORDER BY ?released
LIMIT 20
04/09/12 Ontologies and Semantic 48
49. Jose Gato Luis
<jose.gato@atosresearch.eu>
http://www.linkedin.com/in/josegatoluis
04/09/12 Ontologies and Semantic 49