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 (2)
......@@ -136,19 +136,12 @@ namespace SQL2Linked.Implementations
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}'. ");
var targetClass = GetTargetClass(entry);
SparqlParameterizedString cmdString = new SparqlParameterizedString
// Reinstate the catalog assignments
var cmdString = new SparqlParameterizedString
{
CommandText = "SELECT DISTINCT ?g " +
"WHERE {" +
"GRAPH ?g { ?s a <" + targetClass + "> } . " +
"FILTER(contains(STR(?g), \"" + resourceHandleName + "@\"))" +
"}"
CommandText = "SELECT DISTINCT ?o WHERE { <" + resourceGraphName + "> <http://www.w3.org/ns/dcat#catalog> ?o }"
};
var resultSet = WrapRequest(() => RdfStoreConnector.QueryEndpoint.QueryWithResultSet(cmdString.ToString()));
foreach (var result in resultSet)
{
AssertToGraphUriNode(graph, resourceGraphName, dcat + "catalog", result[0].ToString());
......
......@@ -34,7 +34,7 @@ namespace SQL2Linked.Implementations
}
// check if a triple with dcterms:title '{entry.DisplayName}' already exists in the role graph
var getTriplesDctermsTitle = graph.GetTriplesWithPredicate(new Uri(dcterms + "Title"));
var getTriplesDctermsTitle = graph.GetTriplesWithPredicate(new Uri(dcterms + "title"));
if (!getTriplesDctermsTitle.Any())
{
......
......@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.1.16</Version></PropertyGroup>
<Version>0.1.17</Version></PropertyGroup>
<ItemGroup>
<PackageReference Include="Coscine.Database" Version="2.*-*" />
......
......@@ -3,6 +3,7 @@ using Coscine.Database.Models;
using Coscine.Metadata;
using Polly;
using VDS.RDF;
using VDS.RDF.Query.Algebra;
namespace SQL2Linked
{
......@@ -44,13 +45,30 @@ namespace SQL2Linked
}
}
private void StoreGraphs(IEnumerable<IGraph> graphs)
public void StoreGraphs(IEnumerable<IGraph> graphs)
{
foreach (var graph in graphs)
{
try
{
Console.WriteLine($" ({graph.BaseUri})");
if (graph is WrapperGraph)
{
var wrapperGraph = (WrapperGraph)graph;
// Chunking since the size otherwise can be too large
foreach (var triples in wrapperGraph.AssertList.Chunk(100))
{
WrapRequest(() => RdfStoreConnector.ReadWriteSparqlConnector.UpdateGraph(graph.BaseUri, triples, new List<Triple>()));
}
// Chunking since the size otherwise can be too large
foreach (var triples in wrapperGraph.RetractList.Chunk(100))
{
WrapRequest(() => RdfStoreConnector.ReadWriteSparqlConnector.UpdateGraph(graph.BaseUri, new List<Triple>(), triples));
}
}
else
{
var exists = WrapRequest(() => RdfStoreConnector.HasGraph(graph.BaseUri));
if (exists)
{
......@@ -60,8 +78,15 @@ namespace SQL2Linked
WrapRequest(() => RdfStoreConnector.ClearGraph(graph.BaseUri));
Console.WriteLine($" - Cleared Graph {graph.BaseUri}");
}
// Add the new graph to the store
WrapRequest(() => RdfStoreConnector.AddGraph(graph));
// Chunking since the size otherwise can be too large
// Don't change to only addition of triples, otherwise this could break things
foreach (var triples in graph.Triples.Chunk(100))
{
WrapRequest(() => RdfStoreConnector.ReadWriteSparqlConnector.UpdateGraph(graph.BaseUri, triples, new List<Triple>()));
}
}
Console.WriteLine($" - Graph {graph.BaseUri} added successfully");
Console.WriteLine();
}
......
using VDS.RDF;
namespace SQL2Linked
{
public class WrapperGraph : Graph
{
public List<Triple> AssertList { get; set; }
public List<Triple> RetractList { get; set; }
public WrapperGraph() : base()
{
AssertList = new List<Triple>();
RetractList = new List<Triple>();
}
public override bool Assert(Triple t)
{
AssertList.Add(t);
return base.Assert(t);
}
public override bool Assert(IEnumerable<Triple> triples)
{
AssertList.AddRange(triples);
return base.Assert(triples);
}
public override bool Retract(Triple t)
{
RetractList.Add(t);
return base.Retract(t);
}
public override bool Retract(IEnumerable<Triple> triples)
{
RetractList.AddRange(triples);
return base.Retract(triples);
}
}
}