You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by GitBox <gi...@apache.org> on 2021/12/05 06:13:36 UTC

[GitHub] [incubator-age] afidegnum opened a new issue #153: Collect returns an empty result.

afidegnum opened a new issue #153:
URL: https://github.com/apache/incubator-age/issues/153


   I tried obtaining a nested value between the parent uniquely and all it's children. 
   
   the following query returns empty on children. 
   ```
   
   SELECT * from cypher('text_test', $$
             MATCH (V)-[R:connect]->(V2)
             RETURN V,collect(V2.tag)
   $$) as (V agtype, V2 agtype);
   ```
   
   
   
   ```
   {"id":844424930131987,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"second\", \"class\": \"below\"}"}} | []
   -- | --
   {"id":844424930131973,"label":"node","properties":{"tag":"body","attrib":"null"}} | []
   {"id":844424930131970,"label":"node","properties":{"tag":"head","attrib":"null"}} | []
   {"id":844424930131985,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"innertwo\"}"}} | []
   {"id":844424930131978,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"idone\", \"class\": \"classone\"}"}} | []
   {"id":844424930131974,"label":"node","properties":{"tag":"ul","attrib":"{\"class\": \"menu\"}"}} | []
   {"id":844424930131988,"label":"node","properties":{"tag":"div","attrib":"{\"class\": \"inner\"}"}} | []
   {"id":844424930131983,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"innerone\"}"}} | []
   {"id":844424930131979,"label":"node","properties":{"tag":"ul","attrib":"{\"class\": \"listing\"}"}} | []
   {"id":844424930131969,"label":"node","properties":{"tag":"html","attrib":"{\"lang\": \"en\"}"}} | []
   
   
   ```


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] emotionbug commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
emotionbug commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-998519373


   I resolved issue on AGViewer. anything else left?


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-987139518


   you can have a look [at my repo](https://github.com/afidegnum/dom_serializer)


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] joefagan commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
joefagan commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986869831


   @afidegnum 
   
   Works and formats correctly for me.
   Please send me your code that built the graph and you query that failed.
   
   
   ![image](https://user-images.githubusercontent.com/48284776/144870968-53094e2e-0ca1-4de1-89e1-0608e51e8e94.png)
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-998538476


   Not for now. still working on the other issue


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] joefagan commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
joefagan commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986811673


   @afidegnum 
   You shouldn't need to rely on Python to filter your results. What you're doing should work. 
   Would be good to see all your code.
   Please test the following. If it works, then please submit all your code that doesn't work.
   
   ```
   -- drop graph for cleanup between tests
   SELECT * FROM ag_catalog.drop_graph('test_graph', true);
   
   -- start from a new graph
   -- create parent connected to 2 children with multiple properties
   SELECT * FROM create_graph('test_graph');
   SELECT * FROM cypher('test_graph', $$
       CREATE (p:person {name: 'parent'})
       CREATE (c1:person {name: 'child1', age: 11 })
       CREATE (c2:person {name: 'child2', age: 12 })
       CREATE (p)-[:connect]->(c1)
       CREATE (p)-[:connect]->(c2)
       RETURN p
   $$) as (p agtype);
   
   -- collect a property of children
   SELECT * from cypher('test_graph', $$
             MATCH (p)-[connect]->(c)
             RETURN p.name,collect(c.name)
   $$) as (p agtype, c agtype);
   ```
   Last query should return
       p     |          c
   ----------+----------------------
    "parent" | ["child2", "child1"]
   (1 row)
   
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986621487


   I just discovered the correct query later on, what I needed to do is not to filter any field out, the rest could be done from python
   
   ```
             SELECT * from cypher('text_test', $$
             MATCH (V:node)-[connect]->(V2:node)
   			WITH V as parent, COLLECT(V2) as children
             RETURN parent, children
   $$) as (parent agtype, children agtype);
   ```
   
   
   {"id":844424930131987,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"second\", \"class\": \"below\"}"}} | [{"id":844424930131988,"label":"node","properties":{"tag":"div","attrib":"{\"class\": \"inner\"}"}}]
   -- | --
     |  
   ```
   {"id":844424930131973,"label":"node","properties":{"tag":"body","attrib":"null"}} | [{"id":844424930131987,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"second\", \"class\": \"below\"}"}},
   
   {"id":844424930131978,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"idone\", \"class\": \"classone\"}"}},{"id":844424930131974,"label":"node","properties":{"tag":"ul","attrib":"{\"class\": \"menu\"}"}}]
   
   {"id":844424930131970,"label":"node","properties":{"tag":"head","attrib":"null"}} | [{"id":844424930131972,"label":"node","properties":{"tag":"title","attrib":"null"}},
   {"id":844424930131971,"label":"node","properties":{"tag":"meta","attrib":"{\"charset\": \"UTF-8\"}"}}]
   {"id":844424930131985,"label":"node","properties":{"tag":"div","attrib":"{\"id\": \"innertwo\"}"}} | [{"id":844424930131986,"label":"node","properties":{"tag":"h2","attrib":"null"}}]
   
   
   ```


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum edited a comment on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum edited a comment on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986852998


   That's the result so far.  
   I noticed some of the results are also not formatted in `apache-age-python` I draw the attention to the maintainer. I'm still waiting for his reply.
   
   ![image](https://user-images.githubusercontent.com/374206/144868613-16357993-c689-4957-a7e6-10f8461b5cc2.png)
   
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] emotionbug closed issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
emotionbug closed issue #153:
URL: https://github.com/apache/incubator-age/issues/153


   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986619120


   those returns perfectly 
   
   ```
   SELECT *
   FROM cypher('text_test', $$
             MATCH (V)-[R:connect]->(V2)
             RETURN V, R, V2
   $$) as (V agtype, R agtype, V2 agtype);
   
   ```
   ```
   
   v | r | v2
   -- | -- | --
   {"id":844424930131969,"label":"node","properties":{"tag":"html","attrib":"{\"lang\": \"en\"}"}} | {"id":1125899906842628,"label":"connect","end_id":844424930131973,"start_id":844424930131969,"properties":{"name":null}} | {"id":844424930131973,"label":"node","properties":{"tag":"body","attrib":"null"}}
   {"id":844424930131969,"label":"node","properties":{"tag":"html","attrib":"{\"lang\": \"en\"}"}} | {"id":1125899906842625,"label":"connect","end_id":844424930131970,"start_id":844424930131969,"properties":{"name":null}} | {"id":844424930131970,"label":"node","properties":{"tag":"head","attrib":"null"}}
   {"id":844424930131970,"label":"node","properties":{"tag":"head","attrib":"null"}} | {"id":1125899906842627,"label":"connect","end_id":844424930131972,"start_id":844424930131970,"properties":{"name":null}} | {"id":844424930131972,"label":"node","properties":{"tag":"title","attrib":"null"}}
   ```
   
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] pdpotter commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
pdpotter commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986542230


   Is it possible to give some more information about the date in your graph? E.g. the result of
   
   ```
   SELECT *
   FROM cypher('text_test', $$
             MATCH (V)-[R:connect]->(V2)
             RETURN V, R, V2
   $$) as (V agtype, R agtype, V2 agtype);
   ```
   
   The following minimal example seems to work:
   ### Setup
   ```
   SELECT *
   FROM cypher('test_graph', $$
       CREATE (n:person {name: 'parent'})
       RETURN n
   $$) as (n agtype);
   ```
   ```
                                             n                                           
   --------------------------------------------------------------------------------------
    {"id": 844424930131972, "label": "person", "properties": {"name": "parent"}}::vertex
   (1 row)
   ```
   ```
   SELECT *
   FROM cypher('test_graph', $$
       CREATE (n:person {name: 'child1'})
       RETURN n
   $$) as (n agtype);
   ```
   ```
                                             n                                           
   --------------------------------------------------------------------------------------
    {"id": 844424930131973, "label": "person", "properties": {"name": "child1"}}::vertex
   (1 row)
   ```
   ```
   SELECT 
    FROM cypher('test_graph', $$
       CREATE (n:person {name: 'child2'})
       RETURN n
   $$) as (n agtype);
   ```
   ```
                                             n                                           
   --------------------------------------------------------------------------------------
    {"id": 844424930131974, "label": "person", "properties": {"name": "child2"}}::vertex
   (1 row)
   ```
   ```
   SELECT *
   FROM cypher('test_graph', $$
       MATCH (p:person {name:'parent'}), (c1:person {name:'child1'})
       CREATE (p)-[:connect]->(c1)
       RETURN p, c1
   $$) as (p agtype, c1 agtype);
   ```
   ```
                                             p                                           |                                          c1                                          
   --------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------
    {"id": 844424930131972, "label": "person", "properties": {"name": "parent"}}::vertex | {"id": 844424930131973, "label": "person", "properties": {"name": "child1"}}::vertex
   (1 row)
   ```
   ```
   SELECT *
   FROM cypher('test_graph', $$
       MATCH (p:person {name:'parent'}), (c2:person {name:'child2'})
       CREATE (p)-[:connect]->(c2)
       RETURN p, c2
   $$) as (p agtype, c2 agtype);
   ```
   ```
                                             p                                           |                                          c2                                          
   --------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------
    {"id": 844424930131972, "label": "person", "properties": {"name": "parent"}}::vertex | {"id": 844424930131974, "label": "person", "properties": {"name": "child2"}}::vertex
   (1 row)
   ```
   
   ### Query
   ```
   SELECT *
   FROM cypher('test_graph', $$
       MATCH (p)-[r:connect]->(c)
       RETURN p.name, collect(c.name)
   $$) as (p agtype, c agtype);
       p     |          c           
   ----------+----------------------
    "parent" | ["child2", "child1"]
   (1 row)
   ```
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986878704


   the code I used to build the graph is in python, can I post it ?


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] joefagan commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
joefagan commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986890450


   yes please, together with version numbers of everything and the docker hub link to the docker images you are running
   select version();
   select * from pg_extension;
   
   
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986852998


   That's the result so far.  
   I noticed some of the results are also not formatted in `apache-age-python` I draw the attention to the maintainer. I'm still waiting for his reply.
   
   ![image](https://user-images.githubusercontent.com/374206/144868126-b21ae7cf-5b98-4065-bb4c-a15f5e708ffd.png)
   


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] joefagan edited a comment on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
joefagan edited a comment on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986869831


   @afidegnum 
   
   Works and formats correctly for me.
   Please send me your code that built the graph and you query that failed.
   
   ![image](https://user-images.githubusercontent.com/48284776/144870968-53094e2e-0ca1-4de1-89e1-0608e51e8e94.png)
   
   Ah - mine prints the list ["child2","child1"] correctly but I'd expect "Parent" in 1st column.


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] afidegnum commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
afidegnum commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986877537


   > @afidegnum You shouldn't need to rely on Python to filter your results. What you're doing should work. Would be good to see all your code. Please test the following. If it works, then please submit all your code that doesn't work.
   > 
   > ```
   > -- drop graph for cleanup between tests
   > SELECT * FROM ag_catalog.drop_graph('test_graph', true);
   > 
   > -- start from a new graph
   > -- create parent connected to 2 children with multiple properties
   > SELECT * FROM create_graph('test_graph');
   > SELECT * FROM cypher('test_graph', $$
   >     CREATE (p:person {name: 'parent'})
   >     CREATE (c1:person {name: 'child1', age: 11 })
   >     CREATE (c2:person {name: 'child2', age: 12 })
   >     CREATE (p)-[:connect]->(c1)
   >     CREATE (p)-[:connect]->(c2)
   >     RETURN p
   > $$) as (p agtype);
   > 
   > -- collect a property of children
   > SELECT * from cypher('test_graph', $$
   >           MATCH (p)-[connect]->(c)
   >           RETURN p.name,collect(c.name)
   > $$) as (p agtype, c agtype);
   > ```
   > 
   > Last query should return p | c ----------+---------------------- "parent" | ["child2", "child1"] (1 row)
   
   I just repeated this code. the issue I'm facing is: collecting the fields returns an empty result rather than the node themselves. 
   So, `collect(c)` works but collect(c.name) don't. I believe it should be a version issue. 
   I'm using the docker version of AGviewer and AG extension on Postgres 11


-- 
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-unsubscribe@age.apache.org

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



[GitHub] [incubator-age] joefagan commented on issue #153: Collect returns an empty result.

Posted by GitBox <gi...@apache.org>.
joefagan commented on issue #153:
URL: https://github.com/apache/incubator-age/issues/153#issuecomment-986909795


   @afidegnum 
   You are correct - there is something not right about the latest image bitnine/agviewer:latest
   docker run --publish=3001:3001 --name=agviewer bitnine/agviewer:latest
   ```
   SELECT * from cypher('test_graph', $$
             MATCH (n)
             RETURN n.name
   $$) as (n agtype);
   ```
   does not print the value of property 'name'.
   
   whereas
   ```
   SELECT * from cypher('test_graph', $$
             MATCH (n)
             RETURN collect(n.name)
   $$) as (n agtype);
   ```
   <html>
   <body>
   <!--StartFragment-->
   
   n
   --
   ["parent","child1","child2"]
   
   <!--EndFragment-->
   </body>
   </html>
   
   works fine.


-- 
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-unsubscribe@age.apache.org

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