diff --git a/reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/constants/Constants.java b/reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/constants/Constants.java index 927ba95b6..14f68e0b2 100644 --- a/reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/constants/Constants.java +++ b/reasoner/common/src/main/java/com/antgroup/openspg/reasoner/common/constants/Constants.java @@ -14,7 +14,6 @@ package com.antgroup.openspg.reasoner.common.constants; import com.google.common.collect.Sets; - import java.util.Set; public class Constants { @@ -87,8 +86,6 @@ public class Constants { public static final String CONCEPT_EDGE_EXPAND_FUNC_NAME = "concept_edge_expand"; - /** - * allow throw exception in udf - */ + /** allow throw exception in udf */ public static final String ALLOW_UDF_EXCEPTION = "allowUDFThrowException"; } diff --git a/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/builtin/udf/ContainsAny.java b/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/builtin/udf/ContainsAny.java index 448efc491..2be746aa1 100644 --- a/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/builtin/udf/ContainsAny.java +++ b/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/builtin/udf/ContainsAny.java @@ -16,9 +16,8 @@ import com.antgroup.openspg.reasoner.common.constants.Constants; import com.antgroup.openspg.reasoner.udf.impl.UdfMngImpl; import com.antgroup.openspg.reasoner.udf.model.UdfDefine; -import org.apache.commons.lang3.StringUtils; - import java.util.Map; +import org.apache.commons.lang3.StringUtils; public class ContainsAny { @@ -60,7 +59,8 @@ public boolean containsAny(String toCheckedStr, String[] keywords) { @UdfDefine(name = "contains_any", compatibleName = "contains") public boolean contains(String toCheckedStr, String keyword) { Map configMap = UdfMngImpl.sceneConfigMap.get(); - Boolean allowUDFThrowException = (Boolean) configMap.getOrDefault(Constants.ALLOW_UDF_EXCEPTION, false); + Boolean allowUDFThrowException = + (Boolean) configMap.getOrDefault(Constants.ALLOW_UDF_EXCEPTION, false); if ((toCheckedStr == null || keyword == null) && allowUDFThrowException) { throw new RuntimeException("contains_any arguments is null"); } diff --git a/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/impl/UdfMngImpl.java b/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/impl/UdfMngImpl.java index e5f196c54..5e7a427ba 100644 --- a/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/impl/UdfMngImpl.java +++ b/reasoner/udf/src/main/java/com/antgroup/openspg/reasoner/udf/impl/UdfMngImpl.java @@ -13,6 +13,8 @@ package com.antgroup.openspg.reasoner.udf.impl; +import static com.antgroup.openspg.reasoner.common.Utils.javaType2KgType; + import com.antgroup.openspg.reasoner.common.exception.UdfExistsException; import com.antgroup.openspg.reasoner.common.types.KgType; import com.antgroup.openspg.reasoner.udf.UdfMng; @@ -29,10 +31,6 @@ import com.antgroup.openspg.reasoner.udf.utils.UdfUtils; import com.google.common.collect.Lists; import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import scala.Tuple2; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; @@ -43,8 +41,9 @@ import java.util.List; import java.util.Map; import java.util.Set; - -import static com.antgroup.openspg.reasoner.common.Utils.javaType2KgType; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import scala.Tuple2; @Slf4j(topic = "userlogger") public class UdfMngImpl implements UdfMng { @@ -55,7 +54,8 @@ public class UdfMngImpl implements UdfMng { private static volatile UdfMngImpl instance = null; - public static ThreadLocal> sceneConfigMap = ThreadLocal.withInitial(HashMap::new); + public static ThreadLocal> sceneConfigMap = + ThreadLocal.withInitial(HashMap::new); /** 单例 */ public static UdfMngImpl getInstance() {