Skip to content

Commit

Permalink
V3.14 (#352)
Browse files Browse the repository at this point in the history
Address #350 and #351 for v3.14 development cycle
  • Loading branch information
mdesalvo authored Dec 4, 2024
1 parent affae6c commit d94343e
Show file tree
Hide file tree
Showing 19 changed files with 5,141 additions and 1,176 deletions.
196 changes: 195 additions & 1 deletion RDFSharp.Test/Query/Mirella/Algebra/Queries/RDFSelectQueryTest.cs

Large diffs are not rendered by default.

64 changes: 36 additions & 28 deletions RDFSharp.Test/Query/Mirella/Algebra/RDFPatternGroupTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void ShouldCreatePatternGroup()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNull(pGroup.EvaluateAsService);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 0);
Expand All @@ -59,6 +60,7 @@ public void ShouldCreateOptionalPatternGroup()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsTrue(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsFalse(pGroup.EvaluateAsService.HasValue);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 0);
Expand All @@ -82,6 +84,32 @@ public void ShouldCreateUnionWithNextPatternGroup()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsTrue(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsFalse(pGroup.EvaluateAsService.HasValue);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 0);
Assert.IsNotNull(pGroup.Variables);
Assert.IsTrue(pGroup.Variables.Count == 0);
Assert.IsTrue(pGroup.ToString().Equals(string.Concat(" {", Environment.NewLine, " }", Environment.NewLine)));
Assert.IsTrue(pGroup.QueryMemberID.Equals(RDFModelUtilities.CreateHash(pGroup.QueryMemberStringID)));
Assert.IsTrue(pGroup.GetPatterns().Count() == 0);
Assert.IsTrue(pGroup.GetFilters().Count() == 0);
Assert.IsTrue(pGroup.GetPropertyPaths().Count() == 0);
Assert.IsTrue(pGroup.GetValues().Count() == 0);
Assert.IsTrue(pGroup.GetBinds().Count() == 0);
Assert.IsTrue(pGroup.GetEvaluablePatternGroupMembers().Count() == 0);
}

[TestMethod]
public void ShouldCreateMinusWithNextPatternGroup()
{
RDFPatternGroup pGroup = new RDFPatternGroup().MinusWithNext();

Assert.IsNotNull(pGroup);
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsTrue(pGroup.JoinAsMinus);
Assert.IsFalse(pGroup.EvaluateAsService.HasValue);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 0);
Expand All @@ -106,6 +134,7 @@ public void ShouldCreateServicePatternGroup()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsTrue(pGroup.EvaluateAsService.HasValue);
Assert.IsTrue(string.Equals(pGroup.EvaluateAsService.Value.Item1.ToString(), "ex:org"));
Assert.IsNotNull(pGroup.GroupMembers);
Expand Down Expand Up @@ -143,6 +172,7 @@ public void ShouldCreatePatternGroupWithPatterns()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 3);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -185,6 +215,7 @@ public void ShouldCreatePatternGroupWithPatternsAndFilters()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 4);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -219,6 +250,7 @@ public void ShouldAddPattern()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 3);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -247,6 +279,7 @@ public void ShouldAddFilter()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 1);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -276,6 +309,7 @@ public void ShouldAddPropertyPath()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 1);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -304,6 +338,7 @@ public void ShouldAddValues()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 1);
Assert.IsNotNull(pGroup.Variables);
Expand Down Expand Up @@ -335,6 +370,7 @@ public void ShouldAddBind()
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsFalse(pGroup.JoinAsMinus);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 1);
Assert.IsNotNull(pGroup.Variables);
Expand All @@ -349,34 +385,6 @@ public void ShouldAddBind()
Assert.IsTrue(pGroup.GetBinds().Count() == 1);
Assert.IsTrue(pGroup.GetEvaluablePatternGroupMembers().Count() == 1);
}

[TestMethod]
public void ShouldAddInjectedValues()
{
RDFValues values = new RDFValues().AddColumn(new RDFVariable("s"), [new RDFPlainLiteral("lit")]);
RDFPatternGroup pGroup = new RDFPatternGroup();
pGroup.AddInjectedValues(values);
pGroup.AddInjectedValues(null); //Will not be added, since null is not allowed

Assert.IsNotNull(pGroup);
Assert.IsTrue(pGroup.IsEvaluable);
Assert.IsFalse(pGroup.IsOptional);
Assert.IsFalse(pGroup.JoinAsUnion);
Assert.IsNotNull(pGroup.GroupMembers);
Assert.IsTrue(pGroup.GroupMembers.Count == 1);
Assert.IsNotNull(pGroup.Variables);
Assert.IsTrue(pGroup.Variables.Count == 1);
Assert.IsTrue(pGroup.ToString().Equals(string.Concat(" {", Environment.NewLine, " }", Environment.NewLine))); //Injected values are not printed since they are hidden
Assert.IsTrue(pGroup.ToString([RDFNamespaceRegister.GetByPrefix("rdf")]).Equals(string.Concat(" {", Environment.NewLine, " }", Environment.NewLine)));
Assert.IsTrue(pGroup.QueryMemberID.Equals(RDFModelUtilities.CreateHash(pGroup.QueryMemberStringID)));
Assert.IsTrue(pGroup.GetPatterns().Count() == 0);
Assert.IsTrue(pGroup.GetFilters().Count() == 0);
Assert.IsTrue(pGroup.GetPropertyPaths().Count() == 0);
Assert.IsTrue(pGroup.GetValues().Count() == 1);
Assert.IsTrue(pGroup.GetValues().ToList().TrueForAll(v => v.IsInjected));
Assert.IsTrue(pGroup.GetBinds().Count() == 0);
Assert.IsTrue(pGroup.GetEvaluablePatternGroupMembers().Count() == 1);
}
#endregion
}
}
Loading

0 comments on commit d94343e

Please sign in to comment.