weso / sparkwdsub

Spark processing of wikidata subsets
MIT License
0 stars 3 forks source link

Extraction of nodes that lack required properties #18

Open ExarcaFidalgo opened 2 years ago

ExarcaFidalgo commented 2 years ago

Un ejemplo vale más que mil palabras:

PREFIX :  <http://www.wikidata.org/entity/>
PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>

start=@<publication>

<publication> EXTRA :P31 {
        :P50 @<author> +;
}

<author> EXTRA :P31 {
        :P31 @<human> ;
    :P27 @<country_type> + ;
}

<country> EXTRA :P31 {
    :P31 @<country_type> ;
}

<human>  [:Q5]
<country_type>  [:Q29]

Ejecutando con esta Shape obtiene, como autor de una publicación coreana -una de tantas-, a una "Academia de Estudios Coreanos" que carece tanto de P27 como P31, que definen a nuestro autor.

Esto significa que es capaz de discernir cuándo la propiedad de una entidad posee el valor que le indicamos, pero si no tiene tal propiedad, la da por válida.

Extraction of nodes lacking the required properties

An example is worth a thousand words:

PREFIX :  <http://www.wikidata.org/entity/>
PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>

start=@<publication>

<publication> EXTRA :P31 {
        :P50 @<author> +;
}

<author> EXTRA :P31 {
        :P31 @<human> ;
    :P27 @<country_type> + ;
}

<country> EXTRA :P31 {
    :P31 @<country_type> ;
}

<human>  [:Q5]
<country_type>  [:Q29]

By running this Shape, it obtains, as the author of a Korean publication -one of many-, an "Academy of Korean Studies" that lacks both P27 and P31, which define our author.

This means that it is able to discern when an entity's property has the value we indicate, but if it does not have such a property, it considers it valid.