Материал из wiki
Перейти к: навигация, поиск

Germany is a country located in Europe.

Inverse relationships

The sample pages use Property:Located in, for example the Berlin article states the fact located in::Germany. If you want to also show this information here in the article for the object of the relationship, there are several ways to do this:

  • Special:Browse (the "eye" symbol in the factbox below) shows a page's object relationships.
  • You can query for all things located in Germany, using a query like the following. (Using the MediaWiki variables PAGENAME/FULLPAGENAME for the current pagename/pagename-with-namespace makes the query generic.)
  [[Located in::{{FULLPAGENAME}}]]
  | intro=Things located in {{PAGENAME}}:_ 
  | link=all

Result: Things located in Germany: Город1, Город2

  • You could create the inverse property Location of and annotate pages with this. Semantic MediaWiki does not internally support inverse relationships, so it is up to you to keep the two properties in sync. One way to do this is to use an inline query that outputs the wiki text for the semantic annotation of the inverse property, so it would put the wiki text [[Location of::Berlin]], [[Location of::Hannover]], etc. on this page. The help documentation provides an inline query whose output you can paste in. Embedding it within a property page is complicated and requires nested templates, see California.

«Transitive» relationships

Some pages may not directly state that they are located in Germany, and only state they are located somewhere that in turn is located in Germany. To find things located in things located in Germany, you have to nest a subquery:

Note that this does of course not realise true transitivity, but only a limited number of steps along the property «located in».

Economic data

YearGDP (nominal) (in millions of US$)

(Source: Figures indicate IMF staff estimates see

Факты: Germany
Has titleGermany +
Located inEurope +
Содержит субобъект
"Содержит субобъект" is a predefined property representing a container construct that allows to accumulate property-value assignments similar to that of a normal wiki page and is provided by Semantic MediaWiki.
Germany#IMF-2010 +, Germany#IMF-2011 + и Germany#IMF-2012 +