There is no notion of a "default" value for a property in RDF. Either a triple or triples are present indicating values for a property, or not. It is not at all reasonable to imagine a particular single default value for predicates that may be in use in a global context.
--- A. Soroka The University of Virginia Library > On Nov 6, 2016, at 2:28 PM, neha gupta <[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? > > 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 >> >> >>
