<commit_before># jfake
JFake is a simple system to generate fake data to databases by writing set specifications.

It has 2 usage modes, either it runs as a command line tool or as a library for a web application.
When run as an web application library it will automatically generate the data only if there exists
a config file (WEB-INF/auto.jfake)  and ALL tables pointed to by the config file are empty (this is so that production data should not be overwritten!).

A binary package is available at [JFake JAR download](http://www.jlim.se/download/jfake.jar)

The main idea is to write a specification on HOW the data should be generated rather than specific data.
For example one can write ```[5000,5001,5002,5003]``` to generate a list of numbers but if one wants a range it
could also be described as the range ```5000:5003``` .

A full sample file follows:
```
# Simple product/receipt jfake file

# What datasource do we use to talk to the database
@datasource="java:app/jdbc/ejb1"

# We want to start generating ID's at this ID (to avoid initial conflicts with JPA)
@startid=5000

# Generate product table
product {
  # Generate automatic ID
  id = @autoid
  <commit_msg>Updated README.md with more instructions<commit_after># jfake
JFake is a simple system to generate fake data to databases by writing set specifications liberally licenced under the MIT licence.

It has 2 usage modes, either it runs as a command line tool or as a library for a web application.
When run as an web application library it will automatically generate the data only if there exists
a config file (WEB-INF/auto.jfake)  and ALL tables pointed to by the config file are empty (this is so that production data should not be overwritten!).

A binary package is available at [JFake JAR download](http://www.jlim.se/download/jfake.jar)

The main idea is to write a specification on HOW the data should be generated rather than specific data.
For example one can write ```[5000,5001,5002,5003]``` to generate a list of numbers but if one wants a range it
could also be described as the range ```5000:5003``` .

A full sample is at the end of this README.md (also samples can be found under the samples directory)

The Jfake syntax is built up as the following.

Comments are single line and everything after a ```#``` is a comment.
Sample: ```# This is a comment```

Numbers and strings are the basic data types, numbers are alphanumeric integers and strings are enclosed with paired ' or " characters.
Sample: ```123```   ``` "Hello world" ``` 



A full sample file follows:
```
# Simple product/receipt jfake file

# What datasource do we use to talk to the database
@datasource="java:app/jdbc/ejb1"

# We want to start generating ID's at this ID (to avoid initial conflicts with JPA)
@startid=5000

# Generate product table
product {
  # Generate automatic ID
  id = @autoid
  
{'fraction_non_alphanumeric': 0.06494413407821228, 'fraction_numerical': 0.021997206703910616, 'mean_word_length': 4.295748613678374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6897981', 'n_tokens_mistral': 829, 'n_tokens_neox': 760, 'n_words': 438}