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

ai.grakn.graql.admin.VarPatternAdmin Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
/*
 * GRAKN.AI - THE KNOWLEDGE GRAPH
 * Copyright (C) 2018 Grakn Labs Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package ai.grakn.graql.admin;

import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.VarPattern;

import javax.annotation.CheckReturnValue;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;

/**
 * Admin class for inspecting a {@link VarPattern}
 *
 * @author Felix Chapman
 */
public interface VarPatternAdmin extends PatternAdmin, VarPattern {
    @Override
    default boolean isVarPattern() {
        return true;
    }

    @Override
    default VarPatternAdmin asVarPattern() {
        return this;
    }

    /**
     * @return the variable name of this variable
     */
    @CheckReturnValue
    Var var();

    /**
     * Get a stream of all properties on this variable
     */
    @CheckReturnValue
    Stream getProperties();

    /**
     * Get a stream of all properties of a particular type on this variable
     * @param type the class of {@link VarProperty} to return
     * @param  the type of {@link VarProperty} to return
     */
    @CheckReturnValue
     Stream getProperties(Class type);

    /**
     * Get a unique property of a particular type on this variable, if it exists
     * @param type the class of {@link VarProperty} to return
     * @param  the type of {@link VarProperty} to return
     */
    @CheckReturnValue
     Optional getProperty(Class type);

    /**
     * Get whether this {@link VarPattern} has a {@link VarProperty} of the given type
     * @param type the type of the {@link VarProperty}
     * @param  the type of the {@link VarProperty}
     * @return whether this {@link VarPattern} has a {@link VarProperty} of the given type
     */
    @CheckReturnValue
     boolean hasProperty(Class type);

    /**
     * @return the name this variable represents, if it represents something with a specific name
     */
    @CheckReturnValue
    Optional




© 2015 - 2024 Weber Informatics LLC | Privacy Policy