Fork of مقالات بحاجة لصور من ويكي بيانات - أعلام by ASammour
This query is marked as a draft This query has been published by ASammour.

SQL

AخA
 
USE arwiki_p;
select concat("[[",p.page_title,"]]") as "عنوان المقالة",
concat("[[ملف:",wpp.pp_value,"|تصغير]]") as "الصورة" , 
concat("<nowiki>[[ملف:",wpp.pp_value,"|تصغير]]</nowiki>") as "نص الصورة"
from  
page p
inner join page_props pp
on pp.pp_page = p.page_id
inner join wikidatawiki_p.page wp
on wp.page_title like pp.pp_value
inner join wikidatawiki_p.page_props wpp
on wpp.pp_page = wp.page_id
where p.page_id in (
  select categorylinks.cl_from from categorylinks where categorylinks.cl_from = p.page_id and categorylinks.cl_to like "%كومنز%"
)
and p.page_id not in (
  select pp_page from page_props where pp_propname like "page_image" and pp_page = p.page_id
)
and p.page_id not in (
  select pp_page from page_props where pp_propname like "page_image_free" and pp_page = p.page_id
)
and p.page_id not in (
  select cl_from from categorylinks where cl_from = p.page_id and cl_to = "صفحات_توضيح"
)
and p.page_id not in (
  select cl_from from categorylinks where cl_from = p.page_id and cl_to = "بوابة_تقويم/مقالات_متعلقة"
)
and p.page_id in (
  select cl_from from categorylinks where cl_from = p.page_id and cl_to = "بوابة_جغرافيا/مقالات_متعلقة"
)
and p.page_namespace = 0
and p.page_is_redirect = 0
and pp.pp_propname like "wikibase_item"
and wp.page_namespace = 0
and wp.page_is_redirect =0
and wp.page_content_model like "wikibase-item" 
and wpp.pp_propname like "page_image_free"
limit 500;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...