Re: Loosing assertions
Axel Hecht <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Neil Stansbury wrote:
> Hi Axel,
>
> Thanks, I'm being an idiot had had forgotten that it would just assert a
> new arc not replace it.
>
> I have tried change() instead using the code below, but I still do end
> up with two arcs instead of the original one when I iterate through them.
>
>
> var resource = nsIRDFService.GetResource( resource );
> var property = nsIRDFService.GetResource( property );
>
> var oldTarget = ds.GetTarget( resource, property, true );
> var newTarget = nsIRDFService.GetLiteral( "NewVal" );
>
> ds.Change( resource, property, oldTarget, newTarget );
>
> var nsEnum = ds.GetTargets( resource, property, true );
>
> // Check
> while( nsEnum.hasMoreElements() ) {
> var target = nsEnum.getNext();
> target = target.QueryInterface( Components.interfaces.nsIRDFLiteral );
> alert( "Object: " +target.Value ); // Two assertions
> }
>
>
> Am I missing something again?
Hrm. Change doesn't check if the datasource even has the old arc, thus,
it will add the new arc to the first ds. (Unassert doesn't, and Change
just does Unassert - Assert)
How evil.
Axel