Closed Bug 86435 Opened 23 years ago Closed 18 years ago

Rules for XUL templates should allow inequalities

Categories

(Core Graveyard :: RDF, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: rogerd, Unassigned)

References

Details

The current XUL templating mechanism only allows rules that match exactly (give 
or take the presence of variables specified in bindings). This makes it 
difficult or impossible to write rules that match over a range of values (e.g. 
for values of an integer literal n in the range 0 <= n <= 60 - unless you are 
really willing to write 61 separate <rule> clauses). It would be nice to have a 
way of specifying inequalities in XUL template rule matches. A possible 
implementation would be something along the following lines:

<rule>
  <content uri="?uri" />
  <triple subject="?uri"
          predicate="http://home.netscape.com/NC-rdf#n"
          object="?n" />
  <comparison variable1="?n" comparator=">=" variable2="0" />
  <comparison variable1="?n" comparator="<=" variable2="60" />
</rule>

A more flexible and powerful alternative would be to allow a Javascript function 
to be called, taking an arbitrary number of values and returning a true or false 
value: the rule does not match if false is returned, and can match (assuming all 
other conditions apply) if true is returned:

<rule>
  <content uri="?uri" />
  <triple subject="?uri"
          predicate="http://home.netscape.com/NC-rdf#n"
          object="?n" />
  <test script="mytest(?n)" />
</rule>

Obviously for the template to behave well the script should behave in a 
consistant fashion and not use pseudorandom numbers or changing global variables 
to determine its answer.
Sounds like a great idea.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Target Milestone: --- → mozilla1.0
*** Bug 81508 has been marked as a duplicate of this bug. ***
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Target Milestone: mozilla1.0.1 → Future
tever is not RDF QA anymore
QA Contact: tever → nobody
waterson left the building
Assignee: waterson → nobody
Status: ASSIGNED → NEW
QA Contact: nobody → core.rdf
We could maybe use the expression syntax from
http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/
So something like <expression test="?n &gt;= 0"/>
The patch in bug 285631 provides this feature.
Depends on: 285631
Comparisons are now implemented via:

<conditions>
  <where subject="?name" rel="before" value="Fred"/>
</conditions>
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.