query-7ecc249ba7c90328a2e4818c08995c56

rq turtle/ttl

Chidgk1Pmt(Q85817274)Şırnak Silopi power station w:Category:Power stations in Turkey(Q8788931)Category:Power stations in Turkey

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?article_link ?instance_of ?instance_ofLabel
WHERE
{

{
  SELECT ?article_link ?site
  WHERE
  {

{
  SELECT ?title ?site ?language_code
  WHERE
  {
    ?category_link schema:about wd:Q8788931 . # Category:Power stations in Turkey (Q8788931)
    ?category_link schema:isPartOf ?site .
    ?category_link schema:inLanguage ?language_code .
    ?category_link schema:name ?category_title .
    BIND (STRBEFORE(STRAFTER(STR(?site), "https://"), "/") AS ?endpoint)
    BIND (CONCAT('deepcat:"', STRAFTER(?category_title, ':'), '"') AS ?search_string)
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:api "Search" .
      bd:serviceParam wikibase:endpoint ?endpoint .
      bd:serviceParam mwapi:srnamespace "0" .
      bd:serviceParam mwapi:srsearch ?search_string  .
      ?title wikibase:apiOutput mwapi:title .
    }
  }
}    BIND (STRLANG(?title, ?language_code) AS ?title_with_language)
    ?article_link schema:name ?title_with_language .
  }
}  ?article_link schema:name ?title_with_language .
  ?article_link schema:isPartOf ?site .
  ?article_link schema:about ?item .
  OPTIONAL { ?item wdt:P31 ?instance_of . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,tr". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?article_link"):::projected v1("?category_link") v4("?category_title") v5("?endpoint") v11("?instance_of"):::projected v10("?item"):::projected v3("?language_code") v6("?search_string") v2("?site") v7("?title") v8("?title_with_language") c12(["0"]):::literal c2(["wd:Q8788931"]):::iri c19(["#91;AUTO_LANGUAGE#93;,en,tr"]):::literal c7(["bd:serviceParam"]):::iri c9(["Search"]):::literal c15(["mwapi:title"]):::iri v1 --"schema:about"--> c2 v1 --"schema:isPartOf"--> v2 v1 --"schema:inLanguage"--> v3 v1 --"schema:name"--> v4 bind0[/"substring-before(substring-after(str(?site),'https://'),'/')"/] v2 --o bind0 bind0 --as--o v5 bind1[/"concat('deepcat:"',substring-after(?category_title,':'),'"')"/] v4 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c7 --"mwapi:api"--> c9 c7 --"mwapi:endpoint"--> v5 c7 --"mwapi:srnamespace"--> c12 c7 --"mwapi:srsearch"--> v6 v7 --"mwapi:apiOutput"--> c15 end bind2[/"STRLANG(?title,?language_code)"/] v7 --o bind2 v3 --o bind2 bind2 --as--o v8 v9 --"schema:name"--> v8 v9 --"schema:name"--> v8 v9 --"schema:isPartOf"--> v2 v9 --"schema:about"--> v10 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v10 -."wdt:P31".-> v11 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c7 --"mwapi:language"--> c19 end