Expected JSON File Format
Ingested JSON files must represent a JSON array of JSON objects, each of these objects
representing one event.
All events must define an action property specifying its type, and some
required properties depending on the selected action. [
{
"action": "AddOrReplaceItem",
"item": {
"...": "..."
}
},
...
{
"action": "DeleteItem",
"uri": "..."
},
...
{
"action": "AddOrReplaceClass ",
"classDefinition ": {
"...": "..."
}
}
]
| Supported action |
Description |
Expected properties |
AddOrReplaceItem |
Indexes an item. See the example in Add Item. |
item: A JSON object. The expected format for that item is the
same as for items in the JSON Source for Tabular Data.
|
DeleteItem |
Deletes an item from the index unit. See the example in Delete Item. |
uri: A JSON string, that is the identifier of the item to
delete.
|
DeleteItemsWithPredicate |
Deletes all items matching a given predicate from the index unit. See the
example in Delete Items with Predicate. |
expression: The predicate used to select the items to delete.
The expression uses an item variable, which contains the item
currently evaluated.
itemClassName: This property defines the item type.Data Factory Studio evaluates the predicate against all instances of the class provided with the
itemClassName attribute. It removes from the index unit, all
items for which the predicate evaluates to true.
Note:
Specify a
Fully Qualified Name, including the class package and containing back quotes
` if required.
|
AddOrReplaceClass |
Creates or replace a class entirely in the data Model. See the examples in
Add a Class and Add a More Complex Class. |
classDefinition: Defines the class to add or replace with the
following subproperties:
abstract: As in Java, this indicates that the class is not
complete but you can however use it as reference.
name: Fully Qualified Name of the class to create or to
replace.
parents: (Optional) Specify the list of parent classes. If
empty, core.Item is the default parent class.
attributes: Specify the class properties.
annotations: (Optional) Specify the list of class
annotations.
|
DeleteClass |
Deletes an empty class from the index unit data Model. See the example in
Delete Class.
|
class: a JSON string, with the Fully Qualified Name of the class
to remove, for example, com.package.bar.
|
Examples
Add Item
[
{
"action": "AddOrReplaceItem",
"item": {
"uri": "abcd123",
"class": "com.example.MockClass",
"a_bool": true,
"a_date": "1111-01-11"
}
},
{
"action": "AddOrReplaceItem",
"item": {
"uri": "def546",
"class": "com.example.MockClass",
"a_bool": false,
"a_date": "2222-02-22"
}
},
{
"action": "AddOrReplaceItem",
"item": {
"uri": "ghi789",
"class": "com.example.MockClass",
"a_bool": true,
"a_date": "3333-03-33"
}
}
]
Delete Item
[
{
"action": "DeleteItem",
"uri": "abcd123"
},
{
"action": "DeleteItem",
"uri": "ghi789"
}
]
Delete Items with Predicate
{
"action": "DeleteItemsWithPredicate",
"expression": "item.my_property == \"Example\"",
"itemClassName": "com.example.MockClass"
}
Remove all instances for a specific class: {
"action": "DeleteItemsWithPredicate",
"expression": "true",
"itemClassName": "com.example.MockClassToClear"
}
Remove all items older than a specified date: {
"action": "DeleteItemsWithPredicate",
"expression": "item.my_date < Date.today()",
"itemClassName": "com.example.MockClass"
}
Add a Class
[
{
"action": "AddOrReplaceClass",
"classDefinition": {
"abstract": false,
"name": "com.example.MockClass",
"parents": ["core.Item"],
"attributes": [
{
"name": "a_bool",
"type": "Boolean",
"annotations": []
},
{
"name": "a_date",
"type": "Date",
"annotations": []
}
],
"annotations": []
}
}
]
Add a More Complex Class
[
{
"action": "AddOrReplaceClass",
"classDefinition": {
"abstract": false,
"name": "com.example.ComplexMockClass",
"parents": ["com.example.MockClass"],
"attributes": [
{
"name": "a_localdatetime",
"type": "LocalDateTime",
"annotations": [
{
"type": "InputFormat",
"format": "yyyy-MM-dd'T'HH:mm:ss"
}
]
},
{
"name": "a_float",
"type": "Float",
"annotations": []
},
{
"name": "a_decimal",
"type": "Decimal",
"annotations": []
},
{
"name": "an_Integer",
"type": "Integer",
"annotations": []
},
{
"name": "a_geo",
"type": "Geometry",
"annotations": []
},
{
"name": "a_binary",
"type": "Binary",
"annotations": []
},
{
"name": "a_reference",
"type": "Reference<com.example.MockClass>",
"annotations": []
},
{
"name": "a_Text",
"type": "Text",
"annotations": []
},
{
"name": "a_String",
"type": "String",
"annotations": []
},
{
"name": "a_StringList",
"type": "List<String>",
"annotations": []
},
{
"name": "an_IntegerCollection",
"type": "Collection<Integer>",
"annotations": []
},
{
"name": "a_StringMap",
"type": "Map<String,String>",
"annotations": []
},
{
"name": "a_FloatMap",
"type": "Map<String,Float>",
"annotations": []
}
{
"name": "a_IntegerTimeSeries",
"type": "IntegerTimeSeries",
"annotations": []
},
{
"name": "a_FloatTimeSeries",
"type": "FloatTimeSeries",
"annotations": []
}
{
"name": "a_DecimalTimeSeries",
"type": "DecimalTimeSeries",
"annotations": []
}
{
"name": "a_BooleanTimeSeries",
"type": "BooleanTimeSeries",
"annotations": []
}
{
"name": "a_StringTimeSeries",
"type": "StringTimeSeries",
"annotations": []
}
{
"name": "a_StringEnumTimeSeries",
"type": "StringTimeSeries",
"annotations": [
{
"type": "Enumeration",
"values": ["low", "medium", "high"]
}
]
}
],
"annotations": []
}
}
]
Delete Class
[
{
"action": "DeleteClass",
"class": "com.example.foo"
}
]
|