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

Update: Considering remarks (coscine/issues#2084)

parent b883b2a9
No related branches found
No related tags found
1 merge request!9New: Migrate resource structured data to linked data
Pipeline #776916 skipped
...@@ -53,14 +53,14 @@ namespace SQL2Linked.Implementations ...@@ -53,14 +53,14 @@ namespace SQL2Linked.Implementations
{ {
if (entry.VisibilityId == visibility.Id && visibility.DisplayName.Contains("Public")) if (entry.VisibilityId == visibility.Id && visibility.DisplayName.Contains("Public"))
{ {
AssertToGraphUriNode(graph, resourceGraphName, cosc + "terms/resource#visibility", cosc + $"terms/vivibility#public"); AssertToGraphUriNode(graph, resourceGraphName, cosc + "terms/resource#visibility", cosc + $"terms/visibility#public");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#visibility {cosc}terms/vivibility#public'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#visibility {cosc}terms/visibility#public'. ");
break; break;
} }
else if (entry.VisibilityId == visibility.Id && visibility.DisplayName.Contains("Project Members")) else if (entry.VisibilityId == visibility.Id && visibility.DisplayName.Contains("Project Members"))
{ {
AssertToGraphUriNode(graph, resourceGraphName, cosc + "terms/resource#visibility", cosc + $"terms/vivibility#projectMember"); AssertToGraphUriNode(graph, resourceGraphName, cosc + "terms/resource#visibility", cosc + $"terms/visibility#projectMember");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#visibility {cosc}terms/vivibility#projectMember'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#visibility {cosc}terms/visibility#projectMember'. ");
break; break;
} }
} }
...@@ -88,7 +88,7 @@ namespace SQL2Linked.Implementations ...@@ -88,7 +88,7 @@ namespace SQL2Linked.Implementations
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}creator {cosc}users/{entry.Creator}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}creator {cosc}users/{entry.Creator}'. ");
AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#archived", entry.Archived.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#boolean")); AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#archived", entry.Archived.ToString(), 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.ToString()}'. "); 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", resourceGraphName);
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}'. ");
...@@ -110,27 +110,28 @@ namespace SQL2Linked.Implementations ...@@ -110,27 +110,28 @@ namespace SQL2Linked.Implementations
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcat}catalog {result[0].ToString()}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcat}catalog {result[0].ToString()}'. ");
} }
AssertToGraphUriNode(graph, resourceGraphName, rdf + "type", acl + "Authorization"); var blankNode= graph.CreateBlankNode(entry.Id.ToString());
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {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'. ");
foreach (var projectResource in projectResources) foreach (var projectResource in projectResources)
{ {
if (entry.Id == projectResource.ResourceId) if (entry.Id == projectResource.ResourceId)
{ {
AssertToGraphUriNode(graph, resourceGraphName, acl + "agentGroup", $"{resourceUrlPrefix}/{projectResource.ProjectId}"); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "agentGroup", $"{resourceUrlPrefix}/{projectResource.ProjectId}");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {acl}agentGroup {resourceUrlPrefix}/{projectResource.ProjectId}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}agentGroup {resourceUrlPrefix}/{projectResource.ProjectId}'. ");
break; break;
} }
} }
AssertToGraphUriNode(graph, resourceGraphName, acl + "accessTo", resourceGraphName); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {acl}accessTo {resourceGraphName}'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. ");
AssertToGraphUriNode(graph, resourceGraphName, acl + "mode", acl + "Control"); AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Control");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {acl}accessTo {acl}Control'. "); Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Control'. ");
graphs.Add(graph); graphs.Add(graph);
} }
return graphs; return graphs;
} }
......
...@@ -9,17 +9,17 @@ if (dummyMode) ...@@ -9,17 +9,17 @@ if (dummyMode)
Console.WriteLine("\nBegin SQL 2 Linked Data migration"); Console.WriteLine("\nBegin SQL 2 Linked Data migration");
var roleStructuralData = new RoleStructuralData(); //var roleStructuralData = new RoleStructuralData();
roleStructuralData.Migrate(dummyMode); //roleStructuralData.Migrate(dummyMode);
var userStructuralData = new UserStructuralData(); //var userStructuralData = new UserStructuralData();
userStructuralData.Migrate(dummyMode); //userStructuralData.Migrate(dummyMode);
var resourceTypeStructuralData = new ResourceTypeStructuralData(); //var resourceTypeStructuralData = new ResourceTypeStructuralData();
resourceTypeStructuralData.Migrate(dummyMode); //resourceTypeStructuralData.Migrate(dummyMode);
var projectStructuralData = new ProjectStructuralData(); //var projectStructuralData = new ProjectStructuralData();
projectStructuralData.Migrate(dummyMode); //projectStructuralData.Migrate(dummyMode);
var resourceStructuralData = new ResourceStructuralData(); var resourceStructuralData = new ResourceStructuralData();
resourceStructuralData.Migrate(dummyMode); resourceStructuralData.Migrate(dummyMode);
......
...@@ -77,5 +77,28 @@ namespace SQL2Linked ...@@ -77,5 +77,28 @@ namespace SQL2Linked
) )
); );
} }
public void AssertToGraphBlankAndUriNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject)
{
graph.Assert(
new Triple(
graph.CreateBlankNode(graphSubject),
graph.CreateUriNode(new Uri(graphPredicate)),
graph.CreateUriNode(new Uri(graphObject))
)
);
}
public void AssertToGraphBlankAndUriNode(IGraph graph, IBlankNode graphSubject, string graphPredicate, string graphObject)
{
graph.Assert(
new Triple(
graphSubject,
graph.CreateUriNode(new Uri(graphPredicate)),
graph.CreateUriNode(new Uri(graphObject))
)
);
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment