Template talk:Married cousin test

Explanation: for each query expression, the item in brackets returns a set. EG: children:: returns a list. of people that have Pagename appear in any of their children properties (children-s1, s2, etc.).
 * says, in what person's children field does Fernando, Duke of Viseu (1433-1470) appear? could be two, but answer is:   Note that the mother did not redundantly store him in her children list, so we aren't seeing her here.
 * Nest step, when we do a children:: of that list, we would be asking for a the parents in which Edward of portugal appears as in any of their children properties. Note that if the mother of Fernando appeared, that her parents' parents would be produced as well.  So you can think of the children:: check as operating on each item of the list, however long.  This in turn yields a list.  The final step is to do an interection between this list and that of the spouse.


 * Clear as mud? take apart the query and see for yourself how it works.  everything in q's is the same as an #ask.  So take the grandparents of spouse list.  Using Fernando, Duke of Viseu (1433-1470)
 * spouse::
 * Answer =
 * children:: [[spouse:: ]]
 * That is, person(s) from query above, Beatriz, appears in the children lists of whom?
 * Answer=
 * children:: [[children:: [[spouse:: ]] ]]
 * Now we do the same operation, getting the parents who have these person(s) appearing in their children list. Answer could be a list of four individuals, but in this case, we only have one.
 * Answer:

This list of potentially 4 grandparents of the spouse is then AND'd with the person's grandparents from the first bracketted expression. The interesection of the sets is Phillipa.


 * Note in this code that it is ambiguous what "children" means. It is very clear what children or father means from the perspective of coding info pages or SMW pages.  However, from the perspective of queries, most people would read children::Fernando and think it means children of Fernando.  Actually the query would be clearer if it read "has child::Fernando".  Similarly, the father field would be renamed to has father.

This is why the naming of these properties may get a little longer in order to avoid such confusing situations. It is common practice in other semantic mediawiki, and I thought at first we could avoid what appeared to be a somewhat prolix/pendantic naming convention. But it appears they may have good reason for the practice. - ~  Ph l o x  08:36, 17 May 2009 (UTC)