Skip to content

Commit 5a645c8

Browse files
authored
Avoid querying deprecated types (#1725)
* Add isDeprecated method * Avoid querying deprecated types
1 parent 255299b commit 5a645c8

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

whelk-core/src/main/groovy/whelk/JsonLd.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class JsonLd {
104104
public static final String EQUIVALENT_CLASS = "equivalentClass"
105105
public static final String EQUIVALENT_PROPERTY = "equivalentProperty"
106106
public static final String SAME_AS = "sameAs"
107+
public static final String DEPRECATED = "deprecated"
107108
}
108109

109110
static final class Rdfs {
@@ -785,6 +786,10 @@ class JsonLd {
785786
getCategoryMembers(Category.PENDING).contains(property)
786787
}
787788

789+
boolean isDeprecated(String term) {
790+
return vocabIndex[term]?[Owl.DEPRECATED];
791+
}
792+
788793
/**
789794
* @param type
790795
* @return properties with range or rangeIncludes type

whelk-core/src/main/groovy/whelk/search2/querytree/Condition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ private Node expandType(JsonLd jsonLd) {
204204
}
205205

206206
List<Condition> altFields = Stream.concat(Stream.of(baseType), subtypes.stream())
207+
.filter(Predicate.not(jsonLd::isDeprecated))
207208
.sorted()
208209
.map(t -> withValue(new VocabTerm(t, jsonLd.vocabIndex.get(t))))
209210
.toList();

0 commit comments

Comments
 (0)