diff --git a/RDFSharp.Test/Model/RDFGraphTest.cs b/RDFSharp.Test/Model/RDFGraphTest.cs index 3960cdca5..086fe7a3d 100644 --- a/RDFSharp.Test/Model/RDFGraphTest.cs +++ b/RDFSharp.Test/Model/RDFGraphTest.cs @@ -1774,7 +1774,7 @@ public void ShouldRaiseExceptionOnImportingFromNullDataTable() => Assert.ThrowsException(() => RDFGraph.FromDataTable(null)); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableNotHaving3Columns() + public void ShouldRaiseExceptionOnImportingFromDataTableNotHavingMandatoryColumns() { DataTable table = new DataTable(); table.Columns.Add("?SUBJECT", typeof(string)); diff --git a/RDFSharp.Test/Store/Engines/RDFMemoryStoreTest.cs b/RDFSharp.Test/Store/Engines/RDFMemoryStoreTest.cs index c0b19e2d2..e49c28a13 100644 --- a/RDFSharp.Test/Store/Engines/RDFMemoryStoreTest.cs +++ b/RDFSharp.Test/Store/Engines/RDFMemoryStoreTest.cs @@ -1248,12 +1248,12 @@ public async Task ShouldImportEmptyFromFileAsync(string fileExtension, RDFStoreE } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromNullOrEmptyFilepathAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromFileAsync(RDFStoreEnums.RDFFormats.NQuads, null)); + public async Task ShouldRaiseExceptionOnImportingFromNullOrEmptyFilepathAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromFileAsync(RDFStoreEnums.RDFFormats.NQuads, null)); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromUnexistingFilepathAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromFileAsync(RDFStoreEnums.RDFFormats.NQuads, "blablabla")); + public async Task ShouldRaiseExceptionOnImportingFromUnexistingFilepathAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromFileAsync(RDFStoreEnums.RDFFormats.NQuads, "blablabla")); [DataTestMethod] [DataRow(RDFStoreEnums.RDFFormats.NQuads)] @@ -1380,8 +1380,8 @@ public async Task ShouldImportFromEmptyStreamAsync(RDFStoreEnums.RDFFormats form } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromNullStreamAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromStreamAsync(RDFStoreEnums.RDFFormats.NQuads, null)); + public async Task ShouldRaiseExceptionOnImportingFromNullStreamAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromStreamAsync(RDFStoreEnums.RDFFormats.NQuads, null)); [TestMethod] public void ShouldImportFromDataTable() @@ -1437,7 +1437,7 @@ public void ShouldRaiseExceptionOnImportingFromNullDataTable() => Assert.ThrowsException(() => RDFMemoryStore.FromDataTable(null)); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableNotHaving4Columns() + public void ShouldRaiseExceptionOnImportingFromDataTableNotHavingMandatoryColumns() { DataTable table = new DataTable(); table.Columns.Add("?SUBJECT", typeof(string)); @@ -1459,7 +1459,7 @@ public void ShouldRaiseExceptionOnImportingFromDataTableNotHavingExactColumns() } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullContext() + public void ShouldImportFromDataTableHavingRowWithNullContext() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1468,11 +1468,15 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullContext table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add(null, "http://subj/", "http://pred/", "http://obj/"); - Assert.ThrowsException(() => RDFMemoryStore.FromDataTable(table)); + RDFMemoryStore store = RDFMemoryStore.FromDataTable(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext(), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyContext() + public void ShouldImportFromDataTableHavingRowWithEmptyContext() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1481,7 +1485,28 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyContex table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("", "http://subj/", "http://pred/", "http://obj/"); - Assert.ThrowsException(() => RDFMemoryStore.FromDataTable(table)); + RDFMemoryStore store = RDFMemoryStore.FromDataTable(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext(), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); + } + + [TestMethod] + public void ShouldImportFromDataTableHavingRowWithValorizedContext() + { + DataTable table = new DataTable(); + table.Columns.Add("?CONTEXT", typeof(string)); + table.Columns.Add("?SUBJECT", typeof(string)); + table.Columns.Add("?PREDICATE", typeof(string)); + table.Columns.Add("?OBJECT", typeof(string)); + table.Rows.Add("http://ctx/", "http://subj/", "http://pred/", "http://obj/"); + + RDFMemoryStore store = RDFMemoryStore.FromDataTable(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext("http://ctx/"), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); } [TestMethod] @@ -1651,21 +1676,21 @@ public async Task ShouldImportEmptyFromDataTableAsync() } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromNullDataTableAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(null)); + public async Task ShouldRaiseExceptionOnImportingFromNullDataTableAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(null)); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableNotHaving4ColumnsAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableNotHavingMandatoryColumnsAsync() { DataTable table = new DataTable(); table.Columns.Add("?SUBJECT", typeof(string)); table.Columns.Add("?PREDICATE", typeof(string)); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableNotHavingExactColumnsAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableNotHavingExactColumnsAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1673,11 +1698,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableNotHavingExactColumnsAsy table.Columns.Add("?PREDICATE", typeof(string)); table.Columns.Add("?OBJECTTTTT", typeof(string)); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullContextAsync() + public async Task ShouldImportFromDataTableHavingRowWithNullContextAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1686,11 +1711,15 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullContext table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add(null, "http://subj/", "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + RDFMemoryStore store = await RDFMemoryStore.FromDataTableAsync(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext(), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyContextAsync() + public async Task ShouldImportFromDataTableHavingRowWithEmptyContextAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1699,11 +1728,32 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyContex table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("", "http://subj/", "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + RDFMemoryStore store = await RDFMemoryStore.FromDataTableAsync(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext(), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); + } + + [TestMethod] + public async Task ShouldImportFromDataTableHavingRowWithValorizedContextAsync() + { + DataTable table = new DataTable(); + table.Columns.Add("?CONTEXT", typeof(string)); + table.Columns.Add("?SUBJECT", typeof(string)); + table.Columns.Add("?PREDICATE", typeof(string)); + table.Columns.Add("?OBJECT", typeof(string)); + table.Rows.Add("http://ctx/", "http://subj/", "http://pred/", "http://obj/"); + + RDFMemoryStore store = await RDFMemoryStore.FromDataTableAsync(table); + + Assert.IsNotNull(store); + Assert.IsTrue(store.QuadruplesCount == 1); + Assert.IsTrue(store[new RDFContext("http://ctx/"), new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"), null].QuadruplesCount == 1); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralContextAsync() + public async Task ShouldImportFromDataTableHavingRowWithLiteralContextAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1712,11 +1762,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralCont table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("hello@en", "http://subj/", "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullSubjectAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullSubjectAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1725,11 +1775,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullSubject table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", null, "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptySubjectAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptySubjectAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1738,11 +1788,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptySubjec table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "", "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralSubjectAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralSubjectAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1751,11 +1801,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralSubj table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "hello@en", "http://pred/", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullPredicateAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullPredicateAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1764,11 +1814,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullPredica table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "http://subj/", null, "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyPredicateAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyPredicateAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1777,11 +1827,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithEmptyPredic table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "http://subj/", "", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithBlankPredicateAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithBlankPredicateAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1790,11 +1840,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithBlankPredic table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "http://subj/", "bnode:12345", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralPredicateAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralPredicateAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1803,11 +1853,11 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithLiteralPred table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "http://subj/", "hello@en", "http://obj/"); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullObjectAsync() + public async Task ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullObjectAsync() { DataTable table = new DataTable(); table.Columns.Add("?CONTEXT", typeof(string)); @@ -1816,7 +1866,7 @@ public void ShouldRaiseExceptionOnImportingFromDataTableHavingRowWithNullObjectA table.Columns.Add("?OBJECT", typeof(string)); table.Rows.Add("http://ctx/", "http://subj/", "http://pred/", null); - Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); + await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromDataTableAsync(table)); } [TestMethod] @@ -1846,16 +1896,16 @@ public async Task ShouldImportFromUriAsync() } [TestMethod] - public void ShouldRaiseExceptionOnImportingFromNullUriAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(null)); + public async Task ShouldRaiseExceptionOnImportingFromNullUriAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(null)); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromRelativeUriAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(new Uri("/file/system", UriKind.Relative))); + public async Task ShouldRaiseExceptionOnImportingFromRelativeUriAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(new Uri("/file/system", UriKind.Relative))); [TestMethod] - public void ShouldRaiseExceptionOnImportingFromUnreacheableUriAsync() - => Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(new Uri("http://rdfsharp.test/"))); + public async Task ShouldRaiseExceptionOnImportingFromUnreacheableUriAsync() + => await Assert.ThrowsExceptionAsync(() => RDFMemoryStore.FromUriAsync(new Uri("http://rdfsharp.test/"))); [TestCleanup] public void Cleanup() diff --git a/RDFSharp/Model/RDFGraph.cs b/RDFSharp/Model/RDFGraph.cs index 35016460e..e9172a3e3 100644 --- a/RDFSharp/Model/RDFGraph.cs +++ b/RDFSharp/Model/RDFGraph.cs @@ -716,8 +716,6 @@ public static RDFGraph FromDataTable(DataTable table, bool enableDatatypeDiscove #region Guards if (table == null) throw new RDFModelException("Cannot read RDF graph from datatable because given \"table\" parameter is null."); - if (table.Columns.Count != 3) - throw new RDFModelException("Cannot read RDF graph from datatable because given \"table\" parameter does not have exactly 3 columns."); if (!(table.Columns.Contains("?SUBJECT") && table.Columns.Contains("?PREDICATE") && table.Columns.Contains("?OBJECT"))) throw new RDFModelException("Cannot read RDF graph from datatable because given \"table\" parameter does not have the required columns \"?SUBJECT\", \"?PREDICATE\", \"?OBJECT\"."); #endregion diff --git a/RDFSharp/Store/Engines/RDFMemoryStore.cs b/RDFSharp/Store/Engines/RDFMemoryStore.cs index 1faf1fbb8..1fdd5583f 100644 --- a/RDFSharp/Store/Engines/RDFMemoryStore.cs +++ b/RDFSharp/Store/Engines/RDFMemoryStore.cs @@ -775,26 +775,34 @@ public static RDFMemoryStore FromDataTable(DataTable table, bool enableDatatypeD #region Guards if (table == null) throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter is null."); - if (table.Columns.Count != 4) - throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter does not have exactly 4 columns."); - if (!(table.Columns.Contains("?CONTEXT") && table.Columns.Contains("?SUBJECT") && table.Columns.Contains("?PREDICATE") && table.Columns.Contains("?OBJECT"))) - throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter does not have the required columns \"?CONTEXT\", \"?SUBJECT\", \"?PREDICATE\", \"?OBJECT\"."); + if (!(table.Columns.Contains("?SUBJECT") && table.Columns.Contains("?PREDICATE") && table.Columns.Contains("?OBJECT"))) + throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter does not have the required columns \"?SUBJECT\", \"?PREDICATE\", \"?OBJECT\"."); #endregion RDFMemoryStore memStore = new RDFMemoryStore(); + RDFContext defaultContext = new RDFContext(); + bool hasContextColumn = table.Columns.Contains("?CONTEXT"); #region Parse Table foreach (DataRow tableRow in table.Rows) { #region CONTEXT - if (tableRow.IsNull("?CONTEXT") || string.IsNullOrEmpty(tableRow["?CONTEXT"].ToString())) - throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter contains a row having null or empty value in the \"?CONTEXT\" column."); - - RDFPatternMember rowCtx = RDFQueryUtilities.ParseRDFPatternMember(tableRow["?CONTEXT"].ToString()); - if (!(rowCtx is RDFResource)) - throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter contains a row not having a resource in the \"?CONTEXT\" column."); - if (((RDFResource)rowCtx).IsBlank) - throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter contains a row having a blank resource in the \"?CONTEXT\" column."); + RDFPatternMember rowContext; + if (hasContextColumn) + { + if (tableRow.IsNull("?CONTEXT") || string.IsNullOrEmpty(tableRow["?CONTEXT"].ToString())) + rowContext = defaultContext; + else + { + rowContext = RDFQueryUtilities.ParseRDFPatternMember(tableRow["?CONTEXT"].ToString()); + if (!(rowContext is RDFResource)) + throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter contains a row not having a resource in the \"?CONTEXT\" column."); + if (((RDFResource)rowContext).IsBlank) + throw new RDFStoreException("Cannot read RDF memory store from datatable because given \"table\" parameter contains a row having a blank resource in the \"?CONTEXT\" column."); + } + } + else + rowContext = defaultContext; #endregion #region SUBJECT @@ -823,9 +831,9 @@ public static RDFMemoryStore FromDataTable(DataTable table, bool enableDatatypeD RDFPatternMember rowObj = RDFQueryUtilities.ParseRDFPatternMember(tableRow["?OBJECT"].ToString()); if (rowObj is RDFResource objRes) - memStore.AddQuadruple(new RDFQuadruple(new RDFContext(rowCtx.ToString()), (RDFResource)rowSubj, (RDFResource)rowPred, objRes)); + memStore.AddQuadruple(new RDFQuadruple(new RDFContext(rowContext.ToString()), (RDFResource)rowSubj, (RDFResource)rowPred, objRes)); else - memStore.AddQuadruple(new RDFQuadruple(new RDFContext(rowCtx.ToString()), (RDFResource)rowSubj, (RDFResource)rowPred, (RDFLiteral)rowObj)); + memStore.AddQuadruple(new RDFQuadruple(new RDFContext(rowContext.ToString()), (RDFResource)rowSubj, (RDFResource)rowPred, (RDFLiteral)rowObj)); #endregion } #endregion