--- a/semantics/constraints.pl Wed Jan 09 15:12:17 2013 +0000
+++ b/semantics/constraints.pl Wed Jan 09 17:24:26 2013 +0000
@@ -169,6 +169,24 @@
%% Constraints. Most of these remain to do.
+decl('Constraint', 22, 'key-object',
+ rules([key(id,entity(id,attrs)),
+ key(id,activity(id,t1,t2,attrs)),
+ key(id,agent(id,attrs))])).
+
+decl('Constraint', 23, 'key-properties',
+ rules([key(id,wasGeneratedBy(id, e,a,t,attrs) ),
+ key(id,used(id, a,e,t,attrs)),
+ key(id,wasInformedBy(id, a_2,a_1,attrs) ),
+ key(id,wasStartedBy(id, a_2,e,a_1,t,attrs) ),
+ key(id,wasEndedBy(id, a_2,e,a_1,t,attrs) ),
+ key(id,wasInvalidatedBy(id, e,a,t,attrs) ),
+ key(id,wasDerivedFrom(id, e_2, e_1, a, g2, u1, attrs) ),
+ key(id,wasAttributedTo(id, e,ag,attr) ),
+ key(id,wasAssociatedWith(id, a,ag,pl,attrs) ),
+ key(id,actedOnBehalfOf(id, ag_2,ag_1,a,attrs) ),
+ key(id,wasInfluencedBy(id, o2,o1,attrs) ) ])).
+
decl('Constraint',24,'unique-generation',
rule([gen_1,gen_2,e,a,t_1,t_2,attrs_1,attrs_2],
[wasGeneratedBy(gen_1, e,a,t_1,attrs_1),
@@ -487,32 +505,43 @@
latexConj(Concls),
emit('\n\\end{array}').
-latexRules(rule(Xs,Hyps,Concls)) -->
+wikiRules(key(Id,Formula)) -->
+ emit('The identifier field '),
+ emit('<math>'),
+ emit(Id),
+ emit('</math>'),
+ emit(' is a KEY for the '),
+ emit('<math>'),
+ latexPred(Formula),
+ emit('</math>'),
+ emit(' statement.').
+
+wikiRules(rule(Xs,Hyps,Concls)) -->
emit('<math>\n'),
% Change this to change from logical formula to inference rule format
latexRule(Xs,Hyps,[],Concls),
emit('\n</math>').
-latexRules(rule(Xs,Hyps,Ys,Concls)) -->
+wikiRules(rule(Xs,Hyps,Ys,Concls)) -->
emit('<math>\n'),
% Change this to change from logical formula to inference rule format
latexRule(Xs,Hyps,Ys,Concls),
emit('\n</math>').
-latexRules(comment(Comment,Rules)) -->
+wikiRules(comment(Comment,Rules)) -->
emit(Comment),
- latexRules(Rules).
-latexRules(rules(L)) -->
- latexRuleList(L).
+ wikiRules(Rules).
+wikiRules(rules(L)) -->
+ wikiRuleList(L).
% only handles one nesting level
-latexRuleList([]) --> [].
-latexRuleList([R|Rs]) -->
+wikiRuleList([]) --> [].
+wikiRuleList([R|Rs]) -->
emit('\n#'),
- latexRules(R),
- latexRuleList(Rs).
+ wikiRules(R),
+ wikiRuleList(Rs).
-latexWiki(Type,Num,Name,Rules) -->
+wikiDecl(Type,Num,Name,Rules) -->
emit('=== '),
emit(Type),
emit(' '),
@@ -520,7 +549,7 @@
emit(' ('),
emit(Name),
emit(') ===\n'),
- latexRules(Rules),
+ wikiRules(Rules),
emit('\n').
@@ -572,7 +601,17 @@
htmlQuantify(exists,Ys),
htmlConj(Concls).
-
+htmlRules(key(Id,Formula)) -->
+ emit('The identifier field '),
+ emit('<span class="math">'),
+ emit(Id),
+ emit('</span>'),
+ emit(' is a <span class="conditional">KEY</span> for the '),
+ emit('<span class="math">'),
+ htmlPred(Formula),
+ emit('</span>'),
+ emit(' statement.').
+
htmlRules(rule(Xs,Hyps,Concls)) -->
emit('<span class="math">'),
htmlRule(Xs,Hyps,[],Concls),
@@ -628,5 +667,5 @@
close(Out).
main :- findall(X, decl(_,X,_,_),Xs),
- writeEach(latexWiki,user,Xs).
+ writeEach(wikiDecl,user,Xs).