Skip to content
Snippets Groups Projects
Commit 2b0d6c16 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Fix: Only migrate users which have the TOS accepted (coscine/issues#1782)

parent 7b438363
No related branches found
No related tags found
1 merge request!12Fix: Only migrate users which have the TOS accepted
Pipeline #786123 passed
...@@ -11,6 +11,12 @@ namespace SQL2Linked.Implementations ...@@ -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 rdf = new("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
public readonly Uri foaf = new("http://xmlns.com/foaf/0.1/"); 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) public override IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<User> entries)
{ {
var graphs = new List<IGraph>(); var graphs = new List<IGraph>();
......
...@@ -25,11 +25,16 @@ namespace SQL2Linked ...@@ -25,11 +25,16 @@ namespace SQL2Linked
public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries); public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries);
public virtual IEnumerable<S> GetAll()
{
return Model.GetAll();
}
public void Migrate(bool dummyMode) public void Migrate(bool dummyMode)
{ {
var spacer = new string('-', 35); var spacer = new string('-', 35);
Console.WriteLine($"\n{spacer}\n{typeof(T).Name}\n{spacer}"); Console.WriteLine($"\n{spacer}\n{typeof(T).Name}\n{spacer}");
var graphs = ConvertToLinkedData(Model.GetAll()); var graphs = ConvertToLinkedData(GetAll());
if (!dummyMode) if (!dummyMode)
{ {
StoreGraphs(graphs); StoreGraphs(graphs);
...@@ -56,6 +61,7 @@ namespace SQL2Linked ...@@ -56,6 +61,7 @@ namespace SQL2Linked
Console.WriteLine(); Console.WriteLine();
} }
} }
public void AssertToGraphUriNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject) public void AssertToGraphUriNode(IGraph graph, string graphSubject, string graphPredicate, string graphObject)
{ {
graph.Assert( graph.Assert(
...@@ -66,6 +72,7 @@ namespace SQL2Linked ...@@ -66,6 +72,7 @@ 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)
{ {
graph.Assert( graph.Assert(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment