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

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