Skip to content

Commit

Permalink
Upgraded to Neo4j 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
drwillcharles committed Mar 7, 2023
1 parent 9658b24 commit 341b7d5
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ temp/
docker_example/plugins/*jar

settings.xml
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
```
2) Generate .jar file with all dependencies with `mvn package`
3) Put generated .jar file into `plugins/` folder of your neo4j instance and start the server
4) add `rdkit.index.sanitize=false` to `neo4j.conf`if you want to switch of sanitizing for indexing. If not provided `true` is assumed as default.
4) add `server.rdkit.index.sanitize=false` to `neo4j.conf`if you want to switch of sanitizing for indexing. If not provided `true` is assumed as default.
5) By executing `CALL dbms.procedures()`, you are expected to see `org.rdkit.*` procedures

### usage within Docker
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

<groupId>org.neo4j.rdkit</groupId>
<artifactId>rdkit-index</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<name>RDKit-Neo4j plugin</name>
<packaging>jar</packaging>

<properties>
<mockito.version>2.27.0</mockito.version>
<neo4j.version>4.4.4</neo4j.version>
<neo4j.version>5.5.0</neo4j.version>
<slf4j.version>1.7.25</slf4j.version>
<junit.version>5.2.0</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<license.licenseName>evgerher_license</license.licenseName>
<license.licenseResolver>${project.baseUri}src/main/license</license.licenseResolver>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/rdkit/neo4j/config/RDKitSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
import org.neo4j.graphdb.config.Setting;

public class RDKitSettings implements SettingsDeclaration {
public static final Setting<Boolean> indexSanitize = SettingImpl.newBuilder("rdkit.index.sanitize", SettingValueParsers.BOOL, true).build();
public static final Setting<Boolean> indexSanitize = SettingImpl.newBuilder("server.rdkit.index.sanitize", SettingValueParsers.BOOL, true).build();
}
13 changes: 5 additions & 8 deletions src/main/java/org/rdkit/neo4j/procedures/BaseProcedure.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,11 @@ void checkIndexExistence(List<String> labelNames, String indexName) {
* @param properties - properties to set index on top of
*/
void createFullTextIndex(final String indexName, final List<String> labelNames, final List<String> properties) {
Map<String, Object> params = MapUtil.map(
"index", indexName,
"labels", labelNames,
"property", properties
);

tx.execute("CALL db.index.fulltext.createNodeIndex($index, $labels, $property, {analyzer: 'whitespace'} )", params);
// tx.execute("CALL db.index.fulltext.createNodeIndex($index, $labels, $property, {analyzer: 'whitespace'} )", params);

String property = properties.stream().collect(Collectors.joining("','", "n.", ""));

tx.execute(String.format("CREATE FULLTEXT INDEX %s FOR (n:%s) ON EACH [%s] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }", indexName, String.join("|", labelNames), property));

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void deleteIndex() {
log.info("Create whitespace node index on `fp` property");

tx.execute(String.format("DROP INDEX %s_%s IF EXISTS", Constants.Chemical.getValue(), canonicalSmilesProperty));
tx.execute("CALL db.index.fulltext.drop($index)", MapUtil.map("index", indexName));
tx.execute(String.format("DROP INDEX %s", indexName));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BitSetIndexQueryingTest extends BaseTest {
@Test
public void testIndexing() {

graphDb.executeTransactionally("CALL db.index.fulltext.createNodeIndex('bitset', ['Molecule'], ['bits'], {analyzer: 'whitespace'} )");
graphDb.executeTransactionally("CREATE FULLTEXT INDEX bitset FOR (n:Molecule) ON EACH [n.bits] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }");

// build parameter maps
List<Map<String, Object>> maps = moleculeNameToBitSetMap.entrySet().stream().map(entry -> MapUtil.map(
Expand Down Expand Up @@ -85,14 +85,14 @@ public void testIndexing() {
return null;
});

graphDb.executeTransactionally("CALL db.index.fulltext.drop('bitset')"); // otherwise we get an exception on shutdown
graphDb.executeTransactionally("DROP INDEX bitset"); // otherwise we get an exception on shutdown
}

@Test
public void makeSimilarityRequestTest() throws Exception {
insertChemblRows();

graphDb.executeTransactionally("CALL db.index.fulltext.createNodeIndex('bitset', ['Chemical', 'Structure'], ['fp'], {analyzer: 'whitespace'} )");
graphDb.executeTransactionally("CREATE FULLTEXT INDEX bitset FOR (n:Chemical|Structure) ON EACH [n.fp] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }");

final String smiles1 = "COc1ccc(C(=O)NO)cc1";

Expand Down Expand Up @@ -142,7 +142,7 @@ public void makeSimilarityRequestTest() throws Exception {
return null;
});

graphDb.executeTransactionally("CALL db.index.fulltext.drop('bitset')"); // otherwise we get an exception on shutdown
graphDb.executeTransactionally("DROP INDEX bitset"); // otherwise we get an exception on shutdown
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void createCustomFpTest() throws Exception {
}

graphDb.executeTransactionally("CALL org.rdkit.search.dropIndex()");
graphDb.executeTransactionally("CALL db.index.fulltext.drop($indexName)", MapUtil.map("indexName", propertyName + "_index"));
graphDb.executeTransactionally(String.format("DROP INDEX %s", propertyName + "_index"));
}

@Test(expected = IllegalStateException.class)
Expand Down Expand Up @@ -136,6 +136,6 @@ public void callSimilarityProcedureTest() throws Throwable {
});

graphDb.executeTransactionally("CALL org.rdkit.search.dropIndex()");
graphDb.executeTransactionally("CALL db.index.fulltext.drop($indexName)", MapUtil.map("indexName", propertyName + "_index"));
graphDb.executeTransactionally(String.format("DROP INDEX %s", propertyName + "_index"));
}
}

0 comments on commit 341b7d5

Please sign in to comment.