Hi June,
On 03/05/11 10:16, 朱曼 wrote:
> I am trying createObjectProperty() and addInverseOf(), and it works now.
That's good!
> By the way, I failed to find methods for printing concept axioms, except for
> the DescribeClass in the tutorial. But DescribeClass works well when I
> create OntModel using
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM,null), but when I
> create the model using
> ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC), it works
> wierd. For example, if I try to print an anonymous class which is existed
> restricted on a property(I create the concept this way
> "model.createHasValueRestriction(null, objProp, owlThing)"), and the outputs
> are as follows:
>
> Anonymous restriction with ID a-0
> on property Class :lens
> has value complement of {
> complement of {
> complement of {
> complement of { ...forever, and finally
> Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
So it looks like DescribeClass has entered a loop. Do remember that
DescribeClass was only an example program to illustrate the use of the
API, not a fully-debugged tool in its own right.
I would guess that Pellet is creating a situation in which class A is
the complement of B and vice-versa. Because it's only an example,
DescribeClass is not doing the usual occurs-check to ensure that it
doesn't get stuck in writing "A is the complement of B is the complement
of A ..." etc. What you would need to do is to keep a stack of the
classes that have been visited so far in the various renderXX() methods,
and not recurse into one which has already been rendered. Alternatively,
you may find that writing your own concept describer would be an easier
way give you exactly the features that you need.
Ian
--
____________________________________________________________
Ian Dickinson Epimorphics Ltd, Bristol, UK
mailto:[email protected] http://www.epimorphics.com
cell: +44-7786-850536 landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd. is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
Portishead, Bristol BS20 6PT, UK