org.neo4j.procedure.Name Java Examples
The following examples show how to use
org.neo4j.procedure.Name.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FreetextIK.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param text:待分词文本 * @param useSmart:true 用智能分词,false 细粒度分词 * @return * @Description: TODO(支持中英文本分词) */ @UserFunction(name = "zdr.index.iKAnalyzer") @Description("Fulltext index iKAnalyzer - RETURN zdr.index.iKAnalyzer({text},true) AS words") public List<String> iKAnalyzer(@Name("text") String text, @Name("useSmart") boolean useSmart) { PropertyConfigurator.configureAndWatch("dic" + File.separator + "log4j.properties"); Configuration cfg = new Configuration(useSmart); StringReader input = new StringReader(text.trim()); IKSegmenter ikSegmenter = new IKSegmenter(input, cfg); List<String> results = new ArrayList<>(); try { for (Lexeme lexeme = ikSegmenter.next(); lexeme != null; lexeme = ikSegmenter.next()) { results.add(lexeme.getLexemeText()); } } catch (IOException e) { e.printStackTrace(); } return results; }
Example #2
Source File: RelationshipProcedure.java From neo4j-versioner-core with Apache License 2.0 | 6 votes |
@Procedure(value = "graph.versioner.relationship.create", mode = Mode.WRITE) @Description("graph.versioner.relationship.create(entityA, entityB, type, relProps, date) - Create a relationship from entitySource to entityDestination with the given type and/or properties for the specified date.") public Stream<RelationshipOutput> relationshipCreate( @Name("entitySource") Node entitySource, @Name("entityDestination") Node entityDestination, @Name(value = "type") String type, @Name(value = "relProps", defaultValue = "{}") Map<String, Object> relProps, @Name(value = "date", defaultValue = "null") LocalDateTime date) { isEntityOrThrowException(entitySource); isEntityOrThrowException(entityDestination); Optional<Node> sourceCurrentState = createNewSourceState(entitySource, defaultToNow(date)); Optional<Node> destinationRNode = getRNode(entityDestination); if (sourceCurrentState.isPresent() && destinationRNode.isPresent()) { return streamOfRelationships(createRelationship(sourceCurrentState.get(), destinationRNode.get(), type, relProps)); } else { return Stream.empty(); } }
Example #3
Source File: Init.java From neo4j-versioner-core with Apache License 2.0 | 6 votes |
@Procedure(value = "graph.versioner.init", mode = Mode.WRITE) @Description("graph.versioner.init(entityLabel, {key:value,...}, {key:value,...}, additionalLabel, date) - Create an Entity node with an optional initial State.") public Stream<NodeOutput> init( @Name("entityLabel") String entityLabel, @Name(value = "entityProps", defaultValue = "{}") Map<String, Object> entityProps, @Name(value = "stateProps", defaultValue = "{}") Map<String, Object> stateProps, @Name(value = "additionalLabel", defaultValue = "") String additionalLabel, @Name(value = "date", defaultValue = "null") LocalDateTime date) { Node entity = createNode(entityProps, singletonList(entityLabel)); Node state = createNode(stateProps, getStateLabels(additionalLabel)); connectWithCurrentRelationship(entity, state, date); log.info(LOGGER_TAG + "Created a new Entity with label {} and id {}", entityLabel, entity.getId()); createRNodeAndAssociateTo(entity); return streamOfNodes(entity); }
Example #4
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 6 votes |
@Procedure(value = "graph.versioner.get.all", mode = DEFAULT) @Description("graph.versioner.get.all(entity) - Get all the State nodes for the given Entity.") public Stream<PathOutput> getAllState( @Name("entity") Node entity) { PathImpl.Builder builder = new PathImpl.Builder(entity) .push(entity.getSingleRelationship(RelationshipType.withName(Utility.CURRENT_TYPE), Direction.OUTGOING)); builder = StreamSupport.stream(entity.getRelationships(RelationshipType.withName(Utility.HAS_STATE_TYPE), Direction.OUTGOING).spliterator(), false) //.sorted((a, b) -> -1 * Long.compare((long)a.getProperty(START_DATE_PROP), (long)b.getProperty(START_DATE_PROP))) .reduce( builder, (build, rel) -> Optional.ofNullable(rel.getEndNode().getSingleRelationship(RelationshipType.withName(Utility.PREVIOUS_TYPE), Direction.OUTGOING)) .map(build::push) .orElse(build), (a, b) -> a); return Stream.of(new PathOutput(builder.build())); }
Example #5
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param * @return * @Description: TODO(地理位置名称多字段检索 -) */ @UserFunction(name = "zdr.apoc.locMultiFieldsFullTextSearchCondition") @Description("Location multi fields search- 找共同居住地的人 - EXAMPLE:location:`\"+location+\"`* OR location:`\"+location+\"`*") public String locMultiFieldsFullTextSearchCondition(@Name("node") Node node, @Name("locMultiFields") List<String> locMultiFields) { StringBuilder builder = new StringBuilder(); Map<String, Object> mapProperties = node.getAllProperties(); locMultiFields.forEach(field -> { if (!"".equals(field) && field != null) { if (mapProperties.containsKey(field)) { Object value = node.getProperty(field); if (value instanceof String) { if (value != null && !"".equals(value)) { builder.append(field + ":`" + value + "`* OR "); } } } } }); if (builder != null && !"".equals(builder.toString())) { return builder.substring(0, builder.length() - 3); } return "`null`"; }
Example #6
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param nLabels:节点集合 * @param mLabels:节点集合 * @param strictLabels:标签 分隔符号(||) * @return 两个集合同时包含某一个标签 返回TRUE * @Description: TODO(两个集合同时包含某一个标签) */ @UserFunction(name = "zdr.apoc.relatCalculateRestrict") @Description("Graph relationships calculate restrict") public boolean relatCalculateRestrict(@Name("nLabels") List<String> nLabels, @Name("mLabels") List<String> mLabels, @Name("restrictLabels") String strictLabels) { // ||包含其中一个 if (strictLabels.contains("||")) { String[] strict = strictLabels.split("\\|\\|"); for (int i = 0; i < strict.length; i++) { String label = strict[i]; if (nLabels.contains(label) && mLabels.contains(label)) { return true; } } } else { if (nLabels.contains(strictLabels) && mLabels.contains(strictLabels)) { return true; } } return false; }
Example #7
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param * @return * @Description: TODO(是否包含某字符串 | | - 任意包含一个 & & - 全部包含) */ @UserFunction(name = "zdr.apoc.isContainsString") @Description("Is contains string? &&-All contains ||-Or contains (Chinese||English Chinese&&English)") public boolean isContainsString(@Name("mapPara") Map<String, Object> mapPara) { // 将输入拼接成一个STRING String original = removeNull(mapPara.get("original0")) + removeNull(mapPara.get("original1")) + removeNull(mapPara.get("original2")) + removeNull(mapPara.get("original3")) + removeNull(mapPara.get("original4")) + removeNull(mapPara.get("original5")) + removeNull(mapPara.get("original6")) + removeNull(mapPara.get("original7")) + removeNull(mapPara.get("original8")) + removeNull(mapPara.get("original9")); String input = (String) mapPara.get("input"); if (original != null && !"".equals(original)) { String[] split; if (input.contains("||")) { split = input.split("\\|\\|"); return Arrays.stream(split).parallel().anyMatch(v -> original.contains(v)); } else if (input.contains("&&")) { split = input.split("&&"); return Arrays.stream(split).parallel().allMatch(v -> original.contains(v)); } else if (original.contains(input)) { return true; } } return false; }
Example #8
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param * @return * @Description: TODO(百分比映射) */ @UserFunction(name = "zdr.apoc.scorePercentage") @Description("Set node influence score percentage") public Number percentageInfluenceScore(@Name("mapPara") Map<String, Object> mapPara) { double max = shiftDouble(mapPara.get("maxScore")); double min = shiftDouble(mapPara.get("minScore")); double current = shiftDouble(mapPara.get("currentScore")); // min-max标准化(Min-MaxNormalization)也称为离差标准化,是对原始数据的线性变换,使结果值映射到 [0 - 1] 之间 double initialThreshold = 0.015; if (min <= current && current <= max && min != 0) { double percentage = (current - min) / (max - min); double percentageFormat = Double.parseDouble(String.format("%.6f", percentage)); if (percentageFormat == 0) { return initialThreshold; } return percentageFormat; } else { return initialThreshold; } }
Example #9
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 6 votes |
/** * @param * @return 1、符合时间区间 0、不符合时间区间 * @Description: TODO(判断通联时间段是否匹配) */ @UserFunction(name = "zdr.apoc.matchTimeZone") public Number matchTimeZone(@Name("mapPara") Map<String, String> mapPara) { String startTime = mapPara.get("startTime"); String stopTime = mapPara.get("stopTime"); DateHandle dateHandle = new DateHandle(); long startTimeLong = dateHandle.dateToMillisecond(startTime); long stopTimeLong = dateHandle.dateToMillisecond(stopTime); String timeListString = mapPara.get("timeList"); String[] timeArray = timeListString.split(","); String time; long timeLong; int size = timeArray.length; for (int i = 0; i < size; i++) { time = timeArray[i]; timeLong = dateHandle.dateToMillisecond(time); if (startTimeLong <= timeLong && timeLong <= stopTimeLong) { return 1; // 符合时间区间返回1 } } return 0; // 不符合时间区间返回0 }
Example #10
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.get.current.state", mode = DEFAULT) @Description("graph.versioner.get.current.state(entity) - Get the current State node for the given Entity.") public Stream<NodeOutput> getCurrentState( @Name("entity") Node entity) { return Stream.of(Optional.ofNullable(entity.getSingleRelationship(RelationshipType.withName(Utility.CURRENT_TYPE), Direction.OUTGOING)) .map(Relationship::getEndNode).map(NodeOutput::new).orElse(null)); }
Example #11
Source File: NodeWalker.java From ml-models with Apache License 2.0 | 5 votes |
public Stream<int[]> internalRandomWalk(@Name(value = "steps", defaultValue = "80") int steps, org.neo4j.graphalgo.impl.walking.NodeWalker.NextNodeStrategy strategy, TerminationFlag terminationFlag, int concurrency, int limit, PrimitiveIterator.OfInt idStream) { int timeout = 100; int queueSize = 1000; int batchSize = ParallelUtil.adjustBatchSize(limit, concurrency, 100); Collection<Runnable> tasks = new ArrayList<>((limit / batchSize) + 1); ArrayBlockingQueue<int[]> queue = new ArrayBlockingQueue<>(queueSize); int[] TOMB = new int[0]; while (idStream.hasNext()) { int[] ids = new int[batchSize]; int i = 0; while (i < batchSize && idStream.hasNext()) { ids[i++] = idStream.nextInt(); } int size = i; tasks.add(() -> { for (int j = 0; j < size; j++) { put(queue, doInternalWalk(ids[j], steps, strategy, terminationFlag)); } }); } new Thread(() -> { ParallelUtil.runWithConcurrency(concurrency, tasks, terminationFlag, Pools.DEFAULT); put(queue, TOMB); }).start(); QueueBasedSpliterator<int[]> spliterator = new QueueBasedSpliterator<>(queue, TOMB, terminationFlag, timeout); return StreamSupport.stream(spliterator, false); }
Example #12
Source File: RelationshipProcedure.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.relationship.delete", mode = Mode.WRITE) @Description("graph.versioner.relationship.delete(entityA, entityB, type, date) - Delete a custom type relationship from entitySource's current State to entityDestination for the specified date.") public Stream<BooleanOutput> relationshipDelete( @Name("entitySource") Node entitySource, @Name("entityDestination") Node entityDestination, @Name(value = "type") String type, @Name(value = "date", defaultValue = "null") LocalDateTime date) { isEntityOrThrowException(entitySource); isEntityOrThrowException(entityDestination); if (isSystemType(type)) { throw new VersionerCoreException("It's not possible to delete a System Relationship like " + type + "."); } Optional<Node> sourceCurrentState = createNewSourceState(entitySource, defaultToNow(date)); Optional<Node> destinationRNode = getRNode(entityDestination); Update updateProcedure = new UpdateBuilder().withLog(log).withDb(db).build().orElseThrow(() -> new VersionerCoreException("Unable to initialize update procedure")); if (sourceCurrentState.isPresent() && destinationRNode.isPresent()) { updateProcedure.update(entitySource, sourceCurrentState.get().getAllProperties(), "", null); getCurrentRelationship(entitySource).ifPresent(rel -> rel.getEndNode().getRelationships(RelationshipType.withName(type), Direction.OUTGOING).forEach(Relationship::delete)); return Stream.of(new BooleanOutput(Boolean.TRUE)); } else { return Stream.of(new BooleanOutput(Boolean.FALSE)); } }
Example #13
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.get.nth.state", mode = DEFAULT) @Description("graph.versioner.get.nth.state(entity, nth) - Get the nth State node for the given Entity.") public Stream<NodeOutput> getNthState( @Name("entity") Node entity, @Name("nth") long nth) { return getCurrentState(entity) .findFirst() .flatMap(currentState -> getNthStateFrom(currentState.node, nth)) .map(Utility::streamOfNodes) .orElse(Stream.empty()); }
Example #14
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.get.by.date", mode = DEFAULT) @Description("graph.versioner.get.by.date(entity, date) - Get State node by the given Entity node, created at the given date") public Stream<NodeOutput> getStateByDate( @Name("entity") Node entity, @Name("date") LocalDateTime date) { return StreamSupport.stream(entity.getRelationships(RelationshipType.withName(Utility.HAS_STATE_TYPE), Direction.OUTGOING).spliterator(), false) .filter(relationship -> relationship.getProperty(Utility.START_DATE_PROP).equals(date)) .map(Relationship::getEndNode) .map(NodeOutput::new); }
Example #15
Source File: CustomerProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
@Procedure(value = "zdr.index.search", mode = Mode.WRITE) @Description("CALL zdr.index.search(String indexName, String query, long limit) YIELD node,执行LUCENE全文检索,返回前{limit个结果}") public Stream<ChineseHit> search(@Name("indexName") String indexName, @Name("query") String query, @Name("limit") long limit) { if (!db.index().existsForNodes(indexName)) { log.debug("如果索引不存在则跳过本次查询:`%s`", indexName); return Stream.empty(); } return db.index() .forNodes(indexName) .query(new QueryContext(query).sortByScore().top((int) limit)) .stream() .map(ChineseHit::new); }
Example #16
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.get.by.label", mode = DEFAULT) @Description("graph.versioner.get.by.label(entity, label) - Get State nodes with the given label, by the given Entity node") public Stream<NodeOutput> getAllStateByLabel( @Name("entity") Node entity, @Name("label") String label) { return StreamSupport.stream(entity.getRelationships(RelationshipType.withName(Utility.HAS_STATE_TYPE), Direction.OUTGOING).spliterator(), false) .map(Relationship::getEndNode) .filter(node -> node.hasLabel(Label.label(label))) .map(NodeOutput::new); }
Example #17
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
/** * @param * @return * @Description: TODO(获取命中关键词关系的属性ids的长度 , ids的值是用逗号分隔的id) */ @UserFunction(name = "zdr.apoc.getEventIdsSize") public Number getEventIdsSize(@Name("ids") String ids) { String[] array = ids.split(","); int eventIdsSize = array.length; return eventIdsSize; }
Example #18
Source File: DeepGLProc.java From ml-models with Apache License 2.0 | 5 votes |
@Procedure(value = "embedding.deepgl.stream") public Stream<DeepGL.Result> deepGLStream( @Name(value = "label", defaultValue = "") String label, @Name(value = "relationship", defaultValue = "") String relationship, @Name(value = "config", defaultValue = "{}") Map<String, Object> config) { final ProcedureConfiguration configuration = ProcedureConfiguration.create(config); int iterations = configuration.getInt("iterations", 10); int diffusions = configuration.getInt("diffusions", 10); double pruningLambda = configuration.get("pruningLambda", 0.1); final HeavyGraph graph = (HeavyGraph) new GraphLoader(api, Pools.DEFAULT) .init(log, label, relationship, configuration) .withoutNodeProperties() .withDirection(configuration.getDirection(Direction.BOTH)) .withOptionalNodeProperties(extractNodeFeatures(config)) .load(configuration.getGraphImpl()); if (graph.nodeCount() == 0) { return Stream.empty(); } DeepGL algo = new DeepGL(graph, Pools.DEFAULT, configuration.getConcurrency(), iterations, pruningLambda, diffusions); algo.withProgressLogger(ProgressLogger.wrap(log, "DeepGL")); algo.compute(); graph.release(); return algo.resultStream(); }
Example #19
Source File: Get.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.get.current.path", mode = DEFAULT) @Description("graph.versioner.get.current.path(entity) - Get the current Path (Entity, State and rels) for the given Entity.") public Stream<PathOutput> getCurrentPath( @Name("entity") Node entity) { PathImpl.Builder builder = new PathImpl.Builder(entity); builder = Optional.ofNullable(entity.getSingleRelationship(RelationshipType.withName(Utility.CURRENT_TYPE), Direction.OUTGOING)) .map(builder::push) .orElse(new PathImpl.Builder(entity)); return Stream.of(builder.build()).map(PathOutput::new); }
Example #20
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
/** * @param * @return * @Description: TODO(自定义函数 - 降序排序集合的元素) */ @UserFunction(name = "zdr.apoc.sortDESC") public List<Object> sortDESC(@Name("coll") List<Object> coll) { List sorted = new ArrayList<>(coll); Collections.sort(sorted, new Comparator<Object>() { @Override public int compare(Object o1, Object o2) { Integer o1Int = Integer.valueOf(String.valueOf(o1)); Integer o2Int = Integer.valueOf(String.valueOf(o2)); return o2Int.compareTo(o1Int); } }); return sorted; }
Example #21
Source File: ML.java From neo4j-ml-procedures with Apache License 2.0 | 5 votes |
@Procedure public Stream<PredictionResult> predict(@Name("model") String model, @Name("inputs") Map<String,Object> inputs) { MLModel mlModel = MLModel.from(model); Object value = mlModel.predict(inputs); double confidence = 0.0d; return Stream.of(new PredictionResult(value, confidence)); }
Example #22
Source File: Diff.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.diff.from.current", mode = DEFAULT) @Description("graph.versioner.diff.from.current(state) - Get a list of differences that must be applied to the given state in order to become the current entity state") public Stream<DiffOutput> diffFromCurrent( @Name("state") Node state) { return Optional.ofNullable(state.getSingleRelationship(RelationshipType.withName(Utility.HAS_STATE_TYPE), Direction.INCOMING)) .map(Relationship::getStartNode) .map(entity -> entity.getSingleRelationship(RelationshipType.withName(Utility.CURRENT_TYPE), Direction.OUTGOING)) .map(Relationship::getEndNode) .filter(current -> !current.equals(state)) .map(current -> diffBetweenStates(state, current)) .orElse(Stream.empty()); }
Example #23
Source File: Diff.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.diff.from.previous", mode = DEFAULT) @Description("graph.versioner.diff.from.previous(state) - Get a list of differences that must be applied to the previous statusof the given one in order to become the given state") public Stream<DiffOutput> diffFromPrevious( @Name("state") Node state) { return Optional.ofNullable(state.getSingleRelationship(RelationshipType.withName(Utility.PREVIOUS_TYPE), Direction.OUTGOING)) .map(Relationship::getEndNode) .map(sFrom -> diffBetweenStates(sFrom, state)) .orElse(Stream.empty()); }
Example #24
Source File: Rollback.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.rollback.nth", mode = WRITE) @Description("graph.versioner.rollback.nth(entity, nth-state, date) - Rollback the given Entity to the nth previous State") public Stream<NodeOutput> rollbackNth( @Name("entity") Node entity, @Name("state") long nthState, @Name(value = "date", defaultValue = "null") LocalDateTime date) { LocalDateTime instantDate = defaultToNow(date); return new GetBuilder().build() .flatMap(get -> get.getNthState(entity, nthState).findFirst()) .map(state -> rollbackTo(entity, state.node, instantDate)) .orElse(Stream.empty()); }
Example #25
Source File: Update.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.patch.from", mode = Mode.WRITE) @Description("graph.versioner.patch.from(entity, state, useCurrentRel, date) - Add a new State to the given Entity, starting from the given one. It will update all the properties, not asLabels. If useCurrentRel is false, it will replace the current rels to Rs with the state ones.") public Stream<NodeOutput> patchFrom( @Name("entity") Node entity, @Name("state") Node state, @Name(value = "useCurrentRel", defaultValue = "true") Boolean useCurrentRel, @Name(value = "date", defaultValue = "null") LocalDateTime date) { LocalDateTime instantDate = defaultToNow(date); List<String> labels = streamOfIterable(state.getLabels()).map(Label::name).collect(Collectors.toList()); checkRelationship(entity, state); Optional<Relationship> currentRelationshipOpt = getCurrentRelationship(entity); Node newState = currentRelationshipOpt .map(currentRelationship -> createPatchedState(state.getAllProperties(), labels, instantDate, currentRelationship)) .orElseThrow(() -> new VersionerCoreException("Can't find any current State node for the given entity.")); //Copy all the relationships if (useCurrentRel) { currentRelationshipOpt.ifPresent(rel -> connectStateToRs(rel.getEndNode() , newState)); } else { connectStateToRs(state, newState); } log.info(LOGGER_TAG + "Patched Entity with id {}, adding a State with id {}", entity.getId(), newState.getId()); return Stream.of(new NodeOutput(newState)); }
Example #26
Source File: DeepGLProc.java From ml-models with Apache License 2.0 | 5 votes |
private PropertyMapping[] extractNodeFeatures(@Name(value = "config", defaultValue = "{}") Map<String, Object> config) { List<String> nodeFeatures = (List<String>) config.getOrDefault("nodeFeatures", Collections.emptyList()); PropertyMapping[] propertyMappings = new PropertyMapping[nodeFeatures.size()]; for (int i = 0; i < nodeFeatures.size(); i++) { propertyMappings[i] = PropertyMapping.of(nodeFeatures.get(i), nodeFeatures.get(i), 0.0); } return propertyMappings; }
Example #27
Source File: Diff.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Procedure(value = "graph.versioner.diff", mode = DEFAULT) @Description("graph.versioner.diff(stateFrom, stateTo) - Get a list of differences that must be applied to stateFrom in order to convert it into stateTo") public Stream<DiffOutput> diff( @Name("stateFrom") Node stateFrom, @Name("stateTo") Node stateTo) { return diffBetweenStates(stateFrom, stateTo); }
Example #28
Source File: CustomizeFullTextSearcher.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
private IndexReference getValidIndexReference(@Name("indexName") String name) { IndexReference indexReference = tx.schemaRead().indexGetForName(name); if (indexReference == IndexReference.NO_INDEX) { throw new IllegalArgumentException("There is no such fulltext schema index: " + name); } return indexReference; }
Example #29
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
/** * @param * @return * @Description: TODO(节点ID集合移除某些节点) */ @UserFunction(name = "zdr.apoc.removeIdsFromRawList") @Description("Remove ids from raw node id list") public List<Long> removeIdsFromRawList(@Name("rawIDs") List<Long> rawIDs, @Name("ids") List<Long> ids) { if (rawIDs != null && ids != null) { rawIDs.removeAll(ids); return rawIDs; } return rawIDs; }
Example #30
Source File: ZdrProcedures.java From ongdb-lab-apoc with Apache License 2.0 | 5 votes |
/** * @param * @return * @Description: TODO(节点是否包含某个KEY - 多个中的任意一个) */ @UserFunction(name = "zdr.apoc.nodeIsContainsKey") @Description("Node is contain key or not") public boolean nodeIsContainsKey(@Name("node") Node node, @Name("locMultiFields") List<String> locMultiFields) { Map<String, Object> mapProperties = node.getAllProperties(); for (int i = 0; i < locMultiFields.size(); i++) { String field = locMultiFields.get(i); if (mapProperties.containsKey(field)) { return true; } } return false; }