Warning:
This wiki has been archived and is now read-only.

AssertRetract

From RIF
Jump to: navigation, search




Test TypePositiveEntailmentTest
ContributorAdrian Paschke
StatusApproved
RecordFebruary 2, 2010 telecon
DialectPRD
PurposeRetract + Assert Action of RIF PRD
DescriptionDemonstrates the combination of the assert and retract action in RIF PRD. The rule retracts every facts about the existing customer object and asserts a new fact with a new discount value of "0". Note, the combination of retract and assert in this example does not behave like a modify action, since the ex:status ex:John is retracted as well (and, therefore, re-initialized to "unknown" by the second rule).
SeeAlsoAssertRetract2, Assert, Retract, Modify
SpecRefhttp://www.w3.org/2005/rules/wiki/PRD
Premises
Presentation SyntaxDocument( Prefix(ex <http://example.org/example#>) Prefix(xs <http://www.w3.org/2001/XMLSchema#>) Group ( Forall ?X ( If ?X[ex:status -> "normal" ex:discount -> "10"] Then Do ( Retract (?X) Assert (?X[ex:discount -> "0"]) ) ) If Not( ex:john[ex:status -> "normal"] ) Then Do ( Assert (ex:john[ex:status -> "unkown"]) ) ex:john[ex:status -> "normal" ex:discount -> "10"] ) )
XMLview RIF/XML
Conclusion
Presentation Syntaxex:john[ex:status -> "unknown" ex:discount -> "0"]
XMLview RIF/XML