OWL - 合并 unionOf 和 allValuesFrom

OWL - combining unionOf and allValuesFrom

这样写一个owl:unionOf是否正确:

<owl:Class rdf:ID="Camera">
      <owl:unionOf rdf:parseType="Collections">
        <owl:Class>
          <rdfs:subClassOf>
            <owl:Restriction>
              <owl>onProperty rdf:resource="#hasType"/>
              <owl:allValuesFrom rdf:resource="#Digital"/>
            </owl:Restriction>
          </rdfs:subClassOf>
        </owl:Class>
        <owl:Class>
          <rdfs:subClassOf>
            <owl:Restriction>
              <owl>onProperty rdf:resource="#hasType"/>
              <owl:allValuesFrom rdf:resource="#Film"/>
            </owl:Restriction>
          </rdfs:subClassOf>
        </owl:Class>
      </owl:unionOf>
</owl:Class>

是否有任何其他方法可以指定 hasType 属性 应该具有值 数码电影?

你的想法是正确的。使用联合运算符创建一个匿名 class,其中包含来自两者的元素。所以它看起来像

<owl:Class rdf:ID="Camera">
            <rdfs:subClassOf>
               <owl:Class>
                   <owl:unionOf rdf:parseType="Collection">
                       <owl:Restriction>
                            <owl:onProperty rdf:resource="#hasType"/>
                            <owl:allValuesFrom rdf:resource="#Digital"/>
                        </owl:Restriction>
                        <owl:Restriction>
                            <owl:onProperty rdf:resource="#hasType"/>
                            <owl:allValuesFrom rdf:resource="#Film"/>
                        </owl:Restriction>
                    </owl:unionOf>
                </owl:Class>
            </rdfs:subClassOf>
    </owl:Class>

 <owl:Class rdf:ID="Camera">
                   <owl:unionOf rdf:parseType="Collection">
                           <owl:Restriction>
                                <owl:onProperty rdf:resource="#hasType"/>
                                <owl:allValuesFrom rdf:resource="#Digital"/>
                            </owl:Restriction>
                            <owl:Restriction>
                                <owl:onProperty rdf:resource="#hasType"/>
                                <owl:allValuesFrom rdf:resource="#Film"/>
                            </owl:Restriction>
                    </owl:unionOf>
  </owl:Class>

我建议使用像 Protege 这样的 ontology 编辑器来确保语法正确。