Skip to content
Snippets Groups Projects
Commit 7d79038e authored by Hanna Führ's avatar Hanna Führ
Browse files

Merge remote-tracking branch 'remotes/origin/dev' into Issue/2221-projectDateCreated

parents 62f4dcce 796ee38b
No related tags found
1 merge request!15New: "Date Created" and "Creator" translations added to the SQL2Linked
Pipeline #807409 skipped
...@@ -36,11 +36,14 @@ namespace SQL2Linked.Implementations ...@@ -36,11 +36,14 @@ namespace SQL2Linked.Implementations
IEnumerable<ProjectResource> projectResources = ProjectResourceModel.GetAll(); IEnumerable<ProjectResource> projectResources = ProjectResourceModel.GetAll();
var graphs = new List<IGraph>(); var graphs = new List<IGraph>();
string projectUrlPrefix = "https://hdl.handle.net/" + Prefix; var projectUrlHandlePrefix = "https://hdl.handle.net/" + Prefix;
var projectUrlPrefix = "https://purl.org/coscine/projects";
var resourceUrlPrefix = "https://purl.org/coscine/resources";
foreach (var entry in entries) foreach (var entry in entries)
{ {
var projectGraphName = $"{projectUrlPrefix}/{entry.Id}"; var projectGraphName = $"{projectUrlPrefix}/{entry.Id}";
var projectHandleName = $"{projectUrlHandlePrefix}/{entry.Id}";
var graph = new Graph(); var graph = new Graph();
graph.BaseUri = new Uri(projectGraphName); graph.BaseUri = new Uri(projectGraphName);
...@@ -107,8 +110,8 @@ namespace SQL2Linked.Implementations ...@@ -107,8 +110,8 @@ namespace SQL2Linked.Implementations
AssertToGraphLiteralNode(graph, projectGraphName, cosc + "terms/project#slug", entry.Slug); AssertToGraphLiteralNode(graph, projectGraphName, cosc + "terms/project#slug", entry.Slug);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {cosc}terms/project#slug {entry.Slug}'. "); Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {cosc}terms/project#slug {entry.Slug}'. ");
AssertToGraphUriNode(graph, projectGraphName, foaf + "homepage", projectGraphName); AssertToGraphUriNode(graph, projectGraphName, foaf + "homepage", projectHandleName);
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {foaf}homepage {projectGraphName}'. "); Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {foaf}homepage {projectHandleName}'. ");
foreach (var projectRole in projectRoles) foreach (var projectRole in projectRoles)
{ {
...@@ -137,8 +140,8 @@ namespace SQL2Linked.Implementations ...@@ -137,8 +140,8 @@ namespace SQL2Linked.Implementations
{ {
if (entry.Id == projectResource.ProjectId) if (entry.Id == projectResource.ProjectId)
{ {
AssertToGraphUriNode(graph, projectGraphName, dcat + "catalog", $"{projectUrlPrefix}/{projectResource.ResourceId}"); AssertToGraphUriNode(graph, projectGraphName, dcat + "catalog", $"{resourceUrlPrefix}/{projectResource.ResourceId}");
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}catalog {projectUrlPrefix}/{projectResource.ResourceId}'. "); Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}catalog {resourceUrlPrefix}/{projectResource.ResourceId}'. ");
} }
} }
......
...@@ -38,11 +38,14 @@ namespace SQL2Linked.Implementations ...@@ -38,11 +38,14 @@ namespace SQL2Linked.Implementations
IEnumerable<License> licenses = LicenseModel.GetAll(); IEnumerable<License> licenses = LicenseModel.GetAll();
var graphs = new List<IGraph>(); var graphs = new List<IGraph>();
string resourceUrlPrefix = "https://hdl.handle.net/" + Prefix; var resourceUrlHandlePrefix = "https://hdl.handle.net/" + Prefix;
var projectUrlPrefix = "https://purl.org/coscine/projects";
var resourceUrlPrefix = "https://purl.org/coscine/resources";
foreach (var entry in entries) foreach (var entry in entries)
{ {
var resourceGraphName = $"{resourceUrlPrefix}/{entry.Id}"; var resourceGraphName = $"{resourceUrlPrefix}/{entry.Id}";
var resourceHandleName = $"{resourceUrlHandlePrefix}/{entry.Id}";
var graph = new Graph(); var graph = new Graph();
graph.BaseUri = new Uri(resourceGraphName); graph.BaseUri = new Uri(resourceGraphName);
...@@ -53,8 +56,8 @@ namespace SQL2Linked.Implementations ...@@ -53,8 +56,8 @@ namespace SQL2Linked.Implementations
AssertToGraphUriNode(graph, resourceGraphName, rdf + "type", pim + "Storage"); AssertToGraphUriNode(graph, resourceGraphName, rdf + "type", pim + "Storage");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {rdf}type {pim}Storage'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {rdf}type {pim}Storage'. ");
AssertToGraphUriNode(graph, resourceGraphName, dcat + "service", cosc + $"resourcetype/{entry.TypeId}"); AssertToGraphUriNode(graph, resourceGraphName, dcat + "service", cosc + $"resourcetypes/{entry.TypeId}");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcat}service {cosc}resourcetype/{entry.TypeId}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcat}service {cosc}resourcetypes/{entry.TypeId}'. ");
AssertToGraphLiteralNode(graph, resourceGraphName, dcterms + "title", entry.ResourceName); AssertToGraphLiteralNode(graph, resourceGraphName, dcterms + "title", entry.ResourceName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}title {entry.ResourceName}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}title {entry.ResourceName}'. ");
...@@ -122,7 +125,7 @@ namespace SQL2Linked.Implementations ...@@ -122,7 +125,7 @@ namespace SQL2Linked.Implementations
AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#archived", entry.Archived.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean")); AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#archived", entry.Archived.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean"));
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#archived {entry.Archived}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#archived {entry.Archived}'. ");
AssertToGraphUriNode(graph, resourceGraphName, foaf + "homepage", resourceGraphName); AssertToGraphUriNode(graph, resourceGraphName, foaf + "homepage", resourceHandleName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {foaf}homepage {resourceGraphName}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {foaf}homepage {resourceGraphName}'. ");
AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#deleted", entry.Deleted.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean")); AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#deleted", entry.Deleted.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean"));
...@@ -154,8 +157,8 @@ namespace SQL2Linked.Implementations ...@@ -154,8 +157,8 @@ namespace SQL2Linked.Implementations
AssertToGraphBlankAndUriNode(graph, blankNode, rdf + "type", acl + "Authorization"); AssertToGraphBlankAndUriNode(graph, blankNode, rdf + "type", acl + "Authorization");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {rdf}type {acl}Authorization'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {rdf}type {acl}Authorization'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "agentGroup", $"{resourceUrlPrefix}/{projectResource.ProjectId}"); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "agentGroup", $"{projectUrlPrefix}/{projectResource.ProjectId}");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}agentGroup {resourceUrlPrefix}/{projectResource.ProjectId}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}agentGroup {projectUrlPrefix}/{projectResource.ProjectId}'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. ");
...@@ -163,8 +166,11 @@ namespace SQL2Linked.Implementations ...@@ -163,8 +166,11 @@ namespace SQL2Linked.Implementations
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "default", resourceGraphName); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "default", resourceGraphName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}default {resourceGraphName}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}default {resourceGraphName}'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Control"); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Read");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Control'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Read'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Write");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Write'. ");
} }
} }
......
...@@ -6,7 +6,7 @@ namespace SQL2Linked.Implementations ...@@ -6,7 +6,7 @@ namespace SQL2Linked.Implementations
{ {
public class ResourceTypeStructuralData : StructuralData<ResourceType, ResourceTypeModel> public class ResourceTypeStructuralData : StructuralData<ResourceType, ResourceTypeModel>
{ {
public readonly string ResourceTypeUrlPrefix = "https://purl.org/coscine/resourcetype"; public readonly string ResourceTypeUrlPrefix = "https://purl.org/coscine/resourcetypes";
public readonly Uri rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#"); public readonly Uri rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
public readonly Uri dcat = new("http://www.w3.org/ns/dcat#"); public readonly Uri dcat = new("http://www.w3.org/ns/dcat#");
public readonly Uri dcterms = new("http://purl.org/dc/terms/"); public readonly Uri dcterms = new("http://purl.org/dc/terms/");
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.1.5</Version></PropertyGroup> <Version>0.1.6</Version></PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Coscine.Database" Version="2.*-*" /> <PackageReference Include="Coscine.Database" Version="2.*-*" />
......
...@@ -62,7 +62,9 @@ namespace SQL2Linked ...@@ -62,7 +62,9 @@ namespace SQL2Linked
} }
} }
public void AssertToGraphUriNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject) public void AssertToGraphUriNode(IGraph graph, string graphSubject, string graphPredicate, string? graphObject)
{
if (graphObject != null)
{ {
graph.Assert( graph.Assert(
new Triple( new Triple(
...@@ -72,8 +74,11 @@ namespace SQL2Linked ...@@ -72,8 +74,11 @@ namespace SQL2Linked
) )
); );
} }
}
public void AssertToGraphLiteralNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject, Uri? objectType = null) public void AssertToGraphLiteralNode(IGraph graph, string graphSubject, string graphPredicate, string? graphObject, Uri? objectType = null)
{
if (graphObject != null)
{ {
graph.Assert( graph.Assert(
new Triple( new Triple(
...@@ -83,8 +88,11 @@ namespace SQL2Linked ...@@ -83,8 +88,11 @@ namespace SQL2Linked
) )
); );
} }
}
public void AssertToGraphBlankAndUriNode(IGraph graph, IBlankNode graphSubject, string graphPredicate, string graphObject) public void AssertToGraphBlankAndUriNode(IGraph graph, IBlankNode graphSubject, string graphPredicate, string? graphObject)
{
if (graphObject != null)
{ {
graph.Assert( graph.Assert(
new Triple( new Triple(
...@@ -96,3 +104,4 @@ namespace SQL2Linked ...@@ -96,3 +104,4 @@ namespace SQL2Linked
} }
} }
} }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment