YoungParentDiscount 2

From RIF
Revision as of 18:22, 25 August 2010 by Smitchel (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Test TypePositiveEntailmentTest
ContributorAxel Polleres
StatusObsolete
Record
DialectBLD
PurposeThis test case illustrates the use of guard predicates with built-ins, as well as RDF+BLD combinations.
DescriptionThe first rule says that a child is eligible for a "young-parents" discount if the difference between the child's age and one of the parent's age is less than 25 years. The second rule says that if a parent's age is not numeric, the parent will be marked as needing to be checked for eligibility. Note that external built-ins can be nested arbitrarily. Note also that built-ins in RIF are defined for arguments of specific datatypes. When an argument is not of the appropriate datatype, it is an error. Since the model-theoretic semantics for RIF does not include the notion of an error, the values of built-in predicates and functions are unspecified in such cases. In order to enable writing of rule sets with controlled behavior, RIF defines guard predicates for each datatype.


Note that this test case now doesn't add anything new over YoungParentDiscount_1 because of changes to YoungParentDiscount_1 after initial development.

SeeAlsoYoungParentDiscount_1
SpecRefhttp://www.w3.org/2005/rules/wiki/DTB#Guard_Predicates_for_Datatypes
ImportedDocument
Location http://example.org/mygraph
Turtle@prefix ex: <http://example.org/example#> . @prefix xs: <http://www.w3.org/2001/XMLSchema#> . ex:littleJoeDoe ex:parent ex:JoanDoe, ex:JohnDoe . ex:littleJoeDoe ex:age 10 . ex:JoanDoe ex:age "young"^^xs:string .
XMLview RDF/XML
Premises
Presentation SyntaxDocument( Prefix(ex <http://example.org/example#>) Prefix(func <http://www.w3.org/2007/rif-builtin-function#>) Prefix(pred <http://www.w3.org/2007/rif-builtin-predicate#>) Import(<http://example.org/mygraph> <http://www.w3.org/ns/entailment/RDF>) Group ( Forall ?c ?p ?ca ?pa( ?p # ex:YoungParent :- And( ?c[ ex:parent -> ?p ex:age -> ?ca ] ?p[ ex:age -> ?pa ] External( pred:isInteger( ?pa ) ) External( pred:isInteger( ?ca ) ) External( pred:numeric-less-than(External( func:numeric-subtract( ?pa ?ca ) ) 25 ) ) ) ) Forall ?c ?p ?ca ?pa( ?p # ex:ParentToBeChecked :- And( ?c[ ex:parent -> ?p ex:age -> ?ca ] ?p[ ex:age -> ?pa ] Or ( External( pred:isNotInteger ( ?pa ) ) External( pred:isNotInteger ( ?ca ) ) ) ) ) ) )
XMLview RIF/XML
Conclusion
Presentation Syntaxex:JoanDoe # ex:ParentToBeChecked
XMLview RIF/XML