Changes

Jump to navigation Jump to search
no edit summary
Line 15: Line 15:  
}}</nowiki>
 
}}</nowiki>
   −
The [https://www.semantic-mediawiki.org/wiki/Help:Inline_queries#Parser_function_.23ask '''ask'''] directive is a [https://www.semantic-mediawiki.org/wiki/Help:Inline_queries Semantic MediaWiki inline query]. This particular query searches the wiki pages for pages that have the property [[Property:Is facility|Is facility]] set to True. ''(There is an article on [https://www.semantic-mediawiki.org/wiki/Help:Property_naming Property naming] and in the best practices section, it is advised that you use a verb phrase to describe properties). Also, properties can have various [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes datatypes] - in this case, the property datatype is Boolean.'' The [https://www.semantic-mediawiki.org/wiki/Help:Result_formats |format=ul] line directs the results to be printed out as an unordered list.
+
The [https://www.semantic-mediawiki.org/wiki/Help:Inline_queries#Parser_function_.23ask '''ask'''] directive is a [https://www.semantic-mediawiki.org/wiki/Help:Inline_queries Semantic MediaWiki inline query]. This particular query searches the wiki pages for pages that have the property [[Property:Is facility|Is facility]] set to True. ''(There is an article on [https://www.semantic-mediawiki.org/wiki/Help:Property_naming Property naming] and in the best practices section it is advised that you use a verb phrase to describe properties). Also, properties can have various [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes datatypes] - in this case, the property datatype is Boolean.'' The [https://www.semantic-mediawiki.org/wiki/Help:Result_formats |format=ul] line directs the results to be printed out as an unordered list.
   −
The value in this particular setup is that, when a new facility is added to the space, it will automatically show up in this list. Now, one might argue that facilities are not going to show up at frequent intervals, and, this is true. However, we can extend this practice to create new lists, and [[Equipment]] is one of the major ones. The use of properties allows us to have properties that mark pages as equipment ([[Property:Is equipment|Is equipment::True]]), and to say that the equipment is located in a particular facility ([[Property:Is located in facility|Is Located in facility::Machine Shop]]), and to indicated that the equipment is used in a particular domain ([[Property:Is used in domain|Is used in domain::Metal]]). The use of properties rather than page structure gives us tremendous flexibility in expanding to future groupings. Imagine that we might want to see all equipment that is used on Wood that is located in the Machine Shop or the Wood Shop. This can be easily generated with a query.  
+
The value in this particular setup is that when a new facility is added to the space, it will automatically show up in this list. Now, one might argue that facilities are not going to show up at frequent intervals, and this is true. However, we can extend this practice to create new lists, and [[Equipment]] is one of the major ones. The use of properties allows us to have properties that mark pages as equipment ([[Property:Is equipment|Is equipment::True]]), and to say that the equipment is located in a particular facility ([[Property:Is located in facility|Is Located in facility::Machine Shop]]), and to indicate that the equipment is used in a particular domain ([[Property:Is used in domain|Is used in domain::Metal]]). The use of properties rather than page structure gives us tremendous flexibility in expanding to future groupings. Imagine that we might want to see all equipment that is used on Wood that is located in the Machine Shop or the Wood Shop. This can be easily generated with a query.  
    
One important point for some of the more sophisticated uses on this Wiki (e.g. templates, properties, etc.) - you might not see their effect on other pages until you refresh those pages using the More->Refresh tab at the top of the wiki. This is because a lot of the elements are cached, and a simple refresh on the browser won't necessarily refresh the cache.  
 
One important point for some of the more sophisticated uses on this Wiki (e.g. templates, properties, etc.) - you might not see their effect on other pages until you refresh those pages using the More->Refresh tab at the top of the wiki. This is because a lot of the elements are cached, and a simple refresh on the browser won't necessarily refresh the cache.  
Line 45: Line 45:  
===Creating New Properties===
 
===Creating New Properties===
   −
To create a new property, assign it on a page using standard Property Syntax. This can be done [https://www.semantic-mediawiki.org/wiki/Help:Properties_and_types inline], but most often in this wiki, you will see the [https://www.semantic-mediawiki.org/wiki/Help:Setting_values set] directive used.  
+
To create a new property, assign it on a page using standard Property Syntax. This can be done [https://www.semantic-mediawiki.org/wiki/Help:Properties_and_types inline], but most often in this wiki you will see the [https://www.semantic-mediawiki.org/wiki/Help:Setting_values set] directive used.  
    
  <nowiki> {{#set:
 
  <nowiki> {{#set:
Line 54: Line 54:  
When you have saved this property, reference the [https://www.semantic-mediawiki.org/wiki/Help:Factbox Factbox] located at the bottom of the screen. If this is not visible, insert the line  
 
When you have saved this property, reference the [https://www.semantic-mediawiki.org/wiki/Help:Factbox Factbox] located at the bottom of the screen. If this is not visible, insert the line  
 
  <nowiki> __SHOWFACTBOX__ </nowiki>
 
  <nowiki> __SHOWFACTBOX__ </nowiki>
at the bottom of the wiki page. Remember to remove this line when you have completed it. This will show you the properties created on this page and their values. You can click on the links to the new properties to open their wiki pages. Conversely, you could simply navigate to Property:Property_1_Name in the Wiki if that is easier (and skip the whole factbox thing - but - I like to see the values). On the property page, you will want to declare the property [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes dataype]. The default type is Page, but it is still useful to set this. You can see the datatypes specified or our properties in the table above. It is a good idea to look at the Wiki markup on these pages and copy it from a similar property.  
+
at the bottom of the wiki page. Remember to remove this line when you have completed it. This will show you the properties created on this page and their values. You can click on the links to the new properties to open their wiki pages. Conversely, you could simply navigate to Property:Property_1_Name in the Wiki if that is easier (and skip the whole factbox thing - but - I like to see the values). On the property page you will want to declare the property [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes dataype]. The default type is Page, but it is still useful to set this. You can see the datatypes specified or our properties in the table above. It is a good idea to look at the Wiki markup on these pages and copy it from a similar property.  
   −
Also - in the sidebar of the Wiki, there is a ''Browse properties'' link that shows the properties of the Page. This has some useful information as well.
+
Also, in the sidebar of the Wiki, there is a ''Browse properties'' link that shows the properties of the Page. This has some useful information as well.
    
===Restricting Property Values===
 
===Restricting Property Values===
Line 67: Line 67:  
  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>
 
  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 unordered lists. But if you view the source, you will see something like the following (from [[MediaWiki:Smw_allows_list_Domains]]):
+
However, you 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 unordered lists. But if you view the source, you will see something like the following (from [[MediaWiki:Smw_allows_list_Domains]]):
 
  <nowiki>{{#ask: [[Is domain::True]]
 
  <nowiki>{{#ask: [[Is domain::True]]
 
  |format=template
 
  |format=template
Line 74: Line 74:  
}} </nowiki>
 
}} </nowiki>
   −
This autogenerates the correct ordered list for everything marked [[Property:Is domain]]. One might think that using the |format=ul would create the appropriate unordered list format (with the * in front), but it apparently does not. Therefore, this query removes the page link (link=none) and reduces the entry to simple text, and then it uses the template [[Template:Starlist_for_allow_value_list]] to render the text with a * in front of it (''See [https://www.mediawiki.org/wiki/Help:Templates help on templates] for an explanation of templates''). This works well.  
+
This autogenerates the correct ordered list for everything marked [[Property:Is domain]]. One might think that using the |format=ul would create the appropriate unordered list format (with the * in front), but it does not. Therefore, this query removes the page link (link=none) and reduces the entry to simple text, and then it uses the template [[Template:Starlist_for_allow_value_list]] to render the text with a * in front of it (''See [https://www.mediawiki.org/wiki/Help:Templates help on templates] for an explanation of templates''). This works well.  
   −
If, for some reason, you do enter a value that is not on the allowed list of values, the page will render a small warning icon like this: [[File:small_warning_icon.png|12px|Small Warning Icon]]..
+
If for some reason you do enter a value that is not on the allowed list of values, the page will render a small warning icon like this: [[File:small_warning_icon.png|12px|Small Warning Icon]]..
    
There are some other lurking gotchas that can show up. The default list size is 50. This can be set by $smwgQDefaultLimit in the CustomSettings.php file (on the server, not the wiki). I have asked to have this changed - but you would need to check to see what the actual value is. This can be overridden on a case by case basis by using the limit=100 (or limit=500) or whatever value you want - as one of the parameters in the ask wiki. So - wherever you ask for something like equipment, you certainly want more than 50. Likely the same for software. This showed up in the ask section for [[MediaWiki:Smw_allows_list_Equipment]]. This "ask" has been changed to have a limit of 500.
 
There are some other lurking gotchas that can show up. The default list size is 50. This can be set by $smwgQDefaultLimit in the CustomSettings.php file (on the server, not the wiki). I have asked to have this changed - but you would need to check to see what the actual value is. This can be overridden on a case by case basis by using the limit=100 (or limit=500) or whatever value you want - as one of the parameters in the ask wiki. So - wherever you ask for something like equipment, you certainly want more than 50. Likely the same for software. This showed up in the ask section for [[MediaWiki:Smw_allows_list_Equipment]]. This "ask" has been changed to have a limit of 500.
70

edits

Navigation menu