diff --git a/aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs b/aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs index c77cb80..60e672b 100644 --- a/aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs +++ b/aspnetcore/src/ApiModels/CodeList/FieldOfArt.cs @@ -5,6 +5,6 @@ /// /// http://uri.suomi.fi/codelist/research/Taiteenala /// -public class FieldOfArts : CodeList +public class FieldOfArt : CodeList { } \ No newline at end of file diff --git a/aspnetcore/src/ApiModels/Publication/Publication.cs b/aspnetcore/src/ApiModels/Publication/Publication.cs index f63ec50..1bf5bc8 100644 --- a/aspnetcore/src/ApiModels/Publication/Publication.cs +++ b/aspnetcore/src/ApiModels/Publication/Publication.cs @@ -192,6 +192,13 @@ public class Publication /// public List? FieldsOfEducation { get; set; } + /// + /// Field of art + /// + /// http://uri.suomi.fi/codelist/research/Taiteenala + /// + public FieldOfArt? FieldOfArt { get; set; } + /// /// Keywords /// @@ -257,13 +264,6 @@ public class Publication /// public License? License { get; set; } - /// - /// Field of art - /// - /// http://uri.suomi.fi/codelist/research/Taiteenala - /// - public List? FieldsOfArts { get; set; } - /// /// Art publications type category /// diff --git a/aspnetcore/src/DatabaseContext/ApiDbContext.cs b/aspnetcore/src/DatabaseContext/ApiDbContext.cs index 7b2615a..16e42e7 100644 --- a/aspnetcore/src/DatabaseContext/ApiDbContext.cs +++ b/aspnetcore/src/DatabaseContext/ApiDbContext.cs @@ -34,8 +34,6 @@ public ApiDbContext(DbContextOptions options) public virtual DbSet DimEvents { get; set; } = null!; public virtual DbSet DimExternalServices { get; set; } = null!; public virtual DbSet DimFieldDisplaySettings { get; set; } = null!; - public virtual DbSet DimFieldOfArts { get; set; } = null!; - public virtual DbSet DimFieldOfEducations { get; set; } = null!; public virtual DbSet DimFundingDecisions { get; set; } = null!; public virtual DbSet DimGeos { get; set; } = null!; public virtual DbSet DimIdentifierlessData { get; set; } = null!; @@ -1056,118 +1054,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity(entity => - { - entity.ToTable("dim_field_of_art"); - - entity.Property(e => e.Id).HasColumnName("id"); - - entity.Property(e => e.Created) - .HasColumnType("datetime") - .HasColumnName("created"); - - entity.Property(e => e.FieldId) - .HasMaxLength(255) - .HasColumnName("field_id"); - - entity.Property(e => e.Modified) - .HasColumnType("datetime") - .HasColumnName("modified"); - - entity.Property(e => e.NameEn) - .HasMaxLength(255) - .HasColumnName("name_en"); - - entity.Property(e => e.NameFi) - .HasMaxLength(255) - .HasColumnName("name_fi"); - - entity.Property(e => e.NameSv) - .HasMaxLength(255) - .HasColumnName("name_sv"); - - entity.Property(e => e.SourceDescription) - .HasMaxLength(255) - .HasColumnName("source_description"); - - entity.Property(e => e.SourceId) - .HasMaxLength(255) - .HasColumnName("source_id"); - - entity.HasMany(d => d.DimPublications) - .WithMany(p => p.DimFieldOfArts) - .UsingEntity>( - "BrFieldOfArtDimPublication", - l => l.HasOne().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o505394"), - r => r.HasOne().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o978876"), - j => - { - j.HasKey("DimFieldOfArtId", "DimPublicationId").HasName("PK__br_field__809A87CDC51CB6D5"); - - j.ToTable("br_field_of_art_dim_publication"); - - j.IndexerProperty("DimFieldOfArtId").HasColumnName("dim_field_of_art_id"); - - j.IndexerProperty("DimPublicationId").HasColumnName("dim_publication_id"); - }); - }); - - modelBuilder.Entity(entity => - { - entity.ToTable("dim_field_of_education"); - - entity.Property(e => e.Id).HasColumnName("id"); - - entity.Property(e => e.Created) - .HasColumnType("datetime") - .HasColumnName("created"); - - entity.Property(e => e.FieldId) - .HasMaxLength(255) - .HasColumnName("field_id"); - - entity.Property(e => e.Modified) - .HasColumnType("datetime") - .HasColumnName("modified"); - - entity.Property(e => e.NameEn) - .HasMaxLength(255) - .HasColumnName("name_en"); - - entity.Property(e => e.NameFi) - .HasMaxLength(255) - .HasColumnName("name_fi"); - - entity.Property(e => e.NameSv) - .HasMaxLength(255) - .HasColumnName("name_sv"); - - entity.Property(e => e.SourceDescription) - .HasMaxLength(255) - .HasColumnName("source_description"); - - entity.Property(e => e.SourceId) - .HasMaxLength(255) - .HasColumnName("source_id"); - - entity.HasMany(d => d.DimPublications) - .WithMany(p => p.DimFieldOfEducations) - .UsingEntity>( - "BrFieldOfEducationDimPublication", - l => l.HasOne().WithMany().HasForeignKey("DimPublicationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o449658"), - r => r.HasOne().WithMany().HasForeignKey("DimFieldOfEducationId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_field_o983513"), - j => - { - j.HasKey("DimFieldOfEducationId", "DimPublicationId").HasName("PK__br_field__6E377B2CD08233DA"); - - j.ToTable("br_field_of_education_dim_publication"); - - j.IndexerProperty("DimFieldOfEducationId").HasColumnName("dim_field_of_education_id"); - - j.IndexerProperty("DimPublicationId").HasColumnName("dim_publication_id"); - }); - }); - modelBuilder.Entity(entity => { entity.ToTable("dim_funding_decision"); @@ -1312,23 +1198,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FKdim_fundin974924"); - entity.HasMany(d => d.DimFieldOfArts) - .WithMany(p => p.DimFundingDecisions) - .UsingEntity>( - "BrFundingDecisionDimFieldOfArt", - l => l.HasOne().WithMany().HasForeignKey("DimFieldOfArtId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding154428"), - r => r.HasOne().WithMany().HasForeignKey("DimFundingDecisionId").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FKbr_funding281737"), - j => - { - j.HasKey("DimFundingDecisionId", "DimFieldOfArtId").HasName("PK__br_fundi__07CB586D2869F096"); - - j.ToTable("br_funding_decision_dim_field_of_art"); - - j.IndexerProperty("DimFundingDecisionId").HasColumnName("dim_funding_decision_id"); - - j.IndexerProperty("DimFieldOfArtId").HasColumnName("dim_field_of_art_id"); - }); - entity.HasMany(d => d.DimFundingDecisionFroms) .WithMany(p => p.DimFundingDecisionTos) .UsingEntity>( @@ -2949,6 +2818,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMaxLength(4000) .HasColumnName("doi_handle"); + entity.Property(e => e.FieldOfArtCode).HasColumnName("field_of_art_code"); + entity.Property(e => e.GovermentCollaboration).HasColumnName("goverment_collaboration"); entity.Property(e => e.HospitalDistrictCollaboration).HasColumnName("hospital_district_collaboration"); @@ -3104,6 +2975,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FKdim_public896887"); + entity.HasOne(d => d.FieldOfArtCodeNavigation) + .WithMany(p => p.DimPublicationFieldOfArtCodeNavigations) + .HasForeignKey(d => d.FieldOfArtCode) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("field_of_art_code"); + entity.HasOne(d => d.LanguageCodeNavigation) .WithMany(p => p.DimPublicationLanguageCodeNavigations) .HasForeignKey(d => d.LanguageCode) diff --git a/aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs b/aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs index 8ced0b5..949a124 100644 --- a/aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs +++ b/aspnetcore/src/DatabaseContext/Entities/DimFundingDecision.cs @@ -16,7 +16,6 @@ public DimFundingDecision() FactDimReferencedataFieldOfSciences = new HashSet(); FactFieldValues = new HashSet(); InverseDimFundingDecisionIdParentDecisionNavigation = new HashSet(); - DimFieldOfArts = new HashSet(); DimFundingDecisionFroms = new HashSet(); DimFundingDecisionFromsNavigation = new HashSet(); DimFundingDecisionTos = new HashSet(); @@ -75,7 +74,6 @@ public DimFundingDecision() public virtual ICollection FactFieldValues { get; set; } public virtual ICollection InverseDimFundingDecisionIdParentDecisionNavigation { get; set; } - public virtual ICollection DimFieldOfArts { get; set; } public virtual ICollection DimFundingDecisionFroms { get; set; } public virtual ICollection DimFundingDecisionFromsNavigation { get; set; } public virtual ICollection DimFundingDecisionTos { get; set; } diff --git a/aspnetcore/src/DatabaseContext/Entities/DimPublication.cs b/aspnetcore/src/DatabaseContext/Entities/DimPublication.cs index 26d2086..80ae98d 100644 --- a/aspnetcore/src/DatabaseContext/Entities/DimPublication.cs +++ b/aspnetcore/src/DatabaseContext/Entities/DimPublication.cs @@ -12,8 +12,6 @@ public DimPublication() FactContributions = new HashSet(); FactDimReferencedataFieldOfSciences = new HashSet(); FactFieldValues = new HashSet(); - DimFieldOfArts = new HashSet(); - DimFieldOfEducations = new HashSet(); DimKeywords = new HashSet(); DimReferencedata = new HashSet(); } @@ -77,9 +75,11 @@ public DimPublication() public string? OpenAccess { get; set; } public string? PublisherOpenAccessCode { get; set; } public string? Abstract { get; set; } + public int FieldOfArtCode { get; set; } public virtual DimReferencedatum? ArticleTypeCodeNavigation { get; set; } public virtual DimRegisteredDataSource DimRegisteredDataSource { get; set; } = null!; + public virtual DimReferencedatum FieldOfArtCodeNavigation { get; set; } = null!; public virtual DimReferencedatum LanguageCodeNavigation { get; set; } = null!; public virtual DimReferencedatum LicenseCodeNavigation { get; set; } = null!; public virtual DimReferencedatum? ParentPublicationTypeCodeNavigation { get; set; } @@ -94,8 +94,6 @@ public DimPublication() public virtual ICollection FactDimReferencedataFieldOfSciences { get; set; } public virtual ICollection FactFieldValues { get; set; } - public virtual ICollection DimFieldOfArts { get; set; } - public virtual ICollection DimFieldOfEducations { get; set; } public virtual ICollection DimKeywords { get; set; } public virtual ICollection DimReferencedata { get; set; } } diff --git a/aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs b/aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs index 82f0999..c9c40c3 100644 --- a/aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs +++ b/aspnetcore/src/DatabaseContext/Entities/DimReferencedatum.cs @@ -23,6 +23,7 @@ public DimReferencedatum() DimProfileOnlyPublicationThesisTypeCodeNavigations = new HashSet(); DimProfileOnlyPublicationTypeClassificationCodeNavigations = new HashSet(); DimPublicationArticleTypeCodeNavigations = new HashSet(); + DimPublicationFieldOfArtCodeNavigations = new HashSet(); DimPublicationLanguageCodeNavigations = new HashSet(); DimPublicationLicenseCodeNavigations = new HashSet(); DimPublicationParentPublicationTypeCodeNavigations = new HashSet(); @@ -76,6 +77,7 @@ public DimReferencedatum() public virtual ICollection DimProfileOnlyPublicationThesisTypeCodeNavigations { get; set; } public virtual ICollection DimProfileOnlyPublicationTypeClassificationCodeNavigations { get; set; } public virtual ICollection DimPublicationArticleTypeCodeNavigations { get; set; } + public virtual ICollection DimPublicationFieldOfArtCodeNavigations { get; set; } public virtual ICollection DimPublicationLanguageCodeNavigations { get; set; } public virtual ICollection DimPublicationLicenseCodeNavigations { get; set; } public virtual ICollection DimPublicationParentPublicationTypeCodeNavigations { get; set; } diff --git a/aspnetcore/src/Interface/Interface.csproj b/aspnetcore/src/Interface/Interface.csproj index d61b482..7d8ed7a 100644 --- a/aspnetcore/src/Interface/Interface.csproj +++ b/aspnetcore/src/Interface/Interface.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - fb1549e6-e7b1-45b6-91cb-dfebd31eadb8 + b73bde99-06bf-406c-8e60-eb475cb00acc Linux ..\..\src\Api ..\..\openshift\api\Dockerfile diff --git a/aspnetcore/src/Interface/Maps/PublicationProfile.cs b/aspnetcore/src/Interface/Maps/PublicationProfile.cs index cbf5b45..1094cb0 100644 --- a/aspnetcore/src/Interface/Maps/PublicationProfile.cs +++ b/aspnetcore/src/Interface/Maps/PublicationProfile.cs @@ -39,7 +39,7 @@ public PublicationProfile() CreateMap(); CreateMap(); CreateMap(); - CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/aspnetcore/src/Repositories/Maps/PublicationProfile.cs b/aspnetcore/src/Repositories/Maps/PublicationProfile.cs index 2af27f5..36243da 100644 --- a/aspnetcore/src/Repositories/Maps/PublicationProfile.cs +++ b/aspnetcore/src/Repositories/Maps/PublicationProfile.cs @@ -1,6 +1,7 @@ using CSC.PublicApi.DatabaseContext.Entities; using CSC.PublicApi.Service.Models; using CSC.PublicApi.Service.Models.Publication; +using Microsoft.Data.SqlClient; using FactContribution = CSC.PublicApi.Service.Models.Publication.FactContribution; using Name = CSC.PublicApi.Service.Models.Publication.Name; using Profile = AutoMapper.Profile; @@ -54,7 +55,7 @@ public PublicationProfile() .ForMember(dst => dst.Doi, opt => opt.MapFrom(src => src.Doi)) .ForMember(dst => dst.DoiHandle, opt => opt.MapFrom(src => src.DoiHandle)) .ForMember(dst => dst.FieldsOfScience, opt => opt.MapFrom(src => src.FactDimReferencedataFieldOfSciences.Select(f => f.DimReferencedata))) - .ForMember(dst => dst.FieldsOfEducation, opt => opt.MapFrom(src => src.DimFieldOfEducations)) + .ForMember(dst => dst.FieldOfArt, opt => opt.MapFrom(src => src.FieldOfArtCodeNavigation)) .ForMember(dst => dst.Keywords, opt => opt.MapFrom(src => src.DimKeywords)) .ForMember(dst => dst.InternationalPublication, opt => opt.MapFrom(src => src.InternationalPublication != 9 ? src.InternationalPublication == 1 : (bool?)null)) // 0 = kotim. 1 ulkom. 9 = ei tietoa. .ForMember(dst => dst.Country, opt => opt.MapFrom(src => src.PublicationCountryCodeNavigation)) @@ -67,7 +68,6 @@ public PublicationProfile() .ForMember(dst => dst.License, opt => opt.MapFrom(src => src.LicenseCodeNavigation.Id != -1 ? src.LicenseCodeNavigation : null)) .ForMember(dst => dst.Preprint, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == PreprintType))) .ForMember(dst => dst.SelfArchived, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == SelfArchivedType))) - .ForMember(dst => dst.FieldsOfArts, opt => opt.MapFrom(src => src.DimFieldOfArts)) .ForMember(dst => dst.ArtPublicationTypeCategory, opt => opt.MapFrom(src => src.DimReferencedata)) .ForMember(dst => dst.Abstract, opt => opt.MapFrom(src => src.Abstract)) .ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created)) diff --git a/aspnetcore/src/Service.Models/Publication/Publication.cs b/aspnetcore/src/Service.Models/Publication/Publication.cs index 6983f58..3bf58ee 100644 --- a/aspnetcore/src/Service.Models/Publication/Publication.cs +++ b/aspnetcore/src/Service.Models/Publication/Publication.cs @@ -172,6 +172,11 @@ public class Publication /// public List? FieldsOfEducation { get; set; } + /// + /// Taiteenala + /// + public ReferenceData? FieldOfArt { get; set; } + /// /// Avainsanat /// @@ -232,11 +237,6 @@ public class Publication /// public ReferenceData? License { get; set; } - /// - /// Taiteenala - /// - public List? FieldsOfArts { get; set; } - /// /// TaidealanTyyppiKategoria /// diff --git a/aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs b/aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs index 5d68d9e..908b663 100644 --- a/aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs +++ b/aspnetcore/test/Indexer.Tests/Maps/PublicationProfileTest.cs @@ -110,16 +110,6 @@ private static DimPublication GetEntity() JufoClassCode = "jufoClassCode", Doi = "doi", DoiHandle = "doiHandle", - DimFieldOfEducations = new List - { - new() - { - FieldId = "foeFieldId", - NameFi = "foeNameFi", - NameSv = "foeNameSv", - NameEn = "foeNameEn" - } - }, DimReferencedata = new List { new() @@ -258,16 +248,6 @@ private static DimPublication GetEntity() SelfArchivedType = "preprint" } }, - DimFieldOfArts = new List - { - new() - { - FieldId = "fieldOfArtsId", - NameFi = "fieldOfArtsNameFi", - NameSv = "fieldOfArtsNameSv", - NameEn = "fieldOfArtsNameEn" - } - }, Abstract = "abstract", Created = new DateTime(2023, 3, 10, 10, 43, 00), Modified = new DateTime(2023, 3, 10, 10, 44, 00) @@ -463,15 +443,12 @@ private Publication GetModel() EmbargoDate = new DateTime(2023, 3, 10, 10, 40, 00) } }, - FieldsOfArts = new List + FieldOfArt = new ReferenceData() { - new() - { - Code = "fieldOfArtsId", - NameFi = "fieldOfArtsNameFi", - NameSv = "fieldOfArtsNameSv", - NameEn = "fieldOfArtsNameEn" - } + Code = "123", + NameEn = "fieldOfArtCodeNameEn", + NameFi = "fieldOfArtCodeNameFi", + NameSv = "fieldOfArtCodeNameSv", }, Abstract = "abstract", ArtPublicationTypeCategory = new List diff --git a/aspnetcore/test/Interface.Tests/Maps/PublicationProfileTest.cs b/aspnetcore/test/Interface.Tests/Maps/PublicationProfileTest.cs index f32f5d1..095ac3d 100644 --- a/aspnetcore/test/Interface.Tests/Maps/PublicationProfileTest.cs +++ b/aspnetcore/test/Interface.Tests/Maps/PublicationProfileTest.cs @@ -283,15 +283,12 @@ private static object GetServiceModel() EmbargoDate = new DateTime(2023, 3, 10, 10, 40, 00) } }, - FieldsOfArts = new List + FieldOfArt = new ReferenceData { - new() - { Code = "fieldOfArtsId", NameFi = "fieldOfArtsNameFi", NameSv = "fieldOfArtsNameSv", NameEn = "fieldOfArtsNameEn" - } }, Abstract = "abstract", ArtPublicationTypeCategory = new List @@ -495,15 +492,12 @@ private static object GetApiModel() EmbargoDate = new DateTime(2023, 3, 10, 10, 40, 00) } }, - FieldsOfArts = new List + FieldOfArt = new FieldOfArt { - new() - { - Code = "fieldOfArtsId", - NameFi = "fieldOfArtsNameFi", - NameSv = "fieldOfArtsNameSv", - NameEn = "fieldOfArtsNameEn" - } + Code = "fieldOfArtsId", + NameFi = "fieldOfArtsNameFi", + NameSv = "fieldOfArtsNameSv", + NameEn = "fieldOfArtsNameEn" }, Abstract = "abstract", ArtPublicationTypeCategory = new List