bitnine-oss / agensgraph Goto Github PK
View Code? Open in Web Editor NEWAgensGraph, a transactional graph database based on PostgreSQL
Home Page: http://www.agensgraph.org
License: Other
AgensGraph, a transactional graph database based on PostgreSQL
Home Page: http://www.agensgraph.org
License: Other
Currently, this query incurs ERROR: There must be one type of consecutive update clauses
.
This should be modified ASAP.
Only a couple of questions now and I'll have more questions to follow. thanks.
Hi,
we now plane to consolidate our data storages and actually having relational and document data in the moment. One more special type comming into place are RDF formated
data. Is there any chance I could get it working with Agens?
Question: Could be Agens used as replacement for Triplestore aka Jena TBD?
Thanks a lot for this amazing project.
Can not refer to the attributes of the vertices you created in the previous clause.
create (a {name:'a'}) create (b {prop:a.name});
ERROR: missing FROM-clause entry for table "a"
Is there a way to import graphs from neo4j?
I tried exporting a large graph with apoc from neo, as cypher statements.
I then imported the graph into agensgraph.
This method has several disadvantages, therefore I'm wondering if it is possible to use some
other format, perhaps graphml?
Vertex labels can inherit base vertex or other vertex labels.
But edge label can inherit base edge only.
The grammar for edge inheritance is necessary.
I cloned and compiled master... but I am not able to get the friends of friends query working... This is my test data and query. I am using macos Sierra.
my_graphdb=# MATCH (n:person)-[:knows]->(m:person) RETURN n.name AS n, m.name AS m;
n | m
-------+--------
Tom | Summer
Pat | Nikki
Olive | Todd
Tom | Summer
Pat | Nikki
Olive | Todd
(6 rows)
my_graphdb=# CREATE (:person {name: 'Summer'})-[:knows]->(:person {name: 'Nikki'});
GRAPH WRITE (INSERT VERTEX 2, INSERT EDGE 1)
my_graphdb=# CREATE (:person {name: 'Summer'})-[:knows]->(:person {name: 'Todd'});
GRAPH WRITE (INSERT VERTEX 2, INSERT EDGE 1)
my_graphdb=#
my_graphdb=# MATCH (n:person)-[:knows]->(m:person) RETURN n.name AS n, m.name AS m;
n | m
--------+--------
Tom | Summer
Pat | Nikki
Olive | Todd
Tom | Summer
Pat | Nikki
Olive | Todd
Summer | Nikki
Summer | Todd
(8 rows)
my_graphdb=# MATCH (p:person {name: 'Tom'})-[:knows]->()-[:knows]->(f:person) RETURN p.name AS n, f.name AS m;
n | m
---+---
(0 rows)
would be easier to try this out locally on macOS if there was a homebrew package. https://brew.sh/
thanks!
I came across following situation.
I could not drop vlabel with disable index option.
agensgraph=# create vlabel test disable index inherits (person);
CREATE VLABEL
agensgraph=# drop vlabel test;
ERROR: requested object address for unsupported object class 35: text result "unrecognized object 7045 63090 0"
agensgraph=# reindex vlabel test;
REINDEX
agensgraph=# drop vlabel test;
ERROR: requested object address for unsupported object class 35: text result "unrecognized object 7045 63090 0"
agensgraph=# \d+ ldbc.test;
Table "ldbc.test"
Column | Type | Modifiers | Storage | Stats target | Description
------------+---------+----------------------------------------------------------------------------------------------------+----------+--------------+-------------
id | graphid | not null default graphid(graph_labid('ldbc.test'::cstring), nextval('ldbc.test_id_seq'::regclass)) | plain | |
properties | jsonb | not null default jsonb_build_object() | extended | |
Indexes:
"test_pkey" PRIMARY KEY, btree (id)
"test_properties_idx" gin (properties jsonb_path_ops)
Inherits: ldbc.person
Would it be possible to automatically create VLABEL
s and ELABEL
s upon first usage of them in a query?
Hello,
Since the Vertex/Edge tables makes use of table inheritance, it might be useful to introduce the concept of abstract labels. OrientDB currently supports a similar feature.
One possible implementation would be to just add syntactic sugar around a check constraint. e.g.:
CREATE ABSTRACT VLABEL person
would result in an additional check constraint CONSTRAINT person_abstract_check CHECK (false) NO INHERIT
Thanks you,
John
Some users might want to preserve uniqueness of vertices in the each resulting pattern. However, current implementation of MATCH clause only checks uniqueness of edges. If AgensGraph supports vertex uniqueness through some kind of qualification in WHERE clause, it would be helpful to such users.
Running ag-config.sh script as indicated in readme produces following errors.
dmikov@dmikov-Virtual-Machine:~/Documents/agens-graph-master$ ./ag-config.sh
./ag-config.sh: 29: ./ag-config.sh: Syntax error: "(" unexpected (expecting ";;")
after removing case statement, it produces more errors
dmikov@dmikov-Virtual-Machine:~/Documents/agens-graph-master$ ./ag-config.sh
./ag-config.sh: 34: ./ag-config.sh: Bad substitution
Cypher queries are added by addBatch() and do executeBatch().
stmt.addBatch("CREATE (p1:person {name: 'node2'})-[:knows]->(p2:person {name: 'node3'})");
stmt.executeBatch();
Then following exceptions are occurred.
java.sql.BatchUpdateException: Batch entry 1 CREATE (p1:person {name: 'node2'})-[:knows]->(p2:person {name: 'node3'}) was aborted. Call getNextException to see the cause.
java.sql.BatchUpdateException: Batch entry 1 CREATE (p1:person {name: 'node2'})-[:knows]->(p2:person {name: 'node3'}) was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:133)
at org.postgresql.core.v3.QueryExecutorImpl$ErrorTrackingResultHandler.handleError(QueryExecutorImpl.java:308)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2004)
at org.postgresql.core.v3.QueryExecutorImpl.flushIfDeadlockRisk(QueryExecutorImpl.java:1187)
at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1212)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:1019)
at net.bitnine.graphDB.AgensGraphOps.main(AgensGraphOps.java:91)
at net.bitnine.graphDB.Run.main(Run.java:19)
Current implementation does not check whether INHERITS
option has relations other than vertex and edge. Through #7, we are able to check INHERITS
option.
And did we decide to allow multiple inheritance? If not, we have to restrict the number of parent vertices and edges to 1.
In neo4j we would use WHERE n:LABEL
or WHERE NOT n:LABEL
this does not seem to be supported in agens, is that expected? As a work around WHERE label(n) = 'LABEL'
seems to work.
Other questions, is there a project roadmap? How do you test if a node inherits another label type?
pg_class shows all kind of relations include label.
But there is no way to show labels only.
Agens graph should provide graph catalogs differed from table.
Currently, we have no way to tell PostgreSql processes from AgensGraph processes in ps
command. So we need to print an prefix like '[AG]' in the results of ps -cmd
like following:
$ ps f -o cmd= -u kskim
/home/kskim/agens-graph/bin/postgres
\_ postgres: [AG] pg_statsinfo launcher process
| \_ /home/kskim/agens-graph/bin/pg_statsinfod 43070
\_ postgres: [AG] logger process
\_ postgres: [AG] checkpointer process
\_ postgres: [AG] writer process
\_ postgres: [AG] wal writer process
\_ postgres: [AG] autovacuum launcher process
\_ postgres: [AG] stats collector process
\_ postgres: [AG] kskim postgres [local] idle
\_ postgres: [AG] kskim agensgraph [local] idle
When users' query contains CREATE / MERGE which makes vertexes / edges whose labels don't exist,
AG should create the nonexist label dynamically.
The nonexist labels are created in the transform phase.
Restriction:
We need a view for the property index list.
Need to design the schema of the property index view.
create (a {'1'})
While experimenting with row-level security on AgensGraph I've found out that row-level security is not working correct while working with graphs. It is working well on simple tables etc, but not on create operation for vertexes. Following simple code shows incorrect behavior where test_user1 can insert vertex as test_user2 and policy will not stop it.
create graph person_network;
create vlabel person;
create role test_admin;
create role test_user1;
create role test_user2;
grant usage on schema person_network to public;
grant insert on person_network.person to public;
grant update on person_network.person to public;
grant select on person_network.person to public;
grant usage on all sequences in schema person_network to public;
alter table person_network.person enable row level security;
create policy person_for_admin on person_network.person to test_admin using (true) with check (true);
create policy person_select on person_network.person for select using (current_user = properties->>'owner');
create policy person_insert on person_network.person for insert with check (current_user = properties->>'owner');
set role test_user1;
create (:person {name: 'TU1_name1', owner: 'test_user1', surname: 'TU1_surname1'});
-- this should fail! Trying to insert values as different user
create (:person {name: 'TU1_name2', owner: 'test_user2', surname: 'TU1_surname2'});
match (p:person) return p;
set role test_user2;
create (:person {name: 'TU2_name1', owner: 'test_user2', surname: 'TU2_surname1'});
match (p:person) return p;
set role test_admin;
match (p:person) return p;
I assume this will be the same with edges, but there is also a possibility that there is some intricate detail involved and my policy specification is not correct for whatever reasons. Anyway, I've not being able to duplicate the same issue on similar example dealing with table and jsonb type. Thanks!
Hello,
I've come across an issue while testing some queries with agens-graph using the .NET (NpgSql) client.
Given the following query MATCH (v) RETURN v;
the server returns an exception due to the client defaulting to the binary protocol. AFAICT the various graph types do not implement the required in/out methods for binary encoding.
There are a couple of workarounds such as forcing a cast on the relevant types MATCH (v) RETURN v::text
or forcing the text-based encoding entirely or on a per-column basis. This is less than ideal however, since it requires that the user/library have pre-execution knowledge of the relevant column types or completely switch to the text-based protocol.
If binary support is added, I'd be more than happy to fork and add support for the graph types on the NpgSql side.
Thank you,
John
The following error occurs when trying to create a graph using 'create graph if exists' if there exists the graph.
test=# create graph if not exists bitnine;
CREATE GRAPH
test=# create graph if not exists bitnine;
NOTICE: graph "bitnine" already exists, skipping
ERROR: relation "ag_label_seq" already exists
test=#
There is an issues on the behavior. For example, let's look ᅟat the following example.
CREATE ({'firstName': 'Tom', 'lastName': 'Hansen'});
MATCH (n {firstName: 'Tom'}) RETURN n;
The above example query returns NULL because firstName
is interpreted as firstname
. The parser treats it as an identifier.
This leads to significant incompatibility with other Cypher implementations.
Edge tables has several indexes on them; start_end_id, end_start_id. But these indexes have duplicate information in them. And in results, there are waste of spaces. So it needs to design new index and storage for edge tables.
First, because the index is searched by start or end ID, we only have to index start or end. But currently in order to exploit index-only scan, we use composite indexes(start_end_id, end_start_id). So a new index has to index only start or end but the leaf of the btree has other information; (end, id) and (start_id). And optimizer and executor have to be modified to use the index-only scan mechanism using this new index.
Second, the new index should have properties of gin index; remove duplicates in the tree and buffering for insert.
Googling tels me that in order to find the 'root' for a certain node somewhere in a tree you should use a query like
MATCH (:organisationalunit {name: 'Team ICT'})-[:is_part_of *]->(root:organisationalunit)
WHERE NOT ( (root)-[:is_part_of]->() )
RETURN root::text
but this one tells me
Error: ERROR: syntax error at or near "[" Position: 110 SQLState: 42601 ErrorCode: 0
Hi, there
I was testing AgensGraph with sample data. I experienced the connection interruption while executing
a specific cypher query, so I am leaving an issue here.
Please check the below link for a zip file which contains log files of AgensGraph and my sample data csv files(penpal_history.csv, user.csv)
https://drive.google.com/a/bitnine.net/file/d/0B81ERe_34TPUbUhMYXBiV3J2ZGM/view?usp=sharing
CREATE VLABEL person;
CREATE VLABEL penpal;
CREATE ELABEL send;
CREATE ELABEL sent_from INHERITS (send);
CREATE ELABEL sent_to INHERITS (send);
CREATE EXTENSION file_fdw;
CREATE SERVER import_server FOREIGN DATA WRAPPER file_fdw;
CREATE FOREIGN TABLE vlabel_person(id integer, name varchar(50), username varchar(50), email varchar(50), birthdate date, sex char(1),address varchar(255))
SERVER import_server OPTIONS (FORMAT 'csv', HEADER 'true', FILENAME '/home/agraph/workspace/demo/user.csv', delimiter '|');
CREATE FOREIGN TABLE vlabel_penpal(start_id integer, end_id integer, id integer, timestamp bigint,text text)
SERVER import_server OPTIONS (FORMAT 'csv', HEADER 'true', FILENAME '/home/agraph/workspace/demo/penpal_history.csv', delimiter '|');
LOAD FROM vlabel_person AS person CREATE (a:person=row_to_json(person)::jsonb);
LOAD FROM vlabel_penpal AS penpal
MATCH (a:person), (b:person)
WHERE a.id=to_jsonb((penpal).start_id)::text AND b.id=to_jsonb((penpal).end_id)::text
CREATE (a)-[:SENT_FROM]->(p:penpal {'id':(penpal).id,'timestamp':(penpal).timestamp,'text':(penpal).text})-[:SENT_TO]->(b);
LOAD FROM vlabel_user AS user CREATE (a:user=row_to_json(user)::jsonb);
MATCH (n:person)-[r:sent_from]->(m)-[:sent_to]->(o)
WHERE n.sex='M'
WITH DISTINCT n, count(r) AS pcount
ORDER BY pcount ASC LIMIT 5
MATCH (n:person)-[r]->(p:penpal)-[]->(o2:person)
WITH n,o2
MATCH (o2:person)
WHERE o2.sex='F'
RETURN n.name, o2.name;
2017-01-20 15:54:20 KST 20285 - (pg_statsinfod, , , pg_statsinfod) ERROR: pg_statsinfo: query failed: 서버가 갑자기 연결을 닫았음
이런 처리는 클라이언트의 요구를 처리하는 동안이나
처리하기 전에 서버가 갑자기 종료되었음을 의미함
2017-01-20 15:54:20 KST 20285 - (pg_statsinfod, , , pg_statsinfod) DETAIL: query was: SELECT statsinfo.sample()
2017-01-20 15:56:51 KST 20276 587ee9e0.4f34-11 0 LOG: server process (PID 7317) was terminated by signal 11: Segmentation fault
2017-01-20 15:56:51 KST 20276 587ee9e0.4f34-11 0 DETAIL: Failed process was running: MATCH (n:person)-[r:sent_from]->(m)-[:sent_to]->(o)
WHERE n.sex='M'
WITH DISTINCT n, count(r) AS pcount
ORDER BY pcount ASC LIMIT 5
MATCH (n:person)-[r]->(m:penpal)-[r2]->(o2:person)
WITH n,o2MATCH (o2:person) WHERE o2.sex='F' RETURN n.name, o2.name;
2017-01-20 15:56:51 KST 20276 587ee9e0.4f34-12 0 LOG: terminating any other active server processes
2017-01-20 15:56:51 KST 20276 587ee9e0.4f34-13 0 LOG: all server processes terminated; reinitializing
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-1 0 LOG: database system was interrupted; last known up at 2017-01-20 15:54:16 KST
2017-01-20 15:56:52 KST 7322 5881b4b4.1c9a-1 0 (agraph, agraph, 192.168.0.54(48227), [unknown]) FATAL: the database system is in recovery mode
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-2 0 LOG: database system was not properly shut down; automatic recovery in progress
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-3 0 LOG: redo starts at 0/4277E508
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-4 0 LOG: invalid record length at 0/42780B08: wanted 24, got 0
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-5 0 LOG: redo done at 0/42780AE0
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-6 0 LOG: last completed transaction was at log time 2017-01-20 15:54:20.284383+09
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-7 0 LOG: checkpoint starting: end-of-recovery immediate
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-8 0 LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=0.010 s, sync=0.039 s, total=0.175 s; sync files=4, longest=0.039 s, average=0.009 s; distance=9 kB, estimate=9 kB
2017-01-20 15:56:52 KST 7321 5881b4b4.1c99-9 0 LOG: MultiXact member wraparound protections are now enabled
2017-01-20 15:56:52 KST 20276 587ee9e0.4f34-14 0 LOG: database system is ready to accept connections
If you need any other information from my side, please let me know.
Cheers.
when ran the command initdb -D ...
command, the output
AgensGraph/bin/postgres: error while loading shared libraries: libplds4.so: cannot open shared object file: No such file or directory
no data was returned by command ""/usr/local/AgensGraph/AgensGraph/bin/postgres" -V"
The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/local/AgensGraph/AgensGraph/bin/initdb".
Check your installation.
my server is
$ uname -a
Linux ess-data 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
CREATE PROPERTY INDEX failed due to the following error:
ERROR: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
DETAIL: Key (relname, relnamespace)=(Comment_property_idx, 96465) already exists.
It can be reproduced by issuing several CREATE PROPERTY INDEX DDLs on one vertex label.
It might be due to the race condition in determining property index names.
Create binary of Agensgraph for windows and provide installer with BitRock.
Support Cypher modification queries like CREATE, MERGE,... in pl/pgSQL.
Currenly, only read queries are allowed in pl/pgSQL.
Hello,
Sorry if this is the wrong repository to post this, but I couldn't find any reference to a mailing list or chat.
I was wondering if there are any binaries available for Mac or Windows?
I've tried to build from source on Mac OS X but it appears that the contrib extension pg_statinfo is not compatible with OS X.
Thank you,
John
Currently, PG engine doesn't use any statistic information for estimating cardinality of JSONB containment constraint.
So if one uses curly bracket constraint like following, the estimation is not accurate and this results in non-optimal query plan.
MATCH (a:PERSON {id: 1})-[:KNOWS]->(b:PERSON)
RETURN b;
If there exists GIN index on properties
column, we might use GIN index for estimating the cardinality of JSONB containment constraints. In GIN index, there are posting lists for each JSONB path, and we can exploit the number of elements of a posting list to estimate the cardinality.
Is it possible?
REST API 가 지원되면 좋겠습니다.
데이타 베이스 드라이버를 지원하지 않는 언어로 어플리케이션을 제작하는것은 불가능 하거나 별도의 서버를 두어야 하는 부담이 생깁니다.
REST API 가 지원되면 다양한 개발환경에서 큰 부담없이 어플리케이션을 개발할수 있을것 같습니다.
Hi,
I tried a variable length match on the graph below but I got ERROR: column "id" not found (internal error)
.
This is what I tried:
create (:Person {name: 'a'})<-[:phone_number_of]-(:Extension {ext: 27})-[:extension_of]->(:Number {number: 1111})-[:phone_number_of]->(:Person {name: 'b'});
match p=(:person {name:'a'})-[*]-(:number) return p;
// ERROR: column "id" not found (internal error)
match p=(:person {name:'a'})-[*2]-(:number) return p;
// ERROR: column "id" not found (internal error)
I tried to ask this on a forum but I couldn't find any related to AgensGraph yet.
Thank you for the awesome tool!
Attila
Is there any C Driver for AgensGraph? Cannot seem to find one.
I am new to PostgreSQL and agensgraph and having rough time to setup the environment.
Is PostgreSQL needs to be installed before agensgraph? If PostgreSQL included in AgensGraph, can I use PgAdmin with AgensGraph?
Thanks
Krishna
Property indexes are not used by the optimizer for property constraints in curly brackets.
This is a known issue but until now we used a workaround using WHERE clause.
This can cause confusions to users so we need to resolve this issue ASAP.
Hi,
There is a way to execute queries remotely on a graph ?
Ex:
select dblink_connect('dbname=my_graph', 'My query');
ERROR: could not establish connection
DETAIL: FATAL: database "my_graph" does not exist
Actually, dbname seems to doesn't work as parameter to target graphs with this function.
Any alternatives ?
Thanks
Agens graph has label inheritance system.
According to inheritance, matching parent label's results includes its child label too.
For example label 'know' is inherited by label 'friends', then 'MATCH (a:know)' returns both 'know' and 'friend'.
It's intentional results but someone will need to match only 'know'.
Now the 'only' is not defined yet.
We have need to do discuss the grammar and implementation.
After CREATE query, pg table and ag label are completely same object, relation.
However we need to distinguish because of many reason, error check for cypher target label, management of catalog ag_label, limitation of sql query to label and more.
Especially, ag_label has a bug now. When drop a label with CASCADE, the child label is not deleted from ag_label because child label was dealt as a relation, not label.
There is two or more ways to provide this function. The first one is add relkind type 'vlabel' and 'elable'. This is the most simple but every code which using 'relkind_relation' should be modified too.
The second one is add a variable to class Relation. This make less modification than first one. But another variable is useless memory to pg tables. To select second way, we have to make decision that waste of the memory is acceptable or not.
I started agensgraph server with ag_ctl start
.
I set shared_buffers
parameter too large so the server failed to start.
But I don't see any error message or warning message.
So I can realize the startup failure by using ps -ef
.
I read http://www.businesswire.com/news/home/20170629005344/en/Graph-DBMS-Performance-Comparison-AgensGraph-vs.-Neo4j. Great work guys! I have some questions.
The following fails
CREATE (:LABEL {
email:"...",
firstName:"bing",
lastName:"bab",
phone:"2342342324",
tags:[], uniqueImportId:183 });
with error ERROR: syntax error at or near "["
Currently, graph label objects(edge label and vertex label) are tightly coupled with postgres' table objects.
In query processing, the query parser recognizes labels in terms of table objects,
so that semantic checking or privilege checking for labels are performed as if they are tables.
However, we use tables as one of possible implementations for graph object storage and
other storage implementations, e.g in-memory data structure or graph-specific storage not heap storage could be added in the future.
So it is necessary to separate graph label objects from table objects in the catalog view.
It will not be trivial task because we currently rely on many feature of tables, e.g. semantic checking, hierarchy, privileges and so on.
Implement dijkstra's algorithm to get the shortest path between two nodes
I found that memory increases during CREATE.
It may be due to recent changes of CREATE routine.
You can reproduce this issue by loading large size data using CREATE.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.