Discussion:
property values
neha gupta
2016-11-05 16:24:52 UTC
Permalink
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. 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?
Andy Seaborne
2016-11-06 12:34:27 UTC
Permalink
Post by neha gupta
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. 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?
Provide a complete, minimal example showing what you have tried.

Andy
Lorenz B.
2016-11-06 14:44:59 UTC
Permalink
Post by neha gupta
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-
Post by neha gupta
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
neha gupta
2016-11-06 19:28:54 UTC
Permalink
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. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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-
Post by neha gupta
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
A. Soroka
2016-11-06 19:35:37 UTC
Permalink
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
Post by neha gupta
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. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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-
Post by neha gupta
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.
2016-11-07 07:53:21 UTC
Permalink
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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-
Post by neha gupta
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
neha gupta
2016-11-08 11:05:15 UTC
Permalink
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. <
Post by Lorenz B.
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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-
Post by neha gupta
But if I
set value before get the value, the property "win" always show that
value
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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.
2016-11-08 13:11:24 UTC
Permalink
"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?
Post by neha gupta
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. <
Post by Lorenz B.
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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-
Post by neha gupta
But if I
set value before get the value, the property "win" always show that
value
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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
neha gupta
2016-11-08 13:26:17 UTC
Permalink
When I use team1.addLiteral() before team1.getPropertyValue(), it does not
give me Null error.

On Tue, Nov 8, 2016 at 3:11 PM, Lorenz B. <
Post by Lorenz B.
"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?
Post by neha gupta
Is it a good idea to use team1.addLiteral() before
team1.getPropertyValue()
Post by neha gupta
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. <
Post by Lorenz B.
Post by neha gupta
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
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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.
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
jena.rdf.model.Property-
Post by neha gupta
But if I
set value before get the value, the property "win" always show that
value
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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,
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
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
Lorenz B.
2016-11-09 10:23:40 UTC
Permalink
Post by neha gupta
When I use team1.addLiteral() before team1.getPropertyValue(), it does not
give me Null error.
What do you mean by "Null error"? Show us the code please. The method
returns NULL if there is no such value for the given property:

|RDFNode
<https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFNode.html>|
|getPropertyValue
<https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/OntResource.html#getPropertyValue-org.apache.jena.rdf.model.Property->(Property
<https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/Property.html> property)|

Answer the value of a given RDF property for this resource, or null if
it doesn't have one.


RDFNode val = team1.getPropertyValue(prop);
if(val == null) {
// handle the case here
}

Is this not clear? How do you do this with other methods or APIs that
return NULL if no values exists?
Post by neha gupta
On Tue, Nov 8, 2016 at 3:11 PM, Lorenz B. <
Post by Lorenz B.
"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?
Post by neha gupta
Is it a good idea to use team1.addLiteral() before
team1.getPropertyValue()
Post by neha gupta
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. <
Post by Lorenz B.
Post by neha gupta
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
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each team
with
Post by neha gupta
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.
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
jena.rdf.model.Property-
Post by neha gupta
But if I
set value before get the value, the property "win" always show that
value
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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,
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
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
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
neha gupta
2016-11-10 15:24:25 UTC
Permalink
Thanks Lorenz sir.

On Wed, Nov 9, 2016 at 12:23 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
When I use team1.addLiteral() before team1.getPropertyValue(), it does
not
Post by neha gupta
give me Null error.
What do you mean by "Null error"? Show us the code please. The method
|RDFNode
<https://jena.apache.org/documentation/javadoc/jena/
org/apache/jena/rdf/model/RDFNode.html>|
|getPropertyValue
<https://jena.apache.org/documentation/javadoc/jena/
org/apache/jena/ontology/OntResource.html#getPropertyValue-org.apache.
jena.rdf.model.Property->(Property
<https://jena.apache.org/documentation/javadoc/jena/
org/apache/jena/rdf/model/Property.html> property)|
Answer the value of a given RDF property for this resource, or null if
it doesn't have one.
RDFNode val = team1.getPropertyValue(prop);
if(val == null) {
// handle the case here
}
Is this not clear? How do you do this with other methods or APIs that
return NULL if no values exists?
Post by neha gupta
On Tue, Nov 8, 2016 at 3:11 PM, Lorenz B. <
Post by Lorenz B.
"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?
Post by neha gupta
Is it a good idea to use team1.addLiteral() before
team1.getPropertyValue()
Post by neha gupta
just to assign some value to the property?
And then we can write team1.setPropertyValue() to assign the final
value?
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
On Mon, Nov 7, 2016 at 9:53 AM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
I want to ask why data property value "win" does not have default
zero
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
value? If it was zero, team1.getPropertyValue() would not flush
exception
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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.
Post by neha gupta
On Sun, Nov 6, 2016 at 4:44 PM, Lorenz B. <
Post by Lorenz B.
Post by neha gupta
Hi
I want to get the property value and then add add/sum 2 for each
team
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
with
Post by neha gupta
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.
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
jena.rdf.model.Property-
Post by neha gupta
But if I
set value before get the value, the property "win" always show that
value
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
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,
Post by neha gupta
Post by Lorenz B.
Post by neha gupta
Post by Lorenz B.
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
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Loading...