Skip to content

Commit

Permalink
[Enhancement kbss-cvut/termit-ui#520] Fix Vocabulary content changes …
Browse files Browse the repository at this point in the history
…history query

Query filters were using wrong variables, and removed unnecessary optional block.
  • Loading branch information
lukaskabc committed Nov 11, 2024
1 parent 1486e9f commit 39422e5
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,7 @@ private TypedQuery<AbstractChangeRecord> createDetailedContentChangesQuery(Vocab
BIND(CONCAT(?firstName, " ", ?lastName) as ?authorFullName)
OPTIONAL {
?record ?hasChangedAttribute ?attribute .
OPTIONAL {
?attribute ?hasRdfsLabel ?changedAttributeName .
}
?attribute ?hasRdfsLabel ?changedAttributeName .
}
OPTIONAL {
?term ?inVocabulary ?vocabulary ;
Expand All @@ -442,10 +440,10 @@ private TypedQuery<AbstractChangeRecord> createDetailedContentChangesQuery(Vocab
}
BIND(?termName as ?termNameVal)
BIND(?authorName as ?authorNameVal)
BIND(?changedAttributeName as ?changedAttributeNameVal)
FILTER (!BOUND(?termNameVal) || CONTAINS(LCASE(?label), LCASE(?termName)))
FILTER (!BOUND(?authorNameVal) || CONTAINS(LCASE(?authorFullName), LCASE(?authorName)))
FILTER (!BOUND(?changedAttributeName) || !BOUND(?changedAttributeNameVal) || CONTAINS(LCASE(?changedAttributeName), LCASE(?attributeName)))
BIND(?attributeName as ?changedAttributeNameVal)
FILTER (!BOUND(?termNameVal) || CONTAINS(LCASE(?label), LCASE(?termNameVal)))
FILTER (!BOUND(?authorNameVal) || CONTAINS(LCASE(?authorFullName), LCASE(?authorNameVal)))
FILTER (!BOUND(?changedAttributeName) || !BOUND(?changedAttributeNameVal) || CONTAINS(LCASE(?changedAttributeName), LCASE(?changedAttributeName)))
} ORDER BY DESC(?timestamp) ?attribute
""", AbstractChangeRecord.class)
.setParameter("changeContext", changeTrackingContextResolver.resolveChangeTrackingContext(vocabulary))
Expand Down

0 comments on commit 39422e5

Please sign in to comment.