From db5050c66df3525a2625dd0429e3167c59111b60 Mon Sep 17 00:00:00 2001
From: Hanna Fuehr <fuehr@itc.rwth-aachen.de>
Date: Wed, 10 Aug 2022 10:59:42 +0200
Subject: [PATCH] hopefully final fixes

---
 .../Implementations/ResourceStructuralData.cs | 25 ++++++++-----------
 src/SQL2Linked/StructuralData.cs              |  2 +-
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/SQL2Linked/Implementations/ResourceStructuralData.cs b/src/SQL2Linked/Implementations/ResourceStructuralData.cs
index 891ff8a..6a4ed8f 100644
--- a/src/SQL2Linked/Implementations/ResourceStructuralData.cs
+++ b/src/SQL2Linked/Implementations/ResourceStructuralData.cs
@@ -1,6 +1,5 @@
 using Coscine.Database.DataModel;
 using Coscine.Database.Models;
-using Coscine.Configuration;
 using VDS.RDF;
 using VDS.RDF.Query;
 
@@ -113,27 +112,25 @@ namespace SQL2Linked.Implementations
                     Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcat}catalog {result[0].ToString()}'. ");
                 }
 
-                var blankNode= graph.CreateBlankNode(entry.Id.ToString());
-
-                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)
                 {
                     if (entry.Id == projectResource.ResourceId)
                     {
+                        var blankNode = graph.CreateBlankNode();
+
+                        AssertToGraphBlankAndUriNode(graph, blankNode, rdf + "type", acl + "Authorization");
+                        Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {rdf}type {acl}Authorization'. ");
+
                         AssertToGraphBlankAndUriNode(graph, blankNode, acl + "agentGroup", $"{resourceUrlPrefix}/{projectResource.ProjectId}");
                         Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}agentGroup {resourceUrlPrefix}/{projectResource.ProjectId}'. ");
-                        break;
-                    }
-                }
-
-                AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName);
-                Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. ");
 
-                AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Control");
-                Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Control'. ");
+                        AssertToGraphBlankAndUriNode(graph, blankNode, acl + "accessTo", resourceGraphName);
+                        Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {resourceGraphName}'. ");
 
+                        AssertToGraphBlankAndUriNode(graph, blankNode, acl + "mode", acl + "Control");
+                        Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{blankNode} {acl}accessTo {acl}Control'. ");
+                    }
+                }
                 graphs.Add(graph);
             }
             return graphs;
diff --git a/src/SQL2Linked/StructuralData.cs b/src/SQL2Linked/StructuralData.cs
index a9c9ec0..4d2e231 100644
--- a/src/SQL2Linked/StructuralData.cs
+++ b/src/SQL2Linked/StructuralData.cs
@@ -20,7 +20,7 @@ namespace SQL2Linked
             RdfStoreConnector = new RdfStoreConnector(Configuration.GetStringAndWait("coscine/local/virtuoso/additional/url"));
             Model = new T();
             Prefix = Configuration.GetStringAndWait("coscine/global/epic/prefix");
-            QueryEndpoint = new SparqlRemoteEndpoint(new Uri(string.Format("http://localhost:8890/sparql")));
+            QueryEndpoint = new SparqlRemoteEndpoint(new Uri(Configuration.GetStringAndWait("coscine/local/virtuoso/additional/url")));
         }
 
         public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries);
-- 
GitLab