近來許多研究著重在 context-awareness, ubiquitous computing 或是自動安全監控等領域,目標均是根據環境狀況,透過網路做出適當的反應,而不僅侷限於單機。這些領域牽涉到高度動態的環境,必須透過交換環境資訊與環境推論來達成目標。因此 context representation 與 context reasoning 扮演很重要的角色。本文提出ontology-based 的方法:1) 使用 Web Ontology Language (OWL) 描述 context knowledge,2) 利用 Semantic Web Rule Language (SWRL) 撰寫 rule-based 的推論規則,來達成 context reasoning。OWL 可以定義context knowledge 之間的關係,較詳細描述 context,而且是 XML-Based 語言,因此有良好的 interoperability,容易達成 knowledge分享與重用;使用 SWRL 可以使用已定義好的 OWL knowledge撰寫 rule-based 的First Order Logic (FOL) 推論規則,有較佳結合性,開發與維護較為方便;SWRL亦是 XML-Based 語言,與推論引擎之間沒有強烈的相依性,日後若需要更換推論引擎,不用重新撰寫推論規則來符合推論引擎的語法格式,提升系統維護性。 Recently, quite a few researches on context-awareness, ubiquitous computing and automatic surveillance have emerged. Their objectives are to appropriately react to current context situation on the web, rather than in a single machine. These require exchanging context in an extremely dynamic web environment, as well as reasoning about the context to achieve a goal. Thus, context representation and context reasoning play significant roles here. This thesis presents an ontology-based approach to: 1) employ web ontology language (OWL) to depict context knowledge, and 2) to use semantic web rule language (SWRL) to represent rule-based inference rules for context reasoning. OWL describes context knowledge in details by defining relationships among knowledge. In addition, as an XML-based language, its good interoperability facilitates knowledge sharing and reuse. Further, SWRL represents rule-based first-order logic (FOL) inference rules, which are expressed in term of the predefined OWL taxonomic context knowledge. By doing so, SWRL rules are perfectly integrated with OWL, making it easy to develop and maintain. Besides, as SWRL is also XML-based, it is less dependent upon inference engine. That is, inference engine can be changed without rewriting the rules in engine-specific syntax. This enhances maintainability.