1

关于我以前的帖子,现在当我测试时,progFields 在下面:

System.Reflection.FieldInfo[] progFields = typeof(Program).GetFields();

什么都不返回。我关于 Program 的本体是这样的:

<owl:Class rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Program">
        <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Student"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Teacher"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Rank"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Course"/>
        <owl:disjointWith>
            <owl:Class rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#LearningResource"/>
        </owl:disjointWith>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#ResourceAuthor"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Note"/>
        <owl:disjointWith rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#ClassOfCourse"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty>
                    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#atGrade"/>
                </owl:onProperty>
                <owl:allValuesFrom rdf:resource="http://www.owl-ontologies.com/Ontology1243411901.owl#Grade"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <owl:disjointWith>
            <owl:Class rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Project"/>
        </owl:disjointWith>

在文件的末尾,它的集合被定义:

<owl:AllDifferent>
        <owl:distinctMembers rdf:parseType="Collection">
            <Program rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Information_Technology"/>
            <Program rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Software"/>
            <Program rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Management"/>
            <Program rdf:about="http://www.owl-ontologies.com/Ontology1243411901.owl#Literature"/>
        </owl:distinctMembers>
    </owl:AllDifferent>

本体由 Protege 制作。你能帮忙吗?

4

1 回答 1

3

您得到零字段,因为您的 Program 类不是枚举的 OWL 类

根本问题是您的本体表达了程序不是什么,而不是说它是什么。这没有错,只是不是你想要的。我是一个人,我可以弄清楚你想要什么(即你有 4 个而且只有 4 个程序,它们都是不同的),但是你的本体并没有这么说。你的本体说的如下:

  • 有程序。
  • 如果一个人恰好是一个程序,那么它肯定不是学生、教师等。
  • 程序始终具有 atGrade 属性。
  • 如果它们碰巧是 IT、SW、Mgmt 或文学,它们就不一样了。

但你可以有很多其他人,不仅是 IT、SW、Mgmt 和文学。因此,ROWLEX 没有将 Program 类公开为枚举类。

如果使您的 Program 类成为真正的枚举 OWL 类, ROWLEX 将为您生成静态字段。

于 2009-07-15T15:11:47.807 回答