You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by kumar rohit <ku...@gmail.com> on 2016/11/21 16:11:28 UTC

Two values for a Property

 Literal lit1 = model.createTypedLiteral(yes);
 Literal lit2 = model.createTypedLiteral(no);

if (Some condition)
{
individual.setPropertyValue(Participate, lit1);
else
individual.setPropertyValue(Participate, lit2);
}


Is this possible that we have two set of values for a property? I use the
above statements but it gives me error at setting second property

else
individual.setPropertyValue(Participate, lit2);

Re: Two values for a Property

Posted by Rob Vesse <rv...@dotnetrdf.org>.
Once again you have completely failed to ask a proper question!

Firstly, you haven’t defined what you mean by two sets of values for a property?

The RDF Data model places very little constraints on what triples you can and can’t define. It is quite common to have multiple triples the same subject and predicate but different objects e.g.

@prefix eg: <http://example.org/> .
eg:Rob a eg:Person ;
   eg:name “Rob” ,  Robert” , “Rob Vesse” .

If you can clearly explain what you mean with examples if necessary and then we can give you a more specific answer.

Secondly you say it gives you an error but provide no details of that error. At a minimum, there should be an error message and possibly a stack trace you can share. Without sharing the error we can only guess at what went wrong and with so little detail any guesses we made would likely be useless. If you encounter an error you should be providing the full detail of it

I also strongly suggest that you read about Minimal, Complete and Verifiable examples:

http://stackoverflow.com/help/mcve

If you start asking questions that meet that definition you will get much better answers much faster rather than currently where we have to exchange multiple emails before we even understand your question.

Rob

On 21/11/2016 16:11, "kumar rohit" <ku...@gmail.com> wrote:

     Literal lit1 = model.createTypedLiteral(yes);
     Literal lit2 = model.createTypedLiteral(no);
    
    if (Some condition)
    {
    individual.setPropertyValue(Participate, lit1);
    else
    individual.setPropertyValue(Participate, lit2);
    }
    
    
    Is this possible that we have two set of values for a property? I use the
    above statements but it gives me error at setting second property
    
    else
    individual.setPropertyValue(Participate, lit2);
    





Re: Two values for a Property

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.

On 21.11.2016 17:11, kumar rohit wrote:
>  Literal lit1 = model.createTypedLiteral(yes);
>  Literal lit2 = model.createTypedLiteral(no);
>
> if (Some condition)
> {
> individual.setPropertyValue(Participate, lit1);
> else
> individual.setPropertyValue(Participate, lit2);
> }
>
>
> Is this possible that we have two set of values for a property? 
Two sets of values or two values? Your example shows two values.
> I use the
> above statements but it gives me error at setting second property
>
> else
> individual.setPropertyValue(Participate, lit2);
>
Which error? And if you really use the code you've shown, this are Java
basics and would result in a compiler error which clearly would state
that there are missing braces before and after the "else" keyword