Noms

  • EL KADI Youssef
  • GARGANTUA Mathéo

1 - Utilisation des uris

Voici une liste de Préfix disponible :

@prefix : <https://pokemonkg.org/ontology#> .
@prefix cc: <http://creativecommons.org/ns#> .
@prefix dbo: <http://dbpedia.org/ontology/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix shape: <https://pokemonkg.org/ontology#Shape_> .
@prefix flavor: <https://pokemonkg.org/ontology#Flavor_> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wd: <http://www.wikidata.org/entity/> .
@prefix habitat: <https://pokemonkg.org/ontology#Habitat_> .
@prefix egggroup: <https://pokemonkg.org/ontology#EggGroup_> .
@prefix poketype: <https://pokemonkg.org/ontology#PokeType_> .
@prefix pokemon: <https://pokemonkg.org/instance/pokemon/>
@prefix pokonto: <https://pokemonkg.org/ontology>
@base <https://pokemonkg.org/ontology> .

Question 1

Parmi ces préfixes, identifier 2 préfixes en lien avec l’ontologie pokemonkg et 1 avec les instances de celle-ci.

Préfixes en lien avec l’ontologie pokemonkg :

  • egggroup
  • poketype Instance de pokemonkg :
  • pokemon

Question 2

Donner l’uri courte de :

Question 3

Donner l’uri longue de :

Question 4

Ouvrir chacune des uris longues des deux questions précédentes dans un navigateur web. Que se passe-t-il ? Pourquoi ?

Question 5

Parmi les uris des questions précédentes, lesquelles correspondent à un prédicat ? Justifier votre réponse.

  owl:sameAs a rdf:Property ;
     rdfs:label "sameAs" ;
     rdfs:comment "The property that determines that two given individuals are equal." ;
     rdfs:domain owl:Thing ;
     rdfs:isDefinedBy <http://www.w3.org/2002/07/owl#> ;
     rdfs:range owl:Thing .

De plus, sameAs et minLevelToLearn sont écrits en camlCase, par convention, ce sont donc des prédicats.

2 - Compréhension et écriture d’un graph

Pour cet exercice, vous aurez besoin de parcourir l’ontologie DBPedia. Vous pouvez consulter directement l’ontologie en ligne à cette adresse : http://mappings.dbpedia.org/server/ontology/classes/. Vous pouvez aussi consulter les informations associées à David Bowie ici :https://dbpedia.org/page/David_Bowie Vous utilise- rez dans vos différentes représentations exclusivement les namespaces ci-dessous que l’on supposera déjà référencés :

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Question 6

Pour chaque phrase ci-dessous, dessiner le triplet RDF correspondant dans un graphe orienté (les ressources sont des rectangles verts, les classes des rectangles bleus, les relations des arcs orientés et les propriétés littérales des notes annexes ), puis écrivez selon la syntaxe RDF le triplet correspondant. Exemple : David Bowie s’appelle « David Bowie » et est une Personne

Turtle : dbr:David_Bowie rdf:type dbo:Person . dbr:David_Bowie rdfs:label "David Bowie"@fr

graph LR
	David_Bowie[dbr:David_Bowie]:::resource
    Person[dbo:Artist]:::type
    LabelDB["David Bowie@fr"]
    
    David_Bowie -->|rdf:type| Person
    David_Bowie -->|rdfs:label| LabelDB
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px

À votre tour

  • David Bowie est un artiste dbr:David_Bowie rdf:type dbo:Artist .
graph LR
    DB[dbr:David_Bowie]:::resource
    Artist[dbo:Artist]:::type
    
    DB -->|rdf:type| Artist
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px
  • David Bowie est un chanteur dbr:David_Bowie rdf:type dbo:Singer .
graph LR
    DB[dbr:David_Bowie]:::resource
    Singer[dbo:Singer]:::type
    
    DB -->|rdf:type| Singer
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px
  • David Bowie est britannique dbr:David_Bowie dbo:nationality dbr:United_Kingdom .
graph LR
    DB[dbr:David_Bowie]:::resource
    UK[dbr:United_Kingdom]:::resource
    
    DB -->|dbo:nationality| UK
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
  • David Bowie est né à Londres le 08/01/1947 dbr:David_Bowie dbo:birthPlace dbr:London . dbr:David_Bowie dbo:birthDate "08/01/1947" .
graph LR
    DB[dbr:David_Bowie]:::resource
    London[dbr:London]:::resource
    Date["1947-01-08"]
    
    DB -->|dbo:birthPlace| London
    DB -->|dbo:birthDate| Date
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
  • Londres est une ville du Royaume-Uni qui a une population de 8,961,989 habitants dbr:London rdf:type dbo:City . dbr:London dbo:officialName "Londres" @fr . dbr:United_Kingdom rdf:type Country . dbr:United_Kingdom rdfs:label "Royaume-Uni" @fr . dbr:London dbo:country dbr:United_Kingdom . dbr:London dbo:populationUrban 8961989 .
graph TB
    London[dbr:London]:::resource
    City[dbo:City]:::type
    UK[dbr:United_Kingdom]:::resource
    Country[dbo:Country]:::type
    LabelLondon["Londres@fr"]
    LabelUK["Royaume-Uni@fr"]
    Pop["8961989"]
    
    London -->|rdf:type| City
    London -->|rdfs:label| LabelLondon
    London -->|dbo:country| UK
    London -->|dbo:populationUrban| Pop
    UK -->|rdf:type| Country
    UK -->|rdfs:label| LabelUK
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px
  • Le Royaume-Uni a pour capital Londres, a une population totale de 67,886,004 habitants et a pour monnaie la Livre Sterling qui est également utilisée à Saint-Hélène. dbr:United_Kingdom dbo:capital dbr:London . dbr:United_Kingdom dbo:populationTotal 67886004 . dbr:Pound_sterling rdf:type dbo:Currency . dbr:Pound_sterling rdfs:label "Livre Sterling"@fr . dbr:United_Kingdom dbo:currency dbr:Pound_sterling . dbr:Saint_Helena dbo:currency dbr:Pound_sterling .
graph TB
    UK[dbr:United_Kingdom]:::resource
    London[dbr:London]:::resource
    Pop["67886004"]
    Sterling[dbr:Pound_sterling]:::resource
    StHelena[dbr:Saint_Helena]:::resource
    Currency[dbo:Currency]:::type
    LabelSterling["Livre Sterling@fr"]
    
    UK -->|dbo:capital| London
    UK -->|dbo:populationTotal| Pop
    UK -->|dbo:currency| Sterling
    StHelena -->|dbo:currency| Sterling
    Sterling -->|rdf:type| Currency
    Sterling -->|rdfs:label| LabelSterling
    
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px

3 TTL vers schéma

Dessinez le graphe orienté correspondant au graphe RDF suivant, écrit en Turtle (.ttl). Astuce : en Turtle, le prédicat rdf:type s’écrit aussi a.

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 pe: <http://www.personne.org/ontology/>
PREFIX res: <http://www.personne.org/resource/>
 
pe:Animal a owl:Class .
pe:Personne a owl:Class .
pe:Femme a owl:Class ;
	rdfs:subClassOf pe:Personne .
 
pe:Homme a owl:Class ;
	rdfs:subClassOf pe:Personne .
 
pe:Ville a owl:Class .
pe:habite a owl:ObjectProperty ;
	rdfs:domain pe:Personne ;
	rdfs:range pe:Ville .
 
pe:aPourNom a owl:DatatypeProperty ;
	rdfs:domain pe:Personne ;
	rdfs:range xsd:String .
 
pe:possede a owl:ObjectProperty ;
	rdfs:domain pe:Personne ;
	rdfs:range pe:Animal .
 
res:Snoopy a pe:Animal .
res:Anne a pe:Femme ;
	pe:habite res:Paris ;
	pe:aPourNom "Dutra"^^xsd:string ;
	pe:possede res:Snoopy .
 
res:Paris a pe:Ville .
graph LR
     Relations de classes
    Femme -->|rdfs:subClassOf| Personne
    Homme -->|rdfs:subClassOf| Personne
    
     Types des ressources
    Snoopy -->|rdf:type| Animal
    Anne -->|rdf:type| Femme
    Paris -->|rdf:type| Ville
    
     Styles
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef property fill:#FFD700,stroke:#333,stroke-width:2px
    classDef owl fill:#DDA0DD,stroke:#333,stroke-width:2px

4

Question 8

Dessiner le graphe orienté correspondant (les ressources sont des rectangles verts, les classes des rectangles bleus, les relations des arcs orientés et les propriétés littérales des notes annexes).

graph LR
     CLASSES DE L'ONTOLOGIE
     Hiérarchie des classes
    BadGuy -->|rdfs:subClassOf| Person
    Spy -->|rdfs:subClassOf| Person
    City -->|rdfs:subClassOf| Place
    Country -->|rdfs:subClassOf| Place
    AlcoholicDrink -->|rdfs:subClassOf| Drink
    SoftDrink -->|rdfs:subClassOf| Drink
    AlcoholicDrink -.->|owl:disjointWith| SoftDrink

     ========================================
     ========================================
    rhello
    PropFights["JBOntology:fights"]:::property
    PropHasCapital["JBOntology:hasCapital"]:::property
    PropIsCapitalOf["JBOntology:isCapitalOf"]:::property
    PropLivesIn["JBOntology:livesIn"]:::property
    PropPlays["JBOntology:plays"]:::property
    PropDeserves["JBOntology:deserves"]:::property

     ========================================
     ========================================
    
    PropAlias["JBOntology:alias"]:::property
    PropGender["JBOntology:gender"]:::property
    PropIsThirsty["JBOntology:isThirsty"]:::property

    PropAlias -->|rdfs:domain| ThingClass["owl:Thing"]:::type
    PropAlias -->|rdfs:range| XsdString["xsd:string"]
    PropAlias -->|rdfs:label| LabelAliasFr["Alias@fr"]
    PropAlias -->|rdfs:label| LabelAliasEn["Alias@en"]

    PropGender -->|rdfs:domain| Person
    PropGender -->|rdfs:label| LabelGenderFr["Genre@fr"]
    PropGender -->|rdfs:label| LabelGenderEn["Gender@en"]

    PropIsThirsty -->|rdfs:domain| Person
    PropIsThirsty -->|rdfs:range| XsdBoolean["xsd:boolean"]
    PropIsThirsty -->|rdfs:label| LabelIsThirstyFr["A soif@fr"]
    PropIsThirsty -->|rdfs:label| LabelIsThirstyEn["Is thirsty@en"]

     INSTANCES (Ressources)
     Boissons
    Coke["http://www.movies.org/resources/uuid/Coke"]:::resource
    Martini["http://www.movies.org/resources/uuid/Martini"]:::resource
    
     Personnes
    LeChiffre["http://www.movies.org/resources/uuid/4726"]:::resource
    JamesBond["http://www.movies.org/resources/uuid/5587"]:::resource
    
     ========================================
     ========================================
    
    Coke -->|rdf:type| SoftDrink
    Martini -->|rdf:type| AlcoholicDrink
    
    London -->|rdf:type| City
    UK -->|rdf:type| Country
    UnknownCity -->|rdf:type| City
    
    LeChiffre -->|rdf:type| BadGuy
    JamesBond -->|rdf:type| Spy
    
    Poker -->|rdf:type| Game

     LABELS DES INSTANCES
     ========================================
     ========================================
    
     Relations de James Bond
    JamesBond -->|fights| LeChiffre
    JamesBond -->|livesIn| London
    JamesBond -->|plays| Poker
    JamesBond -->|alias| Alias007["007"]
    JamesBond -->|gender| GenderMale1["male"]
    
     ========================================
     ========================================
    
    classDef type fill:#87CEEB,stroke:#333,stroke-width:2px,color:#000
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px,color:#000
    classDef property fill:#FFD700,stroke:#333,stroke-width:2px,color:#000

Mermaid editor

Question 9

Quelles informations peuvent être inférées automatiquement à partir de cette ontologie et des instances associées ?

  • 5587 vie à 1186 (londres), 1186 est capitale de 2336 (Royaume uni) donc 5587 est britanique
  • 1186 est capitale de 2336, 4586 est capitale de 2336 donc 1186 = 2336 = londres

Question 10

Quelles informations supplémentaires peuvent-être inférées avec les règles d’inférence ci-dessous :

  • 5587 thirsty true car il est de type Spy et il joue à 57256
  • 5587 deserve Coke car il est de type Spy, il combat 4726 et il est thristy (d’après la règle rule_1) et Coke est de type SoftDrink)

Question 11

Se rendre sur https://www.easyrdf.org/converter et convertir le graphe en turtle, n- triples et JSON-LD. Essayez de retrouver les classes, relations, propriétés et instances dans ces différentes syntaxes.

Turtle

  • Propriétés : a owl:ObjectProperty ;
  • Classes : a owl:Class ;
  • Instances : a owl:NamedIndividual ;
  • Relations : ns0:isCapitalOf <...> ;

N-triples

  • Propriétés :
<http://www.movies.org/ontologies/JBOntology#fights> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty> .
  • Classes :
<http://www.movies.org/ontologies/JBOntology#Country> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
  • Instances :
<http://www.movies.org/resources/uuid/1786> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#NamedIndividual> .
  • Relations :
<http://www.movies.org/resources/uuid/1786> <http://www.movies.org/ontologies/JBOntology#isCapitalOf> <http://www.movies.org/resources/uuid/2336> .

JSON-LD

  • Propriétés :
{
	"@id": "http://www.movies.org/ontologies/JBOntology#fights",
	"@type": [
	  "http://www.w3.org/2002/07/owl#ObjectProperty"
	],
	...
}
  • Classes :
{
	"@id": "http://www.movies.org/ontologies/JBOntology#Country",
	"@type": [
	  "http://www.w3.org/2002/07/owl#Class"
	],
	...
}
  • Instances :
{
	"@id": "http://www.movies.org/resources/uuid/1786",
	"@type": [
		"http://www.w3.org/2002/07/owl#NamedIndividual",
		"http://www.movies.org/ontologies/JBOntology#City"
	],
},
  • Relations :`
{
	"@id": "http://www.movies.org/resources/uuid/1786",
	...
	"http://www.movies.org/ontologies/JBOntology#isCapitalOf": [
		{
			"@id": "http://www.movies.org/resources/uuid/2336"
		}
	],
	...
}