Designed to provide an object oriented API that wrappes the string based DataProvider API. It compiles the Java code outputed by the RelcCompiler into JVM bytecode, and dinamically returns an implementation of the API to the user.
You can use this to execute data base opertations (insert, query, remove, update, empty) using your domain objects directly. Each domain object should be a simple POJO. Thas is, a Java object containing private fields, and getter and setter methods for each fields.
You should have a different set of configuration files for every object. for example, these are configuration files for the Page POJO.
-
- Relations file - this file describes the funtional dependencie of the specific data.
-
- Decomposition graph file - this file describes the decomposition graph on the given data.
RelationalDataStore<Page> pageRelationalDataStore = new RelationalDataStore<>(relationPath, decompositionPath);
Page page = new Page();
// set page fields...
page.setTitle("my-titile");
page.setWikiText("my-text")
// init store
pageRelationalDataStore.empty();
// data store operations
pageRelationalDataStore.insert(page);
pageRelationalDataStore.remove(page);
Page template = new Page();
template.setTitle("my-titile");
// query all pages with title 'my-title'. populate only the author field in the results.
pageRelationalDataStore.query(template, Arrays.asList("author"))
Page updateTemplate = new Page();
updateTemplate.setTitle("my-title");
Map<String, String> updates = new HashMap<String, String>();
updates.put("wikitext", "updatedText");
// update all pages with title 'my-title' to new wikitext
pageRelationalDataStore.update(updateTemplate, updates);`