
io.mindmaps.graql.internal.query.match.MatchQueryBase Maven / Gradle / Ivy
/*
* MindmapsDB - A Distributed Semantic Database
* Copyright (C) 2016 Mindmaps Research Ltd
*
* MindmapsDB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MindmapsDB 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MindmapsDB. If not, see .
*/
package io.mindmaps.graql.internal.query.match;
import com.google.common.collect.Sets;
import io.mindmaps.MindmapsGraph;
import io.mindmaps.concept.Concept;
import io.mindmaps.concept.Type;
import io.mindmaps.graql.admin.Conjunction;
import io.mindmaps.graql.admin.PatternAdmin;
import io.mindmaps.graql.admin.VarAdmin;
import io.mindmaps.graql.internal.gremlin.Query;
import io.mindmaps.graql.internal.validation.MatchQueryValidator;
import io.mindmaps.util.ErrorMessage;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static io.mindmaps.util.Schema.ConceptPropertyUnique.ITEM_IDENTIFIER;
import static java.util.stream.Collectors.toSet;
/**
* Base MatchQuery implementation that executes the gremlin traversal
*/
public class MatchQueryBase implements MatchQueryInternal {
private final Conjunction pattern;
/**
* @param pattern a pattern to match in the graph
*/
public MatchQueryBase(Conjunction pattern) {
if (pattern.getPatterns().size() == 0) {
throw new IllegalArgumentException(ErrorMessage.MATCH_NO_PATTERNS.getMessage());
}
this.pattern = pattern;
}
@Override
public Stream
© 2015 - 2025 Weber Informatics LLC | Privacy Policy