Skip to content

Commit

Permalink
Always cache results from JsonLd.getSubClasses
Browse files Browse the repository at this point in the history
  • Loading branch information
kwahlin committed Nov 20, 2024
1 parent f1defee commit 9be79a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions whelk-core/src/main/groovy/whelk/JsonLd.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package whelk

import groovy.transform.CompileStatic
import groovy.transform.Immutable
import groovy.transform.Memoized
import groovy.transform.TypeChecked
import groovy.transform.TypeCheckingMode
import org.apache.logging.log4j.LogManager
Expand Down Expand Up @@ -701,6 +702,7 @@ class JsonLd {
return asList(entity['@type']).any { isSubClassOf((String) it, baseType) }
}

@Memoized
Set<String> getSubClasses(String type) {
return getSubTerms(type, superClassOf, subClassesByType)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ class MatchForm {
return mappings
}

@Memoized
private static Set<String> getSubtypes(String type, JsonLd jsonLd) {
return jsonLd.getSubClasses(type)
}
Expand Down

0 comments on commit 9be79a0

Please sign in to comment.