Top Engine Code
Status: Alpha
Brought to you by:
topengine
############################################################################
# test rule syntax
#
############################################################################
############################################################################
# schema section
#
############################################################################
*schema-begin*
m = resource("m_m")
has_gender = resource("has_gender")
male = resource("male")
female = resource("female")
has = resource("has")
text1 = text("some text here!")
text2 = text("some multi-line " \
"text here!")
text3 = text("some \"quoted\" multi-line \"" \
"text here!\"")
l100 = uint("100")
l_m10 = int ("-10")
l_22_5 = real("22.5")
6 = int("6")
10 = int("10")
one_hour = duration("1:00:00")
time1 = time("2007-01-30 16:00:00")
date1 = date("2007-01-30")
*schema-end*
############################################################################
############################################################################
# knowledge base section
#
############################################################################
*knowledge-base-begin*
default-explain = false
default-optimization = true
*knowledge-base-end*
############################################################################
############################################################################
# knowledge rules section
#
############################################################################
*knowledge-rules-begin*
# another one with long name for attribute keys - they can be mixed as well
rule1: \
(?s1 has ?age) . [ ( ?age >= 6) and (?age < 10)]. \
not(?s1 has male) . \
(?s2 has "2007-02-03") \
-> \
(?s1 has (?age < 10 ) ) . \
(?s2 has male)
# another one with long name for attribute keys - they can be mixed as well
rule2: \
(?s1 has male) \
<- \
(?s1 has ?age).[(?age >= 6) and (?age < 10)]. \
not(?s1 has male). \
(?s1 has "2007-02-03")
query2: SELECT ?s1 ?s3 FROM \
(?s1 has ?age).[(?age >= 6) and (?age < 10)]. \
not(?s1 has male). \
(?s3 has "2007-02-03")
query3: SELECT * FROM \
(?s1 has ?age).[(?age >= 6) and (?age < 10)]. \
not(?s1 has male). \
(?s2 has "2007-02-03")
*knowledge-rules-end*
############################################################################