cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

How can I configure to print out query cypher in the console & How can I use The Neo4j Graph Algorithms Library DFS algorithm in Spring boot project

jayxu688
Node Link

I am using Spring boot to build an app with neo4j.

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>

application.properties

server.port=8080
spring.data.neo4j.embedded.enabled=false
spring.data.neo4j.uri=bolt://neo4j:password@localhost:11005
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=password

logging.level.org.springframework.web=debug
logging.level.org.neo4j.ogm=debug
logging.level.org.springframework.data.neo4j=debug
logging.level.org.neo4j.driver.GraphDatabase=debug

logging.level.org.neo4j.driver.OutboundMessageHandler=debug
logging.level.org.neo4j.driver.InboundMessageDispatcher=debug

# print cypher(test)
#log4j.category.org.springframework.data.neo4j=INFO
#log4j.category.org.org.neo4j.ogm=INFO
# Only print out : Direct driver instance 1263369936 created for server address localhost:11005
logging.level.org.neo4j.ogm.drivers.bolt.request.BoltRequest=DEBUG

ogm.properties

URI=bolt://neo4j:password@localhost:11005
username=neo4j
password=password

Artifact.java

@Data//@ToString、@EqualsAndHashCode、@Getter、@Setter、@RequiredArgsConstrutor
@NodeEntity
public class Artifact implements Serializable {

    @ApiModelProperty(hidden = true)
    private Long id;

    @ApiModelProperty(example = "uk.neo4j.graph")
    private String groupId;

    @ApiModelProperty(example = "neo4j-graph")
    private String artifactId;

    @ApiModelProperty(example = "1.0")
    private String version;

    @ApiModelProperty(example = "true")
    private Boolean availability;

    @Relationship(type = "DEPEND_ON")
    private Set<DependOn> dependOns;

DependOn.java

@Data
@RelationshipEntity(type = "DEPEND_ON")
public class DependOn implements Serializable {


    @Id private Long id;

    @StartNode private Artifact from;

    @EndNode private Artifact to;

    private String scope;

How can I configure to print out query cypher in the console?

Moreover, How can I use the DFS algorithm in graph data science (gds) in the spring boot project?
I hope to use the DFS algorithm to find out whether the artifact currently being queried (that is, the dependency in the maven pom) has been used in other projects released by the company.

For example, log4j2:1.2 has been used in other projects released by the company. I want to query whether there are any projects that the current company has released that depends on log4j2:1.2 in the graph database.

Here is the cyher that I wrote before, but my graph database has over 2 millions of nodes and 10 M of relationships, so the query performance is bad

MATCH (connected)-[:DEPEND_ON*]-> (root:Artifact {gav: "com.twitter:finagle-core_2.11:6.25.0"})
WHERE root <> connected
RETURN distinct connected,root

So I want to query through the DFS algorithm, but I don’t know how to integrate the DFS algorithm in gds into spring boot project.

0 REPLIES 0