namespace pm = "http://www.politicalmashup.nl"
namespace pmd = "http://www.politicalmashup.nl/docinfo"

include "include/toolbox.rnc"
include "include/pmstructure.rnc"

# Schema to describe a politician (member of parliament)
# A politician needs to have at least an Id, a Name, and a party Membership.
# Also try to provide at least one link to an open data source, such as wikipedia.
# A Membership element needs to provide at least what it was a member of in attribute Body.
#
# Specific for Dutch data:
# if Body is government, then the membership-period describes the duration of the legislative-session.
# if Body is commons/senate, the membership-period describes the duration of the actual seating in the respective house.

Content = Member

Member = element pm:member { MemberContent }

MemberContent = 
    Source?
    & Id
    & DcRelation?                   # If there is another member document covering the same member, then declare that relationship in an owl:sameAs element here
    & Name                          # The preferred spelling of the party name 
    & AlternativeNames?             # Alternative spelling variations including acronyms and OCR (mis)spellings
    & Personal?                     # Personal information such as gender and life-philosophy (available for some Dutch politicians).
    & Links?                        # Links to wikipedia, party website, etc.
    & Biographies?                  # A biography in text
    & Curriculum?                   # Within Curriculum a distinction is made between education, official functions, and extra-curricular (other).  
    & Memberships?                   # Memberships of parliament (commons), senate, and government

Personal = element pm:personal {PersonalContent}

PersonalContent =
    Source?
    & element pm:born {DateContent? & Place?}?
    & element pm:deceased {DateContent? & Place?}?
    & element pm:gender { GenderType }?
    & element pm:life-philosophy {text}?

Biographies = element pm:biographies {BiographiesContent}

BiographiesContent = 
    Source?
    & element pm:biography {BiographyContent}

BiographyContent = 
    Source?
    & text

Curriculum = element pm:curriculum {CurriculumContent}

CurriculumContent = 
    Source?
    & element pm:education {CurriculumItemContent} *
    & element pm:function {CurriculumItemContent} *
    & element pm:extra-curricular {CurriculumItemContent} *
                     
CurriculumItemContent = 
    Source?
    & Name # function title or school type
    & Role?
    & Type? # Typically, if role =other, we do still know what type of function it is.
    & AlternativeNames?
    & Period?
    & Extra*  

# Additional information that is known, but has no real value apart from being knowledge. E.g. School name, company name, charity name, etc.
Extra =
    element pm:extra { ExtraContent }
    
ExtraContent =
    Type,
    text

Memberships = element pm:memberships {MembershipsContent}

MembershipsContent = 
    Source?
    & Membership+

Membership = element pm:membership {MembershipContent}

# Some memberships (e.g. uk) require explicit id's
MembershipId = attribute pm:membership-id { text }

MembershipContent = 
    Source?
    & Body
    & MembershipId? 
    & PartyRef?
    & PartyName? # e.g. if there is no PartyRef, it may say 'partijloos' or '-'
    & District? 
    & LegislativeSession?
    & Name? # function title, e.g. 'Prime Minister'  
    & AlternativeNames?
    & Period? # Arjan: Period is not always available in memberships (e.g. with old government types)
    & text