Skip to content

Commit 33ca6a7

Browse files
authored
Sync to latest developments (#320)
1 parent 4f031b2 commit 33ca6a7

27 files changed

+58
-19
lines changed

RDFSharp.Test/RDFSharp.Test.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
1515
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
1616
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
17-
<PackageReference Include="WireMock.Net" Version="1.5.35" />
17+
<PackageReference Include="WireMock.Net" Version="1.5.36" />
1818
<PackageReference Include="coverlet.collector" Version="6.0.0">
1919
<PrivateAssets>all</PrivateAssets>
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFAvgAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public RDFAvgAggregator(RDFVariable aggrVariable, RDFVariable projVariable) : ba
4040
/// </summary>
4141
public override string ToString()
4242
=> IsDistinct ? string.Format("(AVG(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
43-
: string.Format("(AVG({0}) AS {1})", AggregatorVariable, ProjectionVariable);
43+
: string.Format("(AVG({0}) AS {1})", AggregatorVariable, ProjectionVariable);
4444
#endregion
4545

4646
#region Methods

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFCountAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public RDFCountAggregator(RDFVariable aggrVariable, RDFVariable projVariable) :
4040
/// </summary>
4141
public override string ToString()
4242
=> IsDistinct ? string.Format("(COUNT(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
43-
: string.Format("(COUNT({0}) AS {1})", AggregatorVariable, ProjectionVariable);
43+
: string.Format("(COUNT({0}) AS {1})", AggregatorVariable, ProjectionVariable);
4444
#endregion
4545

4646
#region Methods

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFMaxAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public RDFMaxAggregator(RDFVariable aggrVariable, RDFVariable projVariable, RDFQ
4848
/// </summary>
4949
public override string ToString()
5050
=> IsDistinct ? string.Format("(MAX(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
51-
: string.Format("(MAX({0}) AS {1})", AggregatorVariable, ProjectionVariable);
51+
: string.Format("(MAX({0}) AS {1})", AggregatorVariable, ProjectionVariable);
5252
#endregion
5353

5454
#region Methods

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFMinAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public RDFMinAggregator(RDFVariable aggrVariable, RDFVariable projVariable, RDFQ
4848
/// </summary>
4949
public override string ToString()
5050
=> IsDistinct ? string.Format("(MIN(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
51-
: string.Format("(MIN({0}) AS {1})", AggregatorVariable, ProjectionVariable);
51+
: string.Format("(MIN({0}) AS {1})", AggregatorVariable, ProjectionVariable);
5252
#endregion
5353

5454
#region Methods

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFSampleAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public RDFSampleAggregator(RDFVariable aggrVariable, RDFVariable projVariable) :
3838
/// </summary>
3939
public override string ToString()
4040
=> IsDistinct ? string.Format("(SAMPLE(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
41-
: string.Format("(SAMPLE({0}) AS {1})", AggregatorVariable, ProjectionVariable);
41+
: string.Format("(SAMPLE({0}) AS {1})", AggregatorVariable, ProjectionVariable);
4242
#endregion
4343

4444
#region Methods

RDFSharp/Query/Mirella/Algebra/Aggregators/RDFSumAggregator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public RDFSumAggregator(RDFVariable aggrVariable, RDFVariable projVariable) : ba
4141
/// </summary>
4242
public override string ToString()
4343
=> IsDistinct ? string.Format("(SUM(DISTINCT {0}) AS {1})", AggregatorVariable, ProjectionVariable)
44-
: string.Format("(SUM({0}) AS {1})", AggregatorVariable, ProjectionVariable);
44+
: string.Format("(SUM({0}) AS {1})", AggregatorVariable, ProjectionVariable);
4545
#endregion
4646

4747
#region Methods

RDFSharp/Query/Mirella/Algebra/Filters/RDFBooleanAndFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class RDFBooleanAndFilter : RDFFilter
4343
/// </summary>
4444
public RDFBooleanAndFilter(RDFFilter leftFilter, RDFFilter rightFilter)
4545
{
46+
#region Guards
4647
if (leftFilter == null)
4748
throw new RDFQueryException("Cannot create RDFBooleanAndFilter because given \"leftFilter\" parameter is null.");
4849
if (leftFilter is RDFExistsFilter)
@@ -51,6 +52,7 @@ public RDFBooleanAndFilter(RDFFilter leftFilter, RDFFilter rightFilter)
5152
throw new RDFQueryException("Cannot create RDFBooleanAndFilter because given \"rightFilter\" parameter is null.");
5253
if (rightFilter is RDFExistsFilter)
5354
throw new RDFQueryException("Cannot create RDFBooleanAndFilter because given \"rightFilter\" parameter is of type RDFExistsFilter: this is not allowed.");
55+
#endregion
5456

5557
LeftFilter = leftFilter;
5658
RightFilter = rightFilter;

RDFSharp/Query/Mirella/Algebra/Filters/RDFBooleanNotFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ public class RDFBooleanNotFilter : RDFFilter
3838
/// </summary>
3939
public RDFBooleanNotFilter(RDFFilter filter)
4040
{
41+
#region Guards
4142
if (filter == null)
4243
throw new RDFQueryException("Cannot create RDFBooleanNotFilter because given \"filter\" parameter is null.");
4344
if (filter is RDFExistsFilter)
4445
throw new RDFQueryException("Cannot create RDFBooleanNotFilter because given \"filter\" parameter is of type RDFExistsFilter: this is not allowed.");
46+
#endregion
4547

4648
Filter = filter;
4749
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFBooleanOrFilter.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class RDFBooleanOrFilter : RDFFilter
4343
/// </summary>
4444
public RDFBooleanOrFilter(RDFFilter leftFilter, RDFFilter rightFilter)
4545
{
46+
#region Guards
4647
if (leftFilter == null)
4748
throw new RDFQueryException("Cannot create RDFBooleanOrFilter because given \"leftFilter\" parameter is null.");
4849
if (leftFilter is RDFExistsFilter)
@@ -51,7 +52,8 @@ public RDFBooleanOrFilter(RDFFilter leftFilter, RDFFilter rightFilter)
5152
throw new RDFQueryException("Cannot create RDFBooleanOrFilter because given \"rightFilter\" parameter is null.");
5253
if (rightFilter is RDFExistsFilter)
5354
throw new RDFQueryException("Cannot create RDFBooleanOrFilter because given \"rightFilter\" parameter is of type RDFExistsFilter: this is not allowed.");
54-
55+
#endregion
56+
5557
LeftFilter = leftFilter;
5658
RightFilter = rightFilter;
5759
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFBoundFilter.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ public class RDFBoundFilter : RDFFilter
3838
/// </summary>
3939
public RDFBoundFilter(RDFVariable variable)
4040
{
41+
#region Guards
4142
if (variable == null)
4243
throw new RDFQueryException("Cannot create RDFBoundFilter because given \"variable\" parameter is null.");
43-
44+
#endregion
45+
4446
VariableName = variable.ToString();
4547
}
4648
#endregion

RDFSharp/Query/Mirella/Algebra/Filters/RDFComparisonFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ public class RDFComparisonFilter : RDFFilter
5050
/// </summary>
5151
public RDFComparisonFilter(RDFQueryEnums.RDFComparisonFlavors comparisonFlavor, RDFPatternMember leftMember, RDFPatternMember rightMember)
5252
{
53+
#region Guards
5354
if (leftMember == null)
5455
throw new RDFQueryException("Cannot create RDFComparisonFilter because given \"leftMember\" parameter is null.");
5556
if (rightMember == null)
5657
throw new RDFQueryException("Cannot create RDFComparisonFilter because given \"rightMember\" parameter is null.");
58+
#endregion
5759

5860
ComparisonFlavor = comparisonFlavor;
5961
LeftMember = leftMember;

RDFSharp/Query/Mirella/Algebra/Filters/RDFDatatypeFilter.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ public class RDFDatatypeFilter : RDFFilter
4949
/// </summary>
5050
public RDFDatatypeFilter(RDFVariable variable, RDFModelEnums.RDFDatatypes datatype)
5151
{
52+
#region Guards
5253
if (variable == null)
5354
throw new RDFQueryException("Cannot create RDFDatatypeFilter because given \"variable\" parameter is null.");
55+
#endregion
5456

5557
VariableName = variable.ToString();
5658
Datatype = datatype;
@@ -67,7 +69,9 @@ public override string ToString()
6769
internal override string ToString(List<RDFNamespace> prefixes)
6870
=> string.Concat(
6971
"FILTER ( DATATYPE(", VariableName, ") = ",
70-
RDFQueryPrinter.PrintPatternMember(RDFQueryUtilities.ParseRDFPatternMember(RDFModelUtilities.GetDatatypeFromEnum(Datatype)), prefixes), " )");
72+
RDFQueryPrinter.PrintPatternMember(
73+
RDFQueryUtilities.ParseRDFPatternMember(
74+
RDFModelUtilities.GetDatatypeFromEnum(Datatype)), prefixes), " )");
7175
#endregion
7276

7377
#region Methods

RDFSharp/Query/Mirella/Algebra/Filters/RDFExistsFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ public class RDFExistsFilter : RDFFilter
4444
/// </summary>
4545
public RDFExistsFilter(RDFPattern pattern)
4646
{
47+
#region Guards
4748
if (pattern == null)
4849
throw new RDFQueryException("Cannot create RDFExistsFilter because given \"pattern\" parameter is null.");
4950
if (pattern.Variables.Count == 0)
5051
throw new RDFQueryException("Cannot create RDFExistsFilter because given \"pattern\" parameter is a ground pattern.");
52+
#endregion
5153

5254
Pattern = pattern;
5355
IsEvaluable = true;

RDFSharp/Query/Mirella/Algebra/Filters/RDFInFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ public class RDFInFilter : RDFFilter
4444
/// </summary>
4545
public RDFInFilter(RDFPatternMember termToSearch, List<RDFPatternMember> inTerms)
4646
{
47+
#region Guards
4748
if (termToSearch == null)
4849
throw new RDFQueryException("Cannot create RDFInFilter because given \"termToSearch\" parameter is null.");
50+
#endregion
4951

5052
TermToSearch = termToSearch;
5153
InTerms = inTerms ?? new List<RDFPatternMember>();

RDFSharp/Query/Mirella/Algebra/Filters/RDFIsBlankFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public class RDFIsBlankFilter : RDFFilter
3939
/// </summary>
4040
public RDFIsBlankFilter(RDFVariable variable)
4141
{
42+
#region Guards
4243
if (variable == null)
4344
throw new RDFQueryException("Cannot create RDFIsBlankFilter because given \"variable\" parameter is null.");
45+
#endregion
4446

4547
VariableName = variable.ToString();
4648
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFIsLiteralFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ public class RDFIsLiteralFilter : RDFFilter
4040
/// </summary>
4141
public RDFIsLiteralFilter(RDFVariable variable)
4242
{
43+
#region Guards
4344
if (variable == null)
4445
throw new RDFQueryException("Cannot create RDFIsLiteralFilter because given \"variable\" parameter is null.");
46+
#endregion
4547

4648
VariableName = variable.ToString();
4749
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFIsNumericFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public class RDFIsNumericFilter : RDFFilter
3939
/// </summary>
4040
public RDFIsNumericFilter(RDFVariable variable)
4141
{
42+
#region Guards
4243
if (variable == null)
4344
throw new RDFQueryException("Cannot create RDFIsNumericFilter because given \"variable\" parameter is null.");
45+
#endregion
4446

4547
VariableName = variable.ToString();
4648
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFIsUriFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public class RDFIsUriFilter : RDFFilter
3939
/// </summary>
4040
public RDFIsUriFilter(RDFVariable variable)
4141
{
42+
#region Guards
4243
if (variable == null)
4344
throw new RDFQueryException("Cannot create RDFIsUriFilter because given \"variable\" parameter is null.");
45+
#endregion
4446

4547
VariableName = variable.ToString();
4648
}

RDFSharp/Query/Mirella/Algebra/Filters/RDFLangMatchesFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ public class RDFLangMatchesFilter : RDFFilter
5555
/// </summary>
5656
public RDFLangMatchesFilter(RDFVariable variable, string language)
5757
{
58+
#region Guards
5859
if (variable == null)
5960
throw new RDFQueryException("Cannot create RDFLangMatchesFilter because given \"variable\" parameter is null.");
61+
#endregion
6062

6163
bool acceptsNoneOrAnyLanguageTag = (string.IsNullOrEmpty(language) || language == "*");
6264
if (acceptsNoneOrAnyLanguageTag || RDFPlainLiteral.LangTag.Value.Match(language).Success)

RDFSharp/Query/Mirella/Algebra/Filters/RDFRegexFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public class RDFRegexFilter : RDFFilter
4545
/// </summary>
4646
public RDFRegexFilter(RDFVariable variable, Regex regex)
4747
{
48+
#region Guards
4849
if (variable == null)
4950
throw new RDFQueryException("Cannot create RDFRegexFilter because given \"variable\" parameter is null.");
5051
if (regex == null)
5152
throw new RDFQueryException("Cannot create RDFRegexFilter because given \"regex\" parameter is null.");
53+
#endregion
5254

5355
VariableName = variable.ToString();
5456
RegEx = regex;

RDFSharp/Query/Mirella/Algebra/Filters/RDFSameTermFilter.cs

+2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public class RDFSameTermFilter : RDFFilter
4545
/// </summary>
4646
public RDFSameTermFilter(RDFVariable variable, RDFPatternMember rdfTerm)
4747
{
48+
#region Guards
4849
if (variable == null)
4950
throw new RDFQueryException("Cannot create RDFSameTermFilter because given \"variable\" parameter is null.");
5051
if (rdfTerm == null)
5152
throw new RDFQueryException("Cannot create RDFSameTermFilter because given \"rdfTerm\" parameter is null.");
53+
#endregion
5254

5355
VariableName = variable.ToString();
5456
RDFTerm = rdfTerm;

RDFSharp/Query/Mirella/Algebra/Filters/RDFValuesFilter.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ internal override bool ApplyFilter(DataRow row, bool applyNegation)
8080
string filterColumnValue = row[filterColumn].ToString();
8181

8282
//Filter the enumerable representation of the filter table
83-
valuesTableEnumerable = valuesTableEnumerable.Where(binding => binding.IsNull(filterColumn) || binding[filterColumn].ToString().Equals(filterColumnValue, StringComparison.Ordinal));
83+
valuesTableEnumerable = valuesTableEnumerable.Where(binding =>
84+
binding.IsNull(filterColumn) || binding[filterColumn].ToString().Equals(filterColumnValue, StringComparison.Ordinal));
8485
});
8586

8687
//Analyze the response of the check

RDFSharp/Query/Mirella/Algebra/Modifiers/RDFGroupByModifier.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ public class RDFGroupByModifier : RDFModifier
4444
/// </summary>
4545
public RDFGroupByModifier(List<RDFVariable> partitionVariables)
4646
{
47+
#region Guards
4748
if (partitionVariables == null || partitionVariables.Count == 0)
4849
throw new RDFQueryException("Cannot create RDFGroupByModifier because given \"partitionVariables\" parameter is null or empty.");
4950
if (partitionVariables.Any(pv => pv == null))
5051
throw new RDFQueryException("Cannot create RDFGroupByModifier because given \"partitionVariables\" parameter contains null elements.");
52+
#endregion
5153

5254
PartitionVariables = new List<RDFVariable>();
5355
Aggregators = new List<RDFAggregator>();
@@ -116,19 +118,19 @@ private void ConsistencyChecks(DataTable table)
116118
{
117119
//Every partition variable must be found in the working table as a column
118120
IEnumerable<string> unavailablePartitionVariables = PartitionVariables.Where(pv => !table.Columns.Contains(pv.ToString()))
119-
.Select(pv => pv.ToString());
121+
.Select(pv => pv.ToString());
120122
if (unavailablePartitionVariables.Any())
121123
throw new RDFQueryException(string.Format("Cannot apply GroupBy modifier because the working table does not contain the following columns needed for partitioning: {0}", string.Join(",", unavailablePartitionVariables.Distinct())));
122124

123125
//Every aggregator variable must be found in the working table as a column
124126
IEnumerable<string> unavailableAggregatorVariables = Aggregators.Where(ag => !table.Columns.Contains(ag.AggregatorVariable.ToString()))
125-
.Select(ag => ag.AggregatorVariable.ToString());
127+
.Select(ag => ag.AggregatorVariable.ToString());
126128
if (unavailableAggregatorVariables.Any())
127129
throw new RDFQueryException(string.Format("Cannot apply GroupBy modifier because the working table does not contain the following columns needed for aggregation: {0}", string.Join(",", unavailableAggregatorVariables.Distinct())));
128130

129131
//There should NOT be intersection between partition variables (GroupBy) and projection variables (Aggregators)
130132
IEnumerable<string> commonPartitionProjectionVariables = PartitionVariables.Where(pv => Aggregators.Any(ag => (!(ag is RDFPartitionAggregator)) && pv.Equals(ag.ProjectionVariable)))
131-
.Select(pav => pav.ToString());
133+
.Select(pav => pav.ToString());
132134
if (commonPartitionProjectionVariables.Any())
133135
throw new RDFQueryException(string.Format("Cannot apply GroupBy modifier because the following variables have been specified both for partitioning (in GroupBy) and projection (in Aggregator): {0}", string.Join(",", commonPartitionProjectionVariables.Distinct())));
134136
}
@@ -170,9 +172,7 @@ private DataTable ExecuteFilterAlgorythm(DataTable resultTable)
170172
DataTable filteredTable = resultTable.Clone();
171173
IEnumerator rowsEnum = resultTable.Rows.GetEnumerator();
172174
IEnumerable<RDFComparisonFilter> havingFilters = Aggregators.Where(ag => ag.HavingClause.Item1)
173-
.Select(ag => new RDFComparisonFilter(ag.HavingClause.Item2,
174-
ag.ProjectionVariable,
175-
ag.HavingClause.Item3));
175+
.Select(ag => new RDFComparisonFilter(ag.HavingClause.Item2, ag.ProjectionVariable, ag.HavingClause.Item3));
176176
#region ExecuteFilters
177177
bool keepRow = false;
178178
while (rowsEnum.MoveNext())

RDFSharp/Query/Mirella/Algebra/Modifiers/RDFLimitModifier.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ public class RDFLimitModifier : RDFModifier
3737
/// </summary>
3838
public RDFLimitModifier(int limit)
3939
{
40+
#region Guards
4041
if (limit < 0)
4142
throw new RDFQueryException("Cannot create RDFLimitModifier because given \"limit\" parameter (" + limit + ") is negative.");
42-
43+
#endregion
44+
4345
Limit = limit;
4446
}
4547
#endregion

RDFSharp/Query/Mirella/Algebra/Modifiers/RDFOffsetModifier.cs

+2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public class RDFOffsetModifier : RDFModifier
3737
/// </summary>
3838
public RDFOffsetModifier(int offset)
3939
{
40+
#region Guards
4041
if (offset < 0)
4142
throw new RDFQueryException("Cannot create RDFOffsetModifier because given \"offset\" parameter (" + offset + ") is negative.");
43+
#endregion
4244

4345
Offset = offset;
4446
}

RDFSharp/Query/Mirella/Algebra/Modifiers/RDFOrderByModifier.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ public class RDFOrderByModifier : RDFModifier
4141
/// </summary>
4242
public RDFOrderByModifier(RDFVariable variable, RDFQueryEnums.RDFOrderByFlavors orderbyFlavor)
4343
{
44+
#region Guards
4445
if (variable == null)
4546
throw new RDFQueryException("Cannot create RDFOrderByModifier because given \"variable\" parameter is null.");
46-
47+
#endregion
48+
4749
OrderByFlavor = orderbyFlavor;
4850
Variable = variable;
4951
}

0 commit comments

Comments
 (0)