package org.pdxfinder.graph.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by csaba on 07/06/2017.
 */
@NodeEntity
public class OntologyTerm {

    @GraphId
    private Long id;

    private String url;
    private String label;
    private int directMappedSamplesNumber;
    private int indirectMappedSamplesNumber;
    private Set<String> synonyms;
    private String type;

    @Relationship(type = "SUBCLASS_OF" ,direction = Relationship.OUTGOING)
    private Set<OntologyTerm> subclassOf;

    @Relationship(type = "MAPPED_TO", direction = Relationship.INCOMING)
    private SampleToOntologyRelationship sampleMappedTo;

    @Relationship(type = "MAPPED_TO", direction = Relationship.INCOMING)
    private TreatmentToOntologyRelationship treatmentMappedTo;


    public OntologyTerm() {
    }

    public OntologyTerm(String url, String label) {
        this.url = url;
        this.label = label;
        this.directMappedSamplesNumber = 0;
        this.indirectMappedSamplesNumber = 0;
        this.synonyms = new HashSet<>();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public Set<OntologyTerm> getSubclassOf() {
        return subclassOf;
    }

    public void setSubclassOf(Set<OntologyTerm> subclassOf) {
        this.subclassOf = subclassOf;
    }

    public SampleToOntologyRelationship getSampleMappedTo() {
        return sampleMappedTo;
    }

    public void setSampleMappedTo(SampleToOntologyRelationship sampleMappedTo) {
        this.sampleMappedTo = sampleMappedTo;
    }

    public void addSubclass(OntologyTerm ot){
        if(this.subclassOf == null){
            this.subclassOf = new HashSet<OntologyTerm>();
        }
        this.subclassOf.add(ot);
    }

    public int getDirectMappedSamplesNumber() {
        return directMappedSamplesNumber;
    }

    public void setDirectMappedSamplesNumber(int directMappedSamplesNumber) {

        this.directMappedSamplesNumber = directMappedSamplesNumber;
    }

    public int getIndirectMappedSamplesNumber() {
        return indirectMappedSamplesNumber;
    }

    public void setIndirectMappedSamplesNumber(int indirectMappedSamplesNumber) {
        this.indirectMappedSamplesNumber = indirectMappedSamplesNumber;
    }

    public Set<String> getSynonyms() {
        return synonyms;
    }

    public void setSynonyms(Set<String> synonyms) {
        this.synonyms = synonyms;
    }

    public TreatmentToOntologyRelationship getTreatmentMappedTo() {
        return treatmentMappedTo;
    }

    public void setTreatmentMappedTo(TreatmentToOntologyRelationship treatmentMappedTo) {
        this.treatmentMappedTo = treatmentMappedTo;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

@@ -523,16 +523,48 @@
 ng type;
+%0A    private String description;
 %0A%0A    @R
@@ -3272,11 +3272,183 @@
 e;%0A    %7D
+%0A%0A    public String getDescription() %7B%0A        return description;%0A    %7D%0A%0A    public void setDescription(String description) %7B%0A        this.description = description;%0A    %7D
 %0A%7D%0A

Add description