Given an OWLOntology ontology and String s which contains an axiom written in Functional Syntax, how can one add this axiom to the ontology?

One could render ontology, add s to the end of the rendering, and then parse it back, but it seems too inefficient.

asked 05 Dec '11, 08:12

utapyngo's gravatar image

utapyngo
1.9k312
accept rate: 19%


I'm not familiar with the OWL API, but from a quick scan of the JavaDoc for OWLOntology, it seems that the interface is "immutable". There is only getters, no set or add methods. In this case, you'll need to do some form of concatenation to a third object (whether serialising and deserialising is the best way to concatenate, I'm not sure).

However, there is a subinterface OWLMutableOntology which adds methods to change an ontology. In that case, you have two applyChange* methods that will take OWLAxiomChange objects. In other words, if your objects implement that subinterface, you can modify the ontology directly.

link

answered 05 Dec '11, 08:53

Signified's gravatar image

Signified ♦
23.5k1623
accept rate: 37%

1

Notice that OWLOntologyChange requires an OWLAxiom which I don't have (I want to get it from a String). I think I need to play with OWLFunctionalSyntaxParser internals instead.

(05 Dec '11, 09:22) utapyngo utapyngo's gravatar image

You'll probably have to set up an instance of OWLFunctionalSyntaxParser and use it to parse the string. Feed it with a StringReader. See OWLFunctionalSyntaxOWLParser (note slightly different name!) for how to invoke and run it.

(I haven't tried this, but have created parsers myself with JavaCC, the library used here to generate the parser code.)

link

answered 05 Dec '11, 10:25

cygri's gravatar image

cygri ♦
9.0k412
accept rate: 34%

edited 05 Dec '11, 10:28

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×649
×170
×69
×29
×3

Asked: 05 Dec '11, 08:12

Seen: 1,802 times

Last updated: 05 Dec '11, 10:28