Max
Max
Explore posts from servers
ATApache TinkerPop
Created by Max on 9/3/2024 in #questions
Gremlin query to order vertices with some locked to specific positions
I'm working with a product catalog in a graph database using Gremlin. The graph structure includes: 1. Product vertices 2. Category vertices 3. belongsTo edges connecting products to categories. The edge can have an optional lockedPosition property as integer. I need to create a query that returns products in a specific order, where: 1. Some products are "locked" to specific positions (stored as a lockedPosition property on the belongsTo edge) 2. Other "unlocked" products should fill in around these fixed positions For example, if I have 20 products in a category, and product A is locked to position 3 and product B to position 7, the result should return these products in those exact positions, with other products filling the remaining slots with whatever sorting order. (this "product pinning/locking" functionality is used by merchandising team to manually re-arrange products on a product listing page). Can anyone suggest a Gremlin query to achieve this? Also, maybe my data model is wrong for this use case, so I am also keen to accept other suggestions to represent this use case. Thank you!
17 replies
DDeno
Created by Max on 5/12/2024 in #help
Deno package management questions.
I have a few questions regarding package management in Deno. 1. Here Deno documentation states that import maps are only applied to applications, and that library authors should prefer the deps.ts pattern. Contrarily, the jsr documentation specifies that a dependency manifest like the import map in the deno.json file can be used by a library. Does this mean that the deps.ts pattern is now obsolete? 2. How do I use packages published with jsr in a browser environment? Using esm.sh, I can do import ... from "https://esm.sh/preact@10.21.0". Can I do the same with jsr? 3. In jsr, all entry points have to be specified explicitly, so we no longer need to add a package with a trailing slash in the import map to import modules beyond the default entry point. Is this correct? 4. How do I replicate a configuration like this in jsr, specifically specifying external dependencies and aliases?
"imports": {
...
"@headlessui/react": "https://esm.sh/@headlessui/react@2.0.3?external=react,react-dom&alias=@types/react:preact/compat",
...
},
"imports": {
...
"@headlessui/react": "https://esm.sh/@headlessui/react@2.0.3?external=react,react-dom&alias=@types/react:preact/compat",
...
},
3 replies
DDeno
Created by Max on 11/26/2023 in #help
Custom `401 Unauthorized` error page, similar to builtin `404 Not Found`?
How can I create a custom error page that is rendered by middleware in Fresh? The middleware handles authentication for incoming requests and if a request fails authentication, the middleware should generate a 401 Unauthorized response that includes the body of the custom error page.
2 replies