You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Dennis Patzer <pa...@googlemail.com> on 2011/09/30 15:58:56 UTC
Problem with addProperty
Hello folks,
I have a problem with the following code:
Individual eventIndividual =
eventOntModel.getIndividual(instanceNamespace + eventType);
eventIndividual.addProperty(hasState, inactiveOntResource);
The problem is, that after the addProperty-call, no property is added :-(
When doing this with the initial eventIndividual I got from
Individual eventIndividual =
eventOntModel.createIndividual(instanceNamespace + eventType, eventClass);
it works well.
Could you please help me out soonly, time is running a little bit ;-)
Thanks!
Bye Dennis
Re: Problem with addProperty
Posted by Dennis Patzer <pa...@googlemail.com>.
ok, I found the error. It's quite embarassing. Somehow the output of the
model got *before* addProperty.
Sorry for that one!
Bye Dennis
Am 30.09.2011 16:50, schrieb Dave Reynolds:
> On Fri, 2011-09-30 at 15:58 +0200, Dennis Patzer wrote:
>> Hello folks,
>>
>> I have a problem with the following code:
>>
>> Individual eventIndividual =
>> eventOntModel.getIndividual(instanceNamespace + eventType);
>> eventIndividual.addProperty(hasState, inactiveOntResource);
>>
>> The problem is, that after the addProperty-call, no property is added :-(
> That seems unlikely, addProperty definitely works.
>
> The most common cause of problems over addProperty is to apply it to a
> Resource which is associated with a different Model from what you
> intended. In your case you will be adding to eventOntModel which is
> presumably what you want.
>
> The way to debug this is to write a minimal test case to just check that
> operation in the way you are using it. The chances are that in doing
> that you will spot the problem. If not then you will have a complete
> minimal example you can post to see if anyone else can spot it.
>
> Dave
>
>
Re: Problem with addProperty
Posted by Dave Reynolds <da...@gmail.com>.
On Fri, 2011-09-30 at 15:58 +0200, Dennis Patzer wrote:
> Hello folks,
>
> I have a problem with the following code:
>
> Individual eventIndividual =
> eventOntModel.getIndividual(instanceNamespace + eventType);
> eventIndividual.addProperty(hasState, inactiveOntResource);
>
> The problem is, that after the addProperty-call, no property is added :-(
That seems unlikely, addProperty definitely works.
The most common cause of problems over addProperty is to apply it to a
Resource which is associated with a different Model from what you
intended. In your case you will be adding to eventOntModel which is
presumably what you want.
The way to debug this is to write a minimal test case to just check that
operation in the way you are using it. The chances are that in doing
that you will spot the problem. If not then you will have a complete
minimal example you can post to see if anyone else can spot it.
Dave