Although not shown here, the Java interface to RBB also provides the Tagset interface for constructing and manipulating tagsets (e.g. adding or removing name/value pairs and superset/subset testing).
package gov.sandia.rbb; public class RBBTutorial { public static void main(String[] args) { try { ////// Create an RBB // This creates the H2 database, and adds RBB functionality to it. RBB rbb = RBB.create("jdbc:h2:mem:HelloWorldDB", "Any Name"); //// Events // create Events double start=0, end=10; Event ev = new Event(rbb.db(), start, end, new Tagset("name1=value1,name2=value2")); double start2=20, end2=30; Event ev2 = new Event(rbb.db(), start2, end2, new Tagset("name1=value1,name3=value3")); // retrieve events by taget Event[] found = Event.find(rbb.db(), RBBFilter.byTags("name1=value1")); for(Event e : found) System.err.println("Found event: " + e); //// Timeseries // Creating a Timeseries int dim = 2; // 2-dimensional (x,y) data Timeseries t = new Timeseries(rbb, dim, start, new Tagset("name4=value4")); t.add(rbb, 1.0, 2.0, 3.0); t.add(rbb, 2.0, 3.14, 2.718); t.setEnd(rbb.db(), 5.0); /// Finding Timeseries Timeseries[] a = Timeseries.findWithSamples(rbb.db(), RBBFilter.byTags("name4=value4")); for(Timeseries ts : a) System.err.println("Found timeseries: " + ts); rbb.disconnect(); } catch (java.sql.SQLException e) { System.err.println("error: " + e.getLocalizedMessage()); } } }///// todo: Show event-driven processing with RBB.addEventListener()