#6 An easy way to access a Fact Relation


PyCLIPS provides the API-like methods to retrieve Fact
slots, either declared or implied: however there is no
way to quickly access a Fact relation (the first field in a
CLIPS fact), the only way to do it is to apply a formula

f = <somefact>
rel = f.CleanPPForm()[1:-1].split()[0]

which always succeeds for correctly defined facts but
makes code much less readable. Probably this formula
should be implemented at the higher level in order to
improve readability in an operation that is likely to be
performed several times.

The proposal is to implement a read-only property
called 'Relation' for Fact objects, which actually returns
the string defined above as a Symbol (which is the type
of the "relation" as in BPG, page 11). The property
should be read-only because this symbol either depends
on a specific Template or it occurs in an already
asserted Fact: in both cases it would be not modifiable.


  • Francesco Garosi

    • status: open --> closed
  • Francesco Garosi

    Logged In: YES

    Closed with release 1.0_03.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks