Skip to content

Commit

Permalink
Slight code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco De Salvo committed Dec 5, 2024
1 parent e418e70 commit a4ef38a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
3 changes: 1 addition & 2 deletions RDFSharp.Test/Query/Mirella/RDFQueryEngineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void ShouldCreateQueryEngine()
Assert.IsNotNull(queryEngine);
Assert.IsNotNull(queryEngine.PatternGroupMemberResultTables);
Assert.IsNotNull(queryEngine.QueryMemberResultTables);
Assert.IsTrue(RDFQueryEngine.SystemString.Equals(typeof(string)));
}

[TestMethod]
Expand Down Expand Up @@ -5405,7 +5404,7 @@ public void ShouldAddDataColumn()

Assert.IsTrue(table.Columns.Count == 1);
Assert.IsTrue(string.Equals(table.Columns[0].ColumnName, "?COL"));
Assert.IsTrue(table.Columns[0].DataType.Equals(RDFQueryEngine.SystemString));
Assert.IsTrue(table.Columns[0].DataType.Equals(typeof(string)));
}

[TestMethod]
Expand Down
6 changes: 3 additions & 3 deletions RDFSharp/Model/RDFGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@ public DataTable ToDataTable()
{
//Create the structure of the result datatable
DataTable result = new DataTable(ToString());
result.Columns.Add("?SUBJECT", RDFQueryEngine.SystemString);
result.Columns.Add("?PREDICATE", RDFQueryEngine.SystemString);
result.Columns.Add("?OBJECT", RDFQueryEngine.SystemString);
result.Columns.Add("?SUBJECT", typeof(string));
result.Columns.Add("?PREDICATE", typeof(string));
result.Columns.Add("?OBJECT", typeof(string));

//Iterate the triples of the graph to populate the result datatable
result.BeginLoadData();
Expand Down
16 changes: 8 additions & 8 deletions RDFSharp/Query/Mirella/RDFOperationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ private DataTable PopulateInsertOperationResults(List<RDFPattern> insertDataTemp
{
DataTable resultTable = new DataTable("INSERT_RESULTS");
if (datasource.IsStore())
resultTable.Columns.Add("?CONTEXT", SystemString);
resultTable.Columns.Add("?SUBJECT", SystemString);
resultTable.Columns.Add("?PREDICATE", SystemString);
resultTable.Columns.Add("?OBJECT", SystemString);
resultTable.Columns.Add("?CONTEXT", typeof(string));
resultTable.Columns.Add("?SUBJECT", typeof(string));
resultTable.Columns.Add("?PREDICATE", typeof(string));
resultTable.Columns.Add("?OBJECT", typeof(string));

Dictionary<string, string> bindings = new Dictionary<string, string>();
insertDataTemplates.ForEach(insertTemplate =>
Expand Down Expand Up @@ -469,10 +469,10 @@ private DataTable PopulateDeleteOperationResults(List<RDFPattern> deleteDataTemp
{
DataTable resultTable = new DataTable("DELETE_RESULTS");
if (datasource.IsStore())
resultTable.Columns.Add("?CONTEXT", SystemString);
resultTable.Columns.Add("?SUBJECT", SystemString);
resultTable.Columns.Add("?PREDICATE", SystemString);
resultTable.Columns.Add("?OBJECT", SystemString);
resultTable.Columns.Add("?CONTEXT", typeof(string));
resultTable.Columns.Add("?SUBJECT", typeof(string));
resultTable.Columns.Add("?PREDICATE", typeof(string));
resultTable.Columns.Add("?OBJECT", typeof(string));

Dictionary<string, string> bindings = new Dictionary<string, string>();
deleteDataTemplates.ForEach(deleteTemplate =>
Expand Down
7 changes: 1 addition & 6 deletions RDFSharp/Query/Mirella/RDFQueryEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ internal class RDFQueryEngine
/// </summary>
internal Dictionary<long, DataTable> QueryMemberResultTables { get; set; }

/// <summary>
/// Default column type used for Mirella tables
/// </summary>
internal static readonly Type SystemString = typeof(string);

/// <summary>
/// Attribute denoting an optional pattern/patternGroup/query
/// </summary>
Expand Down Expand Up @@ -1405,7 +1400,7 @@ internal static void AddColumn(DataTable table, string columnName)
{
string colName = columnName.Trim().ToUpperInvariant();
if (!table.Columns.Contains(colName))
table.Columns.Add(colName, SystemString);
table.Columns.Add(colName, typeof(string));
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions RDFSharp/Store/RDFStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ public DataTable ToDataTable()
{
//Create the structure of the result datatable
DataTable result = new DataTable(ToString());
result.Columns.Add("?CONTEXT", RDFQueryEngine.SystemString);
result.Columns.Add("?SUBJECT", RDFQueryEngine.SystemString);
result.Columns.Add("?PREDICATE", RDFQueryEngine.SystemString);
result.Columns.Add("?OBJECT", RDFQueryEngine.SystemString);
result.Columns.Add("?CONTEXT", typeof(string));
result.Columns.Add("?SUBJECT", typeof(string));
result.Columns.Add("?PREDICATE", typeof(string));
result.Columns.Add("?OBJECT", typeof(string));

//Iterate the quadruples of the store to populate the result datatable
result.BeginLoadData();
Expand Down

0 comments on commit a4ef38a

Please sign in to comment.