Skip to content

Commit

Permalink
fix(performance): Reverse order of topological sorting in Gravsearch …
Browse files Browse the repository at this point in the history
…queries (#2914)
  • Loading branch information
seakayone authored Nov 2, 2023
1 parent a91f6f6 commit d81a88e
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ package org.knora.webapi.messages.util.search.gravsearch.prequery

import zio._

import scala.collection.mutable.ArrayBuffer

import dsp.errors.AssertionException
import org.knora.webapi.CoreSpec
import org.knora.webapi.core.MessageRelay
Expand Down Expand Up @@ -102,7 +100,7 @@ class GravsearchToCountPrequeryTransformerSpec extends CoreSpec {
groupBy = Nil,
orderBy = Nil,
whereClause = WhereClause(
patterns = ArrayBuffer(
patterns = Vector(
StatementPattern(
subj = QueryVariable(variableName = "thing"),
pred = IriRef(
Expand Down Expand Up @@ -201,7 +199,7 @@ class GravsearchToCountPrequeryTransformerSpec extends CoreSpec {
val transformedQueryWithDecimalOptionalSortCriterionAndFilterComplex: SelectQuery =
SelectQuery(
fromClause = None,
variables = Vector(
variables = List(
Count(
outputVariableName = "count",
distinct = true,
Expand Down Expand Up @@ -237,14 +235,6 @@ class GravsearchToCountPrequeryTransformerSpec extends CoreSpec {
),
OptionalPattern(
patterns = Vector(
StatementPattern(
subj = QueryVariable(variableName = "decimal"),
pred = IriRef(
iri = "http://www.knora.org/ontology/knora-base#valueHasDecimal".toSmartIri,
propertyPathOperator = None
),
obj = QueryVariable(variableName = "decimalVal")
),
StatementPattern(
subj = QueryVariable(variableName = "thing"),
pred = IriRef(
Expand All @@ -264,6 +254,14 @@ class GravsearchToCountPrequeryTransformerSpec extends CoreSpec {
datatype = "http://www.w3.org/2001/XMLSchema#boolean".toSmartIri
)
),
StatementPattern(
subj = QueryVariable(variableName = "decimal"),
pred = IriRef(
iri = "http://www.knora.org/ontology/knora-base#valueHasDecimal".toSmartIri,
propertyPathOperator = None
),
obj = QueryVariable(variableName = "decimalVal")
),
FilterPattern(expression =
CompareExpression(
leftArg = QueryVariable(variableName = "decimalVal"),
Expand Down
Loading

0 comments on commit d81a88e

Please sign in to comment.