﻿<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://dh.aks.ac.kr/Edu/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ko">
		<id>https://dh.aks.ac.kr/Edu/wiki/index.php?action=history&amp;feed=atom&amp;title=DDBC_convert_sql</id>
		<title>DDBC convert sql - 편집 역사</title>
		<link rel="self" type="application/atom+xml" href="https://dh.aks.ac.kr/Edu/wiki/index.php?action=history&amp;feed=atom&amp;title=DDBC_convert_sql"/>
		<link rel="alternate" type="text/html" href="https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;action=history"/>
		<updated>2026-05-12T00:00:10Z</updated>
		<subtitle>이 문서의 편집 역사</subtitle>
		<generator>MediaWiki 1.23.13</generator>

	<entry>
		<id>https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77455&amp;oldid=prev</id>
		<title>Hiblue: Hiblue 사용자가 DDBC convert.sql 문서를 DDBC convert sql 문서로 옮겼습니다</title>
		<link rel="alternate" type="text/html" href="https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77455&amp;oldid=prev"/>
				<updated>2018-08-10T05:45:27Z</updated>
		
		<summary type="html">&lt;p&gt;Hiblue 사용자가 &lt;a href=&quot;/Edu/wiki/index.php/DDBC_convert.sql&quot; class=&quot;mw-redirect&quot; title=&quot;DDBC convert.sql&quot;&gt;DDBC convert.sql&lt;/a&gt; 문서를 &lt;a href=&quot;/Edu/wiki/index.php/DDBC_convert_sql&quot; title=&quot;DDBC convert sql&quot;&gt;DDBC convert sql&lt;/a&gt; 문서로 옮겼습니다&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 8월 10일 (금) 05:45 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(차이 없음)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Hiblue</name></author>	</entry>

	<entry>
		<id>https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77445&amp;oldid=prev</id>
		<title>Hiblue: Hiblue 사용자가 DDBCconvert.sql 문서를 DDBC convert.sql 문서로 옮겼습니다</title>
		<link rel="alternate" type="text/html" href="https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77445&amp;oldid=prev"/>
				<updated>2018-08-10T05:38:57Z</updated>
		
		<summary type="html">&lt;p&gt;Hiblue 사용자가 &lt;a href=&quot;/Edu/wiki/index.php/DDBCconvert.sql&quot; class=&quot;mw-redirect&quot; title=&quot;DDBCconvert.sql&quot;&gt;DDBCconvert.sql&lt;/a&gt; 문서를 &lt;a href=&quot;/Edu/wiki/index.php/DDBC_convert.sql&quot; class=&quot;mw-redirect&quot; title=&quot;DDBC convert.sql&quot;&gt;DDBC convert.sql&lt;/a&gt; 문서로 옮겼습니다&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 8월 10일 (금) 05:38 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(차이 없음)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Hiblue</name></author>	</entry>

	<entry>
		<id>https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77442&amp;oldid=prev</id>
		<title>2018년 8월 10일 (금) 05:37에 대한 Hiblue의 편집</title>
		<link rel="alternate" type="text/html" href="https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77442&amp;oldid=prev"/>
				<updated>2018-08-10T05:37:08Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← 이전 판&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2018년 8월 10일 (금) 05:37 판&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;use hiblue&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;use hiblue&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from t_month order by last&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;select * from t_month order by last&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;235번째 줄:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;235번째 줄:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hiblue</name></author>	</entry>

	<entry>
		<id>https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77441&amp;oldid=prev</id>
		<title>Hiblue: 새 문서: &lt;nowiki&gt; use hiblue select * from t_month order by last --dhtime JDDate  --ddbc Month 	 	--month time:after month 	select distinct '&lt;http://authority.dlia.edu.tw/time#mon'+a.id+'&gt;' as...</title>
		<link rel="alternate" type="text/html" href="https://dh.aks.ac.kr/Edu/wiki/index.php?title=DDBC_convert_sql&amp;diff=77441&amp;oldid=prev"/>
				<updated>2018-08-10T05:36:45Z</updated>
		
		<summary type="html">&lt;p&gt;새 문서: &amp;lt;nowiki&amp;gt; use hiblue select * from t_month order by last --dhtime JDDate  --ddbc Month 	 	--month time:after month 	select distinct &amp;#039;&amp;lt;http://authority.dlia.edu.tw/time#mon&amp;#039;+a.id+&amp;#039;&amp;gt;&amp;#039; as...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;새 문서&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
use hiblue&lt;br /&gt;
select * from t_month order by last&lt;br /&gt;
--dhtime JDDate &lt;br /&gt;
--ddbc Month&lt;br /&gt;
	&lt;br /&gt;
	--month time:after month&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+a.id+'&amp;gt;' as source, '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;' as relation,  '&amp;lt;http://authority.dlia.edu.tw/time#mon'+b.id+'&amp;gt;' as target from t_month a, t_month b where a.last+1=b.first order by source&lt;br /&gt;
&lt;br /&gt;
	--month time:before month&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+a.id+'&amp;gt;' as source, '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;' as relation,  '&amp;lt;http://authority.dlia.edu.tw/time#mon'+b.id+'&amp;gt;' as target from t_month a, t_month b where a.last+1=b.first order by source&lt;br /&gt;
&lt;br /&gt;
	--month label &lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2000/01/rdf-schema#label&amp;gt;', '&amp;quot;'+month_name+'&amp;quot;'+'@hanja' from t_month --질문!! 한자가 맞는가?&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2000/01/rdf-schema#label&amp;gt;', '&amp;quot;'+month+'&amp;quot;^^xsd:nonNegativeInteger' from t_month&lt;br /&gt;
&lt;br /&gt;
	--month hasBeginning day&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+first+'&amp;gt;' from t_month&lt;br /&gt;
	--month hasEnd day&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+last+'&amp;gt;' from t_month&lt;br /&gt;
&lt;br /&gt;
	-- month inside day (inverse of 'month') (예상)&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+t_day.id+'&amp;gt;' from t_month, t_day where t_month.first &amp;lt;= t_day.id and t_month.last &amp;gt;= t_day.id&lt;br /&gt;
		--select * from t_month where id in (10005, 10009, 10010, 10011, 10012, 10013)&lt;br /&gt;
	&lt;br /&gt;
	-- month days (월일수)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#days&amp;gt;','&amp;quot;'+cast(cast(last as int)-cast(first as int) as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from t_month&lt;br /&gt;
	-- month leap (윤달)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;', '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#leap&amp;gt;','&amp;quot;'+cast(leap_month as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from t_month&lt;br /&gt;
&lt;br /&gt;
--ddbc Year&lt;br /&gt;
   	--create t_year&lt;br /&gt;
	create table t_year (id INT IDENTITY(1,1) not null, eraNumber int, era_id int, ganzhi nvarchar(20), first int, last int)&lt;br /&gt;
	insert into t_year select year as eraNumber, era_id, ganzhi, min(first) as first, max(last) as last from t_month group by year, era_id, ganzhi order by first&lt;br /&gt;
	--connect year month&lt;br /&gt;
	update t_month set year_id=a.year_id from (select t_month.id as month_id, t_year.id as year_id from t_year,t_month where t_month.year=t_year.eraNumber and t_month.era_id=t_year.era_id and t_month.ganzhi=t_year.ganzhi) a where a.month_id=t_month.id&lt;br /&gt;
		--select year, era_id, ganzhi, first, last, cast(last as int) - cast(first as int) from t_year &lt;br /&gt;
		--select * from t_month where id in (83069, 83070, 83071, 83068, 83067)&lt;br /&gt;
	--year hasBeginning day 	  &lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(t_year.first as nvarchar)+'&amp;gt;' from t_year &lt;br /&gt;
	--year hasEnd day&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(t_year.last as nvarchar)+'&amp;gt;' from t_year &lt;br /&gt;
    --year inside day(inverse of 'year') (예상)&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+t_day.id+'&amp;gt;' from t_year, t_day where t_day.id&amp;lt;=t_year.last and t_day.id&amp;gt;=t_year.first &lt;br /&gt;
&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#day'+t_day.id+'&amp;gt;',  '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#year&amp;gt;',  '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;' from t_year, t_day where t_day.id&amp;lt;=t_year.last and t_day.id&amp;gt;=t_year.first &lt;br /&gt;
	--year days (연일수)&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#days&amp;gt;', '&amp;quot;'+cast(t_year.last-t_year.first+1 as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from t_year&lt;br /&gt;
&lt;br /&gt;
	--year hasBeginning month&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;' from t_year, t_month where t_year.first=t_month.first&lt;br /&gt;
	--year hasEnd month&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;' from t_year, t_month where t_year.last=t_month.last&lt;br /&gt;
	--year-inside-month  (inverse of year)&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_year.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+t_month.id+'&amp;gt;' from t_year, t_month where t_month.year_id=t_year.id&lt;br /&gt;
	--year before year&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(a.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#before&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.id as nvarchar)+'&amp;gt;' from  t_year a, t_year b where a.first-1=b.last&lt;br /&gt;
	--year-after-year&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(a.id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.id as nvarchar)+'&amp;gt;' from  t_year a, t_year b where a.last+1=b.first&lt;br /&gt;
	--year - era Era&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(id as nvarchar)+'&amp;gt;', '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#era&amp;gt;','&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(era_id as nvarchar)+'&amp;gt;' from t_year&lt;br /&gt;
    --year - eraNumber&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(id as nvarchar)+'&amp;gt;', '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#eraNum&amp;gt;','&amp;quot;'+cast(eraNumber as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from t_year&lt;br /&gt;
    --year ganzhi&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(id as nvarchar)+'&amp;gt;', '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#ganzhi&amp;gt;','&amp;quot;'+ganzhi+'&amp;quot;^^xsd:string@hanja' from t_year&lt;br /&gt;
&lt;br /&gt;
--ddbc era&lt;br /&gt;
	update t_era_names set name=ltrim(rtrim(name))&lt;br /&gt;
	--era-label&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(era_id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2000/01/rdf-schema#label&amp;gt;', '&amp;quot;'+name+'&amp;quot;@'+short_name_eng from t_era_names, c_languages where t_era_names.language_id=c_languages.id&lt;br /&gt;
	--왕년/시연호 = 연호를 쓰지 않는 경우! 그대로 둘것인가 삭제?? 고민여부 -  번역원은 값을 넣지 않음&lt;br /&gt;
	--select distinct eraName, emperor.name from era, emperor where eraName like '%(%' and era.emperor_id=emperor.emperor_id&lt;br /&gt;
	--era- hasBeginning day&lt;br /&gt;
	    select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;' as source, '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(a.first as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a order by source&lt;br /&gt;
	--era hasEnd day&lt;br /&gt;
	    select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;' as source, '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(a.last as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a order by source	&lt;br /&gt;
	--era inside day  (inverse of era)&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;' as source, '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(t_day.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, t_day where t_era.first &amp;lt;= t_day.id and t_era.last &amp;gt;= t_day.id&lt;br /&gt;
	--era days (연호일수)&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#days&amp;gt;', '&amp;quot;'+cast(a.last-a.first+1 as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, &lt;br /&gt;
	--era hasBeginning year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, t_year b where a.first=b.first and a.era_id=b.era_id&lt;br /&gt;
	--era hasEnd year&lt;br /&gt;
    select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, t_year b where a.last=b.last and a.era_id=b.era_id&lt;br /&gt;
    --era inside year  (inverse of era)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(era_id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(id as nvarchar)+'&amp;gt;' from t_year&lt;br /&gt;
		&lt;br /&gt;
	--era Beginning month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(b.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, t_year b where a.first=b.first and a.era_id=b.era_id&lt;br /&gt;
	--era hasEnd month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(b.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, t_year b where a.first=b.first and a.era_id=b.era_id&lt;br /&gt;
    --era inside month (inverse of era)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+t_era.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(t_month.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		t_month,t_year,t_era where t_month.year_id=t_year.id and t_year.era_id=t_era.id&lt;br /&gt;
	&lt;br /&gt;
	--era before era&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#before&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+b.era_id+'&amp;gt;' from (select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, (select era_id, min(first) as first, max(last) as last from t_month group by era_id) b where a.first-1=b.last&lt;br /&gt;
	--era after era &lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+a.era_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+b.era_id+'&amp;gt;' from (select era_id, min(first) as first, max(last) as last from t_month group by era_id) a, (select era_id, min(first) as first, max(last) as last from t_month group by era_id) b where a.last=b.first+1&lt;br /&gt;
				&lt;br /&gt;
&lt;br /&gt;
--emporor&lt;br /&gt;
	--emperor label&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+cast(emperor_id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2000/01/rdf-schema#label&amp;gt;', '&amp;quot;'+name+'&amp;quot;@'+short_name_eng from t_emperor_names, c_languages where t_emperor_names.language_id=c_languages.id&lt;br /&gt;
&lt;br /&gt;
	--emperor hasbeginning day&lt;br /&gt;
	 select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(a.first as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a --685&lt;br /&gt;
		--select emperor_id from t_year,t_era where t_year.era_id=t_era.id group by emperor_id 매칭갯수확인 685&lt;br /&gt;
	--emperor hasEnd day&lt;br /&gt;
	 select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(a.last as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a &lt;br /&gt;
	&lt;br /&gt;
	--emperor inside day (inverse of emperor)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(t_day.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a , t_day where t_day.id&amp;lt;=a.last and t_day.id&amp;gt;=a.first &lt;br /&gt;
	--emperor days(재위일수)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#days&amp;gt;', '&amp;quot;'+cast(a.last-a.first+1 as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a&lt;br /&gt;
&lt;br /&gt;
	--emperor hasbeginning month&lt;br /&gt;
	 select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(t_month.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.first = t_month.first and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emperor hasEnd month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(t_month.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.last = t_month.last and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emporor inside month (inverse of emperor)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+t_era.emperor_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#mon'+cast(t_month.id as nvarchar)+'&amp;gt;' from t_era, t_month where t_month.era_id=t_era.id&lt;br /&gt;
	&lt;br /&gt;
	--emperor hasBeginning year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_month.year_id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.first = t_month.first and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emporor hasEnd year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_month.year_id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.last = t_month.last and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emperor inside year (inverse of emperor)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+t_era.emperor_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(t_month.year_id as nvarchar)+'&amp;gt;' from t_era, t_month where t_month.era_id=t_era.id&lt;br /&gt;
&lt;br /&gt;
	--emperor hasBeginning era&lt;br /&gt;
	 select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(t_era.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.first = t_month.first and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emperor hasEnd era		&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(t_era.id as nvarchar)+'&amp;gt;' from&lt;br /&gt;
		(select t_emperor.id , min(first) as first, max(last) as last from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id) a, t_month, t_era where a.last = t_month.last and t_month.era_id=t_era.id and t_era.emperor_id=a.id&lt;br /&gt;
	--emperor inside era (inverse of emperor)&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+t_era.emperor_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(t_era.id as nvarchar)+'&amp;gt;' from t_era&lt;br /&gt;
&lt;br /&gt;
	--emperor before emperor&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#before&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+b.id+'&amp;gt;' from (select t_emperor.id , min(first) as first, max(last) as last, dynasty_id from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id, dynasty_id) a, (select t_emperor.id , min(first) as first, max(last) as last, dynasty_id  from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id, dynasty_id) b where a.first-1+1=b.last and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--emperor after emperor&lt;br /&gt;
		select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+a.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+b.id+'&amp;gt;' from (select t_emperor.id , min(first) as first, max(last) as last, dynasty_id from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id, dynasty_id) a, (select t_emperor.id , min(first) as first, max(last) as last, dynasty_id  from t_year, t_emperor, t_era where t_year.era_id=t_era.id and t_era.emperor_id=t_emperor.id group by t_emperor.id, dynasty_id) b where a.last+1=b.first and a.dynasty_id=b.dynasty_id	&lt;br /&gt;
&lt;br /&gt;
--dynasty&lt;br /&gt;
	--dynasty label&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dyansty'+cast(dynasty_id as nvarchar)+'&amp;gt;', '&amp;lt;http://www.w3.org/2000/01/rdf-schema#label&amp;gt;', '&amp;quot;'+name+'&amp;quot;@'+short_name_eng from t_dynasty_names, c_languages where t_dynasty_names.language_id=c_languages.id&lt;br /&gt;
	--dynasty nation&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dyansty'+cast(id as nvarchar)+'&amp;gt;', '&amp;lt;http://dh.aks.ac.kr/ontologies/dhtime#nation&amp;gt;', '&amp;quot;'+type+'&amp;quot;^^xsd:string' from t_dynasty&lt;br /&gt;
	&lt;br /&gt;
	--dynasty hasbeginning day&lt;br /&gt;
		--create view t_rel as select distinct t_month.id as month_id,t_year.id as year_id, emperor_id, dynasty_id, t_month.first, t_month.last from t_year,t_era,t_emperor,t_month where t_year.era_id=t_era.id and t_emperor.id=t_era.emperor_id and t_month.year_id=t_year.id&lt;br /&gt;
	 select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(min(first) as nvarchar)+'&amp;gt;' from t_rel group by dynasty_id&lt;br /&gt;
	--dynasty hasEnd day&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(max(last) as nvarchar)+'&amp;gt;' from t_rel group by dynasty_id&lt;br /&gt;
	--dynasty inside day&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#day'+cast(t_day.id as nvarchar)+'&amp;gt;' from (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_day where t_day.id&amp;lt;=a.last and t_day.id&amp;gt;=a.first &lt;br /&gt;
	--dynasty days&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#days&amp;gt;', '&amp;quot;'+cast(a.last-a.first+1 as nvarchar)+'&amp;quot;^^xsd:nonNegativeInteger' from (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a&lt;br /&gt;
	&lt;br /&gt;
	--dynasty hasBeginning month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#month'+cast(b.month_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.first=b.first and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dynasty hasEnd month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#month'+cast(b.month_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.last=b.last and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dyansty insdie month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#month'+cast(month_id as nvarchar)+'&amp;gt;' from t_rel &lt;br /&gt;
&lt;br /&gt;
	--dynasty hasBeginning year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.year_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.first=b.first and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dynasty hasEnd year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(b.year_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.last=b.last and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dyansty inside year&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#year'+cast(year_id as varchar)+'&amp;gt;' from t_rel&lt;br /&gt;
	&lt;br /&gt;
	--dynasty hasBeginning era&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(b.era_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.first=b.first and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dynasty hasEnd era&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(b.era_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.last=b.last and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dyansty inside era&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(era_id as varchar)+'&amp;gt;' from t_rel&lt;br /&gt;
&lt;br /&gt;
	--dynasty hasBeginning emperor&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasBeginning&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(b.emperor_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.first=b.first and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dynasty hasEnd emperor&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#hasEnd&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(b.emperor_id as nvarchar)+'&amp;gt;' from &lt;br /&gt;
	 (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a,	t_rel b where a.last=b.last and a.dynasty_id=b.dynasty_id&lt;br /&gt;
	--dyansty inside emperor&lt;br /&gt;
	select distinct '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+dynasty_id+'&amp;gt;' , '&amp;lt;http://www.w3.org/2006/time#inside&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#era'+cast(emperor_id as varchar)+'&amp;gt;' from t_rel&lt;br /&gt;
&lt;br /&gt;
	--dynasty before dynasty&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#before&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#dyansty'+b.dynasty_id+'&amp;gt;' from (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a, (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) b where a.first-1=b.last &lt;br /&gt;
&lt;br /&gt;
	--dynasty after dynasty&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.dynasty_id+'&amp;gt;', '&amp;lt;http://www.w3.org/2006/time#after&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#dyansty'+b.dynasty_id+'&amp;gt;' from (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) a, (select dynasty_id, min(first) as first, max(last) as last from t_rel group by dynasty_id) b where a.last+1=b.first &lt;br /&gt;
&lt;br /&gt;
	--따로 노는 왕조들;;;&lt;br /&gt;
	--select * from t_dynasty_names where dynasty_id in (0,1,2,3,4,5,6,7,8,9,20,21,23,24,25,26,27,30,33,38,77,80,84,94,95,97,98,99,100,101,102,107,120)&lt;br /&gt;
	&lt;br /&gt;
--class정의&lt;br /&gt;
	--day class Day&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#day'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#Day&amp;gt;' from t_day&lt;br /&gt;
	--month class Month&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#mon'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#Class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#Month&amp;gt;' from t_month&lt;br /&gt;
	--year class Year&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#year'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#Class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#Year&amp;gt;' from t_year&lt;br /&gt;
	--emperor class Emperor&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#emperor'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#Class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#Emperor&amp;gt;' from t_emperor&lt;br /&gt;
	--era class Era&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#era'+id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#Class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#Era&amp;gt;' from t_era&lt;br /&gt;
	--dynasty class Dynasty&lt;br /&gt;
	select '&amp;lt;http://authority.dlia.edu.tw/time#dynasty'+a.id+'&amp;gt;', '&amp;lt;http://www.w3.org/2002/07/owl#Class&amp;gt;', '&amp;lt;http://authority.dlia.edu.tw/time#month&amp;gt;' from t_dynasty&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hiblue</name></author>	</entry>

	</feed>