why
index
/home/syosi/CVS-local/WWW/2000/10/swap/why.py

$Id: why.html,v 1.13 2004/08/08 01:44:49 syosi Exp $
 
A class for storing the reason why something is known.
The dontAsk constant reason is used as a reason for the explanations themselves- we could make
it more complicated here for the recursively minded but i don't see the need at the moment.
 
Assumes wwe are using the process-glbal store -- uses Namespace() @@@

 
Modules
       
binascii
md5
string
sys
uripath
urllib

 
Classes
       
Reason
Because
BecauseOfCommandLine
BecauseOfData
BecauseOfExperience
BecauseBuiltIn
BecauseOfRule
BecauseSubexpression
FormulaReason
BecauseMerge

 
class Because(Reason)
    For the reason given on the string.
This is a kinda end of the road reason. Try to make a more useful one up! ;-)
 
A nested reason can also be given.
 
  Methods defined here:
__init__(self, str, because=None)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this reason as interned in the store.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseBuiltIn(Reason)
    Because the built-in function given concluded so.
A nested reason for running the function can also be given
 
  Methods defined here:
__init__(self, subj, pred, obj, proof)
explain(self, ko)
This is just a plain fact - or was at the time.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseMerge(FormulaReason)
    Because this formula is a merging of others
 
 
Method resolution order:
BecauseMerge
FormulaReason
Reason

Methods defined here:
__init__(self, f, set)

Methods inherited from FormulaReason:
explain(self, ko)
explanation(self, ko=None)
Produce a justification for this formula into the output formula
 
Creates an output formula if necessary.
returns it.
(NB: This is different from reason.explain(ko) which returns the reason)
newStatement(self, s, why)
setFormula(self, formula)
Change the address fo the formula when the formula is moved on close()

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseOfCommandLine(Because)
    Becase the command line given in the string
 
 
Method resolution order:
BecauseOfCommandLine
Because
Reason

Methods inherited from Because:
__init__(self, str, because=None)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this reason as interned in the store.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseOfData(Because)
    Directly from data in the resource whose URI is the string.
 
A nested reason can also be given, for why this resource was parsed.
 
 
Method resolution order:
BecauseOfData
Because
Reason

Methods defined here:
__init__(self, source, because=None)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this reason as interned in the store.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseOfExperience(Because)
    Becase the command line given in the string
 
 
Method resolution order:
BecauseOfExperience
Because
Reason

Methods inherited from Because:
__init__(self, str, because=None)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this reason as interned in the store.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseOfRule(Reason)
     Methods defined here:
__init__(self, rule, bindings, evidence, because=None)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this reason as interned in the store.

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class BecauseSubexpression(Reason)
     Methods inherited from Reason:
__init__(self)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this object as interned in the store.
meIn(self, ko)
The representation of this object in the formula ko

 
class FormulaReason(Reason)
    A Formula reason reproduces the information in a formula
but includes reason information.  There is a link each way (formula,
collector) with the actual formula. Beware that when a new formula is
interned, the collector must be informed that its identity has changed.
The collector is also informed of each statement added.
 
  Methods defined here:
__init__(self, formula=None)
explain(self, ko)
explanation(self, ko=None)
Produce a justification for this formula into the output formula
 
Creates an output formula if necessary.
returns it.
(NB: This is different from reason.explain(ko) which returns the reason)
newStatement(self, s, why)
setFormula(self, formula)
Change the address fo the formula when the formula is moved on close()

Methods inherited from Reason:
meIn(self, ko)
The representation of this object in the formula ko

 
class Reason
    The Reason class holds a reason for having some information.
Well, its subclasses actually do hold data.  This class should not be used itself
to make instances.  Reasons may be given to any functions which put data into stores,
is tracking or proof/explanation generation may be required
 
  Methods defined here:
__init__(self)
explain(self, ko)
Describe this reason to an RDF store
Returns the value of this object as interned in the store.
meIn(self, ko)
The representation of this object in the formula ko

 
Functions
       
describeStatement(s, ko)
Describe the statement into the output formula ko
explainStatement(s, ko)
report(s, why)
Report a new statement to the reason tracking software
 
See the FormulaReason class

 
Data
        becauseSubexpression = <why.BecauseSubexpression instance>
dontAsk = <why.Because instance>
log = <myStore.Namespace object>
proofOf = {}
rdf = <myStore.Namespace object>
reason = <myStore.Namespace object>