All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.protege.webprotege.frame.RelationshipTranslationOptions Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.frame;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;
import edu.stanford.protege.webprotege.criteria.AnyRelationshipPropertyCriteria;
import edu.stanford.protege.webprotege.criteria.AnyRelationshipValueCriteria;
import edu.stanford.protege.webprotege.criteria.RelationshipCriteria;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 2020-04-02
 */
@AutoValue
public abstract class RelationshipTranslationOptions {

    public enum RelationshipMinification {
        MINIMIZED_RELATIONSHIPS,
        NON_MINIMIZED_RELATIONSHIPS
    }

    @Nonnull
    public static RelationshipTranslationOptions get(@Nonnull RelationshipCriteria outgoingRelationshipCriteria,
                                                     @Nullable RelationshipCriteria incomingRelationshipCriteria,
                                                     @Nullable RelationshipMinification relationshipMinification) {
        return new AutoValue_RelationshipTranslationOptions(outgoingRelationshipCriteria,
                                                            incomingRelationshipCriteria,
                                                            relationshipMinification);
    }

    @Nonnull
    public static RelationshipCriteria allOutgoingRelationships() {
        return RelationshipCriteria.get(AnyRelationshipPropertyCriteria.get(),
                                        AnyRelationshipValueCriteria.get());
    }

    @Nullable
    public static RelationshipCriteria noIncomingRelationships() {
        return null;
    }

    @JsonProperty("outgoingRelationshipCriteria")
    @Nullable
    protected abstract RelationshipCriteria getOutgoingRelationshipCriteriaInternal();

    @JsonIgnore
    public Optional getOutgoingRelationshipCriteria() {
        return Optional.ofNullable(getOutgoingRelationshipCriteriaInternal());
    }

    @JsonProperty("incomingRelationshipCriteria")
    @Nullable
    protected abstract RelationshipCriteria getIncomingRelationshipCriteriaInternal();

    @JsonIgnore
    public Optional getIncomingRelationshipCriteria() {
        return Optional.ofNullable(getIncomingRelationshipCriteriaInternal());
    }


    @Nonnull
    public abstract RelationshipMinification getRelationshipMinification();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy