"Good" is very subjective and depends on your design decisions...it would work, sure. But, what is the problem with checking for NULL in your code?
> Is it a good idea to use team1.addLiteral() before team1.getPropertyValue() > just to assign some value to the property? > And then we can write team1.setPropertyValue() to assign the final value? > > > On Mon, Nov 7, 2016 at 9:53 AM, Lorenz B. < > [email protected]> wrote: > >>> I want to ask why data property value "win" does not have default zero >>> value? If it was zero, team1.getPropertyValue() would not flush exception >>> error message? >> Which exception do you mean? There is no exception thrown but NULL >> returned. Please show the code and do not ignore this again. Andy also >> asked you for code. >> And as Adam said, information in RDF can be "unknown". Moreover, it is >> schema-less, and it's not a relational database with default values. >>> On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. < >>> [email protected]> wrote: >>> >>>> Comments inline: >>>>> Hi >>>>> I want to get the property value and then add add/sum 2 for each team >>>> with >>>>> it. >>>>> team1(win value +2) // value is 2 here >>>>> team1(win value +2) // value is 4 here >>>>> >>>>> team.getPropertyValue(Win); >>>>> //then next operation to get value and sum 2 >>>>> >>>>> But the issue is I get error as I have not set the value first. >>>> Which "error" do you get? According to [1] it returns null if there >>>> hasn't been a value set before. >>>> Java allows for >>>> >>>> if(something) { >>>> // do something >>>> } >>>> >>>> [1] >>>> https://jena.apache.org/documentation/javadoc/jena/ >>>> org/apache/jena/ontology/OntResource.html#getPropertyValue-org.apache. >>>> jena.rdf.model.Property- >>>>> But if I >>>>> set value before get the value, the property "win" always show that >> value >>>>> and not after calculated value. >>>>> Is there any way for this issue? >>>> Using an Integer variable in Java that holds the value before if exists, >>>> else 0 ... ? >>>> >>>> -- >>>> 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
