[Mulgara-dev] Problem w/ "insert select ..."

Eric Brown yogieric.dev at gmail.com
Thu Mar 29 07:45:49 UTC 2007


Hi Andrae,

On Mar 28, 2007, at 11:36 PM, Andrae Muys wrote:

>
> On 29/03/2007, at 3:02 PM, Eric Brown wrote:
>>> Neither update nor replace have any meaning when working with  
>>> rdf.  Updating a _property_ of an _instance_ is an operation that  
>>> only makes sense when you have a concept of an _instance_ ---  
>>> correspondingly update is an rdfs level operation.  What mulgara  
>>> does provide is the concept of a transaction.  OTOH I would like  
>>> to see improved support for compound operations.  Something along  
>>> the lines of haskell's do syntax combined with a query/operation  
>>> monad.  I've been referring to this as let-expressions, but  
>>> really it about providing the ability to integrate side-effects  
>>> (insert/delete) cleanly into sequences/sets of queries.
>>
>> It'd be really nice if you could extend itql with very simple  
>> stored procedures (or even just functions defined on the current  
>> session). Of course things always start very simple...
>
> mmm, I'm not entirely sure that what can't be done with a resolver  
> already should be done at all.  What exactly did you have in mind  
> that a resolver can't provide?

Hm. Well, using the shorter form of what I need isn't as verbose...  
so maybe I jumped the gun. Anyway, just looking for a way to reduce  
the verbosity (just as aliases do in a small way). In my limited  
experience itql does seem quite a bit more verbose than sql which  
maybe isn't a big deal for a developer, but IMO is an issue for  
system-admins that need to maintain and manage production systems.

define replace(p, old, new, model)
   delete select $s $p $old from $model where $s $p $old from $model;
   insert select $s $p $new from $model where $s $p $new into $model;
end

replace <pred> <old1> <new1> <model>;
replace <pred> <old2> <new2> <model>;
replace <pred> <old3> <new3> <model>;
replace <pred> <old4> <new4> <model>;
replace <pred> <old5> <new5> <model>;

Cheers,
Eric




More information about the Mulgara-dev mailing list