Skip to content

Commit 46a2c90

Browse files
author
Marco De Salvo
committed
Better Intellisense on many ctors + Drop RDFPlainLiteral.Star
1 parent fc78d9b commit 46a2c90

File tree

13 files changed

+28
-126
lines changed

13 files changed

+28
-126
lines changed

RDFSharp.Test/Query/Mirella/Algebra/Expressions/RDFLangMatchesExpressionTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public void ShouldCreateStarLangMatchesExpressionAndCalculateResultTrue()
373373
table.Rows.Add(row);
374374
table.AcceptChanges();
375375

376-
RDFLangMatchesExpression expression = new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star));
376+
RDFLangMatchesExpression expression = new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")));
377377
RDFPatternMember result = expression.ApplyExpression(table.Rows[0]);
378378

379379
Assert.IsNotNull(result);
@@ -387,7 +387,7 @@ public void ShouldCreateStarLangMatchesExpressionAndCalculateResultTrueOnRightVa
387387
table.Columns.Add("?A", typeof(string));
388388
table.Columns.Add("?B", typeof(string));
389389
DataRow row = table.NewRow();
390-
row["?A"] = RDFPlainLiteral.Star.ToString();
390+
row["?A"] = new RDFPlainLiteral("*").ToString();
391391
row["?B"] = new RDFPlainLiteral("hello", "en-US--ltr").ToString();
392392
table.Rows.Add(row);
393393
table.AcceptChanges();
@@ -411,7 +411,7 @@ public void ShouldCreateStarLangMatchesExpressionAndCalculateResultFalse()
411411
table.Rows.Add(row);
412412
table.AcceptChanges();
413413

414-
RDFLangMatchesExpression expression = new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star));
414+
RDFLangMatchesExpression expression = new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")));
415415
RDFPatternMember result = expression.ApplyExpression(table.Rows[0]);
416416

417417
Assert.IsNotNull(result);

RDFSharp.Test/Query/Mirella/Algebra/Filters/RDFBooleanAndFilterTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void ShouldCreateBooleanAndFilterAndKeepRow()
103103
new RDFDatatypeExpression(new RDFVariable("?A")),
104104
new RDFConstantExpression(RDFVocabulary.XSD.FLOAT))),
105105
new RDFExpressionFilter(
106-
new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star))));
106+
new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")))));
107107
bool keepRow = filter.ApplyFilter(table.Rows[0], false);
108108

109109
Assert.IsTrue(keepRow);
@@ -151,7 +151,7 @@ public void ShouldCreateBooleanAndFilterAndNotKeepRowBecauseNegation()
151151
RDFQueryEnums.RDFComparisonFlavors.EqualTo,
152152
new RDFDatatypeExpression(new RDFVariable("?A")),
153153
new RDFConstantExpression(RDFVocabulary.XSD.FLOAT))),
154-
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star))));
154+
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")))));
155155
bool keepRow = filter.ApplyFilter(table.Rows[0], true);
156156

157157
Assert.IsFalse(keepRow);
@@ -175,7 +175,7 @@ public void ShouldCreateBooleanAndFilterAndNotKeepRowBecauseLeftFailure()
175175
RDFQueryEnums.RDFComparisonFlavors.EqualTo,
176176
new RDFDatatypeExpression(new RDFVariable("?A")),
177177
new RDFConstantExpression(RDFVocabulary.XSD.BOOLEAN))),
178-
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star))));
178+
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")))));
179179
bool keepRow = filter.ApplyFilter(table.Rows[0], false);
180180

181181
Assert.IsFalse(keepRow);

RDFSharp.Test/Query/Mirella/Algebra/Filters/RDFBooleanOrFilterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void ShouldCreateBooleanOrFilterAndKeepRow()
102102
RDFQueryEnums.RDFComparisonFlavors.EqualTo,
103103
new RDFDatatypeExpression(new RDFVariable("?A")),
104104
new RDFConstantExpression(RDFVocabulary.XSD.BOOLEAN))),
105-
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(RDFPlainLiteral.Star))));
105+
new RDFExpressionFilter(new RDFLangMatchesExpression(new RDFVariable("?B"), new RDFConstantExpression(new RDFPlainLiteral("*")))));
106106
bool keepRow = filter.ApplyFilter(table.Rows[0], false);
107107

108108
Assert.IsTrue(keepRow);

RDFSharp.Test/Query/Mirella/RDFQueryEngineTest.cs

Lines changed: 4 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4081,7 +4081,7 @@ public void ShouldDescribeUnexistingVariableTerms()
40814081
}
40824082

40834083
[TestMethod]
4084-
public void ShouldDescribeLiteralBoundVariableTerms()
4084+
public void ShouldDescribeLiteralBoundVariableTermsOnGraph()
40854085
{
40864086
RDFGraph graph = new RDFGraph(
40874087
[
@@ -4125,53 +4125,9 @@ public void ShouldDescribeLiteralBoundVariableTerms()
41254125
}
41264126

41274127
[TestMethod]
4128-
public void ShouldDescribeLiteralBoundVariableTermsOnAsyncGraph()
4128+
public void ShouldDescribeLiteralBoundVariableTermsOnStore()
41294129
{
4130-
RDFGraph agraph = new RDFGraph(
4131-
[
4132-
new RDFTriple(new RDFResource("ex:pluto"),new RDFResource("ex:dogOf"),new RDFResource("ex:topolino")),
4133-
new RDFTriple(new RDFResource("ex:topolino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Mickey Mouse", "en-US")),
4134-
new RDFTriple(new RDFResource("ex:fido"),new RDFResource("ex:dogOf"),new RDFResource("ex:paperino")),
4135-
new RDFTriple(new RDFResource("ex:paperino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Donald Duck", "en-US")),
4136-
new RDFTriple(new RDFResource("ex:balto"),new RDFResource("ex:dogOf"),new RDFResource("ex:whoever")),
4137-
new RDFTriple(new RDFResource("ex:balto"),new RDFResource("ex:hasColor"),new RDFPlainLiteral("green", "en"))
4138-
]);
4139-
4140-
RDFDescribeQuery query = new RDFDescribeQuery()
4141-
.AddDescribeTerm(new RDFVariable("?C"))
4142-
.AddPatternGroup(new RDFPatternGroup()
4143-
.AddPattern(new RDFPattern(new RDFVariable("?Y"), new RDFResource("ex:dogOf2"), new RDFVariable("?X")))
4144-
.AddPattern(new RDFPattern(new RDFVariable("?X"), new RDFResource("ex:hasName"), new RDFVariable("?N")).Optional())
4145-
.UnionWithNext())
4146-
.AddSubQuery(new RDFSelectQuery()
4147-
.AddPatternGroup(new RDFPatternGroup()
4148-
.AddPattern(new RDFPattern(new RDFResource("ex:balto"), new RDFResource("ex:hasColor"), new RDFVariable("?C")))));
4149-
4150-
DataTable table = new DataTable();
4151-
table.Columns.Add("?Y", typeof(string));
4152-
table.Columns.Add("?X", typeof(string));
4153-
table.Columns.Add("?N", typeof(string));
4154-
table.Columns.Add("?C", typeof(string));
4155-
table.AcceptChanges();
4156-
DataRow row0 = table.NewRow();
4157-
row0["?Y"] = null;
4158-
row0["?X"] = null;
4159-
row0["?N"] = null;
4160-
row0["?C"] = "green@EN";
4161-
table.Rows.Add(row0);
4162-
4163-
RDFQueryEngine queryEngine = new RDFQueryEngine();
4164-
DataTable result = queryEngine.DescribeTerms(query, agraph, table);
4165-
4166-
Assert.IsNotNull(result);
4167-
Assert.AreEqual(3, result.Columns.Count);
4168-
Assert.AreEqual(1, result.Rows.Count);
4169-
}
4170-
4171-
[TestMethod]
4172-
public void ShouldDescribeLiteralBoundVariableTermsOnAsyncStore()
4173-
{
4174-
RDFMemoryStore astore = new RDFMemoryStore(
4130+
RDFMemoryStore store = new RDFMemoryStore(
41754131
[
41764132
new RDFQuadruple(new RDFContext("ex:org"), new RDFResource("ex:pluto"),new RDFResource("ex:dogOf"),new RDFResource("ex:topolino")),
41774133
new RDFQuadruple(new RDFContext("ex:org"), new RDFResource("ex:topolino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Mickey Mouse", "en-US")),
@@ -4205,7 +4161,7 @@ public void ShouldDescribeLiteralBoundVariableTermsOnAsyncStore()
42054161
table.Rows.Add(row0);
42064162

42074163
RDFQueryEngine queryEngine = new RDFQueryEngine();
4208-
DataTable result = queryEngine.DescribeTerms(query, astore, table);
4164+
DataTable result = queryEngine.DescribeTerms(query, store, table);
42094165

42104166
Assert.IsNotNull(result);
42114167
Assert.AreEqual(4, result.Columns.Count);
@@ -4238,32 +4194,6 @@ public void ShouldApplyPatternToDataSourceGraph()
42384194
Assert.IsTrue(string.Equals(result.Rows[2]["?X"].ToString(), "ex:whoever", StringComparison.Ordinal));
42394195
}
42404196

4241-
[TestMethod]
4242-
public void ShouldApplyPatternToDataSourceAsyncGraph()
4243-
{
4244-
RDFGraph graph = new RDFGraph(
4245-
[
4246-
new RDFTriple(new RDFResource("ex:pluto"),new RDFResource("ex:dogOf"),new RDFResource("ex:topolino")),
4247-
new RDFTriple(new RDFResource("ex:topolino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Mickey Mouse", "en-US")),
4248-
new RDFTriple(new RDFResource("ex:fido"),new RDFResource("ex:dogOf"),new RDFResource("ex:paperino")),
4249-
new RDFTriple(new RDFResource("ex:paperino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Donald Duck", "en-US")),
4250-
new RDFTriple(new RDFResource("ex:balto"),new RDFResource("ex:dogOf"),new RDFResource("ex:whoever"))
4251-
]);
4252-
RDFPattern pattern = new RDFPattern(new RDFVariable("?Y"), new RDFResource("ex:dogOf"), new RDFVariable("?X"));
4253-
RDFQueryEngine queryEngine = new RDFQueryEngine();
4254-
DataTable result = queryEngine.ApplyPattern(pattern, graph);
4255-
4256-
Assert.IsNotNull(result);
4257-
Assert.AreEqual(2, result.Columns.Count);
4258-
Assert.AreEqual(3, result.Rows.Count);
4259-
Assert.IsTrue(string.Equals(result.Rows[0]["?Y"].ToString(), "ex:pluto", StringComparison.Ordinal));
4260-
Assert.IsTrue(string.Equals(result.Rows[0]["?X"].ToString(), "ex:topolino", StringComparison.Ordinal));
4261-
Assert.IsTrue(string.Equals(result.Rows[1]["?Y"].ToString(), "ex:fido", StringComparison.Ordinal));
4262-
Assert.IsTrue(string.Equals(result.Rows[1]["?X"].ToString(), "ex:paperino", StringComparison.Ordinal));
4263-
Assert.IsTrue(string.Equals(result.Rows[2]["?Y"].ToString(), "ex:balto", StringComparison.Ordinal));
4264-
Assert.IsTrue(string.Equals(result.Rows[2]["?X"].ToString(), "ex:whoever", StringComparison.Ordinal));
4265-
}
4266-
42674197
[TestMethod]
42684198
public void ShouldApplyPatternToDataSourceStore()
42694199
{
@@ -4290,30 +4220,6 @@ public void ShouldApplyPatternToDataSourceStore()
42904220
Assert.IsTrue(string.Equals(result.Rows[2]["?X"].ToString(), "ex:whoever", StringComparison.Ordinal));
42914221
}
42924222

4293-
[TestMethod]
4294-
public async Task ShouldApplyPatternToDataSourceAsyncStore()
4295-
{
4296-
RDFMemoryStore store = new RDFMemoryStore();
4297-
store.AddQuadruple(new RDFQuadruple(new RDFContext(), new RDFResource("ex:pluto"),new RDFResource("ex:dogOf"),new RDFResource("ex:topolino")));
4298-
store.AddQuadruple(new RDFQuadruple(new RDFContext(), new RDFResource("ex:topolino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Mickey Mouse", "en-US")));
4299-
store.AddQuadruple(new RDFQuadruple(new RDFContext(), new RDFResource("ex:fido"),new RDFResource("ex:dogOf"),new RDFResource("ex:paperino")));
4300-
store.AddQuadruple(new RDFQuadruple(new RDFContext(), new RDFResource("ex:paperino"),new RDFResource("ex:hasName"),new RDFPlainLiteral("Donald Duck", "en-US")));
4301-
store.AddQuadruple(new RDFQuadruple(new RDFContext(), new RDFResource("ex:balto"),new RDFResource("ex:dogOf"),new RDFResource("ex:whoever")));
4302-
RDFPattern pattern = new RDFPattern(new RDFVariable("?Y"), new RDFResource("ex:dogOf"), new RDFVariable("?X"));
4303-
RDFQueryEngine queryEngine = new RDFQueryEngine();
4304-
DataTable result = queryEngine.ApplyPattern(pattern, store);
4305-
4306-
Assert.IsNotNull(result);
4307-
Assert.AreEqual(2, result.Columns.Count);
4308-
Assert.AreEqual(3, result.Rows.Count);
4309-
Assert.IsTrue(string.Equals(result.Rows[0]["?Y"].ToString(), "ex:pluto", StringComparison.Ordinal));
4310-
Assert.IsTrue(string.Equals(result.Rows[0]["?X"].ToString(), "ex:topolino", StringComparison.Ordinal));
4311-
Assert.IsTrue(string.Equals(result.Rows[1]["?Y"].ToString(), "ex:fido", StringComparison.Ordinal));
4312-
Assert.IsTrue(string.Equals(result.Rows[1]["?X"].ToString(), "ex:paperino", StringComparison.Ordinal));
4313-
Assert.IsTrue(string.Equals(result.Rows[2]["?Y"].ToString(), "ex:balto", StringComparison.Ordinal));
4314-
Assert.IsTrue(string.Equals(result.Rows[2]["?X"].ToString(), "ex:whoever", StringComparison.Ordinal));
4315-
}
4316-
43174223
[TestMethod]
43184224
public void ShouldApplyPatternToDataSourceFederation()
43194225
{

RDFSharp/Model/RDFModelException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ public sealed class RDFModelException : Exception
2626
{
2727
#region Ctors
2828
/// <summary>
29-
/// Basic ctor to throw an empty RDFModelException
29+
/// Builds an empty RDFModelException
3030
/// </summary>
3131
public RDFModelException() { }
3232

3333
/// <summary>
34-
/// Basic ctor to throw an RDFModelException with message
34+
/// Builds a RDFModelException with the given message
3535
/// </summary>
3636
public RDFModelException(string message) : base(message) { }
3737

3838
/// <summary>
39-
/// Basic ctor to throw an RDFModelException with message and inner exception
39+
/// Builds a RDFModelException with the given message and inner exception
4040
/// </summary>
4141
public RDFModelException(string message, Exception innerException) : base(message, innerException) { }
4242
#endregion

RDFSharp/Model/RDFPlainLiteral.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ public sealed class RDFPlainLiteral : RDFLiteral
2828
/// Represents an handy plain literal for empty strings
2929
/// </summary>
3030
public static readonly RDFPlainLiteral Empty = new RDFPlainLiteral(string.Empty);
31-
/// <summary>
32-
/// Represents an handy plain literal for querying any language tags (*)
33-
/// </summary>
34-
public static readonly RDFPlainLiteral Star = new RDFPlainLiteral("*");
3531
#endregion
3632

3733
#region Properties

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public sealed class RDFExpressionFilter : RDFFilter
3434

3535
#region Ctors
3636
/// <summary>
37-
/// Private-ctor to build a filter on the given expression
37+
/// Builds a filter on the given expression
3838
/// </summary>
3939
/// <exception cref="RDFQueryException"></exception>
4040
private RDFExpressionFilter(RDFExpression expression, bool _)

RDFSharp/Query/Mirella/Algebra/RDFExpression.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected RDFExpression(RDFPatternMember leftArgument, RDFPatternMember rightArg
6767
: this(leftArgument, rightArgument as RDFExpressionArgument) { }
6868

6969
/// <summary>
70-
/// Internal-ctor to build an expression with given expression arguments
70+
/// Builds an expression with given expression arguments
7171
/// </summary>
7272
/// <exception cref = "RDFQueryException" ></exception>
7373
internal RDFExpression(RDFExpressionArgument leftArgument, RDFExpressionArgument rightArgument)
@@ -87,7 +87,7 @@ internal RDFExpression(RDFExpressionArgument leftArgument, RDFExpressionArgument
8787
}
8888

8989
/// <summary>
90-
/// Internal-ctor to build an expression without arguments (e.g: RAND)
90+
/// Builds an expression without arguments (e.g: RAND)
9191
/// </summary>
9292
internal RDFExpression() { }
9393
#endregion

RDFSharp/Query/Mirella/Algebra/RDFSPARQLEndpoint.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public sealed class RDFSPARQLEndpointOperationOptions
208208

209209
#region Ctors
210210
/// <summary>
211-
/// Default-ctor to configure options for a SPARQL UPDATE endpoint operation
211+
/// Configures default options for a SPARQL UPDATE endpoint operation
212212
/// </summary>
213213
public RDFSPARQLEndpointOperationOptions()
214214
{
@@ -217,13 +217,13 @@ public RDFSPARQLEndpointOperationOptions()
217217
}
218218

219219
/// <summary>
220-
/// Custom-ctor to configure options for a SPARQL UPDATE endpoint operation
220+
/// Configure custom options for a SPARQL UPDATE endpoint operation
221221
/// </summary>
222222
public RDFSPARQLEndpointOperationOptions(int timeoutMilliseconds) : this()
223223
=> TimeoutMilliseconds = timeoutMilliseconds < -1 ? -1 : timeoutMilliseconds;
224224

225225
/// <summary>
226-
/// Custom-ctor to configure options for a SPARQL UPDATE endpoint operation
226+
/// Configure custom options for a SPARQL UPDATE endpoint operation
227227
/// </summary>
228228
public RDFSPARQLEndpointOperationOptions(int timeoutMilliseconds, RDFQueryEnums.RDFSPARQLEndpointOperationContentTypes requestContentType) : this(timeoutMilliseconds)
229229
=> RequestContentType = requestContentType;

RDFSharp/Query/RDFQueryException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ public sealed class RDFQueryException : Exception
2626
{
2727
#region Ctors
2828
/// <summary>
29-
/// Basic ctor to throw an empty RDFQueryException
29+
/// Builds an empty RDFQueryException
3030
/// </summary>
3131
public RDFQueryException() { }
3232

3333
/// <summary>
34-
/// Basic ctor to throw an RDFQueryException with message
34+
/// Builds a RDFQueryException with the given message
3535
/// </summary>
3636
public RDFQueryException(string message) : base(message) { }
3737

3838
/// <summary>
39-
/// Basic ctor to throw an RDFQueryException with message and inner exception
39+
/// Builds a RDFQueryException with the given message and inner exception
4040
/// </summary>
4141
public RDFQueryException(string message, Exception innerException) : base(message, innerException) { }
4242
#endregion

0 commit comments

Comments
 (0)