List Info

Thread: Re: Property values




Re: Property values
country flaguser name
United States
2007-05-21 15:12:12
On 5/20/07 3:19 PM, michael wrote:
> 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 = 'newemailexample.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
>>
>> 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.
>>
>> -eyal
> 
> This addresses a pretty basic issue regarding how to
handle repeated value assignments:
> replace or append? The decision here effects the values
returned, a single value or an
> array respectively, and thus how to deal with data
coming from the RDF store.
> 
> I like the idea of being able to have the flexibility
to do both via the semantics of
> =(equals) and <<(append). However, like Eyal
said, the RDF community generally favors
> addition without deletion (no replacement). I like the
idea of retaining a history of
> changes that the additive approach achieves, but there
needs to be a way of identifying
> what values are current and those that are not.

I'm a total neophyte to both Ruby and ActiveRDF, so I
probably don't yet 
know something pivotal to the discussion. That said, I'd
like to share 
an observation or two:

It seems like the principal of least astonishment would
dictate that, by 
default, assignment behaves the way the RDF community
expects (append, 
not replace).

It seems like both actions are valuable behaviors to
embrace.

Perhaps it's interesting to implement both and make it
straightforward 
(and VERY VISIBLE) to make the default behavior
configurable.

But that might violate the principle of least astonishment.
=]

Cheers!

--j
-- 
Jim Meyer, Cucina Media                              jimcucinamedia.com
_______________________________________________
ActiveRDF mailing list
ActiveRDFlists.deri.org
http
://lists.deri.org/mailman/listinfo/activerdf

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )