Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Fix/v0.1.7-dependencies
  • Hotfix/2212-fixFiles
  • Hotfix/2776-workingNewVersion
  • Hotfix/xxxx-changeUrls
  • Hotfix/xxxx-correctAssignments
  • Hotfix/xxxx-coscineGraph
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1781-sqlToLinked
  • Issue/1782-structualDataIntegration
  • Issue/2081-migrateUserStructuralData
  • Issue/2082-migrateRoleStructuralData
  • Issue/2083-migrateResourceTypeStructuralData
  • Issue/2084-migrateResourceStructuralData
  • Issue/2085-migrateProjectStructuralData
  • Issue/2221-projectDateCreated
  • Issue/2222-resourceDateCreated
  • Issue/2304-virtuosoRoars
  • Issue/2518-docs
  • Issue/2666-adminCronjobs
  • Issue/2666-adminCronjobs-theSequal
  • Issue/2847-reporting
  • Issue/2914-trellisMigrator
  • dev
  • gitkeep
  • main
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.12
  • v0.1.13
  • v0.1.14
  • v0.1.15
  • v0.1.16
  • v0.1.17
  • v0.1.18
  • v0.1.19
  • v0.1.2
  • v0.1.20
  • v0.1.21
  • v0.1.22
  • v0.1.23
  • v0.1.24
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
50 results

Target

Select target project
  • coscine/backend/scripts/sql2linked
1 result
Select Git revision
  • Fix/v0.1.7-dependencies
  • Hotfix/2212-fixFiles
  • Hotfix/2776-workingNewVersion
  • Hotfix/xxxx-changeUrls
  • Hotfix/xxxx-correctAssignments
  • Hotfix/xxxx-coscineGraph
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1781-sqlToLinked
  • Issue/1782-structualDataIntegration
  • Issue/2081-migrateUserStructuralData
  • Issue/2082-migrateRoleStructuralData
  • Issue/2083-migrateResourceTypeStructuralData
  • Issue/2084-migrateResourceStructuralData
  • Issue/2085-migrateProjectStructuralData
  • Issue/2221-projectDateCreated
  • Issue/2222-resourceDateCreated
  • Issue/2304-virtuosoRoars
  • Issue/2518-docs
  • Issue/2666-adminCronjobs
  • Issue/2666-adminCronjobs-theSequal
  • Issue/2847-reporting
  • Issue/2914-trellisMigrator
  • dev
  • gitkeep
  • main
  • v0.1.0
  • v0.1.1
  • v0.1.10
  • v0.1.11
  • v0.1.12
  • v0.1.13
  • v0.1.14
  • v0.1.15
  • v0.1.16
  • v0.1.17
  • v0.1.18
  • v0.1.19
  • v0.1.2
  • v0.1.20
  • v0.1.21
  • v0.1.22
  • v0.1.23
  • v0.1.24
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9
50 results
Show changes
Commits on Source (3)
......@@ -33,7 +33,7 @@ public class ProjectStructuralData : StructuralData<ProjectAdminDto>
public override async Task<IEnumerable<IGraph>> ConvertToLinkedDataAsync(IEnumerable<ProjectAdminDto> entries)
{
var graphs = new List<IGraph>();
var coscineHandlePrefix = UriHelper.TryCombineUri(RdfUris.HandlePrefix, _pidConfiguration.Prefix)
var coscineHandlePrefix = UriHelper.TryCombinePath(RdfUris.HandlePrefix, _pidConfiguration.Prefix)
?? throw new Exception("Could not combine handle prefix with PID prefix");
var coscineGraph = new Graph
......
......@@ -3,6 +3,7 @@ using Coscine.ApiClient.Core.Model;
using Newtonsoft.Json;
using SQL2Linked.Utils;
using VDS.RDF;
using VDS.RDF.Parsing;
namespace SQL2Linked.Implementations;
......@@ -34,7 +35,7 @@ public class ResourceStructuralData : StructuralData<ResourceAdminDto>
public override async Task<IEnumerable<IGraph>> ConvertToLinkedDataAsync(IEnumerable<ResourceAdminDto> entries)
{
var graphs = new List<IGraph>();
var coscineHandlePrefix = UriHelper.TryCombineUri(RdfUris.HandlePrefix, _pidConfiguration.Prefix)
var coscineHandlePrefix = UriHelper.TryCombinePath(RdfUris.HandlePrefix, _pidConfiguration.Prefix)
?? throw new Exception("Could not combine handle prefix with PID prefix");
foreach (var entry in entries)
......@@ -120,7 +121,32 @@ public class ResourceStructuralData : StructuralData<ResourceAdminDto>
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.FoafHomepage} {resourceGraphName}'. ");
AssertToGraphLiteralNode(graph, resourceGraphName, RdfUris.CoscineTermsResourceDeleted, entry.Deleted.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean"));
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.CoscineTermsResourceDeleted} {entry.Deleted}'. ");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.CoscineTermsResourceDeleted} {entry.Deleted}'. ");
// Reinstate the catalog assignments
var oldResourceGraphResponse = await _adminApi.GetMetadataGraphAsync(
resourceGraphName.AbsoluteUri,
RdfFormat.TextTurtle
);
if (oldResourceGraphResponse is not null)
{
var oldResourceGraph = new Graph();
var ttlparser = new TurtleParser();
ttlparser.Load(oldResourceGraph, new StringReader(oldResourceGraphResponse.Data.Content));
foreach (var result in oldResourceGraph.GetTriplesWithPredicate(RdfUris.DcatCatalog))
{
if (result.Object.NodeType == NodeType.Uri)
{
var catalogedUri = result.Object as IUriNode;
if (catalogedUri is not null)
{
AssertToGraphUriNode(graph, resourceGraphName, RdfUris.DcatCatalog, catalogedUri.Uri);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.DcatCatalog} {catalogedUri.Uri}'. ");
}
}
}
}
foreach (var projectResource in entry.ProjectResources)
{
......@@ -151,7 +177,7 @@ public class ResourceStructuralData : StructuralData<ResourceAdminDto>
if (entry.DateCreated is not null && entry.DateCreated.HasValue)
{
AssertToGraphLiteralNode(graph, resourceGraphName, RdfUris.DcTermsCreated, entry.DateCreated.Value.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.DcTermsCreated} {entry.DateCreated}'. ");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {RdfUris.DcTermsCreated} {entry.DateCreated}'. ");
}
graphs.Add(graph);
......
......@@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.20</Version>
<Version>0.1.21</Version>
</PropertyGroup>
<PropertyGroup>
......@@ -16,7 +16,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.ApiClient" Version="1.3.0" />
<PackageReference Include="Coscine.ApiClient" Version="1.3.1" />
<PackageReference Include="dotNetRdf" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
......
......@@ -5,6 +5,30 @@
/// </summary>
public static class UriHelper
{
/// <summary>
///
/// </summary>
/// <param name="baseUri"></param>
/// <param name="relativePath"></param>
/// <returns></returns>
public static Uri? TryCombinePath(Uri baseUri, string relativePath)
{
Uri.TryCreate(baseUri, relativePath + "/", out Uri? result);
return result;
}
/// <summary>
///
/// </summary>
/// <param name="baseUri"></param>
/// <param name="relativePath"></param>
/// <returns></returns>
public static Uri? TryCombinePath(Uri baseUri, Guid relativePath)
{
Uri.TryCreate(baseUri, relativePath.ToString() + "/", out Uri? result);
return result;
}
/// <summary>
///
/// </summary>
......