Hi Lorenz, so it means these three classes can not be replaced using setOntClass?
On Fri, Jan 27, 2017 at 9:00 PM, Lorenz Buehmann < buehm...@informatik.uni-leipzig.de> wrote: > setOntClass does not replace classes that follow from rules byinference > - this should be clear.I mean, how should this work? As long as the > rules are used for inference and the data matches the body of the rules, > the head will be added. > > > On 27.01.2017 15:28, tina sani wrote: > > My individual employee is a type of Technical, Manager and Programmer. I > > want to replace all these classes with only one class Worker. I used the > > following code, it supposed to replace it but it does not. > > All these classes are defined in the code. > > > > if ((employee.hasOntClass(technical)) && > > (employee.hasOntClass(programmer)) && (employee.hasOntClass(manager))) > > { > > employee.setOntClass(worker); > > JOptionPane.showMessageDialog(null, "here are the three classes"); > > } > > > > Though it display the message in the Dialog. > > > > On Fri, Jan 27, 2017 at 12:57 PM, Lorenz B. < > > buehm...@informatik.uni-leipzig.de> wrote: > > > >> Why should a method called "listOntClasses" just return a single class? > >> The usage of the plural form should be clear enough. And Javadoc Javadoc > >> Javadoc,... > >>> Dave, I have read some where that Individual#listOntClasses will only > >> list > >>> one class at one time. > >>> > >>> And yes employee is individual and programmer, manager and worker are > >> class > >>> variables. > >>> > >>> On Fri, Jan 27, 2017 at 12:23 AM, Dave Reynolds < > >> dave.e.reyno...@gmail.com> > >>> wrote: > >>> > >>>> On 26/01/2017 21:08, tina sani wrote: > >>>> > >>>>> Hi Dave, Will this work? > >>>>> > >>>>> if ((employee1.hasOntClass(programmer)) && > >>>>> ((employee1.hasOntClass(manager)) &&((employee1.hasOntClass(worker)) > >>>>> { > >>>>> > >>>>> } > >>>>> > >>>> Try it and see! > >>>> > >>>> There's not enough there for us to tell for sure. If the variable > >>>> employee1 is an Individual and if variables programmer, manager and > >> worker > >>>> are all Resources correctly corresponding to your classes then that > will > >>>> test if that Individual has all three of those classes in the model > >>>> (whether asserted or inferred by rules). > >>>> > >>>> To add to my earlier answer, if you have an Individual rather than > just > >>>> and OntResource then Individual#listOntClasses will enable you to > >> enumerate > >>>> the classes conveniently. > >>>> > >>>> Dave > >>>> > >>>> > >>>> On Thu, Jan 26, 2017 at 11:32 PM, Dave Reynolds < > >> dave.e.reyno...@gmail.com > >>>>> wrote: > >>>>> > >>>>> On 26/01/2017 15:20, tina sani wrote: > >>>>>> How can I get all the classes of which an individual is a type? > After > >>>>>>> Jena > >>>>>>> rules executed, my individual has multiple class like: > >>>>>>> Employee001 is of type: Worker, Programmer, Manager. > >>>>>>> > >>>>>>> So can I get all these three classes in Jena ? I have read > somewhere > >>>>>>> that > >>>>>>> getOntClass() only return one class at a time and that is on random > >>>>>>> basis. > >>>>>>> > >>>>>>> See OntResource#listRDFTypes or, if you just have a Resource then > >>>>>>> > >>>>>> Resource#listProperties(RDF.type) or, as Charles says, use SPARQL. > >>>>>> > >>>>>> Dave > >>>>>> > >>>>>> > >>>>>> > >>>>>> --- > >>>>>> This email has been checked for viruses by Avast antivirus software. > >>>>>> https://www.avast.com/antivirus > >>>>>> > >>>>>> > >>>>>> > >>>> --- > >>>> This email has been checked for viruses by Avast antivirus software. > >>>> https://www.avast.com/antivirus > >>>> > >>>> > >> -- > >> Lorenz Bühmann > >> AKSW group, University of Leipzig > >> Group: http://aksw.org - semantic web research center > >> > >> > >