<commit_before>/*
 *  Copyright (c) 2017 <NAME> and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   <NAME>
 */
package org.jnosql.artemis.graph;

import org.jnosql.artemis.IdNotFoundException;

import java.util.Optional;

/**
 * This interface that represents the common operation between an entity
 * and {@link org.apache.tinkerpop.gremlin.structure.Vertex}
 */
public interface GraphTemplate {

    /**
     * Inserts entity
     *
     * @param entity entity to be saved
     * @param <T>    the instance type
     * @return the entity saved
     * @throws NullPointerException when document is null
     * @throws IdNotFoundException  when entity has not {@link org.jnosql.artemis.Id}
     */
    <T> T insert(T entity) throws NullPointerException, IdNotFoundException;

    /**
     * Updates entity
     *
     * @param entity entity to be updated
     * @param <T>    the instance type
     * @return the entity saved
     * @throws NullPointerException when document is null
     * @throws IdNotFoundException  when an entity is null
     */
    <T> T update(T entity) throws NullPointerException, IdNotFoundException;


    /**
     * Deletes a graph given {@link org.apache.tinkerpop.gremlin.structure.T#label} and
     * {@link org.apache.tinkerpop.gremlin.structure.T#id}
     *
     * @param label the label to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#label}
     * @param id    the id to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#id}
     * @param <T>   the id type
     * @throws NullPointerException when either label and id are null
     */
    <T> void delete(String label, T id) throws NullPointerException;


    /**
     * Find an entity given {@link org.apache.tinkerpop.gremlin.structure.T#label} and
     * {@link org.apache.tinkerpop.gremlin.structure.T#id}
     *
     * @param label the label to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#label}
     * @param id    the id to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#id}
     * @param <T>   the entity type
     * @param <ID>  the id type
     * @return the entity found otherwise {@link Optional#empty()}
     * @throws NullPointerException when either label and id are null
     */
    <T, ID> Optional<T> find(String label, ID id) throws NullPointerException;

    /**
     * Either find or create an Edge between this two entities.
     * {@link org.apache.tinkerpop.gremlin.structure.Edge}
     * <pre>entityOUT ---label---> entityIN.</pre>
     *
     * @param entityIN  the ingoing
     * @param label     the Edge label
     * @param entityOUT the outgoing entity
     * @param <IN>      the ingoing type
     * @param <OUT>     the outgoing type
     * @return the {@link EdgeEntity} of these two entities
     * @throws NullPointerException Either when any elements are null or the entity is null
     * @throws IdNotFoundException  when {@link org.jnosql.artemis.Id} annotation is missing in the entities
     */
    <IN, OUT> EdgeEntity<IN, OUT> edge(IN entityIN, String label, OUT entityOUT) throws NullPointerException, IdNotFoundException;

}<commit_msg>Adds Edge resource<commit_after>/*
 *  Copyright (c) 2017 <NAME> and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   <NAME>
 */
package org.jnosql.artemis.graph;

import org.jnosql.artemis.IdNotFoundException;

import java.util.Optional;

/**
 * This interface that represents the common operation between an entity
 * and {@link org.apache.tinkerpop.gremlin.structure.Vertex}
 */
public interface GraphTemplate {

    /**
     * Inserts entity
     *
     * @param entity entity to be saved
     * @param <T>    the instance type
     * @return the entity saved
     * @throws NullPointerException when document is null
     * @throws IdNotFoundException  when entity has not {@link org.jnosql.artemis.Id}
     */
    <T> T insert(T entity) throws NullPointerException, IdNotFoundException;

    /**
     * Updates entity
     *
     * @param entity entity to be updated
     * @param <T>    the instance type
     * @return the entity saved
     * @throws NullPointerException when document is null
     * @throws IdNotFoundException  when an entity is null
     */
    <T> T update(T entity) throws NullPointerException, IdNotFoundException;


    /**
     * Deletes a graph given {@link org.apache.tinkerpop.gremlin.structure.T#label} and
     * {@link org.apache.tinkerpop.gremlin.structure.T#id}
     *
     * @param label the label to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#label}
     * @param id    the id to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#id}
     * @param <T>   the id type
     * @throws NullPointerException when either label and id are null
     */
    <T> void delete(String label, T id) throws NullPointerException;


    /**
     * Find an entity given {@link org.apache.tinkerpop.gremlin.structure.T#label} and
     * {@link org.apache.tinkerpop.gremlin.structure.T#id}
     *
     * @param label the label to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#label}
     * @param id    the id to be used in the query {@link org.apache.tinkerpop.gremlin.structure.T#id}
     * @param <T>   the entity type
     * @param <ID>  the id type
     * @return the entity found otherwise {@link Optional#empty()}
     * @throws NullPointerException when either label and id are null
     */
    <T, ID> Optional<T> find(String label, ID id) throws NullPointerException;

    /**
     * Either find or create an Edge between this two entities.
     * {@link org.apache.tinkerpop.gremlin.structure.Edge}
     * <pre>entityOUT ---label---> entityIN.</pre>
     *
     * @param inbound  the inbound entity
     * @param label    the Edge label
     * @param outbound the outbound entity
     * @param <IN>     the ingoing type
     * @param <OUT>    the outgoing type
     * @return the {@link EdgeEntity} of these two entities
     * @throws NullPointerException Either when any elements are null or the entity is null
     * @throws IdNotFoundException  when {@link org.jnosql.artemis.Id} annotation is missing in the entities
     */
    <IN, OUT> EdgeEntity<IN, OUT> edge(IN inbound, String label, OUT outbound) throws NullPointerException, IdNotFoundException;

}
{'fraction_non_alphanumeric': 0.09427980702963473, 'fraction_numerical': 0.003859407305306685, 'mean_word_length': 3.0110558319513543, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2017292', 'n_tokens_mistral': 2156, 'n_tokens_neox': 2071, 'n_words': 745}