Zeev:

First, when you use "Square" in your examples, I'm pretty sure you actually mean "Area". Second - I think the idea of custom code for handling functions/rules in SMW is a non-starter - too difficult to implement for too little value. The Semantic Rules extension mentioned earlier might be able to handle this - I haven't seen it in action, but given its name it seems promising.

However, it seems to me that the easiest way to implement this would be, instead of storing the formula for the area, to store the sets of allowed values directly. This is n-ary data, so you would have two options - either use multi-value properties, so you could have something like:

[[Has allowed value set::1;4;2]]
[[Has allowed value set::2;5;5]]
...etc.

...or use the Semantic Internal Objects extension, so you could have something like:

{{#set_internal:Is value set for|Has height=1|Has length=4|Has area=2}}
{{#set_internal:Is value set for|Has height=2|Has length=5|Has area=5}}
...etc.

The querying would be different depending on which option you went with, but in either case it wouldn't be that hard.

I don't know whether you can actually write out all the possibilities by hand - it depends on your data needs. If you have hundreds or more of such allowed-value sets, it may make sense to create a custom extension for your wiki that would simply generate the text of these declarations, based on a formula and a set of inputs.

-Yaron


On Thu, Jan 28, 2010 at 9:49 AM, Hauke Pribnow <hauke.pribnow@gmx.net> wrote:
Zeev,

do you know about the ParserFunctions extension? If not, have a look at it:
http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions

You should already be able to implement something like this by using
this extension and some templates.


Cheers,
Hauke

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel