btihen commented on issue #370:
URL: https://github.com/apache/age/issues/370#issuecomment-2453437292
I'm working on extending the 'ActiveAge' to handle paths - if anyone is
interesting giving feedback - here is what I'm thinking any comments / feedback
are appreciated:
```ruby
# DSL - When all edges are of the same type
Path
.edge(HasChild)
.path_length(1..5)
.where(start_node: {first_name: 'Zeke'})
.where('end_node.last_name CONTAINS ?', 'Flintstone')
.limit(3)
# SQL:
SELECT *
FROM cypher('age_schema', $$
MATCH path = (start_node)-[edge:HasChild*1..5]->(end_node)
WHERE start_node.first_name = 'Zeke' AND end_node.gender = 'male'
RETURN path $$) AS (path agtype)
LIMIT 3;
# DSL - with full control of the matching paths
Path
.match('(start_node)-[edge:HasChild*1..5 {guardian_role:
'father'}]->(end_node)')
.where(start_node: {first_name: 'Zeke'})
.where('end_node.last_name =~ ?', 'Flintstone')
.limit(3)
# SQL:
SELECT *
FROM cypher('age_schema', $$
MATCH path = (start_node)-[edge:HasChild*1..5 {guardian_role:
'father'}]->(end_node)
WHERE start_node.first_name = "Jed"
RETURN path $$) AS (path agtype);
# DSL RESULTS:
[
[
Person.find(844424930131969), # Zeke Flintstone
Edge.find(1407374883553281), # HasChild(mother)
Person.find(844424930131971) # Rockbottom Flintstone
],
[
Person.find(844424930131969), # Zeke Flintstone
Edge.find(1407374883553281), # HasChild(mother)
Person.find(844424930131971), # Rockbottom Flintstone
Edge.find(1407374883553284), # HasChild(falther)
Person.find(844424930131975) # Giggles Flintstone
],
[
Person.find(844424930131969), # Zeke Flintstone
Edge.find(1407374883553281), # HasChild(mother)
Person.find(844424930131971), # Rockbottom Flintstone
Edge.find(1407374883553283), # HasChild(father)
Person.find(844424930131974) # Ed Flintstone
]
]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]