我们如何在OWL XML的类实例中指定值?

问题描述 投票:0回答:1

我刚刚开始使用OWL XML,并试图为类的实例提供值,但是我不知道该怎么做。我确实知道可以使用rdf:type指定实例。请考虑如下Java类Organism:

class Organism {
    String name;
    List<Features> features;     
}

class Features {
    int feature1;
    String name;
}

该类由动植物类扩展如下:

class Animal extends Organism {
    int animal_property;
}

class Plant extends Organism {
    int plant_property;
}

现在,我想编写一个描述上述结构的OWL / XML。我已经制作了OWL / XML,如下所示:

 <owl:Class rdf:ID="Organism">
     <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
 </owl:Class>

 <owl:Class rdf:ID="Feature">
     <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
 </owl:Class>

 <owl:Class rdf:ID="Animal">
     <rdfs:subClassOf rdf:resource="#Organism"/>
 </owl:Class>

 <owl:Class rdf:ID="Plant">
     <rdfs:subClassOf rdf:resource="#Organism"/>
 </owl:Class>

 <owl:DatatypeProperty rdf:ID="name">
     <rdfs:domain rdf:resource="#Organism"/> <!-- can we specify two domain here for Feature and Organism? -->
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
 </owl:DatatypeProperty>

 <owl:ObjectProperty rdf:ID="features">
     <rdfs:domain rdf:resource="#Organism"/> 
     <rdfs:range rdf:resource="#Feature"/>
 </owl:ObjectProperty>

 <owl:DatatypeProperty rdf:ID="animal_property">
     <rdfs:domain rdf:resource="#Organism"/> <!-- can we specify two domain here for Feature and Organism? -->
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
 </owl:DatatypeProperty>

 <owl:DatatypeProperty rdf:ID="plant_property">
     <rdfs:domain rdf:resource="#Organism"/> **<!-- can we specify two domain here for Feature and Organism? -->**
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
 </owl:DatatypeProperty>

如果以上定义不正确,请纠正我。如果要如下创建实例:

Animal -> (name, features, animal_property) -> ("Spider",{feature1,feature2},5}
Plant -> (name, features, plant_property) -> ("Rose",{feature2,feature3},2}

feature1 -> (feature1, name) -> (8,"number of legs");
feature2 -> (feature1, name) -> (2,"tentacles");

feature3 -> (feature1, name) -> (1,"rose_feature_1");
feature4 -> (feature1, name) -> (2,"rose_feature_2");

如何用OWL / XML表示?

owl semantic-web
1个回答
0
投票

您的name数据属性应仅将Feature作为其域。在您计划创建的类层次结构中,Organism不会是此属性的域。]

[OWL中可以使用多个域,但是请注意,使用具有两个或多个域的属性意味着作为主题出现的个人属于这些域的交集。我认为您不希望创建同时属于OrganismFeature的个体。

© www.soinside.com 2019 - 2024. All rights reserved.