arcadedb
arcadedb copied to clipboard
SQL: `IMPORT DATABASE` problems with `.xml` file
ArcadeDB Version: ArcadeDB Server v23.6.1-SNAPSHOT (build 422522314d20ab885deff5f337cdd66a390d7c8f/1687430275407/main)
OS and JDK Version: Running on Mac OS X 12.6.5 - OpenJDK 64-Bit Server VM 11.0.19 (Homebrew)
There appear to be two problems with import of generic XML files:
- Types are not created on-the-fly based on the found tag names (ie
Type with name 'v_{http://www.loc.gov/MARC21/slim}record' was not found) - The namespace content instead of the namespace symbol (here it is empty) is used, so actually the type
v_recordinstead ofv_{http://www.loc.gov/MARC21/slim}recordshould be created. And in casexmlns:mynamespace="..."and<mynamespace:record>...</mynamespace:record>is used,v_mynamespace_recordshould be created.
Expected behavior
Succesful XML import
Actual behavior
Error on parsing source 'file://test.xml (compressed=false size=852)'
Error on command execution (PostCommandHandler)
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:64)
at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:73)
at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:101)
at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1291)
at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:446)
at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:115)
at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:83)
at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:98)
at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:124)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source 'file://test.xml (compressed=false size=852)'
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)
... 17 more
Caused by: com.arcadedb.integration.importer.ImportException: Error on importing from source 'file://test.xml (compressed=false size=852)'
at com.arcadedb.integration.importer.format.XMLImporterFormat.load(XMLImporterFormat.java:138)
at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:93)
at com.arcadedb.integration.importer.Importer.load(Importer.java:54)
... 22 more
Caused by: com.arcadedb.exception.SchemaException: Type with name 'v_{http://www.loc.gov/MARC21/slim}record' was not found
at com.arcadedb.schema.EmbeddedSchema.getType(EmbeddedSchema.java:576)
at com.arcadedb.database.EmbeddedDatabase.newVertex(EmbeddedDatabase.java:1118)
at com.arcadedb.integration.importer.format.XMLImporterFormat.load(XMLImporterFormat.java:106)
... 24 more
Steps to reproduce
Create test.xml in the arcadedb folder with content:
<collection xmlns="http://www.loc.gov/MARC21/slim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
<record>
<datafield tag="100" ind1="1" ind2=" ">
<subfield code="a">Marinaccio, Lawrence F.,</subfield>
</datafield>
<datafield tag="100" ind1="1" ind2=" ">
<subfield code="a">Jung, Richard G.,</subfield>
</datafield>
<datafield tag="100" ind1="1" ind2=" ">
<subfield code="a">Jankowski, Francis J.,</subfield>
</datafield>
<datafield tag="100" ind1="1" ind2=" ">
<subfield code="a">Dingee, David A.,</subfield>
</datafield>
<datafield tag="100" ind1="1" ind2=" ">
<subfield code="a">Chastain, Joel W.,</subfield>
</datafield>
</record>
</collection>
Then run:
IMPORT DATABASE file://test.xml