## [Semediawiki-user] Ternary relationship

 [Semediawiki-user] Ternary relationship From: pipi - 2008-08-28 20:16:33 ```Hy list! First of all: I'm new in SMW, and sorry about my English. I think I see the main concept of SMW. If I have a wiki page about Germany, and about Berlin too, then I can tell the wiki a relationship between this two things with this code (in Germany page) [[capital::Berlin]], (and in Berlin page too: [[capital of::Germany]]). But imagine the next: I don't have a Berlin page (I have a general Capital page), but I need an information in Germany page about the population of capital (and in all other countries pages). The Capital page has a Property (population), but the Country-Capital relationship has an exact value. In subject I wrote "ternary relationship", because I have an Object (Country), a Part (Capital) and a Property (population) and these three things together have a value. How can I do this with SMW? (I can imagine a solution: I have Countries, and all of coutries have a capital_population property, but if there is a better idea I don't want use it) Thanks! ```

 [Semediawiki-user] Ternary relationship From: pipi - 2008-08-28 20:16:33 ```Hy list! First of all: I'm new in SMW, and sorry about my English. I think I see the main concept of SMW. If I have a wiki page about Germany, and about Berlin too, then I can tell the wiki a relationship between this two things with this code (in Germany page) [[capital::Berlin]], (and in Berlin page too: [[capital of::Germany]]). But imagine the next: I don't have a Berlin page (I have a general Capital page), but I need an information in Germany page about the population of capital (and in all other countries pages). The Capital page has a Property (population), but the Country-Capital relationship has an exact value. In subject I wrote "ternary relationship", because I have an Object (Country), a Part (Capital) and a Property (population) and these three things together have a value. How can I do this with SMW? (I can imagine a solution: I have Countries, and all of coutries have a capital_population property, but if there is a better idea I don't want use it) Thanks! ```
 Re: [Semediawiki-user] Ternary relationship From: S Page - 2008-09-02 06:42:14 ```pipi wrote: > First of all: I'm new in SMW, and sorry about my English. Welcome to Semantic MediaWiki, your English is better than most USA school graduates ;-) > I think I see the main concept of SMW. If I have a wiki page about > Germany, and about Berlin too, then I can tell the wiki a relationship > between this two things with this code (in Germany page) > [[capital::Berlin]], (and in Berlin page too: [[capital of::Germany]]). > > But imagine the next: I don't have a Berlin page (I have a general > Capital page), but I need an information in Germany page about the > population of capital (and in all other countries pages). The Capital > page has a Property (population), That doesn't make sense. A general capital page doesn't have a value for its population. SMW lets you make statements about pages, it's not so oriented to make meta-statements like "Countries have capitals that have a population" that you can somehow "fill in" (though see template:country and form:country discussion below). > but the Country-Capital relationship > has an exact value. [for population] Yes, if you make a wiki page for the capital. The subject of a statement in SMW is **always** the wiki page where you make the annotation. > In subject I wrote "ternary relationship", because I have an Object > (Country), a Part (Capital) and a Property (population) and these three > things together have a value. > > How can I do this with SMW? (I can imagine a solution: I have Countries, > and all of coutries have a capital_population property, but if there is > a better idea I don't want use it) 1) Yes, giving each country [[Property:capital_population]] is fine. You're avoiding a capital page and a property relating it to the country by "overloading" the property name. The most common way you "say" countries have a capital_population property is to use a MediaWiki template {{country|capital_population=1000|population=60000| ... }} and/or a Semantic Forms "Form:Country". 2) You could sort-of get your "part" idea by creating sub-pages. "Germany/capital" could have a population, but "Germany/people_unemployed" and "Germany/PhD_candidates_in_ontology" could also have populations. You're still making pages but you don't have to explain the relationship to the Germany page -- you're avoiding the relationship property by "overloading" the page title. Unfortunately SMW doesn't have explicit support for identifying sub-pages. (There are other extensions for this but I don't know how well they play with SMW.) I was hoping you could enable the ~ "like" comparator in SMW to query for subpages named [[~Germany/*]] , but I'm pretty confident SMW don't do that, see ;. So you'd still have to add [[part of::Germany]] to each of these subpages, so you might as well explain what the relationship of each is using [[is capital of::Germany]]. 3) You could try using many-valued properties to fake ternary relationships, but it doesn't make much sense to me in your example. -- =S Page ```