Prerequisites
You’ll need to install thenetworkx
library to parse GML files:
Complete Example
Here’s a complete example that reads a GML file and imports it into TuringDB:Example GML File
Here’s a sample GML file to test with (sample.gml
):
Key Points
- Single CREATE Query: Due to TuringDB’s current Cypher limitations, the entire graph must be created in a single CREATE statement.
- Change Management: Always use the change system when modifying data:
- Create a new change with
CHANGE NEW
- Checkout into the change
- Execute your CREATE query
- Commit and submit the change
- Create a new change with
- Label Sanitization: Node and edge types are prefixed with
nt_
andet_
respectively, and special characters are replaced with underscores. - Properties: All node attributes from the GML file are converted to string properties in TuringDB.
Troubleshooting
- Large Graphs: For very large GML files, you might hit query size limits. Consider splitting the import or contact support for guidance.
- Invalid Characters: The sanitization function handles common invalid characters, but you may need to extend it for specific use cases.
- Memory Usage: Large graphs are loaded entirely into memory before conversion, so ensure you have sufficient RAM.