From 81e12f5f44b449d95497f6366daa9040ef7b5e29 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sat, 17 Jun 2023 11:15:10 +0200 Subject: [PATCH] [HABot] Use SemanticsService to search for label/synonyms of a tag class (#1916) Depends on openhab/openhab-core#3636 Signed-off-by: Laurent Garnier --- .../ui/habot/nlp/internal/SemanticsItemResolver.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui.habot/src/main/java/org/openhab/ui/habot/nlp/internal/SemanticsItemResolver.java b/bundles/org.openhab.ui.habot/src/main/java/org/openhab/ui/habot/nlp/internal/SemanticsItemResolver.java index 9ebfe96fc0..af0178b7b2 100644 --- a/bundles/org.openhab.ui.habot/src/main/java/org/openhab/ui/habot/nlp/internal/SemanticsItemResolver.java +++ b/bundles/org.openhab.ui.habot/src/main/java/org/openhab/ui/habot/nlp/internal/SemanticsItemResolver.java @@ -75,7 +75,7 @@ public Stream getMatchingItems(String object, String location) { } if (object != null) { - List> semanticTagTypes = SemanticTags.getByLabelOrSynonym(object, currentLocale); + List> semanticTagTypes = semanticsService.getByLabelOrSynonym(object, currentLocale); if (!semanticTagTypes.isEmpty() && semanticTagTypes.stream().noneMatch(t -> Location.class.isAssignableFrom(t))) { Predicate tagsPredicate = null; @@ -116,14 +116,14 @@ public Map> getAllItemNamedAttributes() throws Uns itemAttributes.add(new ItemNamedAttribute(attributeType, item.getLabel(), AttributeSource.LABEL)); // Add the primary type's label and synonyms - for (String tagLabel : SemanticTags.getLabelAndSynonyms(semanticType, currentLocale)) { + for (String tagLabel : semanticsService.getLabelAndSynonyms(semanticType, currentLocale)) { itemAttributes.add(new ItemNamedAttribute(attributeType, tagLabel, AttributeSource.TAG)); } // Add the related property's label and synonyms Class relatedProperty = SemanticTags.getProperty(item); if (relatedProperty != null) { - for (String propertyLabel : SemanticTags.getLabelAndSynonyms(relatedProperty, currentLocale)) { + for (String propertyLabel : semanticsService.getLabelAndSynonyms(relatedProperty, currentLocale)) { itemAttributes.add(new ItemNamedAttribute("object", propertyLabel, AttributeSource.TAG)); } }