Giter VIP home page Giter VIP logo

csvquery's Introduction

CsvQuery

CsvQuery is a Java library to query CSV and TSV files in an easy and fast manner. CsvQuery allows reading, filtering, ordering and limiting the resulting rows of delimiter separated files such as CSV and TSV. Using its API, client applications can define:

  1. the fields as in the file.
  2. the data attributes (projection) as needed by the client application. The attributes can map directly to the field or be any arbitrary transformation expression to convert one (or more of the fields).
  3. the filtering criteria to eliminate non matching records. The filtering criteria work on the attributes not on the fields
  4. the ordering of the result set by registering the attributes and the soring direction
  5. the paging of the final resultset by setting skip and take values

The library uses the provided query constrcution information to create a customized data reader class and a minimalistic data object class. The reader is used to perform file operations, object materialization, filtering, ordering and limiting the result set. The data object is used as a row container so that each row of the result set is represented by one data object. Both the classes are created and compiled on the fly, so the client application needs the JDK in addition to the JRE. The library has been developed based on the lambda expressions introduced in Java 8 and will not work on any previous version. There is a dependency upon Rythm Template Engine

An example is provided here

Features I am working on:

  1. Adding aggregation functions to the query construction API
  2. Adding a predefined set of functions to attribute transformation expressions.
  3. Removing/ Minimizing the dependency (ies)
  4. Adding metadata to the returned result to make its usage a little bit simpler. for example column names and their data types.

Note 1) This library is a part of a bigger work XQt I am doing towards my PhD, so it may not be following the best practices of programming. Also not designed for UI data binding and so on. For example:

  1. The data reader simply jumps over any record that does not have enough information, does not convert properly as mentioned in the attribute mapping and so on.
  2. The data objects are not Plain Old Java Objects they are Naked Old (or maybe new) Java Objects, as they are using public fields and have not traditional getter/ setter methods. This is for performance reasons but may cause some automatic binding issues!

Note 2) Just as a matter of emphasize: THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. Read the detailed information in the license file.

csvquery's People

Contributors

javadch avatar

Watchers

James Cloos avatar  avatar

csvquery's Issues

integrate a line parser into the reader

a line parser which is able to split a single row to an array of strings considering delimiters, quotes, escape, trimming, and so on should be integrated into the reader.
In addition it should also merge an array of strings into a single string line.
it should be plug-able via the reader, so that if someone needs another way of parsing a line, can develop and plug it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.