From a6cee37021c74bf0ac411ae68b9f0a03ccd1aa5e Mon Sep 17 00:00:00 2001
From: Petar Hristov <hristov@itc.rwth-aachen.de>
Date: Tue, 20 Sep 2022 10:22:28 +0200
Subject: [PATCH] Fix: dates

---
 src/SQL2Linked/Implementations/ProjectStructuralData.cs  | 4 ++--
 src/SQL2Linked/Implementations/ResourceStructuralData.cs | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/SQL2Linked/Implementations/ProjectStructuralData.cs b/src/SQL2Linked/Implementations/ProjectStructuralData.cs
index 5106892..1204d84 100644
--- a/src/SQL2Linked/Implementations/ProjectStructuralData.cs
+++ b/src/SQL2Linked/Implementations/ProjectStructuralData.cs
@@ -60,10 +60,10 @@ namespace SQL2Linked.Implementations
                 AssertToGraphLiteralNode(graph, projectGraphName, dcterms + "description", entry.Description);
                 Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcterms}description {entry.Description}'. ");
 
-                AssertToGraphLiteralNode(graph, projectGraphName, dcat + "startDate", entry.StartDate.ToString());
+                AssertToGraphLiteralNode(graph, projectGraphName, dcat + "startDate", entry.StartDate.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
                 Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}startDate {entry.StartDate}'. ");
 
-                AssertToGraphLiteralNode(graph, projectGraphName, dcat + "endDate", entry.EndDate.ToString());
+                AssertToGraphLiteralNode(graph, projectGraphName, dcat + "endDate", entry.EndDate.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
                 Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{projectGraphName} {dcat}endDate {entry.EndDate}'. ");
 
                 if (!string.IsNullOrWhiteSpace(entry.Keywords))
diff --git a/src/SQL2Linked/Implementations/ResourceStructuralData.cs b/src/SQL2Linked/Implementations/ResourceStructuralData.cs
index 69ff81d..886f212 100644
--- a/src/SQL2Linked/Implementations/ResourceStructuralData.cs
+++ b/src/SQL2Linked/Implementations/ResourceStructuralData.cs
@@ -116,8 +116,11 @@ namespace SQL2Linked.Implementations
                 AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#fixedValues", entry.FixedValues);
                 Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#fixedValues {entry.FixedValues}'. ");
 
-                AssertToGraphUriNode(graph, resourceGraphName, dcterms + "creator", cosc + $"users/{entry.Creator}");
-                Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}creator {cosc}users/{entry.Creator}'. ");
+                if (entry.Creator is not null)
+                {
+                    AssertToGraphUriNode(graph, resourceGraphName, dcterms + "creator", cosc + $"users/{entry.Creator}");
+                    Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}creator {cosc}users/{entry.Creator}'. ");
+                }
 
                 AssertToGraphLiteralNode(graph, resourceGraphName, cosc + "terms/resource#archived", entry.Archived.ToString().ToLower(), new Uri("http://www.w3.org/2001/XMLSchema#boolean"));
                 Console.WriteLine($"For resource '{entry.DisplayName}' will migrate triple '{resourceGraphName} {cosc}terms/resource#archived {entry.Archived}'. ");
@@ -170,7 +173,7 @@ namespace SQL2Linked.Implementations
 
                 if (entry.DateCreated is not null && entry.DateCreated.HasValue)
                 {
-                    AssertToGraphLiteralNode(graph, resourceGraphName, dcterms + "created", entry.DateCreated.Value.ToString());
+                    AssertToGraphLiteralNode(graph, resourceGraphName, dcterms + "created", entry.DateCreated.Value.ToString(), new Uri("http://www.w3.org/2001/XMLSchema#dateTime"));
                     Console.WriteLine($"For project '{entry.DisplayName}' will migrate triple '{resourceGraphName} {dcterms}created {entry.DateCreated}'. ");
                 }
 
-- 
GitLab