ugurdogrusoz / visuall

Visuall: A tool for convenient construction of a web based visual analysis component
2 stars 0 forks source link

Database version update #387

Open herencalik opened 2 years ago

herencalik commented 2 years ago

Example Visuall program currently uses Neo4j database with version 3.5.20 and the newest version of Neo4j is 4.4.8. Between these two versions there are notable functionality and performance differences. However, newer versions break the "General Queries". Necessary parts of database API should be updated to make the program compatible with Neo4j's newest version.

LaraMerdol commented 2 years ago

The visual program currently uses the Neo4j database with version 3.5.20 and the newest version of Neo4j is 4.4.12. Newer versions break some places.

1. Using CALL apoc.cypher.runTimeboxed()

Side effect of some internal change along the way from 3.x -> 4.x: a node, relationship or path instance is now bound to the transaction it originates No longer reuse such a instance in a different transaction except using id(x) to get it's internal id. https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1652#issuecomment-688326108

2. Using General Queries

CALL graphOfInterest CALL commonStream CALL neighborhood

Also ;

Release | Release Date | End of Support Date | Compatible Driver Versions -- | -- | -- | -- 3.5n1 | November 29, 2018 | May 27, 2022 n3 | 4.4, 4.3, 4.2, 4.1, 4.0, 1.7

NEO4J 3.5 not supported anymore

LaraMerdol commented 1 year ago

Some side effect of some internal change along the way from 3.x -> 4.x: a node, relationship or path instance is now bound to the transaction it originates to. You can no longer reuse such a instance in a different transaction except using id(x) to get it’s internal id. In Neo4j 4 and later versions, the APOC procedure apoc.cypher.runTimeboxed has indeed been deprecated, and the newer versions of APOC do not include a direct replacement with a built-in timeout parameter.

LaraMerdol commented 1 year ago

Also, the visuall-advanced-query should be updated. The changes for migrating neo4j 3. to 5.10 will be mainly done. However, there are some big changes that may require a logic change in queries. For now, the neo4j methods used for the current logic are still valid but they are marked as deprecated and will be removed.

Screen Shot 2023-09-11 at 13 59 39

The id property which is an internal unique identifier automatically assigned to every node and relationship in the Neo4j database is deprecated and related meyhods will be removed.

LaraMerdol commented 1 year ago

The new neo4j database should be uploaded to the server. Neo4j Version: 5.10.0

LaraMerdol commented 1 year ago

Using function ID() is deprecated and it is recommended to use elementID() instead.

Screen Shot 2023-10-05 at 11 04 26

[https://neo4j.com/docs](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#:~:text=The%20function%20elementId()%20returns,is%20guaranteed%20an%20element%20ID.)

Although using the function ID() is deprecated, it's important to note that Visuall still identifies everything by this ID. Even Cytoscape uses this ID to identify nodes and edges. The elementID is a string type and is structured like "4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0". While using elementID instead of ID is one possible solution, the problem is that Cytoscape uses this ID as a selector. However, this type of id is not a proper selector id because it is also used as a CSS selector. According to the valid CSS ids rules, ids should begin with a letter (a-z or A-Z) or an underscore (). Subsequent characters can be letters, numbers (0-9), hyphens (-), or underscores (). It's important to note that colons (:) are not valid characters for CSS IDs.

Valid CSS ids should adhere to the following rules:

LaraMerdol commented 1 year ago

Also, the visuall-advanced-query should be updated. The changes for migrating neo4j 3. to 5.10 will be mainly done. However, there are some big changes that may require a logic change in queries. For now, the neo4j methods used for the current logic are still valid but they are marked as deprecated and will be removed. Screen Shot 2023-09-11 at 13 59 39 The id property which is an internal unique identifier automatically assigned to every node and relationship in the Neo4j database is deprecated and related meyhods will be removed.

The Advanced Queries have been updated to use the elementId instead of ID. This update was necessary due to some significant changes that came with the migration from neo4j 3.x to 5.10. While the current logic still works, some of the neo4j methods used are marked as deprecated and will eventually be removed.

LaraMerdol commented 1 year ago

Neo4j reuses its internal ids when nodes and relationships are deleted. This means that applications using, and relying on internal Neo4j ids, are brittle or at risk of making mistakes. It is therefore recommended to rather use application-generated ids. Possible Problems Example: https://community.neo4j.com/t/unrelated-node-and-relationship-have-same-id/31104

The second possible solution is to create application-generated ids and use them instead of IDs.

We can use UUIDs; https://neo4j.com/labs/apoc/5/graph-updates/uuid/

LaraMerdol commented 1 year ago

Neo4j reuses its internal ids when nodes and relationships are deleted. This means that applications using, and relying on internal Neo4j ids, are brittle or at risk of making mistakes. It is therefore recommended to rather use application-generated ids. Possible Problems Example: https://community.neo4j.com/t/unrelated-node-and-relationship-have-same-id/31104

The second possible solution is to create application-generated ids and use them instead of IDs.

We can use UUIDs; https://neo4j.com/labs/apoc/5/graph-updates/uuid/

Not Worked !! I tried it, but it caused some internal issues.(Such as edges not holding the application-generated IDs for their source and target nodes, it causes another query to find the nodes.)) Moreover, assigning an application-generated ID to all nodes is not quite practical. To address this, I added UUID using procedures that handle the automatic addition of UUID properties via the UUID Handler Lifecycle. The UUID handler is a transaction event handler that automatically adds the UUID property to a provided label and for the provided property name.

LaraMerdol commented 1 year ago

I have decided to use elementId instead of id to solve this problem. To overcome the problem described below;

Using function ID() is deprecated and it is recommended to use elementID() instead. Screen Shot 2023-10-05 at 11 04 26

[https://neo4j.com/docs](https://neo4j.com/docs/cypher-manual/current/functions/scalar/#:~:text=The%20function%20elementId()%20returns,is%20guaranteed%20an%20element%20ID.)

Although using the function ID() is deprecated, it's important to note that Visuall still identifies everything by this ID. Even Cytoscape uses this ID to identify nodes and edges. The elementID is a string type and is structured like "4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0". While using elementID instead of ID is one possible solution, the problem is that Cytoscape uses this ID as a selector. However, this type of id is not a proper selector id because it is also used as a CSS selector. According to the valid CSS ids rules, ids should begin with a letter (a-z or A-Z) or an underscore (). Subsequent characters can be letters, numbers (0-9), hyphens (-), or underscores (). It's important to note that colons (:) are not valid characters for CSS IDs.

Valid CSS ids should adhere to the following rules:

  • Must begin with a letter (a-z or A-Z) or an underscore (_).
  • Subsequent characters can be letters, numbers (0-9), hyphens (-), or underscores (_). Colons (:) are not valid characters for CSS IDs.

I converted the colon (:) to an underscore (_) to create a valid CSS selector character sequence. example: "4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0" --> "n4_c0a65d96-4993-4b0c-b036-e7ebd9174905_0"

LaraMerdol commented 1 year ago

I have updated the visuall-advanced-queries and visuall to use Neo4j v5.10. To accomplish this, I had to convert all parts that were using ID to use elementId instead. The new Neo4j v5.10 database is now available on the ivis server and can be found under the name neo4j-server-visuall-new. The code changes are located under the branch unstable-neo4j-update for both repositories.

LaraMerdol commented 1 year ago

New Neo4j 5.10 database is now running on port 3001; the credentials are username: neo4j and password: 12345678. http://ivis.cs.bilkent.edu.tr:3001/browser/

LaraMerdol commented 1 year ago

During the review process, some parts were changed. You can review the changes from https://github.com/ugurdogrusoz/visuall/pull/388. That pull request was closed because the branch was renamed to unstable.