instanceof applies to Java classes. It is a feature of the programming language.

To see if an instance is of data-declared class, which is a separate concept, use getOntClass, hasOntClass or listOntClass methods on Individual.

On 02/10/16 21:55, tina sani wrote:
I have Employee class and "Managers" and "Technicals" as two sub classes of
Employee.

Not in your example - there is no connect from Employee to Manager

Bob is instance of sub class Technical, how can I get like this:

If Bob instance of Technicals, then do something:

            OntClass mgr = model.getOntClass(ns + "Managers");
             OntClass  tech = model.getOntClass(ns + "Technicals");

            OntClass emp = model.getOntClass(ns + "Employee");
            Individual ind = tech.createIndividual(ns + "Bob");

I am trying like below but it flush an error message.

 if (ind instanceof tech){}

In Java, the right-hand side of instanceof must be a java class.

        Andy
  • instanceof tina sani
    • Re: instanceof Andy Seaborne

Reply via email to