use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class AnnotateProcedure method annotate.
@Procedure(name = "ga.nlp.annotate", mode = Mode.WRITE)
@Description("Performs the text annotation and store it into the graph")
public Stream<NodeResult> annotate(@Name("annotationRequest") Map<String, Object> annotationRequest) {
try {
AnnotationRequest request = AnnotationRequest.fromMap(annotationRequest);
Node result = getNLPManager().annotateTextAndPersist(request);
return Stream.of(new NodeResult(result));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
use of org.neo4j.procedure.Description in project neo4j-nlp by graphaware.
the class WorkflowTaskProcedure method start.
@Procedure(name = "ga.nlp.workflow.task.start", mode = Mode.WRITE)
@Description("Start a Task")
public Stream<WorkflowTaskResult> start(@Name(value = "name") String name) {
try {
WorkflowTask workflowTask = getWorkflowManager().getWorkflowTask(name);
if (workflowTask == null) {
throw new RuntimeException("Pipeline task not found");
}
TaskManager.getInstance().execute(workflowTask);
return Stream.of(new WorkflowTaskResult(workflowTask));
} catch (Exception e) {
LOG.error("ERROR in WorkflowTaskProcedure", e);
throw new RuntimeException(e);
}
}
use of org.neo4j.procedure.Description in project neo4j-apoc-procedures by neo4j-contrib.
the class ExtractURL method parse.
@UserFunction("apoc.data.url")
@Description("apoc.data.url('url') as {protocol,host,port,path,query,file,anchor,user} | turn URL into map structure")
public Map<String, Object> parse(@Name("url") final String value) {
if (value == null)
return null;
try {
URL u = new URL(value);
Long port = u.getPort() == -1 ? null : (long) u.getPort();
return map("protocol", u.getProtocol(), "user", u.getUserInfo(), "host", u.getHost(), "port", port, "path", u.getPath(), "file", u.getFile(), "query", u.getQuery(), "anchor", u.getRef());
} catch (MalformedURLException exc) {
return null;
}
}
use of org.neo4j.procedure.Description in project neo4j by neo4j.
the class BuiltInProcedures method indexDetails.
@Deprecated(since = "4.2.0", forRemoval = true)
@SystemProcedure
@Description("Detailed description of specific index.")
@Procedure(name = "db.indexDetails", mode = READ, deprecatedBy = "SHOW INDEXES YIELD * command")
public Stream<IndexDetailResult> indexDetails(@Name("indexName") String indexName) throws ProcedureException {
if (callContext.isSystemDatabase()) {
return Stream.empty();
}
TokenRead tokenRead = kernelTransaction.tokenRead();
IndexingService indexingService = resolver.resolveDependency(IndexingService.class);
SchemaReadCore schemaRead = kernelTransaction.schemaRead().snapshot();
List<IndexDescriptor> indexes = asList(schemaRead.indexesGetAll());
IndexDescriptor index = null;
for (IndexDescriptor candidate : indexes) {
if (candidate.getName().equals(indexName)) {
index = candidate;
break;
}
}
if (index == null) {
throw new ProcedureException(Status.Schema.IndexNotFound, "Could not find index with name \"" + indexName + "\"");
}
final IndexDetailResult indexDetailResult = asIndexDetails(tokenRead, schemaRead, index);
return Stream.of(indexDetailResult);
}
use of org.neo4j.procedure.Description in project neo4j by neo4j.
the class BuiltInDbmsProcedures method listClientConfig.
@Internal
@SystemProcedure
@Description("Return config settings interesting to clients (e.g. Neo4j Browser)")
@Procedure(name = "dbms.clientConfig", mode = DBMS)
public Stream<ConfigResult> listClientConfig() {
List<ConfigResult> results = new ArrayList<>();
Set<String> browserSettings = Stream.of("browser.allow_outgoing_connections", "browser.credential_timeout", "browser.retain_connection_credentials", "browser.retain_editor_history", "dbms.security.auth_enabled", "browser.remote_content_hostname_whitelist", "browser.post_connect_cmd", "dbms.default_database").collect(Collectors.toCollection(HashSet::new));
Config config = graph.getDependencyResolver().resolveDependency(Config.class);
config.getValues().forEach((setting, value) -> {
if (browserSettings.contains(setting.name().toLowerCase())) {
results.add(new ConfigResult(setting, value));
}
});
return results.stream().sorted(Comparator.comparing(c -> c.name));
}
Aggregations