Skip to content

neocoretechs/Relatrix

Repository files navigation

A newer, easier way of looking at and manipulating data.

The Relatrix:

Full featured database which not only builds on the Key/Value Deep Store concept with full transaction checkpointing and recovery and embedded and server models, but provides a novel way of storing, retrieving and relating complex unstructured object data.

Toward an easier, more flexible, data management paradigm. In order to provide structure to unstructured data, an otherwise esoteric branch of math called category theory provides us with a perfect description of how to add increasing levels of structure through its algebraic rules. The Relatrix is a new data management system whose underlying principles are loosely based on this branch of mathematics. The Relatrix is a framework that manages unstructured data by the mapping of the functional relationships within the data sets. These relationships can be simple, standard key/value relationships, or a more complex triplet that contains three objects. The objects in the triplets can themselves be relationships that can be composed into more complex relationships. Relationships are defined as objects comprised of an overarching domain object, with a functional mapping object, that relates the domain to a range object. Data is retrieved as sets presented as standard iterators or streams. There are a number of simple yet powerful sets of retrieval methods utilizing wildcards and concrete objects, and class and object level set return indicators, to get the data back out without getting lost in deep, dark, thickets common to schemaless data stores. It's built atop Meta RocksDb, so the underlying framework is mature, high performance, and reassuringly active and supported.

To get slightly more technical; imagine that rather than being able to map keys one-to-one like a relational database you can map them through a function that adds more relevance. We can then assign equivalence through isomorphism, or functional similarities between data. The relationships themselves are objects which can be composed into higher level relationships that open up the data to perform analysis not possible with conventional databases. Here are some concrete examples:

Building relationships is as easy as saying:
Relatrix.store([fromObject],[mapObject],[toObject]); // This stores a functional relationship
and a query for that set is as simple as:

Stream stream = (Stream) Relatrix.findStream("?", "?", "?");
stream.forEach(e -> Stream.of(e).forEach(g -> System.out.println("Element A:"+g)));

Or using the old Iterator model:
Iterator iterator = Relatrix.findSet("?",[mapObject],"?"); // This retrieves all domain objects and range objects mapped through [mapObject]

To compose two relationships to an association:
Relatrix.store([fromObject1],[mapObject1],Relatrix.store([fromObject2],[mapObject2].[toObject2])); // This composes relationships

Stream stream = (Stream) Relatrix.findStream([fromObject1],"*","?", true); // This returns all range objects mapped to [fromObject1] through ANY map object in parallel, including the relationship stored above

Stream stream = (Stream) Relatrix.findStream(("*","*","*"); // This makes ready for consumption by stream all relationships as identity objects

public class VisualCortex {
	public static void main(String[] args) throws Exception {
		Relatrix.setTablespaceDirectory(args[0]);
		Stream<Result> stream = (Stream<Result>) Relatrix.findStream("?", "?", "?", true);
		Map<Object, Map<Object, Map<Object, Long>>> nameCount = stream.collect(Collectors.groupingBy(b -> b[0].toString(),
		Collectors.groupingBy(d -> d[1].toString(),
		Collectors.groupingBy(e -> e[2].toString(), Collectors.counting()))));
		nameCount.forEach((name, count) -> {
			System.out.println(name + ":" + count);
		});
	}
}

About

A new type of data management system with its roots in category theory.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published