<commit_before># odbogm
# OrientDB Object to Graph Mapper 

The idea is to make a clear Java Object to Graph Vertex to the ***OrientDB***. I really miss the DB4O database. I have not see nothing similar to that, but DB4O is dead so I want to have the same functionality over another database. I have choose OrientDB as a target so I want to make a mapper it be as noninvasive as possible to the developer.

This is my first approach and is in ***experimental version***. Use it as your own risk.
The ODBOGM work against the Graph DB API of the OrientDB. It let you to access the underlying DB if you want but it's implement the basic function to work with the database in an absolutely clear way like DB4O.

To start using it you must initialize a ***SessionManager*** and set the URL to connect to the DB:
```Java
SessionManager sm = new SessionManager("remote:localhost/Test", "root", "toor");
```
After that, the SessionManager implements the method to:

* ***begin***: init the communication and start the first trasaction.
* ***store***: add a new record to the database.
* ***get***: retrieve a record from the database.
* ***delete***: delete the record from the database. 
* ***commit***: process the current transaction.
* ***rollback***: rollback the current transaction. TBD
* ***query***: query the database.
* ***shutdown***: shutdown the DB communication.

So, for example, let say that we have this class definition:

```Java
public class Ex1 {
    private final static Logger LOGGER = Logger.getLogger(Ex1.class .getName());
    private int i = 0;
    public int x = 10;
    public Ex1() {
    }
    
    public int inc(){
        return ++i;
    }
    
    public int test() {
        return x + i;
    }
}
```

to store an instance you do:

```Java
Ex1 ex1 = new Ex1();
sm.store(ex1);
sm.commit();
```

Every primitive field type and String are stored directly to the DB including private field.
Every Object is mapped to a Vertex and an Edge is created with a label <Class>_<field>. The field will not be
created as a part of the class.
The ***final static*** fields are ignored so take care about this.

Example:
```Java
public class Ex2 extends Ex1 {
    private final static Logger LOGGER = Logger.getLogger(Ex2.class .getName());
    
    private Ex1 inner;
    private String ex2String;
    <commit_msg>Actualizo el README con la descripción de los embedded.<commit_after># odbogm
# OrientDB Object to Graph Mapper 

The idea is to make a clear Java Object to Graph Vertex to the ***OrientDB***. I really miss the DB4O database. I have not see nothing similar to that, but DB4O is dead so I want to have the same functionality over another database. I have choose OrientDB as a target so I want to make a mapper it be as noninvasive as possible to the developer.

This is my first approach and is in ***experimental version***. Use it as your own risk.
The ODBOGM work against the Graph DB API of the OrientDB. It let you to access the underlying DB if you want but it's implement the basic function to work with the database in an absolutely clear way like DB4O.

To start using it you must initialize a ***SessionManager*** and set the URL to connect to the DB:
```Java
SessionManager sm = new SessionManager("remote:localhost/Test", "root", "toor");
```
After that, the SessionManager implements the method to:

* ***begin***: init the communication and start the first trasaction.
* ***store***: add a new record to the database.
* ***get***: retrieve a record from the database.
* ***delete***: delete the record from the database. 
* ***commit***: process the current transaction.
* ***rollback***: rollback the current transaction. TBD
* ***query***: query the database.
* ***shutdown***: shutdown the DB communication.

So, for example, let say that we have this class definition:

```Java
public class Ex1 {
    private final static Logger LOGGER = Logger.getLogger(Ex1.class .getName());
    private int i = 0;
    public int x = 10;
    public Ex1() {
    }
    
    public int inc(){
        return ++i;
    }
    
    public int test() {
        return x + i;
    }
}
```

to store an instance you do:

```Java
Ex1 ex1 = new Ex1();
sm.store(ex1);
sm.commit();
```

Every primitive field type and String are stored directly to the DB including private field in a Vertex.
If the object has List or Maps of primitive type, they are mapped as a embedded list/maps.
Every Object is mapped to a Vertex and an Edge is created with a label <Class>_<field>. The field will not be
created as a part of the class.
The ***final static*** fields are ignored so take care about this.

Example:
```Java
public class Ex2 extends Ex1 {
    private final static Logger LOGGER = Logger.getLogger(Ex2.class .getName());
    
    private Ex1 inner;
    private String ex2String;
    
{'fraction_non_alphanumeric': 0.0916857678683059, 'fraction_numerical': 0.007501562825588664, 'mean_word_length': 3.696673189823875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2664261', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1298, 'n_words': 716}