Skip to content

Commit

Permalink
Better management of values uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Oct 13, 2019
1 parent 1e03ece commit 837f3ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions RDFSharp/Query/Mirella/Algebra/RDFPatternGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,12 @@ public RDFPatternGroup AddPropertyPath(RDFPropertyPath propertyPath)
public RDFPatternGroup AddValues(RDFValues values)
{
if (values != null)
this.GroupMembers.Add(values);

{
if (!this.GetValues().Any(v => v.Equals(values)))
{
this.GroupMembers.Add(values);
}
}
return this;
}

Expand Down Expand Up @@ -268,7 +272,7 @@ internal RDFPatternGroup AddInjectedValues(RDFValues values)
clonedValues.IsEvaluable = values.IsEvaluable;
clonedValues.IsInjected = true;

this.GroupMembers.Add(clonedValues);
this.AddValues(clonedValues);
}
return this;
}
Expand Down
4 changes: 3 additions & 1 deletion RDFSharp/Query/Mirella/RDFQueryEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ internal void EvaluatePatternGroup(RDFQuery query, RDFPatternGroup patternGroup,
QueryMemberTemporaryResultTables[patternGroup.QueryMemberID] = new List<DataTable>();

//Iterate the evaluable members of the pattern group
List<RDFPatternGroupMember> evaluablePGMembers = patternGroup.GetEvaluablePatternGroupMembers().ToList();
List<RDFPatternGroupMember> evaluablePGMembers = patternGroup.GetEvaluablePatternGroupMembers()
.Distinct()
.ToList();
foreach (RDFPatternGroupMember evaluablePGMember in evaluablePGMembers)
{

Expand Down

0 comments on commit 837f3ba

Please sign in to comment.