RCCTD WikiDataCuration07
CNUDH
목차
Contents
연구배경
(내용 서술)
연구목적
(내용 서술)
대상주제
(내용 서술)
쿼리작성
1. 중국에서 개최되는 축제 찾기
축제중에서 중국에서 개최되는 축제 그 다음 그 축제를 하는 지역이어디인지와 언제 하는지에 대한
SELECT
?festival ?festivalLabel ?place ?placeLabel ?dayinyearforperiodicoccurrence ?dayinyearforperiodicoccurrenceLabel
WHERE
{?festival wdt:P31 wd:Q132241. # 축제(festival)
?festival wdt:P17 wd:Q148. # 중국에서 개최
OPTIONAL{ ?festival wdt:P131 ?place. } # 지역
OPTIONAL{ ?festival wdt:P837 ?dayinyearforperiodicoccurrence } # 주최되는 날짜
SERVICEwikibase:label{ bd:serviceParam wikibase:language "ko,zh,en". }
}
2.전세계 축제중 중국에서 개최되는 축제
먼저 전세계 축제 개수를 찾은 다음 중화인민공화국을 첫번째로 나오기 위해 order bt desc에 if를 쓴다음 country
중국 이면 1 아니면 0으로 해서 맨 처음 다음에 제일 많은 국가 순으로 정렬해줘
SELECT ?country ?countryLabel (COUNT(?festival) AS ?festivalCount)
WHERE {?festival wdt:P31 wd:Q132241. # 축제(festival)
?festival wdt:P17 ?country. # 개최 국가
SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en". }}
GROUP BY ?country ?countryLabel
ORDER BY
DESC(IF(?country = wd:Q148, 1, 0)) DESC(?festivalCount)
3.중국 지역별 축제 수
중국 축제 중 어느 지역에서 축제가 많이 열리는지 찾아보기
SELECT ?location ?locationLabel (COUNT(?festival) AS ?festivalCount)
WHERE {?festival wdt:P31 wd:Q132241. # 축제
?festival wdt:P17 wd:Q148. # 중국
?festival wdt:P131 ?location. # 지역별 분류
SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,zh,en". }}
GROUP BY ?location ?locationLabel
ORDER BY DESC(?festivalCount)
4.중국에서 개최되는 지역별 축제 위치 SELECT ?festival ?festivalLabel ?place ?placeLabel ?coord WHERE {
?festival wdt:P31 wd:Q132241. # 축제 (festival) ?festival wdt:P17 wd:Q148. # 국가 = 중국 (People's Republic of China)
OPTIONAL { ?festival wdt:P131 ?place. } # 행정구역 (시/성)
OPTIONAL { ?festival wdt:P625 ?coord. } # 좌표 (지도 표시 가능)
SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en,zh". }
} ORDER BY ?festivalLabel
5.축제이면서 공휴일이 축제 <잘못된쿼리> SELECT ?festival ?festivalLabel ?partof ?partofLabel ?publicholiday ?publicholidayLabel WHERE {
?festival wdt:P31 wd:Q132241. # 축제 (festival)
?festival wdt:P17 wd:Q148. # 국가 = 중국 (People's Republic of China)
OPTIONAL { ?festival wdt:P361 ?partof. } # 일부이다
OPTIONAL { ?publicholiday wdt:P31 wd:Q1197685. } #만약 축제이면서 공휴일인 축제가 있으면 표시해줘 없으면 넘어가도 돼
SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en,zh". }
} ORDER BY ?festivalLabel
- publicholiday를 optional처리 하면 중국 축제이면서 공휴일 ex)단오절,중추절이 나올줄 알았지만 전혀 다르게
공휴일 값이 전혀 축제와 연결되지 않음. <옳은쿼리> SELECT ?festival ?festivalLabel ?partof ?partofLabel ?publicHoliday ?publicHolidayLabel WHERE {
?festival wdt:P31 wd:Q132241. # 축제
?festival wdt:P17 wd:Q148. # 중국에서 개최
OPTIONAL { ?festival wdt:P31 ?publicHoliday.
FILTER(?publicHoliday = wd:Q1197685) } # 공휴일이면 표시
OPTIONAL { ?festival wdt:P361 ?partof. } # 일부인 경우
SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en,zh". }
}
- 이렇게 하면 축제중 공휴일인 축제를 찾을 수 있음
결과해석
(내용 서술)
참고자원
(내용 서술)
주석