Hi Michael,

I can think of a hack that might accomplish that: transclude the first page in the second page, while keeping the first page's contents hidden. So adding the following to page "object-B" might work:

<span style="display:none">{{:object-A}}</span>


On Sat, Dec 15, 2012 at 3:54 PM, Michael Rau <michi.rau@gmail.com> wrote:
Hello SMW people,

my objective is to implement inheritance of properties. Example:

page "object-A" has two properties
* prop1::test1
* prop2::test2

Now, object-B inherits from object-A with the following properties:
* is::object-A (specifies inheritance!)
* prop1::test3
* prop3::test4

The final properties (also displayed in the factbox) are expected to be:
* is::object-A (specifies inheritance!)
* prop1::test3 (object-B overwrites object-A)
* prop2::test2 (inherited from object-A and not overwritten)
* prop3::test4 (new property specific to object-B)

My approach is $wgHooks['smwShowFactbox'] defining a parser hook to
1) extract inheritance from property "is"
2) if inheritance is defined, then
2.1) read all properties from parent
2.2) read all properties from child
2.3) append all properties from parent not defined in child

The thing is, I have no glue about how to i) extract properties from a page (child and parent) and ii) append new properties. It
should be possible as demonstrated in SMW_Factbox::getFactboxTex. Possible approach to append new properties might be to add a silent
property definition i.e. [[:prop2::test2]] to the hooks &$text reference. I could also use SMWWriter but I could not get it to work.

Any ideas if there is a straight-forward solution and how to read properties from parent and child?


LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
Semediawiki-devel mailing list

WikiWorks MediaWiki Consulting http://wikiworks.com

WikiWorks MediaWiki Consulting http://wikiworks.com