需要帮助设计 neo4j 查询

问题描述

这里是 Neo4j 新手。 我已经设置了以下关系

InputStream is = ... // you only need an input stream,no local file
    
DefaultFileSystemManager fsmanager = (DefaultFileSystemManager) VFS.getManager();
        
FileSystemOptions opts = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts,true);
StaticUserAuthenticator auth = new StaticUserAuthenticator(host,username,password);
         
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts,auth);
        
String ftpurl = "ftp://" + host + ":" + port + "/" + folder + "/" + filename;
FileObject remoteFile = fsmanager.resolveFile(ftpurl,opts);
        
try (OutputStream ostream = remoteFile.getContent().getoutputStream()) {
    // either copy input stream manually or with IoUtils.copy()
    IoUtils.copy(is,ostream);
}
        
boolean success = remoteFile.exists();
long size = remoteFile.getContent().getSize();
System.out.println(success ? "Successful,copied " + size + " bytes" : "Failed");

我将最受欢迎的股票作为

Customer - [Buys] -> Stocks

MATCH (n:Customer)-[:BUYS]->(s:Stock) RETURN s,count(distinct n) as cnt order by cnt desc limit 1 属性

我需要找到两件事。

  1. 客户在购买最受欢迎的股票之前和之后买了什么

  2. 显示最连续下单的客户 日历月?

对于 pt1:我创建了单独的查询提取最受欢迎的股票并尝试以下选项。

Buy relation have Quantity,unit price and invoice date

我想这样做,但它不起作用

Match (cust:Customer)-[b:BUYS]->(s:Stock)
where b.inInvoiceDate < (match (p)-[b1:Buys]->(s1:Stock {StockCode='18102'}) return b1.InvoiceDate) limit 10 --This fails

有没有像在 sql 世界中那样我可以创建临时表并引用它们的方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...