Closed icejean closed 5 months ago
Hi @icejean, thank you for reporting this, we will have a look at your setup and get back to you.
Thanks for your reply, I'm looking forward to it. :) @vnickolov
Hi @icejean,
Can you please add this dependency and give it a try:
<dependency>
<groupId>org.neo4j.gds</groupId>
<artifactId>opengds-extension</artifactId>
<version>2.5.5</version>
<scope>test</scope>
</dependency>
I was wondering, why do you need the Maven setup, isn't Gradle enough? Also if I read it all correctly it seems that you are checking out the source code and working with it directly and not just using the artifacts provided by Maven central, is my assumption correct?
Hi @icejean,
Can you please add this dependency and give it a try:
<dependency> <groupId>org.neo4j.gds</groupId> <artifactId>opengds-extension</artifactId> <version>2.5.5</version> <scope>test</scope> </dependency>
It doesn't work, same exception. I need to develop my own algorithms and precedures base on Open Graph Data Science, I'v done it with Neo4j community 4.4.5+ Open GDS 2.0.2 in this way before. So I need a maven project with the artifacts. And those algorithms and procedures of Open GDS are good examples to learn from, as the framework of algorithm and precedure often change bwteen versions, so they are a good start point, I just import some original algorithms and procedures in my porject to verify the settings are O.K., especially junit test settings.
My Eclipse project with Neo4j community 4.4.5+ Open GDS 2.0.2:
My algorithms and procedures in my own Open GDS extended plugin
Calling my algorithms and procedures in cypher:
CALL gds.graph.drop( 'graph');
match(n) detach delete n;
CREATE(a:Node {name: 'a'}),
(b:Node {name: 'b'}),
(c:Node {name: 'c'}),
(d:Node {name: 'd'}),
(e:Node {name: 'e'}),
(b)<-[:TYPE {cost:17}]-(a), (c)<-[:TYPE {cost:16}]-(a), (d)<-[:TYPE {cost:19}]-(a), (e)<-[:TYPE {cost:16}]-(a),
(c)<-[:TYPE {cost:3}]-(b), (d)<-[:TYPE {cost:3}]-(b), (e)<-[:TYPE {cost:11}]-(b),
(b)<-[:TYPE {cost:3}]-(c), (d)<-[:TYPE {cost:4}]-(c), (e)<-[:TYPE {cost:8}]-(c),
(b)<-[:TYPE {cost:3}]-(d), (c)<-[:TYPE {cost:4}]-(d), (e)<-[:TYPE {cost:12}]-(d),
(b)<-[:TYPE {cost:11}]-(e), (c)<-[:TYPE {cost:8}]-(e), (d)<-[:TYPE {cost:12}]-(e);
CALL gds.graph.project(
'graph',
'Node',
{
LINK: {
type: 'TYPE',
properties: 'cost',
orientation: 'NATURAL'
}
}
)
MATCH (n:Node {name: 'a'})
CALL gds.alpha.spanningArborescenceReverse.minimum.write('graph', {
startNodeId: id(n),
relationshipWeightProperty: 'cost',
writeProperty: 'MINSA',
weightWriteProperty: 'cost'
})
YIELD preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount;
MATCH (n:Node {name: 'a'})
CALL gds.alpha.spanningArborescenceReverse.kmin.write('graph', {
startNodeId: id(n),
relationshipWeightProperty: 'cost',
writeProperty: 'KMINSA',
weightWriteProperty: 'cost',
k: 4
})
YIELD preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount;
MATCH (n:Node {name: 'a'})
CALL gds.alpha.spanningArborescenceReverse.maximum.write('graph', {
startNodeId: id(n),
relationshipWeightProperty: 'cost',
writeProperty: 'MAXSA',
weightWriteProperty: 'cost'
})
YIELD preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount;
MATCH (n:Node {name: 'a'})
CALL gds.alpha.spanningArborescenceReverse.kmax.write('graph', {
startNodeId: id(n),
relationshipWeightProperty: 'cost',
writeProperty: 'KMAXSA',
weightWriteProperty: 'cost',
k: 4
})
YIELD preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount
RETURN preProcessingMillis, computeMillis, writeMillis, effectiveNodeCount;
match (n)-[r]->(m) return n,r,m;
I was wondering, why do you need the Maven setup, isn't Gradle enough? Also if I read it all correctly it seems that you are checking out the source code and working with it directly and not just using the artifacts provided by Maven central, is my assumption correct?
Hi @icejean,
Can you please add this dependency and give it a try:
<dependency> <groupId>org.neo4j.gds</groupId> <artifactId>opengds-extension</artifactId> <version>2.5.5</version> <scope>test</scope> </dependency>
Maybe we need to pass a parameter -Pneo4jVersion=5.10.0
to the test-utils artifact like the Gradle way in the Maven project, but I don't konw how to do it. Maybe you can install Eclipse and creat a Maven project, import some algorithms and procedures of Open GDS to have a try, as you're familiar with the artifacts. :)
Good morning @icejean I was thinking exactly the same, would it be possible to provide your setup without any proprietary code of course, maybe create a sample GitHub project and share it, this will help us immensely to investigate this issue and help.
@vnickolov : Sure I can provide my example project source. Actually I have a personal website which can provide a download URL for it, no need for a Github project. I import the K spanning tree algorithm and procedures, the spanning tree algorithms and procedures of Open GDS to have a test, the junit test of algorithms are O.K., but all junit tests of procedures are failed with the previous exception. Neo4j Cummunity 5.10+ Open GDS 2.5.5 project rar Neo4j Cummunity 5.10+ Open GDS 2.5.0 project rar
Thank you @icejean, we'll have a look and get back to you.
Hi @icejean, thank you for the code, after inspection we think that the issue is coming up because the test-utils
published to Maven was compiled using Neo4j 4.4 database as default and there are some differences in the it-test-support
artifact.
I would suggest you make verbatim copies of org.neo4j.gds.BaseTest
and org.neo4j.gds.BaseProcTest
to your test package org.neo4j.gds
, just rename them to not be confused with the ones provided by test-utils
and use them in your tests instead of the default ones.
This is sort of a quick and dirty(ish) workaround to get you unblocked, I will raise the issue with the team and we will think about more permanent and robust solution.
@vnickolov Great! It works! Thanks a lot! :)
D:\eclipse2022\workspace\Open-GDS-Extend-2.5.5>mvn test -Dtest=org.neo4j.gds.paths.spanningtree.SpanningTreeStatsProcTest#testYields -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< cn.jean.neo4j:gds-extend >----------------------
[INFO] Building Jean's Neo4j GDS Extend 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce) @ gds-extend ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ gds-extend ---
[INFO] skip non existing resourceDirectory D:\eclipse2022\workspace\Open-GDS-Extend-2.5.5\src\main\resources
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ gds-extend ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 29 source files with javac [debug release 17] to target\classes
[WARNING] 注释处理不适用于隐式编译的文件。
使用 -proc:none 禁用注释处理或使用 -implicit 指定用于隐式编译的策略。
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ gds-extend ---
[INFO] Copying 1 resource from src\test\resources to target\test-classes
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ gds-extend ---
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 12 source files with javac [debug release 17] to target\test-classes
[INFO]
[INFO] --- surefire:3.1.2:test (default-test) @ gds-extend ---
[INFO] Surefire report directory: D:\eclipse2022\workspace\Open-GDS-Extend-2.5.5\target\surefire-reports
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.neo4j.gds.paths.spanningtree.SpanningTreeStatsProcTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.880 s -- in org.neo4j.gds.paths.spanningtree.SpanningTreeStatsProcTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.927 s
[INFO] Finished at: 2024-01-10T10:00:14+08:00
[INFO] ------------------------------------------------------------------------
D:\eclipse2022\workspace\Open-GDS-Extend-2.5.5>
That's great @icejean, do you think we can close this issue? I will create an item to have a discussion with the team and provide a more permanent solution.
@vnickolov Sure, thanks a lot!
Thank you @icejean and please let us know if there is anything we can help with.
Hi, all, I want to develop some extended algorithms based on the Open Graph Data Science libraries 2.5.5, first of all I want to set up a Maven project references the libraries in Eclipse, and import and run some algorithms and procedures of it to verify the settings are O.K., the junit tests of algorithms, spanningtree and kspanningtree for example, are O.K., but the junit tests of precedures, all failed at the point of "@BeforeEach", seems to be failed to load a test instance of Neo4j Database. I can build the library in a command line window with gradle, and run the tests successfully, with Neo4j 5.10.0 community:
But failed with Maven, seems failed to load a correct version of Neo4j instance for testing:
Here's the pom.xml of my project:
And here's the project snapshot:![GDS-2 5 5](https://github.com/neo4j/graph-data-science/assets/54383348/b0b928e1-a82f-43a7-8a02-bd7218464baf)
And here's the related thread in community.neo4j.com.
Any idea? Thanks in advance.