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

accept rate: 19%

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.)

permanent link

answered 05 Dec '11, 10:25

cygri's gravatar image

cygri ♦
accept rate: 34%

edited 05 Dec '11, 10:28

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.

permanent link

answered 05 Dec '11, 08:53

Signified's gravatar image

Signified ♦
accept rate: 37%


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
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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

Question tags:


question asked: 05 Dec '11, 08:12

question was seen: 2,414 times

last updated: 05 Dec '11, 10:28