Re: Picking up justifications in Java-ish implementation
Pierre Grenon <[email protected]> Wed, 23 Aug 2017 16:18:10 +0100
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <CAAkf34yEiX7P-ux0-+AAwVusGYAxZeZ_Jko77rBcErFNHio=ug@mail.gmail.com> |
Alright, I haven't finished my homework... So this => (Logic/getWhyJustification "WHY") #<Justification |i|/LOGIC/@JUSTIFICATION> gives me the justification -- I assume the most recent one I can consify it and it's very pretty to me: => (Justification/consifyJustification (Logic/getWhyJustification "WHY") Logic/KWD_RAW) But I'm struggling making it prettier and reuse the formatting of 'why'. I'm sturggling figuring out how to clone the Stella explain-why because it looks like I'm messing up either the output or the mapping... It's not happy with Logic/$MOST_RECENT_EXPLANATION_MAPPING$ as there's a class mismatch: ClassCastException edu.isi.stella.javalib.StellaSpecialVariable cannot be cast to edu.isi.stella.KeyValueList But maybe trying to use Justification/printExplanation isn't the thing to do? I get all this trouble because I can't run 'why' through clojure's with-out-str as I won't catch side effects that way. It sometimes happen that you guys can pinpoint the right command on top of your head so I'm just asking a bit more specifically than in the earlier message. Best, Pierre On Wed, Aug 23, 2017 at 1:20 PM, Pierre Grenon <[email protected]> wrote: > Hi, > > apologies if this is discussed somewhere and I missed it or if it's a > dumb one to ask. > > I'm trying to catch 'whys' to show them in a makeshift GUI and I'm > struggling with this. > > I'm coding in clojure so I use the PLM jars and I'm inexpertly > wrapping functions or APIs as I find and need them. But I can't seem > to find a way to catch justifications to reuse them as strings and I'm > a little confused by how to go about it between either the > documentation or the javadoc. > > Exhibit A: https://www.isi.edu/isd/LOOM/PowerLoom/documentation/manual/manual_11.html > > explain-why ((label STRING) (style KEYWORD) (maxdepth INTEGER) (stream > OUTPUT-STREAM)) > get-why-justification ((label STRING)) : JUSTIFICATION > > and I think the arguments escape me as I get: > > EvaluationException While evaluating '(EXPLAIN-WHY)': > Undefined operator: `EXPLAIN-WHY' > edu.isi.stella.Cons.evaluateConsTree (Cons.java:8474) > > (I add something similar when wrapping plain 'why' until I added a > module as argument without really knowing why I did that.) > > Exhibit B: https://www.isi.edu/isd/LOOM/PowerLoom/documentation/powerloom-4.0.2-javadoc/edu/isi/powerloom/logic/Justification.html > > Of which I have no clue what to try using -- naively, perhaps I was > looking for something with 'why'... > > Sorry for the vague message in a bottle, as I'mstarting to dig an ever > deeper hole, I'm wondering first if I'm missing something obvious? > > Or do you happen to have any code example using the intended APIs? > > Many thanks, > Pierre