Thanks very much for your helps!

I am trying createObjectProperty() and addInverseOf(), and it works now.

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 {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of {
      complement of { ...forever, and finally
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError

So I am wondering whether I am creating the concept right? and are there
methods for printing concept axioms?

All my best!

June

2011/5/3 Ian Dickinson <[email protected]>

> On 01/05/11 21:28, Dave Reynolds wrote:
> > On Sat, 2011-04-30 at 13:05 +0800, 朱曼 wrote:
> >> Currently I am using Jena to process ontology and create ontology
> classes.
> >> But I confront a problem: how can I create a class which is
> existentially
> >> restricted by the inverse of an existed property(hasValue inverseOf
> >> Property)? I tried "property.getInverse()", but I get a
> >> NullPointerException, I think that is because the inverse property
> doesn't
> >> really exist in the current ontology. And I also notice there is a
> >> createInverseFunctionalProperty method in OntModel, but how can I create
> an
> >> inverse property based on an existed property, so far as the
> >> createInverseFunctionalProperty method only have "uri" and "functional"
> >> parameters?
> >
> > You want OntProperty#addInverseOf
> Or OntProperty#setInverseOf, which will replace any existing
> owl:inverseOf assertions for that property.
>
> > (not sure why it is called "add.."
> > rather than "create..")
> Because that call is only adding an owl:inverseOf triple, not creating
> the inverse property itself. To actually create the property which is
> the inverse of the property in question, June would need a separate
> OntModel#createObjectProperty method call. Perhaps there could be a
> shortcut method which performs both steps in one go, but currently there
> isn't.
>
> 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
>
>

Reply via email to