On this page you can find an explanation of how to work with the transformation service within wvr.io.
The transformation service allows users to create a 'script' to transform or alter a dataset. A transformation can be done on a single space at the time and works through the Transformation service.
Setting up the transformation service
- Add a new service
- Select 'Upload transform script'
- Go to Config
- For File, click on the 'Static' switch to say 'File', now select 'File' in the right box
- For Config put this line in the right box { "wipe": false, "memberKey": "type" }
This are the default setting and can be adjusted if needed. The memberKey as mentioned in the config part above is important and used in almost all of the transformations.
Filestructure & -type
The transformationservice accepts files of the type .yml and .yaml which should have the following structure:
On the first line it file should contain the name of a transformation (with underscores (_)) followed by a semicolon (:).
The next set of lines are the inputs for the transformation. What the content of these should be is shown in chapter below.
In the example below you can see 4 transformations being done based on 3 functions. Generally for each transformation we tend to keep 1 blank line, but more is possible and for each transformation function we keep 2 blank lines.
Example
drop_attributes_for_type: helperColumn type otherColumn type reverse_relation: partOf consistsOf change_attribute_keys: person_has_age age |
Available transformations
Transformation name | Function | Parameters |
---|---|---|
add_relations | Add a relation between 2 nodes. |
|
add_relations_for_all_members | Create relations from a group of nodes (a single type) to a single node. |
|
attributes_to_new_type | Can be used to create a type of nodes which are more frequently used, like classifications of some sort. Attribute mapping is written as: -attributeNameOfSource:attributeNameOfTarget for example: -otlType:naam |
|
change_attribute_into_type | Changes an attribute into a type. This transformation is used when you have a different type of dataset, where for instance you have a bunch of properties listed as Property instead of a Property with a specific name. With this transformation, the attribute value will become a type. |
|
change_attribute_keys | Changes an attribute key for all nodes containing this attribute. |
|
change_identifiers | Changes the id of a node. |
|
create_decomposition_by_separator | Creates a decomposition structure between nodes of one type. For instance if you have a structured dataset with nodes having some attribute (level): 01, 01.02, 01.02.03 and 01.02.01 it will create a relation from 01.02.01 to 01.02 and from 01.02.03 to 01.02 and finally from 01.02 to 01. The Separator (.) and Attribute key (level) mentioned in the parameters are based on the example mentioned above. |
|
create_nodes | Creates a new node with a specified node id and name attribute. |
|
create_relation_based_on_attribute_value | Creates relations based on a specific attribute with a specific value to a specified node. |
|
create_relation_from_sparql_result | Execute the sparql query, and for each result link the from node to the to node. |
|
create_typed_nodes | Create a new node with a specified node id and name attribute with a specified type |
|
delete_type_and_members | Deletes a specific type and all of its members. |
|
drop_attributes_for_type | Removes an attribute for all nodes of a specific type |
|
relate_nodes_based_on_attr_value | Create relations based on the attribute value of the source node and link them to the targetNode with the same value. Note: The target attribute can't have duplicate values. |
|
reverse_all_relations_of_key | Reverses all relations with a certain key and gives it a new name |
|
reverse_relation | Reverse a specific relation between two nodes |
|
reverse_relation_between_types | Reverse a specific relation between two types of nodes |
|
set_names | Set the name of a specific node (sets attribute: name) |
|
store_queried_value_on_node | Execute the sparql query, assuming the query has one result. Stores the found value on the node using the attribute key. If the attribute does not exist, create it before assigning the value. If a previous value on the node exists, override. |
|