query-7cbb4fc5c90363ad0d6b0eeca721132f

rq turtle/ttl

Categories and linksHi! I think this one is pretty easy. I need a query listing every item project-linked to a es.wikipedia category. And I need that link including the secuence "Categoría:Castillos ". I wrote the following query and... it works!

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?LabelES
WHERE
{  

?item wdt:P31 wd:Q4167836 .
 ?sitelink schema:about ?item; 
           schema:isPartOf <https://es.wikipedia.org/> . 
  ?item rdfs:label ?LabelES;
                 FILTER (lang(?LabelES) = "es") . 
         FILTER regex (?LabelES, "Categoría:Castillos ").
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?LabelES"):::projected v2("?item"):::projected v3("?sitelink") c7([https://es.wikipedia.org/]):::iri c4(["wd:Q4167836"]):::iri f0[["regex(?LabelES,'Categoría:Castillos ')"]] f0 --> v1 f1[["?LabelES = 'es'"]] f1 --> v1 v2 --"wdt:P31"--> c4 v3 --"schema:about"--> v2 v3 --"schema:isPartOf"--> c7 v2 --"rdfs:label"--> v1