Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import multi-label vertices using neo4jImporter does not work properly #1340

Closed
LeonardoMarrancone opened this issue Nov 22, 2023 · 2 comments
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@LeonardoMarrancone
Copy link

ArcadeDB Version:

23.10.1

OS and JDK Version:

macOs Ventura Version 13.3.1, java 17.0.2 2022-01-18 LTS

Description

  • Use case:

    • import a dataset with multi-label nodes (e.g :Place:City, :Place:Country) from Neo4j using the arcadedb neo4j importer (jsonl/graphml)
    • be able to query from gremlin/cypher using both Place and its subtypes (e.g g.V().hasLabel(‘Place’) - should retrieve all the Places, Cities and Countries, g.V().hasLabel(‘City’) - should retrieve all the Cities)
  • From the documentation

    • import from multi-label sources using the neo4j importer should create underscore-joined labels (e.g City_Place) that use inheritance
    • vertices with multiple labels work using SQL inheritance and can be then retrieved in gremlin/cypher using the parent label as described here (No support for Multi-label nodes #384)
  • Expected behavior

    • the neo4j importer should be able to import multi-label sources coming from Neo4j as the documentation states and then the vertices should be retrieved as expected by the gremlin/cypher queries
  • Actual behavior

    • the import fail using the commands and jsonl file mentioned in the Steps to reproduce section
    • the import using the graphml file completes but the vertices have vertex as label (@type) and the actual labels are stored as string concatenation in a property (labels = “:Place:City”)

Steps to reproduce

json example line:
{“type”:“node”,“id”:“0",“labels”:[“Place”,“City”],“properties”:{“name”:“Test”}}
if from terminal we execute:

  • docker exec -it arcadedb /bin/sh -c “rm -f /home/arcadedb/databases/graph/database.lck; ./bin/console.sh connect graph”
  • import database file:///home/arcadedb/data/import/all.json
    returns an error:
ERROR:
com.arcadedb.exception.CommandExecutionException: Error on importing database
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:69)
	at com.arcadedb.query.sql.executor.SingleOpExecutionPlan.executeInternal(SingleOpExecutionPlan.java:91)
	at com.arcadedb.query.sql.parser.SimpleExecStatement.execute(SimpleExecStatement.java:52)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:65)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:110)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1313)
	at com.arcadedb.console.Console.executeSQL(Console.java:591)
	at com.arcadedb.console.Console.execute(Console.java:267)
	at com.arcadedb.console.Console.parse(Console.java:731)
	at com.arcadedb.console.Console.interactiveMode(Console.java:129)
	at com.arcadedb.console.Console.execute(Console.java:179)
	at com.arcadedb.console.Console.main(Console.java:142)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source ‘file:///home/arcadedb/data/import/all.json (compressed=false size=37710174)’
	at com.arcadedb.integration.importer.Importer.load(Importer.java:63)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:61)
	... 11 more
Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:229)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.arcadedb.integration.importer.Neo4jImporter.typeNameFromLabels(Neo4jImporter.java:562)
	at com.arcadedb.integration.importer.Neo4jImporter.lambda$syncSchema$1(Neo4jImporter.java:198)
	at com.arcadedb.integration.importer.Neo4jImporter.executeCallback(Neo4jImporter.java:533)
	at com.arcadedb.integration.importer.Neo4jImporter.readFile(Neo4jImporter.java:482)
	at com.arcadedb.integration.importer.Neo4jImporter.syncSchema(Neo4jImporter.java:195)
	at com.arcadedb.integration.importer.Neo4jImporter.run(Neo4jImporter.java:141)
	at com.arcadedb.integration.importer.format.Neo4jImporterFormat.load(Neo4jImporterFormat.java:47)
	at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:95)
	at com.arcadedb.integration.importer.Importer.load(Importer.java:54)
	... 16 more

Further tests using version 22.6.1 (referenced in the issue_384 above)

  • the import fail using the mentioned commands and jsonl file
  • the import using the graphml file completes but the vertices have vertex as label (@type) and the actual labels are stored as string concatenation in a property (labels = “:Place:City”)
@lvca lvca self-assigned this Nov 23, 2023
@lvca lvca added the bug Something isn't working label Nov 23, 2023
@lvca lvca added this to the 23.11.1 milestone Nov 23, 2023
@lvca
Copy link
Contributor

lvca commented Nov 23, 2023

Reproduced. Thanks @LeonardoMarrancone for the detailed test case.

lvca added a commit that referenced this issue Nov 23, 2023
@lvca
Copy link
Contributor

lvca commented Nov 23, 2023

Fixed. Added your file in our test suite to avoid regressions.

@lvca lvca closed this as completed Nov 23, 2023
@lvca lvca added the fixed label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants