# Ejemplo de Jorge ``` <human> EXTRA wdt:P31 { wdt:P22 @<father> *; } <father> EXTRA wdt:P31 { wdt:P735 [<human>/P734/P31/PQ642] * ; # given name wdt:P734 [<human>/P734] * ; # family name } ``` El ejemplo con ShEx de verdad sería: El camino es wdt:P22 (Padre) / wdt:P735 (nombre) / wdt:P734 (apellido) / La relación paternofilial viene dada por una de las siguientes condiciones: 1. Comparten el mismo apellido. ``` :x :apellidos :a :y :apellidos :a => :x :padre :y SPARQL Construct Con números: :x :P734 :a . :y :P734 :a . En SPARQL: SELECT ?x ?y { ?x :P734 ?a . ?y :P735 ?a } ``` 2. El apellido del hijo es un patronímico del nombre del padre (Fernández-Fernando). ``` :x :apellidos (P734) :a :y :nombre (P735) :b :a :patronimico (:PQ642) :b => :x :padre :y ``` Ejemplo de wikidata: https://www.wikidata.org/wiki/Q164892 ``` :x :P734 :a . :a :P31 :PatronimicFamilyName (Q114455398) {| :P642 :b |} :y :P735 :b => :x padre :y ``` Se podría expresar en SPARQL con una consulta CONSTRUCT: https://w.wiki/AJ26 Con Select para hacer pruebas... ``` CONSTRUCT { # :x padre :y ?x :padre ?y } WHERE { ?x wdt:P734 ?a . ?a p:P31 ?ps . ?ps ps:P31 wd:Q114455398 ?ps pq:P642 ?b . ?y wdt:P735 ?b } ``` Inventándonos un lenguaje de reglas tipo Prolog y similares para este caso: ``` Padre(?x,?y) :- wdt:P734(?x,?a), p:P31(?a, ?ps), ps:P31(?ps, wd:Q114455398), pq:P642(?ps, ?b), wdt:P735(?y, ?b). . . . ``` Inventándonos un lenguaje de reglas tipo Prolog tipo WShEx: ``` Padre(?x,?y) :- :P734(?x,?a), :P31(?a, [ wd:Q114455398 ] {| :P642(?ps, ?b) |}, :P735(?y, ?b) . . . . ``` A explorar: - Crear un lenguaje tipo WShEx para declarar reglas y hacer inferencia en wikidata, te atreves? + Muy ambicioso - Se sale del ámbito de la tesis? ``` <FamilyNameWithPatronymicValue> EXTRA :P31 { :P31 [ :Q114455398 ] {| :P642 . * |} } ``` ``` <human> { wdt:P22 @<father> *; } <father> { wdt:P735 [<human>/P734/P31/PQ642] * ; # given name wdt:P734 [<human>/P734] * ; # family name } ```