User:Skierpage/SMW work: Difference between revisions
m →More on my Semantic MediaWiki work: link to SMW_DT_Float.php code |
|||
| Line 2: | Line 2: | ||
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 <tt>author=skierpage</tt> for my contributions. |
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 <tt>author=skierpage</tt> for my contributions. |
||
Quick summary |
Quick summary: |
||
* with Markus Krötzsch I implemented custom units and display units, but |
* with Markus Krötzsch I implemented custom units and preferred display units, but the relevant check-ins to [http://semanticweb.org/wiki/Semantic_MediaWiki_0.5_changes SMW 0.5] were on SourceForge and seem lost. It's a big chunk of the code in [http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_10/extensions/SemanticMediaWiki/includes/SMW_DT_Float.php?revision=16179&view=markup#l352 SMW_DT_Float.php] focused around class SMWLinearTypeHandler, and bits elsewhere. |
||
* [http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_10/extensions/SemanticMediaWiki/includes/SMW_Datatype.php?r1=17484&r2=18172 I added support for boolean properties] in [http://svn.wikimedia.org/viewvc/mediawiki?view=revision&revision=18172 revision 18172] |
* [http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_10/extensions/SemanticMediaWiki/includes/SMW_Datatype.php?r1=17484&r2=18172 I added support for boolean properties] in [http://svn.wikimedia.org/viewvc/mediawiki?view=revision&revision=18172 revision 18172] |
||
* [http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_10/extensions/SemanticMediaWiki/includes/SMW_Datatype.php?view=diff&r1=19622&r2=18833&diff_format=h I implemented enumerated properties] in [http://svn.wikimedia.org/viewvc/mediawiki?view=revision&revision=19622 revision 19622] to only allow certain values |
* [http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_10/extensions/SemanticMediaWiki/includes/SMW_Datatype.php?view=diff&r1=19622&r2=18833&diff_format=h I implemented enumerated properties] in [http://svn.wikimedia.org/viewvc/mediawiki?view=revision&revision=19622 revision 19622] to only allow certain values |
||
Revision as of 04:35, 13 June 2012
More on my Semantic MediaWiki work
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
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 version 0.7 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
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
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)