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 (8)
......@@ -6,10 +6,67 @@ namespace SQL2Linked.Implementations
{
public class ResourceTypeStructuralData : StructuralData<ResourceType, ResourceTypeModel>
{
public readonly string ResourceTypeUrlPrefix = "https://purl.org/coscine/resourcetype";
public readonly Uri RdfType = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
public readonly Uri DcatDataService = new ("http://www.w3.org/ns/dcat#DataService");
public readonly Uri dctermsTitle = new("http://purl.org/dc/terms/title");
public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<ResourceType> entries)
{
// ToDo: Implement
throw new NotImplementedException();
var graphs = new List<IGraph>();
foreach (var entry in entries)
{
var resourceTypeGraphName = $"{ResourceTypeUrlPrefix}/{entry.Id}";
var graph = RdfStoreConnector.GetGraph(resourceTypeGraphName);
// check if a triple with a dcat:DataService already exists in the resourcetype graph
var getTriplesDcatDataService = graph.GetTriplesWithObject(DcatDataService);
if (!getTriplesDcatDataService.Any())
{
graph.Assert(
new Triple(
graph.CreateUriNode(new Uri(resourceTypeGraphName)),
graph.CreateUriNode(RdfType),
graph.CreateUriNode(DcatDataService)
)
);
Console.WriteLine($"For resource type '{entry.DisplayName}' will migrate triple '{graph.BaseUri}' a dcat:DataService. ");
}
else
{
Console.WriteLine($"For resource type '{entry.DisplayName}' will NOT migrate triple '{graph.BaseUri}' a dcat:DataService. ");
}
// check if a triple with dcterms:title '{entry.DisplayName}' already exists in the role graph
var getTriplesDctermsTitle = graph.GetTriplesWithPredicate(dctermsTitle);
if (!getTriplesDctermsTitle.Any())
{
graph.Assert(
new Triple(
graph.CreateUriNode(new Uri(resourceTypeGraphName)),
graph.CreateUriNode(dctermsTitle),
graph.CreateLiteralNode(entry.DisplayName)
)
);
Console.WriteLine($"For resource type '{entry.DisplayName}' will migrate triple '{graph.BaseUri}' dcterms:title '{entry.DisplayName}'. ");
}
else
{
Console.WriteLine($"For resource type '{entry.DisplayName}' will NOT migrate triple '{graph.BaseUri}' dcterms:title '{entry.DisplayName}'. ");
}
if (!getTriplesDcatDataService.Any() || !getTriplesDctermsTitle.Any())
{
graphs.Add(graph);
}
}
return graphs;
}
}
}
\ No newline at end of file
......@@ -6,10 +6,65 @@ namespace SQL2Linked.Implementations
{
public class RoleStructuralData : StructuralData<Role, RoleModel>
{
public readonly string RoleUrlPrefix = "https://purl.org/coscine/roles";
public readonly Uri RdfType = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
public readonly Uri orgRole = new("http://www.w3.org/ns/org#Role");
public readonly Uri dctermsTitle = new("http://purl.org/dc/terms/title");
public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<Role> entries)
{
// ToDo: Implement
throw new NotImplementedException();
var graphs = new List<IGraph>();
foreach (var entry in entries)
{
var roleGraphName = $"{RoleUrlPrefix}/{entry.Id}";
var graph = RdfStoreConnector.GetGraph(roleGraphName);
// check if a triple with a org:role already exists in the role graph
var getTriplesOrgRole = graph.GetTriplesWithObject(orgRole);
if (!getTriplesOrgRole.Any())
{
graph.Assert(
new Triple(
graph.CreateUriNode(new Uri(roleGraphName)),
graph.CreateUriNode(RdfType),
graph.CreateUriNode(orgRole)
)
);
Console.WriteLine($"For role '{entry.DisplayName}' will migrate triple '{graph.BaseUri}' a org:Role. ");
}
else
{
Console.WriteLine($"For role '{entry.DisplayName}' will NOT migrate triple '{graph.BaseUri}' a org:Role. ");
}
// check if a triple with dcterms:title '{entry.DisplayName}' already exists in the role graph
var getTriplesDctermsTitle = graph.GetTriplesWithPredicate(dctermsTitle);
if (!getTriplesDctermsTitle.Any())
{
graph.Assert(
new Triple(
graph.CreateUriNode(new Uri(roleGraphName)),
graph.CreateUriNode(dctermsTitle),
graph.CreateLiteralNode(entry.DisplayName)
)
);
Console.WriteLine($"For role '{entry.DisplayName}' will migrate triple '{graph.BaseUri}' dcterms:title '{entry.DisplayName}'. ");
}
else
{
Console.WriteLine($"For role '{entry.DisplayName}' will NOT migrate triple '{graph.BaseUri}' dcterms:title '{entry.DisplayName}'. ");
}
if (!getTriplesOrgRole.Any() || !getTriplesDctermsTitle.Any())
{
graphs.Add(graph);
}
}
return graphs;
}
}
}
\ No newline at end of file
......@@ -25,17 +25,9 @@ namespace SQL2Linked.Implementations
if (!getTriples.Any())
{
// check if a user graph already exists
var exists = RdfStoreConnector.HasGraph(userGraphName);
if (!exists)
{
RdfStoreConnector.CreateNamedGraph(userGraphName);
}
graph.Assert(
new Triple(
graph.CreateBlankNode(),
graph.CreateUriNode(new Uri(userGraphName)),
graph.CreateUriNode(RdfType),
graph.CreateUriNode(FoafPerson)
)
......
......@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.1</Version></PropertyGroup>
<Version>0.1.2</Version></PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.Database" Version="2.*-*" />
......