Importing Data from XML Files
This topic provides instructions for creating an XML data source, scanning a file, and generating the schema.
- In the Anzo console, expand the Onboard menu and click Structured Data. Anzo displays the Data Sources screen, which lists any existing data sources. For example:
- Click the Create button and select XML Data Source. Anzo opens the Create XML Data Source screen.
- Type a name for the data source in the Title field, and type an optional description in the Description field.
- Click the XML File Location field to open the File Location dialog box.
- In the File Location dialog box, navigate to the directory for the XML file. On the left side of the screen, select the file system or storage location for the file. On the right side of the screen, navigate to the directory that contains the file to import. The screen displays the list of files in the directory. For example:
- Select the file that you want to import and then click OK to close the dialog box.
- Specify the type of schema that Anzo should create. Click the Schema Type field and select one of the following types from the drop-down list:
- Flat: By default, the Schema Type is set to Flat. A flat schema type results in a single schema table with a single mapping file and ETL job. Generating a flat schema is ideal for files with many different objects with nested relationships where there are many one-to-one relationships. If the file contains a large number of arrays or a number of arrays that are large in size, however, generating a flat schema is not recommended. The import can require extensive server resources and take a long time to process.
Note: In Flat mode, Anzo creates relationships that go from the parent node to the child node. For example: Person → Address.
- Relational: A relational schema type results in multiple schema tables, mappings, and jobs. Generating a relational schema is ideal for files that include many arrays or a number of very large arrays. Creating a relational schema from a file that contains many different objects with one-to-one relationships can result in poor import performance and a very large number of small tables, mappings, and ETL jobs.
Note: In Relational mode, Anzo creates relationships that go from the child node to the parent node. For example: Address → Person.
Tip: Anzo performs pre-processing before creating the schema. If the specified Schema Type would result in poor performance or require extensive resources, Anzo displays a warning and prompts you to change the schema type before proceeding with the schema creation.
- Flat: By default, the Schema Type is set to Flat. A flat schema type results in a single schema table with a single mapping file and ETL job. Generating a flat schema is ideal for files with many different objects with nested relationships where there are many one-to-one relationships. If the file contains a large number of arrays or a number of arrays that are large in size, however, generating a flat schema is not recommended. The import can require extensive server resources and take a long time to process.
- The Schema File Location field defines where Anzo saves the generated schema. Cambridge Semantics recommends that you leave the field blank. If you want to designate a custom location, click Browse and choose a file location.
- The value in the Scan Depth field indicates the number of entities in the file that Anzo should scan to find all of the unique objects to include as classes and properties in the generated model. The scan process follows nested objects, counting one object array as one row. Edit the value as needed. A value of -1 instructs Anzo to scan the entire file.
- If the XML file contains lists of objects that are not nested, the file scan cannot determine if any of the objects are the same type, and Anzo treats each object as a new type. To ensure that repeating object paths are treated as the same type if the XML elements are all at the same level, use standard XML path (XPath) syntax to define the repeating element types in the Repeating Element Paths field. If the file nests elements, leave this field blank. Separate paths with semicolons (;). For example:
/root/people;/root/people/vehicles;/root/people/vehicles/maintenance
- Click Save and Extract Schema to scan the file and generate the schema. Anzo saves the data source, creates the schema, and displays the data source details. For example:
To view the schema that Anzo created, you can click the Schema Name link at the bottom of the screen under Schema Details. Anzo opens the overview screen for the schema, where you can access table details and create mappings and pipelines to ingest the data.
The source data can now be onboarded to Anzo. For instructions on onboarding the data by letting Anzo automatically generate the mapping, model, and ETL pipeline, see Auto-Ingesting Imported Data. For information about creating mappings, models, and pipelines manually, see Working with Mappings, Modeling Data, and Working with Pipelines.