开发者

Build an OWL file with JENA

My work requires a construction of ontologies modules. For this I need to construct owl files to contain those ontologies. My input is an xml file with parsed and splitted sentences.

<Subject> A tumor </Subject> 
<Verb> is </Verb> 
<Object> an abnormal growth </Object> 
</sentence> 
<sentence> 
<Subject> A kidney tumor </Subject> 
<Verb> is </Verb> 
<Object> an abnormal growth </Object> 

What I need to do now is:

  • convert "subject" and "object" into OntClass
  • convert "verb" into a transitive property between "obj" and "sub"

I am new on the ontology domain, may be those are basic quest开发者_如何学JAVAions, but I am struggling with the creation of those files, and especially with the transitive property.

Any help is welcome.


To create an OntClass, you simply need to call OntModel.createClass( uri ). Of course, that then leaves the question of which uri you should use. You'll need a namespace, something of the form http://yourcompany.com/ontology/diagnosis#; ideally this namespace will correspond to a web address where your ontology document can be retrieved.

Then you'll need an algorithm for converting a phrase like 'A tumor' into a class name. This could be quite simple:

  • remove prefixes such as definite and indefinite articles (a, an, the)
  • remove spaces and use CamelCase to denote word boundaries

Then the uri will be the concatenation of the namespace and the converted name.

Creating transitive properties is also straightforward (OntModel.createTransitiveProperty()), but in the sample that you show, it appears that you're actually talking about the sub-class relationship between classes. If it is always true that all ns:KidneyTumor instances are also in the set of ns:AbnormalGrowth instances, then your <Verb>is</Verb> corresponds to the existing RDF property rdfs:subClassOf. Of course, if that relationship is more subtle (e.g. may be conditionally or probabilistically true), then you'll need a different relationship with your particular semantics.

As for reading the XML file, there are many tutorials on the web or questions on Stackoverflow to help with that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜