|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <xs:schema |
|
3 xmlns:xs="http://www.w3.org/2001/XMLSchema" |
|
4 targetNamespace="http://www.s60.com/xml/ruleml/2" |
|
5 xmlns:ruleml="http://www.s60.com/xml/ruleml/2" |
|
6 elementFormDefault="qualified"> |
|
7 |
|
8 <xs:element name="ruleml"> |
|
9 <xs:annotation> |
|
10 <xs:documentation> |
|
11 RuleML v2 implementation for specifying rules to execute. |
|
12 </xs:documentation> |
|
13 </xs:annotation> |
|
14 <xs:complexType> |
|
15 <xs:choice minOccurs="0" maxOccurs="unbounded"> |
|
16 <xs:element name="rule" type="xs:string"> |
|
17 <xs:annotation> |
|
18 <xs:documentation> |
|
19 <![CDATA[ |
|
20 <p>The rule element specifies a single rule to execute.</p><br/> |
|
21 |
|
22 <p> |
|
23 For example:<br/> |
|
24 <b><rule>MyFeature.MySetting1 == 'test' configures MyFeature.MySetting2 = '1'</rule></b><br/> |
|
25 This would cause the value '1' to be assigned to the setting 'MyFeature.MySetting2' |
|
26 if the value of the setting 'MyFeature.MySetting1' is 'test'. |
|
27 </p><br/> |
|
28 |
|
29 <p> |
|
30 Arbitrary Python code can also be executed in the rule by enclosing the eval block |
|
31 with {% %}. For example:<br/> |
|
32 <b><rule>True configures MyFeature.MySetting = {% get_some_value() %}</rule></b><br/> |
|
33 This would cause the value got from evaluating the Python function call |
|
34 get_some_value() to be assigned to the setting 'MyFeature.MySetting'. |
|
35 </p><br/> |
|
36 |
|
37 <p> |
|
38 Any settings referenced inside an eval block must be enclosed with ${ } |
|
39 to differentiate them from the Python code. For example:<br/> |
|
40 <b><rule>True configures MyFeature.MySetting = {% get_some_value(${MyFeature.MySetting1}) %}</rule></b><br/> |
|
41 This would cause the value of the setting 'MyFeature.MySetting1' to be passed as a |
|
42 parameter to the function call. |
|
43 The actual feature object handled by ConE can be accessed by enclosing the setting |
|
44 reference with @{ }. |
|
45 </p><br/> |
|
46 |
|
47 <p> |
|
48 Any functions or variables (like get_some_value() in the above examples) need |
|
49 to be defined using eval_globals elements inside the ruleml element. |
|
50 </p> |
|
51 ]]> |
|
52 </xs:documentation> |
|
53 </xs:annotation> |
|
54 </xs:element> |
|
55 <xs:element name="eval_globals" type="ruleml:evalGlobalsType"> |
|
56 <xs:annotation> |
|
57 <xs:documentation> |
|
58 An eval_globals block can be used to add Python variables |
|
59 or functions to the evaluation context of the rules contained |
|
60 within the current ruleml implementation. The Python code can be contained |
|
61 either directly inside the XML element or inside a file pointed by the |
|
62 'file' attribute. |
|
63 </xs:documentation> |
|
64 </xs:annotation> |
|
65 </xs:element> |
|
66 </xs:choice> |
|
67 </xs:complexType> |
|
68 </xs:element> |
|
69 |
|
70 <xs:complexType name="evalGlobalsType"> |
|
71 <xs:simpleContent> |
|
72 <xs:extension base="xs:string"> |
|
73 <xs:attribute name="file" type="xs:string" use="optional"> |
|
74 <xs:annotation> |
|
75 <xs:documentation> |
|
76 Path to the file containing the Python code of the eval_globals element. |
|
77 Should be a path relative to the current implementation file. |
|
78 Specifying the 'file' attribute causes the text content of the eval_globals |
|
79 element to be ignored. |
|
80 </xs:documentation> |
|
81 </xs:annotation> |
|
82 </xs:attribute> |
|
83 </xs:extension> |
|
84 </xs:simpleContent> |
|
85 </xs:complexType> |
|
86 </xs:schema> |