Re: [I] Unable to drop column from vlabel tables [age]

2024-03-06 Thread via GitHub


jrgemignani commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1981513729

   @mingfang Thank you for your contribution to others :)
   


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-06 Thread via GitHub


mingfang commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1981302318

   In case anyone is interested doing search on graph data.
   Here is my final code that doesn't require changing the AGE tables.
   https://gist.github.com/mingfang/729e70e819b2bacabb6519c32fd761cd


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


mingfang closed issue #1639: Unable to drop column from vlabel tables 
URL: https://github.com/apache/age/issues/1639


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


jrgemignani commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979773005

   @mingfang I wish I could help you more here. However, this part (fts) is out 
of my area of expertise. I will just mention that the link provided shows 
CALL/YIELD which are Cypher commands. 


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


mingfang commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979625699

   I am trying to implement searching on graph data.
   https://neo4j.com/developer/kb/fulltext-search-in-neo4j/


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


jrgemignani commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979491054

   @mingfang I'm not following what you want to, or are expecting to do. 
   
   That being said, from what it _looks like to me_, I get the impression that 
you are trying to work with the graph data (graphs/nodes/edges) as relational 
database data (tables/rows/columns) instead of as graph data. You need to think 
of the graph data as graph data and use graph structures and commands to 
represent and retrieve what you want. This may mean rethinking your graph's 
structure so that it represents what you want.
   
   A few notes on graph structures that might be helpful, if you aren't aware 
of them already -
   
   - A graph is a collection of nodes and edges (should be obvious, but worth 
saying to be complete).
   - A node (or vertex) is usually an object or thing. It can contain 0 to any 
number of properties to describe it.
   - An edge (or sometimes called a relationship) is usually a relationship or 
path between 2 nodes. It can contain 0 to any number of properties to describe 
it.
   - A node can have 0 to an infinite number of edges. These edges could be of 
many differing relationships. 
   - An edge always has a direction and always connects just 2 nodes.
   - Apache AGE is a directed property graph meaning that all edges have a 
direction and all components have properties. Components being nodes and edges.
   
   With AGE it is possible to combine SQL and Cypher and mix relational and 
graph. But, you should avoid modifying the underlaying graph data as it can 
potentially cause data corruption.
   
   If you want to add another column to a node/edge you can add that data 
inside the properties for that node/edge. Or, you could create an edge, back to 
itself with that data. That is just an example, and likely a bad one as it is a 
loop. Loops can have consequences for open ended graph transversals.


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


mingfang commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979360630

   Yes I can respect that perspective.
   My use case is to integrate AGE with native Postgres FTS.
   Here is what I have working so far.
   ```sql
   CREATE EXTENSION IF NOT EXISTS age;
   
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   
   SELECT * FROM ag_catalog.drop_graph('movie_recommendation', true);
   SELECT * FROM ag_catalog.create_graph('movie_recommendation');
   
   SELECT * from cypher('movie_recommendation', $$
   CREATE 
   (:User {id: 'user1'}),
   (:User {id: 'user2'}),
   (:Movie {id: 'movie1', name: 'The Shawshank Redemption'}),
   (:Movie {id: 'movie2', name: 'The Godfather'}),
   (:Movie {id: 'movie3', name: 'The Dark Knight'}),
   (:Movie {id: 'movie4', name: 'Army of Thieves'}),
   (:Movie {id: 'movie5', name: 'Oceans Thirteen'}),
   (:Movie {id: 'movie6', name: 'Heat'}),
   (:Genre {name: 'Drama'}),
   (:Genre {name: 'Crime'}),
   (:Genre {name: 'Action'})
   $$) as (V agtype);
   
   SELECT * from cypher('movie_recommendation', $$
   
   MATCH 
   (u1:User {id: 'user1'}), 
   (u2:User {id: 'user2'}), 
   (m1:Movie {id: 'movie1'}),
   (m2:Movie {id: 'movie2'}),
   (m3:Movie {id: 'movie3'}),
   (m4:Movie {id: 'movie4'}),
   (m5:Movie {id: 'movie5'}),
   (m6:Movie {id: 'movie6'}),
   (gD:Genre {name: 'Drama'}),
   (gC:Genre {name: 'Crime'}),
   (gA:Genre {name: 'Action'})
   
   CREATE 
   (u1)-[:WATCHED]->(m1),
   (u1)-[:WATCHED]->(m2),
   (u2)-[:WATCHED]->(m1),
   (m1)-[:BELONGS_TO]->(gD),
   (m2)-[:BELONGS_TO]->(gC),
   (m3)-[:BELONGS_TO]->(gA),
   (m4)-[:BELONGS_TO]->(gD),
   (m5)-[:BELONGS_TO]->(gC),
   (m6)-[:BELONGS_TO]->(gA)
   
   $$) as (V agtype);
   
   ALTER TABLE movie_recommendation."Movie" ADD COLUMN ts tsvector
   GENERATED ALWAYS AS (
   to_tsvector('english', ag_catalog.agtype_access_operator(properties, 
'"name"'::ag_catalog.agtype)::text)
   ) STORED;
   CREATE INDEX ts_idx ON movie_recommendation."Movie" USING GIN (ts);
   
   SELECT *, ts_rank(ts, websearch_to_tsquery('english', 'dark')) AS rank 
   FROM movie_recommendation."Movie" 
   WHERE ts @@ websearch_to_tsquery('english', 'dark');
   ```
   
   The alternative to adding the auto generated column is the add a trigger to 
write to a non-AGE table.
   I think searching, both FTS and vector/embedding based search, are huge in 
the gen-ai era and I'm hoping AGE can support for it.
   What do you recommend as an alternative?


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



Re: [I] Unable to drop column from vlabel tables [age]

2024-03-05 Thread via GitHub


jrgemignani commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979257304

   @mingfang AGE does not support users manually manipulating AGE created/owned 
tables. You do this at your own risk.


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



[I] Unable to drop column from vlabel tables [age]

2024-03-04 Thread via GitHub


mingfang opened a new issue, #1639:
URL: https://github.com/apache/age/issues/1639

   If I add a new column to a vlabel table, then I will not be able to drop 
that column.
   Here are the steps to reproduce
   ```sql
   -- create test graph and table
   SELECT * FROM ag_catalog.create_graph('drop_column');
   SELECT ag_catalog.create_vlabel('drop_column', 'table1');
   
   -- add new column
   ALTER TABLE drop_column.table1 ADD COLUMN col1 TEXT;
   
   -- fail to drop with error: ERROR:  table "table1" is for label "table1"
   ALTER TABLE drop_column.table1 DROP COLUMN col1;
   ```
   
   It's almost as if AGE thinks I'm trying to drop the entire table and not 
just a 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-unsubscr...@age.apache.org.apache.org

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