我该如何遍历我的本体模型?

时间:2012-01-29 09:31:51

标签: semantics rdf jena

如何遍历我的本体文件?我想获得类Shape的子类以及与之关联的属性。我已经看到了遍历Pizza本体文件的例子,但我无法操纵我的目的。我遇到了很多错误。

<?xml version="1.0"?>


<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY SBIRS "http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#" >
]> 


<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#"
 xml:base="http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl"
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 xmlns:SBIRS="http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#"
 xmlns:owl="http://www.w3.org/2002/07/owl#"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl"/>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasArmBone -->

<owl:ObjectProperty rdf:about="&SBIRS;hasArmBone">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasShape"/>
    <owl:inverseOf rdf:resource="&SBIRS;isArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasCranialBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasCranialBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasSkullBone"/>
    <owl:inverseOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasEthmoidBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasEthmoidBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
    <owl:inverseOf rdf:resource="&SBIRS;isTemporalBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasFacialBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasFacialBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasSkullBone"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasForeArmsBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasForeArmsBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasArmBone"/>
    <owl:inverseOf rdf:resource="&SBIRS;isForeArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasFrontalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasFrontalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasHumerusBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasHumerusBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasArmBone"/>
    <owl:inverseOf rdf:resource="&SBIRS;isArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasInferiornasalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasInferiornasalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
    <owl:inverseOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasLacrimalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasLacrimalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasMandibleBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasMandibleBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasMaxilaBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasMaxilaBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasNasalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasNasalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasOccipitalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasOccipitalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasParietalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasParietalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasRadiusBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasRadiusBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasForeArmsBones"/>
    <owl:inverseOf rdf:resource="&SBIRS;isRadiusBoneof"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasRibsBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasRibsBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;haschestBone"/>
    <owl:inverseOf rdf:resource="&SBIRS;isSternumboneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasShape -->

<owl:ObjectProperty rdf:about="&SBIRS;hasShape">
    <owl:inverseOf rdf:resource="&SBIRS;isShapeOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasShenoidBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasShenoidBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasSkullBone -->

<owl:ObjectProperty rdf:about="&SBIRS;hasSkullBone">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasShape"/>
    <owl:inverseOf rdf:resource="&SBIRS;isSkullBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasSternumBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasSternumBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;haschestBone"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasTemporalBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasTemporalBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasCranialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasUlnabones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasUlnabones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasForeArmsBones"/>
    <owl:inverseOf rdf:resource="&SBIRS;isUlnaBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasVomerBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasVomerBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasZygomativBones -->

<owl:ObjectProperty rdf:about="&SBIRS;hasZygomativBones">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasFacialBones"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#haschestBone -->

<owl:ObjectProperty rdf:about="&SBIRS;haschestBone">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;hasShape"/>
    <owl:inverseOf rdf:resource="&SBIRS;isChestBoneOf"/>
    <owl:inverseOf rdf:resource="&SBIRS;isSkullBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isArmBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isArmBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isShapeOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isChestBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isChestBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isShapeOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isCranialBonOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isCranialBonOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isSkullBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isEthmoidboneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isEthmoidboneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isFacialBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isFacialBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isSkullBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isForeArmBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isForeArmBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isFrontalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isFrontalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isHumerusBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isHumerusBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isInferiornasalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isInferiornasalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isLacrimalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isLacrimalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isMandiblBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isMandiblBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isMaxilaBoneOF -->

<owl:ObjectProperty rdf:about="&SBIRS;isMaxilaBoneOF">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isNasalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isNasalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isOccipitalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isOccipitalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isParietalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isParietalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isRadiusBoneof -->

<owl:ObjectProperty rdf:about="&SBIRS;isRadiusBoneof">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isForeArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isRibBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isRibBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isChestBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isShapeOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isShapeOf"/>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isShenoidBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isShenoidBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isSkullBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isSkullBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isShapeOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isSternumboneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isSternumboneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isChestBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isTemporalBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isTemporalBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isCranialBonOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isUlnaBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isUlnaBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isForeArmBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isVomerBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isVomerBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isZygomaticBoneOf -->

<owl:ObjectProperty rdf:about="&SBIRS;isZygomaticBoneOf">
    <rdfs:subPropertyOf rdf:resource="&SBIRS;isFacialBoneOf"/>
</owl:ObjectProperty>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Arm -->

<owl:Class rdf:about="&SBIRS;Arm">
    <rdfs:subClassOf rdf:resource="&SBIRS;Shape"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Chest -->

<owl:Class rdf:about="&SBIRS;Chest">
    <rdfs:subClassOf rdf:resource="&SBIRS;Shape"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Cranial -->

<owl:Class rdf:about="&SBIRS;Cranial">
    <rdfs:subClassOf rdf:resource="&SBIRS;Skull"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#FacialBones -->

<owl:Class rdf:about="&SBIRS;FacialBones">
    <rdfs:subClassOf rdf:resource="&SBIRS;Skull"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#ForeArms -->

<owl:Class rdf:about="&SBIRS;ForeArms">
    <rdfs:subClassOf rdf:resource="&SBIRS;Arm"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Humerus -->

<owl:Class rdf:about="&SBIRS;Humerus">
    <rdfs:subClassOf rdf:resource="&SBIRS;Arm"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Ribs -->

<owl:Class rdf:about="&SBIRS;Ribs">
    <rdfs:subClassOf rdf:resource="&SBIRS;Chest"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Shape -->

<owl:Class rdf:about="&SBIRS;Shape"/>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Skull -->

<owl:Class rdf:about="&SBIRS;Skull">
    <rdfs:subClassOf rdf:resource="&SBIRS;Shape"/>
</owl:Class>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Sternum -->

<owl:Class rdf:about="&SBIRS;Sternum">
    <rdfs:subClassOf rdf:resource="&SBIRS;Chest"/>
</owl:Class>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Ethmoid -->

<owl:NamedIndividual rdf:about="&SBIRS;Ethmoid">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#FrontalBones -->

<owl:NamedIndividual rdf:about="&SBIRS;FrontalBones">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Inferior_Nasal -->

<owl:NamedIndividual rdf:about="&SBIRS;Inferior_Nasal">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Lacrimal -->

<owl:NamedIndividual rdf:about="&SBIRS;Lacrimal">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Mandible -->

<owl:NamedIndividual rdf:about="&SBIRS;Mandible">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Maxilla -->

<owl:NamedIndividual rdf:about="&SBIRS;Maxilla">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Nasal -->

<owl:NamedIndividual rdf:about="&SBIRS;Nasal">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Occipital -->

<owl:NamedIndividual rdf:about="&SBIRS;Occipital">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Parietal -->

<owl:NamedIndividual rdf:about="&SBIRS;Parietal">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Radius -->

<owl:NamedIndividual rdf:about="&SBIRS;Radius">
    <rdf:type rdf:resource="&SBIRS;ForeArms"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Sphenoid -->

<owl:NamedIndividual rdf:about="&SBIRS;Sphenoid">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Temporal -->

<owl:NamedIndividual rdf:about="&SBIRS;Temporal">
    <rdf:type rdf:resource="&SBIRS;Cranial"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Ulna -->

<owl:NamedIndividual rdf:about="&SBIRS;Ulna">
    <rdf:type rdf:resource="&SBIRS;ForeArms"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Vomer -->

<owl:NamedIndividual rdf:about="&SBIRS;Vomer">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Zygomatic -->

<owl:NamedIndividual rdf:about="&SBIRS;Zygomatic">
    <rdf:type rdf:resource="&SBIRS;FacialBones"/>
</owl:NamedIndividual>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// General axioms
//
///////////////////////////////////////////////////////////////////////////////////////
 -->

<rdf:Description>
    <rdf:type rdf:resource="&owl;AllDisjointClasses"/>
    <owl:members rdf:parseType="Collection">
        <rdf:Description rdf:about="&SBIRS;Arm"/>
        <rdf:Description rdf:about="&SBIRS;ForeArms"/>
        <rdf:Description rdf:about="&SBIRS;Humerus"/>
    </owl:members>
</rdf:Description>
<rdf:Description>
    <rdf:type rdf:resource="&owl;AllDisjointClasses"/>
    <owl:members rdf:parseType="Collection">
        <rdf:Description rdf:about="&SBIRS;Chest"/>
        <rdf:Description rdf:about="&SBIRS;Ribs"/>
        <rdf:Description rdf:about="&SBIRS;Sternum"/>
    </owl:members>
</rdf:Description>
<rdf:Description>
    <rdf:type rdf:resource="&owl;AllDisjointClasses"/>
    <owl:members rdf:parseType="Collection">
        <rdf:Description rdf:about="&SBIRS;Cranial"/>
        <rdf:Description rdf:about="&SBIRS;FacialBones"/>
        <rdf:Description rdf:about="&SBIRS;Skull"/>
    </owl:members>
</rdf:Description>
<rdf:Description>
    <rdf:type rdf:resource="&owl;AllDisjointClasses"/>
    <owl:members rdf:parseType="Collection">
        <rdf:Description rdf:about="&SBIRS;Arm"/>
        <rdf:Description rdf:about="&SBIRS;Chest"/>
        <rdf:Description rdf:about="&SBIRS;Shape"/>
        <rdf:Description rdf:about="&SBIRS;Skull"/>
    </owl:members>
</rdf:Description>

1 个答案:

答案 0 :(得分:5)

是否真的有必要发布所有超过700行的本体来提出这个问题?总是赞赏将问题修改为最小形式的一点帮助。此外,如果您的代码有错误,我们可以更轻松地帮助您修复它,如果您知道,实际向我们展示了代码

无论如何,这是一个简单的程序:

代码:

package example;

import java.util.Iterator;

import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;

public class SbirsExample
{
    public static void main( String[] args ) {
        new SbirsExample().run();
    }

    public void run() {
        OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );
        FileManager.get().readModel( m, "src/main/resources/sbirs.owl" );

        String NS = "http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#";

        OntClass shape = m.getOntClass( NS + "Shape" );

        for (Iterator<OntClass> subs = shape.listSubClasses();
             subs.hasNext(); ) {
            OntClass sub = subs.next();

            System.out.println( "sbirs:Shape has sub-class " + sub.getURI() +
                                " with declared properties:" );

            for (Iterator<OntProperty> props = sub.listDeclaredProperties();
                 props.hasNext(); ) {
                OntProperty declared = props.next();
                System.out.println( "   - " + declared );
            }
        }
    }
}

输出:

sbirs:Shape has sub-class http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Skull with declared properties:
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasRadiusBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isRadiusBoneof
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasInferiornasalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasCranialBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasVomerBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isMandiblBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasOccipitalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isInferiornasalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isCranialBonOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasArmBone
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isZygomaticBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasShape
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasFacialBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasNasalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasHumerusBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isLacrimalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isUlnaBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasForeArmsBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isSkullBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isOccipitalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasFrontalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isShenoidBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isMaxilaBoneOF
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasSternumBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasMaxilaBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isShapeOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasMandibleBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isArmBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isFrontalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasZygomativBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasLacrimalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasTemporalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isRibBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasShenoidBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasSkullBone
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#haschestBone
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isChestBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isHumerusBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isParietalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isTemporalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isEthmoidboneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isFacialBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasUlnabones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasEthmoidBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasRibsBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isNasalBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasParietalBones
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isVomerBoneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isSternumboneOf
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#isForeArmBoneOf
 sbirs:Shape has sub-class http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#Chest with declared properties:
    - http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl#hasRadiusBones
    ... etc ...