diff --git a/src/KPI Generator/Reporting.cs b/src/KPI Generator/Reporting.cs index 536c65ed6fc08eb4894a0c8aba3b4106ff4248e4..ad8888e595019ed5235d5fc627c5ba548ede6548 100644 --- a/src/KPI Generator/Reporting.cs +++ b/src/KPI Generator/Reporting.cs @@ -190,10 +190,6 @@ public abstract class Reporting<O> where O : class foreach (var org in organizations) { var ror = org.RorUrl; - if (ror.Contains("www.rwth-aachen.de")) - { - ror = ConvertOldRwthOrganizationToRor(ror); // e.g. <https://www.rwth-aachen.de/22000> turns into <https://ror.org/04xfq0f34#ORG-42NHW> - } result.Add(new Organization { RorUrl = ror.Contains('#') ? ror[..ror.IndexOf('#')] : ror, // e.g. <https://ror.org/04xfq0f34#ORG-42NHW> turns into <https://ror.org/04xfq0f34> @@ -250,54 +246,4 @@ public abstract class Reporting<O> where O : class } Console.WriteLine(); } - - public string ConvertOldRwthOrganizationToRor(string organization) - { - // Converts values like https://www.rwth-aachen.de/22000 to its corresponding RoR (here: https://ror.org/04xfq0f34#ORG-42NHW) - var _queryString = new SparqlParameterizedString - { - CommandText = $@" - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX org: <http://www.w3.org/ns/org#> - - SELECT DISTINCT ?source ?inst - WHERE {{ - # Define ?source URI - VALUES ?source - {{ - <{organization}> - }} . - - # Get Display Name of the institution - ?source rdfs:label ?name . - - # Get Institute Identifier in ?ikzid - ?source org:identifier ?ikzid . - - # IKZ ID is in the form 'ikz:<ID>' or 'ikz:0<ID>' - BIND(concat('ikz:', ?ikzid) AS ?ikz) . - BIND(concat('ikz:0', ?ikzid) AS ?ikz0) . - - # Fetch all institutes from RWTH - <{RwthRor}> org:hasUnit ?inst . - - # OR statement to search by ikz variations and name - {{ ?inst org:identifier ?ikz .}} UNION {{ ?inst org:identifier ?ikz0 .}} UNION {{ ?inst rdfs:label ?name .}} - }} - GROUP BY ?inst - " - }; - using var results = RdfStoreConnector.QueryEndpoint.QueryWithResultSet(_queryString.ToString()); - if (!results.IsEmpty) - { - var inst = results.Select(x => x.Value("inst").ToString()); // Get the value for ?inst - if (inst.Any()) - { - Console.WriteLine($" Organization {organization} found to match {inst.ToList()[0]}"); - organization = inst.ToList()[0]; - } - } - Console.WriteLine($" Could not find match for {organization}"); - return organization; - } } \ No newline at end of file diff --git a/src/KPI Generator/Reportings/Project/ProjectReporting.cs b/src/KPI Generator/Reportings/Project/ProjectReporting.cs index 852e9f36ce6951289044acb026480fc5900910b3..66e6606d0737fb7003f2e4011f31880aeef598e4 100644 --- a/src/KPI Generator/Reportings/Project/ProjectReporting.cs +++ b/src/KPI Generator/Reportings/Project/ProjectReporting.cs @@ -62,7 +62,7 @@ public class ProjectReporting : Reporting<ProjectReportingOptions> Organizations = GetOrganizations(projectReturnObject), Disciplines = projectReturnObject.Disciplines.ToList(), Deleted = projectReturnObject.Deleted, - ProjectVisibilityId = projectReturnObject.Visibility.Id, + ProjectVisibility = projectReturnObject.Visibility, GrantId = projectReturnObject.GrantId, Users = _projectRoleModel.GetAllWhere(x => x.ProjectId == projectReturnObject.Id).Count(), ResourceTypeQuota = GetResourceTypeQuota(projectReturnObject.Id) @@ -86,11 +86,6 @@ public class ProjectReporting : Reporting<ProjectReportingOptions> } var returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains(entry.RorUrl))).ToList(); - // Additional condition to process old RWTH Entries (Could be removed after entries in virtuoso are migrated to their correct RoRs) - if (entry.RorUrl.Equals(RwthRor)) - { - returnObjectsForOrganization.AddRange(returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains("www.rwth-aachen.de"))).ToList()); - } reportingFilesPerOrganization.Add(new ReportingFileObject { diff --git a/src/KPI Generator/Reportings/Project/ReturnObject.cs b/src/KPI Generator/Reportings/Project/ReturnObject.cs index 4a94e1f0a0530c59a1176508692c8f118c2fe7a2..b888462333e02f6bde2f08249c75b0d3a731d387 100644 --- a/src/KPI Generator/Reportings/Project/ReturnObject.cs +++ b/src/KPI Generator/Reportings/Project/ReturnObject.cs @@ -13,7 +13,7 @@ public class ReturnObject public List<Organization> Organizations { get; set; } = new(); public List<DisciplineObject> Disciplines { get; set; } = new(); public bool Deleted { get; set; } - public Guid ProjectVisibilityId { get; set; } + public VisibilityObject ProjectVisibility { get; set; } = null!; public string? GrantId { get; set; } public int? Users { get; set; } = null; public List<ResourceTypeQuotaReturnObject> ResourceTypeQuota { get; set; } = new(); diff --git a/src/KPI Generator/Reportings/Resource/ResourceReporting.cs b/src/KPI Generator/Reportings/Resource/ResourceReporting.cs index 9f92b06bc99b3f231baa13a3953b8eca30a9ccb3..0648a027edeefeca003d9332cf9b9499d718c35f 100644 --- a/src/KPI Generator/Reportings/Resource/ResourceReporting.cs +++ b/src/KPI Generator/Reportings/Resource/ResourceReporting.cs @@ -58,7 +58,7 @@ public class ResourceReporting : Reporting<ResourceReportingOptions> DateCreated = resourceReturnObject.DateCreated, Archived = resourceReturnObject.Archived, Deleted = resourceReturnObject.Deleted, - MetadataVisibilityId = resourceReturnObject.Visibility.Id, + MetadataVisibility = resourceReturnObject.Visibility, RelatedProjectId = GetRelatedProject(resource.Id), Organizations = GetOrganizations(resourceReturnObject.Id), Disciplines = resourceReturnObject.Disciplines.ToList(), @@ -84,11 +84,6 @@ public class ResourceReporting : Reporting<ResourceReportingOptions> Console.WriteLine($" WARNING!: Organization \"{entry.RorUrl}\" could not be correctly identified. Will use \"{_otherOrganization.RorUrl}\"."); } var returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Equals(entry.RorUrl))).ToList(); - // Additional condition to process old RWTH Entries (Could be removed after entries in virtuoso are migrated to their correct RoRs) - if (entry.RorUrl.Equals(RwthRor)) - { - returnObjectsForOrganization.AddRange(returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains("www.rwth-aachen.de"))).ToList()); - } reportingFilesPerOrganization.Add(new ReportingFileObject { diff --git a/src/KPI Generator/Reportings/Resource/ReturnObject.cs b/src/KPI Generator/Reportings/Resource/ReturnObject.cs index 04584f0377a5f4819884608ab51b99f42a9d9754..94e64e14bf41df3b0c304519e7f58c100bc99e41 100644 --- a/src/KPI Generator/Reportings/Resource/ReturnObject.cs +++ b/src/KPI Generator/Reportings/Resource/ReturnObject.cs @@ -13,7 +13,7 @@ public class ReturnObject public DateTime? DateCreated { get; set; } = null; public bool Archived { get; set; } public bool Deleted { get; set; } - public Guid MetadataVisibilityId { get; set; } + public VisibilityObject MetadataVisibility { get; set; } = null!; public Guid? RelatedProjectId { get; set; } public List<Organization> Organizations { get; set; } = new(); public List<DisciplineObject> Disciplines { get; set; } = new();