|
|
Cette page donne quelques exemples d'extraction simple en s'appuyant sur les phrases suivantes :
|
|
|
|
|
|
R1 : The system allows a radio channel to take on two states : listening and trafic
|
|
|
|
|
|

|
|
|
|
|
|
R2 : The system displays a channel in green when it is in broadcast state
|
|
|
|
|
|

|
|
|
|
|
|
Le fichier rdf-unl qui contient ces phrases (:bangbang: Il importe le schéma `https://unl.tetras-libre.fr/rdf/schema#` qui doit être acceessible dans le workspace) :
|
|
|
|
|
|
[2_exemple-rdf-unl-automatic-unl2rdf.ttl](uploads/731a7c5b3f8317a7c4893e0b64e8532c/2_exemple-rdf-unl-automatic-unl2rdf.ttl)
|
|
|
|
|
|
|
|
|
# Règle 1 : extraction d'une cardinalité
|
|
|
|
|
|
Typiquement ce genre de sous-graphe :
|
|
|
|
|
|

|
|
|
|
|
|
```sparql
|
|
|
CONSTRUCT {?lex owl:cardinality ?tInt }
|
|
|
WHERE {
|
|
|
?this a unl:qua ;
|
|
|
unl:has_source ?s ;
|
|
|
unl:has_target ?t .
|
|
|
?t rdfs:label ?tLabel .
|
|
|
?s unl:is_occurrence_of ?lex
|
|
|
BIND(xsd:integer(?tLabel) AS ?tInt)
|
|
|
}
|
|
|
```
|
|
|
|
|
|
# Règle 2 : extraction d'une énumération à deux éléments (1 x `and`)
|
|
|
|
|
|
Typiquement ce genre de sous-graphe :
|
|
|
|
|
|

|
|
|
|
|
|
```sparql
|
|
|
CONSTRUCT {
|
|
|
?lex owl:equivalentClass [
|
|
|
rdf:type rdfs:Datatype ;
|
|
|
owl:oneOf (?l1 ?l2)
|
|
|
]
|
|
|
}
|
|
|
WHERE {
|
|
|
?this a unl:cnt ;
|
|
|
unl:has_source ?s ;
|
|
|
unl:has_target ?t1 .
|
|
|
?s unl:is_occurrence_of ?lex .
|
|
|
?lex rdfs:label ?label .
|
|
|
FILTER regex(?label,"icl>attribute")
|
|
|
?and1 a unl:and ;
|
|
|
unl:has_source ?t1 ;
|
|
|
unl:has_target ?t2 .
|
|
|
?t1 rdfs:label ?l1 .
|
|
|
?t2 rdfs:label ?l2 .
|
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
# Règle 3 : extraction d'une datatype property à partir d'une UW avec `icl>be` dans ses restrictions
|
|
|
|
|
|
Typiquement ce genre de sous-graphe (sans l'arc `mod`):
|
|
|
|
|
|

|
|
|
|
|
|
Note : on extrait aussi le domaine et le but de la relation (`domain` et `range`)
|
|
|
|
|
|
```sparql
|
|
|
CONSTRUCT {
|
|
|
?lex a owl:DatatypeProperty ;
|
|
|
rdfs:domain ?slex ;
|
|
|
rdfs:range ?tlex .
|
|
|
?slex a owl:Class .
|
|
|
?tlex a rdfs:Datatype .
|
|
|
}
|
|
|
WHERE {
|
|
|
?this unl:is_occurrence_of ?lex .
|
|
|
?lex rdfs:label ?label .
|
|
|
FILTER regex(str(?label),"icl>be")
|
|
|
?this unl:aoj ?s .
|
|
|
?this unl:obj ?t .
|
|
|
?s unl:is_occurrence_of ?slex .
|
|
|
?t unl:is_occurrence_of ?tlex .
|
|
|
?tlex rdfs:label ?tlabel .
|
|
|
FILTER regex(str(?tlabel),"icl>attribute")
|
|
|
}
|
|
|
```
|
|
|
|
|
|
# Règle 4 : instanciation d'une datatype property précédement créée
|
|
|
|
|
|
Typiquement ce genre de sous-graphe (avec un arc `plc` au lieu de `mod`):
|
|
|
|
|
|

|
|
|
|
|
|
```sparql
|
|
|
CONSTRUCT {
|
|
|
?aoj a ?aojLex ;
|
|
|
?lex ?modLabel
|
|
|
}
|
|
|
WHERE {
|
|
|
?this rdfs:label ?label .
|
|
|
FILTER regex(str(?label),"icl>be")
|
|
|
?this unl:aoj ?aoj ;
|
|
|
unl:obj ?obj ;
|
|
|
unl:is_occurrence_of ?lex .
|
|
|
?aoj unl:has_attribute ".@indef" ; unl:is_occurrence_of ?aojLex .
|
|
|
?obj unl:plc ?mod ; rdfs:label ?objLabel .
|
|
|
FILTER regex(?objLabel,"icl>attribute")
|
|
|
?mod rdfs:label ?modLabel .
|
|
|
}
|
|
|
```
|
|
|
|
|
|
todo : faire une requête qui fonctionne avec toutes les "sous-relations" de `mod` en interrogeant le schéma unl-rdf |
|
|
\ No newline at end of file |