Skip to content
Snippets Groups Projects
Commit 955b5374 authored by Petar Hristov's avatar Petar Hristov :speech_balloon:
Browse files

Merge branch 'dev' into 'main'

Release: Sprint/2022 23 :robot:

See merge request !22
parents 46359349 8a9b8060
No related branches found
No related tags found
1 merge request!22Release: Sprint/2022 23 :robot:
Pipeline #861921 waiting for manual action
......@@ -26,9 +26,10 @@ publish:
migration:
rules:
- if: $CI_MERGE_REQUEST_ID
when: never # Ignore detached head jobs created by merge requests.
- if: $CI_PIPELINE_SOURCE != "schedule"
when: manual
stage: commands
script:
- dotnet run --project .\src\$DOTNET_MAIN_PROJECT_FOLDER -- --noDryRun
\ No newline at end of file
when: manual
\ No newline at end of file
......@@ -14,9 +14,11 @@ namespace SQL2Linked.Implementations
public readonly Uri vcard = new("http://www.w3.org/2006/vcard/ns#");
public readonly Uri rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
public readonly Uri cosc = new("https://purl.org/coscine/");
private VisibilityModel VisibilityModel = new VisibilityModel();
private ProjectRoleModel ProjectRoleModel = new ProjectRoleModel();
private ProjectResourceModel ProjectResourceModel = new ProjectResourceModel();
private readonly VisibilityModel VisibilityModel = new();
private readonly ProjectRoleModel ProjectRoleModel = new();
private readonly ProjectResourceModel ProjectResourceModel = new();
private readonly ProjectInstituteModel ProjectInstituteModel = new();
// Override to also receive deleted projects
public override IEnumerable<Project> GetAll()
......@@ -34,6 +36,7 @@ namespace SQL2Linked.Implementations
IEnumerable<Visibility> visibilities = VisibilityModel.GetAll();
IEnumerable<ProjectRole> projectRoles = ProjectRoleModel.GetAll();
IEnumerable<ProjectResource> projectResources = ProjectResourceModel.GetAll();
IEnumerable<ProjectInstitute> projectInstitutes = ProjectInstituteModel.GetAll();
var graphs = new List<IGraph>();
var projectUrlHandlePrefix = "https://hdl.handle.net/" + Prefix;
......@@ -45,8 +48,10 @@ namespace SQL2Linked.Implementations
var projectGraphName = $"{projectUrlPrefix}/{entry.Id}";
var projectHandleName = $"{projectUrlHandlePrefix}/{entry.Id}";
var graph = new Graph();
graph.BaseUri = new Uri(projectGraphName);
var graph = new Graph
{
BaseUri = new Uri(projectGraphName)
};
AssertToGraphUriNode(graph, projectGraphName, rdf + "type", dcat + "Catalog");
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {rdf}type {dcat}Catalog'. ");
......@@ -113,9 +118,7 @@ namespace SQL2Linked.Implementations
AssertToGraphUriNode(graph, projectGraphName, foaf + "homepage", projectHandleName);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {foaf}homepage {projectHandleName}'. ");
foreach (var projectRole in projectRoles)
{
if (entry.Id == projectRole.ProjectId)
foreach (var projectRole in projectRoles.Where(p => p.ProjectId.Equals(entry.Id)))
{
AssertToGraphUriNode(graph, projectGraphName, vcard + "hasMember", cosc + "users/" + projectRole.UserId);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {vcard}hasMember {cosc}users/{projectRole.UserId}'. ");
......@@ -134,15 +137,17 @@ namespace SQL2Linked.Implementations
AssertToGraphBlankAndUriNode(graph, blankNode, org + "member", cosc + "users/" + projectRole.UserId);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{blankNode} {org}member {cosc}users/{projectRole.UserId}'. ");
}
}
foreach (var projectResource in projectResources)
{
if (entry.Id == projectResource.ProjectId)
foreach (var projectResource in projectResources.Where(p => p.ProjectId.Equals(entry.Id)))
{
AssertToGraphUriNode(graph, projectGraphName, dcat + "catalog", $"{resourceUrlPrefix}/{projectResource.ResourceId}");
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}catalog {resourceUrlPrefix}/{projectResource.ResourceId}'. ");
}
foreach (var projectInstitute in projectInstitutes.Where(p => p.ProjectId.Equals(entry.Id)))
{
AssertToGraphUriNode(graph, projectGraphName, org + "organization", projectInstitute.OrganizationUrl);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {org}organization {projectInstitute.OrganizationUrl}'. ");
}
if (entry.Creator is not null)
......
using Polly;
using Coscine.Configuration;
using Coscine.Configuration;
using Coscine.Database.Models;
using Coscine.Metadata;
using Polly;
using VDS.RDF;
namespace SQL2Linked
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment