91
Introduction à SPARQL PhD Lynda Temal [email protected] Chez sfeir depuis 10 février 2014

Introduction à SPARQL avec Lynda Temal

  • Upload
    sfeir

  • View
    86

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Introduction à SPARQL avec Lynda Temal

Introduction à SPARQL

PhD Lynda [email protected] sfeir depuis 10 février 2014

Page 2: Introduction à SPARQL avec Lynda Temal

Qu’est ce que le Web sémantique ?

Page 3: Introduction à SPARQL avec Lynda Temal

Quel pays a produit le plus

grand nombre

d’écrivains ?

Page 4: Introduction à SPARQL avec Lynda Temal

Qui peut répondre à cette requête ?

■ Google ? (recherche par mots clés)

■ Wikipedia ? (recherche pour les humains)

■ Web semantique ? DBpedia: version sémantique de

wikipedia

Page 5: Introduction à SPARQL avec Lynda Temal

Version HTML de Wikipedia pour les humains

Page 6: Introduction à SPARQL avec Lynda Temal

Version RDF de dbpedia pour les machines

Page 7: Introduction à SPARQL avec Lynda Temal

SPARQL au coeur du web Sémantique

Page 8: Introduction à SPARQL avec Lynda Temal

Le Web Sémantique mentionné par Tim Berners-Lee en 1994 à WWW

Passer du web des liens entre des pages peu compréhensibles par les machines à ...

un web de choses reliées à la réalité et compréhensibles par les machines

Page 9: Introduction à SPARQL avec Lynda Temal

Ce qu’il faut faire :

Identifier / Expliciter

In front of

behind In front of

Page 10: Introduction à SPARQL avec Lynda Temal

Comment ?

Utiliser une

ontology partagée

Que nous pouvons comprendre

Que la machine peut interpréter

Slide extrait d’une représetation de Fabien Gondon

Page 11: Introduction à SPARQL avec Lynda Temal

Définition de l’ontologie

Page 12: Introduction à SPARQL avec Lynda Temal

Concept / termes / intention / extension

Page 13: Introduction à SPARQL avec Lynda Temal

Relation de subsemption : C is a B

Voiture

Voiture2 roues motrices

Voiture4 roues motrices

VoitureEssence

VoitureHybride

ZOE

Personne

Adulte

VoitureElectrique

part of

is a

is ais a

is a

is a

is ais a

Marie ZOEmate xyz

appartient

is a

is a

Moteur

is a

Moyende transport

is a

Femme

is a

is a

Page 14: Introduction à SPARQL avec Lynda Temal

Comment faire concrètement ?

Page 15: Introduction à SPARQL avec Lynda Temal

Les Technologies du Web Sémantique

Représentation

RequêteRaisonnement

Confiance

Page 16: Introduction à SPARQL avec Lynda Temal

RDFS signifie RDF Schema

Page 17: Introduction à SPARQL avec Lynda Temal

RDFS pour la hiérarchie de classes et de relations

rdfs:Class

rdfs:subClassOf

Person

Woman Man

rdf:Property

rdfs:subPropertyOf

parentOf

motherOf fatherOf

rdfs:domainrdfs:range

Woman PersonmotherOf

Page 18: Introduction à SPARQL avec Lynda Temal

Ontology Web Language (OWL)

Page 19: Introduction à SPARQL avec Lynda Temal

OWL en un

Slide extrait d’une représetation de Fabien Gondon

Page 20: Introduction à SPARQL avec Lynda Temal

Couche de représentation

Page 21: Introduction à SPARQL avec Lynda Temal

RDF

Resource: entreprises, livres, personnes,

programmes, média, services, idées…Description: attributs, qualités, et

des relations entre les ressources

Framework: modèle, langages et

syntaxes pour ces descriptions

Page 22: Introduction à SPARQL avec Lynda Temal

RDF : un modèle de triplets

( sujet , predicat, objet )

Structure d’une phrase simple

ex:

Lynda Temal worksFor Sfeir

( sujet , verbe, complément )

(Temal, worksFor, Sfeir)

Page 23: Introduction à SPARQL avec Lynda Temal

URI : Uniforme Resource Identifier

Page 24: Introduction à SPARQL avec Lynda Temal

Triplet RDF.

Temal worksFor Sfeir

http://home.sfeir.com/sw#temal

http://schema.org/worksFor

http://home.sfeir.com/sw#sfeir

Page 25: Introduction à SPARQL avec Lynda Temal

Prefix in turtle format

@prefix sfeir: <http://home.sfeir.com/sw#> .@prefix sch: <http://schema.org/> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

sfeir:Temal sch:worksFor sfeir:Sfeir;

foaf:givenName "Lynda"^^xsd:String;

foaf:familyName "Temal"^^xsd:String.

Page 26: Introduction à SPARQL avec Lynda Temal

N-Triples

<http://home.sfeir.com/sw#Temal>

<http://schema.org/worksFor>

<http://home.sfeir.com/sw#Sfeir>.

<http://home.sfeir.com/sw#Temal>

<http://xmlns.com/foaf/0.1/givenName>

"Lynda"^^<http://www.w3.org/2001/XMLSchema#String>.

<http://home.sfeir.com/sw#Temal>

<http://xmlns.com/foaf/0.1/familyName>

"Temal"^^<http://www.w3.org/2001/XMLSchema#String>.

Page 27: Introduction à SPARQL avec Lynda Temal

RDF/XML format

<?xml version="1.0" encoding="utf-8" ?>

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

xmlns:sch="http://schema.org"

xmlns:foaf="http://xmlns.com/foaf/0.1/">

<rdf:Description rdf:about="http://home.sfeir.com/sw#Temal">

<sch:worksFor rdf:resource="http://home.sfeir.com/sw#Sfeir"/>

<foaf:givenName rdf:datatype="http://www.w3.org/2001/XMLSchema#String>Lynda</foaf:givenName>

<foaf:familyName rdf:datatype="http://www.w3.org/2001/XMLSchema#String>Temal</foaf:familyName>

</rdf:Description>

</rdf:RDF>

Page 28: Introduction à SPARQL avec Lynda Temal

sfeir:Temal

sfeir:SFEIR

sch:worksFor

foaf:givenName

Lynda(xsd:string)

Temal(xsd:string)

foaf:familyName

dbr:Neuilly-sur-Seine

sch:location

dbr:France

dbo:country

dbr:Paris

dbo:capital

freebase:Paris

geo:2968815

owl:sameAs

Page 29: Introduction à SPARQL avec Lynda Temal

Exemple from scrach

Page 30: Introduction à SPARQL avec Lynda Temal

D’une vue tabulaire vers une vue en graphe

ID Prénom Nom titre Techno client genre role

Temal Lynda Temal developerjava, Web Semantique QuickSign F

Louvet Céline Louvet developerjava, maven appEngine

société générale F teamLeadr

Garnotel Goeffrey Garnotel developerjava, solr dataFlow

M6M techLead

Page 31: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

@prefix sch: <http://schema.org>

sfeir:temal foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java" , "web semantique".

sfeir:garnotel foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr";

sfeir:playesRole "teamLeader" .

sfeir:louvet foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:hasSkill "java", "AppEngine", "maven";

sfeir:involvedInMissionnAt "Societe Generale";

sfeir:playesRole "techLead" .

D’une vue tabulaire vers une vue en graphe

Page 32: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

@prefix sch: <http://schema.org>

sfeir:temal foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java" , "web semantique".

sfeir:garnotel foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr";

sfeir:playesRole "teamLeader" .

sfeir:louvet foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:hasSkill "java", "AppEngine", "maven";

sfeir:involvedInMissionnAt "Societe Generale";

sfeir:playesRole "techLead" .

D’une vue tabulaire vers une vue en graphe

Page 33: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

@prefix sch: <http://schema.org>

sfeir:temal foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java" , "web semantique".

sfeir:garnotel foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr";

sfeir:playesRole "teamLeader" .

sfeir:louvet foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:hasSkill "java", "AppEngine", "maven";

sfeir:involvedInMissionnAt "Societe Generale";

sfeir:playesRole "techLead" .

D’une vue tabulaire vers une vue en graphe

Page 34: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

@prefix sch: <http://schema.org>

sfeir:temal foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java", "web semantique".

sfeir:garnotel foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr";

sfeir:playesRole "teamLeader" .

sfeir:louvet foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "Societe Generale";

sfeir:hasSkill "java", "AppEngine", "maven";

sfeir:playesRole "techLead" .

D’une vue tabulaire vers une vue en graphe

Page 35: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

@prefix sch: <http://schema.org>

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

sfeir:temal rdf:type foaf:Person;

foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java" , "web semantique".

sfeir:garnotel rdf:type foaf:Person;

foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr".

sfeir:louvet rdf:type foaf:Person;

foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sch:worksFor sfeir:Sfeir;

sfeir:involvedInMissionnAt "Societe Generale".

D’une vue tabulaire vers une vue en graphe

Page 36: Introduction à SPARQL avec Lynda Temal

SPARQL

SPARQL Protocol and RDF Query Language

Page 37: Introduction à SPARQL avec Lynda Temal

SPARQL en trois parties

1. Un langage de requêtes

2. Un format de résultats

3. Un protocole d’accès

Page 38: Introduction à SPARQL avec Lynda Temal

SPARQL : langage de requêtes

Prefix

Select ...

From ...

Where {...}

WHERE

SELECT

Page 39: Introduction à SPARQL avec Lynda Temal

Fuseki pour manipuler SPARQL

Page 40: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?person

WHERE {

?person rdf:type foaf:Person.

}

------------------| person |=================| sfeir:louvet || sfeir:temal |

| sfeir:garnotel | ------------------

foaf:Person

?person

rdf:type

Qui sont les persons ?

Page 41: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?person ?prenom

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

}

-------------------------------| person | prenom |===============================| sfeir:louvet | "Céline" || sfeir:temal | "Lynda" || sfeir:garnotel | "Geoffrey" |-------------------------------

foaf:Person

?person

rdf:type

?prenom

foaf:givenName

Quel est leur prenom ?

Page 42: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?person ?prenom ?nom

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

}

--------------------------------------------| person | prenom | nom |============================================| sfeir:louvet | "Céline" | "Louvet" || sfeir:temal | "Lynda" | "Temal" || sfeir:garnotel | "Geoffrey" | "Garnotel" |--------------------------------------------

foaf:Person

?person

rdf:type

?prenom

foaf:givenName

?nom

foaf:familyName

Quel est leur nom ?

Page 43: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?person ?prenom ?nom ?competence

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

?person sfeir:hasSkill ?competence.

}

Quel sont leurs compétences ?

Page 44: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom ?role

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

?person sfeir:playesRole ?role.

}

Quel sont leurs rôles ?

Page 45: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom ?role

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

OPTIONAL {?person sfeir:playesRole ?role.}

}

OPTIONAL : quel sont leurs rôle s’il existe ?

Page 46: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

NOT EXISTS {?person sfeir:playesRole ?role.}

}

--------------------------| nom | prenom |===============| "Temal" | "Lynda" |--------------------------

NOT EXISTS: qui n’a pas de rôle ?

Page 47: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#>

@prefix sch: <http://schema.org>

@prefix foaf: <http://xmlns.com/foaf/0.1/>

sfeir:temal rdf:type foaf:Person;

foaf:givenName "Lynda";

foaf:familyName "Temal";

foaf:gender "female";

sch:jobTitle "developer";

sfeir:involvedInMissionnAt "QuickSign";

sfeir:hasSkill "java" , "web semantique";

sfeir:hireDate "2014-02-10".

sfeir:garnotel rdf:type foaf:Person;

foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sfeir:involvedInMissionnAt "M6";

sfeir:hasSkill "java", "DataFlow", "Solr";

sfeir:playesRole "teamLeader" ;

sfeir:hireDate "2006-10-25".

sfeir:louvet df:type foaf:Person;

foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developer";

sfeir:hasSkill "java", "AppEngine", "maven";

sfeir:involvedInMissionnAt "Societe Generale";

sfeir:playesRole "techLead" ;

sfeir:hireDate "2011-04-17".

Ajouter la date de recrutement

Page 48: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom ?date

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

?person sfeir:hireDate ?date.

FILTER (?date <= "2013-01-01")

}

FILTER : qui était déjà là en 2013 ?

Page 49: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom ?date

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

BIND("some values" As ?aVariable)

}

BIND

Page 50: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?nom ?prenom ?nomPrenom

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

BIND(concat(?nom, " ", ?prenom) As ?nomPrenom)

}

BIND : concatener Nom & Prenom

Page 51: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

CONSTRUCT {?person foaf:name ?nomPrenom}

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

BIND(concat(?nom, " ", ?prenom) As ?nomPrenom)

}

@prefix foaf: <http://xmlns.com/foaf/0.1/> .@prefix sfeir: <http://home.sfeir.com/sw#> .

sfeir:temal foaf:name "Temal Lynda" .sfeir:louvet foaf:name "Louvet Céline" .sfeir:garnotel foaf:name "Garnotel Geoffrey" .

CONSTRUCT : full name

Page 52: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX sch: <http://schema.org/>

CONSTRUCT {

?person rdf:type sch:Person.

?person sch:name ?nomPrenom.

?person sch:givenName ?prenom.

?person sch:familyName ?nom.

?person sch:gender ?gender.

}

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?prenom.

?person foaf:familyName ?nom.

?person foaf:gender ?gender.

BIND(concat(?nom, " ", ?prenom) As ?nomPrenom)

}

CONSTRUCT : foaf ⇒ schema.org

Page 53: Introduction à SPARQL avec Lynda Temal

@prefix sch: <http://schema.org/> .

@prefix foaf: <http://xmlns.com/foaf/0.1/> .

@prefix sfeir: <http://home.sfeir.com/sw#> .

sfeir:temal a sch:Person ;

sch:familyName "Temal" ;

sch:gender "female" ;

sch:givenName "Lynda" ;

sch:name "Temal Lynda" .

sfeir:louvet a sch:Person ;

sch:familyName "Louvet" ;

sch:gender "female" ;

sch:givenName "Céline" ;

sch:name "Louvet Céline" .

sfeir:garnotel a sch:Person ;

sch:familyName "Garnotel" ;

sch:gender "male" ;

sch:givenName "Geoffrey" ;

sch:name "Garnotel Geoffrey" .

Résultat du Construct

Page 54: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

ASK { ?x sfeir:hasSkill "Solr" } yes

ASK { ?x sfeir:hasSkill "Solr", "java" }

ASK { ?x sfeir:hasSkill "Solr","java", "web semantique"}

ASK { ?x sfeir:hasSkill "java" , "web semantique"}

yes

yes

No

Ask : Avons nous ces compétences ?

Page 55: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#> @prefix sch: <http://schema.org/> @prefix foaf: <http://xmlns.com/foaf/0.1/>

sfeir:temal rdf:type foaf:Person;foaf:givenName "Lynda";foaf:familyName "Temal";foaf:gender "female";sch:jobTitle "developer";sfeir:involvedInMissionnAt "QuickSign";sfeir:hasSkill "java" , "web semantique";sfeir:hireDate "2014-02-10".

sfeir:garnotel rdf:type foaf:Person;foaf:givenName "Geoffrey" ;foaf:familyName "Garnotel";foaf:gender "male";sch:jobTitle "developer";sfeir:involvedInMissionnAt "M6";sfeir:hasSkill "java", "DataFlow", "Solr";sfeir:playesRole "teamLeader" ;sfeir:hireDate "2006-10-25".

sfeir:louvet df:type foaf:Person;foaf:givenName "Céline";foaf:familyName "Louvet";foaf:gender "female" ;sch:jobTitle "developer";sfeir:hasSkill "java", "AppEngine", "maven";sfeir:involvedInMissionnAt "Societe Generale";sfeir:playesRole "techLead" ;sfeir:hireDate "2011-04-17".

Graphe mais pas vraiment lié

Page 56: Introduction à SPARQL avec Lynda Temal

GET in the Linked Open Data

Page 57: Introduction à SPARQL avec Lynda Temal

Évolution du Linked Open Data

Page 58: Introduction à SPARQL avec Lynda Temal

Août 2014

DBpedia

Linked Open Data

Page 59: Introduction à SPARQL avec Lynda Temal

Apache Solr dans dbpedia

Page 60: Introduction à SPARQL avec Lynda Temal

@prefix sfeir: <http://home.sfeir.com/sw#> .@prefix sch: <http://schema.org/> .@prefix foaf: <http://xmlns.com/foaf/0.1/>.prefix dbpedia: <http://dbpedia.org/resource/>.

sfeir:garnotel foaf:givenName "Geoffrey" ;

foaf:familyName "Garnotel";

foaf:gender "male";

sch:jobTitle "developer";

sfeir:involvedInMissionnAt dbpedia:M6_(TV_channel);

sfeir:hasSkill dbpedia:Java_(programming_language);

sfeir:hasSkill "DataFlow" ;

sfeir:hasSkill dbpedia:Apache_Solr;

sfeir:playesRole "teamLeader" .

sfeir:louvet rdf:type foaf:Person.

sfeir:louvet foaf:givenName "Céline";

foaf:familyName "Louvet";

foaf:gender "female" ;

sch:jobTitle "developper";

sfeir:hasSkill dbpedia:Java_(programming_language);

sfeir:hasSkill dbpedia:Google_App_Engine;

sfeir:hasSkill dbpedia:Apache_Maven;

sfeir:involvedInMissionnAt dbpedia:Société_générale;

sfeir:playesRole "techLead".

Lien vers dbpedia

Page 61: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX dbr: <http://dbpedia.org/resource/>PREFIX dbpo: <http://dbpedia.org/ontology/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?person ?name ?label ?genre

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?name.

?person sfeir:hasSkill dbr:Apache_Solr.

SERVICE <http://Dbpedia.org/sparql>{

dbr:Apache_Solr rdfs:label ?label;

dbpo:genre ?genre.

FILTER(lang(?label)="en").

}

}

Qui connait solr, quel est sont label et genre ?

Page 62: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX dbr: <http://dbpedia.org/resource/>

PREFIX dbpo: <http://dbpedia.org/ontology/>

SELECT ?person ?name ?skill ?skillName ?genre

WHERE {

?person rdf:type foaf:Person.

?person foaf:givenName ?name.

?person sfeir:hasSkill ?skill.

SERVICE <http://Dbpedia.org/sparql>{

?skill dbpo:genre ?genre.

?skill foaf:name ?skillName.

}

}

Qui a les compétences avec name et genre ?

Page 63: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX dbr: <http://dbpedia.org/resource/>PREFIX dbpo: <http://dbpedia.org/ontology/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Select ?name ?skill ?label ?skillName ?genreWHERE{

?person rdf:type foaf:Person. ?person foaf:givenName ?name. ?person sfeir:hasSkill ?skill.

SERVICE <http://Dbpedia.org/sparql>{ OPTIONAL{?skill rdfs:label ?label.} OPTIONAL{?skill foaf:name ?skillName.} OPTIONAL{?skill dbpo:genre ?genre.} FILTER (lang(?label) = 'fr' && lang(?skillName) = 'en').

}}

OPTIONAL : Encore plus d’info compétences

Page 64: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX dbpedia: <http://dbpedia.org/resource/>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT ?skillName ?sameSkillURI

WHERE{

?person rdf:type foaf:Person.

?person foaf:givenName ?name.

?person sfeir:hasSkill ?skill.

SERVICE <http://Dbpedia.org/sparql>{

OPTIONAL{?skill rdfs:label ?label.}

OPTIONAL{?skill foaf:name ?skillName.}

OPTIONAL{?skill owl:sameAs ?sameSkillURI.}

FILTER (lang(?label) = 'fr')

FILTER (lang(?skillName) = 'en')

}

}

owl:sameAs : encore plus de resources

Page 65: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

INSERT{ ?man a sfeir:Man.

?woman a sfeir:Woman.

}

WHERE {

?man foaf:gender "male".

?woman foaf:gender "female".

}

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX foaf: <http://xmlns.com/foaf/0.1/>

INSERT DATA{sfeir:Woman a rdfs:Class.sfeir:Woman rdfs:subClassOf foaf:Person.sfeir:Man a rdfs:Class.sfeir:Man rdfs:subClassOf foaf:Person.

}

Person

Woman Man

Enrichir le vocabulaire: Man vs Woman ?

Page 66: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX sch: <http://schema.org>

INSERT{

?person1 sfeir:colleague ?person2.

}

WHERE {

?person1 sch:worksFor ?organisation.

?person2 sch:worksFor ?organisation.

FILTER (?person1 != ?person2)

}

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX owl: <http://www.w3.org/2002/07/owl#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

INSERT DATA{sfeir:colleague a owl:SymmetricProperty;

rdfs:domain foaf:Person;rdfs:range foaf:Person;

}

Enrichir le vocabulaire: qui sont mes collègues ?

colleague

owl:ObjectProperty

owl:SymmetricProperty

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX sch: <http://schema.org>

SELECT *

WHERE{

?person1 sfeir:colleague ?person2.

} order by ?person1 ?person2

Page 67: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX dbr: <http://dbpedia.org/resource/>

DELETE DATA {

sfeir:garnotel sfeir:hasSkill dbr:JavaScript.

}

Supprimer les données erronées

PREFIX sfeir: <http://home.sfeir.com/sw#> PREFIX dbr: <http://dbpedia.org/resource/>

SELECT *

WHERE{

sfeir:garnotel ?p ?o.

}

Page 68: Introduction à SPARQL avec Lynda Temal

Enrichir le vocabulaire: décrire les Soirées Sfeir

soirée presentation date

Louvet NoSQL Google datastore and search 16/12/2014

Garnotel I love My Data Moteur de recherche 11/02/2015

Garnotel Data Manipulation Dataflow 03/12/2015

Temal I love My Data Introduction au web semantique 11/02/2015

Temal Web Semantique Introduction à SPARQL 17/02/2016

Orpeliere Web Semantique Introducation à Stardog 17/02/2016

Page 69: Introduction à SPARQL avec Lynda Temal

Ontology pour décrire les évènements

http://purl.org/NET/c4dm/event.owl#

Page 70: Introduction à SPARQL avec Lynda Temal

Définir l’ontologie pour les soirées sfeir

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

sfeir:SoireeSfeir a rdfs:Class.

sfeir:SoireeSfeir rdfs:subClassOf evt:Event.

Event

SoireeSfeir

Page 71: Introduction à SPARQL avec Lynda Temal

Définir l’ontologie pour les soirées sfeir

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

sfeir:SoireeSfeir a rdfs:Class.

sfeir:SoireeSfeir rdfs:subClassOf evt:Event.

sfeir:Presentation a rdfs:Class.

sfeir:Presentation rdfs:subClassOf evt:Event.

Event

SoireeSfeir Presentation

Page 72: Introduction à SPARQL avec Lynda Temal

Définir l’ontologie pour les soirées sfeir

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

sfeir:SoireeSfeir a rdfs:Class.

sfeir:SoireeSfeir rdfs:subClassOf evt:Event.

sfeir:Presentation a rdfs:Class.

sfeir:Presentation rdfs:subClassOf evt:Event.

sfeir:SoireeSfeir evt:hasSubEvent sfeir:Presentation.

Event

SoireeSfeir Presentation

hasSubEvent

Page 73: Introduction à SPARQL avec Lynda Temal

Définir l’ontologie pour les soirées sfeir

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

INSERT DATA{

sfeir:SoireeSfeir a rdfs:Class.

sfeir:SoireeSfeir rdfs:subClassOf evt:Event.

sfeir:Presentation a rdfs:Class.

sfeir:Presentation rdfs:subClassOf evt:Event.

sfeir:SoireeSfeir evt:hasSubEvent sfeir:Presentation.

}

Event

SoireeSfeir Presentation

hasSubEvent

Page 74: Introduction à SPARQL avec Lynda Temal

Décrire une soirée sfeir : I Love My DataPREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA{

GRAPH sfeir:soireeSfeir{

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-17T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

sfeir:IntoductionWebSemantiquePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Introduction au Web Sémantique"@fr ;

foaf:agent sfeir:temal.

}

}

Page 75: Introduction à SPARQL avec Lynda Temal

Décrire une soirée sfeir : I Love My DataPPREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

Page 76: Introduction à SPARQL avec Lynda Temal

Décrire une soirée sfeir : I Love My DataPREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

Décrire une soirée sfeir : I Love My Data

Page 77: Introduction à SPARQL avec Lynda Temal

Décrire une soirée sfeir : I Love My DataPREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

Décrire une soirée sfeir : I Love My Data

Page 78: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

Décrire une soirée sfeir : I Love My Data

Page 79: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

Décrire une soirée sfeir : I Love My Data

Page 80: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

Décrire une soirée sfeir : I Love My Data

Page 81: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

Décrire une soirée sfeir : I Love My Data

Page 82: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

Décrire une soirée sfeir : I Love My Data

Page 83: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

sfeir:IntoductionWebSemantiquePresentation

rdf:type sfeir:Presentation ;

Décrire une soirée sfeir : I Love My Data

Page 84: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

sfeir:IntoductionWebSemantiquePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Introduction au Web Sémantique"@fr ;

foaf:agent sfeir:temal.

}

}

Décrire une soirée sfeir : I Love My Data

Page 85: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA{

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

sfeir:IntoductionWebSemantiquePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Introduction au Web Sémantique"@fr ;

foaf:agent sfeir:temal.

}

Décrire une soirée sfeir : I Love My Data

Page 86: Introduction à SPARQL avec Lynda Temal

PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT DATA{

GRAPH sfeir:soireeSfeir{

sfeir:ILoveMyDataEvent a sfeir:SoireeSfeir ;

rdfs:label "I Love My Data"@en ;

evt:hasSubEvent sfeir:MoteurDeRecherchePresentation ;

evt:hasSubEvent sfeir:IntroductionWebSemantiquePresentation ;

evt:place sfeir:SalleReunion1Sfeir ;

evt:time _:b0 .

_:b0 rdf:type tl:Interval ;

tl:at "2015-02-11T07:00:00"^^xsd:dateTime ;

tl:duration "PT3H"^^xsd:duration .

sfeir:MoteurDeRecherchePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Moteur de recherche"@fr ;

foaf:agent sfeir:garnotel .

sfeir:IntoductionWebSemantiquePresentation

rdf:type sfeir:Presentation ;

rdfs:label "Introduction au Web Sémantique"@fr ;

foaf:agent sfeir:temal.

}

}

Décrire une soirée sfeir : I Love My Data

Page 87: Introduction à SPARQL avec Lynda Temal

Quelle soirée, qui présente quoi et quand ?PREFIX sfeir: <http://home.sfeir.com/sw#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX evt: <http://purl.org/NET/c4dm/event.owl#>

PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?labelSoiree ?labelPresentation ?date ?agent ?graph

WHERE {

GRAPH ?graph {

?soiree rdf:type sfeir:SoireeSfeir;

rdfs:label ?labelSoiree;

evt:hasSubEvent ?presentation;

evt:time ?time.

?time tl:at ?date.

?presentation rdfs:label ?labelPresentation.

?presentation foaf:agent ?agent.

}

}

Page 88: Introduction à SPARQL avec Lynda Temal

PREFIX imdb: <http://data.linkedmdb.org/resource/movie/>PREFIX dcterms: <http://purl.org/dc/terms/>PREFIX dbo: <http://dbpedia.org/ontology/>PREFIX dbp: <http://dbpedia.org/property/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX dbr: <http://dbpedia.org/resource/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?birthDate ?birthPlace ?husbandName ?movieTitle ?movieDate {

{ SERVICE <http://dbpedia.org/sparql>{

dbr:Angelina_Jolie dbo:birthDate ?birthDate ;

dbp:birthPlace ?birthPlace.

?husbandURI dbo:spouse dbr:Angelina_Jolie;

rdfs:label ?husbandName.

Filter (lang (?husbandName) = "en")

}}

{ SERVICE <http://data.linkedmdb.org/sparql>{

?actor imdb:actor_name "Angelina Jolie".

?movie imdb:actor ?actor ;

dcterms:title ?movieTitle ;

dcterms:date ?movieDate .

}}

}

Requête fédérée: dbpedia & linkedmoviedb

Page 89: Introduction à SPARQL avec Lynda Temal

Résultat de la requête fédérée : dbpedia&linkedmoviedb

Page 90: Introduction à SPARQL avec Lynda Temal

Ce que vous devez retenir

➔ Web sémantique extension du web actuel

➔ RDF standard pour représenter les données

➔ Sparql standard pour interroger du RDF

➔ Requêtes fédérées & interopérabilité

➔ Plusieurs sources ouvertes prêtes à être exploitées

➔ Linked data pas forcement open

Page 91: Introduction à SPARQL avec Lynda Temal

Merci !

Questions ?