    001    /*
    002    @license.text@
    003     */
    004    package com.hammurapi.reasoning.tutorial.rules;
    005
    006    import com.hammurapi.reasoning.spi.Infer;
    007    import com.hammurapi.reasoning.tutorial.objectmodel.Child;
    008    import com.hammurapi.reasoning.tutorial.objectmodel.Parent;
    009
    010    public class ParentChildRules {
    011
    012            /**
    013             * Infers child relaitonship from parent relationship.
    014             * @param parent
    015             * @return
    016             */
    017            @Infer
    018            public Child infer(Parent parent) {
    019                    return new Child(parent.getObject(), parent.getSubject());
    020            }
    021
    022            /**
    023             * Infers parent relationship from child relationship
    024             * @param child
    025             * @return
    026             */
    027            @Infer
    028            public Parent infer(Child child) {
    029                    return new Parent(child.getObject(), child.getSubject());
    030            }
    031
    032    }