Changes

Jump to navigation Jump to search
no edit summary
Line 42: Line 42:  
===Restricting Property Values===
 
===Restricting Property Values===
   −
When you create a new property that has a Page (or Text, or possibly other values) that can be assigned to a wide range of values, it might be nice to restrict those values to a particular subset so that typos don't render the property useless. This has been done on the [[Property:Is used in domain|Is used in domain]] and the [[Property:Is located in facility|Is located in facility]] properties.
+
When you create a new property that has a Page (or Text, or possibly other values) that can be assigned to a wide range of values, it might be nice to restrict those values to a particular subset so that typos don't render the property useless. This has been done on the [[Property:Is used in domain|Is used in domain]] and the [[Property:Is located in facility|Is located in facility]] properties. You will see a special property added to those property pages called [https://www.semantic-mediawiki.org/wiki/Help:Special_property_Allows_value_list Allows value list]. The [[https://www.semantic-mediawiki.org/wiki/Help:Special_property_Allows_value_list help link] provides all of the pertinent information, but of special importance is the following:
 +
 
 +
<nowiki>Two steps have to be taken to use this special property:
 +
 +
Add [[Allows value list::...]] to a property page for defining a page reference, e.g. [[Allows value list::Foo]] will define page "MediaWiki:Smw_allows_list_Foo".
 +
Add permissible values as listed items starting either with "*" or "**" to the "MediaWiki:Smw_allows_list_..." page, e.g. "* Bar" or "** Foobar" to page "MediaWiki:Smw_allows_list_Foo".</nowiki>
 +
 
 +
However, might want to go one step further and auto-generate this list from our own properties. For instance, all of our domains are marked with the [Property:Is domain] and our facilities are marked with the [Property:Is facility]. If you view the pages for [MediaWiki:Smw_allows_list_Domains] and [MediaWiki:Smw_allows_list_Facilities], you will see that they have the correct ordered lists. But if you view the source, you will see something like the following:
 +
<nowiki>{{#ask: [[Is domain::True]]
 +
|format=template
 +
|template=Starlist for allow value list
 +
|link=none
 +
}} </nowiki>

Navigation menu