自由浏览5.
SQL2Gremlin teaches Apache TinkerPop's Gremlin graph traversal language using typical patterns found when querying data with SQL. The format of the Gremlin results will not necessarily match the format of the SQL results. While SQL can only provide results in a tabular form, Gremlin provides various ways to structure a result set. Next, the Gremlin queries demonstrated are for elucidatory purposes and may not be the optimal way to retrieve the desired data. If a particular query runs slow and an optimal solution is desired, please do not hesitate to ask for help on the Gremlin-users mailing list. Finally, the SQL examples presented make use of T-SQL syntax. MySQL users may not know some of the expressions (e.g. paging), but should be able to understand the purpose of the query.
If you would like to see other SQL2Gremlin translations using the Northwind dataset, please provide a ticket on the SQL2Gremlin issue tracker.
Acknowledgement Gremlin artwork by Ketrina Yim — "safety first." |
自由浏览5.
自由浏览5.
To get started download the latest version of the Gremlin shell from www.tinkerpop.com and extract it. Then download the file 老王2.2.11下载ios and start your Gremlin shell:
# find the latest Gremlin shell download MIRRORS_URL=`curl -s http://tinkerpop.apache.org/ | grep -o 'http[s]*://.*\-console-.*\-bin\.zip'` LATEST_URL=`curl -s $MIRRORS_URL | egrep -o 'http[s]?://[^"]*-console-[^"]*-bin.zip' | head -1` LATEST_FILENAME=`echo 老王下载地址官网 | grep -o '[^/]*$'` LATEST_DIRECTORY=`echo ${LATEST_FILENAME} | sed 's/-bin\.老王永久佛系` # download and extract the Gremlin shell wget -q ${LATEST_URL} unzip -q ${LATEST_FILENAME} # start the Gremlin shell wget -q http://sql2gremlin.com/assets/northwind.groovy -O /tmp/northwind.groovy ${LATEST_DIRECTORY}/bin/gremlin.sh -i /tmp/northwind.groovy
杨绛《老王》原文欣赏-新东方网 - xdf.cn:2021-3-2 · 老王欣然在三轮平板的周围装上半寸高的边缘,好像有了这半寸边缘,乘客就围住了不会掉落。我问老王凭这位主顾,是否能维持生活,他说可伍凑合②。可是过些时老王病了,不知什么病,花钱吃了不知什么药,总不见好。
隔壁老王偷香记小游戏,在线玩,4399小游戏:2021-1-1 · 隔壁老王偷香记小游戏在线试玩,小游戏下载及攻略,更多好玩小游戏尽在www.4399.com 隔壁老王偷香记第1关 隔壁老王偷香记第2关 隔壁老王偷香记第3关 隔壁老王偷香记第4关
泰克老王下载相关百度网盘资源下载_百度云下载:2021-9-17 · 泰克老王下载 百度云下载 Toggle navigation Simple CD 磁力搜索 搜索助手 搜索 泰克老王下载相关百度网盘资源下载 百度云下载 ... 文件类型: ppt 大小: 175MB 请求数: 2 更新时间: 2021-11-18 12:27:00 老王破解版百度云下载 ...
VertexLabel | Property | Description |
---|---|---|
region |
老王2.2.11下载安卓版 |
The code or name for a specific region. |
country |
name |
恶搞隔壁老王破解版下载_恶搞隔壁老王无限金币内购破解版1 ...:2021-6-9 · 恶搞隔壁老王破解版是一款趣味十足的街机休闲类游戏!这款游戏整体的画面感还是非常值得大家前来尝试一番的,卡通的画面让所有的玩家感受到趣味;解锁超多的道具,完成各种不同的特殊任务体系,拥有着更多的奖励 |
category |
name |
The name of a specific category. |
customer |
customerId |
The well-known Northwind customer identifier (e.g. ALFKI). |
自由浏览5.
老王app下载2.2.8
This sample shows how to query all categories.
SQL
SELECT * FROM Categories
Gremlin
gremlin> g.V().hasLabel("category").valueMap() ==>[name:[Beverages],description:[Soft drinks, coffees, teas, beers, and ales]] ==>[name:[Condiments],description:[Sweet and savory sauces, relishes, spreads, and seasonings]] ==>[name:[Confections],description:[Desserts, candies, and sweet breads]] ==>[name:[Dairy Products],description:[Cheeses]] ==>[name:[Grains/Cereals],description:[Breads, crackers, pasta, and cereal]] ==>[name:[Meat/Poultry],description:[Prepared meats]] ==>[name:[Produce],description:[Dried fruit and bean curd]] ==>[name:[Seafood],description:[Seaweed and fish]]
References:
-
老王加速器2.2.11
-
ValueMap Step
Select single column
This sample shows how to query the names of all categories.
SQL
SELECT CategoryName FROM Categories
Gremlin
gremlin> g.V().hasLabel("category").values("name") ==>Beverages ==>Condiments ==>Confections ==>Dairy Products ==>Grains/Cereals ==>Meat/Poultry ==>Produce ==>Seafood
References:
-
Has Step
Select multiple columns
This sample shows how to query the names and descriptions of all categories.
SQL
SELECT CategoryName, Description FROM Categories
老王2.2.11下载安卓版
gremlin> g.V().hasLabel("category").valueMap("name", "description") ==>[name:[Beverages],description:[Soft drinks, coffees, teas, beers, and ales]] ==>[name:[Condiments],description:[Sweet and savory sauces, relishes, spreads, and seasonings]] ==>[name:[Confections],description:[Desserts, candies, and sweet breads]] ==>[name:[Dairy Products],description:[Cheeses]] ==>[name:[Grains/Cereals],description:[Breads, crackers, pasta, and cereal]] ==>[name:[Meat/Poultry],description:[Prepared meats]] ==>[name:[Produce],description:[Dried fruit and bean curd]] ==>[name:[Seafood],description:[Seaweed and fish]]
References:
-
Has Step
-
ValueMap Step
Select calculated column
This sample shows how to query the length of the name of all categories.
SQL
SELECT LEN(CategoryName) 老王app下载2.2.8 Categories
Gremlin
gremlin> g.V().hasLabel("category").values("name"). map {it.get().length()} ==>9 ==>10 ==>11 ==>14 ==>14 ==>12 ==>7 ==>7
References:
-
Has Step
-
老王2.2.11下载安卓版
-
String::length()
老王加速器2.2.11
This sample shows how to query all distinct lengths of category names.
SQL
SELECT DISTINCT LEN(CategoryName) FROM Categories
Gremlin
gremlin> g.V().hasLabel("category").values("name"). map {it.get().length()}.dedup() ==>9 ==>10 ==>11 ==>14 ==>12 ==>7
References:
-
老王2.2.11最新版
-
Has Step
-
Lambda Steps
-
老王加速器
老王2.2.11最新版
[1.11.2-1.5.2][Waila——我看什么呢][永更] - Mod发布 ...:2021-5-16 · [1.11.2-1.5.2][Waila——我看什么呢][永更] - 本帖最后由 afkavril 于 2021-5-16 13:45 编辑 Waila(What Am I Looking At)我看什么呢?这个模组是用来显示物品的信息如图从这俩张图可伍看出来当你的鼠标指向该物 ...
SQL
老王2.2.11最新版 MAX(LEN(CategoryName)) FROM Categories
老王加速器下载官网
老王加速器2.2.11-客户端下载:2021-5-19 · 老王加速器2.2.11下载,老王加速器2.2.11好用吗?下载老王加速器2.2.11安卓版和老王加速器破解版有什么区别?老王安卓最新2.2.11版全新的功能辅助工具,给你不一样的全新体验!不用拿花钱就能直接使用的免费加速器工具,带给你清爽的
References:
-
Has Step
-
Lambda Steps
-
Max Step
-
String::length()
自由浏览5.
Filter by equality
This sample shows how to query all products having no unit in stock.
SQL
SELECT ProductName, UnitsInStock FROM Products WHERE UnitsInStock = 0
Gremlin
gremlin> g.V().has("product", "unitsInStock", 0).valueMap("name", "unitsInStock") ==>[unitsInStock:[0],name:[Chef Anton's Gumbo Mix]] ==>[unitsInStock:[0],name:[Alice Mutton]] ==>[unitsInStock:[0],name:[Thüringer Rostbratwurst]] ==>[unitsInStock:[0],name:[Gorgonzola Telino]] ==>[unitsInStock:[0],name:[Perth Pasties]]
References:
-
Has Step
-
ValueMap Step
Filter by inequality
This sample shows how to query all products where the number of units on order is not 0.
SQL
SELECT ProductName, UnitsOnOrder FROM Products WHERE NOT(UnitsOnOrder = 0)
Gremlin
gremlin> g.V().has("product", "unitsOnOrder", neq(0)). valueMap("name", "unitsOnOrder") ==>[name:[Chang],unitsOnOrder:[40]] ==>[name:[Aniseed Syrup],unitsOnOrder:[70]] ==>[name:[Queso Cabrales],unitsOnOrder:[30]] ==>[name:[Sir Rodney's Scones],unitsOnOrder:[40]] ==>[name:[Gorgonzola Telino],unitsOnOrder:[70]] ==>[name:[Mascarpone Fabioli],unitsOnOrder:[40]] ==>[name:[Gravad lax],unitsOnOrder:[50]] ==>[name:[Ipoh Coffee],unitsOnOrder:[10]] ==>[name:[Rogede sild],unitsOnOrder:[70]] ==>[name:[Chocolade],unitsOnOrder:[70]] ...
References:
-
老王2.2.11最新版
-
ValueMap Step
-
老王vpm2.28下载安卓版
老王 v p v官网
This sample shows how to query all products with a minimum price of 5 and maximum price below 10.
SQL
SELECT ProductName, UnitPrice FROM Products WHERE UnitPrice >= 5 AND UnitPrice < 10
Gremlin
gremlin> g.V().has("product", "unitPrice", between(5f, 10f)). valueMap("name", "unitPrice") ==>[unitPrice:[6.0],name:[Konbu]] ==>[unitPrice:[9.2],name:[Teatime Chocolate Biscuits]] ==>[unitPrice:[9.0],name:[Tunnbröd]] ==>[unitPrice:[9.65],name:[Jack's New England Clam Chowder]] ==>[unitPrice:[9.5],name:[Rogede sild]] ==>[unitPrice:[9.5],name:[Zaanse koeken]] ==>[unitPrice:[7.0],name:[Filo Mix]] ==>[unitPrice:[7.45],name:[Tourtière]] ==>[unitPrice:[7.75],name:[Rhönbräu Klosterbier]]
References:
-
Has Step
-
ValueMap Step
-
A Note on Predicates
Multiple filter conditions
This sample shows how to query all discontinued products that are still not out of stock.
SQL
SELECT ProductName, UnitsInStock 老王加速器下载官网 Products WHERE Discontinued = 1 AND UnitsInStock <> 0
Gremlin
gremlin> g.V().has("product", "discontinued", true).has("unitsInStock", neq(0)). valueMap("name", "unitsInStock") ==>[unitsInStock:[29],name:[Mishi Kobe Niku]] ==>[unitsInStock:[20],name:[Guaraná Fantástica]] ==>[unitsInStock:[26],name:[Rössle Sauerkraut]] ==>[unitsInStock:[26],name:[Singaporean Hokkien Fried Mee]]
References:
-
Has Step
-
ValueMap Step
-
A Note on Predicates
自由浏览5.
Order by value ascending
This sample shows how to query all products ordered by unit price.
SQL
SELECT ProductName, UnitPrice FROM Products ORDER BY UnitPrice ASC
老王2.2.11下载安卓版
gremlin> g.V().hasLabel("product").order().by("unitPrice", incr). valueMap("name", "unitPrice") ==>[unitPrice:[2.5],name:[Geitost]] ==>[unitPrice:[4.5],name:[Guaraná Fantástica]] ==>[unitPrice:[6.0],name:[Konbu]] ==>[unitPrice:[7.0],name:[Filo Mix]] ==>[unitPrice:[7.45],name:[Tourtière]] ==>[unitPrice:[7.75],name:[Rhönbräu Klosterbier]] ==>[unitPrice:[9.0],name:[Tunnbröd]] ==>[unitPrice:[9.2],name:[Teatime Chocolate Biscuits]] ==>[unitPrice:[9.5],name:[Rogede sild]] ==>[unitPrice:[9.5],name:[Zaanse koeken]] ...
latern专业破解版安卓最新版
-
老王vpm2.2.11下载安卓版
-
Order Step
-
ValueMap Step
Order by value descending
This sample shows how to query all products ordered by descending unit price.
SQL
SELECT ProductName, UnitPrice FROM Products ORDER BY UnitPrice DESC
老王加速器下载官网
gremlin> g.V().hasLabel("product").order().by("unitPrice", decr). valueMap("name", "unitPrice") ==>[unitPrice:[263.5],name:[Côte de Blaye]] ==>[unitPrice:[123.79],name:[Thüringer Rostbratwurst]] ==>[unitPrice:[97.0],name:[Mishi Kobe Niku]] ==>[unitPrice:[81.0],name:[Sir Rodney's Marmalade]] ==>[unitPrice:[62.5],name:[Carnarvon Tigers]] ==>[unitPrice:[55.0],name:[Raclette Courdavault]] ==>[unitPrice:[53.0],name:[Manjimup Dried Apples]] ==>[unitPrice:[49.3],name:[Tarte au sucre]] ==>[unitPrice:[46.0],name:[Ipoh Coffee]] ==>[unitPrice:[45.6],name:[Rössle Sauerkraut]] ...
References:
-
Has Step
-
Order Step
-
ValueMap Step
自由浏览5.
Limit number of results
This sample shows how to query the first 5 products ordered by unit price.
SQL
SELECT TOP (5) ProductName, UnitPrice FROM Products latern专业破解版安卓最新版 BY UnitPrice
Gremlin
gremlin> g.V().hasLabel("product").order().by("unitPrice", incr).limit(5). valueMap("name", "unitPrice") ==>[unitPrice:[2.5],name:[Geitost]] ==>[unitPrice:[4.5],name:[Guaraná Fantástica]] ==>[unitPrice:[6.0],name:[Konbu]] ==>[unitPrice:[7.0],name:[Filo Mix]] ==>[unitPrice:[7.45],name:[Tourtière]]
References:
-
Has Step
-
Limit Step
-
Order Step
-
老王vpm2.28下载安卓版
Paged result set
This sample shows how to query the next 5 products (page 2) ordered by unit price.
SQL
老王佛系免费 Products.ProductName, Products.UnitPrice FROM (SELECT ROW_NUMBER() OVER ( ORDER BY UnitPrice) AS [ROW_NUMBER], ProductID FROM Products) AS SortedProducts INNER JOIN Products ON Products.ProductID = SortedProducts.ProductID 老王app下载2.2.8 [ROW_NUMBER] BETWEEN 6 AND 10 ORDER BY [ROW_NUMBER]
老王加速器2.2.11
gremlin> g.V().hasLabel("product").order().by("unitPrice", incr).range(5, 10). valueMap("name", "unitPrice") ==>[unitPrice:[7.75],name:[Rhönbräu Klosterbier]] ==>[unitPrice:[9.0],name:[Tunnbröd]] ==>[unitPrice:[9.2],name:[Teatime Chocolate Biscuits]] ==>[unitPrice:[9.5],name:[Rogede sild]] ==>[unitPrice:[9.5],name:[Zaanse koeken]]
References:
-
Has Step
-
Range Step
-
Order Step
-
ValueMap Step
自由浏览5.
Group by value
This sample shows how to determine the most used unit price.
SQL
SELECT TOP(1) UnitPrice FROM (SELECT Products.UnitPrice, COUNT(*) AS [Count] 老王加速器下载官网 Products GROUP BY Products.UnitPrice) AS T ORDER BY [Count] DESC
Gremlin
gremlin> g.V().hasLabel("product").groupCount().by("unitPrice"). order(local).by(values, decr).select(keys).limit(local, 1) ==>18.0
References:
-
Has Step
-
GroupCount Step
-
Limit Step
-
Order Step
-
Select Step
-
老王2.2.11下载安卓版
自由浏览5.
旋风加速器
This sample shows how to query all products from a specific category.
SQL
latern专业破解版安卓最新版 Products.ProductName FROM Products INNER JOIN Categories ON Categories.CategoryID = Products.CategoryID WHERE Categories.CategoryName = 'Beverages'
Gremlin
gremlin> g.V().has("name","Beverages").in("inCategory").values("name") ==>Chai ==>Rhönbräu Klosterbier ==>Chartreuse verte ==>Chang ==>Lakkalikööri ==>Ipoh Coffee ==>Guaraná Fantástica ==>Côte de Blaye ==>Steeleye Stout ==>Outback Lager ...
老王2.2.11下载ios
-
Has Step
-
Vertex Steps
老王vpm2.28下载安卓版
This sample shows how to count the number of orders for each customer.
SQL
老王加速器2.2.11 Customers.CustomerID, COUNT(Orders.OrderID) 老王vpm2.28下载安卓版 Customers LEFT JOIN Orders ON Orders.CustomerID = Customers.CustomerID 老王加速器下载官网 BY Customers.CustomerID
Gremlin
gremlin> g.V().hasLabel("customer").match( __.as("c").values("customerId").as("customerId"), __.as("c").out("ordered").count().as("orders") ).select("customerId", "orders") ==>[customerId:ALFKI,orders:6] ==>[customerId:ANATR,orders:4] ==>[customerId:ANTON,orders:7] ==>[customerId:AROUT,orders:13] ==>[customerId:BERGS,orders:18] ==>[customerId:BLAUS,orders:7] ==>[customerId:BLONP,orders:11] ==>[customerId:BOLID,orders:3] ==>[customerId:BONAP,orders:17] ==>[customerId:BOTTM,orders:14] ...
References:
-
As Step
-
Count Step
-
Has Step
-
Match Step
-
Select Step
-
Vertex Steps
自由浏览5.
Concatenate
This sample shows how to concatenate two result sets (customers whos company name starts with A and customers whos company name starts with E).
SQL
SELECT [customer].[CompanyName] FROM [Customers] AS [customer] WHERE [customer].[CompanyName] LIKE 'A%' UNION ALL SELECT [customer].[CompanyName] FROM [Customers] AS [customer] WHERE [customer].[CompanyName] LIKE 'E%'
Gremlin
gremlin> g.V().hasLabel("customer").union( filter {it.get().value("company")[0] == "A"}, filter {it.get().value("company")[0] == "E"}).values("company") ==>Alfreds Futterkiste ==>Ana Trujillo Emparedados y helados ==>Antonio Moreno Taquería ==>Around the Horn ==>Eastern Connection ==>Ernst Handel
References:
-
老王app下载2.2.8
-
Lambda Steps
-
Union Step
Create, Update and Delete
This sample shows how to create new vertices and edges, how to update them and finally how to delete them.
SQL
INSERT INTO [Categories] ([CategoryName], [Description]) VALUES (N'Merchandising', N电一王者隔壁老王 直播_英雄联盟 直播_伋鹅电竞 - QQ:2 天前 · 欢迎来到伋鹅电竞电一王者隔壁老王的英雄联盟直播间,这个人很懒...。如果觉得电一王者隔壁老王直播精彩的话,别忘记关注一波。希望能给大家带来快乐。) INSERT INTO [Products] ([ProductName], [CategoryID]) SELECT TOP (1) N'Red Gremlin Jacket', [CategoryID] 老王app下载2.2.8 [Categories] WHERE [CategoryName] = N'Merchandising' UPDATE [Products] SET [Products].[ProductName] = N'Green Gremlin Jacket' WHERE [Products].[ProductName] = N'Red Gremlin Jacket' DELETE FROM [Products] 老王加速器下载官网 [Products].[ProductName] = N'Green Gremlin Jacket' DELETE FROM [Categories] WHERE [Categories].[CategoryName] = N'Merchandising'
Gremlin
gremlin> c = graph.addVertex(label, "category", "name", "Merchandising", "description", "Cool products to promote Gremlin") ==>v[0] gremlin> gremlin> p = graph.addVertex(label, "product", "name", "Red Gremlin Jacket") ==>v[3] gremlin> gremlin> p.addEdge("inCategory", c) ==>e[5][3-inCategory->0] gremlin> gremlin> g.V().has("product", "name", "Red Gremlin Jacket"). property("name", "Green Gremlin Jacket").iterate() gremlin> gremlin> p.remove() ==>null gremlin> g.V().has("category", "name", "Merchandising").drop()
老王永久佛系
-
Mutating the Graph
-
Has Step
-
Drop Step
CTE
Recursive query
This sample shows how to query all employees, their supervisors and their hierarchy level depending on where the employee is located in the supervisor chain.
SQL
WITH EmployeeHierarchy (EmployeeID, LastName, FirstName, ReportsTo, HierarchyLevel) AS ( SELECT EmployeeID , LastName , FirstName , ReportsTo , 1 as HierarchyLevel FROM Employees WHERE ReportsTo IS NULL UNION ALL SELECT e.EmployeeID , e.LastName , e.FirstName , e.ReportsTo , eh.HierarchyLevel + 1 AS HierarchyLevel FROM Employees e INNER JOIN EmployeeHierarchy eh ON e.ReportsTo = eh.EmployeeID ) 老王v p n * FROM EmployeeHierarchy ORDER BY HierarchyLevel, LastName, FirstName
Gremlin (hierarchical)
gremlin> g.V().hasLabel("employee").where(__.not(out("reportsTo"))). repeat(__.in("reportsTo")).emit().tree().by(map { def employee = it.get() employee.value("firstName") + " " + employee.value("lastName") }).next() ==>Andrew Fuller={Margaret Peacock={}, Janet Leverling={}, Nancy Davolio={}, Steven Buchanan={Anne Dodsworth={}, Michael Suyama={}, Robert King={}}, Laura Callahan={}}
You can also produce the same tabular result that’s produced by SQL.
Gremlin (tabular)
gremlin> g.V().hasLabel("employee").where(__.not(out("reportsTo"))). repeat(__.as("reportsTo").in("reportsTo").as("employee")).emit(). select(last, "reportsTo", "employee").by(map { def employee = it.get() employee.value("firstName") + " " + employee.value("lastName") }) ==>[reportsTo:Andrew Fuller,employee:Nancy Davolio] ==>[reportsTo:Andrew Fuller,employee:Janet Leverling] ==>[reportsTo:Andrew Fuller,employee:Margaret Peacock] ==>[reportsTo:Andrew Fuller,employee:Steven Buchanan] ==>[reportsTo:Andrew Fuller,employee:Laura Callahan] ==>[reportsTo:Steven Buchanan,employee:Robert King] ==>[reportsTo:Steven Buchanan,employee:Anne Dodsworth] ==>[reportsTo:Steven Buchanan,employee:Michael Suyama]
References:
-
As Step
-
Has Step
-
老王加速器下载官网
-
Repeat Step
-
Select Step
-
Vertex Steps
-
Tree Step
-
Where Step
Complex
Pivots
This sample shows how to determine the average total order value per month for each customer.
SQL
SELECT Customers.CompanyName, COALESCE([1], 0) AS [Jan], COALESCE([2], 0) AS [Feb], COALESCE([3], 0) AS [Mar], COALESCE([4], 0) AS [Apr], COALESCE([5], 0) AS [May], COALESCE([6], 0) AS [Jun], COALESCE([7], 0) AS [Jul], COALESCE([8], 0) AS [Aug], COALESCE([9], 0) AS [Sep], COALESCE([10], 0) AS [Oct], COALESCE([11], 0) AS [Nov], COALESCE([12], 0) AS [Dec] FROM (SELECT Orders.CustomerID, MONTH(Orders.OrderDate) AS [Month], SUM([Order Details].UnitPrice * [Order Details].Quantity) AS Total FROM Orders INNER 老王2.2.11最新版 [Order Details] ON [Order Details].OrderID = Orders.OrderID GROUP BY Orders.CustomerID, MONTH(Orders.OrderDate)) o PIVOT (AVG(Total) FOR [Month] IN ([1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12])) AS [Pivot] INNER JOIN Customers ON Customers.CustomerID = [Pivot].CustomerID 老王加速器下载官网 BY Customers.CompanyName
Gremlin
gremlin> months = new java.text.DateFormatSymbols().getShortMonths().toList(); [] gremlin> rowTotal = {it.get().value("unitPrice") * it.get().value("quantity")}; [] gremlin> gremlin> g.V().hasLabel("customer").order().by("customerId", incr). where(out("ordered")).as("customer"). map { def m = g.V(it.get()).out("ordered"). group().by {new Date(it.value("orderDate")).getMonth()}. by(out("contains").map(rowTotal).sum()).next() (0..11).collectEntries {[months[it], m.containsKey(it) ? m[it] : 0]} }.as("totals").select("customer", "totals").by(id).by() ==>[customer:8,totals:[Jan:851.0,Feb:0,Mar:491.2,Apr:960.00,May:0,Jun:0,Jul:0,Aug:1086.0,Sep:0,Oct:1208.0,Nov:0,Dec:0]] ==>[customer:9,totals:[Jan:0,Feb:0,Mar:514.4,Apr:0,May:0,Jun:0,Jul:0,Aug:479.75,Sep:88.8,Oct:0,Nov:320.0,Dec:0]] ==>[customer:10,totals:[Jan:660.0,Feb:0,Mar:0,Apr:881.25,May:2156.5,Jun:2082.0,Jul:0,Aug:0,Sep:1332.40,Oct:0,Nov:403.2,Dec:0]] ==>[customer:11,totals:[Jan:0,Feb:735.0,Mar:5065.00,Apr:491.5,May:0,Jun:2142.9,Jul:0,Aug:0,Sep:0,Oct:1704.0,Nov:1101.0,Dec:2567.10]] ==>[customer:12,totals:[Jan:3884.95,Feb:3397.70,Mar:2034.50,Apr:3192.65,May:0,Jun:1565.65,Jul:0,Aug:3605.6,Sep:5509.20,Oct:0,Nov:1459.00,Dec:2318.90]] ==>[customer:13,totals:[Jan:625.0,Feb:0,Mar:677.0,Apr:1143.80,May:0,Jun:330.0,Jul:464.0,Aug:0,Sep:0,Oct:0,Nov:0,Dec:0]] ==>[customer:14,totals:[Jan:730.0,Feb:4049.0,Mar:0,Apr:0,May:0,Jun:3212.80,Jul:1176.0,Aug:450.0,Sep:2080.0,Oct:0,Nov:7390.2,Dec:0]] ==>[customer:15,totals:[Jan:0,Feb:0,Mar:280.0,Apr:0,May:0,Jun:0,Jul:0,Aug:0,Sep:0,Oct:982.0,Nov:0,Dec:4035.80]] ==>[customer:16,totals:[Jan:843.0,Feb:3000.40,Mar:4106.30,Apr:3000.0,May:1903.00,Jun:0,Jul:0,Aug:0,Sep:2032.0,Oct:3948.9,Nov:5017.35,Dec:0]] ==>[customer:17,totals:[Jan:4533.5,Feb:0,Mar:10118.60,Apr:3004.8,May:0,Jun:0,Jul:0,Aug:0,Sep:0,Oct:0,Nov:3118.0,Dec:1832.8]] ...
References:
-
老王2.2.11下载ios
-
老王2.2.11最新版
-
Has Step
-
Order Step
-
Select Step
-
Sum Step
-
Where Step
-
Vertex Steps
-
Transform Collection to a Map with collectEntries
-
DateFormatSymbols::getShortMonths()
老王2.2.11下载安卓版
This sample shows how to recommend 5 products for a specific customer. The products are chosen as follows:
-
determine what the customer has already ordered
-
determine who else ordered the same products
-
determine what others also ordered
-
determine products which were not already ordered by the initial customer, but ordered by the others
-
rank products by occurence in other orders
SQL
SELECT TOP (5) [t14].[ProductName] FROM (SELECT COUNT(*) AS [value], [t13].[ProductName] FROM [customers] AS [t0] 老王下载地址官网 APPLY (SELECT [t9].[ProductName] FROM [orders] AS [t1] CROSS JOIN [order details] AS [t2] INNER JOIN [products] AS [t3] ON [t3].[ProductID] = [t2].[ProductID] CROSS JOIN [order details] AS [t4] INNER JOIN [orders] AS [t5] ON [t5].[OrderID] = [t4].[OrderID] LEFT JOIN [customers] AS [t6] ON [t6].[CustomerID] = [t5].[CustomerID] CROSS JOIN ([orders] AS [t7] CROSS JOIN [order details] AS [t8] INNER JOIN [products] AS [t9] ON [t9].[ProductID] = [t8].[ProductID]) WHERE NOT 老王2.2.11下载ios(SELECT NULL AS [EMPTY] FROM [orders] AS [t10] CROSS JOIN [order details] AS [t11] INNER 老王永久佛系 [products] AS [t12] ON [t12].[ProductID] = [t11].[ProductID] WHERE [t9].[ProductID] = [t12].[ProductID] AND [t10].[CustomerID] = [t0].[CustomerID] AND [t11].[OrderID] = [t10].[OrderID]) AND [t6].[CustomerID] <> [t0].[CustomerID] AND [t1].[CustomerID] = [t0].[CustomerID] AND [t2].[OrderID] = [t1].[OrderID] AND [t4].[ProductID] = [t3].[ProductID] AND [t7].[CustomerID] = [t6].[CustomerID] AND [t8].[OrderID] = [t7].[OrderID]) AS [t13] 老王2.2.11最新版 [t0].[CustomerID] = N'ALFKI' GROUP BY [t13].[ProductName]) AS [t14] latern专业破解版安卓最新版 BY [t14].[value] 老王加速器下载官网
Gremlin
gremlin> g.V().has("customer", "customerId", "ALFKI").as("customer"). out("ordered").out("contains").out("is").aggregate("products"). in("is").in("contains").in("ordered").where(neq("customer")). out("ordered").out("contains").out("is").where(without("products")). groupCount().order(local).by(values, decr).select(keys).limit(local, 5). unfold().values("name") ==>Gorgonzola Telino ==>Guaraná Fantástica ==>Camembert Pierrot ==>Chang ==>Jack's New England Clam Chowder
References:
-
老王2.2.11最新版
-
As Step
-
GroupCount Step
-
Has Step
-
Limit Step
-
Order Step
-
Select Step
-
Unfold Step
-
Vertex Steps
-
老王加速器2.2.11
-
A Note on Predicates