Release status: experimental
|Implementation||Extended syntax, Parser function|
|Description||Adds a new syntax for short inline queries with the purpose of reducing redundant declaration of information within the wiki.|
|Author(s)||Daniel Werner (Danwetalk)|
|Latest version||0.3.0-alpha (2017-07-28)|
|MediaWiki||MW 1.23+, SMW (tested with 1.7alpha and 1.8 alpha)|
|License||GNU General Public License 3.0 or later|
Translate the Semantic Expressiveness extension if it is available at translatewiki.net
|Check usage and version matrix.|
Semantic Expressiveness is an enhancement for Semantic MediaWiki. Its main feature is to introduce a new syntax for inline short queries. The purpose of this simplest form of inline query is to provide a powerful tool for fighting redundancies within the wiki. Without Semantic Expressiveness it is customary to declare properties in one place but using the same information again all over the same article or on other pages as simple text representation. With Semantic Expressiveness it is possible to use simple references in form of a new syntax to place the same information in various places without writing redundant information. This way if the property changes, the information will update itself all over the wiki wherever the new syntax is in place.
Inline Short Query Syntax
The inline short query syntax is quite similar to Semantic MediaWikis show parser function. It displays one property value of the article its defined on or of another article. The simplest variant of it would be just
<?Name> which would simple print the value of the property called
Name defined on the same page. To print the property of another page
<?Name::Page> can be used. In case the property is not declared on the target page, this syntax will print an abstract text communicating what information it represents.
It is possible to use the syntax in a nested way like
<?Name::Father::Father::Little Boy> or alternatively
<?Name::<?Father::<?Father::Little Boy>>>. Considering
Little Boy is a page representing a human and it has a property
Father of type Page which refers to another page which also represents a human and has the same property, this will print the name of the Little Boys grandfather.
It will be possible to query the property of a page referred to by a property of the type Page defined on the current page.
Usage Within Template Parameters
The syntax is being parsed after parser functions and templates. It respects special MediaWiki constructs such as comments, nowiki, includeonly, noinclude and pre. Therefore when used as template parameter provided data, the template will not receive the short queries result but the syntax itself. If the template doesn't intend to further process the value and the author would not expect the template to process the result, the template can still return text with the original parameter input holding the short query syntax and at a later state of the parser process it will be replaced with its actual result.
If on the other hand it is expected that the template should work with the short queries result, this will only work by using the Semantic Expressiveness parser function
?to?! on the provided parameter value. The parser function will then trigger an early parsing of the syntax and can return the result in various different formats, most notably as plain text without any abstract value in case of failure, so the template can carry on with processing the information.
?to?! Parser Function
TBD - The name of this function will probably change
|First parameter has to be the input text.||any string|
||The actual output format. if this is set to
||Explicitly defines which expressive string pieces should be recognizedby the function||
||Explicitly defines which expressive string pieces should not be recognized by the function|
||This is the group option for the following ones. If it is set to yes the output will contain all possible sort of informational output such as links, error messages and additional markup. The following parameter values can overwrite this behavior in detail if they aren't set to auto.||
||Whether or not to link some information within the found pieces in the output||
||Whether or not to display error messages if there are any available for some piece.||
||Whether or not to display abstract information for expressive piece which can't be resolved.||
Early Extension State
Although this is just an early release, the very concept of this has proven helpful for quite some time already. This has started as part of Daniel Werners RPG-Dev-Wiki project until he decided to release some of the features in a proper extension.
Although the main functionality works, there is still a lot of polishing and bug fixing to do until this can be used in a productive environment. Also, parts of the concept and syntax might change, if anyone has thoughts on this, don't hesitate to use the talk page or contact the author.
Once you have downloaded the code, place the SemanticExpressiveness directory within your MediaWiki extensions directory. Then add the following code near the bottom of your LocalSettings.php file:
# Semantic Expressiveness require_once( "$IP/extensions/SemanticExpressiveness/SemanticExpressiveness.php" );