Skip to content

Commit

Permalink
[Enhancement kbss-cvut/termit-ui#520] Fix change record filter query
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskabc committed Nov 13, 2024
1 parent 8a1dcc9 commit 4334617
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,18 @@ public List<AbstractChangeRecord> findAllFiltered(URI changeContext, ChangeRecor
?record ?hasChangedEntity ?asset ;
?hasTime ?timestamp ;
?hasAuthor ?author .
?asset a ?assetType .
""" + /* Find an asset type if it is known (deleted assets does not have a type */ """
OPTIONAL {
?asset a ?assetType
}
OPTIONAL {
?asset a ?assetTypeVal .
BIND(true as ?isAssetType)
}
""" + /* filter assets without a type (deleted) or with a matching type */ """
BIND(?assetTypeVal as ?assetTypeVar)
FILTER(!BOUND(?assetType) || !BOUND(?assetTypeVar) || BOUND(?isAssetType))
""" + /* Get author's name */ """
?author ?hasFirstName ?firstName ;
?hasLastName ?lastName .
Expand All @@ -124,8 +135,8 @@ public List<AbstractChangeRecord> findAllFiltered(URI changeContext, ChangeRecor
OPTIONAL {
FILTER(!BOUND(?label)) .
?deleteRecord a ?deleteRecordType;
?hasChangedEntity ?term;
?hasRdfsLabel ?label.
?hasChangedEntity ?asset;
?hasRdfsLabel ?label .
}
BIND(?assetLabelValue as ?assetLabel)
BIND(?authorNameValue as ?authorName)
Expand Down Expand Up @@ -155,7 +166,7 @@ public List<AbstractChangeRecord> findAllFiltered(URI changeContext, ChangeRecor
if(asset.isPresent() && asset.get().getUri() != null) {
query = query.setParameter("asset", asset.get().getUri());
} else if (assetType.isPresent()) {
query = query.setParameter("assetType", assetType.get());
query = query.setParameter("assetTypeVal", assetType.get());
}


Expand Down

0 comments on commit 4334617

Please sign in to comment.