TimEL MapDB backend

MapDB backend for TimEL variables

License

License

Categories

Categories

Net MapDB Data Databases
GroupId

GroupId

net.vleo.timel
ArtifactId

ArtifactId

timel-mapdb
Last Version

Last Version

0.9.3
Release Date

Release Date

Type

Type

jar
Description

Description

TimEL MapDB backend
MapDB backend for TimEL variables
Project URL

Project URL

http://timel.vleo.net
Source Code Management

Source Code Management

https://github.com/aleofreddi/timel

Download timel-mapdb

How to add to project

<!-- https://jarcasting.com/artifacts/net.vleo.timel/timel-mapdb/ -->
<dependency>
    <groupId>net.vleo.timel</groupId>
    <artifactId>timel-mapdb</artifactId>
    <version>0.9.3</version>
</dependency>
// https://jarcasting.com/artifacts/net.vleo.timel/timel-mapdb/
implementation 'net.vleo.timel:timel-mapdb:0.9.3'
// https://jarcasting.com/artifacts/net.vleo.timel/timel-mapdb/
implementation ("net.vleo.timel:timel-mapdb:0.9.3")
'net.vleo.timel:timel-mapdb:jar:0.9.3'
<dependency org="net.vleo.timel" name="timel-mapdb" rev="0.9.3">
  <artifact name="timel-mapdb" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.vleo.timel', module='timel-mapdb', version='0.9.3')
)
libraryDependencies += "net.vleo.timel" % "timel-mapdb" % "0.9.3"
[net.vleo.timel/timel-mapdb "0.9.3"]

Dependencies

compile (2)

Group / Artifact Type Version
net.vleo.timel : timel-core jar 0.9.3
org.mapdb : mapdb jar 2.0-beta13

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.6

test (8)

Group / Artifact Type Version
org.apache.commons : commons-csv jar 1.1
net.vleo.timel : timel-core test-jar 0.9.3
org.junit.jupiter : junit-jupiter-api jar 5.4.2
org.junit.jupiter : junit-jupiter-engine jar 5.4.2
org.junit.jupiter : junit-jupiter-params jar 5.4.2
org.hamcrest : hamcrest-library jar 2.1
org.mockito : mockito-core jar 2.27.0
org.mockito : mockito-junit-jupiter jar 2.27.0

Project Modules

There are no modules declared in this project.

TimEL: Time-series Expression Language

License: LGPL v3 Build Status Test Coverage Javadocs

TL;DR

Pick a random example in the 📺 online console and try it yourself!

Why?

Monitoring, metering, IoT, pay-per-use billing: these are only few examples of applications that rely on time-series data! Often you want the final user to be able to manipulate and customize some results based on some time-series data - that's when TimEL comes in handy!

What?

TimEL is a Java library to compile and evaluate TimEL expressions. TimEL expressions are written in a user-friendly language that allows time-series manipulation without the need of taking care about upscaling, downscaling or mixing up different time series intervals.

Let's see an expression to count the number of days:

scale(                                      // (3) and then downsample for the whole interval
    scale(
        uniform(1.0),                       // (1) let's take an integral value 1.0
        every(1, "DAY_OF_YEAR", "UTC")      // (2) repeat it every day
    )
)

If we evaluate this expression for an interval in the same day, let's say 06:00-18:00, it'll report 0.5 - that is half day. If we evaluate it for more days it will count how many days are contained in the interval. The function uniform here returns an integral, so TimEL knows how to interpolate it properly - that is handled by the interpreter so the user does not need to worry no more about time frames.

Features

With TimEL you can:

  • Mix multiple time frames - for example you can sum daily data with hourly data, or even non-regular data like monthly data;
  • Express easily recurrent quantities, like 10 units every hour;
  • Scale natively integral values (like consumptions) and averages;
  • Stream results without the need of having all the operands in memory;
  • Support integer, floating point and double expressions;
  • Extend with your own types and functions;
  • Evaluate expression securely - by default there is no way to access external JVM objects or methods that would expose you to a security risk.

TimEL requires Java 8 and will run in any J2SE or J2EE container. For complete project information, see TimEL's website.

Quickstart

To use TimEL you need to import the following dependency:

Maven

<dependency>
    <groupId>net.vleo.timel</groupId>
    <artifactId>timel-core</artifactId>
    <version>0.9.3</version>
</dependency>

Gradle

implementation 'net.vleo.timel:timel-core:0.9.3'

Now you're ready to go! Let's count how many days passed since (unix) epoch:

// Compile the expression
Expression<?> expression = TimEL
        .parse("scale(scale(uniform(1.0), every(1, \"DAY_OF_YEAR\", \"UTC\")))")
        .compile();

// Evaluate and print the number of days from epoch
Interval interval = Interval.of(Instant.ofEpochMilli(0), Instant.now());
System.out.println(TimEL.evaluate(expression, interval).next());

For a more detailed guide refer to the quickstart guide on TimEL's website.

Language

On TimEL's website you can find a list of available types and functions.

Extending the language

You can extend TimEL language by adding new types, conversions as well as functions. Refer to the extension page on the homepage.

Versions

Version
0.9.3
0.9.2
0.9.1
0.9.0
0.2.0-rc12