use of org.neo4j.procedure.Description in project neo4j by neo4j.
the class BuiltInProcedures method listConstraints.
@Description("List all constraints in the database.")
@Procedure(name = "db.constraints", mode = READ)
public Stream<ConstraintResult> listConstraints() {
Statement statement = tx.acquireStatement();
ReadOperations operations = statement.readOperations();
TokenNameLookup tokens = new StatementTokenNameLookup(operations);
return asList(operations.constraintsGetAll()).stream().map((constraint) -> constraint.prettyPrint(tokens)).sorted().map(ConstraintResult::new).onClose(statement::close);
}
use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class AnnotateProcedure method filter.
@Procedure(name = "ga.nlp.filter", mode = Mode.WRITE)
@Description("Boolean filter for text accordingly to complex filter definition")
public Stream<SingleResult> filter(@Name("filterRequest") Map<String, Object> filterRequest) {
FilterRequest request = FilterRequest.fromMap(filterRequest);
Object result = getNLPManager().filter(request);
return Stream.of(new SingleResult(result));
}
use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class TextProcessorsProcedure method addPipeline.
@Procedure(name = "ga.nlp.processor.addPipeline", mode = Mode.WRITE)
@Description("Add custom pipeline to a Text Processor")
public Stream<SingleResult> addPipeline(@Name("addPipelineRequest") Map<String, Object> addPipelineRequest) {
try {
PipelineSpecification request = mapper.convertValue(addPipelineRequest, PipelineSpecification.class);
getNLPManager().addPipeline(request);
return Stream.of(SingleResult.success());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class TextProcessorsProcedure method test.
@Procedure(name = "ga.nlp.processor.test", mode = Mode.WRITE)
@Description("Procedure for testing custom models.")
public Stream<SingleResult> test(@Name("customModelsRequest") Map<String, Object> customModelsRequest) {
try {
CustomModelsRequest request = CustomModelsRequest.fromMap(customModelsRequest);
Object result = getNLPManager().test(request);
return Stream.of(new SingleResult(result));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class TextRankProcedure method textRankPostprocess.
@Procedure(name = "ga.nlp.ml.textRank.postprocess", mode = Mode.WRITE)
@Description("TextRank post-processing procedure")
public Stream<SingleResult> textRankPostprocess(@Name("textRankRequest") Map<String, Object> textRankRequest) {
try {
TextRankPostprocessRequest request = TextRankPostprocessRequest.fromMap(textRankRequest);
TextRankProcessor processor = (TextRankProcessor) getNLPManager().getExtension(TextRankProcessor.class);
return Stream.of(processor.postprocess(request));
} catch (Exception e) {
LOG.error("ERROR in TextRank", e);
throw new RuntimeException(e);
}
}
Aggregations