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?

Michael.
------------------------------------------------------------------------------
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
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to