Result Data Structure: JsonQL.Compilation.ICompilationResult
The result of loading JSON files is stored in an instance of JsonQL.Compilation.ICompilationResult.
Consider the following C# code snippet that loads MainExample/Example.json that depends on these JSON files (i.e., has JsonQL expressions that reference JSON objects in these files).
Parameters.json - a JSON file with lists “FilteredCountryNames” and “FilteredCompanyNames” referenced in other JSON files below in JsonQL expressions.
Countries.json - a JSON file for data on number of countries
Companies.json - a JSON file for data on number of companies
FilteredCompanies.json - a JSON file shown below with JsonQL expressions that filter companies in Companies.json to include only some companies using data in Parameters.json.
string[] sharedExamplesFolderPath = new string[] { "DocFiles", "MutatingJsonFiles", "Examples"};
var parametersJsonTextData = new JsonTextData("Parameters",
LoadJsonFileHelpers.LoadJsonFile("Parameters.json", sharedExamplesFolderPath));
// countriesJsonTextData uses parametersJsonTextData for parameter parentJsonTextData
var countriesJsonTextData = new JsonTextData("Countries",
LoadJsonFileHelpers.LoadJsonFile("Countries.json", sharedExamplesFolderPath), parametersJsonTextData);
var companiesJsonTextData = new JsonTextData("Companies",
LoadJsonFileHelpers.LoadJsonFile("Companies.json", sharedExamplesFolderPath), countriesJsonTextData);
var filteredCompaniesJsonTextData = new JsonTextData("FilteredCompanies",
LoadJsonFileHelpers.LoadJsonFile("FilteredCompanies.json", sharedExamplesFolderPath), companiesJsonTextData);
// Set the value of jsonCompiler to an instance of JsonQL.Compilation.IJsonCompiler here.
// The value of JsonQL.Compilation.JsonCompiler is normally created by Dependency Injection container
// and it is normally configured as a singleton.
JsonQL.Compilation.IJsonCompiler jsonCompiler = null!;
var result = jsonCompiler.Compile(new JsonTextData("Example",
this.LoadExampleJsonFile("Example.json"), filteredCompaniesJsonTextData));
The value result in C# snippet above is of type JsonQL.Compilation.ICompilationResult and the serialized value of result can be found here MainExample/Result.json.
To retrieve the details of loaded JSON files in JsonQL.Compilation.ICompilationResult you need to retrieve an item in CompiledJsonFiles property for compiled JSON file. The items in this list are of type JsonQL.Compilation.ICompiledJsonData are ordered in such a way that parent JSON file items appear before child JSON file items.
See JsonQL.Compilation.ICompiledJsonData to learn more about this interface.
Property CompilationErrors stores details of errors encountered during compilation process, if any.