Exemplo n.º 1
0
 private void generateIncumbencyMemberAndCommittee(Incumbency mnisIncumbency, XElement elementMemberCommittee)
 {
     string memberId = elementMemberCommittee.Parent.Element(d + "Member_Id").GetText();
     if (string.IsNullOrWhiteSpace(memberId) == false)
     {
         Uri memberUri = IdRetrieval.GetSubject("memberMnisId", memberId, false, logger);
         mnisIncumbency.IncumbencyHasPerson = new Person()
         {
             Id = memberUri
         };
     }
     string committeeId = elementMemberCommittee.Parent.Element(d + "Committee_Id").GetText();
     if (string.IsNullOrWhiteSpace(committeeId) == false)
     {
         string positionCommand = @"
             construct {
                 ?position a parl:FormalBodyChair.
             }
             where {
                 ?position parl:formalBodyChairHasFormalBody ?committee.
                 ?committee parl:formalBodyMnisId @formalBodyMnisId.
             }";
         SparqlParameterizedString positionSparql = new SparqlParameterizedString(positionCommand);
         positionSparql.Namespaces.AddNamespace("parl", new Uri(schemaNamespace));
         positionSparql.SetLiteral("formalBodyMnisId", committeeId);
         Uri positionUri = IdRetrieval.GetSubject(positionSparql.ToString(), false, logger);
         if (positionUri != null)
             mnisIncumbency.IncumbencyHasPosition = new Position()
             {
                 Id = positionUri
             };
     }
 }
Exemplo n.º 2
0
        public override BaseResource[] TransformSource(XDocument doc)
        {
            Incumbency mnisIncumbency = new Incumbency();
            XElement element = doc.Descendants(d + "MemberCommitteeChair_Id").SingleOrDefault();
            if ((element == null) || (element.Parent == null))
                return null;

            XElement elementIncumbency = element.Parent;

            mnisIncumbency.FormalBodyChairIncumbencyMnisId = elementIncumbency.Element(d + "MemberCommitteeChair_Id").GetText();
            mnisIncumbency.IncumbencyStartDate = elementIncumbency.Element(d + "StartDate").GetDate();

            XElement elementMemberCommittee = doc.Descendants(d + "Member_Id").SingleOrDefault();
            if (elementMemberCommittee != null)
                generateIncumbencyMemberAndCommittee(mnisIncumbency, elementMemberCommittee);

            mnisIncumbency.IncumbencyEndDate = elementIncumbency.Element(d + "EndDate").GetDate();

            return new BaseResource[] { mnisIncumbency };
        }
Exemplo n.º 3
0
        public override BaseResource[] TransformSource(XDocument doc)
        {
            XElement governmentIncumbencyElement = doc.Element(atom + "entry")
                                                   .Element(atom + "content")
                                                   .Element(m + "properties");

            Incumbency incumbency = new Incumbency();

            incumbency.GovernmentIncumbencyMnisId = governmentIncumbencyElement.Element(d + "MemberGovernmentPost_Id").GetText();
            incumbency.IncumbencyStartDate        = governmentIncumbencyElement.Element(d + "StartDate").GetDate();
            string governmentPostMnisId = governmentIncumbencyElement.Element(d + "GovernmentPost_Id").GetText();
            Uri    governmentPostUri    = IdRetrieval.GetSubject("governmentPositionMnisId", governmentPostMnisId, false, logger);

            if (governmentPostUri == null)
            {
                logger.Warning($"No government position found for {governmentPostMnisId}");
                return(null);
            }
            incumbency.GovernmentIncumbencyHasGovernmentPosition = new GovernmentPosition()
            {
                Id = governmentPostUri
            };
            string memberId  = governmentIncumbencyElement.Element(d + "Member_Id").GetText();
            Uri    memberUri = IdRetrieval.GetSubject("memberMnisId", memberId, false, logger);

            if (memberUri == null)
            {
                logger.Warning($"No member found for {memberId}");
                return(null);
            }
            incumbency.GovernmentIncumbencyHasGovernmentPerson = new GovernmentPerson()
            {
                Id = memberUri
            };
            incumbency.IncumbencyEndDate = governmentIncumbencyElement.Element(d + "EndDate").GetDate();

            return(new BaseResource[] { incumbency });
        }
Exemplo n.º 4
0
        public override BaseResource[] TransformSource(XDocument doc)
        {
            XElement oppositionIncumbencyElement = doc.Element(atom + "entry")
                                                   .Element(atom + "content")
                                                   .Element(m + "properties");

            Incumbency oppositionIncumbency = new Incumbency();

            oppositionIncumbency.OppositionIncumbencyMnisId = oppositionIncumbencyElement.Element(d + "MemberOppositionPost_Id").GetText();
            oppositionIncumbency.IncumbencyStartDate        = oppositionIncumbencyElement.Element(d + "StartDate").GetDate();
            string oppositionPositionMnisId = oppositionIncumbencyElement.Element(d + "OppositionPost_Id").GetText();
            Uri    oppositionPostUri        = IdRetrieval.GetSubject("oppositionPositionMnisId", oppositionPositionMnisId, false, logger);

            if (oppositionPostUri == null)
            {
                logger.Warning($"No opposition position found for {oppositionPositionMnisId}");
                return(null);
            }
            oppositionIncumbency.OppositionIncumbencyHasOppositionPosition = new OppositionPosition()
            {
                Id = oppositionPostUri
            };
            string memberId  = oppositionIncumbencyElement.Element(d + "Member_Id").GetText();
            Uri    memberUri = IdRetrieval.GetSubject("memberMnisId", memberId, false, logger);

            if (memberUri == null)
            {
                logger.Warning($"No member found for {memberId}");
                return(null);
            }
            oppositionIncumbency.OppositionIncumbencyHasOppositionPerson = new OppositionPerson()
            {
                Id = memberUri
            };
            oppositionIncumbency.IncumbencyEndDate = oppositionIncumbencyElement.Element(d + "EndDate").GetDate();

            return(new BaseResource[] { oppositionIncumbency, });
        }