我是 OWL API 的新手,正在尝试使用它。我使用 OWL API 在 eclipse 中的 protege 和互惠应用程序中创建了一个简单的本体。本体结构如下:-
----------------------------------------------------------------------------------------
Class Object (Data Property)StringValue ObjectProperty relatedTo
----------------------------------------------------------------------------------------
WordString WS1 "One" DS1
WS2 "Two" DS2
WS3 "Three" DS3
DigiString DS1 "1"
DS2 "2"
DS3 "3"
----------------------------------------------------------------------------
完整的本体如下:-
<rdf:RDF xmlns="http://localhost:3030/DigiWord.owl#"
xml:base="http://localhost:3030/DigiWord.owl"
xmlns:DigiWord="http://localhost:3030/DigiWord.owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
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://localhost:3030/DigiWord.owl"/>
<!--
// Object Properties
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://localhost:3030/DigiWord.owl#relatedTo -->
<owl:ObjectProperty rdf:about="&DigiWord;relatedTo">
<rdfs:domain rdf:resource="&DigiWord;DigiString"/>
<rdfs:range rdf:resource="&DigiWord;WordString"/>
</owl:ObjectProperty>
<!--
//
// Data properties
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://localhost:3030/DigiWord.owl#stringValue -->
<owl:DatatypeProperty rdf:about="&DigiWord;stringValue">
<rdfs:domain rdf:resource="&DigiWord;DigiString"/>
<rdfs:domain rdf:resource="&DigiWord;WordString"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
<!--
// Classes
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://localhost:3030/DigiWord.owl#DigiString -->
<owl:Class rdf:about="&DigiWord;DigiString"/>
<!-- http://localhost:3030/DigiWord.owl#WordString -->
<owl:Class rdf:about="&DigiWord;WordString"/>
<!--
// Individuals
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://localhost:3030/DigiWord.owl#DS1 -->
<owl:NamedIndividual rdf:about="&DigiWord;DS1">
<rdf:type rdf:resource="&DigiWord;DigiString"/>
<stringValue rdf:datatype="&xsd;string">1</stringValue>
<relatedTo rdf:resource="&DigiWord;WS1"/>
</owl:NamedIndividual>
<!-- http://localhost:3030/DigiWord.owl#DS2 -->
<owl:NamedIndividual rdf:about="&DigiWord;DS2">
<rdf:type rdf:resource="&DigiWord;DigiString"/>
<stringValue rdf:datatype="&xsd;string">2</stringValue>
<relatedTo rdf:resource="&DigiWord;WS2"/>
</owl:NamedIndividual>
<!-- http://localhost:3030/DigiWord.owl#DS3 -->
<owl:NamedIndividual rdf:about="&DigiWord;DS3">
<rdf:type rdf:resource="&DigiWord;DigiString"/>
<stringValue rdf:datatype="&xsd;string"></stringValue>
<relatedTo rdf:resource="&DigiWord;WS3"/>
</owl:NamedIndividual>
<!-- http://localhost:3030/DigiWord.owl#WS1 -->
<owl:NamedIndividual rdf:about="&DigiWord;WS1">
<rdf:type rdf:resource="&DigiWord;WordString"/>
<stringValue rdf:datatype="&xsd;string">One</stringValue>
</owl:NamedIndividual>
<!-- http://localhost:3030/DigiWord.owl#WS2 -->
<owl:NamedIndividual rdf:about="&DigiWord;WS2">
<rdf:type rdf:resource="&DigiWord;WordString"/>
<stringValue rdf:datatype="&xsd;string">Two</stringValue>
</owl:NamedIndividual>
<!-- http://localhost:3030/DigiWord.owl#WS3 -->
<owl:NamedIndividual rdf:about="&DigiWord;WS3">
<rdf:type rdf:resource="&DigiWord;WordString"/>
<stringValue rdf:datatype="&xsd;string">Three</stringValue>
</owl:NamedIndividual>
</rdf:RDF>
我想为 DS1 检索对象 WS1,为 DS2 检索 WS2,即在提供字符串“1”、“2”等时,我的代码应该分别检索“One”、“Two”。我在网上没有遇到任何此类相关代码。任何帮助将不胜感激。提前致谢。