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 (6)
using Coscine.Database.DataModel;
using Coscine.Database.Models;
using Coscine.Database.Util;
using VDS.RDF;
namespace SQL2Linked.Implementations
......@@ -17,6 +18,17 @@ namespace SQL2Linked.Implementations
private ProjectRoleModel ProjectRoleModel = new ProjectRoleModel();
private ProjectResourceModel ProjectResourceModel = new ProjectResourceModel();
// Override to also receive deleted projects
public override IEnumerable<Project> GetAll()
{
return DatabaseConnection.ConnectToDatabase((db) =>
{
return
(from tableEntry in Model.GetITableFromDatabase(db)
select tableEntry).ToList();
});
}
public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<Project> entries)
{
IEnumerable<Visibility> visibilities = VisibilityModel.GetAll();
......
using Coscine.Database.DataModel;
using Coscine.Database.DataModel;
using Coscine.Database.Models;
using Coscine.Database.Util;
using VDS.RDF;
using VDS.RDF.Query;
......@@ -19,6 +20,17 @@ namespace SQL2Linked.Implementations
private ProjectResourceModel ProjectResourceModel = new ProjectResourceModel();
private LicenseModel LicenseModel = new LicenseModel();
// Override to also receive deleted resources
public override IEnumerable<Resource> GetAll()
{
return DatabaseConnection.ConnectToDatabase((db) =>
{
return
(from tableEntry in Model.GetITableFromDatabase(db)
select tableEntry).ToList();
});
}
public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<Resource> entries)
{
IEnumerable<Visibility> visibilities = VisibilityModel.GetAll();
......@@ -92,6 +104,12 @@ namespace SQL2Linked.Implementations
AssertToGraphLiteralNode(graph, resourceGraphName, dcterms + "description", entry.Description);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}description {entry.Description}'. ");
// Skipping broken resources
if (string.IsNullOrWhiteSpace(entry.ApplicationProfile))
{
continue;
}
AssertToGraphUriNode(graph, resourceGraphName, dcterms + "conformsTo", entry.ApplicationProfile);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}conformsTo {entry.ApplicationProfile}'. ");
......@@ -107,6 +125,9 @@ namespace SQL2Linked.Implementations
AssertToGraphUriNode(graph, 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"));
Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#deleted {entry.Deleted}'. ");
SparqlParameterizedString cmdString = new SparqlParameterizedString
{
CommandText = "SELECT DISTINCT ?g " +
......@@ -139,6 +160,9 @@ namespace SQL2Linked.Implementations
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "default", resourceGraphName);
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}default {resourceGraphName}'. ");
AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Control");
Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Control'. ");
}
......
......@@ -11,6 +11,12 @@ namespace SQL2Linked.Implementations
public readonly Uri rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
public readonly Uri foaf = new("http://xmlns.com/foaf/0.1/");
// Override to only transform users which have accepted the TOS
public override IEnumerable<User> GetAll()
{
return Model.GetAllWhere((user) => user.Tosaccepteds.Any());
}
public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<User> entries)
{
var graphs = new List<IGraph>();
......
......@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.4</Version></PropertyGroup>
<Version>0.1.5</Version></PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.Database" Version="2.*-*" />
......
......@@ -25,11 +25,16 @@ namespace SQL2Linked
public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries);
public virtual IEnumerable<S> GetAll()
{
return Model.GetAll();
}
public void Migrate(bool dummyMode)
{
var spacer = new string('-', 35);
Console.WriteLine($"\n{spacer}\n{typeof(T).Name}\n{spacer}");
var graphs = ConvertToLinkedData(Model.GetAll());
var graphs = ConvertToLinkedData(GetAll());
if (!dummyMode)
{
StoreGraphs(graphs);
......@@ -56,6 +61,7 @@ namespace SQL2Linked
Console.WriteLine();
}
}
public void AssertToGraphUriNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject)
{
graph.Assert(
......@@ -66,6 +72,7 @@ namespace SQL2Linked
)
);
}
public void AssertToGraphLiteralNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject, Uri? objectType = null)
{
graph.Assert(
......