緣起
會進行這個Linked Sesnor Data的試作有一些緣由,把時間拉回2013年8月1日在環保署召集的「環境資源資料開放專家諮詢會議」,開會目的除了討論環保署資料開放平台,更是在於討論紫外線測站資料來當開放資料五顆星的範例。太酷了! 環保署願意進行開放資料5顆星的示範是一件很棒的事! 不但有助於環保署所屬開放資料品質的提昇,也可以刺激其它政府部會對於開放資料品質的關注。但會中業務單位所簡報的那個「紫外線測站的五顆星開放資料」是問題多多,對於OWL/RDF有了解的人,其實不難發現簡報中的那份RDF是有問題的,況且把資料編譯為RDF格式充其量就是4顆星等級,怎麼可以說是5顆星呢?再者,所謂的5顆星開放資料是要連結什麼呢!?
這個問題後來成為與會專家要給予的答案。資料集與資料集要連結,這之間就必需要有某一些關連,也就是所謂的context,以致於資料集中的某一個entity可以與另一個entity以某種形式相連,在普遍的做法就是用owl:sameAs來表達在不同資料集中的二個entity是一樣的,以我有限的所知,資料集之間的context可以由三個特性來思考: 地理空間(Geospatial)、時間的(Temporal)、和主題屬性的(Attributiive),以環保署開資料平台中的紫外線測站資料為例,有可能連結的部份看來只有地理空間的特性了! 就資料特性而言,若環保署要做Linked Open Data (LOD),建議應該朝向Linked Sesnor Data,就是把所有測站以OGC的Sensor Web Enablement (SWE)和 W3C SSN Ontology 二者來表達環保署中的測站,而測站所產生的資料則是以Linked Observation Data 來詮釋。


很遺憾的是,他們並沒有採納這些意見,在環保署開放資料平台上線後,12月初無意間看到,那個有問題的說明己經在環保署開放資料5顆星的頁面上,而有問題的RDF資料也提供下載。這種做法給了二個不好的示範,首先,在專家會議中,本人就不認為那是對的說明和對的RDF資料,但這些內容和資料還是上線了,好吧! 意見也給了,那專家會議的用意什麼? 另一個是比較嚴重的問題是,把錯誤的LOD說明和資料放在一個政府公署開放平台的網頁上,很容易就會誤導其它人,對於LOD的理解,開放也得開放「對」的資訊,是吧! 身為市井小民所幸可以透過平台「意見回饋」反應機制,向環保署說明,那份說明的LOD頁面和RDF資料有問題,哈! 意見回饋比專家會議有效耶! 環保署在一週後拿掉在資料開放平台上的那些LOD資料,所以大家己經看不到了,接著承辦這項業務的人員也來拜訪,並帶著修改的RDF來討論。的確,修改後的RDF,使用了標準語彙,如Dublin Core,但看起來就是一份單純由表格轉為RDF的文件,這不見得有錯,但語意的表達是相當弱的,對於紫外線測站詮釋,也就是紫外線測站所表達出的概念是什麼?並沒有辦法得知。
或許,你心中油然而生一個問題,「疑!那些LOD的資料,在網頁看起來都像是表格一樣,那資料轉成這樣有什麼問題?」嗯! 那些LOD的資料背後其實都有一個ontology來表達資料的語意,只是放上網頁為了瀏覽方便而表現成表格的形態,利用標準語彙也是在確保資料語意不被誤解,但ontology中,概念的結構和邏輯的規範可以使資料語意更為完備,並可以進一步達到邏輯推理,當然目前我們只需要達到將資料本身概念充份地表達,在這個紫外線測站的案例中,如同前面所說,還是採用W3C SSN Ontology來表達紫外線測站才是比較恰當的方式。
從建構知識本體(ontology)開始
這筆所謂的紫外線測站基本資料所記述的資料相當有限,主要項目如下:
- 紫外線測站的中英名稱
- 紫外線測站所在的縣市鄉鎮
- 紫外線測站的空間座標和住址
- 紫外線測站的發佈機關
這筆有限的資料能表達出的內涵確實不多,若只根據這些項目編出的ontology應該也很空洞,對於一個用來表達紫外線測站的ontology而言,不僅僅是要表述地理空間的描述,更重要是要表達什麼是紫外線測站和紫外線測站觀測什麼。根據W3C SSN Ontology 對於感測器(Sesnor)的描述和定義,可以重新想想,要如何重新表達這筆紫外線測站資料:
- 紫外線感測器本身是用來測量紫外線(Ultraviolet)的
- 紫外線觀測是以紫外線指數(UV Index)
- 紫外線感測器是裝在中央氣象局的氣象站或環保署的空氣監測站
- 無論是氣象站或空氣監測站都有空間座標、地址、和所在行政區域
W3C SSN Ontology 這份報告附有很多案例是可以依循的,其中對於Linked Sesnor Data 就有一個案例,對於紫外線測站資料,不就是一個很好拿來模仿的案例! 對於感測器(Sesnor)的描述和定義,這個案例中主要使用W3C SSN ontology和DUL(DOLCE Ultra Light) ontology,此外也描述感測器(Sesnor)觀測能力和裝在氣象局的事實,更重要的是這樣表達的感測器(Sesnor)是可以被連結(link)。根據這個架構,可以設計一個ontology來解釋這筆紫外線測站資料,而這個ontology 不單單只有紫外線測站的ontology,而應該是感測器知識本體(sesnor ontology),且可以應用在任何不同的感測器上,我習慣先用畫圖把需要的class和individuals先勾勒出來,以便後續ontology的編輯。
與寫程式類似,ontology的編輯可以用文字編輯器,但也有一些工具輔助,一般常用的工具為Protégé,根據上面那個畫好的圖,這個UV sesnor ontology 很快就能完成。
Linked Data: 讓自己可以被連結,也可以連結別人
一一解釋UV Sesnor Ontology中類型(class)和個體(individual)會是冗長的說明,為了有效率的說明UV Sesnor Ontology中的知識表達,以下是擷取部份段落來做解釋:
Solar501A (亂瞎掰的)感測器本身是用來測量紫外線(Ultraviolet)的,安裝於台北氣象站的系統平台上,且有量測紫外線指數(UV Index)的能力,而紫外線指數有15個等級,每一個等級就是100焦身/每平方公尺,例如8就是測到紫外線800-899焦身/每平方公尺。紫外線指數又可以分級為低量級、中量級、高量級、過量級、和危險級,下面案例只顯示紫外線指數8-10是過量級。
### http://lod.tw/ontologies/weather-station/uv#Sensor_Solar501A :Sensor_Solar501A rdf:type ssn:SensingDevice , owl:NamedIndividual ; ssn:onPlatform :Platform_for_Taipei_Weather_Station ; ssn:hasMeasurementCapability :UV_Index_MeasurementCapability . ### http://lod.tw/ontologies/weather-station/uv#UV_Index_MeasurementCapability :UV_Index_MeasurementCapability rdf:type ssn:MeasurementCapability , owl:NamedIndividual ; ssn:inCondition :UV_Sacle ; ssn:forProperty :Ultraviolet . ### http://lod.tw/ontologies/weather-station/uv#Ultraviolet :Ultraviolet rdf:type ssn:Property , owl:NamedIndividual . ### http://lod.tw/ontologies/weather-station/uv#UV_Sacle :UV_Sacle rdf:type ssn:MeasurementRange , owl:NamedIndividual ; ssn:hasValue :UV_Index_0_interval , :UV_Index_10_interval , :UV_Index_11_interval , :UV_Index_12_interval , :UV_Index_13_interval , :UV_Index_14_interval , :UV_Index_15_interval , :UV_Index_1_interval , :UV_Index_2_interval , :UV_Index_3_interval , :UV_Index_4_interval , :UV_Index_5_interval , :UV_Index_6_interval , :UV_Index_7_interval , :UV_Index_8_interval , :UV_Index_9_interval . ### http://lod.tw/ontologies/weather-station/uv#UV_Index_8_interval :UV_Index_8_interval rdf:type DUL:Region , owl:NamedIndividual ; :hasMeasurementPropertyMaxValue :UV_Index_8_max_value ; :hasMeasurementPropertyMinValue :UV_Index_8_min_value . ### http://lod.tw/ontologies/weather-station/uv#UV_Index_8_max_value :UV_Index_8_max_value rdf:type DUL:Amount , owl:NamedIndividual ; DUL:hasDataValue "8.99"^^xsd:float ; DUL:isClassifiedBy :Hecto_joule_per_square_meter . ### http://lod.tw/ontologies/weather-station/uv#UV_Index_8_min_value :UV_Index_0_min_value rdf:type DUL:Amount , owl:NamedIndividual ; DUL:hasDataValue "8.0"^^xsd:float ; DUL:isClassifiedBy :Hecto_joule_per_square_meter . ### http://lod.tw/ontologies/weather-station/uv#Very_High_Risk :Very_High_Risk rdf:type ssn:FeatureOfInterest , owl:NamedIndividual ; rdfs:label "過量級"^^xsd:string ; ssn:hasValue :UV_Index_10_interval , :UV_Index_9_interval , :UV_Index_8_interval . |
台北氣象站的系統平台是台北氣象站的一部份,台北氣象站是中央氣象局的一部份,而台北氣象站和中央氣象局都是一種組織(Organization)。
### http://lod.tw/ontologies/weather-station/uv#Platform_for_Taipei__Weather_Station :Platform_for_Taipei__Weather_Station rdf:type ssn:Platform , owl:NamedIndividual ; ssn:attachedSystem :Sensor_Solar501A ; DUL:hasLocation :Site_Taipei_Weather_Station ; DUL:isPartOf :Taipei_Weather_Station . ### http://lod.tw/ontologies/weather-station/uv#Taipei_Weather_Station :Taipei_Weather_Station rdf:type :Weather_Station , owl:NamedIndividual ; rdfs:label "Taipei"^^xsd:string , "台北"^^xsd:string ; DUL:isPartOf :Central_Weather_Bureau_Taiwan ; DUL:hasLocation :Site_Taipei_Weather_Station . ### http://lod.tw/ontologies/weather-station/uv#Weather_Station :Weather_Station rdf:type owl:Class ; rdfs:subClassOf DUL:Organization . ### http://lod.tw/ontologies/weather-station/uv#Central_Weather_Bureau_Taiwan :Central_Weather_Bureau_Taiwan rdf:type :Government_Organization , owl:NamedIndividual ; rdfs:label "中央氣象局"^^xsd:string . |
台北氣象站是在台北氣象站場址(site),這個場址是一個地方(Place),有一個WGS 84 XY座標的參考點(reference point),且這個場址有一個地址(Address),這場址也在一級行級行級區的台北市之中和二級行政區的大安區之中,且大安區也在台北市之中,而台北市在台灣之中。
### http://lod.tw/ontologies/weather-station/uv#Site_Taipei_Weather_Station :Site_Taipei_Weather_Station rdf:type DUL:Place , owl:NamedIndividual ; geo:hasGeometry :Reference_Point_Taiepi_Weather_Station ; vcard:hasAddress :Address_Taipei_Weather_Station ; :is_in :Daan_District ; :is_in :Taipei_City . ### http://lod.tw/ontologies/weather-station/uv#Reference_Point_Taiepi_Weather_Station :Reference_Point_Taiepi_Weather_Station rdf:type geo:Point , owl:NamedIndividual ; wgs84_pos:long "121.55834"^^xsd:float ; wgs84_pos:lat "22.036934"^^xsd:float ; geo:asWKT "Point(121.5583420000, 22.0369330000)"^^sf:wktLiteral . ### http://lod.tw/ontologies/weather-station/uv#Address_Taipei_Weather_Station :Address_Taipei_Weather_Station rdf:type owl:NamedIndividual , vcard:Address ; vcard:street-address "公園路64號"^^xsd:string ; vcard:locality "台北市"^^xsd:string ; vcard:country-name "台灣"^^xsd:string ; vcard:region "大安區"^^xsd:string . ### http://lod.tw/ontologies/weather-station/uv#Daan_District :Daan_District rdf:type lodtw:2nd_Administration , owl:NamedIndividual ; :is_in :Taipei_City ; owl:sameAs freebase:Daan District , geonames:Daan District . ### http://lod.tw/ontologies/weather-station/uv#Taipei_City :Taipei_City rdf:type lodtw:1st_Administration , owl:NamedIndividual ; :is_in :Taiwan ; owl:sameAs freebase:Taipei , geonames:Taipei , wikidata:Taipei , depedia:Taipei. |
眼尖的你不難的不發現,上述的每一個「類型(Class)」和「個體(individuals)」都是以URL方式呈現,如http://lod.tw/ontologies/weather-station/uv#Taipei_City; 且上一段中的台北市和大安區都己經以owl:sameAs分別連結到DBPedia、Geonames、Wikidata、或Freebase,如UV sesnor ontology中的Taipei_City是以owl:sameAs連結http://rdf.freebase.com/ns/m.0ftkx, http://sws.geonames.org/7280290/, http://www.wikidata.org/entity/Q1867, 和http://dbpedia.org/resource/Taipei。與一開始所做的分析一樣,在這筆資料中地名是最有可能拿來連結其它資料的實體(entities)。
最後,想強調的是,編寫這個UV Sesnor ontology用意在於讓更多人了解什麼是LOD,並期待能引發更多LOD的討論,而能有更多更正確的LOD資料。