Example #1
0
 public Roles(
     CommonDomainObjects commonDomainObjects
     ) : base(
         "Roles",
         commonDomainObjects)
 {
     Role = this.DeclareClass <Role>();
     Role.SubClassOf(commonDomainObjects.Named);
 }
Example #2
0
 public Organisations(
     CommonDomainObjects commonDomainObjects
     ) : base(
         "Organisations",
         commonDomainObjects)
 {
     Organisation = this.DeclareClass <Organisation>();
     Organisation.SubClassOf(commonDomainObjects.Named);
 }
Example #3
0
 public Parties(
     CommonDomainObjects commonDomainObjects
     ) : base(
         "Parties",
         commonDomainObjects)
 {
     PartyInRole = this.DeclareClass <PartyInRole>();
     PartyInRole.SubClassOf(commonDomainObjects.DomainObject);
     Role         = PartyInRole.DeclareObjectProperty <PartyInRole, Role>(partyInRole => partyInRole.Role);
     Organisation = PartyInRole.DeclareObjectProperty <PartyInRole, Organisation>(partyInRole => partyInRole.Organisation);
     Person       = PartyInRole.DeclareObjectProperty <PartyInRole, Person>(partyInRole => partyInRole.Person);
 }
Example #4
0
        public void OneTimeSetUp()
        {
            var builder = new ContainerBuilder();

            builder
            .RegisterModule <OntologyModule>();

            _container = builder.Build();

            _commonDomainObjects = _container.Resolve <Deals.CommonDomainObjects>();
            _validation          = _container.Resolve <Deals.Validation>();
            _deals          = _container.Resolve <Deals.Deals>();
            _projectFinance = _container.Resolve <Deals.ProjectFinance>();
        }
Example #5
0
        public RoleIndividuals(
            CommonDomainObjects commonDomainObjects,
            Roles roles
            ) : base(
                "RoleIndividuals",
                commonDomainObjects,
                roles)
        {
            var role = roles.Role;
            var id   = commonDomainObjects.Id;

            Sponsor  = role.DeclareNamedIndividual("Sponsor");
            Borrower = role.DeclareNamedIndividual("Borrower");
            Lender   = role.DeclareNamedIndividual("Lender");
            Advisor  = role.DeclareNamedIndividual("Advisor");
            Sponsor.Value(id, DealRoleIdentifier.Sponsor);
            Borrower.Value(id, DealRoleIdentifier.Borrower);
            Lender.Value(id, DealRoleIdentifier.Lender);
            Advisor.Value(id, DealRoleIdentifier.Advisor);
        }
Example #6
0
        public ProjectFinance(
            CommonDomainObjects commonDomainObjects,
            Deals deals,
            Validation validation
            ) : base(
                "ProjectFinance",
                commonDomainObjects,
                deals,
                validation)
        {
            var dealType = deals.DealType.DeclareNamedIndividual("ProjectFinance");

            dealType.Value(
                commonDomainObjects.Id,
                DealTypeIdentifier.ProjectFinance);

            Deal = this.DeclareClass("Deal");
            Deal.SubClassOf(deals.Debt);
            Deal.SubClassOf(deals.Type.HasValue(dealType));
            Deal.SubClassOf(deals.Sponsors.MinCardinality(1))
            .Annotate(
                validation.Restriction,
                0);
        }
Example #7
0
        public Advisory(
            CommonDomainObjects commonDomainObjects,
            Validation validation,
            Deals deals
            ) : base(
                "Advisory",
                commonDomainObjects,
                validation,
                deals)
        {
            var dealType = deals.DealType.DeclareNamedIndividual("Advisory");

            dealType.Value(
                commonDomainObjects.Id,
                DealTypeIdentifier.Advisory);

            Deal = this.DeclareClass("Deal");
            Deal.SubClassOf(deals.Deal);
            Deal.SubClassOf(deals.Parties.ExactCardinality(1, deals.BankAdvisorParty));
            Deal.SubClassOf(deals.Sponsors.MaxCardinality(0))
            .Annotate(
                validation.Restriction,
                0);
        }
Example #8
0
        public Deals(
            CommonDomainObjects commonDomainObjects,
            Roles roles,
            RoleIndividuals roleIndividuals,
            LegalEntities legalEntities,
            Parties parties,
            Validation validation
            ) : base(
                "Deals",
                commonDomainObjects,
                roles,
                roleIndividuals,
                legalEntities,
                parties,
                validation)
        {
            DealType = this.DeclareClass <DealType>();
            DealType.SubClassOf(commonDomainObjects.Named);
            Deal = this.DeclareClass <Deal>();
            Deal.SubClassOf(commonDomainObjects.Named);
            Type        = Deal.DeclareObjectProperty <Deal, DealType>(deal => deal.Type);
            Parties     = Deal.DeclareObjectProperty <Deal, PartyInRole>(deal => deal.Parties);
            Classifiers = Deal.DeclareObjectProperty <Deal, Classifier>(deal => deal.Classifiers);
            Confers     = Deal.DeclareObjectProperty <Deal, Commitment>(deal => deal.Confers);
            Borrowers   = Deal.DeclareObjectProperty <Deal, PartyInRole>(
                "Borrowers",
                deal => deal.Parties.Where(dealParty => dealParty.Role.Id == DealRoleIdentifier.Borrower));
            Sponsors = Deal.DeclareObjectProperty <Deal, Sponsor>(
                "Sponsors",
                deal => deal.Parties.Where(dealParty => dealParty.Role.Id == DealRoleIdentifier.Sponsor).Cast <Sponsor>());
            this.Exclusivity = Deal.DeclareObjectProperty <Deal, ExclusivityClassifier>(
                "Exclusivity",
                deal => deal.Classifiers.OfType <ExclusivityClassifier>().FirstOrDefault());

            Deal.SubClassOf(
                new DataSomeValuesFrom(
                    commonDomainObjects.Name,
                    new DataComplementOf(new DataOneOf(string.Empty))))
            .Annotate(
                validation.Restriction,
                0);
            Deal.SubClassOf(this.Exclusivity.ExactCardinality(1))
            .Annotate(
                validation.Restriction,
                0);

            LenderParty   = this.DeclareClass("LenderParty");
            AdvisorParty  = this.DeclareClass("AdvisorParty");
            BorrowerParty = this.DeclareClass("BorrowerParty");
            SponsorParty  = this.DeclareClass("SponsorParty");

            LenderParty.SubClassOf(parties.PartyInRole);
            AdvisorParty.SubClassOf(parties.PartyInRole);
            BorrowerParty.SubClassOf(parties.PartyInRole);
            SponsorParty.SubClassOf(parties.PartyInRole);

            LenderParty.Define(parties.Role.HasValue(roleIndividuals.Lender));
            AdvisorParty.Define(parties.Role.HasValue(roleIndividuals.Advisor));
            BorrowerParty.Define(parties.Role.HasValue(roleIndividuals.Borrower));
            SponsorParty.Define(parties.Role.HasValue(roleIndividuals.Sponsor));;

            Sponsor = this.DeclareClass <Sponsor>();
            Sponsor.SubClassOf(SponsorParty);
            Equity = Sponsor.DeclareDataProperty <Sponsor, decimal?>(sponsor => sponsor.Equity);
            Sponsor
            .SubClassOf(Equity.ExactCardinality(1))
            .Annotate(
                validation.Restriction,
                0);

            Bank             = legalEntities.LegalEntity.DeclareNamedIndividual("Bank");
            BankParty        = this.DeclareClass("BankParty");
            BankLenderParty  = this.DeclareClass("BankLenderParty");
            BankAdvisorParty = this.DeclareClass("BankAdvisorParty");
            BankParty.Define(parties.Organisation.HasValue(Bank));
            BankLenderParty.Define(LenderParty.Intersect(BankParty));
            BankAdvisorParty.Define(AdvisorParty.Intersect(BankParty));

            BankParty.SubClassOf(parties.PartyInRole);

            KeyCounterpartyRole = this.DeclareClass("KeyCounterpartyRole");
            KeyCounterparty     = this.DeclareClass("KeyCounterparty");
            KeyCounterparty.SubClassOf(parties.PartyInRole);
            KeyCounterparty.Define(new ObjectSomeValuesFrom(parties.Role, KeyCounterpartyRole));

            Debt = this.DeclareClass("Debt");
            Debt.SubClassOf(Deal);
            Debt.SubClassOf(Parties.ExactCardinality(1, BankLenderParty));
            Debt.SubClassOf(Borrowers.MinCardinality(1))
            .Annotate(
                validation.Restriction,
                0);

            new DisjointClasses(
                this,
                Deal,
                DealType,
                parties.PartyInRole,
                commonDomainObjects.Classifier);

            var ExclusivityClassifier = this.DeclareClass <ExclusivityClassifier>();

            ExclusivityClassifier.SubClassOf(commonDomainObjects.Classifier);
            Deal.SubClassOf(Classifiers.ExactCardinality(1, ExclusivityClassifier))
            .Annotate(
                validation.Restriction,
                0)
            .Annotate(
                validation.SubPropertyName,
                "Exclusivity");

            var NotExclusive = ExclusivityClassifier.DeclareNamedIndividual("NotExclusive");

            NotExclusive.Value(commonDomainObjects.Id, ExclusivityClassifierIdentifier.No);
            var Exclusive = ExclusivityClassifier.Intersect(new ObjectOneOf(NotExclusive).Complement());

            var ExclusiveDeal = this.DeclareClass("ExclusiveDeal");

            ExclusiveDeal.SubClassOf(Deal);
            var intermediate = this.DeclareClass("Intermediate");

            intermediate.Define(new ObjectSomeValuesFrom(Classifiers, Exclusive));
            ExclusiveDeal.Define(new ObjectIntersectionOf(intermediate));

            var Exclusivity = this.DeclareClass <Exclusivity>();
            var Date        = Exclusivity.DeclareDataProperty <Exclusivity, DateTime?>(exclusivity => exclusivity.Date);

            Date.Range(ReservedVocabulary.DateTime)
            .Annotate(
                validation.RangeValidated,
                null);
        }