Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki Kostenlos Bücher Online Lesen
Autoren: Yaron Koren
Vom Netzwerk:
date::>{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}]]
|mainlabel=-
|?Has date
|format=ul
}}
    (“CURRENTYEAR”, “CURRENTMONTH” and “CURRENTDAY” are all pre-defined variables within MediaWiki. There are various ways to encode the current date within queries, but this is the most standard one.)

Refreshing data
    On rare occasions, it can be helpful to refresh all of Semantic MediaWiki’s data. Usually, the data stored accurately reflects the contents of the wiki’s pages; and when a template is re-saved, all the pages that call that template automatically get their semantic data refreshed, so changes to the data structure don’t require any additional action. However, there are times when a mass refresh is useful. One case is when some of the semantic values are calculated, instead of being retrieved directly from the page, like if values are themselves the results of queries. Another case is if something went wrong during the initial storage.
    There are two ways to do a mass refresh of a wiki’s SMW data. The first is to press the button “Start updating data” in the page Special:SMWAdmin.
    The second is to call the script “SMW_refreshData.php”, located in SMW’s /maintenance directory. There are various parameters for this script; you can see the full list of options here:
https://semantic-mediawiki.org/wiki/Help:Repairing_SMW%27s_data
    Finally, you can do a refresh of the semantic data stored for any one page using the SemanticUpdateOnPurge extension; see here .

17  Semantic Forms
    Though there are many extensions that make use of Semantic MediaWiki, Semantic Forms is the most widely-used. It provides a way to edit template calls within a page, where the templates are expected to in turn use Semantic MediaWiki to store their values. It thus complements SMW, by providing a structure for SMW’s storage capabilities.
    This chapter begins with an explanation of how (and why) SMW and templates are used in conjunction, and then gives an in-depth listing of Semantic Forms’ syntax and features.

A template-based approach to SMW
    We covered templates here , and Semantic MediaWiki in the previous chapter. Both are quite useful on their own; but it’s when the two are used together that the full power of both emerges. Templates without a storage system like SMW can provide structure to pages, and a nice standard display, but all that data stored within their fields just goes to waste: you can’t use or display it anywhere outside that page. Meanwhile, Semantic MediaWiki, when used by itself and outside of a structure like templates, is interesting but not very practical.
    This is the naive approach to using SMW tags — to intersperse them among free text, like:
Bob works in [[Has department::Accounting]].
    But there are a number of problems with this approach. Most obviously, it requires people to learn and understand a new syntax. The tag syntax is another bit of wikitext that users have to understand, even when they don’t plan to edit anything related to semantic properties. But more importantly, there’s lots of ambiguity about the actual data in question. What if Bob moves to a different department — is it enough to change the department name, or should there also be a property like “Had department”, pointing to the old value? And is there specific naming that should be used for each department? You could have software that provides autocompletion for semantic properties and their values, but it still won’t resolve all of the ambiguity. The main confusion springs from the fact that users can’t inherently know what the correct “data structure” should be for each page — the ideal set of semantic properties, and the expected value or values there should be for each. A template implicitly defines these things. Without a template, there is no easy way to define, or to clarify to users, which properties should be used and which shouldn’t. But a template serves as both the definition and the container for a data structure.
    There’s another benefit to using templates: they can also set the relevant category or categories for a page. For MediaWiki installations that don’t use Semantic MediaWiki, categories can end up getting used for a large variety of purposes (see here ). In SMW, the number of categories tends to be much smaller, but categories are still used to define a page’s type: whether a page represents a person, department, movie, fish, etc. A template can add

Weitere Kostenlose Bücher