[Activerdf] Property values

Harshal Ganpatrao Hayatnagarkar iamharshal at rediffmail.com
Wed Apr 25 07:01:16 IST 2007


On Tue, 24 Apr 2007 Eyal Oren wrote :
>On 04/23/07/04/07 16:05 -0000, Harshal Ganpatrao Hayatnagarkar wrote:
>>Hi,
>>
>>When I am assigning value to an object property, it gets 'appended' to the list. I don't know how to replace that value. Can you please help me in this?
>>
>>person = TEST::Person.find_by_firstname 'someone'
>>person.email = 'newemail at example.com'
>>puts person.email #Prints an array with old and new emails
>>#How do I replace the email value?
>
>Short answer: use the triple API (ouch, this feels very bad):
>  FederationManager.delete(s, p, old_value)
>  FederationManager.add(s, p, new_value)
>
>Long answer: I think we discussed this on the list already and I wanted to point you to it, but I can't find it quickly. This is an often recurring question, and I want to solve it properly, but I don't know how exactly.
>
>In OO most people would probably want ActiveRDF to replace the object-value given your example, but in RDF people are more accustomed to adding instead of replacing. I'm still thinking how to solve it nicely. One idea:
>
>  person.email << "new address" # would append to existing values
>  person.email = "new address" # would replace existing values

This sounds a good approach.

>
>I tried quickly but didn't get it implemented yet, because it requires some changes to the internals of ActiveRDF. I would be grateful if somebody wants to fix this, otherwise it's on my (longish) list of todo's.

I would be happy to contribute anything that can make ActiveRDF better.

Thanks Eyal for your kind reply.

Sincerely,
Harshal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.deri.org/pipermail/activerdf/attachments/20070425/ada61e87/attachment.htm


More information about the ActiveRDF mailing list