簡體   English   中英

關於使用 static object 值創建子類的本體設計

[英]Ontology design about creating subclasses with static object values

我有一個與本體設計有關的問題。 假設我有一個應試學生關系。 學生可以參加一項或多項英語測試(不同類型)。 我在這里寫數據觀點,所以首先我創建了以下三元組(並非所有內容都有意義,數字、類型等具有代表性)。 但是對於學生來說,測試范圍和測試方式總是相同的。

<http://example.org/student1_english_test>
    a       <http://example.org/EnglishTest> ;
    <http://example.org/testResult>
            "80"^^<http://www.w3.org/2001/XMLSchema#double> ;
    <http://example.org/testType>
            <http://example.org/test/TOEFL_test> ;
    <http://example.org/testRange>
            <http://example.org/1-100> ;
    <http://example.org/testStyle>
            <http://example.org/Facultative> .

然而,我注意到測試范圍和測試風格是重復的,所以我想創建托福和雅思作為英語測試的子類,以便我用相關屬性定義它們一次並描述一次,這樣它們就不會重復。 我可以像下面這樣直接使用嗎? 在那種情況下,我如何描述謂詞測試范圍和測試風格的值?

<http://example.org/student1_english_test>
    a       <http://example.org/TOEFL_test> ;

這意味着,如果學生參加托福考試,那么他將始終是兼任的,並且介於 1-100 之間。 然而,這就是我感到困惑的地方。 如果我將它們定義為子類,是否可以為它們定義一些 static 對象? 還是我必須將它們創建為實例?

    <http://example.org/student1_english_test>
    a       <http://example.org/EnglishTest> ;
    <http://example.org/testType>
            <http://example.org/TOEFL_test> ;
    <http://example.org/testResult>
            "80"^^<http://www.w3.org/2001/XMLSchema#double> .

  <http://example.org/xxx>
     a       <http://example.org/test/TOEFL_test> ;
     <http://example.org/testStyle>
          <http://example.org/Facultative> ;
     <http://example.org#testRange>
           <http://example.org/1-100>  .

    <http://example.org/yyy>
      a       <http://example.org/test/IELTS_test> ;
      <http://example.org/testType>
              <http://example.org/Oral> ;
      <http://example.org#testRange>
              <http://example.org/1.0-4.0>.  

在 RDF 中,您可以將屬性應用於任何事物,無論是個人還是 class,但本體的設計(以及相關詞匯)取決於您想要實現的便利性。 有幾種選擇:

class 的屬性

您可以像<TOEFL_test>一樣保留 class 並對其應用特定屬性:

<TOEFL_test> a rdfs:Class ;
  <testStyle> <Facultative> ;
  <testRange> <1-100> .

<IELTS_test> a rdfs:Class ;
  <testStyle> <Oral> ;
  <testRange> <1.0-4.0> .

這是定義它的最簡單的方法,但使用起來不太方便:OWL 不能用於將 class 視為個體(反之亦然),因此當您以任何方式使用 class 時,這些屬性將基本上不可見. 然而有效的是使用 SPARQL,因為您可以輕松編寫?test a/<testStyle>?style來獲取樣式,而無需在個人上定義它。

關於 class 的聲明

如果你想保留<testStyle><testRange>的現有定義,你可以對每個 class 做一些具體的陳述,為所有個體添加各自的屬性:

<TOEFL_test> rdfs:subClassOf [
  a owl:Restriction ;
  owl:onProperty <testStyle> ;
  owl:hasValue <Facultative>
] , [
  a owl:Restriction ;
  owl:onProperty <testRange> ;
  owl:hasValue <1-100>
] .

<IELTS_test> rdfs:subClassOf [
  a owl:Restriction ;
  owl:onProperty <testStyle> ;
  owl:hasValue <Oral>
] , [
  a owl:Restriction ;
  owl:onProperty <testRange> ;
  owl:hasValue <1.0-4.0>
] .

這也允許您將各個測試類型保留為類,同時暗示有關各個測試的信息,但它有點復雜,並且需要您在每次添加新測試類型時指定這一點。

使用個人

也許最好的方法是根本不使用類並返回到單獨的測試類型:

<TOEFL_test>
  <testStyle> <Facultative> ;
  <testRange> <1-100> .

<IELTS_test>
  <testStyle> <Oral> ;
  <testRange> <1.0-4.0> .

<student1_english_test>
  <testType> <TOEFL_test> .

您仍然可以通過屬性鏈公理為每個單獨的測試提供<testStyle><testRange>三元組:

<testStyle> owl:propertyChainAxiom ( <testType> <testStyle> ) .
<testRange> owl:propertyChainAxiom ( <testType> <testRange> ) .

您不必為每種測試類型編寫任何復雜的東西,並且可以通過 OWL 和 SPARQL 輕松獲得相關信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM