User:Skierpage/SMW work
More on my Semantic MediaWiki work
[edit]I learned PHP to contribute to the Semantic MediaWiki extension. It's all sitting in Subversion. Unfortunately, it seems every site has disabled ViewVC's "query view" due to XSS bugs, so I can't find an easy way to query author=skierpage for my contributions.
Quick summary:
- with Markus Krötzsch I implemented custom units and preferred display units, but the relevant check-ins to SMW 0.5 were on SourceForge and seem lost. It's a big chunk of the code in SMW_DT_Float.php focused around class SMWLinearTypeHandler, and bits elsewhere.
- I added support for boolean properties in revision 18172
- I implemented enumerated properties in revision 19622 to only allow certain values
Custom units and display units
[edit]SMW lets you annotate wiki pages with attributes; each attribute is a property and its value. For example the w:General Motors EV1 article could say
The car had a [[has engine power::102 kW]] electric motor.
The value for power is a number, but there are many different units for power. In discussion with Markus Krötzsch I enhanced SMW so you could create a new datatype [[Type:Power]] and on its page give the conversion formula as additional special properties.
[[Corresponds to::1 W, Watt, Watts]] [[Corresponds to::0.001 kW]] [[Corresponds to::0.0013410220 hp,bhp,horsepower]] ...
This lets you annotate numeric values for a quantity in multiple units while storing them in a consistent unit.
For the property "has engine power" you probably want to display this value in horsepower and kW, not Watts or calories. I added another special property "display units" that indicate what units a property should use, thus [[display units::bhp, kW]]
Help:custom units documents what I implemented. The talented SMW team generalized it to a Quantity type, but the concept remains in SMW 1.7, see http://semanticweb.org/wiki/Property:Height
Allowed values
[edit]A project wiki will probably use a "Status" property, so you could e.g. query for all projects with [[status:in testing]]. To discourage dirty data — status "in test", "testing", etc. — I added a general feature that lets you enumerate the possible values of a property using the special property "allows value". See it in use on olpc:Property:Status.
Documentation
[edit]I wrote and rewrote a lot of the SMW 1.0 documentation and examples to explain these and other features, see all my contributions. For example, Many-valued properties is a help page I wrote from scratch (I started it on another semantic wiki)