Ok, I overlooked that you have the value given.
> Lorenz, with regards, > > Is it mandatory to use : if( Value == null) No, not if you can ensure that there is always exactly one value. > > I mean every property will have a value. In my case, the property supposed > to have three values so I need: > > if (Value=="Value1") You have to use Java object equality instead. > //do this > > if (Value=="Value2") > //do this > else > // do this > > However, in general case, I want to ask if we have or expected to have a > null value, can we do some operation on it or just we display a message to > user that value is null? > > if( Value == null) > JOptionPane.showMessageDialog(null, "Value is null"); You can't do anything on a NULL value - it's a Java NULL. In any case, you should handle this case and give a warning as you suggested. > > > > > > On Tue, Nov 22, 2016 at 3:59 PM, Lorenz B. < > [email protected]> wrote: > >> >>> Hello Lorenz thanks, >>> >>> You mean something like this: >>> >>> RDFNode Value =individual.getPropertyValue(myPropertyName); >>> >>> if (Value=="PropertyValue") >> No, more the other case indeed such that don't have to "know" the value, >> i.e. >> >> if( Value == null) { >> >> } else { >> >> } >>> // >>> >>> On Tue, Nov 22, 2016 at 3:36 PM, Lorenz B. < >>> [email protected]> wrote: >>> >>>> You can use Individual::getPropertyValue, see [1] >>>> >>>> [1] >>>> https://jena.apache.org/documentation/javadoc/jena/ >>>> org/apache/jena/ontology/OntResource.html#getPropertyValue-org.apache. >>>> jena.rdf.model.Property- >>>> >>>>> Does Jena have hasOntProperty() like we have hasOntClass()? In my >>>> project I >>>>> need something like if instance/individual has "this property value", >> do >>>>> some operation. >>>>> >>>>> Thank you for your time. >>>>> >>>> -- >>>> Lorenz Bühmann >>>> AKSW group, University of Leipzig >>>> Group: http://aksw.org - semantic web research center >>>> >>>> >> -- >> Lorenz Bühmann >> AKSW group, University of Leipzig >> Group: http://aksw.org - semantic web research center >> >> -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center
