Property Remappings
Access properties of elements in your graph.
Simple Remappings
Sometimes, you may want to rename a property that is returned from a traversal. You can access properties of an item by using the name of the property as defined in the schema.
You can use the name directly, or if you want to be more explicit,
or in cases where there may be name clashes, you can use the _::
operator.
Example: Direct Access
Example: Explicit Access
Nested Mappings
If you want to access a propertis that traverse from the selected element, you can use the nested variable to continue the traversal. These nested mappings work similarly to closures in rust or anonymous functions in javascript.
- e.g.
|a| { a + 1 }
in rust or(a) => { a + 1 }
in javascript.
We lean heavily on the rust syntax style for nested remappings. The following is an overview of the syntax:
The important thing to note here, is that if we were to access the ID
like we have shown previously:
nested_field: ID
. This ID would would be the ID of the other
item, not the item_name
item due to the tighter scope.
Example: