Using the Data Access API

You can define Datasets using the Data Access API.

This API enables you to define Datasets such as an entity, a relation, or an interaction, for a Reltio object. The procedure to define a Dataset includes the following steps:

Create Builder

First, create a Dataset Builder.

Specifying Dataset Properties and Fields

  • Specify type with builder.ofType(type)
  • Set active flag with .activeOnly(false/true).
    • If activeOnly == true (default), then only active relations and entities are returned
    • If activeOnly == false, then all relations and entities are returned
  • Provide the name of the table for the loaded data using builder.asTable(tableName)
    Note: This method is removed in Data Access API 2.0.
  • Specify which fields to select using builder.select(fieldName)
    • You can select audit attributes: createdBy, createdTime, updatedBy, updatedTime
    • You can select startDate / endDate (timestamp in Dataset)
    • You can select startObjectCrosswalks / endObjectCrosswalks which represent crosswalks for start and end objects
  • Specify which fields to explode using builder.explode(fieldName, explodedName).Explode provides a way to work with multivalue fields. The exploded multivalued field will produce a number of rows, each having only a single value for the exploded field.
    Note: This method is replaced with lateralView in Data Access API 2.0.
    Important: To avoid exceptions in the DataAccess process, when specifying fields to load, make sure that there are no attributes with the same name and only different character case (e.g. "name", "Name", "NAME"). If you have such attributes, you should first modify their names in the data model.
  • For EntityDatasetBuilder, RelationDatasetBuilder, you can select attributes by crosswalks and filter using .attributesFromSource, .attributesFromTable, ovOnly(). Examples: .attributesFromSource("HCOS", "HCP"), .attributesFromTable("table1", "table2").
    Note:
    • .attributesFromSource will automatically sanitize sources to the following format: configuration/sources/HCOS. Specifying the full path (configuration/sources/HCOS) is also possible.
    • If .attributesFromSource is specified, an attribute will appear if it comes from any of specified sources (effectively, it is a Boolean OR). The same applies for .attributesFromTable. If the parameters list is empty, then filtering is not applied. If both .attributesFromSource and .attributesFromTable are specified, an attribute must satisfy both filters, for example: by table and by source.
    • ovOnly(): the default value is ovOnly('true') for EntityDatasetBuilder and for RelationDatasetBuilder.

Build Dataset

  • Call method DataAccess.build() to create the Dataset.

Working with Dataset

When your Dataset is defined, you can print schema to verify the dataset structure and run queries to retrieve data for your purposes.