@chase annotation and is materialized in a parallel and distributed fashion into datasources such as CSV files or Neo4j databases.
Configuring the Chase Graph
The@chase annotation configures how the chase graph is stored. Its syntax is as follows:
Materializing the Chase Graph on CSV
For CSV datasources, the chase graph is stored as a CSV dataset having the following columns “Fact”, “ProvenanceLeft”, “ProvenanceRight”, “Rule” representing the chase fact, the left body predicate, the right body predicate (empty if the chase fact is generated by a linear rule), the description of the rule generating the chase fact, respectively. Consider this example:@chase annotation instructs Vadalog to store the chase in the path disk/data/chase.csv. The directory may contain multiple CSVs due to the distributed evaluation, with the following rows:
Chase graph at: disk/data/chase.csv
Handling Aggregations
The production of the chase for programs with aggregations requires to introduce artificial intermediate chase nodes representing facts with group by values. This intermediate chase node guarantees the connectivity between the fact resulting from an aggregation and the facts that contributed to calculate it. Such a intermediate chase fact is identified by its predicate which is the original predicate name prepended byaggregated_explainability_.
As an example, the following program:
Chase graph at: disk/data/chase.csv
Materializing the Chase Graph on CSV using Neo4j Bulk Import
When materializing the chase in CSV format, it is possible to structure the data for import into Neo4j using the bulk import tool. This is particularly useful for navigating very large chase graphs with Neo4j. To activate this functionality, set the parameterforNeo4jBulkImport=true (the default is false). This command enables the materialization of the chase into two CSV files: one for nodes and one for edges. The CSV of the nodes has the following columns “id:ID”, “:Label”. The CSV of the edges has the following columns :START_ID, :END_ID, rule:string,:TYPE. Consider this example:
Chase graph at: neo4j-import/chase/nodes/part-0.csv
Chase graph at: neo4j-import/chase/edges/part-0.csv
Materializing the Chase Graph on Neo4j with connectors
For Neo4j, the chase graph is represented as a graph with a node for each chase node and an edge for each derivation having name DERIVED_BY. Each node is a Neo4j node with the label CHASE_NODE and a propertyfact for the chase fact. Consider this example:
bolt://localhost:7687. In this case there will be created four CHASE_NODE nodes
DERIVED_BY edges
Retrieving the Chase from Neo4j
After storing the chase in Neo4j, it can be retrieved using distributed Neo4j Connectors with the following annotations:Optimize the Chase materialization and retrieval on Neo4j
Note that to have better performances while materializing and retrieving the chase from Neo4j, you can index theCHASE_NODE via the following cypher query in the Neo4j Browser or via cypher shell:

