Skip to content

Commit

Permalink
Merge query prefixes with GetPrefixes()
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Oct 13, 2019
1 parent d161e73 commit 1e03ece
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions RDFSharp/Query/Mirella/RDFQueryPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ internal static String PrintSelectQuery(RDFSelectQuery selectQuery, Double inden
else if (queryMember is RDFQuery)
{
//Merge main query prefixes
selectQuery.Prefixes.ForEach(pf1 => {
if (!((RDFSelectQuery)queryMember).Prefixes.Any(pf2 => pf2.Equals(pf1)))
((RDFSelectQuery)queryMember).AddPrefix(pf1);
});
selectQuery.GetPrefixes()
.ForEach(pf1 => ((RDFSelectQuery)queryMember).AddPrefix(pf1));

//Current subquery is set as UNION with the next one
if (((RDFSelectQuery)queryMember).JoinAsUnion)
Expand Down Expand Up @@ -429,10 +427,8 @@ internal static String PrintDescribeQuery(RDFDescribeQuery describeQuery)
else if (queryMember is RDFQuery)
{
//Merge main query prefixes
describeQuery.Prefixes.ForEach(pf1 => {
if (!((RDFSelectQuery)queryMember).Prefixes.Any(pf2 => pf2.Equals(pf1)))
((RDFSelectQuery)queryMember).AddPrefix(pf1);
});
describeQuery.GetPrefixes()
.ForEach(pf1 => ((RDFSelectQuery)queryMember).AddPrefix(pf1));

//Current subquery is set as UNION with the next one
if (((RDFSelectQuery)queryMember).JoinAsUnion)
Expand Down Expand Up @@ -641,10 +637,8 @@ internal static String PrintConstructQuery(RDFConstructQuery constructQuery)
else if (queryMember is RDFQuery)
{
//Merge main query prefixes
constructQuery.Prefixes.ForEach(pf1 => {
if (!((RDFSelectQuery)queryMember).Prefixes.Any(pf2 => pf2.Equals(pf1)))
((RDFSelectQuery)queryMember).AddPrefix(pf1);
});
constructQuery.GetPrefixes()
.ForEach(pf1 => ((RDFSelectQuery)queryMember).AddPrefix(pf1));

//Current subquery is set as UNION with the next one
if (((RDFSelectQuery)queryMember).JoinAsUnion)
Expand Down Expand Up @@ -830,10 +824,8 @@ internal static String PrintAskQuery(RDFAskQuery askQuery)
else if (queryMember is RDFQuery)
{
//Merge main query prefixes
askQuery.Prefixes.ForEach(pf1 => {
if (!((RDFSelectQuery)queryMember).Prefixes.Any(pf2 => pf2.Equals(pf1)))
((RDFSelectQuery)queryMember).AddPrefix(pf1);
});
askQuery.GetPrefixes()
.ForEach(pf1 => ((RDFSelectQuery)queryMember).AddPrefix(pf1));

//Current subquery is set as UNION with the next one
if (((RDFSelectQuery)queryMember).JoinAsUnion)
Expand Down

0 comments on commit 1e03ece

Please sign in to comment.