On Mon, 2011-05-23 at 12:43 +0800, 朱曼 wrote:
> Hi list,
> 
> In the following code, I try to create an ontology model with pellet,
> then I create an anonymous class which is complement to an existed
> class "Mother"(see details from the attached ontology test.owl), and I
> want to print "not Mother", but the results appear to be:
> 
> not (Female)  (Mother) 
> not Female
> 

If you try without a reasoner (use OntModelSpec.OWL_MEM) you will
probably get what you want.

Why Pellet is inferring the extra complementOf relation is hard to tell
without seeing the ontology.

Dave

> Are there convenient ways to print "not Mother" directly?
> 
> ---------------------------------------------------------------------------------------------------------------------------------------
>         OntModel m =
> ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
>         m.read("test.owl");
>         OntClass c = m.getOntClass(m.getNsPrefixURI("") + "Mother");
>         OntClass newCls = m.createComplementClass(null, c);
>         if (newCls.isComplementClass()) {
>             System.out.print("not");
>             for (ExtendedIterator<? extends OntClass> iter =
> newCls.asComplementClass().listOperands(); iter.hasNext(); )
>                 System.out.print(" (" + iter.next().getLocalName() +
> ") ");
>             System.out.print("\nnot ");
> 
> System.out.println(newCls.asComplementClass().getOperand().getLocalName());
>             
>         }
> ------------------------------------------------------------------------------------------------------------------------------------------
> 
> All the best,
> 
> June



Reply via email to