Re: Blob problems
Hi Henrik, On Sat, Sep 19, 2009 at 08:34:36PM +0200, Alexander Burger wrote: ... [test3.l:23] !? (has (meta This Var) Val (get This Var)) has -- Bad message ... And what is 'Var', and - most important - (meta This Var). The latter one must be something which cannot handle 'has'. Just tell us what these values are when you are at the error prompt. Then we'll probably know what goes wrong. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
It worked OK, and I realized I had another relation with the same setup: (class +Awords +Entity) (rel words (+Blob)) (rel counts (+Blob)) (dm put (Key Val) (put! This Key T) (out (blob This Key) (prinl Val))) The above works but I wanted to follow your advice on this one too, so I changed it to: (dm put (Key Val) (super This Key T) (out (blob This Key) (prinl Val))) However, I'm getting: !? (has (meta This Var) Val (get This Var)) has -- Bad message When I run the code which is using the above like this: (let Awords (new! '(+Awords)) (put Awords 'words Words) (put Awords 'counts (mapcar val Words)) (put A 'words Awords)) Any ides on why the super version isn't working out this time? /Henrik On Wed, Sep 16, 2009 at 7:55 AM, Alexander Burger a...@software-lab.de wro= te: Hi Henrik, (class +Article +Entity) (rel aid =A0 =A0 =A0 (+Key +Number)) (rel title =A0 =A0 (+String)) (rel type =A0 =A0 =A0(+String)) (rel htmlUrl =A0 (+Key +String)) (rel body =A0 =A0 =A0(+Blob)) (dm put (Key Val) =A0 =A0(if (=3D Key 'body) =A0 =A0 =A0 (prog =A0 =A0 =A0 =A0 =A0(put! This 'body T) =A0 =A0 =A0 =A0 =A0(out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0 (prinl Val))) =A0 =A0 =A0 (super Key Val))) I didn't try this code, and have no direct explanation why you get an error upon re-import, but I see a different problem: It is not good to nest 'put!' within 'put'. 'put!' builds its own transaction with 'dbSync' and 'commit'. This means, that you get a preliminary 'commit', which will unlock the database too early. So the 'put!' above should at least be a simple 'put'. Then we might simply use 'super' instead: =A0 (dm put (Key Val) =A0 =A0 =A0(ifn (=3D=3D Key 'body) =A0 =A0 =A0 =A0 (super Key Val) =A0 =A0 =A0 =A0 (super 'body T) =A0 =A0 =A0 =A0 (out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0(prinl Val) ) ) ) As usual, this 'put' must run in a transaction (surrounded by 'dbSync' and 'commit'), of course. I don't know if this solves the original problem though. The same situation ('put!' inside 'lose!') we have here: (dm lose! () =A0 =A0(call 'rm (blob This 'body)) =A0 =A0(put! This 'body NIL) =A0 =A0(super)) In fact, I never directly remove blobs, and rely on the nightly garbage collection to have them cleaned up. So the above 'lose!' method might simply be omitted. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
I might be inclined to think something similar normally, but in this case the only difference is: (put! This Key T) which works as opposed to (super This Key T) which doesn't. And that has absolutely nothing to do with A (an article). /Henrik On Sat, Sep 19, 2009 at 4:36 PM, Alexander Burger a...@software-lab.de wro= te: Hi Henrik, (let Awords (new! '(+Awords)) =A0 (put Awords 'words Words) =A0 (put Awords 'counts (mapcar val Words)) =A0 (put A 'words Awords)) 'A' probably is not an object of a class that knows about 'words'. However, I'm getting: !? (has (meta This Var) Val (get This Var)) has -- Bad message I also frequently get such an error, if some code does not match the E/R definitions. I would type here =A0 : This =A0 - =A0 # Something which is the value of 'A' and =A0 : Var =A0 - words =A0# Probably 'words' In any case, when you know 'This' and 'Var', you usually have a clue what went wrong. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
I don't understand how a (show This) would show anything else but this in this case: [test3.l:23] !? (has (meta This Var) Val (get This Var)) has -- Bad message ? (show This) {4-5v;} (+Awords) - {4-5v;} If you check the earlier code listing you will see that +Awords is clearly a descendant of +Entity. I mean, this works perfectly for +Article (as per your instructions earlier), why it doesn't work for +Awords too is beyond me. /Henrik On Sat, Sep 19, 2009 at 5:43 PM, Alexander Burger a...@software-lab.de wrote: Still it might be helpful to find out why 'has' cannot be invoked: !? (has (meta This Var) Val (get This Var)) has -- Bad message What is 'This'? It must be an object of a class (if any?) which is perhaps not an '+Entity', or where (meta This Var), the inheritance of the relation class, does not have a method for 'has'. Perhaps this would be a hint then what's going wrong. -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
Hi Henrik, (class +Article +Entity) (rel aid (+Key +Number)) (rel title (+String)) (rel type (+String)) (rel htmlUrl (+Key +String)) (rel body (+Blob)) (dm put (Key Val) (if (= Key 'body) (prog (put! This 'body T) (out (blob This 'body) (prinl Val))) (super Key Val))) I didn't try this code, and have no direct explanation why you get an error upon re-import, but I see a different problem: It is not good to nest 'put!' within 'put'. 'put!' builds its own transaction with 'dbSync' and 'commit'. This means, that you get a preliminary 'commit', which will unlock the database too early. So the 'put!' above should at least be a simple 'put'. Then we might simply use 'super' instead: (dm put (Key Val) (ifn (== Key 'body) (super Key Val) (super 'body T) (out (blob This 'body) (prinl Val) ) ) ) As usual, this 'put' must run in a transaction (surrounded by 'dbSync' and 'commit'), of course. I don't know if this solves the original problem though. The same situation ('put!' inside 'lose!') we have here: (dm lose! () (call 'rm (blob This 'body)) (put! This 'body NIL) (super)) In fact, I never directly remove blobs, and rely on the nightly garbage collection to have them cleaned up. So the above 'lose!' method might simply be omitted. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Blob problems
nightly garbage I can't remember, didn't you go through that cron job script here in the mailing list or was it on IRC, if it was on IRC maybe it would be a good idea to do it here again? Will change the put! implementation, the error was on put so hopefully that might take care of it... /Henrik On Wed, Sep 16, 2009 at 7:55 AM, Alexander Burger a...@software-lab.de wro= te: Hi Henrik, (class +Article +Entity) (rel aid =A0 =A0 =A0 (+Key +Number)) (rel title =A0 =A0 (+String)) (rel type =A0 =A0 =A0(+String)) (rel htmlUrl =A0 (+Key +String)) (rel body =A0 =A0 =A0(+Blob)) (dm put (Key Val) =A0 =A0(if (=3D Key 'body) =A0 =A0 =A0 (prog =A0 =A0 =A0 =A0 =A0(put! This 'body T) =A0 =A0 =A0 =A0 =A0(out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0 (prinl Val))) =A0 =A0 =A0 (super Key Val))) I didn't try this code, and have no direct explanation why you get an error upon re-import, but I see a different problem: It is not good to nest 'put!' within 'put'. 'put!' builds its own transaction with 'dbSync' and 'commit'. This means, that you get a preliminary 'commit', which will unlock the database too early. So the 'put!' above should at least be a simple 'put'. Then we might simply use 'super' instead: =A0 (dm put (Key Val) =A0 =A0 =A0(ifn (=3D=3D Key 'body) =A0 =A0 =A0 =A0 (super Key Val) =A0 =A0 =A0 =A0 (super 'body T) =A0 =A0 =A0 =A0 (out (blob This 'body) =A0 =A0 =A0 =A0 =A0 =A0(prinl Val) ) ) ) As usual, this 'put' must run in a transaction (surrounded by 'dbSync' and 'commit'), of course. I don't know if this solves the original problem though. The same situation ('put!' inside 'lose!') we have here: (dm lose! () =A0 =A0(call 'rm (blob This 'body)) =A0 =A0(put! This 'body NIL) =A0 =A0(super)) In fact, I never directly remove blobs, and rely on the nightly garbage collection to have them cleaned up. So the above 'lose!' method might simply be omitted. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe