On 26/01/2011 17:59, Ellis, Peter C wrote: > Greetings, all - > > Is there a way to configure Semantic MediaWiki so that properties are defined > in more than one namespace? Here's the situation: we have a system that > automatically populates wikis with a certain set of predefined properties > that we don't want users to be able to modify (which is why the property data > is automatically updated with each site release). However, we still want to > provide users with the capability to define their own properties whilst > avoiding any possibility of accidentally overwriting user-defined properties > with future updates that might add or remove properties from our > automatically generated list. The idea we came up with was to allow users to > define properties within a separate namespace - say, UserProperty instead of > Property - and then have our automated system check to make sure that the > user had not already defined a property with a matching name prior to > creating its entries. Thus, we'd have both the UserProperty AND Property > namespaces working in s > ync. > > I realize this is a nontrivial bit of functionality, but was hoping that > perhaps some mechanism already existed that might allow us to do this (or > perhaps that someone might have a better idea of how to approach this). My > searches have turned up nothing, but I figured that if anyone would know, > it'd be the developer community.
If the list of predefined properties that you require is small, then it would be an option to register them in LocalSettings.php. SMW already has predefined properties that the user cannot change (e.g. "Property:has type"), and it is possible to add to this list. You can use something like the following code (pardon my linebreaks): $wgHooks['smwInitProperties'][] = 'myinitProperties'; function myinitProperties() { SMWPropertyValue::registerProperty('___myp', '_num', 'Myproperty', true); SMWPropertyValue::registerPropertyAlias('___myp', 'My property'); } Explanation of first call ("registerProperty"): "___myp" is an internal (language-independent) ID for your property. It is strongly recommended to put three "_" in the beginning to avoid any name clashes with SMW properties. The rest is arbitrary, but keep it short. "_num" is the (language-independent) ID of the datatype that the property will have. The list of SMW's internal datatype IDs is found in the language file SMW_LanguageEn.php (or whatever your language). "Myproperty" is the label that users will see for this property, and the name of its page. "true" just means that the property will be included in the Factbox. You would want this. Note: for internal properties that cannot be set or queried directly (e.g. if you code an extension that needs to store some data), one should use "false" as a label. The second call merely registers an alternative name. You probably do not need this. Properties registered like this can still have a page (and SMW will print links to it when mentioning the property) but the datatype is fixed internally and will not be overwritten. Since predefined properties are loaded whenever SMW is used, it is not suggested to use this mechanism for registering large numbers of properties. Cheers, Markus > > Thanks! > __________________________________________________ > Peter Ellis > Scientist > Knowledge Discovery and Informatics > Pacific Northwest National Laboratory > > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Semediawiki-devel mailing list > Semediawiki-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/semediawiki-devel > ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel