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/11/05 18:15:48 UTC

[GitHub] [incubator-age] deem0n opened a new issue #140: What is the correct way to MATCH vertexes without edges?

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


   I tried 
   
   ``` sql
   SELECT * FROM cypher('test', 
   $$MATCH (f:Engine),(t:Engine)
   WHERE NOT EXISTS((f)-[]->(t))
   RETURN f,t$$) as (f agtype, t agtype);
   ```
   
   and it returns nothing. I am sure there are plenty not connected vertexes in my DB though.


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   To find orphaned nodes...
   ```
   SELECT * FROM cypher('test', 
   $$ MATCH (f) WHERE NOT EXISTS((f)-[]-()) return f;
   RETURN f $$) as (f agtype);
   ```
   
   


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   To find orphaned nodes...
   ```
   SELECT * FROM cypher('test', 
   $$ MATCH (f) WHERE NOT EXISTS((f)-[]-()) return f;
   RETURN f $$) as (f agtype);
   ```
   
   


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   To find orphaned nodes...
   ```
   SELECT * FROM cypher('test', 
   $$ MATCH (f) WHERE NOT EXISTS((f)-[]-()) return f;
   RETURN f $$) as (f agtype);
   ```
   
   


-- 
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] jrgemignani commented on issue #140: What is the correct way to MATCH vertexes without edges?

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


   It is best not to assume anything about a graph. Did you create a vertex without an edge to test the command against?


-- 
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] jrgemignani commented on issue #140: What is the correct way to MATCH vertexes without edges?

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


   It should work but it doesn't and I'm not sure why. I even traced it in the debugger to no avail. We will have to create a JIRA ticket and look into it more deeply.


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   To find orphaned nodes...
   ```
   SELECT * FROM cypher('test', 
   $$ MATCH (f) WHERE NOT EXISTS((f)-[]-())
   RETURN f $$) as (f agtype);
   ```
   
   


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   Jira ticket is now raised and has been assigned.


-- 
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] jrgemignani commented on issue #140: What is the correct way to MATCH vertexes without edges?

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


   It is best not to assume anything about a graph. Did you create a vertex without an edge to test the command against?


-- 
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] JoshInnis closed issue #140: What is the correct way to MATCH vertexes without edges?

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


   


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   
   To find orphaned nodes, I would expect this to work
   ```
   SELECT * FROM cypher('test', 
   $$ MATCH (f) WHERE NOT EXISTS((f)-[]-())
   RETURN f $$) as (f agtype);
   ```
   It does not
   
   


-- 
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 #140: What is the correct way to MATCH vertexes without edges?

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


   
   @deem0n has uncovered something for sure.
   
   The AGE behaviour is quite different from that of Neo4j sandbox (or AgensGraph) where the NOT EXISTS seems to find edges that could exist but don't. EG even for an orphaned node {name: "a"}, the only node in the graph,
   ```
   MATCH (a),(b) WHERE NOT EXISTS((a)-[]->(b)) return a.name, b.name;
   ```
   returns
   "a", "a"
   since there is no loop edge from a to a.
   
   See more examples below and how to create them from scratch
    
   ```
   -- create new graph
   SELECT * FROM create_graph('test');
   
   -- create a vertex with no edges
   SELECT * FROM cypher('test', $$
   CREATE (a:Engine {name: "orphan"})
   $$) as (a agtype);
   
   SELECT * FROM cypher('test', 
   $$MATCH (f:Engine),(t:Engine)
   WHERE NOT EXISTS((f)-[]->(t))
   RETURN f,t$$) as (f agtype, t agtype);
   ```
   returns 0 rows.
   Equivalent commands in neo4j sandbox
   ```
   create (a:Engine{name: "Orphan"});
   MATCH (f:Engine),(t:Engine) WHERE NOT EXISTS((f)-[]->(t)) RETURN f.name, t.name;
   ```
   
   returns 1 row
   f.name, t.name
   "Orphan", "Orphan"
   
   With more nodes the difference in behaviour is noticeable
   
   NOT EXISTS behaviour in AGE is not quite what is expected.
   
   ```
   -- create 2 nodes and an edge
   -- ({name: "F"})-[:r]->(name: "T")
   SELECT * FROM cypher('test', $$
   CREATE (a:Engine {name: "F"}) -[:r]- > (:engine {name: "T"})
   $$) as (bla agtype);
   
   SELECT * FROM cypher('test', 
   $$MATCH (f:Engine),(t:Engine)
   WHERE NOT EXISTS((f)-[]->(t))
   RETURN f.name, t.name $$) as (f agtype, t agtype);
   ```
   again returns no rows, whereas the equivalent commands in neo4j returns 5
   f.name	t.name
   "Orphan"	"Orphan"
   "Orphan"	"F"
   "F"	"Orphan"
   "F"	"F"
   
   
   
   
   
   
   


-- 
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] JoshInnis commented on issue #140: What is the correct way to MATCH vertexes without edges?

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


   PR #141 should have resolved this 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



Re: [GitHub] [incubator-age] deem0n opened a new issue #140: What is the correct way to MATCH vertexes without edges?

Posted by John Gemignani <jo...@bitnine.net>.
It is best not to assume anything about a graph. Did you create a vertex
without an edge to test the command against it?

On Fri, Nov 5, 2021 at 11:15 AM GitBox <gi...@apache.org> wrote:

>
> deem0n opened a new issue #140:
> URL: https://github.com/apache/incubator-age/issues/140
>
>
>    I tried
>
>    ``` sql
>    SELECT * FROM cypher('test',
>    $$MATCH (f:Engine),(t:Engine)
>    WHERE NOT EXISTS((f)-[]->(t))
>    RETURN f,t$$) as (f agtype, t agtype);
>    ```
>
>    and it returns nothing. I am sure there are plenty not connected
> vertexes in my DB though.
>
>
> --
> 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] jrgemignani commented on issue #140: What is the correct way to MATCH vertexes without edges?

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


   It is best not to assume anything about a graph. Did you create a vertex without an edge to test the command against?


-- 
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