avowkind commented on issue #365:
URL: https://github.com/apache/age/issues/365#issuecomment-2048586407

   Using that query I get
   
   "{""id"": 3096224744137123, ""label"": ""featureOfInterest"", ""end_id"": 
1407374883553780, ""start_id"": 2533274790715811, ""properties"": {}}::edge"
   "{""id"": 3096224744137124, ""label"": ""featureOfInterest"", ""end_id"": 
1407374883553780, ""start_id"": 2533274790715812, ""properties"": {}}::edge"
   "{""id"": 3096224744137125, ""label"": ""featureOfInterest"", ""end_id"": 
1407374883555256, ""start_id"": 2533274790715813, ""properties"": {}}::edge”
   
   Using this modified version
   SELECT * FROM cypher('fishpond', $$
   MATCH (o)-[edge:featureOfInterest]->(f)
   where id(edge) > 3096224744137122
   and id(edge) < 3096224744137126
   RETURN o, edge, f ORDER BY id(edge) $$) as (o agtype, edge agtype, f agtype);
   
   I get only 2 results
   "{""id"": 2533274790715811, ""label"": ""Observation"", ""properties"": 
{""id"": ""fde14e35"", ""result"": 6, ""parameters"": {""filename"": ""Class 18 
2021 feeding records Nov 21 -.xlsx"", ""sheetname"": ""South pen (mix)""}, 
""resultTime"": ""2022-03-20T00:00:00Z"", ""phenomenonTime"": 
""2022-03-20T00:00:00Z"", ""observedProperty"": ""mortality_fish_weight_g"", 
""featureOfInterest"": ""pfr:nelson:tank:C09""}}::vertex""{""id"": 
3096224744137123, ""label"": ""featureOfInterest"", ""end_id"": 
1407374883553780, ""start_id"": 2533274790715811, ""properties"": 
{}}::edge""{""id"": 1407374883553780, ""label"": ""Feature"", ""properties"": 
{""id"": ""pfr:nelson:tank:C09"", ""name"": ""C09"", ""relations"": [{""id"": 
""pfr:nelson:tank_group:C"", ""relation"": ""partOf""}], ""description"": 
""C09"", ""featureGroup"": ""pfr:fg:tank""}}::vertex"
   "{""id"": 2533274790715813, ""label"": ""Observation"", ""properties"": 
{""id"": ""3de89087"", ""result"": 750, ""parameters"": {""Comments"": ""2mm 
Japanese and 2.3mm skretting"", ""filename"": ""Class 18 2021 feeding records 
Nov 21 -.xlsx"", ""food_type"": ""2.3mm EP02 Otohime (g)"", ""sheetname"": 
""South pen (mix) (2)""}, ""resultTime"": ""2022-03-25T00:00:00Z"", 
""phenomenonTime"": ""2022-03-25T00:00:00Z"", ""observedProperty"": 
""fish_food_g"", ""featureOfInterest"": 
""pfr:nelson:tank:seapen_south""}}::vertex""{""id"": 3096224744137125, 
""label"": ""featureOfInterest"", ""end_id"": 1407374883555256, ""start_id"": 
2533274790715813, ""properties"": {}}::edge""{""id"": 1407374883555256, 
""label"": ""Feature"", ""properties"": {""id"": 
""pfr:nelson:tank:seapen_south"", ""name"": ""Beatrix Bay South"", 
""relations"": [{""id"": ""pfr:nelson:tank_group:beatrix_bay"", ""relation"": 
""partOf""}], ""description"": ""South Pen"", ""featureGroup"": 
""pfr:fg:tank""}}::vertex”
   
   So the "{""id"": 3096224744137124, ""label"": ""featureOfInterest"", 
""end_id"": 1407374883553780, ""start_id"": 2533274790715812, ""properties"": 
{}}::edge”. Is the problem one.
   
   Checking the start ID It does not exist.
   
   select * from cypher('fishpond', $$
   MATCH (o)
   WHERE id(o) = 2533274790715812
   RETURN o $$) as (o agtype);
   
   While changing the id to 811 or 813 we get a result.
   
   So we have a single observation record that is missing and a dangling edge.
   
   Deleting the edge
   SELECT * FROM cypher('fishpond', $$
   MATCH ()-[edge:featureOfInterest]->()
   where id(edge) = 3096224744137124
   DELETE edge
   RETURN edge ORDER BY id(edge) $$) as (edge agtype);
   
   However I think there must be multiple examples of these deleted 
observations that have dangling edges.
   
   What would a cypher query look like to find them?
   
   Thanks Andrew
   
   > On 11 Apr 2024, at 10:45 AM, Andrew Watkins ***@***.***> wrote:
   >
   > To clarify
   >
   > This [edge:featureOfInterest] is the link between an observation and a 
feature.
   >
   > Might it be the case that we have an observation that has been lost or 
deleted somehow without the edge being removed. e.g .if someone did MATCH 
DELETE without the DETACH?
   >
   > Or is it the feature end that is missing?
   >
   > Thanks Andrew
   >
   >> On 11 Apr 2024, at 8:41 AM, John Gemignani ***@***.***> wrote:
   >>
   >> ***@***.***(https://github.com/avowkind) I know why it fails and then 
works -
   >>
   >> Technically speaking, it shouldn't work as that error is a fatal error, 
that's why it fails the first run. However, the context isn't cleaned up, so it 
works the second run because a context already exists and it doesn't need to 
build a new one. As to why it is getting an edge that doesn't have a valid 
start or end id and why that edge it got doesn't exist,... I'm still looking 
into that.
   >>
   >> For me, it is failing on an edge found in "featureOfInterest" -
   >>
   >> (gdb) p {edge_id, edge_vertex_start_id, edge_vertex_end_id}
   >> $4 = {3096224744137124, 2533274790715812, 1407374883553780}
   >>
   >> fishpond=# SELECT * FROM cypher('fishpond', $$MATCH 
()-[edge:featureOfInterest]->() where id(edge) > 3096224744137122 and id(edge) 
< 3096224744137126 RETURN edge ORDER BY id(edge) $$) as (edge agtype);
   >>                                                                    edge
   >>
   >> 
------------------------------------------------------------------------------------------------------------------------------------
   >> ------
   >>  {"id": 3096224744137123, "label": "featureOfInterest", "end_id": 
1407374883553780, "start_id": 2533274790715811, "properties": {}}:
   >> :edge
   >>  {"id": 3096224744137125, "label": "featureOfInterest", "end_id": 
1407374883555256, "start_id": 2533274790715813, "properties": {}}:
   >> :edge
   >> (2 rows)
   >>
   >> fishpond=#
   >>
   >> —
   >> Reply to this email directly, [view it on 
GitHub](https://github.com/apache/age/issues/365#issuecomment-2048401215), or 
[unsubscribe](https://github.com/notifications/unsubscribe-auth/AAMFYFLOHEUCESYI3TEYUXDY4WPY3AVCNFSM6AAAAAASIWFLLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYGQYDCMRRGU).
   >> You are receiving this because you were mentioned.Message ID: ***@***.***>


-- 
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: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to