index
int64 | repo_id
string | file_path
string | content
string |
|---|---|---|---|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/MedianVertexProgram.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.LabelId;
import ai.grakn.util.Schema;
import com.google.common.collect.Sets;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.MemoryComputeKey;
import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
import org.apache.tinkerpop.gremlin.process.computer.Messenger;
import org.apache.tinkerpop.gremlin.process.computer.VertexComputeKey;
import org.apache.tinkerpop.gremlin.process.traversal.Operator;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static ai.grakn.graql.internal.analytics.DegreeStatisticsVertexProgram.degreeStatisticsStepResourceOwner;
import static ai.grakn.graql.internal.analytics.DegreeStatisticsVertexProgram.degreeStatisticsStepResourceRelation;
import static ai.grakn.graql.internal.analytics.DegreeVertexProgram.DEGREE;
import static ai.grakn.graql.internal.analytics.Utility.vertexHasSelectedTypeId;
/**
* The vertex program for computing the median of given resource using quick select algorithm.
* <p>
*
* @author Jason Liu
* @author Sheldon Hall
*/
public class MedianVertexProgram extends GraknVertexProgram<Long> {
private static final int MAX_ITERATION = 40;
public static final String MEDIAN = "medianVertexProgram.median";
private static final String RESOURCE_DATA_TYPE = "medianVertexProgram.resourceDataType";
private static final String RESOURCE_TYPE = "medianVertexProgram.statisticsResourceType";
private static final String LABEL = "medianVertexProgram.label";
private static final String COUNT = "medianVertexProgram.count";
private static final String INDEX_START = "medianVertexProgram.indexStart";
private static final String INDEX_END = "medianVertexProgram.indexEnd";
private static final String INDEX_MEDIAN = "medianVertexProgram.indexMedian";
private static final String PIVOT = "medianVertexProgram.pivot";
private static final String PIVOT_POSITIVE = "medianVertexProgram.pivotPositive";
private static final String PIVOT_NEGATIVE = "medianVertexProgram.pivotNegative";
private static final String POSITIVE_COUNT = "medianVertexProgram.positiveCount";
private static final String NEGATIVE_COUNT = "medianVertexProgram.negativeCount";
private static final String FOUND = "medianVertexProgram.found";
private static final String LABEL_SELECTED = "medianVertexProgram.labelSelected";
private static final Set<MemoryComputeKey> MEMORY_COMPUTE_KEYS = Sets.newHashSet(
MemoryComputeKey.of(MEDIAN, Operator.assign, false, false),
MemoryComputeKey.of(LABEL_SELECTED, Operator.assign, true, true),
MemoryComputeKey.of(FOUND, Operator.assign, false, true),
MemoryComputeKey.of(INDEX_START, Operator.assign, false, true),
MemoryComputeKey.of(INDEX_END, Operator.assign, false, true),
MemoryComputeKey.of(INDEX_MEDIAN, Operator.assign, false, true),
MemoryComputeKey.of(COUNT, Operator.sumLong, false, true),
MemoryComputeKey.of(POSITIVE_COUNT, Operator.sumLong, false, true),
MemoryComputeKey.of(NEGATIVE_COUNT, Operator.sumLong, false, true),
MemoryComputeKey.of(PIVOT, Operator.assign, true, true),
MemoryComputeKey.of(PIVOT_POSITIVE, Operator.assign, true, true),
MemoryComputeKey.of(PIVOT_NEGATIVE, Operator.assign, true, true));
private Set<LabelId> statisticsResourceLabelIds = new HashSet<>();
@SuppressWarnings("unused")// Needed internally for OLAP tasks
public MedianVertexProgram() {
}
public MedianVertexProgram(Set<LabelId> statisticsResourceLabelIds,
AttributeType.DataType resourceDataType) {
this.statisticsResourceLabelIds = statisticsResourceLabelIds;
String resourceDataTypeValue = resourceDataType.equals(AttributeType.DataType.LONG) ?
Schema.VertexProperty.VALUE_LONG.name() : Schema.VertexProperty.VALUE_DOUBLE.name();
persistentProperties.put(RESOURCE_DATA_TYPE, resourceDataTypeValue);
}
@Override
public Set<VertexComputeKey> getVertexComputeKeys() {
return Sets.newHashSet(
VertexComputeKey.of(DEGREE, true),
VertexComputeKey.of(LABEL, true));
}
@Override
public Set<MemoryComputeKey> getMemoryComputeKeys() {
return MEMORY_COMPUTE_KEYS;
}
@Override
public Set<MessageScope> getMessageScopes(final Memory memory) {
switch (memory.getIteration()) {
case 0:
return Sets.newHashSet(messageScopeShortcutIn, messageScopeResourceOut);
case 1:
return Collections.singleton(messageScopeShortcutOut);
default:
return Collections.emptySet();
}
}
@Override
public void storeState(final Configuration configuration) {
super.storeState(configuration);
statisticsResourceLabelIds.forEach(
typeId -> configuration.addProperty(RESOURCE_TYPE + "." + typeId, typeId));
}
@Override
public void loadState(final Graph graph, final Configuration configuration) {
super.loadState(graph, configuration);
configuration.subset(RESOURCE_TYPE).getKeys().forEachRemaining(key ->
statisticsResourceLabelIds.add((LabelId) configuration.getProperty(RESOURCE_TYPE + "." + key)));
}
@Override
public void setup(final Memory memory) {
LOGGER.debug("MedianVertexProgram Started !!!!!!!!");
memory.set(COUNT, 0L);
memory.set(LABEL_SELECTED, memory.getIteration());
memory.set(NEGATIVE_COUNT, 0L);
memory.set(POSITIVE_COUNT, 0L);
memory.set(FOUND, false);
if (persistentProperties.get(RESOURCE_DATA_TYPE).equals(Schema.VertexProperty.VALUE_LONG.name())) {
memory.set(MEDIAN, 0L);
memory.set(PIVOT, 0L);
memory.set(PIVOT_NEGATIVE, 0L);
memory.set(PIVOT_POSITIVE, 0L);
} else {
memory.set(MEDIAN, 0D);
memory.set(PIVOT, 0D);
memory.set(PIVOT_NEGATIVE, 0D);
memory.set(PIVOT_POSITIVE, 0D);
}
}
@Override
public void safeExecute(final Vertex vertex, Messenger<Long> messenger, final Memory memory) {
switch (memory.getIteration()) {
case 0:
degreeStatisticsStepResourceOwner(vertex, messenger, statisticsResourceLabelIds);
break;
case 1:
degreeStatisticsStepResourceRelation(vertex, messenger, statisticsResourceLabelIds);
break;
case 2:
if (vertexHasSelectedTypeId(vertex, statisticsResourceLabelIds)) {
// put degree
long degree = vertex.property(DEGREE).isPresent() ?
getMessageCount(messenger) + (Long) vertex.value(DEGREE) : getMessageCount(messenger);
vertex.property(DEGREE, degree);
// select pivot randomly
if (degree > 0) {
memory.add(PIVOT,
vertex.value((String) persistentProperties.get(RESOURCE_DATA_TYPE)));
memory.add(COUNT, degree);
}
}
break;
case 3:
if (vertexHasSelectedTypeId(vertex, statisticsResourceLabelIds) &&
(long) vertex.value(DEGREE) > 0) {
Number value = vertex.value((String) persistentProperties.get(RESOURCE_DATA_TYPE));
if (value.doubleValue() < memory.<Number>get(PIVOT).doubleValue()) {
updateMemoryNegative(vertex, memory, value);
} else if (value.doubleValue() > memory.<Number>get(PIVOT).doubleValue()) {
updateMemoryPositive(vertex, memory, value);
} else {
// also assign a label to pivot, so all the selected resources have label
vertex.property(LABEL, 0);
}
}
break;
// default case is almost the same as case 5, except that in case 5 no vertex has label
default:
if (vertexHasSelectedTypeId(vertex, statisticsResourceLabelIds) &&
(long) vertex.value(DEGREE) > 0 &&
(int) vertex.value(LABEL) == memory.<Integer>get(LABEL_SELECTED)) {
Number value = vertex.value((String) persistentProperties.get(RESOURCE_DATA_TYPE));
if (value.doubleValue() < memory.<Number>get(PIVOT).doubleValue()) {
updateMemoryNegative(vertex, memory, value);
} else if (value.doubleValue() > memory.<Number>get(PIVOT).doubleValue()) {
updateMemoryPositive(vertex, memory, value);
}
}
break;
}
}
private void updateMemoryPositive(Vertex vertex, Memory memory, Number value) {
vertex.property(LABEL, memory.getIteration());
memory.add(POSITIVE_COUNT, vertex.value(DEGREE));
memory.add(PIVOT_POSITIVE, value);
}
private void updateMemoryNegative(Vertex vertex, Memory memory, Number value) {
vertex.property(LABEL, -memory.getIteration());
memory.add(NEGATIVE_COUNT, vertex.value(DEGREE));
memory.add(PIVOT_NEGATIVE, value);
}
@Override
public boolean terminate(final Memory memory) {
LOGGER.debug("Finished Iteration " + memory.getIteration());
if (memory.getIteration() == 2) {
memory.set(INDEX_START, 0L);
memory.set(INDEX_END, memory.<Long>get(COUNT) - 1L);
memory.set(INDEX_MEDIAN, (memory.<Long>get(COUNT) - 1L) / 2L);
LOGGER.debug("count: " + memory.<Long>get(COUNT));
LOGGER.debug("first pivot: " + memory.<Long>get(PIVOT));
} else if (memory.getIteration() > 2) {
long indexNegativeEnd = memory.<Long>get(INDEX_START) + memory.<Long>get(NEGATIVE_COUNT) - 1;
long indexPositiveStart = memory.<Long>get(INDEX_END) - memory.<Long>get(POSITIVE_COUNT) + 1;
LOGGER.debug("pivot: " + memory.get(PIVOT));
LOGGER.debug(memory.<Long>get(INDEX_START) + ", " + indexNegativeEnd);
LOGGER.debug(indexPositiveStart + ", " + memory.<Long>get(INDEX_END));
LOGGER.debug("negative count: " + memory.<Long>get(NEGATIVE_COUNT));
LOGGER.debug("positive count: " + memory.<Long>get(POSITIVE_COUNT));
LOGGER.debug("negative pivot: " + memory.get(PIVOT_NEGATIVE));
LOGGER.debug("positive pivot: " + memory.get(PIVOT_POSITIVE));
if (indexNegativeEnd < memory.<Long>get(INDEX_MEDIAN)) {
if (indexPositiveStart > memory.<Long>get(INDEX_MEDIAN)) {
memory.set(FOUND, true);
LOGGER.debug("FOUND IT!!!");
} else {
memory.set(INDEX_START, indexPositiveStart);
memory.set(PIVOT, memory.get(PIVOT_POSITIVE));
memory.set(LABEL_SELECTED, memory.getIteration());
LOGGER.debug("new pivot: " + memory.get(PIVOT));
}
} else {
memory.set(INDEX_END, indexNegativeEnd);
memory.set(PIVOT, memory.get(PIVOT_NEGATIVE));
memory.set(LABEL_SELECTED, -memory.getIteration());
LOGGER.debug("new pivot: " + memory.get(PIVOT));
}
memory.set(MEDIAN, memory.get(PIVOT));
memory.set(POSITIVE_COUNT, 0L);
memory.set(NEGATIVE_COUNT, 0L);
}
return memory.<Boolean>get(FOUND) || memory.getIteration() >= MAX_ITERATION;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/MinMapReduce.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.LabelId;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Set;
/**
* The MapReduce program for computing the min value of the given resource.
* <p>
*
* @author Jason Liu
* @author Sheldon Hall
*/
public class MinMapReduce extends StatisticsMapReduce<Number> {
// Needed internally for OLAP tasks
public MinMapReduce() {
}
public MinMapReduce(Set<LabelId> selectedLabelIds, AttributeType.DataType resourceDataType, String degreePropertyKey) {
super(selectedLabelIds, resourceDataType, degreePropertyKey);
}
@Override
public void safeMap(final Vertex vertex, final MapEmitter<Serializable, Number> emitter) {
Number value = resourceIsValid(vertex) ? resourceValue(vertex) : maxValue();
emitter.emit(NullObject.instance(), value);
}
@Override
Number reduceValues(Iterator<Number> values) {
if (usingLong()) {
return IteratorUtils.reduce(values, Long.MAX_VALUE, (a, b) -> Math.min(a.longValue(), b.longValue()));
} else {
return IteratorUtils.reduce(values, Double.MAX_VALUE, (a, b) -> Math.min(a.doubleValue(), b.doubleValue()));
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/NoResultException.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
/**
* Signals that no result is generated by vertex program, so map reduce can be skipped.
* <p>
*
* @author Jason Liu
*/
public class NoResultException extends RuntimeException {
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/ShortestPathVertexProgram.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.ConceptId;
import ai.grakn.util.Schema;
import com.google.common.collect.Iterators;
import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.MemoryComputeKey;
import org.apache.tinkerpop.gremlin.process.computer.MessageScope;
import org.apache.tinkerpop.gremlin.process.computer.Messenger;
import org.apache.tinkerpop.gremlin.process.computer.VertexComputeKey;
import org.apache.tinkerpop.gremlin.process.traversal.Operator;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/**
* The vertex program for computing the shortest path between two instances.
*
@author Ganeshwara Herawan Hananda
@author Jason Liu
@author Sheldon Hall
*/
public class ShortestPathVertexProgram extends GraknVertexProgram<ShortestPathVertexProgram.VertexMessage> {
private static final Logger LOG = LoggerFactory.getLogger(ShortestPathVertexProgram.class);
// persistent properties
private final String sourceId = "source-id";
private final String destinationId = "destination-id";
// vertex property names
private final String srcMsgFromPrevIterations = "message-from-source";
private final String destMsgFromPrevIterations = "message-from-destination";
private final String shortestPathRecordedAndBroadcasted = "shortest-path-found-and-relayed";
private final String pathFoundButIsNotTheShortest = "not-the-shortest";
// memory key names
public static final String SHORTEST_PATH = "result";
private final String atLeastOneVertexActive = "at-least-one-vertex-active";
private final String shortestPathLength = "length";
private final String allShortestPathsFound_TerminateAtTheEndOfThisIteration = "terminate";
private final MessageScope inEdge = MessageScope.Local.of(__::inE);
private final MessageScope outEdge = MessageScope.Local.of(__::outE);
private final long SHORTEST_PATH_LENGTH_NOT_YET_SET = -1L;
// needed for OLAP
public ShortestPathVertexProgram() {
}
public ShortestPathVertexProgram(ConceptId source, ConceptId destination) {
persistentProperties.put(sourceId, source.getValue());
persistentProperties.put(destinationId, destination.getValue());
}
@Override
public Set<MessageScope> getMessageScopes(final Memory memory) {
return new HashSet<>(Arrays.asList(inEdge, outEdge));
}
@Override
public Set<VertexComputeKey> getVertexComputeKeys() {
return new HashSet<>(Arrays.asList(
VertexComputeKey.of(shortestPathRecordedAndBroadcasted, true),
VertexComputeKey.of(pathFoundButIsNotTheShortest, true),
VertexComputeKey.of(srcMsgFromPrevIterations, true),
VertexComputeKey.of(destMsgFromPrevIterations, true)
));
}
@Override
public Set<MemoryComputeKey> getMemoryComputeKeys() {
return new HashSet<>(Arrays.asList(
MemoryComputeKey.of(atLeastOneVertexActive, Operator.or, false, true),
MemoryComputeKey.of(shortestPathLength, Operator.assign, true, true),
MemoryComputeKey.of(allShortestPathsFound_TerminateAtTheEndOfThisIteration, Operator.assign, false, true),
MemoryComputeKey.of(SHORTEST_PATH, Operator.addAll, false, false)
));
}
@Override
public void setup(final Memory memory) {
memory.set(atLeastOneVertexActive, false);
memory.set(shortestPathLength, SHORTEST_PATH_LENGTH_NOT_YET_SET);
memory.set(allShortestPathsFound_TerminateAtTheEndOfThisIteration, false);
memory.set(SHORTEST_PATH, new HashMap<String, Set<String>>());
}
@Override
public void safeExecute(Vertex vertex, Messenger<VertexMessage> messenger, final Memory memory) {
String vertexId = this.<String>get(vertex, Schema.VertexProperty.ID.name()).get();
if (source(vertex)) {
if (memory.isInitialIteration()) {
broadcastInitialSourceMessage(messenger, memory, vertexId);
memory.add(atLeastOneVertexActive, true);
}
else {
List<VertexMessage> messages = messages(messenger);
List<MessageFromSource> incomingSourceMsg = messageFromSource(messages);
List<MessageFromDestination> incomingDestMsg = messageFromDestination(messages);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received the following messages: " + incomingSourceMsg + ", " + incomingDestMsg);
if (!incomingSourceMsg.isEmpty() || !incomingDestMsg.isEmpty()) {
if (!incomingDestMsg.isEmpty()) {
long pathLength = incomingDestMsg.get(0).pathLength();
if (memory.<Long>get(shortestPathLength) == SHORTEST_PATH_LENGTH_NOT_YET_SET || pathLength == memory.<Long>get(shortestPathLength)) {
recordShortestPath_AndMarkBroadcasted(vertex, memory, vertexId, incomingDestMsg, pathLength);
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received " + incomingDestMsg + " of length " +
pathLength + ". This isn't the shortest path, which is of length " + memory.<Long>get(shortestPathLength) + ". Do nothing.");
}
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": no message from destination yet. Do nothing");
}
}
}
}
else if (destination(vertex)) {
if (memory.isInitialIteration()) {
broadcastInitialDestinationMessage(messenger, memory, vertexId);
memory.add(atLeastOneVertexActive, true);
}
else {
List<VertexMessage> messages = messages(messenger);
List<MessageFromSource> incomingSourceMsg = messageFromSource(messages);
List<MessageFromDestination> incomingDestMsg = messageFromDestination(messages);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received the following messages: " + incomingSourceMsg + ", " + incomingDestMsg);
if (!incomingSourceMsg.isEmpty() || !incomingDestMsg.isEmpty()) {
if (!incomingSourceMsg.isEmpty()) {
long pathLength = incomingSourceMsg.get(0).pathLength();
if (memory.<Long>get(shortestPathLength) == SHORTEST_PATH_LENGTH_NOT_YET_SET || pathLength == memory.<Long>get(shortestPathLength)) {
markBroadcasted_TerminateAtTheEndOfThisIeration(vertex, memory, vertexId, incomingSourceMsg, pathLength);
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received " + incomingSourceMsg + " of length " +
pathLength + ". This isn't the shortest path, which is of length " + memory.<Long>get(shortestPathLength) + ". Do nothing.");
}
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": no message from source yet. Do nothing");
}
}
}
}
else { // if neither source nor destination vertex
if (memory.isInitialIteration()) {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": neither a source nor destination vertex. Do nothing.");
}
else {
boolean shortestPathProcessed = this.<Boolean>get(vertex, shortestPathRecordedAndBroadcasted).orElse(false);
if (shortestPathProcessed) {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": shortest path have been relayed. Do nothing.");
return;
}
List<VertexMessage> messages = messages(messenger);
List<MessageFromSource> incomingSourceMsg = messageFromSource(messages);
List<MessageFromDestination> incomingDestMsg = messageFromDestination(messages);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received the following messages: " + incomingSourceMsg + ", " + incomingDestMsg);
if (!incomingSourceMsg.isEmpty() || !incomingDestMsg.isEmpty()) {
boolean hasNewMessageToProcess = false;
if (!get(vertex, srcMsgFromPrevIterations).isPresent() && !incomingSourceMsg.isEmpty()) {
set(vertex, srcMsgFromPrevIterations, incomingSourceMsg);
broadcastSourceMessages(messenger, memory, vertexId, incomingSourceMsg);
hasNewMessageToProcess = true;
}
if (!get(vertex, destMsgFromPrevIterations).isPresent() && !incomingDestMsg.isEmpty()) {
set(vertex, destMsgFromPrevIterations, incomingDestMsg);
broadcastDestinationMessages(messenger, memory, vertexId, incomingDestMsg);
hasNewMessageToProcess = true;
}
if (get(vertex, srcMsgFromPrevIterations).isPresent() && get(vertex, destMsgFromPrevIterations).isPresent()) {
List<MessageFromSource> srcMsgs = this.<List<MessageFromSource>>get(vertex, srcMsgFromPrevIterations).get();
List<MessageFromDestination> destMsgs = this.<List<MessageFromDestination>>get(vertex, destMsgFromPrevIterations).get();
long pathLength = srcMsgs.get(0).pathLength() + destMsgs.get(0).pathLength();
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": Path between source and destination with length " + pathLength + " found here.");
if (memory.<Long>get(shortestPathLength) == SHORTEST_PATH_LENGTH_NOT_YET_SET || pathLength == memory.<Long>get(shortestPathLength)) {
recordShortestPath_AndMarkBroadcasted(vertex, memory, vertexId, destMsgs, pathLength);
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": is not the shortest path. Do nothing.");
set(vertex, pathFoundButIsNotTheShortest, true);
}
}
memory.add(atLeastOneVertexActive, hasNewMessageToProcess);
}
else {
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": receives no message. Do nothing.");
}
}
}
}
@Override
public boolean terminate(final Memory memory) {
boolean terminate = !memory.<Boolean>get(atLeastOneVertexActive) || memory.<Boolean>get(allShortestPathsFound_TerminateAtTheEndOfThisIteration);
if (!memory.<Boolean>get(atLeastOneVertexActive)) {
LOG.debug("No vertex is active. Terminating compute path.");
}
if (memory.<Boolean>get(allShortestPathsFound_TerminateAtTheEndOfThisIteration)) {
LOG.debug("All shortest paths have been found. Terminating compute path.");
}
memory.set(atLeastOneVertexActive, false); // set for next iteration
return terminate;
}
private Map<String, Set<String>> recordShortestPath_AndMarkBroadcasted(Vertex vertex, Memory memory, String vertexId, List<MessageFromDestination> destMsgs, long pathLength) {
Map<String, Set<String>> msg = new HashMap<>(Collections.singletonMap(vertexId,
destMsgs.stream().map(e -> e.vertexId()).collect(Collectors.toSet())));
memory.add(SHORTEST_PATH, msg);
memory.add(shortestPathLength, pathLength);
set(vertex, shortestPathRecordedAndBroadcasted, true);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": is the shortest path. Record(" + msg + ")");
return msg;
}
private void markBroadcasted_TerminateAtTheEndOfThisIeration(Vertex vertex, Memory memory, String vertexId, List<MessageFromSource> incomingSourceMsg, long pathLength) {
Map<String, Set<String>> msg = new HashMap<>(Collections.singletonMap(vertexId,
incomingSourceMsg.stream().map(e -> e.vertexId()).collect(Collectors.toSet())));
// memory.add(SHORTEST_PATH, msg); do not record
memory.add(shortestPathLength, pathLength);
set(vertex, shortestPathRecordedAndBroadcasted, true);
memory.add(allShortestPathsFound_TerminateAtTheEndOfThisIteration, true);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": received " + msg + ". 'compute new-path' finished. Terminating...");
}
private void broadcastInitialDestinationMessage(Messenger<VertexMessage> messenger, Memory memory, String vertexId) {
MessageFromDestination initialOutgoingDestMsg = new MessageFromDestination(vertexId,1L);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": I am the destination vertex [" + vertexId + "]. Sending message " + initialOutgoingDestMsg + " to neighbors");
broadcastToNeighbors(messenger, initialOutgoingDestMsg);
}
private void broadcastInitialSourceMessage(Messenger<VertexMessage> messenger, Memory memory, String vertexId) {
MessageFromSource initialOutgoingSrcMsg = new MessageFromSource(vertexId,1L);
broadcastToNeighbors(messenger, initialOutgoingSrcMsg);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": I am the source vertex [" + vertexId + "]. Sending message " + initialOutgoingSrcMsg + " to neighbors");
}
private void broadcastDestinationMessages(Messenger<VertexMessage> messenger, Memory memory, String vertexId, List<MessageFromDestination> incomingDestMsg) {
if (!incomingDestMsg.isEmpty()) {
MessageFromDestination msg = incomingDestMsg.get(0);
MessageFromDestination outgoingDstMsg = new MessageFromDestination(vertexId, msg.pathLength() + 1);
broadcastToNeighbors(messenger, outgoingDstMsg);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": Relaying message " + outgoingDstMsg + ".");
}
}
private void broadcastSourceMessages(Messenger<VertexMessage> messenger, Memory memory, String vertexId, List<MessageFromSource> incomingSourceMsg) {
if (!incomingSourceMsg.isEmpty()) {
MessageFromSource msg = incomingSourceMsg.get(0);
MessageFromSource outgoingSrcMsg = new MessageFromSource(vertexId, msg.pathLength() + 1);
broadcastToNeighbors(messenger, outgoingSrcMsg);
LOG.debug("Iteration " + memory.getIteration() + ", Vertex " + vertexId + ": Relaying message " + outgoingSrcMsg + ".");
}
}
private boolean source(Vertex vertex) {
String source = (String) persistentProperties.get(sourceId);
String vertexId = this.<String>get(vertex, Schema.VertexProperty.ID.name()).get();
return source.equals(vertexId);
}
private boolean destination(Vertex vertex) {
String source = (String) persistentProperties.get(destinationId);
String vertexId = this.<String>get(vertex, Schema.VertexProperty.ID.name()).get();
return source.equals(vertexId);
}
private List<VertexMessage> messages(Messenger<VertexMessage> messenger) {
return IteratorUtils.asList(messenger.receiveMessages());
}
private List<MessageFromSource> messageFromSource(List<VertexMessage> messages) {
return IteratorUtils.asList(Iterators.filter(messages.iterator(), e -> e instanceof MessageFromSource));
}
private List<MessageFromDestination> messageFromDestination(List<VertexMessage> messages) {
return IteratorUtils.asList(Iterators.filter(messages.iterator(), e -> e instanceof MessageFromDestination));
}
private <T> Optional<T> get(Vertex vertex, String key) {
return Optional.ofNullable(vertex.property(key).orElse(null)).map(e -> (T) e);
}
private void set(Vertex vertex, String key, Object value) {
vertex.property(key, value);
}
private void broadcastToNeighbors(Messenger<VertexMessage> messenger, VertexMessage message) {
messenger.sendMessage(inEdge, message);
messenger.sendMessage(outEdge, message);
}
interface VertexMessage {
String vertexId();
long pathLength();
}
static class MessageFromSource implements VertexMessage {
private final String vertexId;
private final long pathLength;
MessageFromSource(String vertexId, long pathLength) {
this.vertexId = vertexId;
this.pathLength = pathLength;
}
@Override
public String vertexId() {
return vertexId;
}
@Override
public long pathLength() {
return pathLength;
}
@Override
public String toString() {
return "FromSourceMessage(vertexId=" + vertexId + ", pathLength=" + pathLength + ")";
}
}
static class MessageFromDestination implements VertexMessage {
private final String vertexId;
private final long pathLength;
MessageFromDestination(String vertexId, long pathLength) {
this.vertexId = vertexId;
this.pathLength = pathLength;
}
@Override
public String vertexId() {
return vertexId;
}
@Override
public long pathLength() {
return pathLength;
}
@Override
public String toString() {
return "FromDestinationMessage(vertexId=" + vertexId + ", pathLength=" + pathLength + ")";
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/StatisticsMapReduce.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.LabelId;
import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Set;
import static ai.grakn.graql.internal.analytics.Utility.vertexHasSelectedTypeId;
/**
* The abstract MapReduce program for computing statistics.
*
* @author Jason Liu
* @param <T> Determines the return type of th MapReduce statistics computation
*/
public abstract class StatisticsMapReduce<T> extends GraknMapReduce<T> {
String degreePropertyKey;
StatisticsMapReduce() {
}
StatisticsMapReduce(Set<LabelId> selectedLabelIds, AttributeType.DataType resourceDataType, String degreePropertyKey) {
super(selectedLabelIds, resourceDataType);
this.degreePropertyKey = degreePropertyKey;
this.persistentProperties.put(DegreeVertexProgram.DEGREE, degreePropertyKey);
}
@Override
public void loadState(final Graph graph, final Configuration configuration) {
super.loadState(graph, configuration);
degreePropertyKey = (String) persistentProperties.get(DegreeVertexProgram.DEGREE);
}
boolean resourceIsValid(Vertex vertex) {
return vertexHasSelectedTypeId(vertex, selectedTypes) && vertex.<Long>value(degreePropertyKey) > 0;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/StdMapReduce.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.LabelId;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* The MapReduce program for computing the standard deviation of the given resource.
* <p>
*
* @author Jason Liu
* @author Sheldon Hall
*/
public class StdMapReduce extends StatisticsMapReduce<Map<String, Double>> {
public static final String COUNT = "C";
public static final String SUM = "S";
public static final String SQUARE_SUM = "SM";
// Needed internally for OLAP tasks
public StdMapReduce() {
}
public StdMapReduce(Set<LabelId> selectedLabelIds, AttributeType.DataType resourceDataType, String degreePropertyKey) {
super(selectedLabelIds, resourceDataType, degreePropertyKey);
}
@Override
public void safeMap(final Vertex vertex, final MapEmitter<Serializable, Map<String, Double>> emitter) {
if (resourceIsValid(vertex)) {
Map<String, Double> tuple = new HashMap<>(3);
Double degree =
((Long) vertex.value(degreePropertyKey)).doubleValue();
double value = resourceValue(vertex).doubleValue();
tuple.put(SUM, value * degree);
tuple.put(SQUARE_SUM, value * value * degree);
tuple.put(COUNT, degree);
emitter.emit(NullObject.instance(), tuple);
return;
}
Map<String, Double> emptyTuple = new HashMap<>(3);
emptyTuple.put(SUM, 0D);
emptyTuple.put(SQUARE_SUM, 0D);
emptyTuple.put(COUNT, 0D);
emitter.emit(NullObject.instance(), emptyTuple);
}
@Override
Map<String, Double> reduceValues(Iterator<Map<String, Double>> values) {
Map<String, Double> emptyTuple = new HashMap<>(3);
emptyTuple.put(SUM, 0D);
emptyTuple.put(SQUARE_SUM, 0D);
emptyTuple.put(COUNT, 0D);
return IteratorUtils.reduce(values, emptyTuple,
(a, b) -> {
a.put(COUNT, a.get(COUNT) + b.get(COUNT));
a.put(SUM, a.get(SUM) + b.get(SUM));
a.put(SQUARE_SUM, a.get(SQUARE_SUM) + b.get(SQUARE_SUM));
return a;
});
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/SumMapReduce.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.LabelId;
import ai.grakn.util.Schema;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Set;
/**
* The MapReduce program for computing the sum of the given resource.
* <p>
*
* @author Jason Liu
* @author Sheldon Hall
*/
public class SumMapReduce extends StatisticsMapReduce<Number> {
// Needed internally for OLAP tasks
public SumMapReduce() {
}
public SumMapReduce(Set<LabelId> selectedLabelIds, AttributeType.DataType resourceDataType, String degreePropertyKey) {
super(selectedLabelIds, resourceDataType, degreePropertyKey);
}
@Override
public void safeMap(final Vertex vertex, final MapEmitter<Serializable, Number> emitter) {
if (usingLong()) {
if (resourceIsValid(vertex)) {
emitter.emit(NullObject.instance(),
((Long) vertex.value(Schema.VertexProperty.VALUE_LONG.name())) *
((Long) vertex.value(degreePropertyKey)));
return;
}
emitter.emit(NullObject.instance(), 0L);
} else {
if (resourceIsValid(vertex)) {
emitter.emit(NullObject.instance(),
((Double) vertex.value(Schema.VertexProperty.VALUE_DOUBLE.name())) *
((Long) vertex.value(degreePropertyKey)));
return;
}
emitter.emit(NullObject.instance(), 0D);
}
}
@Override
Number reduceValues(Iterator<Number> values) {
if (usingLong()) {
return IteratorUtils.reduce(values, 0L, (a, b) -> a.longValue() + b.longValue());
} else {
return IteratorUtils.reduce(values, 0D, (a, b) -> a.doubleValue() + b.doubleValue());
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/analytics/Utility.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.analytics;
import ai.grakn.GraknTx;
import ai.grakn.concept.Concept;
import ai.grakn.concept.ConceptId;
import ai.grakn.concept.Label;
import ai.grakn.concept.LabelId;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.util.Schema;
import org.apache.tinkerpop.gremlin.process.computer.KeyValue;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static ai.grakn.graql.Graql.var;
/**
* Some helper methods for MapReduce and vertex program.
* <p>
*
* @author Jason Liu
* @author Sheldon Hall
*/
public class Utility {
/**
* The Grakn type property on a given Tinkerpop vertex.
* If the vertex is a {@link SchemaConcept}, return invalid {@link Label}.
*
* @param vertex the Tinkerpop vertex
* @return the type
*/
static LabelId getVertexTypeId(Vertex vertex) {
if (vertex.property(Schema.VertexProperty.THING_TYPE_LABEL_ID.name()).isPresent()) {
return LabelId.of(vertex.value(Schema.VertexProperty.THING_TYPE_LABEL_ID.name()));
}
return LabelId.invalid();
}
static boolean vertexHasSelectedTypeId(Vertex vertex, Set<LabelId> selectedTypeIds) {
return vertex.property(Schema.VertexProperty.THING_TYPE_LABEL_ID.name()).isPresent() &&
selectedTypeIds.contains(LabelId.of(vertex.value(Schema.VertexProperty.THING_TYPE_LABEL_ID.name())));
}
/**
* The state of the vertex in the database. This may detect ghost nodes and allow them to be excluded from
* computations. If the vertex is alive it is likely to be a valid Grakn concept.
*
* @return if the vertex is alive
*/
static boolean isAlive(Vertex vertex) {
if (vertex == null) return false;
try {
return vertex.property(Schema.VertexProperty.ID.name()).isPresent();
} catch (IllegalStateException e) {
return false;
}
}
/**
* A helper method for set MapReduce. It simply combines sets into one set.
*
* @param values the aggregated values associated with the key
* @param <T> the type of the set
* @return the combined set
*/
static <T> Set<T> reduceSet(Iterator<Set<T>> values) {
Set<T> set = new HashSet<>();
while (values.hasNext()) {
set.addAll(values.next());
}
return set;
}
/**
* Transforms an iterator of key-value pairs into a map
*
* @param keyValues an iterator of key-value pairs
* @param <K> the type of the keys
* @param <V> the type of the values
* @return the resulting map
*/
static <K, V> Map<K, V> keyValuesToMap(Iterator<KeyValue<K, V>> keyValues) {
Map<K, V> map = new HashMap<>();
keyValues.forEachRemaining(pair -> map.put(pair.getKey(), pair.getValue()));
return map;
}
/**
* Check whether it is possible that there is a resource edge between the two given concepts.
*/
private static boolean mayHaveResourceEdge(GraknTx graknGraph, ConceptId conceptId1, ConceptId conceptId2) {
Concept concept1 = graknGraph.getConcept(conceptId1);
Concept concept2 = graknGraph.getConcept(conceptId2);
return concept1 != null && concept2 != null && (concept1.isAttribute() || concept2.isAttribute());
}
/**
* Get the resource edge id if there is one. Return null if not.
*/
public static ConceptId getResourceEdgeId(GraknTx graph, ConceptId conceptId1, ConceptId conceptId2) {
if (mayHaveResourceEdge(graph, conceptId1, conceptId2)) {
Optional<Concept> firstConcept = graph.graql().match(
var("x").id(conceptId1),
var("y").id(conceptId2),
var("z").rel(var("x")).rel(var("y")))
.get("z")
.stream().map(answer -> answer.get("z"))
.findFirst();
if (firstConcept.isPresent()) {
return firstConcept.get().id();
}
}
return null;
}
/**
* Get the id of given vertex.
*/
static String getVertexId(Vertex vertex) {
return vertex.value(Schema.VertexProperty.ID.name());
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlBaseListener.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link GraqlListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class GraqlBaseListener implements GraqlListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterQueryList(GraqlParser.QueryListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitQueryList(GraqlParser.QueryListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterQueryEOF(GraqlParser.QueryEOFContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitQueryEOF(GraqlParser.QueryEOFContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterQuery(GraqlParser.QueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitQuery(GraqlParser.QueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMatchBase(GraqlParser.MatchBaseContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMatchBase(GraqlParser.MatchBaseContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMatchOffset(GraqlParser.MatchOffsetContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMatchOffset(GraqlParser.MatchOffsetContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMatchOrderBy(GraqlParser.MatchOrderByContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMatchOrderBy(GraqlParser.MatchOrderByContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMatchLimit(GraqlParser.MatchLimitContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMatchLimit(GraqlParser.MatchLimitContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterGetQuery(GraqlParser.GetQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitGetQuery(GraqlParser.GetQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterInsertQuery(GraqlParser.InsertQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitInsertQuery(GraqlParser.InsertQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDefineQuery(GraqlParser.DefineQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDefineQuery(GraqlParser.DefineQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterUndefineQuery(GraqlParser.UndefineQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitUndefineQuery(GraqlParser.UndefineQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDeleteQuery(GraqlParser.DeleteQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDeleteQuery(GraqlParser.DeleteQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAggregateQuery(GraqlParser.AggregateQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAggregateQuery(GraqlParser.AggregateQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVariables(GraqlParser.VariablesContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVariables(GraqlParser.VariablesContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeQuery(GraqlParser.ComputeQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeQuery(GraqlParser.ComputeQueryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeMethod(GraqlParser.ComputeMethodContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeMethod(GraqlParser.ComputeMethodContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeConditions(GraqlParser.ComputeConditionsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeConditions(GraqlParser.ComputeConditionsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeCondition(GraqlParser.ComputeConditionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeCondition(GraqlParser.ComputeConditionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeFromID(GraqlParser.ComputeFromIDContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeFromID(GraqlParser.ComputeFromIDContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeToID(GraqlParser.ComputeToIDContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeToID(GraqlParser.ComputeToIDContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeInLabels(GraqlParser.ComputeInLabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeInLabels(GraqlParser.ComputeInLabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgs(GraqlParser.ComputeArgsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgs(GraqlParser.ComputeArgsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgK(GraqlParser.ComputeArgKContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgK(GraqlParser.ComputeArgKContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgSize(GraqlParser.ComputeArgSizeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgSize(GraqlParser.ComputeArgSizeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterComputeArgContains(GraqlParser.ComputeArgContainsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitComputeArgContains(GraqlParser.ComputeArgContainsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCustomAgg(GraqlParser.CustomAggContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCustomAgg(GraqlParser.CustomAggContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVariableArgument(GraqlParser.VariableArgumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVariableArgument(GraqlParser.VariableArgumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAggregateArgument(GraqlParser.AggregateArgumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAggregateArgument(GraqlParser.AggregateArgumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPatterns(GraqlParser.PatternsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPatterns(GraqlParser.PatternsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVarPatternCase(GraqlParser.VarPatternCaseContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVarPatternCase(GraqlParser.VarPatternCaseContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAndPattern(GraqlParser.AndPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAndPattern(GraqlParser.AndPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterOrPattern(GraqlParser.OrPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitOrPattern(GraqlParser.OrPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVarPatterns(GraqlParser.VarPatternsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVarPatterns(GraqlParser.VarPatternsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVarPattern(GraqlParser.VarPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVarPattern(GraqlParser.VarPatternContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIsa(GraqlParser.IsaContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIsa(GraqlParser.IsaContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIsaExplicit(GraqlParser.IsaExplicitContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIsaExplicit(GraqlParser.IsaExplicitContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSub(GraqlParser.SubContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSub(GraqlParser.SubContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterRelates(GraqlParser.RelatesContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitRelates(GraqlParser.RelatesContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPlays(GraqlParser.PlaysContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPlays(GraqlParser.PlaysContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropId(GraqlParser.PropIdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropId(GraqlParser.PropIdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropLabel(GraqlParser.PropLabelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropLabel(GraqlParser.PropLabelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropValue(GraqlParser.PropValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropValue(GraqlParser.PropValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropWhen(GraqlParser.PropWhenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropWhen(GraqlParser.PropWhenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropThen(GraqlParser.PropThenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropThen(GraqlParser.PropThenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropHas(GraqlParser.PropHasContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropHas(GraqlParser.PropHasContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropResource(GraqlParser.PropResourceContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropResource(GraqlParser.PropResourceContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropKey(GraqlParser.PropKeyContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropKey(GraqlParser.PropKeyContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropRel(GraqlParser.PropRelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropRel(GraqlParser.PropRelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIsAbstract(GraqlParser.IsAbstractContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIsAbstract(GraqlParser.IsAbstractContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropDatatype(GraqlParser.PropDatatypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropDatatype(GraqlParser.PropDatatypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropRegex(GraqlParser.PropRegexContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropRegex(GraqlParser.PropRegexContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPropNeq(GraqlParser.PropNeqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPropNeq(GraqlParser.PropNeqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCasting(GraqlParser.CastingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCasting(GraqlParser.CastingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVariable(GraqlParser.VariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVariable(GraqlParser.VariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateEq(GraqlParser.PredicateEqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateEq(GraqlParser.PredicateEqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateVariable(GraqlParser.PredicateVariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateVariable(GraqlParser.PredicateVariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateNeq(GraqlParser.PredicateNeqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateNeq(GraqlParser.PredicateNeqContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateGt(GraqlParser.PredicateGtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateGt(GraqlParser.PredicateGtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateGte(GraqlParser.PredicateGteContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateGte(GraqlParser.PredicateGteContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateLt(GraqlParser.PredicateLtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateLt(GraqlParser.PredicateLtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateLte(GraqlParser.PredicateLteContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateLte(GraqlParser.PredicateLteContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateContains(GraqlParser.PredicateContainsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateContains(GraqlParser.PredicateContainsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPredicateRegex(GraqlParser.PredicateRegexContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPredicateRegex(GraqlParser.PredicateRegexContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueVariable(GraqlParser.ValueVariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueVariable(GraqlParser.ValueVariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValuePrimitive(GraqlParser.ValuePrimitiveContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValuePrimitive(GraqlParser.ValuePrimitiveContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueString(GraqlParser.ValueStringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueString(GraqlParser.ValueStringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueInteger(GraqlParser.ValueIntegerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueInteger(GraqlParser.ValueIntegerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueReal(GraqlParser.ValueRealContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueReal(GraqlParser.ValueRealContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueBoolean(GraqlParser.ValueBooleanContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueBoolean(GraqlParser.ValueBooleanContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueDate(GraqlParser.ValueDateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueDate(GraqlParser.ValueDateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValueDateTime(GraqlParser.ValueDateTimeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValueDateTime(GraqlParser.ValueDateTimeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLabels(GraqlParser.LabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLabels(GraqlParser.LabelsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLabelsArray(GraqlParser.LabelsArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLabelsArray(GraqlParser.LabelsArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLabel(GraqlParser.LabelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLabel(GraqlParser.LabelContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterId(GraqlParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitId(GraqlParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIdentifier(GraqlParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIdentifier(GraqlParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDatatype(GraqlParser.DatatypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDatatype(GraqlParser.DatatypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterOrder(GraqlParser.OrderContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitOrder(GraqlParser.OrderContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBool(GraqlParser.BoolContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBool(GraqlParser.BoolContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlBaseVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
* This class provides an empty implementation of {@link GraqlVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public class GraqlBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements GraqlVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitQueryList(GraqlParser.QueryListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitQueryEOF(GraqlParser.QueryEOFContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitQuery(GraqlParser.QueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMatchBase(GraqlParser.MatchBaseContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMatchOffset(GraqlParser.MatchOffsetContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMatchOrderBy(GraqlParser.MatchOrderByContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMatchLimit(GraqlParser.MatchLimitContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGetQuery(GraqlParser.GetQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitInsertQuery(GraqlParser.InsertQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDefineQuery(GraqlParser.DefineQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitUndefineQuery(GraqlParser.UndefineQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDeleteQuery(GraqlParser.DeleteQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAggregateQuery(GraqlParser.AggregateQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVariables(GraqlParser.VariablesContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeQuery(GraqlParser.ComputeQueryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeMethod(GraqlParser.ComputeMethodContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeConditions(GraqlParser.ComputeConditionsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeCondition(GraqlParser.ComputeConditionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeFromID(GraqlParser.ComputeFromIDContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeToID(GraqlParser.ComputeToIDContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeInLabels(GraqlParser.ComputeInLabelsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgs(GraqlParser.ComputeArgsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgK(GraqlParser.ComputeArgKContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgSize(GraqlParser.ComputeArgSizeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitComputeArgContains(GraqlParser.ComputeArgContainsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCustomAgg(GraqlParser.CustomAggContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVariableArgument(GraqlParser.VariableArgumentContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAggregateArgument(GraqlParser.AggregateArgumentContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPatterns(GraqlParser.PatternsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVarPatternCase(GraqlParser.VarPatternCaseContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAndPattern(GraqlParser.AndPatternContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitOrPattern(GraqlParser.OrPatternContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVarPatterns(GraqlParser.VarPatternsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVarPattern(GraqlParser.VarPatternContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIsa(GraqlParser.IsaContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIsaExplicit(GraqlParser.IsaExplicitContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSub(GraqlParser.SubContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitRelates(GraqlParser.RelatesContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPlays(GraqlParser.PlaysContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropId(GraqlParser.PropIdContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropLabel(GraqlParser.PropLabelContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropValue(GraqlParser.PropValueContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropWhen(GraqlParser.PropWhenContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropThen(GraqlParser.PropThenContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropHas(GraqlParser.PropHasContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropResource(GraqlParser.PropResourceContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropKey(GraqlParser.PropKeyContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropRel(GraqlParser.PropRelContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIsAbstract(GraqlParser.IsAbstractContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropDatatype(GraqlParser.PropDatatypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropRegex(GraqlParser.PropRegexContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPropNeq(GraqlParser.PropNeqContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCasting(GraqlParser.CastingContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVariable(GraqlParser.VariableContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateEq(GraqlParser.PredicateEqContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateVariable(GraqlParser.PredicateVariableContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateNeq(GraqlParser.PredicateNeqContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateGt(GraqlParser.PredicateGtContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateGte(GraqlParser.PredicateGteContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateLt(GraqlParser.PredicateLtContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateLte(GraqlParser.PredicateLteContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateContains(GraqlParser.PredicateContainsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPredicateRegex(GraqlParser.PredicateRegexContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueVariable(GraqlParser.ValueVariableContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValuePrimitive(GraqlParser.ValuePrimitiveContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueString(GraqlParser.ValueStringContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueInteger(GraqlParser.ValueIntegerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueReal(GraqlParser.ValueRealContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueBoolean(GraqlParser.ValueBooleanContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueDate(GraqlParser.ValueDateContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValueDateTime(GraqlParser.ValueDateTimeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLabels(GraqlParser.LabelsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLabelsArray(GraqlParser.LabelsArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLabel(GraqlParser.LabelContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitId(GraqlParser.IdContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIdentifier(GraqlParser.IdentifierContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDatatype(GraqlParser.DatatypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitOrder(GraqlParser.OrderContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBool(GraqlParser.BoolContext ctx) { return visitChildren(ctx); }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlLexer.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GraqlLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38,
T__38=39, T__39=40, T__40=41, MIN=42, MAX=43, MEDIAN=44, MEAN=45, STD=46,
SUM=47, COUNT=48, PATH=49, CLUSTER=50, CENTRALITY=51, FROM=52, TO=53,
OF=54, IN=55, DEGREE=56, K_CORE=57, CONNECTED_COMPONENT=58, MIN_K=59,
K=60, CONTAINS=61, SIZE=62, USING=63, WHERE=64, MATCH=65, INSERT=66, DEFINE=67,
UNDEFINE=68, COMPUTE=69, ASC=70, DESC=71, LONG_TYPE=72, DOUBLE_TYPE=73,
STRING_TYPE=74, BOOLEAN_TYPE=75, DATE_TYPE=76, TRUE=77, FALSE=78, VARIABLE=79,
ID=80, STRING=81, REGEX=82, INTEGER=83, REAL=84, DATE=85, DATETIME=86,
COMMENT=87, IMPLICIT_IDENTIFIER=88, WS=89, DOLLAR=90;
public static String[] modeNames = {
"DEFAULT_MODE"
};
public static final String[] ruleNames = {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
"T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24",
"T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
"T__33", "T__34", "T__35", "T__36", "T__37", "T__38", "T__39", "T__40",
"MIN", "MAX", "MEDIAN", "MEAN", "STD", "SUM", "COUNT", "PATH", "CLUSTER",
"CENTRALITY", "FROM", "TO", "OF", "IN", "DEGREE", "K_CORE", "CONNECTED_COMPONENT",
"MIN_K", "K", "CONTAINS", "SIZE", "USING", "WHERE", "MATCH", "INSERT",
"DEFINE", "UNDEFINE", "COMPUTE", "ASC", "DESC", "LONG_TYPE", "DOUBLE_TYPE",
"STRING_TYPE", "BOOLEAN_TYPE", "DATE_TYPE", "TRUE", "FALSE", "VARIABLE",
"ID", "STRING", "REGEX", "INTEGER", "REAL", "DATE", "DATETIME", "DATE_FRAGMENT",
"MONTH", "DAY", "YEAR", "TIME", "HOUR", "MINUTE", "SECOND", "ESCAPE_SEQ",
"COMMENT", "IMPLICIT_IDENTIFIER", "WS", "DOLLAR"
};
private static final String[] _LITERAL_NAMES = {
null, "'limit'", "';'", "'offset'", "'order'", "'by'", "'get'", "'delete'",
"'aggregate'", "','", "'['", "']'", "'='", "'or'", "'{'", "'}'", "'isa'",
"'isa!'", "'sub'", "'relates'", "'as'", "'plays'", "'id'", "'label'",
"'when'", "'then'", "'has'", "'via'", "'key'", "'('", "')'", "'is-abstract'",
"'datatype'", "'regex'", "'!='", "':'", "'=='", "'!=='", "'>'", "'>='",
"'<'", "'<='", "'min'", "'max'", "'median'", "'mean'", "'std'", "'sum'",
"'count'", "'path'", "'cluster'", "'centrality'", "'from'", "'to'", "'of'",
"'in'", "'degree'", "'k-core'", "'connected-component'", "'min-k'", "'k'",
"'contains'", "'size'", "'using'", "'where'", "'match'", "'insert'", "'define'",
"'undefine'", "'compute'", "'asc'", "'desc'", "'long'", "'double'", "'string'",
"'boolean'", "'date'", "'true'", "'false'", null, null, null, null, null,
null, null, null, null, null, null, "'$'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, "MIN", "MAX", "MEDIAN", "MEAN", "STD",
"SUM", "COUNT", "PATH", "CLUSTER", "CENTRALITY", "FROM", "TO", "OF", "IN",
"DEGREE", "K_CORE", "CONNECTED_COMPONENT", "MIN_K", "K", "CONTAINS", "SIZE",
"USING", "WHERE", "MATCH", "INSERT", "DEFINE", "UNDEFINE", "COMPUTE",
"ASC", "DESC", "LONG_TYPE", "DOUBLE_TYPE", "STRING_TYPE", "BOOLEAN_TYPE",
"DATE_TYPE", "TRUE", "FALSE", "VARIABLE", "ID", "STRING", "REGEX", "INTEGER",
"REAL", "DATE", "DATETIME", "COMMENT", "IMPLICIT_IDENTIFIER", "WS", "DOLLAR"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public GraqlLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Graql.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\\\u02f4\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+
",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+
"\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+
"\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+
"\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+
"\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+
"`\t`\4a\ta\4b\tb\4c\tc\4d\td\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\4\3\4\3"+
"\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\7\3\7\3\7\3\7"+
"\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3"+
"\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\20\3\20\3"+
"\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\24\3"+
"\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3"+
"\26\3\26\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3"+
"\31\3\31\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3"+
"\34\3\35\3\35\3\35\3\35\3\36\3\36\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3"+
" \3 \3 \3 \3!\3!\3!\3!\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3#\3#\3"+
"#\3$\3$\3%\3%\3%\3&\3&\3&\3&\3\'\3\'\3(\3(\3(\3)\3)\3*\3*\3*\3+\3+\3+"+
"\3+\3,\3,\3,\3,\3-\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3/\3/\3/\3/\3\60\3"+
"\60\3\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\62\3\62\3"+
"\63\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\64\3"+
"\64\3\64\3\64\3\64\3\64\3\65\3\65\3\65\3\65\3\65\3\66\3\66\3\66\3\67\3"+
"\67\3\67\38\38\38\39\39\39\39\39\39\39\3:\3:\3:\3:\3:\3:\3:\3;\3;\3;\3"+
";\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3<\3<\3<\3<\3<\3<\3"+
"=\3=\3>\3>\3>\3>\3>\3>\3>\3>\3>\3?\3?\3?\3?\3?\3@\3@\3@\3@\3@\3@\3A\3"+
"A\3A\3A\3A\3A\3B\3B\3B\3B\3B\3B\3C\3C\3C\3C\3C\3C\3C\3D\3D\3D\3D\3D\3"+
"D\3D\3E\3E\3E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3F\3F\3F\3F\3F\3G\3G\3G\3G\3"+
"H\3H\3H\3H\3H\3I\3I\3I\3I\3I\3J\3J\3J\3J\3J\3J\3J\3K\3K\3K\3K\3K\3K\3"+
"K\3L\3L\3L\3L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3N\3N\3N\3N\3N\3O\3O\3O\3O\3"+
"O\3O\3P\3P\6P\u025f\nP\rP\16P\u0260\3Q\3Q\7Q\u0265\nQ\fQ\16Q\u0268\13"+
"Q\3R\3R\3R\7R\u026d\nR\fR\16R\u0270\13R\3R\3R\3R\3R\7R\u0276\nR\fR\16"+
"R\u0279\13R\3R\5R\u027c\nR\3S\3S\3S\3S\7S\u0282\nS\fS\16S\u0285\13S\3"+
"S\3S\3T\5T\u028a\nT\3T\6T\u028d\nT\rT\16T\u028e\3U\5U\u0292\nU\3U\6U\u0295"+
"\nU\rU\16U\u0296\3U\3U\6U\u029b\nU\rU\16U\u029c\3V\3V\3W\3W\3W\3W\3X\3"+
"X\3X\3X\3X\3X\3Y\3Y\3Y\3Z\3Z\3Z\3[\3[\3[\3[\3[\3[\6[\u02b7\n[\r[\16[\u02b8"+
"\5[\u02bb\n[\3\\\3\\\3\\\3\\\3\\\5\\\u02c2\n\\\3]\3]\3]\3^\3^\3^\3_\3"+
"_\3_\3_\6_\u02ce\n_\r_\16_\u02cf\5_\u02d2\n_\3`\3`\3`\3a\3a\7a\u02d9\n"+
"a\fa\16a\u02dc\13a\3a\5a\u02df\na\3a\5a\u02e2\na\3a\3a\3b\3b\6b\u02e8"+
"\nb\rb\16b\u02e9\3c\6c\u02ed\nc\rc\16c\u02ee\3c\3c\3d\3d\3\u02da\2e\3"+
"\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37"+
"\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37="+
" ?!A\"C#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9"+
"q:s;u<w=y>{?}@\177A\u0081B\u0083C\u0085D\u0087E\u0089F\u008bG\u008dH\u008f"+
"I\u0091J\u0093K\u0095L\u0097M\u0099N\u009bO\u009dP\u009fQ\u00a1R\u00a3"+
"S\u00a5T\u00a7U\u00a9V\u00abW\u00adX\u00af\2\u00b1\2\u00b3\2\u00b5\2\u00b7"+
"\2\u00b9\2\u00bb\2\u00bd\2\u00bf\2\u00c1Y\u00c3Z\u00c5[\u00c7\\\3\2\17"+
"\7\2//\62;C\\aac|\5\2C\\aac|\4\2$$^^\4\2))^^\3\2\61\61\4\2--//\3\2\62"+
";\3\2\62\63\3\2\62\65\3\2\62\64\3\2\628\3\3\f\f\5\2\13\f\17\17\"\"\u0301"+
"\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2"+
"\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2"+
"\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2"+
"\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2"+
"\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3"+
"\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2"+
"\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2"+
"U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3"+
"\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2"+
"\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2"+
"{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085"+
"\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2"+
"\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097"+
"\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2"+
"\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9"+
"\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2"+
"\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\3\u00c9\3\2\2\2\5\u00cf\3\2\2\2\7\u00d1"+
"\3\2\2\2\t\u00d8\3\2\2\2\13\u00de\3\2\2\2\r\u00e1\3\2\2\2\17\u00e5\3\2"+
"\2\2\21\u00ec\3\2\2\2\23\u00f6\3\2\2\2\25\u00f8\3\2\2\2\27\u00fa\3\2\2"+
"\2\31\u00fc\3\2\2\2\33\u00fe\3\2\2\2\35\u0101\3\2\2\2\37\u0103\3\2\2\2"+
"!\u0105\3\2\2\2#\u0109\3\2\2\2%\u010e\3\2\2\2\'\u0112\3\2\2\2)\u011a\3"+
"\2\2\2+\u011d\3\2\2\2-\u0123\3\2\2\2/\u0126\3\2\2\2\61\u012c\3\2\2\2\63"+
"\u0131\3\2\2\2\65\u0136\3\2\2\2\67\u013a\3\2\2\29\u013e\3\2\2\2;\u0142"+
"\3\2\2\2=\u0144\3\2\2\2?\u0146\3\2\2\2A\u0152\3\2\2\2C\u015b\3\2\2\2E"+
"\u0161\3\2\2\2G\u0164\3\2\2\2I\u0166\3\2\2\2K\u0169\3\2\2\2M\u016d\3\2"+
"\2\2O\u016f\3\2\2\2Q\u0172\3\2\2\2S\u0174\3\2\2\2U\u0177\3\2\2\2W\u017b"+
"\3\2\2\2Y\u017f\3\2\2\2[\u0186\3\2\2\2]\u018b\3\2\2\2_\u018f\3\2\2\2a"+
"\u0193\3\2\2\2c\u0199\3\2\2\2e\u019e\3\2\2\2g\u01a6\3\2\2\2i\u01b1\3\2"+
"\2\2k\u01b6\3\2\2\2m\u01b9\3\2\2\2o\u01bc\3\2\2\2q\u01bf\3\2\2\2s\u01c6"+
"\3\2\2\2u\u01cd\3\2\2\2w\u01e1\3\2\2\2y\u01e7\3\2\2\2{\u01e9\3\2\2\2}"+
"\u01f2\3\2\2\2\177\u01f7\3\2\2\2\u0081\u01fd\3\2\2\2\u0083\u0203\3\2\2"+
"\2\u0085\u0209\3\2\2\2\u0087\u0210\3\2\2\2\u0089\u0217\3\2\2\2\u008b\u0220"+
"\3\2\2\2\u008d\u0228\3\2\2\2\u008f\u022c\3\2\2\2\u0091\u0231\3\2\2\2\u0093"+
"\u0236\3\2\2\2\u0095\u023d\3\2\2\2\u0097\u0244\3\2\2\2\u0099\u024c\3\2"+
"\2\2\u009b\u0251\3\2\2\2\u009d\u0256\3\2\2\2\u009f\u025c\3\2\2\2\u00a1"+
"\u0262\3\2\2\2\u00a3\u027b\3\2\2\2\u00a5\u027d\3\2\2\2\u00a7\u0289\3\2"+
"\2\2\u00a9\u0291\3\2\2\2\u00ab\u029e\3\2\2\2\u00ad\u02a0\3\2\2\2\u00af"+
"\u02a4\3\2\2\2\u00b1\u02aa\3\2\2\2\u00b3\u02ad\3\2\2\2\u00b5\u02ba\3\2"+
"\2\2\u00b7\u02bc\3\2\2\2\u00b9\u02c3\3\2\2\2\u00bb\u02c6\3\2\2\2\u00bd"+
"\u02c9\3\2\2\2\u00bf\u02d3\3\2\2\2\u00c1\u02d6\3\2\2\2\u00c3\u02e5\3\2"+
"\2\2\u00c5\u02ec\3\2\2\2\u00c7\u02f2\3\2\2\2\u00c9\u00ca\7n\2\2\u00ca"+
"\u00cb\7k\2\2\u00cb\u00cc\7o\2\2\u00cc\u00cd\7k\2\2\u00cd\u00ce\7v\2\2"+
"\u00ce\4\3\2\2\2\u00cf\u00d0\7=\2\2\u00d0\6\3\2\2\2\u00d1\u00d2\7q\2\2"+
"\u00d2\u00d3\7h\2\2\u00d3\u00d4\7h\2\2\u00d4\u00d5\7u\2\2\u00d5\u00d6"+
"\7g\2\2\u00d6\u00d7\7v\2\2\u00d7\b\3\2\2\2\u00d8\u00d9\7q\2\2\u00d9\u00da"+
"\7t\2\2\u00da\u00db\7f\2\2\u00db\u00dc\7g\2\2\u00dc\u00dd\7t\2\2\u00dd"+
"\n\3\2\2\2\u00de\u00df\7d\2\2\u00df\u00e0\7{\2\2\u00e0\f\3\2\2\2\u00e1"+
"\u00e2\7i\2\2\u00e2\u00e3\7g\2\2\u00e3\u00e4\7v\2\2\u00e4\16\3\2\2\2\u00e5"+
"\u00e6\7f\2\2\u00e6\u00e7\7g\2\2\u00e7\u00e8\7n\2\2\u00e8\u00e9\7g\2\2"+
"\u00e9\u00ea\7v\2\2\u00ea\u00eb\7g\2\2\u00eb\20\3\2\2\2\u00ec\u00ed\7"+
"c\2\2\u00ed\u00ee\7i\2\2\u00ee\u00ef\7i\2\2\u00ef\u00f0\7t\2\2\u00f0\u00f1"+
"\7g\2\2\u00f1\u00f2\7i\2\2\u00f2\u00f3\7c\2\2\u00f3\u00f4\7v\2\2\u00f4"+
"\u00f5\7g\2\2\u00f5\22\3\2\2\2\u00f6\u00f7\7.\2\2\u00f7\24\3\2\2\2\u00f8"+
"\u00f9\7]\2\2\u00f9\26\3\2\2\2\u00fa\u00fb\7_\2\2\u00fb\30\3\2\2\2\u00fc"+
"\u00fd\7?\2\2\u00fd\32\3\2\2\2\u00fe\u00ff\7q\2\2\u00ff\u0100\7t\2\2\u0100"+
"\34\3\2\2\2\u0101\u0102\7}\2\2\u0102\36\3\2\2\2\u0103\u0104\7\177\2\2"+
"\u0104 \3\2\2\2\u0105\u0106\7k\2\2\u0106\u0107\7u\2\2\u0107\u0108\7c\2"+
"\2\u0108\"\3\2\2\2\u0109\u010a\7k\2\2\u010a\u010b\7u\2\2\u010b\u010c\7"+
"c\2\2\u010c\u010d\7#\2\2\u010d$\3\2\2\2\u010e\u010f\7u\2\2\u010f\u0110"+
"\7w\2\2\u0110\u0111\7d\2\2\u0111&\3\2\2\2\u0112\u0113\7t\2\2\u0113\u0114"+
"\7g\2\2\u0114\u0115\7n\2\2\u0115\u0116\7c\2\2\u0116\u0117\7v\2\2\u0117"+
"\u0118\7g\2\2\u0118\u0119\7u\2\2\u0119(\3\2\2\2\u011a\u011b\7c\2\2\u011b"+
"\u011c\7u\2\2\u011c*\3\2\2\2\u011d\u011e\7r\2\2\u011e\u011f\7n\2\2\u011f"+
"\u0120\7c\2\2\u0120\u0121\7{\2\2\u0121\u0122\7u\2\2\u0122,\3\2\2\2\u0123"+
"\u0124\7k\2\2\u0124\u0125\7f\2\2\u0125.\3\2\2\2\u0126\u0127\7n\2\2\u0127"+
"\u0128\7c\2\2\u0128\u0129\7d\2\2\u0129\u012a\7g\2\2\u012a\u012b\7n\2\2"+
"\u012b\60\3\2\2\2\u012c\u012d\7y\2\2\u012d\u012e\7j\2\2\u012e\u012f\7"+
"g\2\2\u012f\u0130\7p\2\2\u0130\62\3\2\2\2\u0131\u0132\7v\2\2\u0132\u0133"+
"\7j\2\2\u0133\u0134\7g\2\2\u0134\u0135\7p\2\2\u0135\64\3\2\2\2\u0136\u0137"+
"\7j\2\2\u0137\u0138\7c\2\2\u0138\u0139\7u\2\2\u0139\66\3\2\2\2\u013a\u013b"+
"\7x\2\2\u013b\u013c\7k\2\2\u013c\u013d\7c\2\2\u013d8\3\2\2\2\u013e\u013f"+
"\7m\2\2\u013f\u0140\7g\2\2\u0140\u0141\7{\2\2\u0141:\3\2\2\2\u0142\u0143"+
"\7*\2\2\u0143<\3\2\2\2\u0144\u0145\7+\2\2\u0145>\3\2\2\2\u0146\u0147\7"+
"k\2\2\u0147\u0148\7u\2\2\u0148\u0149\7/\2\2\u0149\u014a\7c\2\2\u014a\u014b"+
"\7d\2\2\u014b\u014c\7u\2\2\u014c\u014d\7v\2\2\u014d\u014e\7t\2\2\u014e"+
"\u014f\7c\2\2\u014f\u0150\7e\2\2\u0150\u0151\7v\2\2\u0151@\3\2\2\2\u0152"+
"\u0153\7f\2\2\u0153\u0154\7c\2\2\u0154\u0155\7v\2\2\u0155\u0156\7c\2\2"+
"\u0156\u0157\7v\2\2\u0157\u0158\7{\2\2\u0158\u0159\7r\2\2\u0159\u015a"+
"\7g\2\2\u015aB\3\2\2\2\u015b\u015c\7t\2\2\u015c\u015d\7g\2\2\u015d\u015e"+
"\7i\2\2\u015e\u015f\7g\2\2\u015f\u0160\7z\2\2\u0160D\3\2\2\2\u0161\u0162"+
"\7#\2\2\u0162\u0163\7?\2\2\u0163F\3\2\2\2\u0164\u0165\7<\2\2\u0165H\3"+
"\2\2\2\u0166\u0167\7?\2\2\u0167\u0168\7?\2\2\u0168J\3\2\2\2\u0169\u016a"+
"\7#\2\2\u016a\u016b\7?\2\2\u016b\u016c\7?\2\2\u016cL\3\2\2\2\u016d\u016e"+
"\7@\2\2\u016eN\3\2\2\2\u016f\u0170\7@\2\2\u0170\u0171\7?\2\2\u0171P\3"+
"\2\2\2\u0172\u0173\7>\2\2\u0173R\3\2\2\2\u0174\u0175\7>\2\2\u0175\u0176"+
"\7?\2\2\u0176T\3\2\2\2\u0177\u0178\7o\2\2\u0178\u0179\7k\2\2\u0179\u017a"+
"\7p\2\2\u017aV\3\2\2\2\u017b\u017c\7o\2\2\u017c\u017d\7c\2\2\u017d\u017e"+
"\7z\2\2\u017eX\3\2\2\2\u017f\u0180\7o\2\2\u0180\u0181\7g\2\2\u0181\u0182"+
"\7f\2\2\u0182\u0183\7k\2\2\u0183\u0184\7c\2\2\u0184\u0185\7p\2\2\u0185"+
"Z\3\2\2\2\u0186\u0187\7o\2\2\u0187\u0188\7g\2\2\u0188\u0189\7c\2\2\u0189"+
"\u018a\7p\2\2\u018a\\\3\2\2\2\u018b\u018c\7u\2\2\u018c\u018d\7v\2\2\u018d"+
"\u018e\7f\2\2\u018e^\3\2\2\2\u018f\u0190\7u\2\2\u0190\u0191\7w\2\2\u0191"+
"\u0192\7o\2\2\u0192`\3\2\2\2\u0193\u0194\7e\2\2\u0194\u0195\7q\2\2\u0195"+
"\u0196\7w\2\2\u0196\u0197\7p\2\2\u0197\u0198\7v\2\2\u0198b\3\2\2\2\u0199"+
"\u019a\7r\2\2\u019a\u019b\7c\2\2\u019b\u019c\7v\2\2\u019c\u019d\7j\2\2"+
"\u019dd\3\2\2\2\u019e\u019f\7e\2\2\u019f\u01a0\7n\2\2\u01a0\u01a1\7w\2"+
"\2\u01a1\u01a2\7u\2\2\u01a2\u01a3\7v\2\2\u01a3\u01a4\7g\2\2\u01a4\u01a5"+
"\7t\2\2\u01a5f\3\2\2\2\u01a6\u01a7\7e\2\2\u01a7\u01a8\7g\2\2\u01a8\u01a9"+
"\7p\2\2\u01a9\u01aa\7v\2\2\u01aa\u01ab\7t\2\2\u01ab\u01ac\7c\2\2\u01ac"+
"\u01ad\7n\2\2\u01ad\u01ae\7k\2\2\u01ae\u01af\7v\2\2\u01af\u01b0\7{\2\2"+
"\u01b0h\3\2\2\2\u01b1\u01b2\7h\2\2\u01b2\u01b3\7t\2\2\u01b3\u01b4\7q\2"+
"\2\u01b4\u01b5\7o\2\2\u01b5j\3\2\2\2\u01b6\u01b7\7v\2\2\u01b7\u01b8\7"+
"q\2\2\u01b8l\3\2\2\2\u01b9\u01ba\7q\2\2\u01ba\u01bb\7h\2\2\u01bbn\3\2"+
"\2\2\u01bc\u01bd\7k\2\2\u01bd\u01be\7p\2\2\u01bep\3\2\2\2\u01bf\u01c0"+
"\7f\2\2\u01c0\u01c1\7g\2\2\u01c1\u01c2\7i\2\2\u01c2\u01c3\7t\2\2\u01c3"+
"\u01c4\7g\2\2\u01c4\u01c5\7g\2\2\u01c5r\3\2\2\2\u01c6\u01c7\7m\2\2\u01c7"+
"\u01c8\7/\2\2\u01c8\u01c9\7e\2\2\u01c9\u01ca\7q\2\2\u01ca\u01cb\7t\2\2"+
"\u01cb\u01cc\7g\2\2\u01cct\3\2\2\2\u01cd\u01ce\7e\2\2\u01ce\u01cf\7q\2"+
"\2\u01cf\u01d0\7p\2\2\u01d0\u01d1\7p\2\2\u01d1\u01d2\7g\2\2\u01d2\u01d3"+
"\7e\2\2\u01d3\u01d4\7v\2\2\u01d4\u01d5\7g\2\2\u01d5\u01d6\7f\2\2\u01d6"+
"\u01d7\7/\2\2\u01d7\u01d8\7e\2\2\u01d8\u01d9\7q\2\2\u01d9\u01da\7o\2\2"+
"\u01da\u01db\7r\2\2\u01db\u01dc\7q\2\2\u01dc\u01dd\7p\2\2\u01dd\u01de"+
"\7g\2\2\u01de\u01df\7p\2\2\u01df\u01e0\7v\2\2\u01e0v\3\2\2\2\u01e1\u01e2"+
"\7o\2\2\u01e2\u01e3\7k\2\2\u01e3\u01e4\7p\2\2\u01e4\u01e5\7/\2\2\u01e5"+
"\u01e6\7m\2\2\u01e6x\3\2\2\2\u01e7\u01e8\7m\2\2\u01e8z\3\2\2\2\u01e9\u01ea"+
"\7e\2\2\u01ea\u01eb\7q\2\2\u01eb\u01ec\7p\2\2\u01ec\u01ed\7v\2\2\u01ed"+
"\u01ee\7c\2\2\u01ee\u01ef\7k\2\2\u01ef\u01f0\7p\2\2\u01f0\u01f1\7u\2\2"+
"\u01f1|\3\2\2\2\u01f2\u01f3\7u\2\2\u01f3\u01f4\7k\2\2\u01f4\u01f5\7|\2"+
"\2\u01f5\u01f6\7g\2\2\u01f6~\3\2\2\2\u01f7\u01f8\7w\2\2\u01f8\u01f9\7"+
"u\2\2\u01f9\u01fa\7k\2\2\u01fa\u01fb\7p\2\2\u01fb\u01fc\7i\2\2\u01fc\u0080"+
"\3\2\2\2\u01fd\u01fe\7y\2\2\u01fe\u01ff\7j\2\2\u01ff\u0200\7g\2\2\u0200"+
"\u0201\7t\2\2\u0201\u0202\7g\2\2\u0202\u0082\3\2\2\2\u0203\u0204\7o\2"+
"\2\u0204\u0205\7c\2\2\u0205\u0206\7v\2\2\u0206\u0207\7e\2\2\u0207\u0208"+
"\7j\2\2\u0208\u0084\3\2\2\2\u0209\u020a\7k\2\2\u020a\u020b\7p\2\2\u020b"+
"\u020c\7u\2\2\u020c\u020d\7g\2\2\u020d\u020e\7t\2\2\u020e\u020f\7v\2\2"+
"\u020f\u0086\3\2\2\2\u0210\u0211\7f\2\2\u0211\u0212\7g\2\2\u0212\u0213"+
"\7h\2\2\u0213\u0214\7k\2\2\u0214\u0215\7p\2\2\u0215\u0216\7g\2\2\u0216"+
"\u0088\3\2\2\2\u0217\u0218\7w\2\2\u0218\u0219\7p\2\2\u0219\u021a\7f\2"+
"\2\u021a\u021b\7g\2\2\u021b\u021c\7h\2\2\u021c\u021d\7k\2\2\u021d\u021e"+
"\7p\2\2\u021e\u021f\7g\2\2\u021f\u008a\3\2\2\2\u0220\u0221\7e\2\2\u0221"+
"\u0222\7q\2\2\u0222\u0223\7o\2\2\u0223\u0224\7r\2\2\u0224\u0225\7w\2\2"+
"\u0225\u0226\7v\2\2\u0226\u0227\7g\2\2\u0227\u008c\3\2\2\2\u0228\u0229"+
"\7c\2\2\u0229\u022a\7u\2\2\u022a\u022b\7e\2\2\u022b\u008e\3\2\2\2\u022c"+
"\u022d\7f\2\2\u022d\u022e\7g\2\2\u022e\u022f\7u\2\2\u022f\u0230\7e\2\2"+
"\u0230\u0090\3\2\2\2\u0231\u0232\7n\2\2\u0232\u0233\7q\2\2\u0233\u0234"+
"\7p\2\2\u0234\u0235\7i\2\2\u0235\u0092\3\2\2\2\u0236\u0237\7f\2\2\u0237"+
"\u0238\7q\2\2\u0238\u0239\7w\2\2\u0239\u023a\7d\2\2\u023a\u023b\7n\2\2"+
"\u023b\u023c\7g\2\2\u023c\u0094\3\2\2\2\u023d\u023e\7u\2\2\u023e\u023f"+
"\7v\2\2\u023f\u0240\7t\2\2\u0240\u0241\7k\2\2\u0241\u0242\7p\2\2\u0242"+
"\u0243\7i\2\2\u0243\u0096\3\2\2\2\u0244\u0245\7d\2\2\u0245\u0246\7q\2"+
"\2\u0246\u0247\7q\2\2\u0247\u0248\7n\2\2\u0248\u0249\7g\2\2\u0249\u024a"+
"\7c\2\2\u024a\u024b\7p\2\2\u024b\u0098\3\2\2\2\u024c\u024d\7f\2\2\u024d"+
"\u024e\7c\2\2\u024e\u024f\7v\2\2\u024f\u0250\7g\2\2\u0250\u009a\3\2\2"+
"\2\u0251\u0252\7v\2\2\u0252\u0253\7t\2\2\u0253\u0254\7w\2\2\u0254\u0255"+
"\7g\2\2\u0255\u009c\3\2\2\2\u0256\u0257\7h\2\2\u0257\u0258\7c\2\2\u0258"+
"\u0259\7n\2\2\u0259\u025a\7u\2\2\u025a\u025b\7g\2\2\u025b\u009e\3\2\2"+
"\2\u025c\u025e\7&\2\2\u025d\u025f\t\2\2\2\u025e\u025d\3\2\2\2\u025f\u0260"+
"\3\2\2\2\u0260\u025e\3\2\2\2\u0260\u0261\3\2\2\2\u0261\u00a0\3\2\2\2\u0262"+
"\u0266\t\3\2\2\u0263\u0265\t\2\2\2\u0264\u0263\3\2\2\2\u0265\u0268\3\2"+
"\2\2\u0266\u0264\3\2\2\2\u0266\u0267\3\2\2\2\u0267\u00a2\3\2\2\2\u0268"+
"\u0266\3\2\2\2\u0269\u026e\7$\2\2\u026a\u026d\n\4\2\2\u026b\u026d\5\u00bf"+
"`\2\u026c\u026a\3\2\2\2\u026c\u026b\3\2\2\2\u026d\u0270\3\2\2\2\u026e"+
"\u026c\3\2\2\2\u026e\u026f\3\2\2\2\u026f\u0271\3\2\2\2\u0270\u026e\3\2"+
"\2\2\u0271\u027c\7$\2\2\u0272\u0277\7)\2\2\u0273\u0276\n\5\2\2\u0274\u0276"+
"\5\u00bf`\2\u0275\u0273\3\2\2\2\u0275\u0274\3\2\2\2\u0276\u0279\3\2\2"+
"\2\u0277\u0275\3\2\2\2\u0277\u0278\3\2\2\2\u0278\u027a\3\2\2\2\u0279\u0277"+
"\3\2\2\2\u027a\u027c\7)\2\2\u027b\u0269\3\2\2\2\u027b\u0272\3\2\2\2\u027c"+
"\u00a4\3\2\2\2\u027d\u0283\7\61\2\2\u027e\u0282\n\6\2\2\u027f\u0280\7"+
"^\2\2\u0280\u0282\7\61\2\2\u0281\u027e\3\2\2\2\u0281\u027f\3\2\2\2\u0282"+
"\u0285\3\2\2\2\u0283\u0281\3\2\2\2\u0283\u0284\3\2\2\2\u0284\u0286\3\2"+
"\2\2\u0285\u0283\3\2\2\2\u0286\u0287\7\61\2\2\u0287\u00a6\3\2\2\2\u0288"+
"\u028a\t\7\2\2\u0289\u0288\3\2\2\2\u0289\u028a\3\2\2\2\u028a\u028c\3\2"+
"\2\2\u028b\u028d\t\b\2\2\u028c\u028b\3\2\2\2\u028d\u028e\3\2\2\2\u028e"+
"\u028c\3\2\2\2\u028e\u028f\3\2\2\2\u028f\u00a8\3\2\2\2\u0290\u0292\t\7"+
"\2\2\u0291\u0290\3\2\2\2\u0291\u0292\3\2\2\2\u0292\u0294\3\2\2\2\u0293"+
"\u0295\t\b\2\2\u0294\u0293\3\2\2\2\u0295\u0296\3\2\2\2\u0296\u0294\3\2"+
"\2\2\u0296\u0297\3\2\2\2\u0297\u0298\3\2\2\2\u0298\u029a\7\60\2\2\u0299"+
"\u029b\t\b\2\2\u029a\u0299\3\2\2\2\u029b\u029c\3\2\2\2\u029c\u029a\3\2"+
"\2\2\u029c\u029d\3\2\2\2\u029d\u00aa\3\2\2\2\u029e\u029f\5\u00afX\2\u029f"+
"\u00ac\3\2\2\2\u02a0\u02a1\5\u00afX\2\u02a1\u02a2\7V\2\2\u02a2\u02a3\5"+
"\u00b7\\\2\u02a3\u00ae\3\2\2\2\u02a4\u02a5\5\u00b5[\2\u02a5\u02a6\7/\2"+
"\2\u02a6\u02a7\5\u00b1Y\2\u02a7\u02a8\7/\2\2\u02a8\u02a9\5\u00b3Z\2\u02a9"+
"\u00b0\3\2\2\2\u02aa\u02ab\t\t\2\2\u02ab\u02ac\t\b\2\2\u02ac\u00b2\3\2"+
"\2\2\u02ad\u02ae\t\n\2\2\u02ae\u02af\t\b\2\2\u02af\u00b4\3\2\2\2\u02b0"+
"\u02b1\t\b\2\2\u02b1\u02b2\t\b\2\2\u02b2\u02b3\t\b\2\2\u02b3\u02bb\t\b"+
"\2\2\u02b4\u02b6\t\7\2\2\u02b5\u02b7\t\b\2\2\u02b6\u02b5\3\2\2\2\u02b7"+
"\u02b8\3\2\2\2\u02b8\u02b6\3\2\2\2\u02b8\u02b9\3\2\2\2\u02b9\u02bb\3\2"+
"\2\2\u02ba\u02b0\3\2\2\2\u02ba\u02b4\3\2\2\2\u02bb\u00b6\3\2\2\2\u02bc"+
"\u02bd\5\u00b9]\2\u02bd\u02be\7<\2\2\u02be\u02c1\5\u00bb^\2\u02bf\u02c0"+
"\7<\2\2\u02c0\u02c2\5\u00bd_\2\u02c1\u02bf\3\2\2\2\u02c1\u02c2\3\2\2\2"+
"\u02c2\u00b8\3\2\2\2\u02c3\u02c4\t\13\2\2\u02c4\u02c5\t\b\2\2\u02c5\u00ba"+
"\3\2\2\2\u02c6\u02c7\t\f\2\2\u02c7\u02c8\t\b\2\2\u02c8\u00bc\3\2\2\2\u02c9"+
"\u02ca\t\f\2\2\u02ca\u02d1\t\b\2\2\u02cb\u02cd\7\60\2\2\u02cc\u02ce\t"+
"\b\2\2\u02cd\u02cc\3\2\2\2\u02ce\u02cf\3\2\2\2\u02cf\u02cd\3\2\2\2\u02cf"+
"\u02d0\3\2\2\2\u02d0\u02d2\3\2\2\2\u02d1\u02cb\3\2\2\2\u02d1\u02d2\3\2"+
"\2\2\u02d2\u00be\3\2\2\2\u02d3\u02d4\7^\2\2\u02d4\u02d5\13\2\2\2\u02d5"+
"\u00c0\3\2\2\2\u02d6\u02da\7%\2\2\u02d7\u02d9\13\2\2\2\u02d8\u02d7\3\2"+
"\2\2\u02d9\u02dc\3\2\2\2\u02da\u02db\3\2\2\2\u02da\u02d8\3\2\2\2\u02db"+
"\u02de\3\2\2\2\u02dc\u02da\3\2\2\2\u02dd\u02df\7\17\2\2\u02de\u02dd\3"+
"\2\2\2\u02de\u02df\3\2\2\2\u02df\u02e1\3\2\2\2\u02e0\u02e2\t\r\2\2\u02e1"+
"\u02e0\3\2\2\2\u02e2\u02e3\3\2\2\2\u02e3\u02e4\ba\2\2\u02e4\u00c2\3\2"+
"\2\2\u02e5\u02e7\7B\2\2\u02e6\u02e8\t\2\2\2\u02e7\u02e6\3\2\2\2\u02e8"+
"\u02e9\3\2\2\2\u02e9\u02e7\3\2\2\2\u02e9\u02ea\3\2\2\2\u02ea\u00c4\3\2"+
"\2\2\u02eb\u02ed\t\16\2\2\u02ec\u02eb\3\2\2\2\u02ed\u02ee\3\2\2\2\u02ee"+
"\u02ec\3\2\2\2\u02ee\u02ef\3\2\2\2\u02ef\u02f0\3\2\2\2\u02f0\u02f1\bc"+
"\2\2\u02f1\u00c6\3\2\2\2\u02f2\u02f3\7&\2\2\u02f3\u00c8\3\2\2\2\33\2\u0260"+
"\u0266\u026c\u026e\u0275\u0277\u027b\u0281\u0283\u0289\u028e\u0291\u0296"+
"\u029c\u02b8\u02ba\u02c1\u02cf\u02d1\u02da\u02de\u02e1\u02e9\u02ee\3\2"+
"\3\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlListener.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
* This interface defines a complete listener for a parse tree produced by
* {@link GraqlParser}.
*/
public interface GraqlListener extends ParseTreeListener {
/**
* Enter a parse tree produced by {@link GraqlParser#queryList}.
* @param ctx the parse tree
*/
void enterQueryList(GraqlParser.QueryListContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#queryList}.
* @param ctx the parse tree
*/
void exitQueryList(GraqlParser.QueryListContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#queryEOF}.
* @param ctx the parse tree
*/
void enterQueryEOF(GraqlParser.QueryEOFContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#queryEOF}.
* @param ctx the parse tree
*/
void exitQueryEOF(GraqlParser.QueryEOFContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#query}.
* @param ctx the parse tree
*/
void enterQuery(GraqlParser.QueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#query}.
* @param ctx the parse tree
*/
void exitQuery(GraqlParser.QueryContext ctx);
/**
* Enter a parse tree produced by the {@code matchBase}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void enterMatchBase(GraqlParser.MatchBaseContext ctx);
/**
* Exit a parse tree produced by the {@code matchBase}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void exitMatchBase(GraqlParser.MatchBaseContext ctx);
/**
* Enter a parse tree produced by the {@code matchOffset}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void enterMatchOffset(GraqlParser.MatchOffsetContext ctx);
/**
* Exit a parse tree produced by the {@code matchOffset}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void exitMatchOffset(GraqlParser.MatchOffsetContext ctx);
/**
* Enter a parse tree produced by the {@code matchOrderBy}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void enterMatchOrderBy(GraqlParser.MatchOrderByContext ctx);
/**
* Exit a parse tree produced by the {@code matchOrderBy}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void exitMatchOrderBy(GraqlParser.MatchOrderByContext ctx);
/**
* Enter a parse tree produced by the {@code matchLimit}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void enterMatchLimit(GraqlParser.MatchLimitContext ctx);
/**
* Exit a parse tree produced by the {@code matchLimit}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
*/
void exitMatchLimit(GraqlParser.MatchLimitContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#getQuery}.
* @param ctx the parse tree
*/
void enterGetQuery(GraqlParser.GetQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#getQuery}.
* @param ctx the parse tree
*/
void exitGetQuery(GraqlParser.GetQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#insertQuery}.
* @param ctx the parse tree
*/
void enterInsertQuery(GraqlParser.InsertQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#insertQuery}.
* @param ctx the parse tree
*/
void exitInsertQuery(GraqlParser.InsertQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#defineQuery}.
* @param ctx the parse tree
*/
void enterDefineQuery(GraqlParser.DefineQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#defineQuery}.
* @param ctx the parse tree
*/
void exitDefineQuery(GraqlParser.DefineQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#undefineQuery}.
* @param ctx the parse tree
*/
void enterUndefineQuery(GraqlParser.UndefineQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#undefineQuery}.
* @param ctx the parse tree
*/
void exitUndefineQuery(GraqlParser.UndefineQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#deleteQuery}.
* @param ctx the parse tree
*/
void enterDeleteQuery(GraqlParser.DeleteQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#deleteQuery}.
* @param ctx the parse tree
*/
void exitDeleteQuery(GraqlParser.DeleteQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#aggregateQuery}.
* @param ctx the parse tree
*/
void enterAggregateQuery(GraqlParser.AggregateQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#aggregateQuery}.
* @param ctx the parse tree
*/
void exitAggregateQuery(GraqlParser.AggregateQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#variables}.
* @param ctx the parse tree
*/
void enterVariables(GraqlParser.VariablesContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#variables}.
* @param ctx the parse tree
*/
void exitVariables(GraqlParser.VariablesContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeQuery}.
* @param ctx the parse tree
*/
void enterComputeQuery(GraqlParser.ComputeQueryContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeQuery}.
* @param ctx the parse tree
*/
void exitComputeQuery(GraqlParser.ComputeQueryContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeMethod}.
* @param ctx the parse tree
*/
void enterComputeMethod(GraqlParser.ComputeMethodContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeMethod}.
* @param ctx the parse tree
*/
void exitComputeMethod(GraqlParser.ComputeMethodContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeConditions}.
* @param ctx the parse tree
*/
void enterComputeConditions(GraqlParser.ComputeConditionsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeConditions}.
* @param ctx the parse tree
*/
void exitComputeConditions(GraqlParser.ComputeConditionsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeCondition}.
* @param ctx the parse tree
*/
void enterComputeCondition(GraqlParser.ComputeConditionContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeCondition}.
* @param ctx the parse tree
*/
void exitComputeCondition(GraqlParser.ComputeConditionContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeFromID}.
* @param ctx the parse tree
*/
void enterComputeFromID(GraqlParser.ComputeFromIDContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeFromID}.
* @param ctx the parse tree
*/
void exitComputeFromID(GraqlParser.ComputeFromIDContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeToID}.
* @param ctx the parse tree
*/
void enterComputeToID(GraqlParser.ComputeToIDContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeToID}.
* @param ctx the parse tree
*/
void exitComputeToID(GraqlParser.ComputeToIDContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeOfLabels}.
* @param ctx the parse tree
*/
void enterComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeOfLabels}.
* @param ctx the parse tree
*/
void exitComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeInLabels}.
* @param ctx the parse tree
*/
void enterComputeInLabels(GraqlParser.ComputeInLabelsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeInLabels}.
* @param ctx the parse tree
*/
void exitComputeInLabels(GraqlParser.ComputeInLabelsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeAlgorithm}.
* @param ctx the parse tree
*/
void enterComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeAlgorithm}.
* @param ctx the parse tree
*/
void exitComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeArgs}.
* @param ctx the parse tree
*/
void enterComputeArgs(GraqlParser.ComputeArgsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeArgs}.
* @param ctx the parse tree
*/
void exitComputeArgs(GraqlParser.ComputeArgsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#computeArgsArray}.
* @param ctx the parse tree
*/
void enterComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#computeArgsArray}.
* @param ctx the parse tree
*/
void exitComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx);
/**
* Enter a parse tree produced by the {@code computeArgMinK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void enterComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx);
/**
* Exit a parse tree produced by the {@code computeArgMinK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void exitComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx);
/**
* Enter a parse tree produced by the {@code computeArgK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void enterComputeArgK(GraqlParser.ComputeArgKContext ctx);
/**
* Exit a parse tree produced by the {@code computeArgK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void exitComputeArgK(GraqlParser.ComputeArgKContext ctx);
/**
* Enter a parse tree produced by the {@code computeArgSize}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void enterComputeArgSize(GraqlParser.ComputeArgSizeContext ctx);
/**
* Exit a parse tree produced by the {@code computeArgSize}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void exitComputeArgSize(GraqlParser.ComputeArgSizeContext ctx);
/**
* Enter a parse tree produced by the {@code computeArgContains}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void enterComputeArgContains(GraqlParser.ComputeArgContainsContext ctx);
/**
* Exit a parse tree produced by the {@code computeArgContains}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
*/
void exitComputeArgContains(GraqlParser.ComputeArgContainsContext ctx);
/**
* Enter a parse tree produced by the {@code customAgg}
* labeled alternative in {@link GraqlParser#aggregate}.
* @param ctx the parse tree
*/
void enterCustomAgg(GraqlParser.CustomAggContext ctx);
/**
* Exit a parse tree produced by the {@code customAgg}
* labeled alternative in {@link GraqlParser#aggregate}.
* @param ctx the parse tree
*/
void exitCustomAgg(GraqlParser.CustomAggContext ctx);
/**
* Enter a parse tree produced by the {@code variableArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
*/
void enterVariableArgument(GraqlParser.VariableArgumentContext ctx);
/**
* Exit a parse tree produced by the {@code variableArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
*/
void exitVariableArgument(GraqlParser.VariableArgumentContext ctx);
/**
* Enter a parse tree produced by the {@code aggregateArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
*/
void enterAggregateArgument(GraqlParser.AggregateArgumentContext ctx);
/**
* Exit a parse tree produced by the {@code aggregateArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
*/
void exitAggregateArgument(GraqlParser.AggregateArgumentContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#patterns}.
* @param ctx the parse tree
*/
void enterPatterns(GraqlParser.PatternsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#patterns}.
* @param ctx the parse tree
*/
void exitPatterns(GraqlParser.PatternsContext ctx);
/**
* Enter a parse tree produced by the {@code varPatternCase}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void enterVarPatternCase(GraqlParser.VarPatternCaseContext ctx);
/**
* Exit a parse tree produced by the {@code varPatternCase}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void exitVarPatternCase(GraqlParser.VarPatternCaseContext ctx);
/**
* Enter a parse tree produced by the {@code andPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void enterAndPattern(GraqlParser.AndPatternContext ctx);
/**
* Exit a parse tree produced by the {@code andPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void exitAndPattern(GraqlParser.AndPatternContext ctx);
/**
* Enter a parse tree produced by the {@code orPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void enterOrPattern(GraqlParser.OrPatternContext ctx);
/**
* Exit a parse tree produced by the {@code orPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
*/
void exitOrPattern(GraqlParser.OrPatternContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#varPatterns}.
* @param ctx the parse tree
*/
void enterVarPatterns(GraqlParser.VarPatternsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#varPatterns}.
* @param ctx the parse tree
*/
void exitVarPatterns(GraqlParser.VarPatternsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#varPattern}.
* @param ctx the parse tree
*/
void enterVarPattern(GraqlParser.VarPatternContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#varPattern}.
* @param ctx the parse tree
*/
void exitVarPattern(GraqlParser.VarPatternContext ctx);
/**
* Enter a parse tree produced by the {@code isa}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterIsa(GraqlParser.IsaContext ctx);
/**
* Exit a parse tree produced by the {@code isa}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitIsa(GraqlParser.IsaContext ctx);
/**
* Enter a parse tree produced by the {@code isaExplicit}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterIsaExplicit(GraqlParser.IsaExplicitContext ctx);
/**
* Exit a parse tree produced by the {@code isaExplicit}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitIsaExplicit(GraqlParser.IsaExplicitContext ctx);
/**
* Enter a parse tree produced by the {@code sub}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterSub(GraqlParser.SubContext ctx);
/**
* Exit a parse tree produced by the {@code sub}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitSub(GraqlParser.SubContext ctx);
/**
* Enter a parse tree produced by the {@code relates}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterRelates(GraqlParser.RelatesContext ctx);
/**
* Exit a parse tree produced by the {@code relates}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitRelates(GraqlParser.RelatesContext ctx);
/**
* Enter a parse tree produced by the {@code plays}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPlays(GraqlParser.PlaysContext ctx);
/**
* Exit a parse tree produced by the {@code plays}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPlays(GraqlParser.PlaysContext ctx);
/**
* Enter a parse tree produced by the {@code propId}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropId(GraqlParser.PropIdContext ctx);
/**
* Exit a parse tree produced by the {@code propId}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropId(GraqlParser.PropIdContext ctx);
/**
* Enter a parse tree produced by the {@code propLabel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropLabel(GraqlParser.PropLabelContext ctx);
/**
* Exit a parse tree produced by the {@code propLabel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropLabel(GraqlParser.PropLabelContext ctx);
/**
* Enter a parse tree produced by the {@code propValue}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropValue(GraqlParser.PropValueContext ctx);
/**
* Exit a parse tree produced by the {@code propValue}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropValue(GraqlParser.PropValueContext ctx);
/**
* Enter a parse tree produced by the {@code propWhen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropWhen(GraqlParser.PropWhenContext ctx);
/**
* Exit a parse tree produced by the {@code propWhen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropWhen(GraqlParser.PropWhenContext ctx);
/**
* Enter a parse tree produced by the {@code propThen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropThen(GraqlParser.PropThenContext ctx);
/**
* Exit a parse tree produced by the {@code propThen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropThen(GraqlParser.PropThenContext ctx);
/**
* Enter a parse tree produced by the {@code propHas}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropHas(GraqlParser.PropHasContext ctx);
/**
* Exit a parse tree produced by the {@code propHas}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropHas(GraqlParser.PropHasContext ctx);
/**
* Enter a parse tree produced by the {@code propResource}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropResource(GraqlParser.PropResourceContext ctx);
/**
* Exit a parse tree produced by the {@code propResource}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropResource(GraqlParser.PropResourceContext ctx);
/**
* Enter a parse tree produced by the {@code propKey}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropKey(GraqlParser.PropKeyContext ctx);
/**
* Exit a parse tree produced by the {@code propKey}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropKey(GraqlParser.PropKeyContext ctx);
/**
* Enter a parse tree produced by the {@code propRel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropRel(GraqlParser.PropRelContext ctx);
/**
* Exit a parse tree produced by the {@code propRel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropRel(GraqlParser.PropRelContext ctx);
/**
* Enter a parse tree produced by the {@code isAbstract}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterIsAbstract(GraqlParser.IsAbstractContext ctx);
/**
* Exit a parse tree produced by the {@code isAbstract}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitIsAbstract(GraqlParser.IsAbstractContext ctx);
/**
* Enter a parse tree produced by the {@code propDatatype}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropDatatype(GraqlParser.PropDatatypeContext ctx);
/**
* Exit a parse tree produced by the {@code propDatatype}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropDatatype(GraqlParser.PropDatatypeContext ctx);
/**
* Enter a parse tree produced by the {@code propRegex}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropRegex(GraqlParser.PropRegexContext ctx);
/**
* Exit a parse tree produced by the {@code propRegex}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropRegex(GraqlParser.PropRegexContext ctx);
/**
* Enter a parse tree produced by the {@code propNeq}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void enterPropNeq(GraqlParser.PropNeqContext ctx);
/**
* Exit a parse tree produced by the {@code propNeq}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
*/
void exitPropNeq(GraqlParser.PropNeqContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#casting}.
* @param ctx the parse tree
*/
void enterCasting(GraqlParser.CastingContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#casting}.
* @param ctx the parse tree
*/
void exitCasting(GraqlParser.CastingContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#variable}.
* @param ctx the parse tree
*/
void enterVariable(GraqlParser.VariableContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#variable}.
* @param ctx the parse tree
*/
void exitVariable(GraqlParser.VariableContext ctx);
/**
* Enter a parse tree produced by the {@code predicateEq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateEq(GraqlParser.PredicateEqContext ctx);
/**
* Exit a parse tree produced by the {@code predicateEq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateEq(GraqlParser.PredicateEqContext ctx);
/**
* Enter a parse tree produced by the {@code predicateVariable}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateVariable(GraqlParser.PredicateVariableContext ctx);
/**
* Exit a parse tree produced by the {@code predicateVariable}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateVariable(GraqlParser.PredicateVariableContext ctx);
/**
* Enter a parse tree produced by the {@code predicateNeq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateNeq(GraqlParser.PredicateNeqContext ctx);
/**
* Exit a parse tree produced by the {@code predicateNeq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateNeq(GraqlParser.PredicateNeqContext ctx);
/**
* Enter a parse tree produced by the {@code predicateGt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateGt(GraqlParser.PredicateGtContext ctx);
/**
* Exit a parse tree produced by the {@code predicateGt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateGt(GraqlParser.PredicateGtContext ctx);
/**
* Enter a parse tree produced by the {@code predicateGte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateGte(GraqlParser.PredicateGteContext ctx);
/**
* Exit a parse tree produced by the {@code predicateGte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateGte(GraqlParser.PredicateGteContext ctx);
/**
* Enter a parse tree produced by the {@code predicateLt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateLt(GraqlParser.PredicateLtContext ctx);
/**
* Exit a parse tree produced by the {@code predicateLt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateLt(GraqlParser.PredicateLtContext ctx);
/**
* Enter a parse tree produced by the {@code predicateLte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateLte(GraqlParser.PredicateLteContext ctx);
/**
* Exit a parse tree produced by the {@code predicateLte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateLte(GraqlParser.PredicateLteContext ctx);
/**
* Enter a parse tree produced by the {@code predicateContains}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateContains(GraqlParser.PredicateContainsContext ctx);
/**
* Exit a parse tree produced by the {@code predicateContains}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateContains(GraqlParser.PredicateContainsContext ctx);
/**
* Enter a parse tree produced by the {@code predicateRegex}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void enterPredicateRegex(GraqlParser.PredicateRegexContext ctx);
/**
* Exit a parse tree produced by the {@code predicateRegex}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
*/
void exitPredicateRegex(GraqlParser.PredicateRegexContext ctx);
/**
* Enter a parse tree produced by the {@code valueVariable}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
*/
void enterValueVariable(GraqlParser.ValueVariableContext ctx);
/**
* Exit a parse tree produced by the {@code valueVariable}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
*/
void exitValueVariable(GraqlParser.ValueVariableContext ctx);
/**
* Enter a parse tree produced by the {@code valuePrimitive}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
*/
void enterValuePrimitive(GraqlParser.ValuePrimitiveContext ctx);
/**
* Exit a parse tree produced by the {@code valuePrimitive}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
*/
void exitValuePrimitive(GraqlParser.ValuePrimitiveContext ctx);
/**
* Enter a parse tree produced by the {@code valueString}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueString(GraqlParser.ValueStringContext ctx);
/**
* Exit a parse tree produced by the {@code valueString}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueString(GraqlParser.ValueStringContext ctx);
/**
* Enter a parse tree produced by the {@code valueInteger}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueInteger(GraqlParser.ValueIntegerContext ctx);
/**
* Exit a parse tree produced by the {@code valueInteger}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueInteger(GraqlParser.ValueIntegerContext ctx);
/**
* Enter a parse tree produced by the {@code valueReal}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueReal(GraqlParser.ValueRealContext ctx);
/**
* Exit a parse tree produced by the {@code valueReal}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueReal(GraqlParser.ValueRealContext ctx);
/**
* Enter a parse tree produced by the {@code valueBoolean}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueBoolean(GraqlParser.ValueBooleanContext ctx);
/**
* Exit a parse tree produced by the {@code valueBoolean}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueBoolean(GraqlParser.ValueBooleanContext ctx);
/**
* Enter a parse tree produced by the {@code valueDate}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueDate(GraqlParser.ValueDateContext ctx);
/**
* Exit a parse tree produced by the {@code valueDate}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueDate(GraqlParser.ValueDateContext ctx);
/**
* Enter a parse tree produced by the {@code valueDateTime}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void enterValueDateTime(GraqlParser.ValueDateTimeContext ctx);
/**
* Exit a parse tree produced by the {@code valueDateTime}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
*/
void exitValueDateTime(GraqlParser.ValueDateTimeContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#labels}.
* @param ctx the parse tree
*/
void enterLabels(GraqlParser.LabelsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#labels}.
* @param ctx the parse tree
*/
void exitLabels(GraqlParser.LabelsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#labelsArray}.
* @param ctx the parse tree
*/
void enterLabelsArray(GraqlParser.LabelsArrayContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#labelsArray}.
* @param ctx the parse tree
*/
void exitLabelsArray(GraqlParser.LabelsArrayContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#label}.
* @param ctx the parse tree
*/
void enterLabel(GraqlParser.LabelContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#label}.
* @param ctx the parse tree
*/
void exitLabel(GraqlParser.LabelContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#id}.
* @param ctx the parse tree
*/
void enterId(GraqlParser.IdContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#id}.
* @param ctx the parse tree
*/
void exitId(GraqlParser.IdContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#identifier}.
* @param ctx the parse tree
*/
void enterIdentifier(GraqlParser.IdentifierContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#identifier}.
* @param ctx the parse tree
*/
void exitIdentifier(GraqlParser.IdentifierContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#datatype}.
* @param ctx the parse tree
*/
void enterDatatype(GraqlParser.DatatypeContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#datatype}.
* @param ctx the parse tree
*/
void exitDatatype(GraqlParser.DatatypeContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#order}.
* @param ctx the parse tree
*/
void enterOrder(GraqlParser.OrderContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#order}.
* @param ctx the parse tree
*/
void exitOrder(GraqlParser.OrderContext ctx);
/**
* Enter a parse tree produced by {@link GraqlParser#bool}.
* @param ctx the parse tree
*/
void enterBool(GraqlParser.BoolContext ctx);
/**
* Exit a parse tree produced by {@link GraqlParser#bool}.
* @param ctx the parse tree
*/
void exitBool(GraqlParser.BoolContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlParser.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GraqlParser extends Parser {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38,
T__38=39, T__39=40, T__40=41, MIN=42, MAX=43, MEDIAN=44, MEAN=45, STD=46,
SUM=47, COUNT=48, PATH=49, CLUSTER=50, CENTRALITY=51, FROM=52, TO=53,
OF=54, IN=55, DEGREE=56, K_CORE=57, CONNECTED_COMPONENT=58, MIN_K=59,
K=60, CONTAINS=61, SIZE=62, USING=63, WHERE=64, MATCH=65, INSERT=66, DEFINE=67,
UNDEFINE=68, COMPUTE=69, ASC=70, DESC=71, LONG_TYPE=72, DOUBLE_TYPE=73,
STRING_TYPE=74, BOOLEAN_TYPE=75, DATE_TYPE=76, TRUE=77, FALSE=78, VARIABLE=79,
ID=80, STRING=81, REGEX=82, INTEGER=83, REAL=84, DATE=85, DATETIME=86,
COMMENT=87, IMPLICIT_IDENTIFIER=88, WS=89, DOLLAR=90;
public static final int
RULE_queryList = 0, RULE_queryEOF = 1, RULE_query = 2, RULE_matchPart = 3,
RULE_getQuery = 4, RULE_insertQuery = 5, RULE_defineQuery = 6, RULE_undefineQuery = 7,
RULE_deleteQuery = 8, RULE_aggregateQuery = 9, RULE_variables = 10, RULE_computeQuery = 11,
RULE_computeMethod = 12, RULE_computeConditions = 13, RULE_computeCondition = 14,
RULE_computeFromID = 15, RULE_computeToID = 16, RULE_computeOfLabels = 17,
RULE_computeInLabels = 18, RULE_computeAlgorithm = 19, RULE_computeArgs = 20,
RULE_computeArgsArray = 21, RULE_computeArg = 22, RULE_aggregate = 23,
RULE_argument = 24, RULE_patterns = 25, RULE_pattern = 26, RULE_varPatterns = 27,
RULE_varPattern = 28, RULE_property = 29, RULE_casting = 30, RULE_variable = 31,
RULE_predicate = 32, RULE_valueOrVar = 33, RULE_value = 34, RULE_labels = 35,
RULE_labelsArray = 36, RULE_label = 37, RULE_id = 38, RULE_identifier = 39,
RULE_datatype = 40, RULE_order = 41, RULE_bool = 42;
public static final String[] ruleNames = {
"queryList", "queryEOF", "query", "matchPart", "getQuery", "insertQuery",
"defineQuery", "undefineQuery", "deleteQuery", "aggregateQuery", "variables",
"computeQuery", "computeMethod", "computeConditions", "computeCondition",
"computeFromID", "computeToID", "computeOfLabels", "computeInLabels",
"computeAlgorithm", "computeArgs", "computeArgsArray", "computeArg", "aggregate",
"argument", "patterns", "pattern", "varPatterns", "varPattern", "property",
"casting", "variable", "predicate", "valueOrVar", "value", "labels", "labelsArray",
"label", "id", "identifier", "datatype", "order", "bool"
};
private static final String[] _LITERAL_NAMES = {
null, "'limit'", "';'", "'offset'", "'order'", "'by'", "'get'", "'delete'",
"'aggregate'", "','", "'['", "']'", "'='", "'or'", "'{'", "'}'", "'isa'",
"'isa!'", "'sub'", "'relates'", "'as'", "'plays'", "'id'", "'label'",
"'when'", "'then'", "'has'", "'via'", "'key'", "'('", "')'", "'is-abstract'",
"'datatype'", "'regex'", "'!='", "':'", "'=='", "'!=='", "'>'", "'>='",
"'<'", "'<='", "'min'", "'max'", "'median'", "'mean'", "'std'", "'sum'",
"'count'", "'path'", "'cluster'", "'centrality'", "'from'", "'to'", "'of'",
"'in'", "'degree'", "'k-core'", "'connected-component'", "'min-k'", "'k'",
"'contains'", "'size'", "'using'", "'where'", "'match'", "'insert'", "'define'",
"'undefine'", "'compute'", "'asc'", "'desc'", "'long'", "'double'", "'string'",
"'boolean'", "'date'", "'true'", "'false'", null, null, null, null, null,
null, null, null, null, null, null, "'$'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, "MIN", "MAX", "MEDIAN", "MEAN", "STD",
"SUM", "COUNT", "PATH", "CLUSTER", "CENTRALITY", "FROM", "TO", "OF", "IN",
"DEGREE", "K_CORE", "CONNECTED_COMPONENT", "MIN_K", "K", "CONTAINS", "SIZE",
"USING", "WHERE", "MATCH", "INSERT", "DEFINE", "UNDEFINE", "COMPUTE",
"ASC", "DESC", "LONG_TYPE", "DOUBLE_TYPE", "STRING_TYPE", "BOOLEAN_TYPE",
"DATE_TYPE", "TRUE", "FALSE", "VARIABLE", "ID", "STRING", "REGEX", "INTEGER",
"REAL", "DATE", "DATETIME", "COMMENT", "IMPLICIT_IDENTIFIER", "WS", "DOLLAR"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "Graql.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public GraqlParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class QueryListContext extends ParserRuleContext {
public TerminalNode EOF() { return getToken(GraqlParser.EOF, 0); }
public List<QueryContext> query() {
return getRuleContexts(QueryContext.class);
}
public QueryContext query(int i) {
return getRuleContext(QueryContext.class,i);
}
public QueryListContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_queryList; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterQueryList(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitQueryList(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitQueryList(this);
else return visitor.visitChildren(this);
}
}
public final QueryListContext queryList() throws RecognitionException {
QueryListContext _localctx = new QueryListContext(_ctx, getState());
enterRule(_localctx, 0, RULE_queryList);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(89);
_errHandler.sync(this);
_la = _input.LA(1);
while (((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & ((1L << (MATCH - 65)) | (1L << (INSERT - 65)) | (1L << (DEFINE - 65)) | (1L << (UNDEFINE - 65)) | (1L << (COMPUTE - 65)))) != 0)) {
{
{
setState(86);
query();
}
}
setState(91);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(92);
match(EOF);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class QueryEOFContext extends ParserRuleContext {
public QueryContext query() {
return getRuleContext(QueryContext.class,0);
}
public TerminalNode EOF() { return getToken(GraqlParser.EOF, 0); }
public QueryEOFContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_queryEOF; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterQueryEOF(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitQueryEOF(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitQueryEOF(this);
else return visitor.visitChildren(this);
}
}
public final QueryEOFContext queryEOF() throws RecognitionException {
QueryEOFContext _localctx = new QueryEOFContext(_ctx, getState());
enterRule(_localctx, 2, RULE_queryEOF);
try {
enterOuterAlt(_localctx, 1);
{
setState(94);
query();
setState(95);
match(EOF);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class QueryContext extends ParserRuleContext {
public GetQueryContext getQuery() {
return getRuleContext(GetQueryContext.class,0);
}
public InsertQueryContext insertQuery() {
return getRuleContext(InsertQueryContext.class,0);
}
public DefineQueryContext defineQuery() {
return getRuleContext(DefineQueryContext.class,0);
}
public UndefineQueryContext undefineQuery() {
return getRuleContext(UndefineQueryContext.class,0);
}
public DeleteQueryContext deleteQuery() {
return getRuleContext(DeleteQueryContext.class,0);
}
public AggregateQueryContext aggregateQuery() {
return getRuleContext(AggregateQueryContext.class,0);
}
public ComputeQueryContext computeQuery() {
return getRuleContext(ComputeQueryContext.class,0);
}
public QueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_query; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitQuery(this);
else return visitor.visitChildren(this);
}
}
public final QueryContext query() throws RecognitionException {
QueryContext _localctx = new QueryContext(_ctx, getState());
enterRule(_localctx, 4, RULE_query);
try {
setState(104);
switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(97);
getQuery();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(98);
insertQuery();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(99);
defineQuery();
}
break;
case 4:
enterOuterAlt(_localctx, 4);
{
setState(100);
undefineQuery();
}
break;
case 5:
enterOuterAlt(_localctx, 5);
{
setState(101);
deleteQuery();
}
break;
case 6:
enterOuterAlt(_localctx, 6);
{
setState(102);
aggregateQuery();
}
break;
case 7:
enterOuterAlt(_localctx, 7);
{
setState(103);
computeQuery();
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class MatchPartContext extends ParserRuleContext {
public MatchPartContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_matchPart; }
public MatchPartContext() { }
public void copyFrom(MatchPartContext ctx) {
super.copyFrom(ctx);
}
}
public static class MatchBaseContext extends MatchPartContext {
public TerminalNode MATCH() { return getToken(GraqlParser.MATCH, 0); }
public PatternsContext patterns() {
return getRuleContext(PatternsContext.class,0);
}
public MatchBaseContext(MatchPartContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterMatchBase(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitMatchBase(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitMatchBase(this);
else return visitor.visitChildren(this);
}
}
public static class MatchOffsetContext extends MatchPartContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public MatchOffsetContext(MatchPartContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterMatchOffset(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitMatchOffset(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitMatchOffset(this);
else return visitor.visitChildren(this);
}
}
public static class MatchOrderByContext extends MatchPartContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public OrderContext order() {
return getRuleContext(OrderContext.class,0);
}
public MatchOrderByContext(MatchPartContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterMatchOrderBy(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitMatchOrderBy(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitMatchOrderBy(this);
else return visitor.visitChildren(this);
}
}
public static class MatchLimitContext extends MatchPartContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public MatchLimitContext(MatchPartContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterMatchLimit(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitMatchLimit(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitMatchLimit(this);
else return visitor.visitChildren(this);
}
}
public final MatchPartContext matchPart() throws RecognitionException {
return matchPart(0);
}
private MatchPartContext matchPart(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
MatchPartContext _localctx = new MatchPartContext(_ctx, _parentState);
MatchPartContext _prevctx = _localctx;
int _startState = 6;
enterRecursionRule(_localctx, 6, RULE_matchPart, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
_localctx = new MatchBaseContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(107);
match(MATCH);
setState(108);
patterns();
}
_ctx.stop = _input.LT(-1);
setState(128);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,4,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(126);
switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
case 1:
{
_localctx = new MatchLimitContext(new MatchPartContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_matchPart);
setState(110);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(111);
match(T__0);
setState(112);
match(INTEGER);
setState(113);
match(T__1);
}
break;
case 2:
{
_localctx = new MatchOffsetContext(new MatchPartContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_matchPart);
setState(114);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(115);
match(T__2);
setState(116);
match(INTEGER);
setState(117);
match(T__1);
}
break;
case 3:
{
_localctx = new MatchOrderByContext(new MatchPartContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_matchPart);
setState(118);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(119);
match(T__3);
setState(120);
match(T__4);
setState(121);
match(VARIABLE);
setState(123);
_la = _input.LA(1);
if (_la==ASC || _la==DESC) {
{
setState(122);
order();
}
}
setState(125);
match(T__1);
}
break;
}
}
}
setState(130);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,4,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class GetQueryContext extends ParserRuleContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public VariablesContext variables() {
return getRuleContext(VariablesContext.class,0);
}
public GetQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_getQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterGetQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitGetQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitGetQuery(this);
else return visitor.visitChildren(this);
}
}
public final GetQueryContext getQuery() throws RecognitionException {
GetQueryContext _localctx = new GetQueryContext(_ctx, getState());
enterRule(_localctx, 8, RULE_getQuery);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(131);
matchPart(0);
setState(132);
match(T__5);
setState(134);
_la = _input.LA(1);
if (_la==VARIABLE) {
{
setState(133);
variables();
}
}
setState(136);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class InsertQueryContext extends ParserRuleContext {
public TerminalNode INSERT() { return getToken(GraqlParser.INSERT, 0); }
public VarPatternsContext varPatterns() {
return getRuleContext(VarPatternsContext.class,0);
}
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public InsertQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_insertQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterInsertQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitInsertQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitInsertQuery(this);
else return visitor.visitChildren(this);
}
}
public final InsertQueryContext insertQuery() throws RecognitionException {
InsertQueryContext _localctx = new InsertQueryContext(_ctx, getState());
enterRule(_localctx, 10, RULE_insertQuery);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(139);
_la = _input.LA(1);
if (_la==MATCH) {
{
setState(138);
matchPart(0);
}
}
setState(141);
match(INSERT);
setState(142);
varPatterns();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DefineQueryContext extends ParserRuleContext {
public TerminalNode DEFINE() { return getToken(GraqlParser.DEFINE, 0); }
public VarPatternsContext varPatterns() {
return getRuleContext(VarPatternsContext.class,0);
}
public DefineQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_defineQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterDefineQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitDefineQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitDefineQuery(this);
else return visitor.visitChildren(this);
}
}
public final DefineQueryContext defineQuery() throws RecognitionException {
DefineQueryContext _localctx = new DefineQueryContext(_ctx, getState());
enterRule(_localctx, 12, RULE_defineQuery);
try {
enterOuterAlt(_localctx, 1);
{
setState(144);
match(DEFINE);
setState(145);
varPatterns();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class UndefineQueryContext extends ParserRuleContext {
public TerminalNode UNDEFINE() { return getToken(GraqlParser.UNDEFINE, 0); }
public VarPatternsContext varPatterns() {
return getRuleContext(VarPatternsContext.class,0);
}
public UndefineQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_undefineQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterUndefineQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitUndefineQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitUndefineQuery(this);
else return visitor.visitChildren(this);
}
}
public final UndefineQueryContext undefineQuery() throws RecognitionException {
UndefineQueryContext _localctx = new UndefineQueryContext(_ctx, getState());
enterRule(_localctx, 14, RULE_undefineQuery);
try {
enterOuterAlt(_localctx, 1);
{
setState(147);
match(UNDEFINE);
setState(148);
varPatterns();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DeleteQueryContext extends ParserRuleContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public VariablesContext variables() {
return getRuleContext(VariablesContext.class,0);
}
public DeleteQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_deleteQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterDeleteQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitDeleteQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitDeleteQuery(this);
else return visitor.visitChildren(this);
}
}
public final DeleteQueryContext deleteQuery() throws RecognitionException {
DeleteQueryContext _localctx = new DeleteQueryContext(_ctx, getState());
enterRule(_localctx, 16, RULE_deleteQuery);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(150);
matchPart(0);
setState(151);
match(T__6);
setState(153);
_la = _input.LA(1);
if (_la==VARIABLE) {
{
setState(152);
variables();
}
}
setState(155);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AggregateQueryContext extends ParserRuleContext {
public MatchPartContext matchPart() {
return getRuleContext(MatchPartContext.class,0);
}
public AggregateContext aggregate() {
return getRuleContext(AggregateContext.class,0);
}
public AggregateQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_aggregateQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterAggregateQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitAggregateQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitAggregateQuery(this);
else return visitor.visitChildren(this);
}
}
public final AggregateQueryContext aggregateQuery() throws RecognitionException {
AggregateQueryContext _localctx = new AggregateQueryContext(_ctx, getState());
enterRule(_localctx, 18, RULE_aggregateQuery);
try {
enterOuterAlt(_localctx, 1);
{
setState(157);
matchPart(0);
setState(158);
match(T__7);
setState(159);
aggregate();
setState(160);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VariablesContext extends ParserRuleContext {
public List<TerminalNode> VARIABLE() { return getTokens(GraqlParser.VARIABLE); }
public TerminalNode VARIABLE(int i) {
return getToken(GraqlParser.VARIABLE, i);
}
public VariablesContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_variables; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVariables(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVariables(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVariables(this);
else return visitor.visitChildren(this);
}
}
public final VariablesContext variables() throws RecognitionException {
VariablesContext _localctx = new VariablesContext(_ctx, getState());
enterRule(_localctx, 20, RULE_variables);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(162);
match(VARIABLE);
setState(167);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__8) {
{
{
setState(163);
match(T__8);
setState(164);
match(VARIABLE);
}
}
setState(169);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeQueryContext extends ParserRuleContext {
public TerminalNode COMPUTE() { return getToken(GraqlParser.COMPUTE, 0); }
public ComputeMethodContext computeMethod() {
return getRuleContext(ComputeMethodContext.class,0);
}
public ComputeConditionsContext computeConditions() {
return getRuleContext(ComputeConditionsContext.class,0);
}
public ComputeQueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeQuery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeQuery(this);
else return visitor.visitChildren(this);
}
}
public final ComputeQueryContext computeQuery() throws RecognitionException {
ComputeQueryContext _localctx = new ComputeQueryContext(_ctx, getState());
enterRule(_localctx, 22, RULE_computeQuery);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(170);
match(COMPUTE);
setState(171);
computeMethod();
setState(173);
_la = _input.LA(1);
if (((((_la - 52)) & ~0x3f) == 0 && ((1L << (_la - 52)) & ((1L << (FROM - 52)) | (1L << (TO - 52)) | (1L << (OF - 52)) | (1L << (IN - 52)) | (1L << (USING - 52)) | (1L << (WHERE - 52)))) != 0)) {
{
setState(172);
computeConditions();
}
}
setState(175);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeMethodContext extends ParserRuleContext {
public TerminalNode COUNT() { return getToken(GraqlParser.COUNT, 0); }
public TerminalNode MIN() { return getToken(GraqlParser.MIN, 0); }
public TerminalNode MAX() { return getToken(GraqlParser.MAX, 0); }
public TerminalNode MEDIAN() { return getToken(GraqlParser.MEDIAN, 0); }
public TerminalNode MEAN() { return getToken(GraqlParser.MEAN, 0); }
public TerminalNode STD() { return getToken(GraqlParser.STD, 0); }
public TerminalNode SUM() { return getToken(GraqlParser.SUM, 0); }
public TerminalNode PATH() { return getToken(GraqlParser.PATH, 0); }
public TerminalNode CENTRALITY() { return getToken(GraqlParser.CENTRALITY, 0); }
public TerminalNode CLUSTER() { return getToken(GraqlParser.CLUSTER, 0); }
public ComputeMethodContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeMethod; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeMethod(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeMethod(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeMethod(this);
else return visitor.visitChildren(this);
}
}
public final ComputeMethodContext computeMethod() throws RecognitionException {
ComputeMethodContext _localctx = new ComputeMethodContext(_ctx, getState());
enterRule(_localctx, 24, RULE_computeMethod);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(177);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MIN) | (1L << MAX) | (1L << MEDIAN) | (1L << MEAN) | (1L << STD) | (1L << SUM) | (1L << COUNT) | (1L << PATH) | (1L << CLUSTER) | (1L << CENTRALITY))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeConditionsContext extends ParserRuleContext {
public List<ComputeConditionContext> computeCondition() {
return getRuleContexts(ComputeConditionContext.class);
}
public ComputeConditionContext computeCondition(int i) {
return getRuleContext(ComputeConditionContext.class,i);
}
public ComputeConditionsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeConditions; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeConditions(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeConditions(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeConditions(this);
else return visitor.visitChildren(this);
}
}
public final ComputeConditionsContext computeConditions() throws RecognitionException {
ComputeConditionsContext _localctx = new ComputeConditionsContext(_ctx, getState());
enterRule(_localctx, 26, RULE_computeConditions);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(179);
computeCondition();
setState(184);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__8) {
{
{
setState(180);
match(T__8);
setState(181);
computeCondition();
}
}
setState(186);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeConditionContext extends ParserRuleContext {
public TerminalNode FROM() { return getToken(GraqlParser.FROM, 0); }
public ComputeFromIDContext computeFromID() {
return getRuleContext(ComputeFromIDContext.class,0);
}
public TerminalNode TO() { return getToken(GraqlParser.TO, 0); }
public ComputeToIDContext computeToID() {
return getRuleContext(ComputeToIDContext.class,0);
}
public TerminalNode OF() { return getToken(GraqlParser.OF, 0); }
public ComputeOfLabelsContext computeOfLabels() {
return getRuleContext(ComputeOfLabelsContext.class,0);
}
public TerminalNode IN() { return getToken(GraqlParser.IN, 0); }
public ComputeInLabelsContext computeInLabels() {
return getRuleContext(ComputeInLabelsContext.class,0);
}
public TerminalNode USING() { return getToken(GraqlParser.USING, 0); }
public ComputeAlgorithmContext computeAlgorithm() {
return getRuleContext(ComputeAlgorithmContext.class,0);
}
public TerminalNode WHERE() { return getToken(GraqlParser.WHERE, 0); }
public ComputeArgsContext computeArgs() {
return getRuleContext(ComputeArgsContext.class,0);
}
public ComputeConditionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeCondition; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeCondition(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeCondition(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeCondition(this);
else return visitor.visitChildren(this);
}
}
public final ComputeConditionContext computeCondition() throws RecognitionException {
ComputeConditionContext _localctx = new ComputeConditionContext(_ctx, getState());
enterRule(_localctx, 28, RULE_computeCondition);
try {
setState(199);
switch (_input.LA(1)) {
case FROM:
enterOuterAlt(_localctx, 1);
{
setState(187);
match(FROM);
setState(188);
computeFromID();
}
break;
case TO:
enterOuterAlt(_localctx, 2);
{
setState(189);
match(TO);
setState(190);
computeToID();
}
break;
case OF:
enterOuterAlt(_localctx, 3);
{
setState(191);
match(OF);
setState(192);
computeOfLabels();
}
break;
case IN:
enterOuterAlt(_localctx, 4);
{
setState(193);
match(IN);
setState(194);
computeInLabels();
}
break;
case USING:
enterOuterAlt(_localctx, 5);
{
setState(195);
match(USING);
setState(196);
computeAlgorithm();
}
break;
case WHERE:
enterOuterAlt(_localctx, 6);
{
setState(197);
match(WHERE);
setState(198);
computeArgs();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeFromIDContext extends ParserRuleContext {
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public ComputeFromIDContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeFromID; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeFromID(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeFromID(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeFromID(this);
else return visitor.visitChildren(this);
}
}
public final ComputeFromIDContext computeFromID() throws RecognitionException {
ComputeFromIDContext _localctx = new ComputeFromIDContext(_ctx, getState());
enterRule(_localctx, 30, RULE_computeFromID);
try {
enterOuterAlt(_localctx, 1);
{
setState(201);
id();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeToIDContext extends ParserRuleContext {
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public ComputeToIDContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeToID; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeToID(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeToID(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeToID(this);
else return visitor.visitChildren(this);
}
}
public final ComputeToIDContext computeToID() throws RecognitionException {
ComputeToIDContext _localctx = new ComputeToIDContext(_ctx, getState());
enterRule(_localctx, 32, RULE_computeToID);
try {
enterOuterAlt(_localctx, 1);
{
setState(203);
id();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeOfLabelsContext extends ParserRuleContext {
public LabelsContext labels() {
return getRuleContext(LabelsContext.class,0);
}
public ComputeOfLabelsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeOfLabels; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeOfLabels(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeOfLabels(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeOfLabels(this);
else return visitor.visitChildren(this);
}
}
public final ComputeOfLabelsContext computeOfLabels() throws RecognitionException {
ComputeOfLabelsContext _localctx = new ComputeOfLabelsContext(_ctx, getState());
enterRule(_localctx, 34, RULE_computeOfLabels);
try {
enterOuterAlt(_localctx, 1);
{
setState(205);
labels();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeInLabelsContext extends ParserRuleContext {
public LabelsContext labels() {
return getRuleContext(LabelsContext.class,0);
}
public ComputeInLabelsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeInLabels; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeInLabels(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeInLabels(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeInLabels(this);
else return visitor.visitChildren(this);
}
}
public final ComputeInLabelsContext computeInLabels() throws RecognitionException {
ComputeInLabelsContext _localctx = new ComputeInLabelsContext(_ctx, getState());
enterRule(_localctx, 36, RULE_computeInLabels);
try {
enterOuterAlt(_localctx, 1);
{
setState(207);
labels();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeAlgorithmContext extends ParserRuleContext {
public TerminalNode DEGREE() { return getToken(GraqlParser.DEGREE, 0); }
public TerminalNode K_CORE() { return getToken(GraqlParser.K_CORE, 0); }
public TerminalNode CONNECTED_COMPONENT() { return getToken(GraqlParser.CONNECTED_COMPONENT, 0); }
public ComputeAlgorithmContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeAlgorithm; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeAlgorithm(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeAlgorithm(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeAlgorithm(this);
else return visitor.visitChildren(this);
}
}
public final ComputeAlgorithmContext computeAlgorithm() throws RecognitionException {
ComputeAlgorithmContext _localctx = new ComputeAlgorithmContext(_ctx, getState());
enterRule(_localctx, 38, RULE_computeAlgorithm);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(209);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << DEGREE) | (1L << K_CORE) | (1L << CONNECTED_COMPONENT))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeArgsContext extends ParserRuleContext {
public ComputeArgsArrayContext computeArgsArray() {
return getRuleContext(ComputeArgsArrayContext.class,0);
}
public ComputeArgContext computeArg() {
return getRuleContext(ComputeArgContext.class,0);
}
public ComputeArgsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeArgs; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgs(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgs(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgs(this);
else return visitor.visitChildren(this);
}
}
public final ComputeArgsContext computeArgs() throws RecognitionException {
ComputeArgsContext _localctx = new ComputeArgsContext(_ctx, getState());
enterRule(_localctx, 40, RULE_computeArgs);
try {
setState(213);
switch (_input.LA(1)) {
case T__9:
enterOuterAlt(_localctx, 1);
{
setState(211);
computeArgsArray();
}
break;
case MIN_K:
case K:
case CONTAINS:
case SIZE:
enterOuterAlt(_localctx, 2);
{
setState(212);
computeArg();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeArgsArrayContext extends ParserRuleContext {
public List<ComputeArgContext> computeArg() {
return getRuleContexts(ComputeArgContext.class);
}
public ComputeArgContext computeArg(int i) {
return getRuleContext(ComputeArgContext.class,i);
}
public ComputeArgsArrayContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeArgsArray; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgsArray(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgsArray(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgsArray(this);
else return visitor.visitChildren(this);
}
}
public final ComputeArgsArrayContext computeArgsArray() throws RecognitionException {
ComputeArgsArrayContext _localctx = new ComputeArgsArrayContext(_ctx, getState());
enterRule(_localctx, 42, RULE_computeArgsArray);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(215);
match(T__9);
setState(216);
computeArg();
setState(221);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__8) {
{
{
setState(217);
match(T__8);
setState(218);
computeArg();
}
}
setState(223);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(224);
match(T__10);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComputeArgContext extends ParserRuleContext {
public ComputeArgContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_computeArg; }
public ComputeArgContext() { }
public void copyFrom(ComputeArgContext ctx) {
super.copyFrom(ctx);
}
}
public static class ComputeArgSizeContext extends ComputeArgContext {
public TerminalNode SIZE() { return getToken(GraqlParser.SIZE, 0); }
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public ComputeArgSizeContext(ComputeArgContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgSize(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgSize(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgSize(this);
else return visitor.visitChildren(this);
}
}
public static class ComputeArgMinKContext extends ComputeArgContext {
public TerminalNode MIN_K() { return getToken(GraqlParser.MIN_K, 0); }
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public ComputeArgMinKContext(ComputeArgContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgMinK(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgMinK(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgMinK(this);
else return visitor.visitChildren(this);
}
}
public static class ComputeArgKContext extends ComputeArgContext {
public TerminalNode K() { return getToken(GraqlParser.K, 0); }
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public ComputeArgKContext(ComputeArgContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgK(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgK(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgK(this);
else return visitor.visitChildren(this);
}
}
public static class ComputeArgContainsContext extends ComputeArgContext {
public TerminalNode CONTAINS() { return getToken(GraqlParser.CONTAINS, 0); }
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public ComputeArgContainsContext(ComputeArgContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterComputeArgContains(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitComputeArgContains(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitComputeArgContains(this);
else return visitor.visitChildren(this);
}
}
public final ComputeArgContext computeArg() throws RecognitionException {
ComputeArgContext _localctx = new ComputeArgContext(_ctx, getState());
enterRule(_localctx, 44, RULE_computeArg);
try {
setState(238);
switch (_input.LA(1)) {
case MIN_K:
_localctx = new ComputeArgMinKContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(226);
match(MIN_K);
setState(227);
match(T__11);
setState(228);
match(INTEGER);
}
break;
case K:
_localctx = new ComputeArgKContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(229);
match(K);
setState(230);
match(T__11);
setState(231);
match(INTEGER);
}
break;
case SIZE:
_localctx = new ComputeArgSizeContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(232);
match(SIZE);
setState(233);
match(T__11);
setState(234);
match(INTEGER);
}
break;
case CONTAINS:
_localctx = new ComputeArgContainsContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(235);
match(CONTAINS);
setState(236);
match(T__11);
setState(237);
id();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AggregateContext extends ParserRuleContext {
public AggregateContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_aggregate; }
public AggregateContext() { }
public void copyFrom(AggregateContext ctx) {
super.copyFrom(ctx);
}
}
public static class CustomAggContext extends AggregateContext {
public IdentifierContext identifier() {
return getRuleContext(IdentifierContext.class,0);
}
public List<ArgumentContext> argument() {
return getRuleContexts(ArgumentContext.class);
}
public ArgumentContext argument(int i) {
return getRuleContext(ArgumentContext.class,i);
}
public CustomAggContext(AggregateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterCustomAgg(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitCustomAgg(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitCustomAgg(this);
else return visitor.visitChildren(this);
}
}
public final AggregateContext aggregate() throws RecognitionException {
AggregateContext _localctx = new AggregateContext(_ctx, getState());
enterRule(_localctx, 46, RULE_aggregate);
try {
int _alt;
_localctx = new CustomAggContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(240);
identifier();
setState(244);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,15,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(241);
argument();
}
}
}
setState(246);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,15,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ArgumentContext extends ParserRuleContext {
public ArgumentContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_argument; }
public ArgumentContext() { }
public void copyFrom(ArgumentContext ctx) {
super.copyFrom(ctx);
}
}
public static class AggregateArgumentContext extends ArgumentContext {
public AggregateContext aggregate() {
return getRuleContext(AggregateContext.class,0);
}
public AggregateArgumentContext(ArgumentContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterAggregateArgument(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitAggregateArgument(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitAggregateArgument(this);
else return visitor.visitChildren(this);
}
}
public static class VariableArgumentContext extends ArgumentContext {
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public VariableArgumentContext(ArgumentContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVariableArgument(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVariableArgument(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVariableArgument(this);
else return visitor.visitChildren(this);
}
}
public final ArgumentContext argument() throws RecognitionException {
ArgumentContext _localctx = new ArgumentContext(_ctx, getState());
enterRule(_localctx, 48, RULE_argument);
try {
setState(249);
switch (_input.LA(1)) {
case VARIABLE:
_localctx = new VariableArgumentContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(247);
match(VARIABLE);
}
break;
case MIN:
case MAX:
case MEDIAN:
case MEAN:
case STD:
case SUM:
case COUNT:
case PATH:
case CLUSTER:
case FROM:
case TO:
case OF:
case IN:
case DEGREE:
case K_CORE:
case CONNECTED_COMPONENT:
case MIN_K:
case K:
case CONTAINS:
case SIZE:
case WHERE:
case ID:
case STRING:
_localctx = new AggregateArgumentContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(248);
aggregate();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PatternsContext extends ParserRuleContext {
public List<PatternContext> pattern() {
return getRuleContexts(PatternContext.class);
}
public PatternContext pattern(int i) {
return getRuleContext(PatternContext.class,i);
}
public PatternsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_patterns; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPatterns(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPatterns(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPatterns(this);
else return visitor.visitChildren(this);
}
}
public final PatternsContext patterns() throws RecognitionException {
PatternsContext _localctx = new PatternsContext(_ctx, getState());
enterRule(_localctx, 50, RULE_patterns);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(254);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
setState(251);
pattern(0);
setState(252);
match(T__1);
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(256);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PatternContext extends ParserRuleContext {
public PatternContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_pattern; }
public PatternContext() { }
public void copyFrom(PatternContext ctx) {
super.copyFrom(ctx);
}
}
public static class VarPatternCaseContext extends PatternContext {
public VarPatternContext varPattern() {
return getRuleContext(VarPatternContext.class,0);
}
public VarPatternCaseContext(PatternContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVarPatternCase(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVarPatternCase(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVarPatternCase(this);
else return visitor.visitChildren(this);
}
}
public static class AndPatternContext extends PatternContext {
public PatternsContext patterns() {
return getRuleContext(PatternsContext.class,0);
}
public AndPatternContext(PatternContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterAndPattern(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitAndPattern(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitAndPattern(this);
else return visitor.visitChildren(this);
}
}
public static class OrPatternContext extends PatternContext {
public List<PatternContext> pattern() {
return getRuleContexts(PatternContext.class);
}
public PatternContext pattern(int i) {
return getRuleContext(PatternContext.class,i);
}
public OrPatternContext(PatternContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterOrPattern(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitOrPattern(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitOrPattern(this);
else return visitor.visitChildren(this);
}
}
public final PatternContext pattern() throws RecognitionException {
return pattern(0);
}
private PatternContext pattern(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
PatternContext _localctx = new PatternContext(_ctx, _parentState);
PatternContext _prevctx = _localctx;
int _startState = 52;
enterRecursionRule(_localctx, 52, RULE_pattern, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(264);
switch (_input.LA(1)) {
case T__15:
case T__16:
case T__17:
case T__18:
case T__20:
case T__21:
case T__22:
case T__23:
case T__24:
case T__25:
case T__27:
case T__28:
case T__30:
case T__31:
case T__32:
case T__33:
case T__35:
case T__36:
case T__37:
case T__38:
case T__39:
case T__40:
case MIN:
case MAX:
case MEDIAN:
case MEAN:
case STD:
case SUM:
case COUNT:
case PATH:
case CLUSTER:
case FROM:
case TO:
case OF:
case IN:
case DEGREE:
case K_CORE:
case CONNECTED_COMPONENT:
case MIN_K:
case K:
case CONTAINS:
case SIZE:
case WHERE:
case TRUE:
case FALSE:
case VARIABLE:
case ID:
case STRING:
case REGEX:
case INTEGER:
case REAL:
case DATE:
case DATETIME:
case IMPLICIT_IDENTIFIER:
{
_localctx = new VarPatternCaseContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(259);
varPattern();
}
break;
case T__13:
{
_localctx = new AndPatternContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(260);
match(T__13);
setState(261);
patterns();
setState(262);
match(T__14);
}
break;
default:
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
setState(271);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,19,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new OrPatternContext(new PatternContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_pattern);
setState(266);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(267);
match(T__12);
setState(268);
pattern(3);
}
}
}
setState(273);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,19,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class VarPatternsContext extends ParserRuleContext {
public List<VarPatternContext> varPattern() {
return getRuleContexts(VarPatternContext.class);
}
public VarPatternContext varPattern(int i) {
return getRuleContext(VarPatternContext.class,i);
}
public VarPatternsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_varPatterns; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVarPatterns(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVarPatterns(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVarPatterns(this);
else return visitor.visitChildren(this);
}
}
public final VarPatternsContext varPatterns() throws RecognitionException {
VarPatternsContext _localctx = new VarPatternsContext(_ctx, getState());
enterRule(_localctx, 54, RULE_varPatterns);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(277);
_errHandler.sync(this);
_la = _input.LA(1);
do {
{
{
setState(274);
varPattern();
setState(275);
match(T__1);
}
}
setState(279);
_errHandler.sync(this);
_la = _input.LA(1);
} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__15) | (1L << T__16) | (1L << T__17) | (1L << T__18) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24) | (1L << T__25) | (1L << T__27) | (1L << T__28) | (1L << T__30) | (1L << T__31) | (1L << T__32) | (1L << T__33) | (1L << T__35) | (1L << T__36) | (1L << T__37) | (1L << T__38) | (1L << T__39) | (1L << T__40) | (1L << MIN) | (1L << MAX) | (1L << MEDIAN) | (1L << MEAN) | (1L << STD) | (1L << SUM) | (1L << COUNT) | (1L << PATH) | (1L << CLUSTER) | (1L << FROM) | (1L << TO) | (1L << OF) | (1L << IN) | (1L << DEGREE) | (1L << K_CORE) | (1L << CONNECTED_COMPONENT) | (1L << MIN_K) | (1L << K) | (1L << CONTAINS) | (1L << SIZE))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (WHERE - 64)) | (1L << (TRUE - 64)) | (1L << (FALSE - 64)) | (1L << (VARIABLE - 64)) | (1L << (ID - 64)) | (1L << (STRING - 64)) | (1L << (REGEX - 64)) | (1L << (INTEGER - 64)) | (1L << (REAL - 64)) | (1L << (DATE - 64)) | (1L << (DATETIME - 64)) | (1L << (IMPLICIT_IDENTIFIER - 64)))) != 0) );
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VarPatternContext extends ParserRuleContext {
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public List<PropertyContext> property() {
return getRuleContexts(PropertyContext.class);
}
public PropertyContext property(int i) {
return getRuleContext(PropertyContext.class,i);
}
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public VarPatternContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_varPattern; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVarPattern(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVarPattern(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVarPattern(this);
else return visitor.visitChildren(this);
}
}
public final VarPatternContext varPattern() throws RecognitionException {
VarPatternContext _localctx = new VarPatternContext(_ctx, getState());
enterRule(_localctx, 56, RULE_varPattern);
int _la;
try {
int _alt;
setState(295);
switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(281);
match(VARIABLE);
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(283);
switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) {
case 1:
{
setState(282);
variable();
}
break;
}
setState(285);
property();
setState(292);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,23,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(287);
_la = _input.LA(1);
if (_la==T__8) {
{
setState(286);
match(T__8);
}
}
setState(289);
property();
}
}
}
setState(294);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,23,_ctx);
}
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PropertyContext extends ParserRuleContext {
public PropertyContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_property; }
public PropertyContext() { }
public void copyFrom(PropertyContext ctx) {
super.copyFrom(ctx);
}
}
public static class SubContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public SubContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterSub(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitSub(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitSub(this);
else return visitor.visitChildren(this);
}
}
public static class PlaysContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public PlaysContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPlays(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPlays(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPlays(this);
else return visitor.visitChildren(this);
}
}
public static class PropDatatypeContext extends PropertyContext {
public DatatypeContext datatype() {
return getRuleContext(DatatypeContext.class,0);
}
public PropDatatypeContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropDatatype(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropDatatype(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropDatatype(this);
else return visitor.visitChildren(this);
}
}
public static class PropRelContext extends PropertyContext {
public List<CastingContext> casting() {
return getRuleContexts(CastingContext.class);
}
public CastingContext casting(int i) {
return getRuleContext(CastingContext.class,i);
}
public PropRelContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropRel(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropRel(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropRel(this);
else return visitor.visitChildren(this);
}
}
public static class RelatesContext extends PropertyContext {
public VariableContext role;
public VariableContext superRole;
public List<VariableContext> variable() {
return getRuleContexts(VariableContext.class);
}
public VariableContext variable(int i) {
return getRuleContext(VariableContext.class,i);
}
public RelatesContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterRelates(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitRelates(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitRelates(this);
else return visitor.visitChildren(this);
}
}
public static class PropThenContext extends PropertyContext {
public VarPatternsContext varPatterns() {
return getRuleContext(VarPatternsContext.class,0);
}
public PropThenContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropThen(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropThen(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropThen(this);
else return visitor.visitChildren(this);
}
}
public static class PropHasContext extends PropertyContext {
public Token resource;
public Token relation;
public LabelContext label() {
return getRuleContext(LabelContext.class,0);
}
public PredicateContext predicate() {
return getRuleContext(PredicateContext.class,0);
}
public List<TerminalNode> VARIABLE() { return getTokens(GraqlParser.VARIABLE); }
public TerminalNode VARIABLE(int i) {
return getToken(GraqlParser.VARIABLE, i);
}
public PropHasContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropHas(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropHas(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropHas(this);
else return visitor.visitChildren(this);
}
}
public static class PropNeqContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public PropNeqContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropNeq(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropNeq(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropNeq(this);
else return visitor.visitChildren(this);
}
}
public static class PropIdContext extends PropertyContext {
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public PropIdContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropId(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropId(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropId(this);
else return visitor.visitChildren(this);
}
}
public static class IsAbstractContext extends PropertyContext {
public IsAbstractContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterIsAbstract(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitIsAbstract(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitIsAbstract(this);
else return visitor.visitChildren(this);
}
}
public static class PropKeyContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public PropKeyContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropKey(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropKey(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropKey(this);
else return visitor.visitChildren(this);
}
}
public static class PropResourceContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public PropResourceContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropResource(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropResource(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropResource(this);
else return visitor.visitChildren(this);
}
}
public static class PropLabelContext extends PropertyContext {
public LabelContext label() {
return getRuleContext(LabelContext.class,0);
}
public PropLabelContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropLabel(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropLabel(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropLabel(this);
else return visitor.visitChildren(this);
}
}
public static class IsaContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public IsaContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterIsa(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitIsa(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitIsa(this);
else return visitor.visitChildren(this);
}
}
public static class PropRegexContext extends PropertyContext {
public TerminalNode REGEX() { return getToken(GraqlParser.REGEX, 0); }
public PropRegexContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropRegex(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropRegex(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropRegex(this);
else return visitor.visitChildren(this);
}
}
public static class PropWhenContext extends PropertyContext {
public PatternsContext patterns() {
return getRuleContext(PatternsContext.class,0);
}
public PropWhenContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropWhen(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropWhen(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropWhen(this);
else return visitor.visitChildren(this);
}
}
public static class IsaExplicitContext extends PropertyContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public IsaExplicitContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterIsaExplicit(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitIsaExplicit(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitIsaExplicit(this);
else return visitor.visitChildren(this);
}
}
public static class PropValueContext extends PropertyContext {
public PredicateContext predicate() {
return getRuleContext(PredicateContext.class,0);
}
public PropValueContext(PropertyContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPropValue(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPropValue(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPropValue(this);
else return visitor.visitChildren(this);
}
}
public final PropertyContext property() throws RecognitionException {
PropertyContext _localctx = new PropertyContext(_ctx, getState());
enterRule(_localctx, 58, RULE_property);
int _la;
try {
setState(358);
switch ( getInterpreter().adaptivePredict(_input,29,_ctx) ) {
case 1:
_localctx = new IsaContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(297);
match(T__15);
setState(298);
variable();
}
break;
case 2:
_localctx = new IsaExplicitContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(299);
match(T__16);
setState(300);
variable();
}
break;
case 3:
_localctx = new SubContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(301);
match(T__17);
setState(302);
variable();
}
break;
case 4:
_localctx = new RelatesContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(303);
match(T__18);
setState(304);
((RelatesContext)_localctx).role = variable();
setState(307);
switch ( getInterpreter().adaptivePredict(_input,25,_ctx) ) {
case 1:
{
setState(305);
match(T__19);
setState(306);
((RelatesContext)_localctx).superRole = variable();
}
break;
}
}
break;
case 5:
_localctx = new PlaysContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(309);
match(T__20);
setState(310);
variable();
}
break;
case 6:
_localctx = new PropIdContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(311);
match(T__21);
setState(312);
id();
}
break;
case 7:
_localctx = new PropLabelContext(_localctx);
enterOuterAlt(_localctx, 7);
{
setState(313);
match(T__22);
setState(314);
label();
}
break;
case 8:
_localctx = new PropValueContext(_localctx);
enterOuterAlt(_localctx, 8);
{
setState(315);
predicate();
}
break;
case 9:
_localctx = new PropWhenContext(_localctx);
enterOuterAlt(_localctx, 9);
{
setState(316);
match(T__23);
setState(317);
match(T__13);
setState(318);
patterns();
setState(319);
match(T__14);
}
break;
case 10:
_localctx = new PropThenContext(_localctx);
enterOuterAlt(_localctx, 10);
{
setState(321);
match(T__24);
setState(322);
match(T__13);
setState(323);
varPatterns();
setState(324);
match(T__14);
}
break;
case 11:
_localctx = new PropHasContext(_localctx);
enterOuterAlt(_localctx, 11);
{
setState(326);
match(T__25);
setState(327);
label();
setState(330);
switch (_input.LA(1)) {
case VARIABLE:
{
setState(328);
((PropHasContext)_localctx).resource = match(VARIABLE);
}
break;
case T__35:
case T__36:
case T__37:
case T__38:
case T__39:
case T__40:
case CONTAINS:
case TRUE:
case FALSE:
case STRING:
case REGEX:
case INTEGER:
case REAL:
case DATE:
case DATETIME:
{
setState(329);
predicate();
}
break;
default:
throw new NoViableAltException(this);
}
setState(334);
switch ( getInterpreter().adaptivePredict(_input,27,_ctx) ) {
case 1:
{
setState(332);
match(T__26);
setState(333);
((PropHasContext)_localctx).relation = match(VARIABLE);
}
break;
}
}
break;
case 12:
_localctx = new PropResourceContext(_localctx);
enterOuterAlt(_localctx, 12);
{
setState(336);
match(T__25);
setState(337);
variable();
}
break;
case 13:
_localctx = new PropKeyContext(_localctx);
enterOuterAlt(_localctx, 13);
{
setState(338);
match(T__27);
setState(339);
variable();
}
break;
case 14:
_localctx = new PropRelContext(_localctx);
enterOuterAlt(_localctx, 14);
{
setState(340);
match(T__28);
setState(341);
casting();
setState(346);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__8) {
{
{
setState(342);
match(T__8);
setState(343);
casting();
}
}
setState(348);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(349);
match(T__29);
}
break;
case 15:
_localctx = new IsAbstractContext(_localctx);
enterOuterAlt(_localctx, 15);
{
setState(351);
match(T__30);
}
break;
case 16:
_localctx = new PropDatatypeContext(_localctx);
enterOuterAlt(_localctx, 16);
{
setState(352);
match(T__31);
setState(353);
datatype();
}
break;
case 17:
_localctx = new PropRegexContext(_localctx);
enterOuterAlt(_localctx, 17);
{
setState(354);
match(T__32);
setState(355);
match(REGEX);
}
break;
case 18:
_localctx = new PropNeqContext(_localctx);
enterOuterAlt(_localctx, 18);
{
setState(356);
match(T__33);
setState(357);
variable();
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CastingContext extends ParserRuleContext {
public VariableContext variable() {
return getRuleContext(VariableContext.class,0);
}
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public CastingContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_casting; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterCasting(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitCasting(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitCasting(this);
else return visitor.visitChildren(this);
}
}
public final CastingContext casting() throws RecognitionException {
CastingContext _localctx = new CastingContext(_ctx, getState());
enterRule(_localctx, 60, RULE_casting);
int _la;
try {
setState(369);
switch ( getInterpreter().adaptivePredict(_input,31,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(360);
variable();
setState(363);
_la = _input.LA(1);
if (_la==T__34) {
{
setState(361);
match(T__34);
setState(362);
match(VARIABLE);
}
}
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(365);
variable();
setState(366);
match(VARIABLE);
notifyErrorListeners("expecting {',', ':'}");
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VariableContext extends ParserRuleContext {
public LabelContext label() {
return getRuleContext(LabelContext.class,0);
}
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public VariableContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_variable; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterVariable(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitVariable(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitVariable(this);
else return visitor.visitChildren(this);
}
}
public final VariableContext variable() throws RecognitionException {
VariableContext _localctx = new VariableContext(_ctx, getState());
enterRule(_localctx, 62, RULE_variable);
try {
setState(373);
switch (_input.LA(1)) {
case MIN:
case MAX:
case MEDIAN:
case MEAN:
case STD:
case SUM:
case COUNT:
case PATH:
case CLUSTER:
case FROM:
case TO:
case OF:
case IN:
case DEGREE:
case K_CORE:
case CONNECTED_COMPONENT:
case MIN_K:
case K:
case CONTAINS:
case SIZE:
case WHERE:
case ID:
case STRING:
case IMPLICIT_IDENTIFIER:
enterOuterAlt(_localctx, 1);
{
setState(371);
label();
}
break;
case VARIABLE:
enterOuterAlt(_localctx, 2);
{
setState(372);
match(VARIABLE);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PredicateContext extends ParserRuleContext {
public PredicateContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_predicate; }
public PredicateContext() { }
public void copyFrom(PredicateContext ctx) {
super.copyFrom(ctx);
}
}
public static class PredicateEqContext extends PredicateContext {
public ValueContext value() {
return getRuleContext(ValueContext.class,0);
}
public PredicateEqContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateEq(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateEq(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateEq(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateGteContext extends PredicateContext {
public ValueOrVarContext valueOrVar() {
return getRuleContext(ValueOrVarContext.class,0);
}
public PredicateGteContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateGte(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateGte(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateGte(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateNeqContext extends PredicateContext {
public ValueOrVarContext valueOrVar() {
return getRuleContext(ValueOrVarContext.class,0);
}
public PredicateNeqContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateNeq(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateNeq(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateNeq(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateRegexContext extends PredicateContext {
public TerminalNode REGEX() { return getToken(GraqlParser.REGEX, 0); }
public PredicateRegexContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateRegex(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateRegex(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateRegex(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateContainsContext extends PredicateContext {
public TerminalNode STRING() { return getToken(GraqlParser.STRING, 0); }
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public PredicateContainsContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateContains(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateContains(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateContains(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateGtContext extends PredicateContext {
public ValueOrVarContext valueOrVar() {
return getRuleContext(ValueOrVarContext.class,0);
}
public PredicateGtContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateGt(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateGt(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateGt(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateLteContext extends PredicateContext {
public ValueOrVarContext valueOrVar() {
return getRuleContext(ValueOrVarContext.class,0);
}
public PredicateLteContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateLte(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateLte(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateLte(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateVariableContext extends PredicateContext {
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public PredicateVariableContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateVariable(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateVariable(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateVariable(this);
else return visitor.visitChildren(this);
}
}
public static class PredicateLtContext extends PredicateContext {
public ValueOrVarContext valueOrVar() {
return getRuleContext(ValueOrVarContext.class,0);
}
public PredicateLtContext(PredicateContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterPredicateLt(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitPredicateLt(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitPredicateLt(this);
else return visitor.visitChildren(this);
}
}
public final PredicateContext predicate() throws RecognitionException {
PredicateContext _localctx = new PredicateContext(_ctx, getState());
enterRule(_localctx, 64, RULE_predicate);
int _la;
try {
setState(394);
switch ( getInterpreter().adaptivePredict(_input,34,_ctx) ) {
case 1:
_localctx = new PredicateEqContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(376);
_la = _input.LA(1);
if (_la==T__35) {
{
setState(375);
match(T__35);
}
}
setState(378);
value();
}
break;
case 2:
_localctx = new PredicateVariableContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(379);
match(T__35);
setState(380);
match(VARIABLE);
}
break;
case 3:
_localctx = new PredicateNeqContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(381);
match(T__36);
setState(382);
valueOrVar();
}
break;
case 4:
_localctx = new PredicateGtContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(383);
match(T__37);
setState(384);
valueOrVar();
}
break;
case 5:
_localctx = new PredicateGteContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(385);
match(T__38);
setState(386);
valueOrVar();
}
break;
case 6:
_localctx = new PredicateLtContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(387);
match(T__39);
setState(388);
valueOrVar();
}
break;
case 7:
_localctx = new PredicateLteContext(_localctx);
enterOuterAlt(_localctx, 7);
{
setState(389);
match(T__40);
setState(390);
valueOrVar();
}
break;
case 8:
_localctx = new PredicateContainsContext(_localctx);
enterOuterAlt(_localctx, 8);
{
setState(391);
match(CONTAINS);
setState(392);
_la = _input.LA(1);
if ( !(_la==VARIABLE || _la==STRING) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
break;
case 9:
_localctx = new PredicateRegexContext(_localctx);
enterOuterAlt(_localctx, 9);
{
setState(393);
match(REGEX);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ValueOrVarContext extends ParserRuleContext {
public ValueOrVarContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_valueOrVar; }
public ValueOrVarContext() { }
public void copyFrom(ValueOrVarContext ctx) {
super.copyFrom(ctx);
}
}
public static class ValuePrimitiveContext extends ValueOrVarContext {
public ValueContext value() {
return getRuleContext(ValueContext.class,0);
}
public ValuePrimitiveContext(ValueOrVarContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValuePrimitive(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValuePrimitive(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValuePrimitive(this);
else return visitor.visitChildren(this);
}
}
public static class ValueVariableContext extends ValueOrVarContext {
public TerminalNode VARIABLE() { return getToken(GraqlParser.VARIABLE, 0); }
public ValueVariableContext(ValueOrVarContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueVariable(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueVariable(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueVariable(this);
else return visitor.visitChildren(this);
}
}
public final ValueOrVarContext valueOrVar() throws RecognitionException {
ValueOrVarContext _localctx = new ValueOrVarContext(_ctx, getState());
enterRule(_localctx, 66, RULE_valueOrVar);
try {
setState(398);
switch (_input.LA(1)) {
case VARIABLE:
_localctx = new ValueVariableContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(396);
match(VARIABLE);
}
break;
case TRUE:
case FALSE:
case STRING:
case INTEGER:
case REAL:
case DATE:
case DATETIME:
_localctx = new ValuePrimitiveContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(397);
value();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ValueContext extends ParserRuleContext {
public ValueContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_value; }
public ValueContext() { }
public void copyFrom(ValueContext ctx) {
super.copyFrom(ctx);
}
}
public static class ValueBooleanContext extends ValueContext {
public BoolContext bool() {
return getRuleContext(BoolContext.class,0);
}
public ValueBooleanContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueBoolean(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueBoolean(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueBoolean(this);
else return visitor.visitChildren(this);
}
}
public static class ValueStringContext extends ValueContext {
public TerminalNode STRING() { return getToken(GraqlParser.STRING, 0); }
public ValueStringContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueString(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueString(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueString(this);
else return visitor.visitChildren(this);
}
}
public static class ValueRealContext extends ValueContext {
public TerminalNode REAL() { return getToken(GraqlParser.REAL, 0); }
public ValueRealContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueReal(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueReal(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueReal(this);
else return visitor.visitChildren(this);
}
}
public static class ValueDateTimeContext extends ValueContext {
public TerminalNode DATETIME() { return getToken(GraqlParser.DATETIME, 0); }
public ValueDateTimeContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueDateTime(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueDateTime(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueDateTime(this);
else return visitor.visitChildren(this);
}
}
public static class ValueDateContext extends ValueContext {
public TerminalNode DATE() { return getToken(GraqlParser.DATE, 0); }
public ValueDateContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueDate(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueDate(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueDate(this);
else return visitor.visitChildren(this);
}
}
public static class ValueIntegerContext extends ValueContext {
public TerminalNode INTEGER() { return getToken(GraqlParser.INTEGER, 0); }
public ValueIntegerContext(ValueContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterValueInteger(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitValueInteger(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitValueInteger(this);
else return visitor.visitChildren(this);
}
}
public final ValueContext value() throws RecognitionException {
ValueContext _localctx = new ValueContext(_ctx, getState());
enterRule(_localctx, 68, RULE_value);
try {
setState(406);
switch (_input.LA(1)) {
case STRING:
_localctx = new ValueStringContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(400);
match(STRING);
}
break;
case INTEGER:
_localctx = new ValueIntegerContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(401);
match(INTEGER);
}
break;
case REAL:
_localctx = new ValueRealContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(402);
match(REAL);
}
break;
case TRUE:
case FALSE:
_localctx = new ValueBooleanContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(403);
bool();
}
break;
case DATE:
_localctx = new ValueDateContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(404);
match(DATE);
}
break;
case DATETIME:
_localctx = new ValueDateTimeContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(405);
match(DATETIME);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class LabelsContext extends ParserRuleContext {
public LabelsArrayContext labelsArray() {
return getRuleContext(LabelsArrayContext.class,0);
}
public LabelContext label() {
return getRuleContext(LabelContext.class,0);
}
public LabelsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_labels; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterLabels(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitLabels(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitLabels(this);
else return visitor.visitChildren(this);
}
}
public final LabelsContext labels() throws RecognitionException {
LabelsContext _localctx = new LabelsContext(_ctx, getState());
enterRule(_localctx, 70, RULE_labels);
try {
setState(410);
switch (_input.LA(1)) {
case T__9:
enterOuterAlt(_localctx, 1);
{
setState(408);
labelsArray();
}
break;
case MIN:
case MAX:
case MEDIAN:
case MEAN:
case STD:
case SUM:
case COUNT:
case PATH:
case CLUSTER:
case FROM:
case TO:
case OF:
case IN:
case DEGREE:
case K_CORE:
case CONNECTED_COMPONENT:
case MIN_K:
case K:
case CONTAINS:
case SIZE:
case WHERE:
case ID:
case STRING:
case IMPLICIT_IDENTIFIER:
enterOuterAlt(_localctx, 2);
{
setState(409);
label();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class LabelsArrayContext extends ParserRuleContext {
public List<LabelContext> label() {
return getRuleContexts(LabelContext.class);
}
public LabelContext label(int i) {
return getRuleContext(LabelContext.class,i);
}
public LabelsArrayContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_labelsArray; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterLabelsArray(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitLabelsArray(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitLabelsArray(this);
else return visitor.visitChildren(this);
}
}
public final LabelsArrayContext labelsArray() throws RecognitionException {
LabelsArrayContext _localctx = new LabelsArrayContext(_ctx, getState());
enterRule(_localctx, 72, RULE_labelsArray);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(412);
match(T__9);
setState(413);
label();
setState(418);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__8) {
{
{
setState(414);
match(T__8);
setState(415);
label();
}
}
setState(420);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(421);
match(T__10);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class LabelContext extends ParserRuleContext {
public IdentifierContext identifier() {
return getRuleContext(IdentifierContext.class,0);
}
public TerminalNode IMPLICIT_IDENTIFIER() { return getToken(GraqlParser.IMPLICIT_IDENTIFIER, 0); }
public LabelContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_label; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterLabel(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitLabel(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitLabel(this);
else return visitor.visitChildren(this);
}
}
public final LabelContext label() throws RecognitionException {
LabelContext _localctx = new LabelContext(_ctx, getState());
enterRule(_localctx, 74, RULE_label);
try {
setState(425);
switch (_input.LA(1)) {
case MIN:
case MAX:
case MEDIAN:
case MEAN:
case STD:
case SUM:
case COUNT:
case PATH:
case CLUSTER:
case FROM:
case TO:
case OF:
case IN:
case DEGREE:
case K_CORE:
case CONNECTED_COMPONENT:
case MIN_K:
case K:
case CONTAINS:
case SIZE:
case WHERE:
case ID:
case STRING:
enterOuterAlt(_localctx, 1);
{
setState(423);
identifier();
}
break;
case IMPLICIT_IDENTIFIER:
enterOuterAlt(_localctx, 2);
{
setState(424);
match(IMPLICIT_IDENTIFIER);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IdContext extends ParserRuleContext {
public IdentifierContext identifier() {
return getRuleContext(IdentifierContext.class,0);
}
public IdContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_id; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterId(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitId(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitId(this);
else return visitor.visitChildren(this);
}
}
public final IdContext id() throws RecognitionException {
IdContext _localctx = new IdContext(_ctx, getState());
enterRule(_localctx, 76, RULE_id);
try {
enterOuterAlt(_localctx, 1);
{
setState(427);
identifier();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IdentifierContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(GraqlParser.ID, 0); }
public TerminalNode STRING() { return getToken(GraqlParser.STRING, 0); }
public TerminalNode MIN() { return getToken(GraqlParser.MIN, 0); }
public TerminalNode MAX() { return getToken(GraqlParser.MAX, 0); }
public TerminalNode MEDIAN() { return getToken(GraqlParser.MEDIAN, 0); }
public TerminalNode MEAN() { return getToken(GraqlParser.MEAN, 0); }
public TerminalNode STD() { return getToken(GraqlParser.STD, 0); }
public TerminalNode SUM() { return getToken(GraqlParser.SUM, 0); }
public TerminalNode COUNT() { return getToken(GraqlParser.COUNT, 0); }
public TerminalNode PATH() { return getToken(GraqlParser.PATH, 0); }
public TerminalNode CLUSTER() { return getToken(GraqlParser.CLUSTER, 0); }
public TerminalNode FROM() { return getToken(GraqlParser.FROM, 0); }
public TerminalNode TO() { return getToken(GraqlParser.TO, 0); }
public TerminalNode OF() { return getToken(GraqlParser.OF, 0); }
public TerminalNode IN() { return getToken(GraqlParser.IN, 0); }
public TerminalNode DEGREE() { return getToken(GraqlParser.DEGREE, 0); }
public TerminalNode K_CORE() { return getToken(GraqlParser.K_CORE, 0); }
public TerminalNode CONNECTED_COMPONENT() { return getToken(GraqlParser.CONNECTED_COMPONENT, 0); }
public TerminalNode MIN_K() { return getToken(GraqlParser.MIN_K, 0); }
public TerminalNode K() { return getToken(GraqlParser.K, 0); }
public TerminalNode CONTAINS() { return getToken(GraqlParser.CONTAINS, 0); }
public TerminalNode SIZE() { return getToken(GraqlParser.SIZE, 0); }
public TerminalNode WHERE() { return getToken(GraqlParser.WHERE, 0); }
public IdentifierContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_identifier; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterIdentifier(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitIdentifier(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitIdentifier(this);
else return visitor.visitChildren(this);
}
}
public final IdentifierContext identifier() throws RecognitionException {
IdentifierContext _localctx = new IdentifierContext(_ctx, getState());
enterRule(_localctx, 78, RULE_identifier);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(429);
_la = _input.LA(1);
if ( !(((((_la - 42)) & ~0x3f) == 0 && ((1L << (_la - 42)) & ((1L << (MIN - 42)) | (1L << (MAX - 42)) | (1L << (MEDIAN - 42)) | (1L << (MEAN - 42)) | (1L << (STD - 42)) | (1L << (SUM - 42)) | (1L << (COUNT - 42)) | (1L << (PATH - 42)) | (1L << (CLUSTER - 42)) | (1L << (FROM - 42)) | (1L << (TO - 42)) | (1L << (OF - 42)) | (1L << (IN - 42)) | (1L << (DEGREE - 42)) | (1L << (K_CORE - 42)) | (1L << (CONNECTED_COMPONENT - 42)) | (1L << (MIN_K - 42)) | (1L << (K - 42)) | (1L << (CONTAINS - 42)) | (1L << (SIZE - 42)) | (1L << (WHERE - 42)) | (1L << (ID - 42)) | (1L << (STRING - 42)))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class DatatypeContext extends ParserRuleContext {
public TerminalNode LONG_TYPE() { return getToken(GraqlParser.LONG_TYPE, 0); }
public TerminalNode DOUBLE_TYPE() { return getToken(GraqlParser.DOUBLE_TYPE, 0); }
public TerminalNode STRING_TYPE() { return getToken(GraqlParser.STRING_TYPE, 0); }
public TerminalNode BOOLEAN_TYPE() { return getToken(GraqlParser.BOOLEAN_TYPE, 0); }
public TerminalNode DATE_TYPE() { return getToken(GraqlParser.DATE_TYPE, 0); }
public DatatypeContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_datatype; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterDatatype(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitDatatype(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitDatatype(this);
else return visitor.visitChildren(this);
}
}
public final DatatypeContext datatype() throws RecognitionException {
DatatypeContext _localctx = new DatatypeContext(_ctx, getState());
enterRule(_localctx, 80, RULE_datatype);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(431);
_la = _input.LA(1);
if ( !(((((_la - 72)) & ~0x3f) == 0 && ((1L << (_la - 72)) & ((1L << (LONG_TYPE - 72)) | (1L << (DOUBLE_TYPE - 72)) | (1L << (STRING_TYPE - 72)) | (1L << (BOOLEAN_TYPE - 72)) | (1L << (DATE_TYPE - 72)))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class OrderContext extends ParserRuleContext {
public TerminalNode ASC() { return getToken(GraqlParser.ASC, 0); }
public TerminalNode DESC() { return getToken(GraqlParser.DESC, 0); }
public OrderContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_order; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterOrder(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitOrder(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitOrder(this);
else return visitor.visitChildren(this);
}
}
public final OrderContext order() throws RecognitionException {
OrderContext _localctx = new OrderContext(_ctx, getState());
enterRule(_localctx, 82, RULE_order);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(433);
_la = _input.LA(1);
if ( !(_la==ASC || _la==DESC) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BoolContext extends ParserRuleContext {
public TerminalNode TRUE() { return getToken(GraqlParser.TRUE, 0); }
public TerminalNode FALSE() { return getToken(GraqlParser.FALSE, 0); }
public BoolContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_bool; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).enterBool(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlListener ) ((GraqlListener)listener).exitBool(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlVisitor ) return ((GraqlVisitor<? extends T>)visitor).visitBool(this);
else return visitor.visitChildren(this);
}
}
public final BoolContext bool() throws RecognitionException {
BoolContext _localctx = new BoolContext(_ctx, getState());
enterRule(_localctx, 84, RULE_bool);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(435);
_la = _input.LA(1);
if ( !(_la==TRUE || _la==FALSE) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 3:
return matchPart_sempred((MatchPartContext)_localctx, predIndex);
case 26:
return pattern_sempred((PatternContext)_localctx, predIndex);
}
return true;
}
private boolean matchPart_sempred(MatchPartContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 3);
case 1:
return precpred(_ctx, 2);
case 2:
return precpred(_ctx, 1);
}
return true;
}
private boolean pattern_sempred(PatternContext _localctx, int predIndex) {
switch (predIndex) {
case 3:
return precpred(_ctx, 2);
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\\\u01b8\4\2\t\2\4"+
"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+
",\t,\3\2\7\2Z\n\2\f\2\16\2]\13\2\3\2\3\2\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3"+
"\4\3\4\3\4\5\4k\n\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3"+
"\5\3\5\3\5\3\5\3\5\5\5~\n\5\3\5\7\5\u0081\n\5\f\5\16\5\u0084\13\5\3\6"+
"\3\6\3\6\5\6\u0089\n\6\3\6\3\6\3\7\5\7\u008e\n\7\3\7\3\7\3\7\3\b\3\b\3"+
"\b\3\t\3\t\3\t\3\n\3\n\3\n\5\n\u009c\n\n\3\n\3\n\3\13\3\13\3\13\3\13\3"+
"\13\3\f\3\f\3\f\7\f\u00a8\n\f\f\f\16\f\u00ab\13\f\3\r\3\r\3\r\5\r\u00b0"+
"\n\r\3\r\3\r\3\16\3\16\3\17\3\17\3\17\7\17\u00b9\n\17\f\17\16\17\u00bc"+
"\13\17\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\3\20\5\20"+
"\u00ca\n\20\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26"+
"\5\26\u00d8\n\26\3\27\3\27\3\27\3\27\7\27\u00de\n\27\f\27\16\27\u00e1"+
"\13\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30"+
"\3\30\5\30\u00f1\n\30\3\31\3\31\7\31\u00f5\n\31\f\31\16\31\u00f8\13\31"+
"\3\32\3\32\5\32\u00fc\n\32\3\33\3\33\3\33\6\33\u0101\n\33\r\33\16\33\u0102"+
"\3\34\3\34\3\34\3\34\3\34\3\34\5\34\u010b\n\34\3\34\3\34\3\34\7\34\u0110"+
"\n\34\f\34\16\34\u0113\13\34\3\35\3\35\3\35\6\35\u0118\n\35\r\35\16\35"+
"\u0119\3\36\3\36\5\36\u011e\n\36\3\36\3\36\5\36\u0122\n\36\3\36\7\36\u0125"+
"\n\36\f\36\16\36\u0128\13\36\5\36\u012a\n\36\3\37\3\37\3\37\3\37\3\37"+
"\3\37\3\37\3\37\3\37\3\37\5\37\u0136\n\37\3\37\3\37\3\37\3\37\3\37\3\37"+
"\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37"+
"\3\37\5\37\u014d\n\37\3\37\3\37\5\37\u0151\n\37\3\37\3\37\3\37\3\37\3"+
"\37\3\37\3\37\3\37\7\37\u015b\n\37\f\37\16\37\u015e\13\37\3\37\3\37\3"+
"\37\3\37\3\37\3\37\3\37\3\37\3\37\5\37\u0169\n\37\3 \3 \3 \5 \u016e\n"+
" \3 \3 \3 \3 \5 \u0174\n \3!\3!\5!\u0178\n!\3\"\5\"\u017b\n\"\3\"\3\""+
"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\5\"\u018d\n\""+
"\3#\3#\5#\u0191\n#\3$\3$\3$\3$\3$\3$\5$\u0199\n$\3%\3%\5%\u019d\n%\3&"+
"\3&\3&\3&\7&\u01a3\n&\f&\16&\u01a6\13&\3&\3&\3\'\3\'\5\'\u01ac\n\'\3("+
"\3(\3)\3)\3*\3*\3+\3+\3,\3,\3,\2\4\b\66-\2\4\6\b\n\f\16\20\22\24\26\30"+
"\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPRTV\2\t\3\2,\65\3\2:<\4\2Q"+
"QSS\6\2,\64\66@BBRS\3\2JN\3\2HI\3\2OP\u01db\2[\3\2\2\2\4`\3\2\2\2\6j\3"+
"\2\2\2\bl\3\2\2\2\n\u0085\3\2\2\2\f\u008d\3\2\2\2\16\u0092\3\2\2\2\20"+
"\u0095\3\2\2\2\22\u0098\3\2\2\2\24\u009f\3\2\2\2\26\u00a4\3\2\2\2\30\u00ac"+
"\3\2\2\2\32\u00b3\3\2\2\2\34\u00b5\3\2\2\2\36\u00c9\3\2\2\2 \u00cb\3\2"+
"\2\2\"\u00cd\3\2\2\2$\u00cf\3\2\2\2&\u00d1\3\2\2\2(\u00d3\3\2\2\2*\u00d7"+
"\3\2\2\2,\u00d9\3\2\2\2.\u00f0\3\2\2\2\60\u00f2\3\2\2\2\62\u00fb\3\2\2"+
"\2\64\u0100\3\2\2\2\66\u010a\3\2\2\28\u0117\3\2\2\2:\u0129\3\2\2\2<\u0168"+
"\3\2\2\2>\u0173\3\2\2\2@\u0177\3\2\2\2B\u018c\3\2\2\2D\u0190\3\2\2\2F"+
"\u0198\3\2\2\2H\u019c\3\2\2\2J\u019e\3\2\2\2L\u01ab\3\2\2\2N\u01ad\3\2"+
"\2\2P\u01af\3\2\2\2R\u01b1\3\2\2\2T\u01b3\3\2\2\2V\u01b5\3\2\2\2XZ\5\6"+
"\4\2YX\3\2\2\2Z]\3\2\2\2[Y\3\2\2\2[\\\3\2\2\2\\^\3\2\2\2][\3\2\2\2^_\7"+
"\2\2\3_\3\3\2\2\2`a\5\6\4\2ab\7\2\2\3b\5\3\2\2\2ck\5\n\6\2dk\5\f\7\2e"+
"k\5\16\b\2fk\5\20\t\2gk\5\22\n\2hk\5\24\13\2ik\5\30\r\2jc\3\2\2\2jd\3"+
"\2\2\2je\3\2\2\2jf\3\2\2\2jg\3\2\2\2jh\3\2\2\2ji\3\2\2\2k\7\3\2\2\2lm"+
"\b\5\1\2mn\7C\2\2no\5\64\33\2o\u0082\3\2\2\2pq\f\5\2\2qr\7\3\2\2rs\7U"+
"\2\2s\u0081\7\4\2\2tu\f\4\2\2uv\7\5\2\2vw\7U\2\2w\u0081\7\4\2\2xy\f\3"+
"\2\2yz\7\6\2\2z{\7\7\2\2{}\7Q\2\2|~\5T+\2}|\3\2\2\2}~\3\2\2\2~\177\3\2"+
"\2\2\177\u0081\7\4\2\2\u0080p\3\2\2\2\u0080t\3\2\2\2\u0080x\3\2\2\2\u0081"+
"\u0084\3\2\2\2\u0082\u0080\3\2\2\2\u0082\u0083\3\2\2\2\u0083\t\3\2\2\2"+
"\u0084\u0082\3\2\2\2\u0085\u0086\5\b\5\2\u0086\u0088\7\b\2\2\u0087\u0089"+
"\5\26\f\2\u0088\u0087\3\2\2\2\u0088\u0089\3\2\2\2\u0089\u008a\3\2\2\2"+
"\u008a\u008b\7\4\2\2\u008b\13\3\2\2\2\u008c\u008e\5\b\5\2\u008d\u008c"+
"\3\2\2\2\u008d\u008e\3\2\2\2\u008e\u008f\3\2\2\2\u008f\u0090\7D\2\2\u0090"+
"\u0091\58\35\2\u0091\r\3\2\2\2\u0092\u0093\7E\2\2\u0093\u0094\58\35\2"+
"\u0094\17\3\2\2\2\u0095\u0096\7F\2\2\u0096\u0097\58\35\2\u0097\21\3\2"+
"\2\2\u0098\u0099\5\b\5\2\u0099\u009b\7\t\2\2\u009a\u009c\5\26\f\2\u009b"+
"\u009a\3\2\2\2\u009b\u009c\3\2\2\2\u009c\u009d\3\2\2\2\u009d\u009e\7\4"+
"\2\2\u009e\23\3\2\2\2\u009f\u00a0\5\b\5\2\u00a0\u00a1\7\n\2\2\u00a1\u00a2"+
"\5\60\31\2\u00a2\u00a3\7\4\2\2\u00a3\25\3\2\2\2\u00a4\u00a9\7Q\2\2\u00a5"+
"\u00a6\7\13\2\2\u00a6\u00a8\7Q\2\2\u00a7\u00a5\3\2\2\2\u00a8\u00ab\3\2"+
"\2\2\u00a9\u00a7\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa\27\3\2\2\2\u00ab\u00a9"+
"\3\2\2\2\u00ac\u00ad\7G\2\2\u00ad\u00af\5\32\16\2\u00ae\u00b0\5\34\17"+
"\2\u00af\u00ae\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00b2"+
"\7\4\2\2\u00b2\31\3\2\2\2\u00b3\u00b4\t\2\2\2\u00b4\33\3\2\2\2\u00b5\u00ba"+
"\5\36\20\2\u00b6\u00b7\7\13\2\2\u00b7\u00b9\5\36\20\2\u00b8\u00b6\3\2"+
"\2\2\u00b9\u00bc\3\2\2\2\u00ba\u00b8\3\2\2\2\u00ba\u00bb\3\2\2\2\u00bb"+
"\35\3\2\2\2\u00bc\u00ba\3\2\2\2\u00bd\u00be\7\66\2\2\u00be\u00ca\5 \21"+
"\2\u00bf\u00c0\7\67\2\2\u00c0\u00ca\5\"\22\2\u00c1\u00c2\78\2\2\u00c2"+
"\u00ca\5$\23\2\u00c3\u00c4\79\2\2\u00c4\u00ca\5&\24\2\u00c5\u00c6\7A\2"+
"\2\u00c6\u00ca\5(\25\2\u00c7\u00c8\7B\2\2\u00c8\u00ca\5*\26\2\u00c9\u00bd"+
"\3\2\2\2\u00c9\u00bf\3\2\2\2\u00c9\u00c1\3\2\2\2\u00c9\u00c3\3\2\2\2\u00c9"+
"\u00c5\3\2\2\2\u00c9\u00c7\3\2\2\2\u00ca\37\3\2\2\2\u00cb\u00cc\5N(\2"+
"\u00cc!\3\2\2\2\u00cd\u00ce\5N(\2\u00ce#\3\2\2\2\u00cf\u00d0\5H%\2\u00d0"+
"%\3\2\2\2\u00d1\u00d2\5H%\2\u00d2\'\3\2\2\2\u00d3\u00d4\t\3\2\2\u00d4"+
")\3\2\2\2\u00d5\u00d8\5,\27\2\u00d6\u00d8\5.\30\2\u00d7\u00d5\3\2\2\2"+
"\u00d7\u00d6\3\2\2\2\u00d8+\3\2\2\2\u00d9\u00da\7\f\2\2\u00da\u00df\5"+
".\30\2\u00db\u00dc\7\13\2\2\u00dc\u00de\5.\30\2\u00dd\u00db\3\2\2\2\u00de"+
"\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0\3\2\2\2\u00e0\u00e2\3\2"+
"\2\2\u00e1\u00df\3\2\2\2\u00e2\u00e3\7\r\2\2\u00e3-\3\2\2\2\u00e4\u00e5"+
"\7=\2\2\u00e5\u00e6\7\16\2\2\u00e6\u00f1\7U\2\2\u00e7\u00e8\7>\2\2\u00e8"+
"\u00e9\7\16\2\2\u00e9\u00f1\7U\2\2\u00ea\u00eb\7@\2\2\u00eb\u00ec\7\16"+
"\2\2\u00ec\u00f1\7U\2\2\u00ed\u00ee\7?\2\2\u00ee\u00ef\7\16\2\2\u00ef"+
"\u00f1\5N(\2\u00f0\u00e4\3\2\2\2\u00f0\u00e7\3\2\2\2\u00f0\u00ea\3\2\2"+
"\2\u00f0\u00ed\3\2\2\2\u00f1/\3\2\2\2\u00f2\u00f6\5P)\2\u00f3\u00f5\5"+
"\62\32\2\u00f4\u00f3\3\2\2\2\u00f5\u00f8\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f6"+
"\u00f7\3\2\2\2\u00f7\61\3\2\2\2\u00f8\u00f6\3\2\2\2\u00f9\u00fc\7Q\2\2"+
"\u00fa\u00fc\5\60\31\2\u00fb\u00f9\3\2\2\2\u00fb\u00fa\3\2\2\2\u00fc\63"+
"\3\2\2\2\u00fd\u00fe\5\66\34\2\u00fe\u00ff\7\4\2\2\u00ff\u0101\3\2\2\2"+
"\u0100\u00fd\3\2\2\2\u0101\u0102\3\2\2\2\u0102\u0100\3\2\2\2\u0102\u0103"+
"\3\2\2\2\u0103\65\3\2\2\2\u0104\u0105\b\34\1\2\u0105\u010b\5:\36\2\u0106"+
"\u0107\7\20\2\2\u0107\u0108\5\64\33\2\u0108\u0109\7\21\2\2\u0109\u010b"+
"\3\2\2\2\u010a\u0104\3\2\2\2\u010a\u0106\3\2\2\2\u010b\u0111\3\2\2\2\u010c"+
"\u010d\f\4\2\2\u010d\u010e\7\17\2\2\u010e\u0110\5\66\34\5\u010f\u010c"+
"\3\2\2\2\u0110\u0113\3\2\2\2\u0111\u010f\3\2\2\2\u0111\u0112\3\2\2\2\u0112"+
"\67\3\2\2\2\u0113\u0111\3\2\2\2\u0114\u0115\5:\36\2\u0115\u0116\7\4\2"+
"\2\u0116\u0118\3\2\2\2\u0117\u0114\3\2\2\2\u0118\u0119\3\2\2\2\u0119\u0117"+
"\3\2\2\2\u0119\u011a\3\2\2\2\u011a9\3\2\2\2\u011b\u012a\7Q\2\2\u011c\u011e"+
"\5@!\2\u011d\u011c\3\2\2\2\u011d\u011e\3\2\2\2\u011e\u011f\3\2\2\2\u011f"+
"\u0126\5<\37\2\u0120\u0122\7\13\2\2\u0121\u0120\3\2\2\2\u0121\u0122\3"+
"\2\2\2\u0122\u0123\3\2\2\2\u0123\u0125\5<\37\2\u0124\u0121\3\2\2\2\u0125"+
"\u0128\3\2\2\2\u0126\u0124\3\2\2\2\u0126\u0127\3\2\2\2\u0127\u012a\3\2"+
"\2\2\u0128\u0126\3\2\2\2\u0129\u011b\3\2\2\2\u0129\u011d\3\2\2\2\u012a"+
";\3\2\2\2\u012b\u012c\7\22\2\2\u012c\u0169\5@!\2\u012d\u012e\7\23\2\2"+
"\u012e\u0169\5@!\2\u012f\u0130\7\24\2\2\u0130\u0169\5@!\2\u0131\u0132"+
"\7\25\2\2\u0132\u0135\5@!\2\u0133\u0134\7\26\2\2\u0134\u0136\5@!\2\u0135"+
"\u0133\3\2\2\2\u0135\u0136\3\2\2\2\u0136\u0169\3\2\2\2\u0137\u0138\7\27"+
"\2\2\u0138\u0169\5@!\2\u0139\u013a\7\30\2\2\u013a\u0169\5N(\2\u013b\u013c"+
"\7\31\2\2\u013c\u0169\5L\'\2\u013d\u0169\5B\"\2\u013e\u013f\7\32\2\2\u013f"+
"\u0140\7\20\2\2\u0140\u0141\5\64\33\2\u0141\u0142\7\21\2\2\u0142\u0169"+
"\3\2\2\2\u0143\u0144\7\33\2\2\u0144\u0145\7\20\2\2\u0145\u0146\58\35\2"+
"\u0146\u0147\7\21\2\2\u0147\u0169\3\2\2\2\u0148\u0149\7\34\2\2\u0149\u014c"+
"\5L\'\2\u014a\u014d\7Q\2\2\u014b\u014d\5B\"\2\u014c\u014a\3\2\2\2\u014c"+
"\u014b\3\2\2\2\u014d\u0150\3\2\2\2\u014e\u014f\7\35\2\2\u014f\u0151\7"+
"Q\2\2\u0150\u014e\3\2\2\2\u0150\u0151\3\2\2\2\u0151\u0169\3\2\2\2\u0152"+
"\u0153\7\34\2\2\u0153\u0169\5@!\2\u0154\u0155\7\36\2\2\u0155\u0169\5@"+
"!\2\u0156\u0157\7\37\2\2\u0157\u015c\5> \2\u0158\u0159\7\13\2\2\u0159"+
"\u015b\5> \2\u015a\u0158\3\2\2\2\u015b\u015e\3\2\2\2\u015c\u015a\3\2\2"+
"\2\u015c\u015d\3\2\2\2\u015d\u015f\3\2\2\2\u015e\u015c\3\2\2\2\u015f\u0160"+
"\7 \2\2\u0160\u0169\3\2\2\2\u0161\u0169\7!\2\2\u0162\u0163\7\"\2\2\u0163"+
"\u0169\5R*\2\u0164\u0165\7#\2\2\u0165\u0169\7T\2\2\u0166\u0167\7$\2\2"+
"\u0167\u0169\5@!\2\u0168\u012b\3\2\2\2\u0168\u012d\3\2\2\2\u0168\u012f"+
"\3\2\2\2\u0168\u0131\3\2\2\2\u0168\u0137\3\2\2\2\u0168\u0139\3\2\2\2\u0168"+
"\u013b\3\2\2\2\u0168\u013d\3\2\2\2\u0168\u013e\3\2\2\2\u0168\u0143\3\2"+
"\2\2\u0168\u0148\3\2\2\2\u0168\u0152\3\2\2\2\u0168\u0154\3\2\2\2\u0168"+
"\u0156\3\2\2\2\u0168\u0161\3\2\2\2\u0168\u0162\3\2\2\2\u0168\u0164\3\2"+
"\2\2\u0168\u0166\3\2\2\2\u0169=\3\2\2\2\u016a\u016d\5@!\2\u016b\u016c"+
"\7%\2\2\u016c\u016e\7Q\2\2\u016d\u016b\3\2\2\2\u016d\u016e\3\2\2\2\u016e"+
"\u0174\3\2\2\2\u016f\u0170\5@!\2\u0170\u0171\7Q\2\2\u0171\u0172\b \1\2"+
"\u0172\u0174\3\2\2\2\u0173\u016a\3\2\2\2\u0173\u016f\3\2\2\2\u0174?\3"+
"\2\2\2\u0175\u0178\5L\'\2\u0176\u0178\7Q\2\2\u0177\u0175\3\2\2\2\u0177"+
"\u0176\3\2\2\2\u0178A\3\2\2\2\u0179\u017b\7&\2\2\u017a\u0179\3\2\2\2\u017a"+
"\u017b\3\2\2\2\u017b\u017c\3\2\2\2\u017c\u018d\5F$\2\u017d\u017e\7&\2"+
"\2\u017e\u018d\7Q\2\2\u017f\u0180\7\'\2\2\u0180\u018d\5D#\2\u0181\u0182"+
"\7(\2\2\u0182\u018d\5D#\2\u0183\u0184\7)\2\2\u0184\u018d\5D#\2\u0185\u0186"+
"\7*\2\2\u0186\u018d\5D#\2\u0187\u0188\7+\2\2\u0188\u018d\5D#\2\u0189\u018a"+
"\7?\2\2\u018a\u018d\t\4\2\2\u018b\u018d\7T\2\2\u018c\u017a\3\2\2\2\u018c"+
"\u017d\3\2\2\2\u018c\u017f\3\2\2\2\u018c\u0181\3\2\2\2\u018c\u0183\3\2"+
"\2\2\u018c\u0185\3\2\2\2\u018c\u0187\3\2\2\2\u018c\u0189\3\2\2\2\u018c"+
"\u018b\3\2\2\2\u018dC\3\2\2\2\u018e\u0191\7Q\2\2\u018f\u0191\5F$\2\u0190"+
"\u018e\3\2\2\2\u0190\u018f\3\2\2\2\u0191E\3\2\2\2\u0192\u0199\7S\2\2\u0193"+
"\u0199\7U\2\2\u0194\u0199\7V\2\2\u0195\u0199\5V,\2\u0196\u0199\7W\2\2"+
"\u0197\u0199\7X\2\2\u0198\u0192\3\2\2\2\u0198\u0193\3\2\2\2\u0198\u0194"+
"\3\2\2\2\u0198\u0195\3\2\2\2\u0198\u0196\3\2\2\2\u0198\u0197\3\2\2\2\u0199"+
"G\3\2\2\2\u019a\u019d\5J&\2\u019b\u019d\5L\'\2\u019c\u019a\3\2\2\2\u019c"+
"\u019b\3\2\2\2\u019dI\3\2\2\2\u019e\u019f\7\f\2\2\u019f\u01a4\5L\'\2\u01a0"+
"\u01a1\7\13\2\2\u01a1\u01a3\5L\'\2\u01a2\u01a0\3\2\2\2\u01a3\u01a6\3\2"+
"\2\2\u01a4\u01a2\3\2\2\2\u01a4\u01a5\3\2\2\2\u01a5\u01a7\3\2\2\2\u01a6"+
"\u01a4\3\2\2\2\u01a7\u01a8\7\r\2\2\u01a8K\3\2\2\2\u01a9\u01ac\5P)\2\u01aa"+
"\u01ac\7Z\2\2\u01ab\u01a9\3\2\2\2\u01ab\u01aa\3\2\2\2\u01acM\3\2\2\2\u01ad"+
"\u01ae\5P)\2\u01aeO\3\2\2\2\u01af\u01b0\t\5\2\2\u01b0Q\3\2\2\2\u01b1\u01b2"+
"\t\6\2\2\u01b2S\3\2\2\2\u01b3\u01b4\t\7\2\2\u01b4U\3\2\2\2\u01b5\u01b6"+
"\t\b\2\2\u01b6W\3\2\2\2*[j}\u0080\u0082\u0088\u008d\u009b\u00a9\u00af"+
"\u00ba\u00c9\u00d7\u00df\u00f0\u00f6\u00fb\u0102\u010a\u0111\u0119\u011d"+
"\u0121\u0126\u0129\u0135\u014c\u0150\u015c\u0168\u016d\u0173\u0177\u017a"+
"\u018c\u0190\u0198\u019c\u01a4\u01ab";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateBaseListener.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link GraqlTemplateListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class GraqlTemplateBaseListener implements GraqlTemplateListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTemplate(GraqlTemplateParser.TemplateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTemplate(GraqlTemplateParser.TemplateContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBlock(GraqlTemplateParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBlock(GraqlTemplateParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBlockContents(GraqlTemplateParser.BlockContentsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBlockContents(GraqlTemplateParser.BlockContentsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStatement(GraqlTemplateParser.StatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStatement(GraqlTemplateParser.StatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterForInStatement(GraqlTemplateParser.ForInStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitForInStatement(GraqlTemplateParser.ForInStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfStatement(GraqlTemplateParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfStatement(GraqlTemplateParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfPartial(GraqlTemplateParser.IfPartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfPartial(GraqlTemplateParser.IfPartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterElsePartial(GraqlTemplateParser.ElsePartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitElsePartial(GraqlTemplateParser.ElsePartialContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExpression(GraqlTemplateParser.ExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExpression(GraqlTemplateParser.ExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNumber(GraqlTemplateParser.NumberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNumber(GraqlTemplateParser.NumberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterInt_(GraqlTemplateParser.Int_Context ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitInt_(GraqlTemplateParser.Int_Context ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDouble_(GraqlTemplateParser.Double_Context ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDouble_(GraqlTemplateParser.Double_Context ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterString(GraqlTemplateParser.StringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitString(GraqlTemplateParser.StringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterList(GraqlTemplateParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitList(GraqlTemplateParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNil(GraqlTemplateParser.NilContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNil(GraqlTemplateParser.NilContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterOrExpression(GraqlTemplateParser.OrExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitOrExpression(GraqlTemplateParser.OrExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEqExpression(GraqlTemplateParser.EqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEqExpression(GraqlTemplateParser.EqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAndExpression(GraqlTemplateParser.AndExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAndExpression(GraqlTemplateParser.AndExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLessExpression(GraqlTemplateParser.LessExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLessExpression(GraqlTemplateParser.LessExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNotExpression(GraqlTemplateParser.NotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNotExpression(GraqlTemplateParser.NotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIdExpression(GraqlTemplateParser.IdExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIdExpression(GraqlTemplateParser.IdExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMapAccessor(GraqlTemplateParser.MapAccessorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMapAccessor(GraqlTemplateParser.MapAccessorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterListAccessor(GraqlTemplateParser.ListAccessorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitListAccessor(GraqlTemplateParser.ListAccessorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterId(GraqlTemplateParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitId(GraqlTemplateParser.IdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVarResolved(GraqlTemplateParser.VarResolvedContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVarResolved(GraqlTemplateParser.VarResolvedContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVarLiteral(GraqlTemplateParser.VarLiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVarLiteral(GraqlTemplateParser.VarLiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterKeyword(GraqlTemplateParser.KeywordContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitKeyword(GraqlTemplateParser.KeywordContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateBaseVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
* This class provides an empty implementation of {@link GraqlTemplateVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public class GraqlTemplateBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements GraqlTemplateVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTemplate(GraqlTemplateParser.TemplateContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBlock(GraqlTemplateParser.BlockContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBlockContents(GraqlTemplateParser.BlockContentsContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStatement(GraqlTemplateParser.StatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitForInStatement(GraqlTemplateParser.ForInStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIfStatement(GraqlTemplateParser.IfStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIfPartial(GraqlTemplateParser.IfPartialContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitElsePartial(GraqlTemplateParser.ElsePartialContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExpression(GraqlTemplateParser.ExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNumber(GraqlTemplateParser.NumberContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitInt_(GraqlTemplateParser.Int_Context ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDouble_(GraqlTemplateParser.Double_Context ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitString(GraqlTemplateParser.StringContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitList(GraqlTemplateParser.ListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNil(GraqlTemplateParser.NilContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitOrExpression(GraqlTemplateParser.OrExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEqExpression(GraqlTemplateParser.EqExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAndExpression(GraqlTemplateParser.AndExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLessExpression(GraqlTemplateParser.LessExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNotExpression(GraqlTemplateParser.NotExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIdExpression(GraqlTemplateParser.IdExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMapAccessor(GraqlTemplateParser.MapAccessorContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitListAccessor(GraqlTemplateParser.ListAccessorContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitId(GraqlTemplateParser.IdContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVarResolved(GraqlTemplateParser.VarResolvedContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVarLiteral(GraqlTemplateParser.VarLiteralContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitKeyword(GraqlTemplateParser.KeywordContext ctx) { return visitChildren(ctx); }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateLexer.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GraqlTemplateLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, FOR=7, IF=8, ELSEIF=9,
ELSE=10, DO=11, IN=12, EQ=13, NEQ=14, AND=15, OR=16, NOT=17, GREATER=18,
GREATEREQ=19, LESS=20, LESSEQ=21, LPAREN=22, RPAREN=23, LBR=24, RBR=25,
DOLLAR=26, AT=27, QUOTE=28, SQOUTE=29, NULL=30, INT=31, DOUBLE=32, BOOLEAN=33,
ID=34, STRING=35, VAR_GRAQL=36, ID_MACRO=37, WS=38, COMMENT=39;
public static String[] modeNames = {
"DEFAULT_MODE"
};
public static final String[] ruleNames = {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "FOR", "IF", "ELSEIF",
"ELSE", "DO", "IN", "EQ", "NEQ", "AND", "OR", "NOT", "GREATER", "GREATEREQ",
"LESS", "LESSEQ", "LPAREN", "RPAREN", "LBR", "RBR", "DOLLAR", "AT", "QUOTE",
"SQOUTE", "NULL", "INT", "DOUBLE", "BOOLEAN", "ID", "STRING", "VAR_GRAQL",
"ID_MACRO", "WS", "COMMENT", "ESCAPE_SEQ"
};
private static final String[] _LITERAL_NAMES = {
null, "'{'", "'}'", "','", "'.'", "';'", "':'", "'for'", "'if'", "'elseif'",
"'else'", "'do'", "'in'", "'='", "'!='", "'and'", "'or'", "'not'", "'>'",
"'>='", "'<'", "'<='", "'('", "')'", "'['", "']'", "'$'", "'@'", "'\"'",
"'''", "'null'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, "FOR", "IF", "ELSEIF", "ELSE",
"DO", "IN", "EQ", "NEQ", "AND", "OR", "NOT", "GREATER", "GREATEREQ", "LESS",
"LESSEQ", "LPAREN", "RPAREN", "LBR", "RBR", "DOLLAR", "AT", "QUOTE", "SQOUTE",
"NULL", "INT", "DOUBLE", "BOOLEAN", "ID", "STRING", "VAR_GRAQL", "ID_MACRO",
"WS", "COMMENT"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public GraqlTemplateLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "GraqlTemplate.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2)\u00f1\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\3\2\3\2\3\3\3"+
"\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\n\3\n"+
"\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r"+
"\3\16\3\16\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\22\3\22"+
"\3\22\3\22\3\23\3\23\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\27\3\27"+
"\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\35\3\35\3\36\3\36"+
"\3\37\3\37\3\37\3\37\3\37\3 \6 \u00a9\n \r \16 \u00aa\3!\6!\u00ae\n!\r"+
"!\16!\u00af\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\5\"\u00bb\n\"\3#\6#\u00be"+
"\n#\r#\16#\u00bf\3$\3$\3$\7$\u00c5\n$\f$\16$\u00c8\13$\3$\3$\3$\3$\7$"+
"\u00ce\n$\f$\16$\u00d1\13$\3$\5$\u00d4\n$\3%\3%\3%\3&\3&\3&\3\'\3\'\3"+
"\'\3\'\3(\3(\7(\u00e2\n(\f(\16(\u00e5\13(\3(\5(\u00e8\n(\3(\5(\u00eb\n"+
"(\3(\3(\3)\3)\3)\3\u00e3\2*\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25"+
"\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32"+
"\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q\2\3\2\t\3\2\62;\4\2"+
"\60\60\62;\7\2//\62;C\\aac|\4\2$$^^\4\2))^^\5\2\13\f\17\17\"\"\3\3\f\f"+
"\u00fa\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2"+
"\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3"+
"\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2"+
"\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2"+
"/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2"+
"\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2"+
"G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\3S\3\2\2\2\5U\3"+
"\2\2\2\7W\3\2\2\2\tY\3\2\2\2\13[\3\2\2\2\r]\3\2\2\2\17_\3\2\2\2\21c\3"+
"\2\2\2\23f\3\2\2\2\25m\3\2\2\2\27r\3\2\2\2\31u\3\2\2\2\33x\3\2\2\2\35"+
"z\3\2\2\2\37}\3\2\2\2!\u0081\3\2\2\2#\u0084\3\2\2\2%\u0088\3\2\2\2\'\u008a"+
"\3\2\2\2)\u008d\3\2\2\2+\u008f\3\2\2\2-\u0092\3\2\2\2/\u0094\3\2\2\2\61"+
"\u0096\3\2\2\2\63\u0098\3\2\2\2\65\u009a\3\2\2\2\67\u009c\3\2\2\29\u009e"+
"\3\2\2\2;\u00a0\3\2\2\2=\u00a2\3\2\2\2?\u00a8\3\2\2\2A\u00ad\3\2\2\2C"+
"\u00ba\3\2\2\2E\u00bd\3\2\2\2G\u00d3\3\2\2\2I\u00d5\3\2\2\2K\u00d8\3\2"+
"\2\2M\u00db\3\2\2\2O\u00df\3\2\2\2Q\u00ee\3\2\2\2ST\7}\2\2T\4\3\2\2\2"+
"UV\7\177\2\2V\6\3\2\2\2WX\7.\2\2X\b\3\2\2\2YZ\7\60\2\2Z\n\3\2\2\2[\\\7"+
"=\2\2\\\f\3\2\2\2]^\7<\2\2^\16\3\2\2\2_`\7h\2\2`a\7q\2\2ab\7t\2\2b\20"+
"\3\2\2\2cd\7k\2\2de\7h\2\2e\22\3\2\2\2fg\7g\2\2gh\7n\2\2hi\7u\2\2ij\7"+
"g\2\2jk\7k\2\2kl\7h\2\2l\24\3\2\2\2mn\7g\2\2no\7n\2\2op\7u\2\2pq\7g\2"+
"\2q\26\3\2\2\2rs\7f\2\2st\7q\2\2t\30\3\2\2\2uv\7k\2\2vw\7p\2\2w\32\3\2"+
"\2\2xy\7?\2\2y\34\3\2\2\2z{\7#\2\2{|\7?\2\2|\36\3\2\2\2}~\7c\2\2~\177"+
"\7p\2\2\177\u0080\7f\2\2\u0080 \3\2\2\2\u0081\u0082\7q\2\2\u0082\u0083"+
"\7t\2\2\u0083\"\3\2\2\2\u0084\u0085\7p\2\2\u0085\u0086\7q\2\2\u0086\u0087"+
"\7v\2\2\u0087$\3\2\2\2\u0088\u0089\7@\2\2\u0089&\3\2\2\2\u008a\u008b\7"+
"@\2\2\u008b\u008c\7?\2\2\u008c(\3\2\2\2\u008d\u008e\7>\2\2\u008e*\3\2"+
"\2\2\u008f\u0090\7>\2\2\u0090\u0091\7?\2\2\u0091,\3\2\2\2\u0092\u0093"+
"\7*\2\2\u0093.\3\2\2\2\u0094\u0095\7+\2\2\u0095\60\3\2\2\2\u0096\u0097"+
"\7]\2\2\u0097\62\3\2\2\2\u0098\u0099\7_\2\2\u0099\64\3\2\2\2\u009a\u009b"+
"\7&\2\2\u009b\66\3\2\2\2\u009c\u009d\7B\2\2\u009d8\3\2\2\2\u009e\u009f"+
"\7$\2\2\u009f:\3\2\2\2\u00a0\u00a1\7)\2\2\u00a1<\3\2\2\2\u00a2\u00a3\7"+
"p\2\2\u00a3\u00a4\7w\2\2\u00a4\u00a5\7n\2\2\u00a5\u00a6\7n\2\2\u00a6>"+
"\3\2\2\2\u00a7\u00a9\t\2\2\2\u00a8\u00a7\3\2\2\2\u00a9\u00aa\3\2\2\2\u00aa"+
"\u00a8\3\2\2\2\u00aa\u00ab\3\2\2\2\u00ab@\3\2\2\2\u00ac\u00ae\t\3\2\2"+
"\u00ad\u00ac\3\2\2\2\u00ae\u00af\3\2\2\2\u00af\u00ad\3\2\2\2\u00af\u00b0"+
"\3\2\2\2\u00b0B\3\2\2\2\u00b1\u00b2\7v\2\2\u00b2\u00b3\7t\2\2\u00b3\u00b4"+
"\7w\2\2\u00b4\u00bb\7g\2\2\u00b5\u00b6\7h\2\2\u00b6\u00b7\7c\2\2\u00b7"+
"\u00b8\7n\2\2\u00b8\u00b9\7u\2\2\u00b9\u00bb\7g\2\2\u00ba\u00b1\3\2\2"+
"\2\u00ba\u00b5\3\2\2\2\u00bbD\3\2\2\2\u00bc\u00be\t\4\2\2\u00bd\u00bc"+
"\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0"+
"F\3\2\2\2\u00c1\u00c6\7$\2\2\u00c2\u00c5\n\5\2\2\u00c3\u00c5\5Q)\2\u00c4"+
"\u00c2\3\2\2\2\u00c4\u00c3\3\2\2\2\u00c5\u00c8\3\2\2\2\u00c6\u00c4\3\2"+
"\2\2\u00c6\u00c7\3\2\2\2\u00c7\u00c9\3\2\2\2\u00c8\u00c6\3\2\2\2\u00c9"+
"\u00d4\7$\2\2\u00ca\u00cf\7)\2\2\u00cb\u00ce\n\6\2\2\u00cc\u00ce\5Q)\2"+
"\u00cd\u00cb\3\2\2\2\u00cd\u00cc\3\2\2\2\u00ce\u00d1\3\2\2\2\u00cf\u00cd"+
"\3\2\2\2\u00cf\u00d0\3\2\2\2\u00d0\u00d2\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d2"+
"\u00d4\7)\2\2\u00d3\u00c1\3\2\2\2\u00d3\u00ca\3\2\2\2\u00d4H\3\2\2\2\u00d5"+
"\u00d6\5\65\33\2\u00d6\u00d7\5E#\2\u00d7J\3\2\2\2\u00d8\u00d9\5\67\34"+
"\2\u00d9\u00da\5E#\2\u00daL\3\2\2\2\u00db\u00dc\t\7\2\2\u00dc\u00dd\3"+
"\2\2\2\u00dd\u00de\b\'\2\2\u00deN\3\2\2\2\u00df\u00e3\7%\2\2\u00e0\u00e2"+
"\13\2\2\2\u00e1\u00e0\3\2\2\2\u00e2\u00e5\3\2\2\2\u00e3\u00e4\3\2\2\2"+
"\u00e3\u00e1\3\2\2\2\u00e4\u00e7\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e6\u00e8"+
"\7\17\2\2\u00e7\u00e6\3\2\2\2\u00e7\u00e8\3\2\2\2\u00e8\u00ea\3\2\2\2"+
"\u00e9\u00eb\t\b\2\2\u00ea\u00e9\3\2\2\2\u00eb\u00ec\3\2\2\2\u00ec\u00ed"+
"\b(\2\2\u00edP\3\2\2\2\u00ee\u00ef\7^\2\2\u00ef\u00f0\13\2\2\2\u00f0R"+
"\3\2\2\2\17\2\u00aa\u00af\u00ba\u00bf\u00c4\u00c6\u00cd\u00cf\u00d3\u00e3"+
"\u00e7\u00ea\3\2\3\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateListener.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
* This interface defines a complete listener for a parse tree produced by
* {@link GraqlTemplateParser}.
*/
public interface GraqlTemplateListener extends ParseTreeListener {
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#template}.
* @param ctx the parse tree
*/
void enterTemplate(GraqlTemplateParser.TemplateContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#template}.
* @param ctx the parse tree
*/
void exitTemplate(GraqlTemplateParser.TemplateContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#block}.
* @param ctx the parse tree
*/
void enterBlock(GraqlTemplateParser.BlockContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#block}.
* @param ctx the parse tree
*/
void exitBlock(GraqlTemplateParser.BlockContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#blockContents}.
* @param ctx the parse tree
*/
void enterBlockContents(GraqlTemplateParser.BlockContentsContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#blockContents}.
* @param ctx the parse tree
*/
void exitBlockContents(GraqlTemplateParser.BlockContentsContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#statement}.
* @param ctx the parse tree
*/
void enterStatement(GraqlTemplateParser.StatementContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#statement}.
* @param ctx the parse tree
*/
void exitStatement(GraqlTemplateParser.StatementContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#forInStatement}.
* @param ctx the parse tree
*/
void enterForInStatement(GraqlTemplateParser.ForInStatementContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#forInStatement}.
* @param ctx the parse tree
*/
void exitForInStatement(GraqlTemplateParser.ForInStatementContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#forEachStatement}.
* @param ctx the parse tree
*/
void enterForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#forEachStatement}.
* @param ctx the parse tree
*/
void exitForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#ifStatement}.
* @param ctx the parse tree
*/
void enterIfStatement(GraqlTemplateParser.IfStatementContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#ifStatement}.
* @param ctx the parse tree
*/
void exitIfStatement(GraqlTemplateParser.IfStatementContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#ifPartial}.
* @param ctx the parse tree
*/
void enterIfPartial(GraqlTemplateParser.IfPartialContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#ifPartial}.
* @param ctx the parse tree
*/
void exitIfPartial(GraqlTemplateParser.IfPartialContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#elseIfPartial}.
* @param ctx the parse tree
*/
void enterElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#elseIfPartial}.
* @param ctx the parse tree
*/
void exitElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#elsePartial}.
* @param ctx the parse tree
*/
void enterElsePartial(GraqlTemplateParser.ElsePartialContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#elsePartial}.
* @param ctx the parse tree
*/
void exitElsePartial(GraqlTemplateParser.ElsePartialContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#expression}.
* @param ctx the parse tree
*/
void enterExpression(GraqlTemplateParser.ExpressionContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#expression}.
* @param ctx the parse tree
*/
void exitExpression(GraqlTemplateParser.ExpressionContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#number}.
* @param ctx the parse tree
*/
void enterNumber(GraqlTemplateParser.NumberContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#number}.
* @param ctx the parse tree
*/
void exitNumber(GraqlTemplateParser.NumberContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#int_}.
* @param ctx the parse tree
*/
void enterInt_(GraqlTemplateParser.Int_Context ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#int_}.
* @param ctx the parse tree
*/
void exitInt_(GraqlTemplateParser.Int_Context ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#double_}.
* @param ctx the parse tree
*/
void enterDouble_(GraqlTemplateParser.Double_Context ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#double_}.
* @param ctx the parse tree
*/
void exitDouble_(GraqlTemplateParser.Double_Context ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#string}.
* @param ctx the parse tree
*/
void enterString(GraqlTemplateParser.StringContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#string}.
* @param ctx the parse tree
*/
void exitString(GraqlTemplateParser.StringContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#list}.
* @param ctx the parse tree
*/
void enterList(GraqlTemplateParser.ListContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#list}.
* @param ctx the parse tree
*/
void exitList(GraqlTemplateParser.ListContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#nil}.
* @param ctx the parse tree
*/
void enterNil(GraqlTemplateParser.NilContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#nil}.
* @param ctx the parse tree
*/
void exitNil(GraqlTemplateParser.NilContext ctx);
/**
* Enter a parse tree produced by the {@code groupExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code groupExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code orExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterOrExpression(GraqlTemplateParser.OrExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code orExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitOrExpression(GraqlTemplateParser.OrExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code eqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterEqExpression(GraqlTemplateParser.EqExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code eqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitEqExpression(GraqlTemplateParser.EqExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code andExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterAndExpression(GraqlTemplateParser.AndExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code andExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitAndExpression(GraqlTemplateParser.AndExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code greaterExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code greaterExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code lessEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code lessEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code notEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code notEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code lessExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterLessExpression(GraqlTemplateParser.LessExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code lessExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitLessExpression(GraqlTemplateParser.LessExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code notExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterNotExpression(GraqlTemplateParser.NotExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code notExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitNotExpression(GraqlTemplateParser.NotExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code greaterEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code greaterEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code booleanExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code booleanExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code booleanConstant}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void enterBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx);
/**
* Exit a parse tree produced by the {@code booleanConstant}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
*/
void exitBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#escapedExpression}.
* @param ctx the parse tree
*/
void enterEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#escapedExpression}.
* @param ctx the parse tree
*/
void exitEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code idExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
*/
void enterIdExpression(GraqlTemplateParser.IdExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code idExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
*/
void exitIdExpression(GraqlTemplateParser.IdExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code macroExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
*/
void enterMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx);
/**
* Exit a parse tree produced by the {@code macroExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
*/
void exitMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx);
/**
* Enter a parse tree produced by the {@code mapAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
*/
void enterMapAccessor(GraqlTemplateParser.MapAccessorContext ctx);
/**
* Exit a parse tree produced by the {@code mapAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
*/
void exitMapAccessor(GraqlTemplateParser.MapAccessorContext ctx);
/**
* Enter a parse tree produced by the {@code listAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
*/
void enterListAccessor(GraqlTemplateParser.ListAccessorContext ctx);
/**
* Exit a parse tree produced by the {@code listAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
*/
void exitListAccessor(GraqlTemplateParser.ListAccessorContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#id}.
* @param ctx the parse tree
*/
void enterId(GraqlTemplateParser.IdContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#id}.
* @param ctx the parse tree
*/
void exitId(GraqlTemplateParser.IdContext ctx);
/**
* Enter a parse tree produced by the {@code varResolved}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
*/
void enterVarResolved(GraqlTemplateParser.VarResolvedContext ctx);
/**
* Exit a parse tree produced by the {@code varResolved}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
*/
void exitVarResolved(GraqlTemplateParser.VarResolvedContext ctx);
/**
* Enter a parse tree produced by the {@code varLiteral}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
*/
void enterVarLiteral(GraqlTemplateParser.VarLiteralContext ctx);
/**
* Exit a parse tree produced by the {@code varLiteral}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
*/
void exitVarLiteral(GraqlTemplateParser.VarLiteralContext ctx);
/**
* Enter a parse tree produced by {@link GraqlTemplateParser#keyword}.
* @param ctx the parse tree
*/
void enterKeyword(GraqlTemplateParser.KeywordContext ctx);
/**
* Exit a parse tree produced by {@link GraqlTemplateParser#keyword}.
* @param ctx the parse tree
*/
void exitKeyword(GraqlTemplateParser.KeywordContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateParser.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GraqlTemplateParser extends Parser {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, FOR=7, IF=8, ELSEIF=9,
ELSE=10, DO=11, IN=12, EQ=13, NEQ=14, AND=15, OR=16, NOT=17, GREATER=18,
GREATEREQ=19, LESS=20, LESSEQ=21, LPAREN=22, RPAREN=23, LBR=24, RBR=25,
DOLLAR=26, AT=27, QUOTE=28, SQOUTE=29, NULL=30, INT=31, DOUBLE=32, BOOLEAN=33,
ID=34, STRING=35, VAR_GRAQL=36, ID_MACRO=37, WS=38, COMMENT=39;
public static final int
RULE_template = 0, RULE_block = 1, RULE_blockContents = 2, RULE_statement = 3,
RULE_forInStatement = 4, RULE_forEachStatement = 5, RULE_ifStatement = 6,
RULE_ifPartial = 7, RULE_elseIfPartial = 8, RULE_elsePartial = 9, RULE_expression = 10,
RULE_number = 11, RULE_int_ = 12, RULE_double_ = 13, RULE_string = 14,
RULE_list = 15, RULE_nil = 16, RULE_bool = 17, RULE_escapedExpression = 18,
RULE_untypedExpression = 19, RULE_accessor = 20, RULE_id = 21, RULE_var = 22,
RULE_keyword = 23;
public static final String[] ruleNames = {
"template", "block", "blockContents", "statement", "forInStatement", "forEachStatement",
"ifStatement", "ifPartial", "elseIfPartial", "elsePartial", "expression",
"number", "int_", "double_", "string", "list", "nil", "bool", "escapedExpression",
"untypedExpression", "accessor", "id", "var", "keyword"
};
private static final String[] _LITERAL_NAMES = {
null, "'{'", "'}'", "','", "'.'", "';'", "':'", "'for'", "'if'", "'elseif'",
"'else'", "'do'", "'in'", "'='", "'!='", "'and'", "'or'", "'not'", "'>'",
"'>='", "'<'", "'<='", "'('", "')'", "'['", "']'", "'$'", "'@'", "'\"'",
"'''", "'null'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, "FOR", "IF", "ELSEIF", "ELSE",
"DO", "IN", "EQ", "NEQ", "AND", "OR", "NOT", "GREATER", "GREATEREQ", "LESS",
"LESSEQ", "LPAREN", "RPAREN", "LBR", "RBR", "DOLLAR", "AT", "QUOTE", "SQOUTE",
"NULL", "INT", "DOUBLE", "BOOLEAN", "ID", "STRING", "VAR_GRAQL", "ID_MACRO",
"WS", "COMMENT"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "GraqlTemplate.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public GraqlTemplateParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class TemplateContext extends ParserRuleContext {
public BlockContentsContext blockContents() {
return getRuleContext(BlockContentsContext.class,0);
}
public TerminalNode EOF() { return getToken(GraqlTemplateParser.EOF, 0); }
public TemplateContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_template; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterTemplate(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitTemplate(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitTemplate(this);
else return visitor.visitChildren(this);
}
}
public final TemplateContext template() throws RecognitionException {
TemplateContext _localctx = new TemplateContext(_ctx, getState());
enterRule(_localctx, 0, RULE_template);
try {
enterOuterAlt(_localctx, 1);
{
setState(48);
blockContents();
setState(49);
match(EOF);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BlockContext extends ParserRuleContext {
public BlockContentsContext blockContents() {
return getRuleContext(BlockContentsContext.class,0);
}
public BlockContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_block; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterBlock(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitBlock(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitBlock(this);
else return visitor.visitChildren(this);
}
}
public final BlockContext block() throws RecognitionException {
BlockContext _localctx = new BlockContext(_ctx, getState());
enterRule(_localctx, 2, RULE_block);
try {
enterOuterAlt(_localctx, 1);
{
setState(51);
match(T__0);
setState(52);
blockContents();
setState(53);
match(T__1);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BlockContentsContext extends ParserRuleContext {
public List<StatementContext> statement() {
return getRuleContexts(StatementContext.class);
}
public StatementContext statement(int i) {
return getRuleContext(StatementContext.class,i);
}
public List<EscapedExpressionContext> escapedExpression() {
return getRuleContexts(EscapedExpressionContext.class);
}
public EscapedExpressionContext escapedExpression(int i) {
return getRuleContext(EscapedExpressionContext.class,i);
}
public List<VarContext> var() {
return getRuleContexts(VarContext.class);
}
public VarContext var(int i) {
return getRuleContext(VarContext.class,i);
}
public List<KeywordContext> keyword() {
return getRuleContexts(KeywordContext.class);
}
public KeywordContext keyword(int i) {
return getRuleContext(KeywordContext.class,i);
}
public List<TerminalNode> ID() { return getTokens(GraqlTemplateParser.ID); }
public TerminalNode ID(int i) {
return getToken(GraqlTemplateParser.ID, i);
}
public BlockContentsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_blockContents; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterBlockContents(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitBlockContents(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitBlockContents(this);
else return visitor.visitChildren(this);
}
}
public final BlockContentsContext blockContents() throws RecognitionException {
BlockContentsContext _localctx = new BlockContentsContext(_ctx, getState());
enterRule(_localctx, 4, RULE_blockContents);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(62);
_errHandler.sync(this);
_la = _input.LA(1);
while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__4) | (1L << T__5) | (1L << FOR) | (1L << IF) | (1L << ELSEIF) | (1L << ELSE) | (1L << DO) | (1L << IN) | (1L << EQ) | (1L << NEQ) | (1L << AND) | (1L << OR) | (1L << NOT) | (1L << GREATER) | (1L << GREATEREQ) | (1L << LESS) | (1L << LESSEQ) | (1L << LPAREN) | (1L << RPAREN) | (1L << LBR) | (1L << RBR) | (1L << DOLLAR) | (1L << QUOTE) | (1L << SQOUTE) | (1L << NULL) | (1L << BOOLEAN) | (1L << ID) | (1L << STRING) | (1L << VAR_GRAQL) | (1L << ID_MACRO))) != 0)) {
{
setState(60);
switch ( getInterpreter().adaptivePredict(_input,0,_ctx) ) {
case 1:
{
setState(55);
statement();
}
break;
case 2:
{
setState(56);
escapedExpression();
}
break;
case 3:
{
setState(57);
var();
}
break;
case 4:
{
setState(58);
keyword();
}
break;
case 5:
{
setState(59);
match(ID);
}
break;
}
}
setState(64);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class StatementContext extends ParserRuleContext {
public ForInStatementContext forInStatement() {
return getRuleContext(ForInStatementContext.class,0);
}
public ForEachStatementContext forEachStatement() {
return getRuleContext(ForEachStatementContext.class,0);
}
public IfStatementContext ifStatement() {
return getRuleContext(IfStatementContext.class,0);
}
public StatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_statement; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterStatement(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitStatement(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitStatement(this);
else return visitor.visitChildren(this);
}
}
public final StatementContext statement() throws RecognitionException {
StatementContext _localctx = new StatementContext(_ctx, getState());
enterRule(_localctx, 6, RULE_statement);
try {
setState(68);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(65);
forInStatement();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(66);
forEachStatement();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(67);
ifStatement();
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ForInStatementContext extends ParserRuleContext {
public TerminalNode FOR() { return getToken(GraqlTemplateParser.FOR, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public TerminalNode ID() { return getToken(GraqlTemplateParser.ID, 0); }
public TerminalNode IN() { return getToken(GraqlTemplateParser.IN, 0); }
public ListContext list() {
return getRuleContext(ListContext.class,0);
}
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public TerminalNode DO() { return getToken(GraqlTemplateParser.DO, 0); }
public BlockContext block() {
return getRuleContext(BlockContext.class,0);
}
public ForInStatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_forInStatement; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterForInStatement(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitForInStatement(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitForInStatement(this);
else return visitor.visitChildren(this);
}
}
public final ForInStatementContext forInStatement() throws RecognitionException {
ForInStatementContext _localctx = new ForInStatementContext(_ctx, getState());
enterRule(_localctx, 8, RULE_forInStatement);
try {
enterOuterAlt(_localctx, 1);
{
setState(70);
match(FOR);
setState(71);
match(LPAREN);
setState(72);
match(ID);
setState(73);
match(IN);
setState(74);
list();
setState(75);
match(RPAREN);
setState(76);
match(DO);
setState(77);
block();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ForEachStatementContext extends ParserRuleContext {
public TerminalNode FOR() { return getToken(GraqlTemplateParser.FOR, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public ListContext list() {
return getRuleContext(ListContext.class,0);
}
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public TerminalNode DO() { return getToken(GraqlTemplateParser.DO, 0); }
public BlockContext block() {
return getRuleContext(BlockContext.class,0);
}
public ForEachStatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_forEachStatement; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterForEachStatement(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitForEachStatement(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitForEachStatement(this);
else return visitor.visitChildren(this);
}
}
public final ForEachStatementContext forEachStatement() throws RecognitionException {
ForEachStatementContext _localctx = new ForEachStatementContext(_ctx, getState());
enterRule(_localctx, 10, RULE_forEachStatement);
try {
enterOuterAlt(_localctx, 1);
{
setState(79);
match(FOR);
setState(80);
match(LPAREN);
setState(81);
list();
setState(82);
match(RPAREN);
setState(83);
match(DO);
setState(84);
block();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IfStatementContext extends ParserRuleContext {
public IfPartialContext ifPartial() {
return getRuleContext(IfPartialContext.class,0);
}
public List<ElseIfPartialContext> elseIfPartial() {
return getRuleContexts(ElseIfPartialContext.class);
}
public ElseIfPartialContext elseIfPartial(int i) {
return getRuleContext(ElseIfPartialContext.class,i);
}
public ElsePartialContext elsePartial() {
return getRuleContext(ElsePartialContext.class,0);
}
public IfStatementContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_ifStatement; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterIfStatement(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitIfStatement(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitIfStatement(this);
else return visitor.visitChildren(this);
}
}
public final IfStatementContext ifStatement() throws RecognitionException {
IfStatementContext _localctx = new IfStatementContext(_ctx, getState());
enterRule(_localctx, 12, RULE_ifStatement);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(86);
ifPartial();
setState(90);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(87);
elseIfPartial();
}
}
}
setState(92);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
}
setState(94);
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
{
setState(93);
elsePartial();
}
break;
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IfPartialContext extends ParserRuleContext {
public TerminalNode IF() { return getToken(GraqlTemplateParser.IF, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public BoolContext bool() {
return getRuleContext(BoolContext.class,0);
}
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public TerminalNode DO() { return getToken(GraqlTemplateParser.DO, 0); }
public BlockContext block() {
return getRuleContext(BlockContext.class,0);
}
public IfPartialContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_ifPartial; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterIfPartial(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitIfPartial(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitIfPartial(this);
else return visitor.visitChildren(this);
}
}
public final IfPartialContext ifPartial() throws RecognitionException {
IfPartialContext _localctx = new IfPartialContext(_ctx, getState());
enterRule(_localctx, 14, RULE_ifPartial);
try {
enterOuterAlt(_localctx, 1);
{
setState(96);
match(IF);
setState(97);
match(LPAREN);
setState(98);
bool(0);
setState(99);
match(RPAREN);
setState(100);
match(DO);
setState(101);
block();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ElseIfPartialContext extends ParserRuleContext {
public TerminalNode ELSEIF() { return getToken(GraqlTemplateParser.ELSEIF, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public BoolContext bool() {
return getRuleContext(BoolContext.class,0);
}
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public TerminalNode DO() { return getToken(GraqlTemplateParser.DO, 0); }
public BlockContext block() {
return getRuleContext(BlockContext.class,0);
}
public ElseIfPartialContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_elseIfPartial; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterElseIfPartial(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitElseIfPartial(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitElseIfPartial(this);
else return visitor.visitChildren(this);
}
}
public final ElseIfPartialContext elseIfPartial() throws RecognitionException {
ElseIfPartialContext _localctx = new ElseIfPartialContext(_ctx, getState());
enterRule(_localctx, 16, RULE_elseIfPartial);
try {
enterOuterAlt(_localctx, 1);
{
setState(103);
match(ELSEIF);
setState(104);
match(LPAREN);
setState(105);
bool(0);
setState(106);
match(RPAREN);
setState(107);
match(DO);
setState(108);
block();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ElsePartialContext extends ParserRuleContext {
public TerminalNode ELSE() { return getToken(GraqlTemplateParser.ELSE, 0); }
public BlockContext block() {
return getRuleContext(BlockContext.class,0);
}
public ElsePartialContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_elsePartial; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterElsePartial(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitElsePartial(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitElsePartial(this);
else return visitor.visitChildren(this);
}
}
public final ElsePartialContext elsePartial() throws RecognitionException {
ElsePartialContext _localctx = new ElsePartialContext(_ctx, getState());
enterRule(_localctx, 18, RULE_elsePartial);
try {
enterOuterAlt(_localctx, 1);
{
setState(110);
match(ELSE);
setState(111);
block();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExpressionContext extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public NilContext nil() {
return getRuleContext(NilContext.class,0);
}
public StringContext string() {
return getRuleContext(StringContext.class,0);
}
public NumberContext number() {
return getRuleContext(NumberContext.class,0);
}
public TerminalNode BOOLEAN() { return getToken(GraqlTemplateParser.BOOLEAN, 0); }
public ExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitExpression(this);
else return visitor.visitChildren(this);
}
}
public final ExpressionContext expression() throws RecognitionException {
ExpressionContext _localctx = new ExpressionContext(_ctx, getState());
enterRule(_localctx, 20, RULE_expression);
try {
setState(118);
switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(113);
untypedExpression();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(114);
nil();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(115);
string();
}
break;
case 4:
enterOuterAlt(_localctx, 4);
{
setState(116);
number();
}
break;
case 5:
enterOuterAlt(_localctx, 5);
{
setState(117);
match(BOOLEAN);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class NumberContext extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public Int_Context int_() {
return getRuleContext(Int_Context.class,0);
}
public Double_Context double_() {
return getRuleContext(Double_Context.class,0);
}
public NumberContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_number; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterNumber(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitNumber(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitNumber(this);
else return visitor.visitChildren(this);
}
}
public final NumberContext number() throws RecognitionException {
NumberContext _localctx = new NumberContext(_ctx, getState());
enterRule(_localctx, 22, RULE_number);
try {
setState(123);
switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(120);
untypedExpression();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(121);
int_();
}
break;
case 3:
enterOuterAlt(_localctx, 3);
{
setState(122);
double_();
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Int_Context extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public TerminalNode INT() { return getToken(GraqlTemplateParser.INT, 0); }
public Int_Context(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_int_; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterInt_(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitInt_(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitInt_(this);
else return visitor.visitChildren(this);
}
}
public final Int_Context int_() throws RecognitionException {
Int_Context _localctx = new Int_Context(_ctx, getState());
enterRule(_localctx, 24, RULE_int_);
try {
setState(127);
switch (_input.LA(1)) {
case LESS:
case ID_MACRO:
enterOuterAlt(_localctx, 1);
{
setState(125);
untypedExpression();
}
break;
case INT:
enterOuterAlt(_localctx, 2);
{
setState(126);
match(INT);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Double_Context extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public TerminalNode DOUBLE() { return getToken(GraqlTemplateParser.DOUBLE, 0); }
public Double_Context(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_double_; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterDouble_(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitDouble_(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitDouble_(this);
else return visitor.visitChildren(this);
}
}
public final Double_Context double_() throws RecognitionException {
Double_Context _localctx = new Double_Context(_ctx, getState());
enterRule(_localctx, 26, RULE_double_);
try {
setState(131);
switch (_input.LA(1)) {
case LESS:
case ID_MACRO:
enterOuterAlt(_localctx, 1);
{
setState(129);
untypedExpression();
}
break;
case DOUBLE:
enterOuterAlt(_localctx, 2);
{
setState(130);
match(DOUBLE);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class StringContext extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public TerminalNode STRING() { return getToken(GraqlTemplateParser.STRING, 0); }
public StringContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_string; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterString(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitString(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitString(this);
else return visitor.visitChildren(this);
}
}
public final StringContext string() throws RecognitionException {
StringContext _localctx = new StringContext(_ctx, getState());
enterRule(_localctx, 28, RULE_string);
try {
setState(135);
switch (_input.LA(1)) {
case LESS:
case ID_MACRO:
enterOuterAlt(_localctx, 1);
{
setState(133);
untypedExpression();
}
break;
case STRING:
enterOuterAlt(_localctx, 2);
{
setState(134);
match(STRING);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ListContext extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public ListContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterList(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitList(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitList(this);
else return visitor.visitChildren(this);
}
}
public final ListContext list() throws RecognitionException {
ListContext _localctx = new ListContext(_ctx, getState());
enterRule(_localctx, 30, RULE_list);
try {
enterOuterAlt(_localctx, 1);
{
setState(137);
untypedExpression();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class NilContext extends ParserRuleContext {
public TerminalNode NULL() { return getToken(GraqlTemplateParser.NULL, 0); }
public NilContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_nil; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterNil(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitNil(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitNil(this);
else return visitor.visitChildren(this);
}
}
public final NilContext nil() throws RecognitionException {
NilContext _localctx = new NilContext(_ctx, getState());
enterRule(_localctx, 32, RULE_nil);
try {
enterOuterAlt(_localctx, 1);
{
setState(139);
match(NULL);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class BoolContext extends ParserRuleContext {
public BoolContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_bool; }
public BoolContext() { }
public void copyFrom(BoolContext ctx) {
super.copyFrom(ctx);
}
}
public static class GroupExpressionContext extends BoolContext {
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public BoolContext bool() {
return getRuleContext(BoolContext.class,0);
}
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public GroupExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterGroupExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitGroupExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitGroupExpression(this);
else return visitor.visitChildren(this);
}
}
public static class OrExpressionContext extends BoolContext {
public List<BoolContext> bool() {
return getRuleContexts(BoolContext.class);
}
public BoolContext bool(int i) {
return getRuleContext(BoolContext.class,i);
}
public TerminalNode OR() { return getToken(GraqlTemplateParser.OR, 0); }
public OrExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterOrExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitOrExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitOrExpression(this);
else return visitor.visitChildren(this);
}
}
public static class EqExpressionContext extends BoolContext {
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public TerminalNode EQ() { return getToken(GraqlTemplateParser.EQ, 0); }
public EqExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterEqExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitEqExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitEqExpression(this);
else return visitor.visitChildren(this);
}
}
public static class AndExpressionContext extends BoolContext {
public List<BoolContext> bool() {
return getRuleContexts(BoolContext.class);
}
public BoolContext bool(int i) {
return getRuleContext(BoolContext.class,i);
}
public TerminalNode AND() { return getToken(GraqlTemplateParser.AND, 0); }
public AndExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterAndExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitAndExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitAndExpression(this);
else return visitor.visitChildren(this);
}
}
public static class GreaterExpressionContext extends BoolContext {
public List<NumberContext> number() {
return getRuleContexts(NumberContext.class);
}
public NumberContext number(int i) {
return getRuleContext(NumberContext.class,i);
}
public TerminalNode GREATER() { return getToken(GraqlTemplateParser.GREATER, 0); }
public GreaterExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterGreaterExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitGreaterExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitGreaterExpression(this);
else return visitor.visitChildren(this);
}
}
public static class LessEqExpressionContext extends BoolContext {
public List<NumberContext> number() {
return getRuleContexts(NumberContext.class);
}
public NumberContext number(int i) {
return getRuleContext(NumberContext.class,i);
}
public TerminalNode LESSEQ() { return getToken(GraqlTemplateParser.LESSEQ, 0); }
public LessEqExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterLessEqExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitLessEqExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitLessEqExpression(this);
else return visitor.visitChildren(this);
}
}
public static class NotEqExpressionContext extends BoolContext {
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public TerminalNode NEQ() { return getToken(GraqlTemplateParser.NEQ, 0); }
public NotEqExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterNotEqExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitNotEqExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitNotEqExpression(this);
else return visitor.visitChildren(this);
}
}
public static class LessExpressionContext extends BoolContext {
public List<NumberContext> number() {
return getRuleContexts(NumberContext.class);
}
public NumberContext number(int i) {
return getRuleContext(NumberContext.class,i);
}
public TerminalNode LESS() { return getToken(GraqlTemplateParser.LESS, 0); }
public LessExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterLessExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitLessExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitLessExpression(this);
else return visitor.visitChildren(this);
}
}
public static class NotExpressionContext extends BoolContext {
public TerminalNode NOT() { return getToken(GraqlTemplateParser.NOT, 0); }
public BoolContext bool() {
return getRuleContext(BoolContext.class,0);
}
public NotExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterNotExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitNotExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitNotExpression(this);
else return visitor.visitChildren(this);
}
}
public static class GreaterEqExpressionContext extends BoolContext {
public List<NumberContext> number() {
return getRuleContexts(NumberContext.class);
}
public NumberContext number(int i) {
return getRuleContext(NumberContext.class,i);
}
public TerminalNode GREATEREQ() { return getToken(GraqlTemplateParser.GREATEREQ, 0); }
public GreaterEqExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterGreaterEqExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitGreaterEqExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitGreaterEqExpression(this);
else return visitor.visitChildren(this);
}
}
public static class BooleanExpressionContext extends BoolContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public BooleanExpressionContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterBooleanExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitBooleanExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitBooleanExpression(this);
else return visitor.visitChildren(this);
}
}
public static class BooleanConstantContext extends BoolContext {
public TerminalNode BOOLEAN() { return getToken(GraqlTemplateParser.BOOLEAN, 0); }
public BooleanConstantContext(BoolContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterBooleanConstant(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitBooleanConstant(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitBooleanConstant(this);
else return visitor.visitChildren(this);
}
}
public final BoolContext bool() throws RecognitionException {
return bool(0);
}
private BoolContext bool(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
BoolContext _localctx = new BoolContext(_ctx, _parentState);
BoolContext _prevctx = _localctx;
int _startState = 34;
enterRecursionRule(_localctx, 34, RULE_bool, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(174);
switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) {
case 1:
{
_localctx = new NotExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(142);
match(NOT);
setState(143);
bool(11);
}
break;
case 2:
{
_localctx = new GroupExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(144);
match(LPAREN);
setState(145);
bool(0);
setState(146);
match(RPAREN);
}
break;
case 3:
{
_localctx = new EqExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(148);
expression();
setState(149);
match(EQ);
setState(150);
expression();
}
break;
case 4:
{
_localctx = new NotEqExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(152);
expression();
setState(153);
match(NEQ);
setState(154);
expression();
}
break;
case 5:
{
_localctx = new GreaterExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(156);
number();
setState(157);
match(GREATER);
setState(158);
number();
}
break;
case 6:
{
_localctx = new GreaterEqExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(160);
number();
setState(161);
match(GREATEREQ);
setState(162);
number();
}
break;
case 7:
{
_localctx = new LessExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(164);
number();
setState(165);
match(LESS);
setState(166);
number();
}
break;
case 8:
{
_localctx = new LessEqExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(168);
number();
setState(169);
match(LESSEQ);
setState(170);
number();
}
break;
case 9:
{
_localctx = new BooleanExpressionContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(172);
untypedExpression();
}
break;
case 10:
{
_localctx = new BooleanConstantContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(173);
match(BOOLEAN);
}
break;
}
_ctx.stop = _input.LT(-1);
setState(184);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,12,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(182);
switch ( getInterpreter().adaptivePredict(_input,11,_ctx) ) {
case 1:
{
_localctx = new OrExpressionContext(new BoolContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_bool);
setState(176);
if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
setState(177);
match(OR);
setState(178);
bool(9);
}
break;
case 2:
{
_localctx = new AndExpressionContext(new BoolContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_bool);
setState(179);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
setState(180);
match(AND);
setState(181);
bool(8);
}
break;
}
}
}
setState(186);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,12,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class EscapedExpressionContext extends ParserRuleContext {
public UntypedExpressionContext untypedExpression() {
return getRuleContext(UntypedExpressionContext.class,0);
}
public EscapedExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_escapedExpression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterEscapedExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitEscapedExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitEscapedExpression(this);
else return visitor.visitChildren(this);
}
}
public final EscapedExpressionContext escapedExpression() throws RecognitionException {
EscapedExpressionContext _localctx = new EscapedExpressionContext(_ctx, getState());
enterRule(_localctx, 36, RULE_escapedExpression);
try {
enterOuterAlt(_localctx, 1);
{
setState(187);
untypedExpression();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class UntypedExpressionContext extends ParserRuleContext {
public UntypedExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_untypedExpression; }
public UntypedExpressionContext() { }
public void copyFrom(UntypedExpressionContext ctx) {
super.copyFrom(ctx);
}
}
public static class IdExpressionContext extends UntypedExpressionContext {
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public List<AccessorContext> accessor() {
return getRuleContexts(AccessorContext.class);
}
public AccessorContext accessor(int i) {
return getRuleContext(AccessorContext.class,i);
}
public IdExpressionContext(UntypedExpressionContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterIdExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitIdExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitIdExpression(this);
else return visitor.visitChildren(this);
}
}
public static class MacroExpressionContext extends UntypedExpressionContext {
public TerminalNode ID_MACRO() { return getToken(GraqlTemplateParser.ID_MACRO, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public List<ExpressionContext> expression() {
return getRuleContexts(ExpressionContext.class);
}
public ExpressionContext expression(int i) {
return getRuleContext(ExpressionContext.class,i);
}
public MacroExpressionContext(UntypedExpressionContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterMacroExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitMacroExpression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitMacroExpression(this);
else return visitor.visitChildren(this);
}
}
public final UntypedExpressionContext untypedExpression() throws RecognitionException {
UntypedExpressionContext _localctx = new UntypedExpressionContext(_ctx, getState());
enterRule(_localctx, 38, RULE_untypedExpression);
int _la;
try {
setState(212);
switch (_input.LA(1)) {
case LESS:
_localctx = new IdExpressionContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(189);
match(LESS);
setState(190);
id();
setState(194);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__3 || _la==LBR) {
{
{
setState(191);
accessor();
}
}
setState(196);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(197);
match(GREATER);
}
break;
case ID_MACRO:
_localctx = new MacroExpressionContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(199);
match(ID_MACRO);
setState(200);
match(LPAREN);
setState(202);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << LESS) | (1L << NULL) | (1L << INT) | (1L << DOUBLE) | (1L << BOOLEAN) | (1L << STRING) | (1L << ID_MACRO))) != 0)) {
{
setState(201);
expression();
}
}
setState(208);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__2) {
{
{
setState(204);
match(T__2);
setState(205);
expression();
}
}
setState(210);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(211);
match(RPAREN);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AccessorContext extends ParserRuleContext {
public AccessorContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_accessor; }
public AccessorContext() { }
public void copyFrom(AccessorContext ctx) {
super.copyFrom(ctx);
}
}
public static class ListAccessorContext extends AccessorContext {
public Int_Context int_() {
return getRuleContext(Int_Context.class,0);
}
public ListAccessorContext(AccessorContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterListAccessor(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitListAccessor(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitListAccessor(this);
else return visitor.visitChildren(this);
}
}
public static class MapAccessorContext extends AccessorContext {
public IdContext id() {
return getRuleContext(IdContext.class,0);
}
public MapAccessorContext(AccessorContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterMapAccessor(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitMapAccessor(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitMapAccessor(this);
else return visitor.visitChildren(this);
}
}
public final AccessorContext accessor() throws RecognitionException {
AccessorContext _localctx = new AccessorContext(_ctx, getState());
enterRule(_localctx, 40, RULE_accessor);
try {
setState(220);
switch (_input.LA(1)) {
case T__3:
_localctx = new MapAccessorContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(214);
match(T__3);
setState(215);
id();
}
break;
case LBR:
_localctx = new ListAccessorContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(216);
match(LBR);
setState(217);
int_();
setState(218);
match(RBR);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IdContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(GraqlTemplateParser.ID, 0); }
public TerminalNode STRING() { return getToken(GraqlTemplateParser.STRING, 0); }
public IdContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_id; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterId(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitId(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitId(this);
else return visitor.visitChildren(this);
}
}
public final IdContext id() throws RecognitionException {
IdContext _localctx = new IdContext(_ctx, getState());
enterRule(_localctx, 42, RULE_id);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(222);
_la = _input.LA(1);
if ( !(_la==ID || _la==STRING) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class VarContext extends ParserRuleContext {
public VarContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_var; }
public VarContext() { }
public void copyFrom(VarContext ctx) {
super.copyFrom(ctx);
}
}
public static class VarResolvedContext extends VarContext {
public TerminalNode DOLLAR() { return getToken(GraqlTemplateParser.DOLLAR, 0); }
public List<UntypedExpressionContext> untypedExpression() {
return getRuleContexts(UntypedExpressionContext.class);
}
public UntypedExpressionContext untypedExpression(int i) {
return getRuleContext(UntypedExpressionContext.class,i);
}
public VarResolvedContext(VarContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterVarResolved(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitVarResolved(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitVarResolved(this);
else return visitor.visitChildren(this);
}
}
public static class VarLiteralContext extends VarContext {
public TerminalNode VAR_GRAQL() { return getToken(GraqlTemplateParser.VAR_GRAQL, 0); }
public VarLiteralContext(VarContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterVarLiteral(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitVarLiteral(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitVarLiteral(this);
else return visitor.visitChildren(this);
}
}
public final VarContext var() throws RecognitionException {
VarContext _localctx = new VarContext(_ctx, getState());
enterRule(_localctx, 44, RULE_var);
try {
int _alt;
setState(231);
switch (_input.LA(1)) {
case DOLLAR:
_localctx = new VarResolvedContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(224);
match(DOLLAR);
setState(226);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
setState(225);
untypedExpression();
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(228);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,18,_ctx);
} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );
}
break;
case VAR_GRAQL:
_localctx = new VarLiteralContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(230);
match(VAR_GRAQL);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class KeywordContext extends ParserRuleContext {
public TerminalNode RPAREN() { return getToken(GraqlTemplateParser.RPAREN, 0); }
public TerminalNode LPAREN() { return getToken(GraqlTemplateParser.LPAREN, 0); }
public TerminalNode LBR() { return getToken(GraqlTemplateParser.LBR, 0); }
public TerminalNode RBR() { return getToken(GraqlTemplateParser.RBR, 0); }
public TerminalNode FOR() { return getToken(GraqlTemplateParser.FOR, 0); }
public TerminalNode IF() { return getToken(GraqlTemplateParser.IF, 0); }
public TerminalNode ELSEIF() { return getToken(GraqlTemplateParser.ELSEIF, 0); }
public TerminalNode ELSE() { return getToken(GraqlTemplateParser.ELSE, 0); }
public TerminalNode DO() { return getToken(GraqlTemplateParser.DO, 0); }
public TerminalNode IN() { return getToken(GraqlTemplateParser.IN, 0); }
public TerminalNode BOOLEAN() { return getToken(GraqlTemplateParser.BOOLEAN, 0); }
public TerminalNode AND() { return getToken(GraqlTemplateParser.AND, 0); }
public TerminalNode OR() { return getToken(GraqlTemplateParser.OR, 0); }
public TerminalNode NOT() { return getToken(GraqlTemplateParser.NOT, 0); }
public TerminalNode NULL() { return getToken(GraqlTemplateParser.NULL, 0); }
public TerminalNode EQ() { return getToken(GraqlTemplateParser.EQ, 0); }
public TerminalNode NEQ() { return getToken(GraqlTemplateParser.NEQ, 0); }
public TerminalNode GREATER() { return getToken(GraqlTemplateParser.GREATER, 0); }
public TerminalNode GREATEREQ() { return getToken(GraqlTemplateParser.GREATEREQ, 0); }
public TerminalNode LESS() { return getToken(GraqlTemplateParser.LESS, 0); }
public TerminalNode LESSEQ() { return getToken(GraqlTemplateParser.LESSEQ, 0); }
public TerminalNode QUOTE() { return getToken(GraqlTemplateParser.QUOTE, 0); }
public TerminalNode SQOUTE() { return getToken(GraqlTemplateParser.SQOUTE, 0); }
public TerminalNode STRING() { return getToken(GraqlTemplateParser.STRING, 0); }
public KeywordContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_keyword; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).enterKeyword(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GraqlTemplateListener ) ((GraqlTemplateListener)listener).exitKeyword(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GraqlTemplateVisitor ) return ((GraqlTemplateVisitor<? extends T>)visitor).visitKeyword(this);
else return visitor.visitChildren(this);
}
}
public final KeywordContext keyword() throws RecognitionException {
KeywordContext _localctx = new KeywordContext(_ctx, getState());
enterRule(_localctx, 46, RULE_keyword);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(233);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__4) | (1L << T__5) | (1L << FOR) | (1L << IF) | (1L << ELSEIF) | (1L << ELSE) | (1L << DO) | (1L << IN) | (1L << EQ) | (1L << NEQ) | (1L << AND) | (1L << OR) | (1L << NOT) | (1L << GREATER) | (1L << GREATEREQ) | (1L << LESS) | (1L << LESSEQ) | (1L << LPAREN) | (1L << RPAREN) | (1L << LBR) | (1L << RBR) | (1L << QUOTE) | (1L << SQOUTE) | (1L << NULL) | (1L << BOOLEAN) | (1L << STRING))) != 0)) ) {
_errHandler.recoverInline(this);
} else {
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 17:
return bool_sempred((BoolContext)_localctx, predIndex);
}
return true;
}
private boolean bool_sempred(BoolContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 8);
case 1:
return precpred(_ctx, 7);
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3)\u00ee\4\2\t\2\4"+
"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\7\4?\n\4\f\4\16\4B\13"+
"\4\3\5\3\5\3\5\5\5G\n\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3"+
"\7\3\7\3\7\3\7\3\7\3\b\3\b\7\b[\n\b\f\b\16\b^\13\b\3\b\5\ba\n\b\3\t\3"+
"\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\f"+
"\3\f\3\f\3\f\3\f\5\fy\n\f\3\r\3\r\3\r\5\r~\n\r\3\16\3\16\5\16\u0082\n"+
"\16\3\17\3\17\5\17\u0086\n\17\3\20\3\20\5\20\u008a\n\20\3\21\3\21\3\22"+
"\3\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23"+
"\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23"+
"\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u00b1\n\23\3\23\3\23\3\23\3\23\3\23"+
"\3\23\7\23\u00b9\n\23\f\23\16\23\u00bc\13\23\3\24\3\24\3\25\3\25\3\25"+
"\7\25\u00c3\n\25\f\25\16\25\u00c6\13\25\3\25\3\25\3\25\3\25\3\25\5\25"+
"\u00cd\n\25\3\25\3\25\7\25\u00d1\n\25\f\25\16\25\u00d4\13\25\3\25\5\25"+
"\u00d7\n\25\3\26\3\26\3\26\3\26\3\26\3\26\5\26\u00df\n\26\3\27\3\27\3"+
"\30\3\30\6\30\u00e5\n\30\r\30\16\30\u00e6\3\30\5\30\u00ea\n\30\3\31\3"+
"\31\3\31\2\3$\32\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\2"+
"\4\3\2$%\7\2\5\5\7\33\36 ##%%\u00f9\2\62\3\2\2\2\4\65\3\2\2\2\6@\3\2\2"+
"\2\bF\3\2\2\2\nH\3\2\2\2\fQ\3\2\2\2\16X\3\2\2\2\20b\3\2\2\2\22i\3\2\2"+
"\2\24p\3\2\2\2\26x\3\2\2\2\30}\3\2\2\2\32\u0081\3\2\2\2\34\u0085\3\2\2"+
"\2\36\u0089\3\2\2\2 \u008b\3\2\2\2\"\u008d\3\2\2\2$\u00b0\3\2\2\2&\u00bd"+
"\3\2\2\2(\u00d6\3\2\2\2*\u00de\3\2\2\2,\u00e0\3\2\2\2.\u00e9\3\2\2\2\60"+
"\u00eb\3\2\2\2\62\63\5\6\4\2\63\64\7\2\2\3\64\3\3\2\2\2\65\66\7\3\2\2"+
"\66\67\5\6\4\2\678\7\4\2\28\5\3\2\2\29?\5\b\5\2:?\5&\24\2;?\5.\30\2<?"+
"\5\60\31\2=?\7$\2\2>9\3\2\2\2>:\3\2\2\2>;\3\2\2\2><\3\2\2\2>=\3\2\2\2"+
"?B\3\2\2\2@>\3\2\2\2@A\3\2\2\2A\7\3\2\2\2B@\3\2\2\2CG\5\n\6\2DG\5\f\7"+
"\2EG\5\16\b\2FC\3\2\2\2FD\3\2\2\2FE\3\2\2\2G\t\3\2\2\2HI\7\t\2\2IJ\7\30"+
"\2\2JK\7$\2\2KL\7\16\2\2LM\5 \21\2MN\7\31\2\2NO\7\r\2\2OP\5\4\3\2P\13"+
"\3\2\2\2QR\7\t\2\2RS\7\30\2\2ST\5 \21\2TU\7\31\2\2UV\7\r\2\2VW\5\4\3\2"+
"W\r\3\2\2\2X\\\5\20\t\2Y[\5\22\n\2ZY\3\2\2\2[^\3\2\2\2\\Z\3\2\2\2\\]\3"+
"\2\2\2]`\3\2\2\2^\\\3\2\2\2_a\5\24\13\2`_\3\2\2\2`a\3\2\2\2a\17\3\2\2"+
"\2bc\7\n\2\2cd\7\30\2\2de\5$\23\2ef\7\31\2\2fg\7\r\2\2gh\5\4\3\2h\21\3"+
"\2\2\2ij\7\13\2\2jk\7\30\2\2kl\5$\23\2lm\7\31\2\2mn\7\r\2\2no\5\4\3\2"+
"o\23\3\2\2\2pq\7\f\2\2qr\5\4\3\2r\25\3\2\2\2sy\5(\25\2ty\5\"\22\2uy\5"+
"\36\20\2vy\5\30\r\2wy\7#\2\2xs\3\2\2\2xt\3\2\2\2xu\3\2\2\2xv\3\2\2\2x"+
"w\3\2\2\2y\27\3\2\2\2z~\5(\25\2{~\5\32\16\2|~\5\34\17\2}z\3\2\2\2}{\3"+
"\2\2\2}|\3\2\2\2~\31\3\2\2\2\177\u0082\5(\25\2\u0080\u0082\7!\2\2\u0081"+
"\177\3\2\2\2\u0081\u0080\3\2\2\2\u0082\33\3\2\2\2\u0083\u0086\5(\25\2"+
"\u0084\u0086\7\"\2\2\u0085\u0083\3\2\2\2\u0085\u0084\3\2\2\2\u0086\35"+
"\3\2\2\2\u0087\u008a\5(\25\2\u0088\u008a\7%\2\2\u0089\u0087\3\2\2\2\u0089"+
"\u0088\3\2\2\2\u008a\37\3\2\2\2\u008b\u008c\5(\25\2\u008c!\3\2\2\2\u008d"+
"\u008e\7 \2\2\u008e#\3\2\2\2\u008f\u0090\b\23\1\2\u0090\u0091\7\23\2\2"+
"\u0091\u00b1\5$\23\r\u0092\u0093\7\30\2\2\u0093\u0094\5$\23\2\u0094\u0095"+
"\7\31\2\2\u0095\u00b1\3\2\2\2\u0096\u0097\5\26\f\2\u0097\u0098\7\17\2"+
"\2\u0098\u0099\5\26\f\2\u0099\u00b1\3\2\2\2\u009a\u009b\5\26\f\2\u009b"+
"\u009c\7\20\2\2\u009c\u009d\5\26\f\2\u009d\u00b1\3\2\2\2\u009e\u009f\5"+
"\30\r\2\u009f\u00a0\7\24\2\2\u00a0\u00a1\5\30\r\2\u00a1\u00b1\3\2\2\2"+
"\u00a2\u00a3\5\30\r\2\u00a3\u00a4\7\25\2\2\u00a4\u00a5\5\30\r\2\u00a5"+
"\u00b1\3\2\2\2\u00a6\u00a7\5\30\r\2\u00a7\u00a8\7\26\2\2\u00a8\u00a9\5"+
"\30\r\2\u00a9\u00b1\3\2\2\2\u00aa\u00ab\5\30\r\2\u00ab\u00ac\7\27\2\2"+
"\u00ac\u00ad\5\30\r\2\u00ad\u00b1\3\2\2\2\u00ae\u00b1\5(\25\2\u00af\u00b1"+
"\7#\2\2\u00b0\u008f\3\2\2\2\u00b0\u0092\3\2\2\2\u00b0\u0096\3\2\2\2\u00b0"+
"\u009a\3\2\2\2\u00b0\u009e\3\2\2\2\u00b0\u00a2\3\2\2\2\u00b0\u00a6\3\2"+
"\2\2\u00b0\u00aa\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b0\u00af\3\2\2\2\u00b1"+
"\u00ba\3\2\2\2\u00b2\u00b3\f\n\2\2\u00b3\u00b4\7\22\2\2\u00b4\u00b9\5"+
"$\23\13\u00b5\u00b6\f\t\2\2\u00b6\u00b7\7\21\2\2\u00b7\u00b9\5$\23\n\u00b8"+
"\u00b2\3\2\2\2\u00b8\u00b5\3\2\2\2\u00b9\u00bc\3\2\2\2\u00ba\u00b8\3\2"+
"\2\2\u00ba\u00bb\3\2\2\2\u00bb%\3\2\2\2\u00bc\u00ba\3\2\2\2\u00bd\u00be"+
"\5(\25\2\u00be\'\3\2\2\2\u00bf\u00c0\7\26\2\2\u00c0\u00c4\5,\27\2\u00c1"+
"\u00c3\5*\26\2\u00c2\u00c1\3\2\2\2\u00c3\u00c6\3\2\2\2\u00c4\u00c2\3\2"+
"\2\2\u00c4\u00c5\3\2\2\2\u00c5\u00c7\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c7"+
"\u00c8\7\24\2\2\u00c8\u00d7\3\2\2\2\u00c9\u00ca\7\'\2\2\u00ca\u00cc\7"+
"\30\2\2\u00cb\u00cd\5\26\f\2\u00cc\u00cb\3\2\2\2\u00cc\u00cd\3\2\2\2\u00cd"+
"\u00d2\3\2\2\2\u00ce\u00cf\7\5\2\2\u00cf\u00d1\5\26\f\2\u00d0\u00ce\3"+
"\2\2\2\u00d1\u00d4\3\2\2\2\u00d2\u00d0\3\2\2\2\u00d2\u00d3\3\2\2\2\u00d3"+
"\u00d5\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d5\u00d7\7\31\2\2\u00d6\u00bf\3"+
"\2\2\2\u00d6\u00c9\3\2\2\2\u00d7)\3\2\2\2\u00d8\u00d9\7\6\2\2\u00d9\u00df"+
"\5,\27\2\u00da\u00db\7\32\2\2\u00db\u00dc\5\32\16\2\u00dc\u00dd\7\33\2"+
"\2\u00dd\u00df\3\2\2\2\u00de\u00d8\3\2\2\2\u00de\u00da\3\2\2\2\u00df+"+
"\3\2\2\2\u00e0\u00e1\t\2\2\2\u00e1-\3\2\2\2\u00e2\u00e4\7\34\2\2\u00e3"+
"\u00e5\5(\25\2\u00e4\u00e3\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6\u00e4\3\2"+
"\2\2\u00e6\u00e7\3\2\2\2\u00e7\u00ea\3\2\2\2\u00e8\u00ea\7&\2\2\u00e9"+
"\u00e2\3\2\2\2\u00e9\u00e8\3\2\2\2\u00ea/\3\2\2\2\u00eb\u00ec\t\3\2\2"+
"\u00ec\61\3\2\2\2\26>@F\\`x}\u0081\u0085\u0089\u00b0\u00b8\u00ba\u00c4"+
"\u00cc\u00d2\u00d6\u00de\u00e6\u00e9";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlTemplateVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/GraqlTemplate.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link GraqlTemplateParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface GraqlTemplateVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#template}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTemplate(GraqlTemplateParser.TemplateContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBlock(GraqlTemplateParser.BlockContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#blockContents}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBlockContents(GraqlTemplateParser.BlockContentsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatement(GraqlTemplateParser.StatementContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#forInStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForInStatement(GraqlTemplateParser.ForInStatementContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#forEachStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForEachStatement(GraqlTemplateParser.ForEachStatementContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#ifStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfStatement(GraqlTemplateParser.IfStatementContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#ifPartial}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfPartial(GraqlTemplateParser.IfPartialContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#elseIfPartial}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElseIfPartial(GraqlTemplateParser.ElseIfPartialContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#elsePartial}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElsePartial(GraqlTemplateParser.ElsePartialContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExpression(GraqlTemplateParser.ExpressionContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#number}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumber(GraqlTemplateParser.NumberContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#int_}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInt_(GraqlTemplateParser.Int_Context ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#double_}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDouble_(GraqlTemplateParser.Double_Context ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#string}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitString(GraqlTemplateParser.StringContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#list}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitList(GraqlTemplateParser.ListContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#nil}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNil(GraqlTemplateParser.NilContext ctx);
/**
* Visit a parse tree produced by the {@code groupExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroupExpression(GraqlTemplateParser.GroupExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code orExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrExpression(GraqlTemplateParser.OrExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code eqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEqExpression(GraqlTemplateParser.EqExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code andExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAndExpression(GraqlTemplateParser.AndExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code greaterExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGreaterExpression(GraqlTemplateParser.GreaterExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code lessEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLessEqExpression(GraqlTemplateParser.LessEqExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code notEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNotEqExpression(GraqlTemplateParser.NotEqExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code lessExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLessExpression(GraqlTemplateParser.LessExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code notExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNotExpression(GraqlTemplateParser.NotExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code greaterEqExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGreaterEqExpression(GraqlTemplateParser.GreaterEqExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code booleanExpression}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBooleanExpression(GraqlTemplateParser.BooleanExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code booleanConstant}
* labeled alternative in {@link GraqlTemplateParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBooleanConstant(GraqlTemplateParser.BooleanConstantContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#escapedExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEscapedExpression(GraqlTemplateParser.EscapedExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code idExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdExpression(GraqlTemplateParser.IdExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code macroExpression}
* labeled alternative in {@link GraqlTemplateParser#untypedExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMacroExpression(GraqlTemplateParser.MacroExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code mapAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMapAccessor(GraqlTemplateParser.MapAccessorContext ctx);
/**
* Visit a parse tree produced by the {@code listAccessor}
* labeled alternative in {@link GraqlTemplateParser#accessor}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitListAccessor(GraqlTemplateParser.ListAccessorContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#id}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitId(GraqlTemplateParser.IdContext ctx);
/**
* Visit a parse tree produced by the {@code varResolved}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarResolved(GraqlTemplateParser.VarResolvedContext ctx);
/**
* Visit a parse tree produced by the {@code varLiteral}
* labeled alternative in {@link GraqlTemplateParser#var}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarLiteral(GraqlTemplateParser.VarLiteralContext ctx);
/**
* Visit a parse tree produced by {@link GraqlTemplateParser#keyword}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitKeyword(GraqlTemplateParser.KeywordContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GraqlVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/Graql.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link GraqlParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface GraqlVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link GraqlParser#queryList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQueryList(GraqlParser.QueryListContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#queryEOF}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQueryEOF(GraqlParser.QueryEOFContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#query}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuery(GraqlParser.QueryContext ctx);
/**
* Visit a parse tree produced by the {@code matchBase}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMatchBase(GraqlParser.MatchBaseContext ctx);
/**
* Visit a parse tree produced by the {@code matchOffset}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMatchOffset(GraqlParser.MatchOffsetContext ctx);
/**
* Visit a parse tree produced by the {@code matchOrderBy}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMatchOrderBy(GraqlParser.MatchOrderByContext ctx);
/**
* Visit a parse tree produced by the {@code matchLimit}
* labeled alternative in {@link GraqlParser#matchPart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMatchLimit(GraqlParser.MatchLimitContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#getQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGetQuery(GraqlParser.GetQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#insertQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInsertQuery(GraqlParser.InsertQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#defineQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineQuery(GraqlParser.DefineQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#undefineQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUndefineQuery(GraqlParser.UndefineQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#deleteQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeleteQuery(GraqlParser.DeleteQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#aggregateQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAggregateQuery(GraqlParser.AggregateQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#variables}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariables(GraqlParser.VariablesContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeQuery(GraqlParser.ComputeQueryContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeMethod}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeMethod(GraqlParser.ComputeMethodContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeConditions}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeConditions(GraqlParser.ComputeConditionsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeCondition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeCondition(GraqlParser.ComputeConditionContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeFromID}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeFromID(GraqlParser.ComputeFromIDContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeToID}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeToID(GraqlParser.ComputeToIDContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeOfLabels}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeOfLabels(GraqlParser.ComputeOfLabelsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeInLabels}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeInLabels(GraqlParser.ComputeInLabelsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeAlgorithm}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeAlgorithm(GraqlParser.ComputeAlgorithmContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeArgs}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgs(GraqlParser.ComputeArgsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#computeArgsArray}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgsArray(GraqlParser.ComputeArgsArrayContext ctx);
/**
* Visit a parse tree produced by the {@code computeArgMinK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgMinK(GraqlParser.ComputeArgMinKContext ctx);
/**
* Visit a parse tree produced by the {@code computeArgK}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgK(GraqlParser.ComputeArgKContext ctx);
/**
* Visit a parse tree produced by the {@code computeArgSize}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgSize(GraqlParser.ComputeArgSizeContext ctx);
/**
* Visit a parse tree produced by the {@code computeArgContains}
* labeled alternative in {@link GraqlParser#computeArg}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComputeArgContains(GraqlParser.ComputeArgContainsContext ctx);
/**
* Visit a parse tree produced by the {@code customAgg}
* labeled alternative in {@link GraqlParser#aggregate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCustomAgg(GraqlParser.CustomAggContext ctx);
/**
* Visit a parse tree produced by the {@code variableArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariableArgument(GraqlParser.VariableArgumentContext ctx);
/**
* Visit a parse tree produced by the {@code aggregateArgument}
* labeled alternative in {@link GraqlParser#argument}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAggregateArgument(GraqlParser.AggregateArgumentContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#patterns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPatterns(GraqlParser.PatternsContext ctx);
/**
* Visit a parse tree produced by the {@code varPatternCase}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarPatternCase(GraqlParser.VarPatternCaseContext ctx);
/**
* Visit a parse tree produced by the {@code andPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAndPattern(GraqlParser.AndPatternContext ctx);
/**
* Visit a parse tree produced by the {@code orPattern}
* labeled alternative in {@link GraqlParser#pattern}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrPattern(GraqlParser.OrPatternContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#varPatterns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarPatterns(GraqlParser.VarPatternsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#varPattern}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarPattern(GraqlParser.VarPatternContext ctx);
/**
* Visit a parse tree produced by the {@code isa}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIsa(GraqlParser.IsaContext ctx);
/**
* Visit a parse tree produced by the {@code isaExplicit}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIsaExplicit(GraqlParser.IsaExplicitContext ctx);
/**
* Visit a parse tree produced by the {@code sub}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSub(GraqlParser.SubContext ctx);
/**
* Visit a parse tree produced by the {@code relates}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRelates(GraqlParser.RelatesContext ctx);
/**
* Visit a parse tree produced by the {@code plays}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPlays(GraqlParser.PlaysContext ctx);
/**
* Visit a parse tree produced by the {@code propId}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropId(GraqlParser.PropIdContext ctx);
/**
* Visit a parse tree produced by the {@code propLabel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropLabel(GraqlParser.PropLabelContext ctx);
/**
* Visit a parse tree produced by the {@code propValue}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropValue(GraqlParser.PropValueContext ctx);
/**
* Visit a parse tree produced by the {@code propWhen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropWhen(GraqlParser.PropWhenContext ctx);
/**
* Visit a parse tree produced by the {@code propThen}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropThen(GraqlParser.PropThenContext ctx);
/**
* Visit a parse tree produced by the {@code propHas}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropHas(GraqlParser.PropHasContext ctx);
/**
* Visit a parse tree produced by the {@code propResource}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropResource(GraqlParser.PropResourceContext ctx);
/**
* Visit a parse tree produced by the {@code propKey}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropKey(GraqlParser.PropKeyContext ctx);
/**
* Visit a parse tree produced by the {@code propRel}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropRel(GraqlParser.PropRelContext ctx);
/**
* Visit a parse tree produced by the {@code isAbstract}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIsAbstract(GraqlParser.IsAbstractContext ctx);
/**
* Visit a parse tree produced by the {@code propDatatype}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropDatatype(GraqlParser.PropDatatypeContext ctx);
/**
* Visit a parse tree produced by the {@code propRegex}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropRegex(GraqlParser.PropRegexContext ctx);
/**
* Visit a parse tree produced by the {@code propNeq}
* labeled alternative in {@link GraqlParser#property}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPropNeq(GraqlParser.PropNeqContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#casting}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCasting(GraqlParser.CastingContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#variable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariable(GraqlParser.VariableContext ctx);
/**
* Visit a parse tree produced by the {@code predicateEq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateEq(GraqlParser.PredicateEqContext ctx);
/**
* Visit a parse tree produced by the {@code predicateVariable}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateVariable(GraqlParser.PredicateVariableContext ctx);
/**
* Visit a parse tree produced by the {@code predicateNeq}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateNeq(GraqlParser.PredicateNeqContext ctx);
/**
* Visit a parse tree produced by the {@code predicateGt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateGt(GraqlParser.PredicateGtContext ctx);
/**
* Visit a parse tree produced by the {@code predicateGte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateGte(GraqlParser.PredicateGteContext ctx);
/**
* Visit a parse tree produced by the {@code predicateLt}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateLt(GraqlParser.PredicateLtContext ctx);
/**
* Visit a parse tree produced by the {@code predicateLte}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateLte(GraqlParser.PredicateLteContext ctx);
/**
* Visit a parse tree produced by the {@code predicateContains}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateContains(GraqlParser.PredicateContainsContext ctx);
/**
* Visit a parse tree produced by the {@code predicateRegex}
* labeled alternative in {@link GraqlParser#predicate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredicateRegex(GraqlParser.PredicateRegexContext ctx);
/**
* Visit a parse tree produced by the {@code valueVariable}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueVariable(GraqlParser.ValueVariableContext ctx);
/**
* Visit a parse tree produced by the {@code valuePrimitive}
* labeled alternative in {@link GraqlParser#valueOrVar}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValuePrimitive(GraqlParser.ValuePrimitiveContext ctx);
/**
* Visit a parse tree produced by the {@code valueString}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueString(GraqlParser.ValueStringContext ctx);
/**
* Visit a parse tree produced by the {@code valueInteger}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueInteger(GraqlParser.ValueIntegerContext ctx);
/**
* Visit a parse tree produced by the {@code valueReal}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueReal(GraqlParser.ValueRealContext ctx);
/**
* Visit a parse tree produced by the {@code valueBoolean}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueBoolean(GraqlParser.ValueBooleanContext ctx);
/**
* Visit a parse tree produced by the {@code valueDate}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueDate(GraqlParser.ValueDateContext ctx);
/**
* Visit a parse tree produced by the {@code valueDateTime}
* labeled alternative in {@link GraqlParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueDateTime(GraqlParser.ValueDateTimeContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#labels}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabels(GraqlParser.LabelsContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#labelsArray}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabelsArray(GraqlParser.LabelsArrayContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#label}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabel(GraqlParser.LabelContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#id}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitId(GraqlParser.IdContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#identifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentifier(GraqlParser.IdentifierContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#datatype}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDatatype(GraqlParser.DatatypeContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#order}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrder(GraqlParser.OrderContext ctx);
/**
* Visit a parse tree produced by {@link GraqlParser#bool}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBool(GraqlParser.BoolContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinBaseListener.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link GremlinListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class GremlinBaseListener implements GremlinListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTraversal(GremlinParser.TraversalContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTraversal(GremlinParser.TraversalContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIdExpr(GremlinParser.IdExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIdExpr(GremlinParser.IdExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterListExpr(GremlinParser.ListExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitListExpr(GremlinParser.ListExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStepExpr(GremlinParser.StepExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStepExpr(GremlinParser.StepExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMethodExpr(GremlinParser.MethodExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethodExpr(GremlinParser.MethodExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNegExpr(GremlinParser.NegExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNegExpr(GremlinParser.NegExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSquigglyExpr(GremlinParser.SquigglyExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSquigglyExpr(GremlinParser.SquigglyExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMapExpr(GremlinParser.MapExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMapExpr(GremlinParser.MapExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMapEntry(GremlinParser.MapEntryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMapEntry(GremlinParser.MapEntryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStep(GremlinParser.StepContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStep(GremlinParser.StepContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCall(GremlinParser.CallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCall(GremlinParser.CallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterList(GremlinParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitList(GremlinParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIds(GremlinParser.IdsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIds(GremlinParser.IdsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinBaseVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
* This class provides an empty implementation of {@link GremlinVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public class GremlinBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements GremlinVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTraversal(GremlinParser.TraversalContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIdExpr(GremlinParser.IdExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitListExpr(GremlinParser.ListExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStepExpr(GremlinParser.StepExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethodExpr(GremlinParser.MethodExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNegExpr(GremlinParser.NegExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSquigglyExpr(GremlinParser.SquigglyExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMapExpr(GremlinParser.MapExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMapEntry(GremlinParser.MapEntryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStep(GremlinParser.StepContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCall(GremlinParser.CallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitList(GremlinParser.ListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIds(GremlinParser.IdsContext ctx) { return visitChildren(ctx); }
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinLexer.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GremlinLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, ID=13, WS=14;
public static String[] modeNames = {
"DEFAULT_MODE"
};
public static final String[] ruleNames = {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "ID", "WS"
};
private static final String[] _LITERAL_NAMES = {
null, "'.'", "'!'", "'~'", "'{'", "','", "'}'", "'='", "'@'", "'('", "')'",
"'['", "']'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, null,
null, "ID", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public GremlinLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Gremlin.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\20F\b\1\4\2\t\2\4"+
"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3"+
"\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3"+
"\16\5\169\n\16\3\16\6\16<\n\16\r\16\16\16=\3\17\6\17A\n\17\r\17\16\17"+
"B\3\17\3\17\2\2\20\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r"+
"\31\16\33\17\35\20\3\2\4\7\2//\62;C\\aac|\5\2\13\f\17\17\"\"H\2\3\3\2"+
"\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17"+
"\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2"+
"\2\2\2\33\3\2\2\2\2\35\3\2\2\2\3\37\3\2\2\2\5!\3\2\2\2\7#\3\2\2\2\t%\3"+
"\2\2\2\13\'\3\2\2\2\r)\3\2\2\2\17+\3\2\2\2\21-\3\2\2\2\23/\3\2\2\2\25"+
"\61\3\2\2\2\27\63\3\2\2\2\31\65\3\2\2\2\338\3\2\2\2\35@\3\2\2\2\37 \7"+
"\60\2\2 \4\3\2\2\2!\"\7#\2\2\"\6\3\2\2\2#$\7\u0080\2\2$\b\3\2\2\2%&\7"+
"}\2\2&\n\3\2\2\2\'(\7.\2\2(\f\3\2\2\2)*\7\177\2\2*\16\3\2\2\2+,\7?\2\2"+
",\20\3\2\2\2-.\7B\2\2.\22\3\2\2\2/\60\7*\2\2\60\24\3\2\2\2\61\62\7+\2"+
"\2\62\26\3\2\2\2\63\64\7]\2\2\64\30\3\2\2\2\65\66\7_\2\2\66\32\3\2\2\2"+
"\679\7#\2\28\67\3\2\2\289\3\2\2\29;\3\2\2\2:<\t\2\2\2;:\3\2\2\2<=\3\2"+
"\2\2=;\3\2\2\2=>\3\2\2\2>\34\3\2\2\2?A\t\3\2\2@?\3\2\2\2AB\3\2\2\2B@\3"+
"\2\2\2BC\3\2\2\2CD\3\2\2\2DE\b\17\2\2E\36\3\2\2\2\6\28=B\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinListener.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeListener;
/**
* This interface defines a complete listener for a parse tree produced by
* {@link GremlinParser}.
*/
public interface GremlinListener extends ParseTreeListener {
/**
* Enter a parse tree produced by {@link GremlinParser#traversal}.
* @param ctx the parse tree
*/
void enterTraversal(GremlinParser.TraversalContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#traversal}.
* @param ctx the parse tree
*/
void exitTraversal(GremlinParser.TraversalContext ctx);
/**
* Enter a parse tree produced by the {@code idExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterIdExpr(GremlinParser.IdExprContext ctx);
/**
* Exit a parse tree produced by the {@code idExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitIdExpr(GremlinParser.IdExprContext ctx);
/**
* Enter a parse tree produced by the {@code listExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterListExpr(GremlinParser.ListExprContext ctx);
/**
* Exit a parse tree produced by the {@code listExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitListExpr(GremlinParser.ListExprContext ctx);
/**
* Enter a parse tree produced by the {@code stepExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterStepExpr(GremlinParser.StepExprContext ctx);
/**
* Exit a parse tree produced by the {@code stepExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitStepExpr(GremlinParser.StepExprContext ctx);
/**
* Enter a parse tree produced by the {@code methodExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterMethodExpr(GremlinParser.MethodExprContext ctx);
/**
* Exit a parse tree produced by the {@code methodExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitMethodExpr(GremlinParser.MethodExprContext ctx);
/**
* Enter a parse tree produced by the {@code negExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterNegExpr(GremlinParser.NegExprContext ctx);
/**
* Exit a parse tree produced by the {@code negExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitNegExpr(GremlinParser.NegExprContext ctx);
/**
* Enter a parse tree produced by the {@code squigglyExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterSquigglyExpr(GremlinParser.SquigglyExprContext ctx);
/**
* Exit a parse tree produced by the {@code squigglyExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitSquigglyExpr(GremlinParser.SquigglyExprContext ctx);
/**
* Enter a parse tree produced by the {@code mapExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void enterMapExpr(GremlinParser.MapExprContext ctx);
/**
* Exit a parse tree produced by the {@code mapExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
*/
void exitMapExpr(GremlinParser.MapExprContext ctx);
/**
* Enter a parse tree produced by {@link GremlinParser#mapEntry}.
* @param ctx the parse tree
*/
void enterMapEntry(GremlinParser.MapEntryContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#mapEntry}.
* @param ctx the parse tree
*/
void exitMapEntry(GremlinParser.MapEntryContext ctx);
/**
* Enter a parse tree produced by {@link GremlinParser#step}.
* @param ctx the parse tree
*/
void enterStep(GremlinParser.StepContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#step}.
* @param ctx the parse tree
*/
void exitStep(GremlinParser.StepContext ctx);
/**
* Enter a parse tree produced by {@link GremlinParser#call}.
* @param ctx the parse tree
*/
void enterCall(GremlinParser.CallContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#call}.
* @param ctx the parse tree
*/
void exitCall(GremlinParser.CallContext ctx);
/**
* Enter a parse tree produced by {@link GremlinParser#list}.
* @param ctx the parse tree
*/
void enterList(GremlinParser.ListContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#list}.
* @param ctx the parse tree
*/
void exitList(GremlinParser.ListContext ctx);
/**
* Enter a parse tree produced by {@link GremlinParser#ids}.
* @param ctx the parse tree
*/
void enterIds(GremlinParser.IdsContext ctx);
/**
* Exit a parse tree produced by {@link GremlinParser#ids}.
* @param ctx the parse tree
*/
void exitIds(GremlinParser.IdsContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinParser.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class GremlinParser extends Parser {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, ID=13, WS=14;
public static final int
RULE_traversal = 0, RULE_expr = 1, RULE_mapEntry = 2, RULE_step = 3, RULE_call = 4,
RULE_list = 5, RULE_ids = 6;
public static final String[] ruleNames = {
"traversal", "expr", "mapEntry", "step", "call", "list", "ids"
};
private static final String[] _LITERAL_NAMES = {
null, "'.'", "'!'", "'~'", "'{'", "','", "'}'", "'='", "'@'", "'('", "')'",
"'['", "']'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, null,
null, "ID", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "Gremlin.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public GremlinParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class TraversalContext extends ParserRuleContext {
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
}
public TerminalNode EOF() { return getToken(GremlinParser.EOF, 0); }
public TraversalContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_traversal; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterTraversal(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitTraversal(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitTraversal(this);
else return visitor.visitChildren(this);
}
}
public final TraversalContext traversal() throws RecognitionException {
TraversalContext _localctx = new TraversalContext(_ctx, getState());
enterRule(_localctx, 0, RULE_traversal);
try {
enterOuterAlt(_localctx, 1);
{
setState(14);
expr();
setState(15);
match(EOF);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ExprContext extends ParserRuleContext {
public ExprContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_expr; }
public ExprContext() { }
public void copyFrom(ExprContext ctx) {
super.copyFrom(ctx);
}
}
public static class NegExprContext extends ExprContext {
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
}
public NegExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterNegExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitNegExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitNegExpr(this);
else return visitor.visitChildren(this);
}
}
public static class SquigglyExprContext extends ExprContext {
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
}
public SquigglyExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterSquigglyExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitSquigglyExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitSquigglyExpr(this);
else return visitor.visitChildren(this);
}
}
public static class MethodExprContext extends ExprContext {
public TerminalNode ID() { return getToken(GremlinParser.ID, 0); }
public CallContext call() {
return getRuleContext(CallContext.class,0);
}
public MethodExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterMethodExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitMethodExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitMethodExpr(this);
else return visitor.visitChildren(this);
}
}
public static class MapExprContext extends ExprContext {
public List<MapEntryContext> mapEntry() {
return getRuleContexts(MapEntryContext.class);
}
public MapEntryContext mapEntry(int i) {
return getRuleContext(MapEntryContext.class,i);
}
public MapExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterMapExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitMapExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitMapExpr(this);
else return visitor.visitChildren(this);
}
}
public static class ListExprContext extends ExprContext {
public ListContext list() {
return getRuleContext(ListContext.class,0);
}
public ListExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterListExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitListExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitListExpr(this);
else return visitor.visitChildren(this);
}
}
public static class IdExprContext extends ExprContext {
public TerminalNode ID() { return getToken(GremlinParser.ID, 0); }
public IdExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterIdExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitIdExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitIdExpr(this);
else return visitor.visitChildren(this);
}
}
public static class StepExprContext extends ExprContext {
public StepContext step() {
return getRuleContext(StepContext.class,0);
}
public StepExprContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterStepExpr(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitStepExpr(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitStepExpr(this);
else return visitor.visitChildren(this);
}
}
public final ExprContext expr() throws RecognitionException {
ExprContext _localctx = new ExprContext(_ctx, getState());
enterRule(_localctx, 2, RULE_expr);
int _la;
try {
setState(39);
switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
case 1:
_localctx = new IdExprContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(17);
match(ID);
}
break;
case 2:
_localctx = new ListExprContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(18);
list();
}
break;
case 3:
_localctx = new StepExprContext(_localctx);
enterOuterAlt(_localctx, 3);
{
setState(19);
step();
}
break;
case 4:
_localctx = new MethodExprContext(_localctx);
enterOuterAlt(_localctx, 4);
{
setState(20);
match(ID);
setState(21);
match(T__0);
setState(22);
call();
}
break;
case 5:
_localctx = new NegExprContext(_localctx);
enterOuterAlt(_localctx, 5);
{
setState(23);
match(T__1);
setState(24);
expr();
}
break;
case 6:
_localctx = new SquigglyExprContext(_localctx);
enterOuterAlt(_localctx, 6);
{
setState(25);
match(T__2);
setState(26);
expr();
}
break;
case 7:
_localctx = new MapExprContext(_localctx);
enterOuterAlt(_localctx, 7);
{
setState(27);
match(T__3);
setState(36);
_la = _input.LA(1);
if (_la==ID) {
{
setState(28);
mapEntry();
setState(33);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__4) {
{
{
setState(29);
match(T__4);
setState(30);
mapEntry();
}
}
setState(35);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(38);
match(T__5);
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class MapEntryContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(GremlinParser.ID, 0); }
public ExprContext expr() {
return getRuleContext(ExprContext.class,0);
}
public MapEntryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_mapEntry; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterMapEntry(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitMapEntry(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitMapEntry(this);
else return visitor.visitChildren(this);
}
}
public final MapEntryContext mapEntry() throws RecognitionException {
MapEntryContext _localctx = new MapEntryContext(_ctx, getState());
enterRule(_localctx, 4, RULE_mapEntry);
try {
enterOuterAlt(_localctx, 1);
{
setState(41);
match(ID);
setState(42);
match(T__6);
setState(43);
expr();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class StepContext extends ParserRuleContext {
public CallContext call() {
return getRuleContext(CallContext.class,0);
}
public IdsContext ids() {
return getRuleContext(IdsContext.class,0);
}
public StepContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_step; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterStep(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitStep(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitStep(this);
else return visitor.visitChildren(this);
}
}
public final StepContext step() throws RecognitionException {
StepContext _localctx = new StepContext(_ctx, getState());
enterRule(_localctx, 6, RULE_step);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(45);
call();
setState(48);
_la = _input.LA(1);
if (_la==T__7) {
{
setState(46);
match(T__7);
setState(47);
ids();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class CallContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(GremlinParser.ID, 0); }
public List<ExprContext> expr() {
return getRuleContexts(ExprContext.class);
}
public ExprContext expr(int i) {
return getRuleContext(ExprContext.class,i);
}
public CallContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_call; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterCall(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitCall(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitCall(this);
else return visitor.visitChildren(this);
}
}
public final CallContext call() throws RecognitionException {
CallContext _localctx = new CallContext(_ctx, getState());
enterRule(_localctx, 8, RULE_call);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(50);
match(ID);
setState(63);
_la = _input.LA(1);
if (_la==T__8) {
{
setState(51);
match(T__8);
setState(60);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__10) | (1L << ID))) != 0)) {
{
setState(52);
expr();
setState(57);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__4) {
{
{
setState(53);
match(T__4);
setState(54);
expr();
}
}
setState(59);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(62);
match(T__9);
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ListContext extends ParserRuleContext {
public List<ExprContext> expr() {
return getRuleContexts(ExprContext.class);
}
public ExprContext expr(int i) {
return getRuleContext(ExprContext.class,i);
}
public ListContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterList(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitList(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitList(this);
else return visitor.visitChildren(this);
}
}
public final ListContext list() throws RecognitionException {
ListContext _localctx = new ListContext(_ctx, getState());
enterRule(_localctx, 10, RULE_list);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(65);
match(T__10);
setState(74);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__1) | (1L << T__2) | (1L << T__3) | (1L << T__10) | (1L << ID))) != 0)) {
{
setState(66);
expr();
setState(71);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__4) {
{
{
setState(67);
match(T__4);
setState(68);
expr();
}
}
setState(73);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(76);
match(T__11);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class IdsContext extends ParserRuleContext {
public List<TerminalNode> ID() { return getTokens(GremlinParser.ID); }
public TerminalNode ID(int i) {
return getToken(GremlinParser.ID, i);
}
public IdsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_ids; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).enterIds(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof GremlinListener ) ((GremlinListener)listener).exitIds(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof GremlinVisitor ) return ((GremlinVisitor<? extends T>)visitor).visitIds(this);
else return visitor.visitChildren(this);
}
}
public final IdsContext ids() throws RecognitionException {
IdsContext _localctx = new IdsContext(_ctx, getState());
enterRule(_localctx, 12, RULE_ids);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(78);
match(T__10);
setState(87);
_la = _input.LA(1);
if (_la==ID) {
{
setState(79);
match(ID);
setState(84);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__4) {
{
{
setState(80);
match(T__4);
setState(81);
match(ID);
}
}
setState(86);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(89);
match(T__11);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\20^\4\2\t\2\4\3\t"+
"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\3\3\3\3\3\3\3\3"+
"\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\7\3\"\n\3\f\3\16\3%\13\3\5\3"+
"\'\n\3\3\3\5\3*\n\3\3\4\3\4\3\4\3\4\3\5\3\5\3\5\5\5\63\n\5\3\6\3\6\3\6"+
"\3\6\3\6\7\6:\n\6\f\6\16\6=\13\6\5\6?\n\6\3\6\5\6B\n\6\3\7\3\7\3\7\3\7"+
"\7\7H\n\7\f\7\16\7K\13\7\5\7M\n\7\3\7\3\7\3\b\3\b\3\b\3\b\7\bU\n\b\f\b"+
"\16\bX\13\b\5\bZ\n\b\3\b\3\b\3\b\2\2\t\2\4\6\b\n\f\16\2\2f\2\20\3\2\2"+
"\2\4)\3\2\2\2\6+\3\2\2\2\b/\3\2\2\2\n\64\3\2\2\2\fC\3\2\2\2\16P\3\2\2"+
"\2\20\21\5\4\3\2\21\22\7\2\2\3\22\3\3\2\2\2\23*\7\17\2\2\24*\5\f\7\2\25"+
"*\5\b\5\2\26\27\7\17\2\2\27\30\7\3\2\2\30*\5\n\6\2\31\32\7\4\2\2\32*\5"+
"\4\3\2\33\34\7\5\2\2\34*\5\4\3\2\35&\7\6\2\2\36#\5\6\4\2\37 \7\7\2\2 "+
"\"\5\6\4\2!\37\3\2\2\2\"%\3\2\2\2#!\3\2\2\2#$\3\2\2\2$\'\3\2\2\2%#\3\2"+
"\2\2&\36\3\2\2\2&\'\3\2\2\2\'(\3\2\2\2(*\7\b\2\2)\23\3\2\2\2)\24\3\2\2"+
"\2)\25\3\2\2\2)\26\3\2\2\2)\31\3\2\2\2)\33\3\2\2\2)\35\3\2\2\2*\5\3\2"+
"\2\2+,\7\17\2\2,-\7\t\2\2-.\5\4\3\2.\7\3\2\2\2/\62\5\n\6\2\60\61\7\n\2"+
"\2\61\63\5\16\b\2\62\60\3\2\2\2\62\63\3\2\2\2\63\t\3\2\2\2\64A\7\17\2"+
"\2\65>\7\13\2\2\66;\5\4\3\2\678\7\7\2\28:\5\4\3\29\67\3\2\2\2:=\3\2\2"+
"\2;9\3\2\2\2;<\3\2\2\2<?\3\2\2\2=;\3\2\2\2>\66\3\2\2\2>?\3\2\2\2?@\3\2"+
"\2\2@B\7\f\2\2A\65\3\2\2\2AB\3\2\2\2B\13\3\2\2\2CL\7\r\2\2DI\5\4\3\2E"+
"F\7\7\2\2FH\5\4\3\2GE\3\2\2\2HK\3\2\2\2IG\3\2\2\2IJ\3\2\2\2JM\3\2\2\2"+
"KI\3\2\2\2LD\3\2\2\2LM\3\2\2\2MN\3\2\2\2NO\7\16\2\2O\r\3\2\2\2PY\7\r\2"+
"\2QV\7\17\2\2RS\7\7\2\2SU\7\17\2\2TR\3\2\2\2UX\3\2\2\2VT\3\2\2\2VW\3\2"+
"\2\2WZ\3\2\2\2XV\3\2\2\2YQ\3\2\2\2YZ\3\2\2\2Z[\3\2\2\2[\\\7\16\2\2\\\17"+
"\3\2\2\2\r#&)\62;>AILVY";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/antlr/GremlinVisitor.java
|
// Generated from ai/grakn/graql/internal/antlr/Gremlin.g4 by ANTLR 4.5
package ai.grakn.graql.internal.antlr;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link GremlinParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface GremlinVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link GremlinParser#traversal}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTraversal(GremlinParser.TraversalContext ctx);
/**
* Visit a parse tree produced by the {@code idExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdExpr(GremlinParser.IdExprContext ctx);
/**
* Visit a parse tree produced by the {@code listExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitListExpr(GremlinParser.ListExprContext ctx);
/**
* Visit a parse tree produced by the {@code stepExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStepExpr(GremlinParser.StepExprContext ctx);
/**
* Visit a parse tree produced by the {@code methodExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMethodExpr(GremlinParser.MethodExprContext ctx);
/**
* Visit a parse tree produced by the {@code negExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNegExpr(GremlinParser.NegExprContext ctx);
/**
* Visit a parse tree produced by the {@code squigglyExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSquigglyExpr(GremlinParser.SquigglyExprContext ctx);
/**
* Visit a parse tree produced by the {@code mapExpr}
* labeled alternative in {@link GremlinParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMapExpr(GremlinParser.MapExprContext ctx);
/**
* Visit a parse tree produced by {@link GremlinParser#mapEntry}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMapEntry(GremlinParser.MapEntryContext ctx);
/**
* Visit a parse tree produced by {@link GremlinParser#step}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStep(GremlinParser.StepContext ctx);
/**
* Visit a parse tree produced by {@link GremlinParser#call}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCall(GremlinParser.CallContext ctx);
/**
* Visit a parse tree produced by {@link GremlinParser#list}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitList(GremlinParser.ListContext ctx);
/**
* Visit a parse tree produced by {@link GremlinParser#ids}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIds(GremlinParser.IdsContext ctx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/AutoValue_GraqlTraversal.java
|
package ai.grakn.graql.internal.gremlin;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_GraqlTraversal extends GraqlTraversal {
private final ImmutableSet<ImmutableList<Fragment>> fragments;
AutoValue_GraqlTraversal(
ImmutableSet<ImmutableList<Fragment>> fragments) {
if (fragments == null) {
throw new NullPointerException("Null fragments");
}
this.fragments = fragments;
}
@Override
public ImmutableSet<ImmutableList<Fragment>> fragments() {
return fragments;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof GraqlTraversal) {
GraqlTraversal that = (GraqlTraversal) o;
return (this.fragments.equals(that.fragments()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= this.fragments.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/ConjunctionQuery.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin;
import ai.grakn.GraknTx;
import ai.grakn.exception.GraqlQueryException;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.Conjunction;
import ai.grakn.graql.admin.VarPatternAdmin;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.sets.EquivalentFragmentSets;
import ai.grakn.graql.internal.pattern.property.VarPropertyInternal;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import static ai.grakn.util.CommonUtil.toImmutableSet;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
/**
* A query that does not contain any disjunctions, so it can be represented as a single gremlin traversal.
* <p>
* The {@code ConjunctionQuery} is passed a {@link Conjunction<VarPatternAdmin>}.
* {@link EquivalentFragmentSet}s can be extracted from each {@link GraqlTraversal}.
* <p>
* The {@link EquivalentFragmentSet}s are sorted to produce a set of lists of {@link Fragment}s. Each list of fragments
* describes a connected component in the query. Most queries are completely connected, so there will be only one
* list of fragments in the set. If the query is disconnected (e.g. match $x isa movie, $y isa person), then there
* will be multiple lists of fragments in the set.
* <p>
* A gremlin traversal is created by concatenating the traversals within each fragment.
*/
class ConjunctionQuery {
private final Set<VarPatternAdmin> vars;
private final ImmutableSet<EquivalentFragmentSet> equivalentFragmentSets;
/**
* @param patternConjunction a pattern containing no disjunctions to find in the graph
*/
ConjunctionQuery(Conjunction<VarPatternAdmin> patternConjunction, GraknTx graph) {
vars = patternConjunction.getPatterns();
if (vars.size() == 0) {
throw GraqlQueryException.noPatterns();
}
ImmutableSet<EquivalentFragmentSet> fragmentSets =
vars.stream().flatMap(ConjunctionQuery::equivalentFragmentSetsRecursive).collect(toImmutableSet());
// Get all variable names mentioned in non-starting fragments
Set<Var> names = fragmentSets.stream()
.flatMap(EquivalentFragmentSet::stream)
.filter(fragment -> !fragment.isStartingFragment())
.flatMap(fragment -> fragment.vars().stream())
.collect(toImmutableSet());
// Get all dependencies fragments have on certain variables existing
Set<Var> dependencies = fragmentSets.stream()
.flatMap(EquivalentFragmentSet::stream)
.flatMap(fragment -> fragment.dependencies().stream())
.collect(toImmutableSet());
Set<Var> validNames = Sets.difference(names, dependencies);
// Filter out any non-essential starting fragments (because other fragments refer to their starting variable)
Set<EquivalentFragmentSet> initialEquivalentFragmentSets = fragmentSets.stream()
.filter(set -> set.stream().anyMatch(
fragment -> !fragment.isStartingFragment() || !validNames.contains(fragment.start())
))
.collect(toSet());
// Apply final optimisations
EquivalentFragmentSets.optimiseFragmentSets(initialEquivalentFragmentSets, graph);
this.equivalentFragmentSets = ImmutableSet.copyOf(initialEquivalentFragmentSets);
}
ImmutableSet<EquivalentFragmentSet> getEquivalentFragmentSets() {
return equivalentFragmentSets;
}
/**
* Get all possible orderings of fragments
*/
Set<List<Fragment>> allFragmentOrders() {
Collection<List<EquivalentFragmentSet>> fragmentSetPermutations = Collections2.permutations(equivalentFragmentSets);
return fragmentSetPermutations.stream().flatMap(ConjunctionQuery::cartesianProduct).collect(toSet());
}
private static Stream<List<Fragment>> cartesianProduct(List<EquivalentFragmentSet> fragmentSets) {
// Get fragments in each set
List<Set<Fragment>> fragments = fragmentSets.stream()
.map(EquivalentFragmentSet::fragments)
.collect(toList());
return Sets.cartesianProduct(fragments).stream();
}
private static Stream<EquivalentFragmentSet> equivalentFragmentSetsRecursive(VarPatternAdmin var) {
return var.implicitInnerVarPatterns().stream().flatMap(ConjunctionQuery::equivalentFragmentSetsOfVar);
}
private static Stream<EquivalentFragmentSet> equivalentFragmentSetsOfVar(VarPatternAdmin var) {
Collection<EquivalentFragmentSet> traversals = new HashSet<>();
Var start = var.var();
var.getProperties().forEach(property -> {
VarPropertyInternal propertyInternal = (VarPropertyInternal) property;
Collection<EquivalentFragmentSet> newTraversals = propertyInternal.match(start);
traversals.addAll(newTraversals);
});
if (!traversals.isEmpty()) {
return traversals.stream();
} else {
// If this variable has no properties, only confirm that it is not internal and nothing else.
return Stream.of(EquivalentFragmentSets.notInternalFragmentSet(null, start));
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/EquivalentFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.Set;
import java.util.stream.Stream;
import static java.util.stream.Collectors.joining;
/**
* a pattern to match in the graph. comprised of {@code Fragments}, each describing one way to represent the traversal,
* starting from different variables.
* <p>
* A {@code EquivalentFragmentSet} may contain only one {@code Fragment} (e.g. checking the 'id' property), while others may
* be comprised of two fragments (e.g. $x isa $y, which may start from $x or $y).
*
* @author Felix Chapman
*/
public abstract class EquivalentFragmentSet implements Iterable<Fragment> {
@Override
@CheckReturnValue
public final Iterator<Fragment> iterator() {
return stream().iterator();
}
public final Stream<Fragment> stream() {
return fragments().stream();
}
/**
* @return a set of fragments that this EquivalentFragmentSet contains
*/
public abstract Set<Fragment> fragments();
@Nullable
public abstract VarProperty varProperty();
@Override
public String toString() {
return fragments().stream().map(Object::toString).collect(joining(", ", "{", "}"));
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/GraqlTraversal.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Match;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectStep;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static ai.grakn.util.CommonUtil.toImmutableSet;
import static java.util.stream.Collectors.joining;
/**
* A traversal over a Grakn knowledge base, representing one of many ways to execute a {@link Match}.
* Comprised of ordered {@code Fragment}s which are used to construct a TinkerPop {@code GraphTraversal}, which can be
* retrieved and executed.
*
* @author Felix Chapman
*/
@AutoValue
public abstract class GraqlTraversal {
// Just a pretend big number
private static final long NUM_VERTICES_ESTIMATE = 10_000;
private static final double COST_NEW_TRAVERSAL = Math.log1p(NUM_VERTICES_ESTIMATE);
static GraqlTraversal create(Set<? extends List<Fragment>> fragments) {
ImmutableSet<ImmutableList<Fragment>> copy = fragments.stream().map(ImmutableList::copyOf).collect(toImmutableSet());
return new AutoValue_GraqlTraversal(copy);
}
/**
* Get the {@code GraphTraversal} that this {@code GraqlTraversal} represents.
*/
// Because 'union' accepts an array, we can't use generics
@SuppressWarnings("unchecked")
public GraphTraversal<Vertex, Map<String, Element>> getGraphTraversal(EmbeddedGraknTx<?> tx, Set<Var> vars) {
if (fragments().size() == 1) {
// If there are no disjunctions, we don't need to union them and get a performance boost
ImmutableList<Fragment> list = Iterables.getOnlyElement(fragments());
return getConjunctionTraversal(tx, tx.getTinkerTraversal().V(), vars, list);
} else {
Traversal[] traversals = fragments().stream()
.map(list -> getConjunctionTraversal(tx, __.V(), vars, list))
.toArray(Traversal[]::new);
// This is a sneaky trick - we want to do a union but tinkerpop requires all traversals to start from
// somewhere, so we start from a single arbitrary vertex.
GraphTraversal traversal = tx.getTinkerTraversal().V().limit(1).union(traversals);
return selectVars(traversal, vars);
}
}
// Set of disjunctions
// |
// | List of fragments in order of execution
// | |
// V V
public abstract ImmutableSet<ImmutableList<Fragment>> fragments();
/**
* @param transform map defining id transform var -> new id
* @return graql traversal with concept id transformed according to the provided transform
*/
public GraqlTraversal transform(Map<Var, ConceptId> transform){
ImmutableList<Fragment> fragments = ImmutableList.copyOf(
Iterables.getOnlyElement(fragments()).stream().map(f -> f.transform(transform)).collect(Collectors.toList())
);
return new AutoValue_GraqlTraversal(ImmutableSet.of(fragments));
}
/**
* @return a gremlin traversal that represents this inner query
*/
private GraphTraversal<Vertex, Map<String, Element>> getConjunctionTraversal(
EmbeddedGraknTx<?> tx, GraphTraversal<Vertex, Vertex> traversal, Set<Var> vars,
ImmutableList<Fragment> fragmentList
) {
GraphTraversal<Vertex, ? extends Element> newTraversal = traversal;
// If the first fragment can operate on edges, then we have to navigate all edges as well
if (fragmentList.get(0).canOperateOnEdges()) {
newTraversal = traversal.union(__.identity(), __.outE(Schema.EdgeLabel.ATTRIBUTE.getLabel()));
}
return applyFragments(tx, vars, fragmentList, newTraversal);
}
private GraphTraversal<Vertex, Map<String, Element>> applyFragments(
EmbeddedGraknTx<?> tx, Set<Var> vars, ImmutableList<Fragment> fragmentList,
GraphTraversal<Vertex, ? extends Element> traversal
) {
Set<Var> foundVars = new HashSet<>();
// Apply fragments in order into one single traversal
Var currentName = null;
for (Fragment fragment : fragmentList) {
// Apply fragment to traversal
fragment.applyTraversal(traversal, tx, foundVars, currentName);
currentName = fragment.end() != null ? fragment.end() : fragment.start();
}
// Select all the variable names
return selectVars(traversal, Sets.intersection(vars, foundVars));
}
/**
* Get the estimated complexity of the traversal.
*/
public double getComplexity() {
double totalCost = 0;
for (List<Fragment> list : fragments()) {
totalCost += fragmentListCost(list);
}
return totalCost;
}
static double fragmentListCost(List<Fragment> fragments) {
Set<Var> names = new HashSet<>();
double listCost = 0;
for (Fragment fragment : fragments) {
listCost += fragmentCost(fragment, names);
names.addAll(fragment.vars());
}
return listCost;
}
static double fragmentCost(Fragment fragment, Collection<Var> names) {
if (names.contains(fragment.start()) || fragment.hasFixedFragmentCost()) {
return fragment.fragmentCost();
} else {
// Restart traversal, meaning we are navigating from all vertices
return COST_NEW_TRAVERSAL;
}
}
private static <S, E> GraphTraversal<S, Map<String, E>> selectVars(GraphTraversal<S, ?> traversal, Set<Var> vars) {
if (vars.isEmpty()) {
// Produce an empty result
return traversal.constant(ImmutableMap.of());
} else if (vars.size() == 1) {
String label = vars.iterator().next().name();
return traversal.select(label, label);
} else {
String[] labelArray = vars.stream().map(Var::name).toArray(String[]::new);
return traversal.asAdmin().addStep(new SelectStep<>(traversal.asAdmin(), null, labelArray));
}
}
@Override
public String toString() {
return "{" + fragments().stream().map(list -> {
StringBuilder sb = new StringBuilder();
Var currentName = null;
for (Fragment fragment : list) {
if (!fragment.start().equals(currentName)) {
if (currentName != null) sb.append(" ");
sb.append(fragment.start().shortName());
currentName = fragment.start();
}
sb.append(fragment.name());
Var end = fragment.end();
if (end != null) {
sb.append(end.shortName());
currentName = end;
}
}
return sb.toString();
}).collect(joining(", ")) + "}";
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/GreedyTraversalPlan.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin;
import ai.grakn.concept.Label;
import ai.grakn.concept.RelationshipType;
import ai.grakn.concept.Role;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.concept.Type;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.Conjunction;
import ai.grakn.graql.admin.PatternAdmin;
import ai.grakn.graql.admin.VarPatternAdmin;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import ai.grakn.graql.internal.gremlin.fragment.InIsaFragment;
import ai.grakn.graql.internal.gremlin.fragment.InSubFragment;
import ai.grakn.graql.internal.gremlin.fragment.LabelFragment;
import ai.grakn.graql.internal.gremlin.fragment.OutRolePlayerFragment;
import ai.grakn.graql.internal.gremlin.sets.EquivalentFragmentSets;
import ai.grakn.graql.internal.gremlin.spanningtree.Arborescence;
import ai.grakn.graql.internal.gremlin.spanningtree.ChuLiuEdmonds;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.SparseWeightedGraph;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.graql.internal.pattern.property.IsaProperty;
import ai.grakn.graql.internal.pattern.property.LabelProperty;
import ai.grakn.graql.internal.pattern.property.ValueProperty;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static ai.grakn.graql.Graql.var;
import static ai.grakn.graql.internal.gremlin.fragment.Fragment.SHARD_LOAD_FACTOR;
import static ai.grakn.util.CommonUtil.toImmutableSet;
/**
* Class for generating greedy traversal plans
*
* @author Grakn Warriors
*/
public class GreedyTraversalPlan {
protected static final Logger LOG = LoggerFactory.getLogger(GreedyTraversalPlan.class);
/**
* Create a traversal plan.
*
* @param pattern a pattern to find a query plan for
* @return a semi-optimal traversal plan
*/
public static GraqlTraversal createTraversal(PatternAdmin pattern, EmbeddedGraknTx<?> tx) {
Collection<Conjunction<VarPatternAdmin>> patterns = pattern.getDisjunctiveNormalForm().getPatterns();
Set<? extends List<Fragment>> fragments = patterns.stream()
.map(conjunction -> new ConjunctionQuery(conjunction, tx))
.map((ConjunctionQuery query) -> planForConjunction(query, tx))
.collect(toImmutableSet());
return GraqlTraversal.create(fragments);
}
/**
* Create a plan using Edmonds' algorithm with greedy approach to execute a single conjunction
*
* @param query the conjunction query to find a traversal plan
* @return a semi-optimal traversal plan to execute the given conjunction
*/
private static List<Fragment> planForConjunction(ConjunctionQuery query, EmbeddedGraknTx<?> tx) {
final List<Fragment> plan = new ArrayList<>(); // this will be the final plan
final Map<NodeId, Node> allNodes = new HashMap<>(); // all the nodes in the spanning tree
final Set<Node> connectedNodes = new HashSet<>();
final Map<Node, Double> nodesWithFixedCost = new HashMap<>();
// getting all the fragments from the conjunction query
final Set<Fragment> allFragments = query.getEquivalentFragmentSets().stream()
.flatMap(EquivalentFragmentSet::stream).collect(Collectors.toSet());
// if role p[ayers' types are known, we can infer the types of the relationship
// then add a label fragment to the fragment set
inferRelationshipTypes(tx, allFragments);
// it's possible that some (or all) fragments are disconnect
// e.g. $x isa person; $y isa dog;
// these are valid conjunctions and useful when inserting new data
Collection<Set<Fragment>> connectedFragmentSets =
getConnectedFragmentSets(plan, allFragments, allNodes, connectedNodes, nodesWithFixedCost, tx);
// generate plan for each connected set of fragments
// since each set is independent, order of the set doesn't matter
connectedFragmentSets.forEach(fragmentSet -> {
final Map<Node, Map<Node, Fragment>> edges = new HashMap<>();
final Set<Node> highPriorityStartingNodeSet = new HashSet<>();
final Set<Node> lowPriorityStartingNodeSet = new HashSet<>();
final Set<Fragment> edgeFragmentSet = new HashSet<>();
fragmentSet.forEach(fragment -> {
if (fragment.end() != null) {
edgeFragmentSet.add(fragment);
// when we are have more info from the cache, e.g. instance count,
// we can have a better estimate on the cost of the fragment
updateFragmentCost(allNodes, nodesWithFixedCost, fragment);
} else if (fragment.hasFixedFragmentCost()) {
Node node = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
if (fragment instanceof LabelFragment) {
Type type = tx.getType(Iterators.getOnlyElement(((LabelFragment) fragment).labels().iterator()));
if (type != null && type.isImplicit()) {
// implicit types have low priority because their instances may be edges
lowPriorityStartingNodeSet.add(node);
} else {
// other labels/types are the ideal starting point as they are indexed
highPriorityStartingNodeSet.add(node);
}
} else {
highPriorityStartingNodeSet.add(node);
}
}
});
// convert fragments to a connected graph
Set<Weighted<DirectedEdge<Node>>> weightedGraph = buildWeightedGraph(
allNodes, connectedNodes, edges, edgeFragmentSet);
if (!weightedGraph.isEmpty()) {
// sparse graph for better performance
SparseWeightedGraph<Node> sparseWeightedGraph = SparseWeightedGraph.from(weightedGraph);
// selecting starting points
Collection<Node> startingNodes;
if (!highPriorityStartingNodeSet.isEmpty()) {
startingNodes = highPriorityStartingNodeSet;
} else if (!lowPriorityStartingNodeSet.isEmpty()) {
startingNodes = lowPriorityStartingNodeSet;
} else {
// if all else fails, use any valid nodes
startingNodes = sparseWeightedGraph.getNodes().stream()
.filter(Node::isValidStartingPoint).collect(Collectors.toSet());
}
// find the minimum spanning tree for each root
// then get the tree with minimum weight
Arborescence<Node> arborescence = startingNodes.stream()
.map(node -> ChuLiuEdmonds.getMaxArborescence(sparseWeightedGraph, node))
.max(Comparator.comparingDouble(tree -> tree.weight))
.map(arborescenceInside -> arborescenceInside.val).orElse(Arborescence.empty());
greedyTraversal(plan, arborescence, allNodes, edges);
}
addUnvisitedNodeFragments(plan, allNodes, connectedNodes);
});
// add disconnected fragment set with no edge fragment
addUnvisitedNodeFragments(plan, allNodes, allNodes.values());
LOG.trace("Greedy Plan = " + plan);
return plan;
}
// infer type of relationship type if we know the type of the role players
// add label fragment and isa fragment if we can infer any
private static void inferRelationshipTypes(EmbeddedGraknTx<?> tx, Set<Fragment> allFragments) {
Map<Var, Type> labelVarTypeMap = getLabelVarTypeMap(tx, allFragments);
if (labelVarTypeMap.isEmpty()) return;
Multimap<Var, Type> instanceVarTypeMap = getInstanceVarTypeMap(allFragments, labelVarTypeMap);
Multimap<Var, Var> relationshipRolePlayerMap = getRelationshipRolePlayerMap(allFragments, instanceVarTypeMap);
if (relationshipRolePlayerMap.isEmpty()) return;
// for each type, get all possible relationship type it could be in
Multimap<Type, RelationshipType> relationshipMap = HashMultimap.create();
labelVarTypeMap.values().stream().distinct().forEach(
type -> addAllPossibleRelationships(relationshipMap, type));
// inferred labels should be kept separately, even if they are already in allFragments set
Map<Label, Var> inferredLabels = new HashMap<>();
relationshipRolePlayerMap.asMap().forEach((relationshipVar, rolePlayerVars) -> {
Set<Type> possibleRelationshipTypes = rolePlayerVars.stream()
.filter(instanceVarTypeMap::containsKey)
.map(rolePlayer -> getAllPossibleRelationshipTypes(
instanceVarTypeMap.get(rolePlayer), relationshipMap))
.reduce(Sets::intersection).orElse(Collections.emptySet());
//TODO: if possibleRelationshipTypes here is empty, the query will not match any data
if (possibleRelationshipTypes.size() == 1) {
Type relationshipType = possibleRelationshipTypes.iterator().next();
Label label = relationshipType.label();
// add label fragment if this label has not been inferred
if (!inferredLabels.containsKey(label)) {
Var labelVar = var();
inferredLabels.put(label, labelVar);
Fragment labelFragment = Fragments.label(LabelProperty.of(label), labelVar, ImmutableSet.of(label));
allFragments.add(labelFragment);
}
// finally, add inferred isa fragments
Var labelVar = inferredLabels.get(label);
IsaProperty isaProperty = IsaProperty.of(labelVar.admin());
EquivalentFragmentSet isaEquivalentFragmentSet = EquivalentFragmentSets.isa(isaProperty,
relationshipVar, labelVar, relationshipType.isImplicit());
allFragments.addAll(isaEquivalentFragmentSet.fragments());
}
});
}
private static Multimap<Var, Var> getRelationshipRolePlayerMap(
Set<Fragment> allFragments, Multimap<Var, Type> instanceVarTypeMap) {
// relationship vars and its role player vars
Multimap<Var, Var> relationshipRolePlayerMap = HashMultimap.create();
allFragments.stream().filter(OutRolePlayerFragment.class::isInstance)
.forEach(fragment -> relationshipRolePlayerMap.put(fragment.start(), fragment.end()));
// find all the relationships requiring type inference
Iterator<Var> iterator = relationshipRolePlayerMap.keySet().iterator();
while (iterator.hasNext()) {
Var relationship = iterator.next();
// the relation should have at least 2 known role players so we can infer something useful
if (instanceVarTypeMap.containsKey(relationship) ||
relationshipRolePlayerMap.get(relationship).size() < 2) {
iterator.remove();
} else {
int numRolePlayersHaveType = 0;
for (Var rolePlayer : relationshipRolePlayerMap.get(relationship)) {
if (instanceVarTypeMap.containsKey(rolePlayer)) {
numRolePlayersHaveType++;
}
}
if (numRolePlayersHaveType < 2) {
iterator.remove();
}
}
}
return relationshipRolePlayerMap;
}
// find all vars with direct or indirect out isa edges
private static Multimap<Var, Type> getInstanceVarTypeMap(
Set<Fragment> allFragments, Map<Var, Type> labelVarTypeMap) {
Multimap<Var, Type> instanceVarTypeMap = HashMultimap.create();
int oldSize;
do {
oldSize = instanceVarTypeMap.size();
allFragments.stream()
.filter(fragment -> labelVarTypeMap.containsKey(fragment.start()))
.filter(fragment -> fragment instanceof InIsaFragment || fragment instanceof InSubFragment)
.forEach(fragment -> instanceVarTypeMap.put(fragment.end(), labelVarTypeMap.get(fragment.start())));
} while (oldSize != instanceVarTypeMap.size());
return instanceVarTypeMap;
}
// find all vars representing types
private static Map<Var, Type> getLabelVarTypeMap(EmbeddedGraknTx<?> tx, Set<Fragment> allFragments) {
Map<Var, Type> labelVarTypeMap = new HashMap<>();
allFragments.stream()
.filter(LabelFragment.class::isInstance)
.forEach(fragment -> {
// TODO: labels() should return ONE label instead of a set
SchemaConcept schemaConcept = tx.getSchemaConcept(
Iterators.getOnlyElement(((LabelFragment) fragment).labels().iterator()));
if (schemaConcept != null && !schemaConcept.isRole() && !schemaConcept.isRule()) {
labelVarTypeMap.put(fragment.start(), schemaConcept.asType());
}
});
return labelVarTypeMap;
}
private static Set<Type> getAllPossibleRelationshipTypes(
Collection<Type> instanceVarTypes, Multimap<Type, RelationshipType> relationshipMap) {
return instanceVarTypes.stream()
.map(rolePlayerType -> (Set<Type>) new HashSet<Type>(relationshipMap.get(rolePlayerType)))
.reduce(Sets::intersection).orElse(Collections.emptySet());
}
private static void addAllPossibleRelationships(Multimap<Type, RelationshipType> relationshipMap, Type metaType) {
metaType.subs().forEach(type -> type.playing().flatMap(Role::relationships)
.forEach(relationshipType -> relationshipMap.put(type, relationshipType)));
}
// add unvisited node fragments to plan for each connected fragment set
private static void addUnvisitedNodeFragments(List<Fragment> plan,
Map<NodeId, Node> allNodes,
Collection<Node> connectedNodes) {
Set<Node> nodeWithFragment = connectedNodes.stream()
// make sure the fragment either have no dependency or dependencies have been dealt with
.filter(node -> !node.getFragmentsWithoutDependency().isEmpty() ||
!node.getFragmentsWithDependencyVisited().isEmpty())
.collect(Collectors.toSet());
while (!nodeWithFragment.isEmpty()) {
nodeWithFragment.forEach(node -> addNodeFragmentToPlan(node, plan, allNodes, false));
nodeWithFragment = connectedNodes.stream()
.filter(node -> !node.getFragmentsWithoutDependency().isEmpty() ||
!node.getFragmentsWithDependencyVisited().isEmpty())
.collect(Collectors.toSet());
}
}
// return a collection of set, in each set, all the fragments are connected
private static Collection<Set<Fragment>> getConnectedFragmentSets(
List<Fragment> plan, Set<Fragment> allFragments,
Map<NodeId, Node> allNodes, Set<Node> connectedNodes,
Map<Node, Double> nodesWithFixedCost, EmbeddedGraknTx<?> tx) {
allFragments.forEach(fragment -> {
if (fragment.end() == null) {
processFragmentWithFixedCost(plan, allNodes, connectedNodes, nodesWithFixedCost, tx, fragment);
}
if (!fragment.dependencies().isEmpty()) {
processFragmentWithDependencies(allNodes, fragment);
}
});
// process sub fragments here as we probably need to break the query tree
processSubFragment(allNodes, nodesWithFixedCost, allFragments);
final Map<Integer, Set<Var>> varSetMap = new HashMap<>();
final Map<Integer, Set<Fragment>> fragmentSetMap = new HashMap<>();
final int[] index = {0};
allFragments.forEach(fragment -> {
Set<Var> fragmentVarNameSet = Sets.newHashSet(fragment.vars());
List<Integer> setsWithVarInCommon = new ArrayList<>();
varSetMap.forEach((setIndex, varNameSet) -> {
if (!Collections.disjoint(varNameSet, fragmentVarNameSet)) {
setsWithVarInCommon.add(setIndex);
}
});
if (setsWithVarInCommon.isEmpty()) {
index[0] += 1;
varSetMap.put(index[0], fragmentVarNameSet);
fragmentSetMap.put(index[0], Sets.newHashSet(fragment));
} else {
Iterator<Integer> iterator = setsWithVarInCommon.iterator();
Integer firstSet = iterator.next();
varSetMap.get(firstSet).addAll(fragmentVarNameSet);
fragmentSetMap.get(firstSet).add(fragment);
while (iterator.hasNext()) {
Integer nextSet = iterator.next();
varSetMap.get(firstSet).addAll(varSetMap.remove(nextSet));
fragmentSetMap.get(firstSet).addAll(fragmentSetMap.remove(nextSet));
}
}
});
return fragmentSetMap.values();
}
private static void processFragmentWithFixedCost(List<Fragment> plan,
Map<NodeId, Node> allNodes,
Set<Node> connectedNodes,
Map<Node, Double> nodesWithFixedCost,
EmbeddedGraknTx<?> tx, Fragment fragment) {
Node start = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
connectedNodes.add(start);
if (fragment.hasFixedFragmentCost()) {
// fragments that should be done right away
plan.add(fragment);
double logInstanceCount = -1D;
Long shardCount = fragment.getShardCount(tx);
if (shardCount > 0) {
logInstanceCount = Math.log(shardCount - 1D + SHARD_LOAD_FACTOR) +
Math.log(tx.shardingThreshold());
}
nodesWithFixedCost.put(start, logInstanceCount);
start.setFixedFragmentCost(fragment.fragmentCost());
} else if (fragment.dependencies().isEmpty()) {
//fragments that should be done when a node has been visited
start.getFragmentsWithoutDependency().add(fragment);
}
}
private static void processFragmentWithDependencies(Map<NodeId, Node> allNodes, Fragment fragment) {
// it's either neq or value fragment
Node start = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
Node other = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.dependencies().iterator().next(),
allNodes);
start.getFragmentsWithDependency().add(fragment);
other.getDependants().add(fragment);
// check whether it's value fragment
if (fragment.varProperty() instanceof ValueProperty) {
// as value fragment is not symmetric, we need to add it again
other.getFragmentsWithDependency().add(fragment);
start.getDependants().add(fragment);
}
}
// if in-sub starts from an indexed supertype, update the fragment cost of in-isa starting from the subtypes
private static void processSubFragment(Map<NodeId, Node> allNodes,
Map<Node, Double> nodesWithFixedCost,
Set<Fragment> allFragments) {
Set<Fragment> validSubFragments = allFragments.stream().filter(fragment -> {
if (fragment instanceof InSubFragment) {
Node superType = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
if (nodesWithFixedCost.containsKey(superType) && nodesWithFixedCost.get(superType) > 0D) {
Node subType = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.end(), allNodes);
return !nodesWithFixedCost.containsKey(subType);
}
}
return false;
}).collect(Collectors.toSet());
if (!validSubFragments.isEmpty()) {
validSubFragments.forEach(fragment -> {
// TODO: should decrease the weight of sub type after each level
nodesWithFixedCost.put(Node.addIfAbsent(NodeId.NodeType.VAR, fragment.end(), allNodes),
nodesWithFixedCost.get(Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes)));
});
// recursively process all the sub fragments
processSubFragment(allNodes, nodesWithFixedCost, allFragments);
}
}
private static void updateFragmentCost(Map<NodeId, Node> allNodes,
Map<Node, Double> nodesWithFixedCost,
Fragment fragment) {
// ideally, this is where we update fragment cost after we get more info and statistics of the graph
// however, for now, only shard count is available, which is used to infer number of instances of a type
if (fragment instanceof InIsaFragment) {
Node type = Node.addIfAbsent(NodeId.NodeType.VAR, fragment.start(), allNodes);
if (nodesWithFixedCost.containsKey(type) && nodesWithFixedCost.get(type) > 0) {
fragment.setAccurateFragmentCost(nodesWithFixedCost.get(type));
}
}
}
private static Set<Weighted<DirectedEdge<Node>>> buildWeightedGraph(Map<NodeId, Node> allNodes,
Set<Node> connectedNodes,
Map<Node, Map<Node, Fragment>> edges,
Set<Fragment> edgeFragmentSet) {
final Set<Weighted<DirectedEdge<Node>>> weightedGraph = new HashSet<>();
edgeFragmentSet.stream()
.flatMap(fragment -> fragment.directedEdges(allNodes, edges).stream())
// add each edge together with its weight
.forEach(weightedDirectedEdge -> {
weightedGraph.add(weightedDirectedEdge);
connectedNodes.add(weightedDirectedEdge.val.destination);
connectedNodes.add(weightedDirectedEdge.val.source);
});
return weightedGraph;
}
// standard tree traversal from the root node
// always visit the branch/node with smaller cost
private static void greedyTraversal(List<Fragment> plan, Arborescence<Node> arborescence,
Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edgeFragmentChildToParent) {
Map<Node, Set<Node>> edgesParentToChild = new HashMap<>();
arborescence.getParents().forEach((child, parent) -> {
if (!edgesParentToChild.containsKey(parent)) {
edgesParentToChild.put(parent, new HashSet<>());
}
edgesParentToChild.get(parent).add(child);
});
Node root = arborescence.getRoot();
Set<Node> reachableNodes = Sets.newHashSet(root);
// expanding from the root until all nodes have been visited
while (!reachableNodes.isEmpty()) {
Node nodeWithMinCost = reachableNodes.stream().min(Comparator.comparingDouble(node ->
branchWeight(node, arborescence, edgesParentToChild, edgeFragmentChildToParent))).orElse(null);
assert nodeWithMinCost != null : "reachableNodes is never empty, so there is always a minimum";
// add edge fragment first, then node fragments
Fragment fragment = getEdgeFragment(nodeWithMinCost, arborescence, edgeFragmentChildToParent);
if (fragment != null) plan.add(fragment);
addNodeFragmentToPlan(nodeWithMinCost, plan, nodes, true);
reachableNodes.remove(nodeWithMinCost);
if (edgesParentToChild.containsKey(nodeWithMinCost)) {
reachableNodes.addAll(edgesParentToChild.get(nodeWithMinCost));
}
}
}
// recursively compute the weight of a branch
private static double branchWeight(Node node, Arborescence<Node> arborescence,
Map<Node, Set<Node>> edgesParentToChild,
Map<Node, Map<Node, Fragment>> edgeFragmentChildToParent) {
Double nodeWeight = node.getNodeWeight();
if (nodeWeight == null) {
nodeWeight = getEdgeFragmentCost(node, arborescence, edgeFragmentChildToParent) + nodeFragmentWeight(node);
node.setNodeWeight(nodeWeight);
}
Double branchWeight = node.getBranchWeight();
if (branchWeight == null) {
final double[] weight = {nodeWeight};
if (edgesParentToChild.containsKey(node)) {
edgesParentToChild.get(node).forEach(child ->
weight[0] += branchWeight(child, arborescence, edgesParentToChild, edgeFragmentChildToParent));
}
branchWeight = weight[0];
node.setBranchWeight(branchWeight);
}
return branchWeight;
}
// compute the total cost of a node
private static double nodeFragmentWeight(Node node) {
double costFragmentsWithoutDependency = node.getFragmentsWithoutDependency().stream()
.mapToDouble(Fragment::fragmentCost).sum();
double costFragmentsWithDependencyVisited = node.getFragmentsWithDependencyVisited().stream()
.mapToDouble(Fragment::fragmentCost).sum();
double costFragmentsWithDependency = node.getFragmentsWithDependency().stream()
.mapToDouble(Fragment::fragmentCost).sum();
return costFragmentsWithoutDependency + node.getFixedFragmentCost() +
(costFragmentsWithDependencyVisited + costFragmentsWithDependency) / 2D;
}
// adding a node's fragments to plan, updating dependants' dependency map
private static void addNodeFragmentToPlan(Node node, List<Fragment> plan, Map<NodeId, Node> nodes,
boolean visited) {
if (!visited) {
node.getFragmentsWithoutDependency().stream()
.min(Comparator.comparingDouble(Fragment::fragmentCost))
.ifPresent(firstNodeFragment -> {
plan.add(firstNodeFragment);
node.getFragmentsWithoutDependency().remove(firstNodeFragment);
});
}
node.getFragmentsWithoutDependency().addAll(node.getFragmentsWithDependencyVisited());
plan.addAll(node.getFragmentsWithoutDependency().stream()
.sorted(Comparator.comparingDouble(Fragment::fragmentCost))
.collect(Collectors.toList()));
node.getFragmentsWithoutDependency().clear();
node.getFragmentsWithDependencyVisited().clear();
// telling their dependants that they have been visited
node.getDependants().forEach(fragment -> {
Node otherNode = nodes.get(new NodeId(NodeId.NodeType.VAR, fragment.start()));
if (node.equals(otherNode)) {
otherNode = nodes.get(new NodeId(NodeId.NodeType.VAR, fragment.dependencies().iterator().next()));
}
otherNode.getDependants().remove(fragment.getInverse());
otherNode.getFragmentsWithDependencyVisited().add(fragment);
});
node.getDependants().clear();
}
// get edge fragment cost in order to map branch cost
private static double getEdgeFragmentCost(Node node, Arborescence<Node> arborescence,
Map<Node, Map<Node, Fragment>> edgeToFragment) {
Fragment fragment = getEdgeFragment(node, arborescence, edgeToFragment);
if (fragment != null) return fragment.fragmentCost();
return 0D;
}
@Nullable
private static Fragment getEdgeFragment(Node node, Arborescence<Node> arborescence,
Map<Node, Map<Node, Fragment>> edgeToFragment) {
if (edgeToFragment.containsKey(node) &&
edgeToFragment.get(node).containsKey(arborescence.getParents().get(node))) {
return edgeToFragment.get(node).get(arborescence.getParents().get(node));
}
return null;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AbstractRolePlayerFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.Label;
import ai.grakn.concept.Role;
import ai.grakn.graql.Graql;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Edge;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.graql.internal.gremlin.fragment.Fragments.displayOptionalTypeLabels;
import static java.util.stream.Collectors.toSet;
/**
* Abstract class for the fragments that traverse {@link Schema.EdgeLabel#ROLE_PLAYER} edges: {@link InRolePlayerFragment} and
* {@link OutRolePlayerFragment}.
*
* @author Felix Chapman
*/
public abstract class AbstractRolePlayerFragment extends Fragment {
@Override
public abstract Var end();
abstract Var edge();
abstract @Nullable Var role();
abstract @Nullable ImmutableSet<Label> roleLabels();
abstract @Nullable ImmutableSet<Label> relationTypeLabels();
final String innerName() {
Var role = role();
String roleString = role != null ? " role:" + role.shortName() : "";
String rels = displayOptionalTypeLabels("rels", relationTypeLabels());
String roles = displayOptionalTypeLabels("roles", roleLabels());
return "[" + Schema.EdgeLabel.ROLE_PLAYER.getLabel() + ":" + edge().shortName() + roleString + rels + roles + "]";
}
@Override
final ImmutableSet<Var> otherVars() {
ImmutableSet.Builder<Var> builder = ImmutableSet.<Var>builder().add(edge());
Var role = role();
if (role != null) builder.add(role);
return builder.build();
}
@Override
public final Set<Weighted<DirectedEdge<Node>>> directedEdges(
Map<NodeId, Node> nodes, Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(edge(), nodes, edges);
}
static void applyLabelsToTraversal(
GraphTraversal<?, Edge> traversal, Schema.EdgeProperty property,
@Nullable Set<Label> typeLabels, EmbeddedGraknTx<?> tx) {
if (typeLabels != null) {
Set<Integer> typeIds =
typeLabels.stream().map(label -> tx.convertToId(label).getValue()).collect(toSet());
traversal.has(property.name(), P.within(typeIds));
}
}
/**
* Optionally traverse from a {@link Schema.EdgeLabel#ROLE_PLAYER} edge to the {@link Role} it mentions, plus any super-types.
*
* @param traversal the traversal, starting from the {@link Schema.EdgeLabel#ROLE_PLAYER} edge
* @param role the variable to assign to the role. If not present, do nothing
* @param edgeProperty the edge property to look up the role label ID
*/
static void traverseToRole(
GraphTraversal<?, Edge> traversal, @Nullable Var role, Schema.EdgeProperty edgeProperty,
Collection<Var> vars) {
if (role != null) {
Var edge = Graql.var();
traversal.as(edge.name());
Fragments.outSubs(Fragments.traverseSchemaConceptFromEdge(traversal, edgeProperty));
assignVar(traversal, role, vars).select(edge.name());
}
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AttributeIndexFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.util.Schema.VertexProperty.INDEX;
@AutoValue
abstract class AttributeIndexFragment extends Fragment {
abstract String attributeIndex();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return traversal.has(INDEX.name(), attributeIndex());
}
@Override
public String name() {
return "[index:" + attributeIndex() + "]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_INDEX;
}
@Override
public boolean hasFixedFragmentCost() {
return true;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_AttributeIndexFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_AttributeIndexFragment extends AttributeIndexFragment {
private final VarProperty varProperty;
private final Var start;
private final String attributeIndex;
AutoValue_AttributeIndexFragment(
@Nullable VarProperty varProperty,
Var start,
String attributeIndex) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (attributeIndex == null) {
throw new NullPointerException("Null attributeIndex");
}
this.attributeIndex = attributeIndex;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
String attributeIndex() {
return attributeIndex;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof AttributeIndexFragment) {
AttributeIndexFragment that = (AttributeIndexFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.attributeIndex.equals(that.attributeIndex()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.attributeIndex.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_DataTypeFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.AttributeType;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_DataTypeFragment extends DataTypeFragment {
private final VarProperty varProperty;
private final Var start;
private final AttributeType.DataType dataType;
AutoValue_DataTypeFragment(
@Nullable VarProperty varProperty,
Var start,
AttributeType.DataType dataType) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (dataType == null) {
throw new NullPointerException("Null dataType");
}
this.dataType = dataType;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
AttributeType.DataType dataType() {
return dataType;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof DataTypeFragment) {
DataTypeFragment that = (DataTypeFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.dataType.equals(that.dataType()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.dataType.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_IdFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_IdFragment extends IdFragment {
private final VarProperty varProperty;
private final Var start;
private final ConceptId id;
AutoValue_IdFragment(
@Nullable VarProperty varProperty,
Var start,
ConceptId id) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (id == null) {
throw new NullPointerException("Null id");
}
this.id = id;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
ConceptId id() {
return id;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof IdFragment) {
IdFragment that = (IdFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.id.equals(that.id()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.id.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_InIsaFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_InIsaFragment extends InIsaFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
private final boolean mayHaveEdgeInstances;
AutoValue_InIsaFragment(
@Nullable VarProperty varProperty,
Var start,
Var end,
boolean mayHaveEdgeInstances) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
this.mayHaveEdgeInstances = mayHaveEdgeInstances;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
boolean mayHaveEdgeInstances() {
return mayHaveEdgeInstances;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof InIsaFragment) {
InIsaFragment that = (InIsaFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()))
&& (this.mayHaveEdgeInstances == that.mayHaveEdgeInstances());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
h *= 1000003;
h ^= this.mayHaveEdgeInstances ? 1231 : 1237;
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_InPlaysFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_InPlaysFragment extends InPlaysFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
private final boolean required;
AutoValue_InPlaysFragment(
@Nullable VarProperty varProperty,
Var start,
Var end,
boolean required) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
this.required = required;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
boolean required() {
return required;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof InPlaysFragment) {
InPlaysFragment that = (InPlaysFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()))
&& (this.required == that.required());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
h *= 1000003;
h ^= this.required ? 1231 : 1237;
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_InRelatesFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_InRelatesFragment extends InRelatesFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
AutoValue_InRelatesFragment(
@Nullable VarProperty varProperty,
Var start,
Var end) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof InRelatesFragment) {
InRelatesFragment that = (InRelatesFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_InRolePlayerFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_InRolePlayerFragment extends InRolePlayerFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
private final Var edge;
private final Var role;
private final ImmutableSet<Label> roleLabels;
private final ImmutableSet<Label> relationTypeLabels;
AutoValue_InRolePlayerFragment(
@Nullable VarProperty varProperty,
Var start,
Var end,
Var edge,
@Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels,
@Nullable ImmutableSet<Label> relationTypeLabels) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
if (edge == null) {
throw new NullPointerException("Null edge");
}
this.edge = edge;
this.role = role;
this.roleLabels = roleLabels;
this.relationTypeLabels = relationTypeLabels;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
Var edge() {
return edge;
}
@Nullable
@Override
Var role() {
return role;
}
@Nullable
@Override
ImmutableSet<Label> roleLabels() {
return roleLabels;
}
@Nullable
@Override
ImmutableSet<Label> relationTypeLabels() {
return relationTypeLabels;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof InRolePlayerFragment) {
InRolePlayerFragment that = (InRolePlayerFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()))
&& (this.edge.equals(that.edge()))
&& ((this.role == null) ? (that.role() == null) : this.role.equals(that.role()))
&& ((this.roleLabels == null) ? (that.roleLabels() == null) : this.roleLabels.equals(that.roleLabels()))
&& ((this.relationTypeLabels == null) ? (that.relationTypeLabels() == null) : this.relationTypeLabels.equals(that.relationTypeLabels()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
h *= 1000003;
h ^= this.edge.hashCode();
h *= 1000003;
h ^= (role == null) ? 0 : this.role.hashCode();
h *= 1000003;
h ^= (roleLabels == null) ? 0 : this.roleLabels.hashCode();
h *= 1000003;
h ^= (relationTypeLabels == null) ? 0 : this.relationTypeLabels.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_InSubFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_InSubFragment extends InSubFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
AutoValue_InSubFragment(
@Nullable VarProperty varProperty,
Var start,
Var end) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof InSubFragment) {
InSubFragment that = (InSubFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_IsAbstractFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_IsAbstractFragment extends IsAbstractFragment {
private final VarProperty varProperty;
private final Var start;
AutoValue_IsAbstractFragment(
@Nullable VarProperty varProperty,
Var start) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof IsAbstractFragment) {
IsAbstractFragment that = (IsAbstractFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_LabelFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_LabelFragment extends LabelFragment {
private final VarProperty varProperty;
private final Var start;
private final ImmutableSet<Label> labels;
AutoValue_LabelFragment(
@Nullable VarProperty varProperty,
Var start,
ImmutableSet<Label> labels) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (labels == null) {
throw new NullPointerException("Null labels");
}
this.labels = labels;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public ImmutableSet<Label> labels() {
return labels;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof LabelFragment) {
LabelFragment that = (LabelFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.labels.equals(that.labels()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.labels.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_NeqFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_NeqFragment extends NeqFragment {
private final VarProperty varProperty;
private final Var start;
private final Var other;
AutoValue_NeqFragment(
@Nullable VarProperty varProperty,
Var start,
Var other) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (other == null) {
throw new NullPointerException("Null other");
}
this.other = other;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var other() {
return other;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof NeqFragment) {
NeqFragment that = (NeqFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.other.equals(that.other()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.other.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_NotInternalFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_NotInternalFragment extends NotInternalFragment {
private final VarProperty varProperty;
private final Var start;
AutoValue_NotInternalFragment(
@Nullable VarProperty varProperty,
Var start) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof NotInternalFragment) {
NotInternalFragment that = (NotInternalFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_OutIsaFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_OutIsaFragment extends OutIsaFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
AutoValue_OutIsaFragment(
@Nullable VarProperty varProperty,
Var start,
Var end) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof OutIsaFragment) {
OutIsaFragment that = (OutIsaFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_OutPlaysFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_OutPlaysFragment extends OutPlaysFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
private final boolean required;
AutoValue_OutPlaysFragment(
@Nullable VarProperty varProperty,
Var start,
Var end,
boolean required) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
this.required = required;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
boolean required() {
return required;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof OutPlaysFragment) {
OutPlaysFragment that = (OutPlaysFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()))
&& (this.required == that.required());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
h *= 1000003;
h ^= this.required ? 1231 : 1237;
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_OutRelatesFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_OutRelatesFragment extends OutRelatesFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
AutoValue_OutRelatesFragment(
@Nullable VarProperty varProperty,
Var start,
Var end) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof OutRelatesFragment) {
OutRelatesFragment that = (OutRelatesFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_OutRolePlayerFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_OutRolePlayerFragment extends OutRolePlayerFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
private final Var edge;
private final Var role;
private final ImmutableSet<Label> roleLabels;
private final ImmutableSet<Label> relationTypeLabels;
AutoValue_OutRolePlayerFragment(
@Nullable VarProperty varProperty,
Var start,
Var end,
Var edge,
@Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels,
@Nullable ImmutableSet<Label> relationTypeLabels) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
if (edge == null) {
throw new NullPointerException("Null edge");
}
this.edge = edge;
this.role = role;
this.roleLabels = roleLabels;
this.relationTypeLabels = relationTypeLabels;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
Var edge() {
return edge;
}
@Nullable
@Override
Var role() {
return role;
}
@Nullable
@Override
ImmutableSet<Label> roleLabels() {
return roleLabels;
}
@Nullable
@Override
ImmutableSet<Label> relationTypeLabels() {
return relationTypeLabels;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof OutRolePlayerFragment) {
OutRolePlayerFragment that = (OutRolePlayerFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()))
&& (this.edge.equals(that.edge()))
&& ((this.role == null) ? (that.role() == null) : this.role.equals(that.role()))
&& ((this.roleLabels == null) ? (that.roleLabels() == null) : this.roleLabels.equals(that.roleLabels()))
&& ((this.relationTypeLabels == null) ? (that.relationTypeLabels() == null) : this.relationTypeLabels.equals(that.relationTypeLabels()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
h *= 1000003;
h ^= this.edge.hashCode();
h *= 1000003;
h ^= (role == null) ? 0 : this.role.hashCode();
h *= 1000003;
h ^= (roleLabels == null) ? 0 : this.roleLabels.hashCode();
h *= 1000003;
h ^= (relationTypeLabels == null) ? 0 : this.relationTypeLabels.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_OutSubFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_OutSubFragment extends OutSubFragment {
private final VarProperty varProperty;
private final Var start;
private final Var end;
AutoValue_OutSubFragment(
@Nullable VarProperty varProperty,
Var start,
Var end) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (end == null) {
throw new NullPointerException("Null end");
}
this.end = end;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
public Var end() {
return end;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof OutSubFragment) {
OutSubFragment that = (OutSubFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.end.equals(that.end()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.end.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_RegexFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_RegexFragment extends RegexFragment {
private final VarProperty varProperty;
private final Var start;
private final String regex;
AutoValue_RegexFragment(
@Nullable VarProperty varProperty,
Var start,
String regex) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (regex == null) {
throw new NullPointerException("Null regex");
}
this.regex = regex;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
String regex() {
return regex;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof RegexFragment) {
RegexFragment that = (RegexFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.regex.equals(that.regex()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.regex.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/AutoValue_ValueFragment.java
|
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_ValueFragment extends ValueFragment {
private final VarProperty varProperty;
private final Var start;
private final ValuePredicate predicate;
AutoValue_ValueFragment(
@Nullable VarProperty varProperty,
Var start,
ValuePredicate predicate) {
this.varProperty = varProperty;
if (start == null) {
throw new NullPointerException("Null start");
}
this.start = start;
if (predicate == null) {
throw new NullPointerException("Null predicate");
}
this.predicate = predicate;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
public Var start() {
return start;
}
@Override
ValuePredicate predicate() {
return predicate;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof ValueFragment) {
ValueFragment that = (ValueFragment) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.start.equals(that.start()))
&& (this.predicate.equals(that.predicate()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.start.hashCode();
h *= 1000003;
h ^= this.predicate.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/DataTypeFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.AttributeType;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.util.Schema.VertexProperty.DATA_TYPE;
@AutoValue
abstract class DataTypeFragment extends Fragment {
abstract AttributeType.DataType dataType();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> tx, Collection<Var> vars) {
return traversal.has(DATA_TYPE.name(), dataType().getName());
}
@Override
public String name() {
return "[datatype:" + dataType().getName() + "]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_DATA_TYPE;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/Fragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted.weighted;
/**
* represents a graph traversal, with one start point and optionally an end point
*
* A fragment is composed of four things:
* <ul>
* <li>A gremlin traversal function, that takes a gremlin traversal and appends some new gremlin steps</li>
* <li>A starting variable name, where the gremlin traversal must start from</li>
* <li>An optional ending variable name, if the gremlin traversal navigates to a new Graql variable</li>
* <li>A priority, that describes how efficient this traversal is to help with ordering the traversals</li>
* </ul>
*
* Variable names refer to Graql variables. Some of these variable names may be randomly-generated UUIDs, such as for
* castings.
*
* A {@code Fragment} is usually contained in a {@code EquivalentFragmentSet}, which contains multiple fragments describing
* the different directions the traversal can be followed in, with different starts and ends.
*
* A gremlin traversal is created from a {@code Query} by appending together fragments in order of priority, one from
* each {@code EquivalentFragmentSet} describing the {@code Query}.
*
* @author Grakn Warriors
*/
public abstract class Fragment {
// Default values used for estimate internal fragment cost
private static final double NUM_INSTANCES_PER_TYPE = 100D;
private static final double NUM_SUBTYPES_PER_TYPE = 1.5D;
private static final double NUM_RELATIONS_PER_INSTANCE = 30D;
private static final double NUM_TYPES_PER_ROLE = 3D;
private static final double NUM_ROLES_PER_TYPE = 3D;
private static final double NUM_ROLE_PLAYERS_PER_RELATION = 2D;
private static final double NUM_ROLE_PLAYERS_PER_ROLE = 1D;
private static final double NUM_RESOURCES_PER_VALUE = 2D;
static final double COST_INSTANCES_PER_TYPE = Math.log1p(NUM_INSTANCES_PER_TYPE);
static final double COST_SUBTYPES_PER_TYPE = Math.log1p(NUM_SUBTYPES_PER_TYPE);
static final double COST_RELATIONS_PER_INSTANCE = Math.log1p(NUM_RELATIONS_PER_INSTANCE);
static final double COST_TYPES_PER_ROLE = Math.log1p(NUM_TYPES_PER_ROLE);
static final double COST_ROLES_PER_TYPE = Math.log1p(NUM_ROLES_PER_TYPE);
static final double COST_ROLE_PLAYERS_PER_RELATION = Math.log1p(NUM_ROLE_PLAYERS_PER_RELATION);
static final double COST_ROLE_PLAYERS_PER_ROLE = Math.log1p(NUM_ROLE_PLAYERS_PER_ROLE);
static final double COST_SAME_AS_PREVIOUS = Math.log1p(1);
static final double COST_NODE_INDEX = -Math.log(NUM_INSTANCES_PER_TYPE);
static final double COST_NODE_INDEX_VALUE = -Math.log(NUM_INSTANCES_PER_TYPE / NUM_RESOURCES_PER_VALUE);
static final double COST_NODE_NEQ = -Math.log(2D);
static final double COST_NODE_DATA_TYPE = -Math.log(AttributeType.DataType.SUPPORTED_TYPES.size() / 2D);
static final double COST_NODE_UNSPECIFIC_PREDICATE = -Math.log(2D);
static final double COST_NODE_REGEX = -Math.log(2D);
static final double COST_NODE_NOT_INTERNAL = -Math.log(1.1D);
static final double COST_NODE_IS_ABSTRACT = -Math.log(1.1D);
// By default we assume the latest shard is 25% full
public static final double SHARD_LOAD_FACTOR = 0.25;
private Double accurateFragmentCost = null;
/*
* This is the memoized result of {@link #vars()}
*/
private @Nullable
ImmutableSet<Var> vars = null;
/**
* @param transform map defining id transform var -> new id
* @return transformed fragment with id predicates transformed according to the transform
*/
public Fragment transform(Map<Var, ConceptId> transform) {
return this;
}
/**
* Get the corresponding property
*/
public abstract @Nullable
VarProperty varProperty();
/**
* @return the variable name that this fragment starts from in the query
*/
public abstract Var start();
/**
* @return the variable name that this fragment ends at in the query, if this query has an end variable
*/
public @Nullable
Var end() {
return null;
}
ImmutableSet<Var> otherVars() {
return ImmutableSet.of();
}
/**
* @return the variable names that this fragment requires to have already been visited
*/
public Set<Var> dependencies() {
return ImmutableSet.of();
}
/**
* Convert the fragment to a set of weighted edges for query planning
*
* @param nodes all nodes in the query
* @param edges a mapping from edge(child, parent) to its corresponding fragment
* @return a set of edges
*/
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return Collections.emptySet();
}
/**
* @param traversal the traversal to extend with this Fragment
* @param tx the graph to execute the traversal on
*/
public final GraphTraversal<Vertex, ? extends Element> applyTraversal(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> tx,
Collection<Var> vars, @Nullable Var currentVar) {
if (currentVar != null) {
if (!currentVar.equals(start())) {
if (vars.contains(start())) {
// If the variable name has been visited but the traversal is not at that variable name, select it
traversal.select(start().name());
} else {
// Restart traversal when fragments are disconnected
traversal.V().as(start().name());
}
}
} else {
// If the variable name has not been visited yet, remember it and use the 'as' step
traversal.as(start().name());
}
vars.add(start());
traversal = applyTraversalInner(traversal, tx, vars);
Var end = end();
if (end != null) {
assignVar(traversal, end, vars);
}
vars.addAll(vars());
return traversal;
}
static <T, U> GraphTraversal<T, U> assignVar(GraphTraversal<T, U> traversal, Var var, Collection<Var> vars) {
if (!vars.contains(var)) {
// This variable name has not been encountered before, remember it and use the 'as' step
return traversal.as(var.name());
} else {
// This variable name has been encountered before, confirm it is the same
return traversal.where(P.eq(var.name()));
}
}
/**
* @param traversal the traversal to extend with this Fragment
* @param tx the {@link EmbeddedGraknTx} to execute the traversal on
* @param vars
*/
abstract GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> tx, Collection<Var> vars);
/**
* The name of the fragment
*/
public abstract String name();
/**
* A starting fragment is a fragment that can start a traversal.
* If any other fragment is present that refers to the same variable, the starting fragment can be omitted.
*/
public boolean isStartingFragment() {
return false;
}
/**
* Get the cost for executing the fragment.
*/
public double fragmentCost() {
if (accurateFragmentCost != null) return accurateFragmentCost;
return internalFragmentCost();
}
public void setAccurateFragmentCost(double fragmentCost) {
accurateFragmentCost = fragmentCost;
}
public abstract double internalFragmentCost();
/**
* If a fragment has fixed cost, the traversal is done using index. This makes the fragment a good starting point.
* A plan should always start with these fragments when possible.
*/
public boolean hasFixedFragmentCost() {
return false;
}
public Fragment getInverse() {
return this;
}
public Long getShardCount(EmbeddedGraknTx<?> tx) {
return 0L;
}
/**
* Indicates whether the fragment can be used on an {@link org.apache.tinkerpop.gremlin.structure.Edge} as well as
* a {@link org.apache.tinkerpop.gremlin.structure.Vertex}.
*/
public boolean canOperateOnEdges() {
return false;
}
/**
* Get all variables in the fragment including the start and end (if present)
*/
public final Set<Var> vars() {
if (vars == null) {
ImmutableSet.Builder<Var> builder = ImmutableSet.<Var>builder().add(start());
Var end = end();
if (end != null) builder.add(end);
builder.addAll(otherVars());
vars = builder.build();
}
return vars;
}
@Override
public final String toString() {
String str = start() + name();
if (end() != null) str += end().toString();
return str;
}
final Set<Weighted<DirectedEdge<Node>>> directedEdges(NodeId.NodeType nodeType,
Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edgeToFragment) {
Node start = Node.addIfAbsent(NodeId.NodeType.VAR, start(), nodes);
Node end = Node.addIfAbsent(NodeId.NodeType.VAR, end(), nodes);
Node middle = Node.addIfAbsent(nodeType, Sets.newHashSet(start(), end()), nodes);
middle.setInvalidStartingPoint();
addEdgeToFragmentMapping(middle, start, edgeToFragment);
return Sets.newHashSet(
weighted(DirectedEdge.from(start).to(middle), -fragmentCost()),
weighted(DirectedEdge.from(middle).to(end), 0));
}
final Set<Weighted<DirectedEdge<Node>>> directedEdges(Var edge,
Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edgeToFragment) {
Node start = Node.addIfAbsent(NodeId.NodeType.VAR, start(), nodes);
Node end = Node.addIfAbsent(NodeId.NodeType.VAR, end(), nodes);
Node middle = Node.addIfAbsent(NodeId.NodeType.VAR, edge, nodes);
middle.setInvalidStartingPoint();
addEdgeToFragmentMapping(middle, start, edgeToFragment);
return Sets.newHashSet(
weighted(DirectedEdge.from(start).to(middle), -fragmentCost()),
weighted(DirectedEdge.from(middle).to(end), 0));
}
private void addEdgeToFragmentMapping(Node child, Node parent, Map<Node, Map<Node, Fragment>> edgeToFragment) {
if (!edgeToFragment.containsKey(child)) {
edgeToFragment.put(child, new HashMap<>());
}
edgeToFragment.get(child).put(parent, this);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/Fragments.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.ConceptId;
import ai.grakn.concept.Label;
import ai.grakn.graql.Graql;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.util.StringConverter;
import ai.grakn.util.Schema;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import javax.annotation.Nullable;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.SUB;
import static ai.grakn.util.Schema.VertexProperty.LABEL_ID;
import static ai.grakn.util.Schema.VertexProperty.THING_TYPE_LABEL_ID;
import static java.util.stream.Collectors.joining;
/**
* Factory for creating instances of {@link Fragment}.
*
* @author Felix Chapman
*/
public class Fragments {
private Fragments() {
}
public static Fragment inRolePlayer(VarProperty varProperty,
Var rolePlayer, Var edge, Var relation, @Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels,
@Nullable ImmutableSet<Label> relationTypeLabels) {
return new AutoValue_InRolePlayerFragment(
varProperty, rolePlayer, relation, edge, role, roleLabels, relationTypeLabels);
}
public static Fragment outRolePlayer(VarProperty varProperty,
Var relation, Var edge, Var rolePlayer, @Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels,
@Nullable ImmutableSet<Label> relationTypeLabels) {
return new AutoValue_OutRolePlayerFragment(
varProperty, relation, rolePlayer, edge, role, roleLabels, relationTypeLabels);
}
public static Fragment inSub(VarProperty varProperty, Var start, Var end) {
return new AutoValue_InSubFragment(varProperty, start, end);
}
public static Fragment outSub(VarProperty varProperty, Var start, Var end) {
return new AutoValue_OutSubFragment(varProperty, start, end);
}
public static InRelatesFragment inRelates(VarProperty varProperty, Var start, Var end) {
return new AutoValue_InRelatesFragment(varProperty, start, end);
}
public static Fragment outRelates(VarProperty varProperty, Var start, Var end) {
return new AutoValue_OutRelatesFragment(varProperty, start, end);
}
public static Fragment inIsa(VarProperty varProperty, Var start, Var end, boolean mayHaveEdgeInstances) {
return new AutoValue_InIsaFragment(varProperty, start, end, mayHaveEdgeInstances);
}
public static Fragment outIsa(VarProperty varProperty, Var start, Var end) {
return new AutoValue_OutIsaFragment(varProperty, start, end);
}
public static Fragment dataType(VarProperty varProperty, Var start, AttributeType.DataType dataType) {
return new AutoValue_DataTypeFragment(varProperty, start, dataType);
}
public static Fragment inPlays(VarProperty varProperty, Var start, Var end, boolean required) {
return new AutoValue_InPlaysFragment(varProperty, start, end, required);
}
public static Fragment outPlays(VarProperty varProperty, Var start, Var end, boolean required) {
return new AutoValue_OutPlaysFragment(varProperty, start, end, required);
}
public static Fragment id(VarProperty varProperty, Var start, ConceptId id) {
return new AutoValue_IdFragment(varProperty, start, id);
}
public static Fragment label(VarProperty varProperty, Var start, ImmutableSet<Label> labels) {
return new AutoValue_LabelFragment(varProperty, start, labels);
}
public static Fragment value(VarProperty varProperty, Var start, ValuePredicate predicate) {
return new AutoValue_ValueFragment(varProperty, start, predicate);
}
public static Fragment isAbstract(VarProperty varProperty, Var start) {
return new AutoValue_IsAbstractFragment(varProperty, start);
}
public static Fragment regex(VarProperty varProperty, Var start, String regex) {
return new AutoValue_RegexFragment(varProperty, start, regex);
}
public static Fragment notInternal(VarProperty varProperty, Var start) {
return new AutoValue_NotInternalFragment(varProperty, start);
}
public static Fragment neq(VarProperty varProperty, Var start, Var other) {
return new AutoValue_NeqFragment(varProperty, start, other);
}
/**
* A {@link Fragment} that uses an index stored on each attribute. Attributes are indexed by direct type and value.
*/
public static Fragment attributeIndex(
@Nullable VarProperty varProperty, Var start, Label label, Object attributeValue) {
String attributeIndex = Schema.generateAttributeIndex(label, attributeValue.toString());
return new AutoValue_AttributeIndexFragment(varProperty, start, attributeIndex);
}
static <T> GraphTraversal<T, Vertex> outSubs(GraphTraversal<T, Vertex> traversal) {
// These traversals make sure to only navigate types by checking they do not have a `THING_TYPE_LABEL_ID` property
return union(traversal, ImmutableSet.of(
__.<Vertex>not(__.has(THING_TYPE_LABEL_ID.name())).not(__.hasLabel(Schema.BaseType.SHARD.name())),
__.repeat(__.out(SUB.getLabel())).emit()
)).unfold();
}
static <T> GraphTraversal<T, Vertex> inSubs(GraphTraversal<T, Vertex> traversal) {
// These traversals make sure to only navigate types by checking they do not have a `THING_TYPE_LABEL_ID` property
return union(traversal, ImmutableSet.of(
__.<Vertex>not(__.has(THING_TYPE_LABEL_ID.name())).not(__.hasLabel(Schema.BaseType.SHARD.name())),
__.repeat(__.in(SUB.getLabel())).emit()
)).unfold();
}
/**
* A type-safe way to do `__.union(a, b)`, as `Fragments.union(ImmutableSet.of(a, b))`.
* This avoids issues with unchecked varargs.
*/
static <S, E> GraphTraversal<S, E> union(Iterable<GraphTraversal<? super S, ? extends E>> traversals) {
return union(__.identity(), traversals);
}
/**
* A type-safe way to do `a.union(b, c)`, as `Fragments.union(a, ImmutableSet.of(b, c))`.
* This avoids issues with unchecked varargs.
*/
static <S, E1, E2> GraphTraversal<S, E2> union(
GraphTraversal<S, ? extends E1> start, Iterable<GraphTraversal<? super E1, ? extends E2>> traversals) {
// This is safe, because we know all the arguments are of the right type
//noinspection unchecked
GraphTraversal<E1, E2>[] array = (GraphTraversal<E1, E2>[]) Iterables.toArray(traversals, GraphTraversal.class);
return start.union(array);
}
/**
* Create a traversal that filters to only vertices
*/
static <T> GraphTraversal<T, Vertex> isVertex(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to vertices
//noinspection unchecked
return (GraphTraversal<T, Vertex>) traversal.has(Schema.VertexProperty.ID.name());
}
/**
* Create a traversal that filters to only edges
*/
static <T> GraphTraversal<T, Edge> isEdge(GraphTraversal<T, ? extends Element> traversal) {
// This cast is safe because we filter only to edges
//noinspection unchecked
return (GraphTraversal<T, Edge>) traversal.hasNot(Schema.VertexProperty.ID.name());
}
static String displayOptionalTypeLabels(String name, @Nullable Set<Label> typeLabels) {
if (typeLabels != null) {
return " " + name + ":" + typeLabels.stream().map(StringConverter::typeLabelToString).collect(joining(","));
} else {
return "";
}
}
static <S> GraphTraversal<S, Vertex> traverseSchemaConceptFromEdge(
GraphTraversal<S, Edge> traversal, Schema.EdgeProperty edgeProperty) {
// Access label ID from edge
Var labelId = Graql.var();
traversal.values(edgeProperty.name()).as(labelId.name());
// Look up schema concept using ID
return traversal.V().has(LABEL_ID.name(), __.where(P.eq(labelId.name())));
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/IdFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.pattern.property.IdProperty;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.graql.internal.util.StringConverter.idToString;
@AutoValue
abstract class IdFragment extends Fragment {
abstract ConceptId id();
public Fragment transform(Map<Var, ConceptId> transform) {
ConceptId toId = transform.get(start());
if (toId == null) return this;
return new AutoValue_IdFragment(IdProperty.of(toId), start(), toId);
}
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
if (canOperateOnEdges()) {
// Handle both edges and vertices
return traversal.or(
edgeTraversal(),
vertexTraversal(__.identity())
);
} else {
return vertexTraversal(traversal);
}
}
private GraphTraversal<Vertex, Vertex> vertexTraversal(GraphTraversal<Vertex, ? extends Element> traversal) {
// A vertex should always be looked up by vertex property, not the actual vertex ID which may be incorrect.
// This is because a vertex may represent a reified relation, which will use the original edge ID as an ID.
// We know only vertices have this property, so the cast is safe
//noinspection unchecked
return (GraphTraversal<Vertex, Vertex>) traversal.has(Schema.VertexProperty.ID.name(), id().getValue());
}
private GraphTraversal<Edge, Edge> edgeTraversal() {
return __.hasId(id().getValue().substring(1));
}
@Override
public String name() {
return "[id:" + idToString(id()) + "]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_INDEX;
}
@Override
public boolean hasFixedFragmentCost() {
return true;
}
@Override
public boolean canOperateOnEdges() {
return id().getValue().startsWith(Schema.PREFIX_EDGE);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/InIsaFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.graql.Graql.var;
import static ai.grakn.util.Schema.BaseType.RELATIONSHIP_TYPE;
import static ai.grakn.util.Schema.EdgeLabel.ATTRIBUTE;
import static ai.grakn.util.Schema.EdgeLabel.ISA;
import static ai.grakn.util.Schema.EdgeLabel.PLAYS;
import static ai.grakn.util.Schema.EdgeLabel.RELATES;
import static ai.grakn.util.Schema.EdgeLabel.SHARD;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_TYPE_LABEL_ID;
import static ai.grakn.util.Schema.VertexProperty.IS_IMPLICIT;
import static ai.grakn.util.Schema.VertexProperty.LABEL_ID;
/**
* A fragment representing traversing an isa edge from type to instance.
*
* @author Felix Chapman
*/
@AutoValue
public abstract class InIsaFragment extends Fragment {
@Override
public abstract Var end();
abstract boolean mayHaveEdgeInstances();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
GraphTraversal<Vertex, Vertex> vertexTraversal = Fragments.isVertex(traversal);
if (mayHaveEdgeInstances()) {
GraphTraversal<Vertex, Vertex> isImplicitRelationType =
__.<Vertex>hasLabel(RELATIONSHIP_TYPE.name()).has(IS_IMPLICIT.name(), true);
GraphTraversal<Vertex, Element> toVertexAndEdgeInstances = Fragments.union(ImmutableSet.of(
toVertexInstances(__.identity()),
toEdgeInstances()
));
return choose(vertexTraversal, isImplicitRelationType,
toVertexAndEdgeInstances,
toVertexInstances(__.identity())
);
} else {
return toVertexInstances(vertexTraversal);
}
}
/**
* A type-safe way to do `a.choose(pred, whenTrue, whenFalse)`, as `choose(a, pred, whenTrue, whenFalse)`.
* This is because the default signature is too restrictive
*/
private <S, E1, E2> GraphTraversal<S, E2> choose(
GraphTraversal<S, E1> traversal, GraphTraversal<E1, ?> traversalPredicate,
GraphTraversal<E1, ? extends E2> trueChoice, GraphTraversal<E1, ? extends E2> falseChoice) {
// This is safe. The generics for `GraphTraversal#choose` are more restrictive than necessary
//noinspection unchecked
return traversal.choose(
traversalPredicate, (GraphTraversal<S, E2>) trueChoice, (GraphTraversal<S, E2>) falseChoice);
}
private <S> GraphTraversal<S, Vertex> toVertexInstances(GraphTraversal<S, Vertex> traversal) {
return traversal.in(SHARD.getLabel()).in(ISA.getLabel());
}
private GraphTraversal<Vertex, Edge> toEdgeInstances() {
Var type = var();
Var labelId = var();
// There is no fast way to retrieve all edge instances, because edges cannot be globally indexed.
// This is a best-effort, that uses the schema to limit the search space...
// First retrieve the type ID
GraphTraversal<Vertex, Vertex> traversal =
__.<Vertex>as(type.name()).values(LABEL_ID.name()).as(labelId.name()).select(type.name());
// Next, navigate the schema to all possible types whose instances can be in this relation
traversal = Fragments.inSubs(traversal.out(RELATES.getLabel()).in(PLAYS.getLabel()));
// Navigate to all (vertex) instances of those types
// (we do not need to navigate to edge instances, because edge instances cannot be role-players)
traversal = toVertexInstances(traversal);
// Finally, navigate to all relation edges with the correct type attached to these instances
return traversal.outE(ATTRIBUTE.getLabel())
.has(RELATIONSHIP_TYPE_LABEL_ID.name(), __.where(P.eq(labelId.name())));
}
@Override
public String name() {
return String.format("<-[isa:%s]-", mayHaveEdgeInstances() ? "with-edges" : "");
}
@Override
public double internalFragmentCost() {
return COST_INSTANCES_PER_TYPE;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.ISA, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/InPlaysFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.PLAYS;
@AutoValue
abstract class InPlaysFragment extends Fragment {
@Override
public abstract Var end();
abstract boolean required();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
GraphTraversal<Vertex, Vertex> vertexTraversal = Fragments.isVertex(traversal);
if (required()) {
vertexTraversal.inE(PLAYS.getLabel()).has(Schema.EdgeProperty.REQUIRED.name()).otherV();
} else {
vertexTraversal.in(PLAYS.getLabel());
}
return Fragments.inSubs(vertexTraversal);
}
@Override
public String name() {
if (required()) {
return "<-[plays:required]-";
} else {
return "<-[plays]-";
}
}
@Override
public double internalFragmentCost() {
return COST_TYPES_PER_ROLE;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.PLAYS, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/InRelatesFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.RELATES;
@AutoValue
abstract class InRelatesFragment extends Fragment {
@Override
public abstract Var end();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.isVertex(traversal).in(RELATES.getLabel());
}
@Override
public String name() {
return "<-[relates]-";
}
@Override
public double internalFragmentCost() {
return COST_SAME_AS_PREVIOUS;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.RELATES, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/InRolePlayerFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.Pop;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.graql.internal.pattern.Patterns.RELATION_DIRECTION;
import static ai.grakn.graql.internal.pattern.Patterns.RELATION_EDGE;
import static ai.grakn.util.Schema.EdgeLabel.ROLE_PLAYER;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_ROLE_OWNER_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_ROLE_VALUE_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_TYPE_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.ROLE_LABEL_ID;
/**
* A fragment representing traversing a {@link ai.grakn.util.Schema.EdgeLabel#ROLE_PLAYER} edge from the role-player to
* the relation.
* <p>
* Part of a {@link ai.grakn.graql.internal.gremlin.EquivalentFragmentSet}, along with {@link OutRolePlayerFragment}.
*
* @author Felix Chapman
*/
@AutoValue
abstract class InRolePlayerFragment extends AbstractRolePlayerFragment {
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> tx, Collection<Var> vars) {
return Fragments.union(Fragments.isVertex(traversal), ImmutableSet.of(
reifiedRelationTraversal(tx, vars),
edgeRelationTraversal(tx, Direction.OUT, RELATIONSHIP_ROLE_OWNER_LABEL_ID, vars),
edgeRelationTraversal(tx, Direction.IN, RELATIONSHIP_ROLE_VALUE_LABEL_ID, vars)
));
}
private GraphTraversal<Vertex, Vertex> reifiedRelationTraversal(EmbeddedGraknTx<?> tx, Collection<Var> vars) {
GraphTraversal<Vertex, Edge> edgeTraversal = __.<Vertex>inE(ROLE_PLAYER.getLabel()).as(edge().name());
// Filter by any provided type labels
applyLabelsToTraversal(edgeTraversal, ROLE_LABEL_ID, roleLabels(), tx);
applyLabelsToTraversal(edgeTraversal, RELATIONSHIP_TYPE_LABEL_ID, relationTypeLabels(), tx);
traverseToRole(edgeTraversal, role(), ROLE_LABEL_ID, vars);
return edgeTraversal.outV();
}
private GraphTraversal<Vertex, Edge> edgeRelationTraversal(
EmbeddedGraknTx<?> tx, Direction direction, Schema.EdgeProperty roleProperty, Collection<Var> vars) {
GraphTraversal<Vertex, Edge> edgeTraversal = __.toE(direction, Schema.EdgeLabel.ATTRIBUTE.getLabel());
// Identify the relation - role-player pair by combining the relationship edge and direction into a map
edgeTraversal.as(RELATION_EDGE.name()).constant(direction).as(RELATION_DIRECTION.name());
edgeTraversal.select(Pop.last, RELATION_EDGE.name(), RELATION_DIRECTION.name()).as(edge().name()).select(RELATION_EDGE.name());
// Filter by any provided type labels
applyLabelsToTraversal(edgeTraversal, roleProperty, roleLabels(), tx);
applyLabelsToTraversal(edgeTraversal, RELATIONSHIP_TYPE_LABEL_ID, relationTypeLabels(), tx);
traverseToRole(edgeTraversal, role(), roleProperty, vars);
return edgeTraversal;
}
@Override
public String name() {
return "<-" + innerName() + "-";
}
@Override
public double internalFragmentCost() {
return COST_RELATIONS_PER_INSTANCE;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/InSubFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* Fragment following in sub edges
*
* @author Felix Chapman
*/
@AutoValue
public abstract class InSubFragment extends Fragment {
@Override
public abstract Var end();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.inSubs(Fragments.isVertex(traversal));
}
@Override
public String name() {
return "<-[sub]-";
}
@Override
public double internalFragmentCost() {
return COST_SUBTYPES_PER_TYPE;
}
@Override
public Fragment getInverse() {
return Fragments.outSub(varProperty(), end(), start());
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.SUB, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/IsAbstractFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
@AutoValue
abstract class IsAbstractFragment extends Fragment {
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return traversal.has(Schema.VertexProperty.IS_ABSTRACT.name(), true);
}
@Override
public String name() {
return "[is-abstract]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_IS_ABSTRACT;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/LabelFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.concept.Label;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.util.StringConverter;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Set;
import static ai.grakn.util.Schema.VertexProperty.LABEL_ID;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toSet;
/**
* A fragment representing traversing a label.
*
* @author Grakn Warriors
*/
@AutoValue
public abstract class LabelFragment extends Fragment {
// TODO: labels() should return ONE label instead of a set
public abstract ImmutableSet<Label> labels();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> tx, Collection<Var> vars) {
Set<Integer> labelIds =
labels().stream().map(label -> tx.convertToId(label).getValue()).collect(toSet());
if (labelIds.size() == 1) {
int labelId = Iterables.getOnlyElement(labelIds);
return traversal.has(LABEL_ID.name(), labelId);
} else {
return traversal.has(LABEL_ID.name(), P.within(labelIds));
}
}
@Override
public String name() {
return "[label:" + labels().stream().map(StringConverter::typeLabelToString).collect(joining(",")) + "]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_INDEX;
}
@Override
public boolean hasFixedFragmentCost() {
return true;
}
@Override
public Long getShardCount(EmbeddedGraknTx<?> tx) {
return labels().stream()
.map(tx::<SchemaConcept>getSchemaConcept)
.filter(schemaConcept -> schemaConcept != null && schemaConcept.isType())
.flatMap(SchemaConcept::subs)
.mapToLong(schemaConcept -> tx.getShardCount(schemaConcept.asType()))
.sum();
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/NeqFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
/**
* A fragment representing a negation.
*
* @author Felix Chapman
*/
@AutoValue
public abstract class NeqFragment extends Fragment {
public abstract Var other();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return traversal.where(P.neq(other().name()));
}
@Override
public String name() {
return "[neq:" + other().shortName() + "]";
}
@Override
public double internalFragmentCost() {
// This is arbitrary - we imagine about half the results are filtered out
return COST_NODE_NEQ;
}
@Override
public Fragment getInverse() {
return Fragments.neq(varProperty(), other(), start());
}
@Override
public ImmutableSet<Var> dependencies() {
return ImmutableSet.of(other());
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/NotInternalFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
@AutoValue
abstract class NotInternalFragment extends Fragment {
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return traversal.not(__.hasLabel(Schema.BaseType.SHARD.name()));
}
@Override
public String name() {
return "[not-internal]";
}
@Override
public boolean isStartingFragment() {
return true;
}
@Override
public double internalFragmentCost() {
return COST_NODE_NOT_INTERNAL;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/OutIsaFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.ISA;
import static ai.grakn.util.Schema.EdgeLabel.SHARD;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_TYPE_LABEL_ID;
/**
* A fragment representing traversing an isa edge from instance to type.
*
* @author Felix Chapman
*/
@AutoValue
public abstract class OutIsaFragment extends Fragment {
@Override
public abstract Var end();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.union(traversal, ImmutableSet.of(
Fragments.isVertex(__.identity()).out(ISA.getLabel()).out(SHARD.getLabel()),
edgeTraversal()
));
}
private GraphTraversal<Element, Vertex> edgeTraversal() {
return Fragments.traverseSchemaConceptFromEdge(Fragments.isEdge(__.identity()), RELATIONSHIP_TYPE_LABEL_ID);
}
@Override
public String name() {
return "-[isa]->";
}
@Override
public double internalFragmentCost() {
return COST_SAME_AS_PREVIOUS;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.ISA, nodes, edges);
}
@Override
public boolean canOperateOnEdges() {
return true;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/OutPlaysFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.PLAYS;
@AutoValue
abstract class OutPlaysFragment extends Fragment {
@Override
public abstract Var end();
abstract boolean required();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
GraphTraversal<Vertex, Vertex> vertexTraversal = Fragments.outSubs(Fragments.isVertex(traversal));
if (required()) {
return vertexTraversal.outE(PLAYS.getLabel()).has(Schema.EdgeProperty.REQUIRED.name()).otherV();
} else {
return vertexTraversal.out(PLAYS.getLabel());
}
}
@Override
public String name() {
if (required()) {
return "-[plays:required]->";
} else {
return "-[plays]->";
}
}
@Override
public double internalFragmentCost() {
return COST_ROLES_PER_TYPE;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.PLAYS, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/OutRelatesFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static ai.grakn.util.Schema.EdgeLabel.RELATES;
@AutoValue
abstract class OutRelatesFragment extends Fragment {
@Override
public abstract Var end();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.isVertex(traversal).out(RELATES.getLabel());
}
@Override
public String name() {
return "-[relates]->";
}
@Override
public double internalFragmentCost() {
return COST_ROLE_PLAYERS_PER_RELATION;
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.RELATES, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/OutRolePlayerFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import org.apache.tinkerpop.gremlin.process.traversal.Pop;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.graql.internal.pattern.Patterns.RELATION_DIRECTION;
import static ai.grakn.graql.internal.pattern.Patterns.RELATION_EDGE;
import static ai.grakn.util.Schema.EdgeLabel.ROLE_PLAYER;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_ROLE_OWNER_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_ROLE_VALUE_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.RELATIONSHIP_TYPE_LABEL_ID;
import static ai.grakn.util.Schema.EdgeProperty.ROLE_LABEL_ID;
/**
* A fragment representing traversing a {@link ai.grakn.util.Schema.EdgeLabel#ROLE_PLAYER} edge from the relation to the
* role-player.
* <p>
* Part of a {@link ai.grakn.graql.internal.gremlin.EquivalentFragmentSet}, along with {@link InRolePlayerFragment}.
*
* @author Felix Chapman
*/
@AutoValue
public abstract class OutRolePlayerFragment extends AbstractRolePlayerFragment {
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.union(traversal, ImmutableSet.of(
reifiedRelationTraversal(graph, vars),
edgeRelationTraversal(graph, Direction.OUT, RELATIONSHIP_ROLE_OWNER_LABEL_ID, vars),
edgeRelationTraversal(graph, Direction.IN, RELATIONSHIP_ROLE_VALUE_LABEL_ID, vars)
));
}
private GraphTraversal<Element, Vertex> reifiedRelationTraversal(EmbeddedGraknTx<?> tx, Collection<Var> vars) {
GraphTraversal<Element, Vertex> traversal = Fragments.isVertex(__.identity());
GraphTraversal<Element, Edge> edgeTraversal = traversal.outE(ROLE_PLAYER.getLabel()).as(edge().name());
// Filter by any provided type labels
applyLabelsToTraversal(edgeTraversal, ROLE_LABEL_ID, roleLabels(), tx);
applyLabelsToTraversal(edgeTraversal, RELATIONSHIP_TYPE_LABEL_ID, relationTypeLabels(), tx);
traverseToRole(edgeTraversal, role(), ROLE_LABEL_ID, vars);
return edgeTraversal.inV();
}
private GraphTraversal<Element, Vertex> edgeRelationTraversal(
EmbeddedGraknTx<?> tx, Direction direction, Schema.EdgeProperty roleProperty, Collection<Var> vars) {
GraphTraversal<Element, Edge> edgeTraversal = Fragments.isEdge(__.identity());
// Filter by any provided type labels
applyLabelsToTraversal(edgeTraversal, roleProperty, roleLabels(), tx);
applyLabelsToTraversal(edgeTraversal, RELATIONSHIP_TYPE_LABEL_ID, relationTypeLabels(), tx);
traverseToRole(edgeTraversal, role(), roleProperty, vars);
// Identify the relation - role-player pair by combining the relationship edge and direction into a map
edgeTraversal.as(RELATION_EDGE.name()).constant(direction).as(RELATION_DIRECTION.name());
edgeTraversal.select(Pop.last, RELATION_EDGE.name(), RELATION_DIRECTION.name()).as(edge().name()).select(RELATION_EDGE.name());
return edgeTraversal.toV(direction);
}
@Override
public String name() {
return "-" + innerName() + "->";
}
@Override
public double internalFragmentCost() {
return roleLabels() != null ? COST_ROLE_PLAYERS_PER_ROLE : COST_ROLE_PLAYERS_PER_RELATION;
}
@Override
public boolean canOperateOnEdges() {
return true;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/OutSubFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.Node;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.NodeId;
import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* Fragment following out sub edges
*
* @author Felix Chapman
*/
@AutoValue
public abstract class OutSubFragment extends Fragment {
@Override
public abstract Var end();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return Fragments.outSubs(Fragments.isVertex(traversal));
}
@Override
public String name() {
return "-[sub]->";
}
@Override
public double internalFragmentCost() {
return COST_SAME_AS_PREVIOUS;
}
@Override
public Fragment getInverse() {
return Fragments.inSub(varProperty(), end(), start());
}
@Override
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId, Node> nodes,
Map<Node, Map<Node, Fragment>> edges) {
return directedEdges(NodeId.NodeType.SUB, nodes, edges);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/RegexFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.Var;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import ai.grakn.util.StringUtil;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import static ai.grakn.util.Schema.VertexProperty.REGEX;
@AutoValue
abstract class RegexFragment extends Fragment {
abstract String regex();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return traversal.has(REGEX.name(), regex());
}
@Override
public String name() {
return "[regex:" + StringUtil.valueToString(regex()) + "]";
}
@Override
public double internalFragmentCost() {
return COST_NODE_REGEX;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/fragment/ValueFragment.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.fragment;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarPatternAdmin;
import ai.grakn.kb.internal.EmbeddedGraknTx;
import com.google.auto.value.AutoValue;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import java.util.Collection;
import java.util.Set;
import static ai.grakn.util.CommonUtil.optionalToStream;
import static java.util.stream.Collectors.toSet;
@AutoValue
abstract class ValueFragment extends Fragment {
abstract ValuePredicate predicate();
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
GraphTraversal<Vertex, ? extends Element> traversal, EmbeddedGraknTx<?> graph, Collection<Var> vars) {
return predicate().applyPredicate(traversal);
}
@Override
public String name() {
return "[value:" + predicate() + "]";
}
@Override
public double internalFragmentCost() {
if (predicate().isSpecific()) {
return COST_NODE_INDEX_VALUE;
} else {
// Assume approximately half of values will satisfy a filter
return COST_NODE_UNSPECIFIC_PREDICATE;
}
}
@Override
public boolean hasFixedFragmentCost() {
return predicate().isSpecific() && dependencies().isEmpty();
}
@Override
public Set<Var> dependencies() {
return optionalToStream(predicate().getInnerVar()).map(VarPatternAdmin::var).collect(toSet());
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AttributeIndexFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.Label;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import static ai.grakn.graql.internal.gremlin.sets.EquivalentFragmentSets.fragmentSetOfType;
/**
* A query can use a more-efficient attribute index traversal when the following criteria are met:
* <p>
* 1. There is an {@link IsaFragmentSet} and a {@link ValueFragmentSet} referring to the same instance {@link Var}.
* 2. The {@link IsaFragmentSet} refers to a type {@link Var} with a {@link LabelFragmentSet}.
* 3. The {@link LabelFragmentSet} refers to one type in the knowledge base.
* 4. The {@link ValueFragmentSet} is an equality predicate referring to a literal value.
* <p>
* When all these criteria are met, the fragments representing the {@link IsaFragmentSet} and the
* {@link ValueFragmentSet} can be replaced with a {@link AttributeIndexFragmentSet} that will use the attribute index
* to perform a unique lookup in constant time.
*
* @author Felix Chapman
*/
@AutoValue
abstract class AttributeIndexFragmentSet extends EquivalentFragmentSet {
static AttributeIndexFragmentSet of(Var var, Label label, Object value) {
return new AutoValue_AttributeIndexFragmentSet(var, label, value);
}
@Override
@Nullable
public final VarProperty varProperty() {
return null;
}
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.attributeIndex(varProperty(), var(), label(), value()));
}
abstract Var var();
abstract Label label();
abstract Object value();
static final FragmentSetOptimisation ATTRIBUTE_INDEX_OPTIMISATION = (fragmentSets, graph) -> {
Iterable<ValueFragmentSet> valueSets = equalsValueFragments(fragmentSets)::iterator;
for (ValueFragmentSet valueSet : valueSets) {
Var attribute = valueSet.var();
IsaFragmentSet isaSet = EquivalentFragmentSets.typeInformationOf(attribute, fragmentSets);
if (isaSet == null) continue;
Var type = isaSet.type();
LabelFragmentSet nameSet = EquivalentFragmentSets.labelOf(type, fragmentSets);
if (nameSet == null) continue;
Set<Label> labels = nameSet.labels();
if (labels.size() == 1) {
Label label = Iterables.getOnlyElement(labels);
optimise(fragmentSets, valueSet, isaSet, label);
return true;
}
}
return false;
};
private static void optimise(
Collection<EquivalentFragmentSet> fragmentSets, ValueFragmentSet valueSet, IsaFragmentSet isaSet,
Label label
) {
// Remove fragment sets we are going to replace
fragmentSets.remove(valueSet);
fragmentSets.remove(isaSet);
// Add a new fragment set to replace the old ones
Var attribute = valueSet.var();
Optional<Object> maybeValue = valueSet.predicate().equalsValue();
assert maybeValue.isPresent() : "This is filtered to only ones with equalValues in equalValueFragments method";
Object value = maybeValue.get();
AttributeIndexFragmentSet indexFragmentSet = AttributeIndexFragmentSet.of(attribute, label, value);
fragmentSets.add(indexFragmentSet);
}
private static Stream<ValueFragmentSet> equalsValueFragments(Collection<EquivalentFragmentSet> fragmentSets) {
return fragmentSetOfType(ValueFragmentSet.class, fragmentSets)
.filter(valueFragmentSet -> {
ValuePredicate predicate = valueFragmentSet.predicate();
return predicate.equalsValue().isPresent() && !predicate.getInnerVar().isPresent();
});
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_AttributeIndexFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import javax.annotation.Generated;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_AttributeIndexFragmentSet extends AttributeIndexFragmentSet {
private final Var var;
private final Label label;
private final Object value;
AutoValue_AttributeIndexFragmentSet(
Var var,
Label label,
Object value) {
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
if (label == null) {
throw new NullPointerException("Null label");
}
this.label = label;
if (value == null) {
throw new NullPointerException("Null value");
}
this.value = value;
}
@Override
Var var() {
return var;
}
@Override
Label label() {
return label;
}
@Override
Object value() {
return value;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof AttributeIndexFragmentSet) {
AttributeIndexFragmentSet that = (AttributeIndexFragmentSet) o;
return (this.var.equals(that.var()))
&& (this.label.equals(that.label()))
&& (this.value.equals(that.value()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= this.var.hashCode();
h *= 1000003;
h ^= this.label.hashCode();
h *= 1000003;
h ^= this.value.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_DataTypeFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.AttributeType;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_DataTypeFragmentSet extends DataTypeFragmentSet {
private final VarProperty varProperty;
private final Var attributeType;
private final AttributeType.DataType dataType;
AutoValue_DataTypeFragmentSet(
@Nullable VarProperty varProperty,
Var attributeType,
AttributeType.DataType dataType) {
this.varProperty = varProperty;
if (attributeType == null) {
throw new NullPointerException("Null attributeType");
}
this.attributeType = attributeType;
if (dataType == null) {
throw new NullPointerException("Null dataType");
}
this.dataType = dataType;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var attributeType() {
return attributeType;
}
@Override
AttributeType.DataType dataType() {
return dataType;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof DataTypeFragmentSet) {
DataTypeFragmentSet that = (DataTypeFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.attributeType.equals(that.attributeType()))
&& (this.dataType.equals(that.dataType()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.attributeType.hashCode();
h *= 1000003;
h ^= this.dataType.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_IdFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_IdFragmentSet extends IdFragmentSet {
private final VarProperty varProperty;
private final Var var;
private final ConceptId id;
AutoValue_IdFragmentSet(
@Nullable VarProperty varProperty,
Var var,
ConceptId id) {
this.varProperty = varProperty;
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
if (id == null) {
throw new NullPointerException("Null id");
}
this.id = id;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var var() {
return var;
}
@Override
ConceptId id() {
return id;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof IdFragmentSet) {
IdFragmentSet that = (IdFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.var.equals(that.var()))
&& (this.id.equals(that.id()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.var.hashCode();
h *= 1000003;
h ^= this.id.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_IsAbstractFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_IsAbstractFragmentSet extends IsAbstractFragmentSet {
private final VarProperty varProperty;
private final Var var;
AutoValue_IsAbstractFragmentSet(
@Nullable VarProperty varProperty,
Var var) {
this.varProperty = varProperty;
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var var() {
return var;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof IsAbstractFragmentSet) {
IsAbstractFragmentSet that = (IsAbstractFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.var.equals(that.var()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.var.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_IsaFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_IsaFragmentSet extends IsaFragmentSet {
private final VarProperty varProperty;
private final Var instance;
private final Var type;
private final boolean mayHaveEdgeInstances;
AutoValue_IsaFragmentSet(
@Nullable VarProperty varProperty,
Var instance,
Var type,
boolean mayHaveEdgeInstances) {
this.varProperty = varProperty;
if (instance == null) {
throw new NullPointerException("Null instance");
}
this.instance = instance;
if (type == null) {
throw new NullPointerException("Null type");
}
this.type = type;
this.mayHaveEdgeInstances = mayHaveEdgeInstances;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var instance() {
return instance;
}
@Override
Var type() {
return type;
}
@Override
boolean mayHaveEdgeInstances() {
return mayHaveEdgeInstances;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof IsaFragmentSet) {
IsaFragmentSet that = (IsaFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.instance.equals(that.instance()))
&& (this.type.equals(that.type()))
&& (this.mayHaveEdgeInstances == that.mayHaveEdgeInstances());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.instance.hashCode();
h *= 1000003;
h ^= this.type.hashCode();
h *= 1000003;
h ^= this.mayHaveEdgeInstances ? 1231 : 1237;
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_LabelFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_LabelFragmentSet extends LabelFragmentSet {
private final VarProperty varProperty;
private final Var var;
private final ImmutableSet<Label> labels;
AutoValue_LabelFragmentSet(
@Nullable VarProperty varProperty,
Var var,
ImmutableSet<Label> labels) {
this.varProperty = varProperty;
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
if (labels == null) {
throw new NullPointerException("Null labels");
}
this.labels = labels;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var var() {
return var;
}
@Override
ImmutableSet<Label> labels() {
return labels;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof LabelFragmentSet) {
LabelFragmentSet that = (LabelFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.var.equals(that.var()))
&& (this.labels.equals(that.labels()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.var.hashCode();
h *= 1000003;
h ^= this.labels.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_NeqFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_NeqFragmentSet extends NeqFragmentSet {
private final VarProperty varProperty;
private final Var varA;
private final Var varB;
AutoValue_NeqFragmentSet(
@Nullable VarProperty varProperty,
Var varA,
Var varB) {
this.varProperty = varProperty;
if (varA == null) {
throw new NullPointerException("Null varA");
}
this.varA = varA;
if (varB == null) {
throw new NullPointerException("Null varB");
}
this.varB = varB;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var varA() {
return varA;
}
@Override
Var varB() {
return varB;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof NeqFragmentSet) {
NeqFragmentSet that = (NeqFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.varA.equals(that.varA()))
&& (this.varB.equals(that.varB()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.varA.hashCode();
h *= 1000003;
h ^= this.varB.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_NotInternalFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_NotInternalFragmentSet extends NotInternalFragmentSet {
private final VarProperty varProperty;
private final Var var;
AutoValue_NotInternalFragmentSet(
@Nullable VarProperty varProperty,
Var var) {
this.varProperty = varProperty;
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var var() {
return var;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof NotInternalFragmentSet) {
NotInternalFragmentSet that = (NotInternalFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.var.equals(that.var()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.var.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_PlaysFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_PlaysFragmentSet extends PlaysFragmentSet {
private final VarProperty varProperty;
private final Var type;
private final Var role;
private final boolean required;
AutoValue_PlaysFragmentSet(
@Nullable VarProperty varProperty,
Var type,
Var role,
boolean required) {
this.varProperty = varProperty;
if (type == null) {
throw new NullPointerException("Null type");
}
this.type = type;
if (role == null) {
throw new NullPointerException("Null role");
}
this.role = role;
this.required = required;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var type() {
return type;
}
@Override
Var role() {
return role;
}
@Override
boolean required() {
return required;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof PlaysFragmentSet) {
PlaysFragmentSet that = (PlaysFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.type.equals(that.type()))
&& (this.role.equals(that.role()))
&& (this.required == that.required());
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.type.hashCode();
h *= 1000003;
h ^= this.role.hashCode();
h *= 1000003;
h ^= this.required ? 1231 : 1237;
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_RegexFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_RegexFragmentSet extends RegexFragmentSet {
private final VarProperty varProperty;
private final Var attributeType;
private final String regex;
AutoValue_RegexFragmentSet(
@Nullable VarProperty varProperty,
Var attributeType,
String regex) {
this.varProperty = varProperty;
if (attributeType == null) {
throw new NullPointerException("Null attributeType");
}
this.attributeType = attributeType;
if (regex == null) {
throw new NullPointerException("Null regex");
}
this.regex = regex;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var attributeType() {
return attributeType;
}
@Override
String regex() {
return regex;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof RegexFragmentSet) {
RegexFragmentSet that = (RegexFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.attributeType.equals(that.attributeType()))
&& (this.regex.equals(that.regex()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.attributeType.hashCode();
h *= 1000003;
h ^= this.regex.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_RelatesFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_RelatesFragmentSet extends RelatesFragmentSet {
private final VarProperty varProperty;
private final Var relationshipType;
private final Var role;
AutoValue_RelatesFragmentSet(
@Nullable VarProperty varProperty,
Var relationshipType,
Var role) {
this.varProperty = varProperty;
if (relationshipType == null) {
throw new NullPointerException("Null relationshipType");
}
this.relationshipType = relationshipType;
if (role == null) {
throw new NullPointerException("Null role");
}
this.role = role;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var relationshipType() {
return relationshipType;
}
@Override
Var role() {
return role;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof RelatesFragmentSet) {
RelatesFragmentSet that = (RelatesFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.relationshipType.equals(that.relationshipType()))
&& (this.role.equals(that.role()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.relationshipType.hashCode();
h *= 1000003;
h ^= this.role.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_RolePlayerFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.Label;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_RolePlayerFragmentSet extends RolePlayerFragmentSet {
private final VarProperty varProperty;
private final Var relation;
private final Var edge;
private final Var rolePlayer;
private final Var role;
private final ImmutableSet<Label> roleLabels;
private final ImmutableSet<Label> relationshipTypeLabels;
AutoValue_RolePlayerFragmentSet(
@Nullable VarProperty varProperty,
Var relation,
Var edge,
Var rolePlayer,
@Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels,
@Nullable ImmutableSet<Label> relationshipTypeLabels) {
this.varProperty = varProperty;
if (relation == null) {
throw new NullPointerException("Null relation");
}
this.relation = relation;
if (edge == null) {
throw new NullPointerException("Null edge");
}
this.edge = edge;
if (rolePlayer == null) {
throw new NullPointerException("Null rolePlayer");
}
this.rolePlayer = rolePlayer;
this.role = role;
this.roleLabels = roleLabels;
this.relationshipTypeLabels = relationshipTypeLabels;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var relation() {
return relation;
}
@Override
Var edge() {
return edge;
}
@Override
Var rolePlayer() {
return rolePlayer;
}
@Nullable
@Override
Var role() {
return role;
}
@Nullable
@Override
ImmutableSet<Label> roleLabels() {
return roleLabels;
}
@Nullable
@Override
ImmutableSet<Label> relationshipTypeLabels() {
return relationshipTypeLabels;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof RolePlayerFragmentSet) {
RolePlayerFragmentSet that = (RolePlayerFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.relation.equals(that.relation()))
&& (this.edge.equals(that.edge()))
&& (this.rolePlayer.equals(that.rolePlayer()))
&& ((this.role == null) ? (that.role() == null) : this.role.equals(that.role()))
&& ((this.roleLabels == null) ? (that.roleLabels() == null) : this.roleLabels.equals(that.roleLabels()))
&& ((this.relationshipTypeLabels == null) ? (that.relationshipTypeLabels() == null) : this.relationshipTypeLabels.equals(that.relationshipTypeLabels()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.relation.hashCode();
h *= 1000003;
h ^= this.edge.hashCode();
h *= 1000003;
h ^= this.rolePlayer.hashCode();
h *= 1000003;
h ^= (role == null) ? 0 : this.role.hashCode();
h *= 1000003;
h ^= (roleLabels == null) ? 0 : this.roleLabels.hashCode();
h *= 1000003;
h ^= (relationshipTypeLabels == null) ? 0 : this.relationshipTypeLabels.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_SubFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_SubFragmentSet extends SubFragmentSet {
private final VarProperty varProperty;
private final Var subConcept;
private final Var superConcept;
AutoValue_SubFragmentSet(
@Nullable VarProperty varProperty,
Var subConcept,
Var superConcept) {
this.varProperty = varProperty;
if (subConcept == null) {
throw new NullPointerException("Null subConcept");
}
this.subConcept = subConcept;
if (superConcept == null) {
throw new NullPointerException("Null superConcept");
}
this.superConcept = superConcept;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var subConcept() {
return subConcept;
}
@Override
Var superConcept() {
return superConcept;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof SubFragmentSet) {
SubFragmentSet that = (SubFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.subConcept.equals(that.subConcept()))
&& (this.superConcept.equals(that.superConcept()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.subConcept.hashCode();
h *= 1000003;
h ^= this.superConcept.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/AutoValue_ValueFragmentSet.java
|
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_ValueFragmentSet extends ValueFragmentSet {
private final VarProperty varProperty;
private final Var var;
private final ValuePredicate predicate;
AutoValue_ValueFragmentSet(
@Nullable VarProperty varProperty,
Var var,
ValuePredicate predicate) {
this.varProperty = varProperty;
if (var == null) {
throw new NullPointerException("Null var");
}
this.var = var;
if (predicate == null) {
throw new NullPointerException("Null predicate");
}
this.predicate = predicate;
}
@Nullable
@Override
public VarProperty varProperty() {
return varProperty;
}
@Override
Var var() {
return var;
}
@Override
ValuePredicate predicate() {
return predicate;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof ValueFragmentSet) {
ValueFragmentSet that = (ValueFragmentSet) o;
return ((this.varProperty == null) ? (that.varProperty() == null) : this.varProperty.equals(that.varProperty()))
&& (this.var.equals(that.var()))
&& (this.predicate.equals(that.predicate()));
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= (varProperty == null) ? 0 : this.varProperty.hashCode();
h *= 1000003;
h ^= this.var.hashCode();
h *= 1000003;
h ^= this.predicate.hashCode();
return h;
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/DataTypeFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.AttributeType;
import ai.grakn.graql.Var;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#dataType(ai.grakn.graql.admin.VarProperty, Var, AttributeType.DataType)
*
* @author Felix Chapman
*/
@AutoValue
abstract class DataTypeFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.dataType(varProperty(), attributeType(), dataType()));
}
abstract Var attributeType();
abstract AttributeType.DataType dataType();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/EquivalentFragmentSets.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.GraknTx;
import ai.grakn.concept.AttributeType;
import ai.grakn.concept.ConceptId;
import ai.grakn.concept.Label;
import ai.grakn.concept.Relationship;
import ai.grakn.concept.RelationshipType;
import ai.grakn.concept.Role;
import ai.grakn.graql.ValuePredicate;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.stream.Stream;
/**
* Factory class for producing instances of {@link EquivalentFragmentSet}.
*
* @author Felix Chapman
*/
public class EquivalentFragmentSets {
private static final ImmutableCollection<FragmentSetOptimisation> OPTIMISATIONS = ImmutableSet.of(
RolePlayerFragmentSet.ROLE_OPTIMISATION,
RolePlayerFragmentSet.IMPLICIT_RELATION_OPTIMISATION,
AttributeIndexFragmentSet.ATTRIBUTE_INDEX_OPTIMISATION,
RolePlayerFragmentSet.RELATION_TYPE_OPTIMISATION,
LabelFragmentSet.REDUNDANT_LABEL_ELIMINATION_OPTIMISATION,
SubFragmentSet.SUB_TRAVERSAL_ELIMINATION_OPTIMISATION,
IsaFragmentSet.SKIP_EDGE_INSTANCE_CHECK_OPTIMISATION
);
/**
* An {@link EquivalentFragmentSet} that indicates a variable is a type whose instances play a role.
*
* @param type a type variable label
* @param role a role variable label
* @param required whether the plays must be constrained to be "required"
*/
public static EquivalentFragmentSet plays(VarProperty varProperty, Var type, Var role, boolean required) {
return new AutoValue_PlaysFragmentSet(varProperty, type, role, required);
}
/**
* Describes the edge connecting a {@link Relationship} to a role-player.
* <p>
* Can be constrained with information about the possible {@link Role}s or {@link RelationshipType}s.
*
* @author Felix Chapman
*/
public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Var relation, Var edge, Var rolePlayer, @Nullable Var role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) {
return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels);
}
public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Var relation, Var edge, Var rolePlayer, @Nullable Var role) {
return rolePlayer(varProperty, relation, edge, rolePlayer, role, null, null);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable is a sub-type of another variable.
*/
public static EquivalentFragmentSet sub(VarProperty varProperty, Var subType, Var superType) {
return new AutoValue_SubFragmentSet(varProperty, subType, superType);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable is a relation type which involves a role.
*/
public static EquivalentFragmentSet relates(VarProperty varProperty, Var relationType, Var role) {
return new AutoValue_RelatesFragmentSet(varProperty, relationType, role);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable is not a casting or a shard.
*/
public static EquivalentFragmentSet notInternalFragmentSet(VarProperty varProperty, Var start) {
return new AutoValue_NotInternalFragmentSet(varProperty, start);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable is a direct instance of a type.
*/
public static EquivalentFragmentSet isa(
VarProperty varProperty, Var instance, Var type, boolean mayHaveEdgeInstances) {
return new AutoValue_IsaFragmentSet(varProperty, instance, type, mayHaveEdgeInstances);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable is not equal to another variable.
*/
public static EquivalentFragmentSet neq(VarProperty varProperty, Var varA, Var varB) {
return new AutoValue_NeqFragmentSet(varProperty, varA, varB);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable represents a resource with value matching a predicate.
*/
public static EquivalentFragmentSet value(VarProperty varProperty, Var resource, ValuePredicate predicate) {
return new AutoValue_ValueFragmentSet(varProperty, resource, predicate);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable representing a concept with a particular ID.
*/
public static EquivalentFragmentSet id(VarProperty varProperty, Var start, ConceptId id) {
return new AutoValue_IdFragmentSet(varProperty, start, id);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable represents an abstract type.
*/
public static EquivalentFragmentSet isAbstract(VarProperty varProperty, Var start) {
return new AutoValue_IsAbstractFragmentSet(varProperty, start);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable representing a schema concept with one of the
* specified labels.
*/
public static EquivalentFragmentSet label(VarProperty varProperty, Var type, ImmutableSet<Label> labels) {
return new AutoValue_LabelFragmentSet(varProperty, type, labels);
}
/**
* An {@link EquivalentFragmentSet} that indicates a variable representing a resource type with a data-type.
*/
public static EquivalentFragmentSet dataType(VarProperty varProperty, Var resourceType, AttributeType.DataType<?> dataType) {
return new AutoValue_DataTypeFragmentSet(varProperty, resourceType, dataType);
}
/**
* An {@link EquivalentFragmentSet} that indicates a resource type whose instances must conform to a given regex.
*/
public static EquivalentFragmentSet regex(VarProperty varProperty, Var resourceType, String regex) {
return new AutoValue_RegexFragmentSet(varProperty, resourceType, regex);
}
/**
* Modify the given collection of {@link EquivalentFragmentSet} to introduce certain optimisations, such as the
* {@link AttributeIndexFragmentSet}.
* <p>
* This involves substituting various {@link EquivalentFragmentSet} with other {@link EquivalentFragmentSet}.
*/
public static void optimiseFragmentSets(
Collection<EquivalentFragmentSet> fragmentSets, GraknTx graph) {
// Repeatedly apply optimisations until they don't alter the query
boolean changed = true;
while (changed) {
changed = false;
for (FragmentSetOptimisation optimisation : OPTIMISATIONS) {
changed |= optimisation.apply(fragmentSets, graph);
}
}
}
static <T extends EquivalentFragmentSet> Stream<T> fragmentSetOfType(
Class<T> clazz, Collection<EquivalentFragmentSet> fragmentSets) {
return fragmentSets.stream().filter(clazz::isInstance).map(clazz::cast);
}
static @Nullable LabelFragmentSet labelOf(Var type, Collection<EquivalentFragmentSet> fragmentSets) {
return fragmentSetOfType(LabelFragmentSet.class, fragmentSets)
.filter(labelFragmentSet -> labelFragmentSet.var().equals(type))
.findAny()
.orElse(null);
}
@Nullable
static IsaFragmentSet typeInformationOf(Var instance, Collection<EquivalentFragmentSet> fragmentSets) {
return fragmentSetOfType(IsaFragmentSet.class, fragmentSets)
.filter(isaFragmentSet -> isaFragmentSet.instance().equals(instance))
.findAny()
.orElse(null);
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/FragmentSetOptimisation.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.GraknTx;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import java.util.Collection;
/**
* Describes an optimisation strategy that can be applied to {@link EquivalentFragmentSet}s.
*
* @author Felix Chapman
*/
@FunctionalInterface
public interface FragmentSetOptimisation {
/**
* Apply the optimisation to the given {@link EquivalentFragmentSet}s using the given {@link GraknTx}.
*
* <p>
* The strategy may modify the collection. If it does, it will return {@code true}, otherwise it will return
* {@code false}.
* </p>
*
* @param fragmentSets a mutable collection of {@link EquivalentFragmentSet}s
* @param tx the {@link GraknTx} that these {@link EquivalentFragmentSet}s are going to operate against
* @return whether {@code fragmentSets} was modified
*/
boolean apply(Collection<EquivalentFragmentSet> fragmentSets, GraknTx tx);
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/IdFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.ConceptId;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#id(VarProperty, Var, ConceptId)
*
* @author Felix Chapman
*/
@AutoValue
abstract class IdFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.id(varProperty(), var(), id()));
}
abstract Var var();
abstract ConceptId id();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/IsAbstractFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import static ai.grakn.graql.internal.gremlin.fragment.Fragments.isAbstract;
/**
* @see EquivalentFragmentSets#isAbstract(VarProperty, Var)
*
* @author Felix Chapman
*/
@AutoValue
abstract class IsAbstractFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(isAbstract(varProperty(), var()));
}
abstract Var var();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/IsaFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import static ai.grakn.graql.internal.gremlin.sets.EquivalentFragmentSets.fragmentSetOfType;
import static ai.grakn.graql.internal.gremlin.sets.EquivalentFragmentSets.labelOf;
/**
* @see EquivalentFragmentSets#isa(VarProperty, Var, Var, boolean)
*
* @author Felix Chapman
*/
@AutoValue
abstract class IsaFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(
Fragments.outIsa(varProperty(), instance(), type()),
Fragments.inIsa(varProperty(), type(), instance(), mayHaveEdgeInstances())
);
}
abstract Var instance();
abstract Var type();
abstract boolean mayHaveEdgeInstances();
/**
* We can skip the mid-traversal check for edge instances in the following case:
*
* <ol>
* <li>There is an {@link IsaFragmentSet} {@code $x-[isa:with-edges]->$X}
* <li>There is a {@link LabelFragmentSet} {@code $X[label:foo,bar]}
* <li>The labels {@code foo} and {@code bar} are all not types that may have edge instances</li>
* </ol>
*/
static final FragmentSetOptimisation SKIP_EDGE_INSTANCE_CHECK_OPTIMISATION = (fragments, tx) -> {
Iterable<IsaFragmentSet> isaSets = fragmentSetOfType(IsaFragmentSet.class, fragments)::iterator;
for (IsaFragmentSet isaSet : isaSets) {
if (!isaSet.mayHaveEdgeInstances()) continue;
LabelFragmentSet labelSet = labelOf(isaSet.type(), fragments);
if (labelSet == null) continue;
boolean mayHaveEdgeInstances = labelSet.labels().stream()
.map(tx::<SchemaConcept>getSchemaConcept)
.anyMatch(IsaFragmentSet::mayHaveEdgeInstances);
if (!mayHaveEdgeInstances) {
fragments.remove(isaSet);
fragments.add(EquivalentFragmentSets.isa(isaSet.varProperty(), isaSet.instance(), isaSet.type(), false));
return true;
}
}
return false;
};
private static boolean mayHaveEdgeInstances(SchemaConcept concept) {
return concept.isRelationshipType() && concept.isImplicit();
}
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/LabelFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.GraknTx;
import ai.grakn.concept.Label;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import javax.annotation.Nullable;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
/**
* @see EquivalentFragmentSets#label(VarProperty, Var, ImmutableSet)
*
* @author Felix Chapman
*/
@AutoValue
abstract class LabelFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.label(varProperty(), var(), labels()));
}
abstract Var var();
abstract ImmutableSet<Label> labels();
/**
* Expand a {@link LabelFragmentSet} to match all sub-concepts of the single existing {@link Label}.
*
* Returns null if there is not exactly one label any of the {@link Label}s mentioned are not in the knowledge base.
*/
@Nullable
LabelFragmentSet tryExpandSubs(Var typeVar, GraknTx tx) {
if (labels().size() != 1) return null;
Label oldLabel = Iterables.getOnlyElement(labels());
SchemaConcept concept = tx.getSchemaConcept(oldLabel);
if (concept == null) return null;
Set<Label> newLabels = concept.subs().map(SchemaConcept::label).collect(toSet());
return new AutoValue_LabelFragmentSet(varProperty(), typeVar, ImmutableSet.copyOf(newLabels));
}
/**
* Optimise away any redundant {@link LabelFragmentSet}s. A {@link LabelFragmentSet} is considered redundant if:
* <ol>
* <li>It refers to a {@link SchemaConcept} that exists in the knowledge base
* <li>It is not associated with a user-defined {@link Var}
* <li>The {@link Var} it is associated with is not referred to in any other fragment
* <li>The fragment set is not the only remaining fragment set</li>
* </ol>
*/
static final FragmentSetOptimisation REDUNDANT_LABEL_ELIMINATION_OPTIMISATION = (fragmentSets, graph) -> {
if (fragmentSets.size() <= 1) return false;
Iterable<LabelFragmentSet> labelFragments =
EquivalentFragmentSets.fragmentSetOfType(LabelFragmentSet.class, fragmentSets)::iterator;
for (LabelFragmentSet labelSet : labelFragments) {
boolean hasUserDefinedVar = labelSet.var().isUserDefinedName();
if (hasUserDefinedVar) continue;
boolean existsInGraph = labelSet.labels().stream().anyMatch(label -> graph.getSchemaConcept(label) != null);
if (!existsInGraph) continue;
boolean varReferredToInOtherFragment = fragmentSets.stream()
.filter(set -> !set.equals(labelSet))
.flatMap(set -> set.fragments().stream())
.map(Fragment::vars)
.anyMatch(vars -> vars.contains(labelSet.var()));
if (!varReferredToInOtherFragment) {
fragmentSets.remove(labelSet);
return true;
}
}
return false;
};
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/NeqFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#neq(VarProperty, Var, Var)
*
* @author Felix Chapman
*/
@AutoValue
abstract class NeqFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(
Fragments.neq(varProperty(), varA(), varB()), Fragments.neq(varProperty(), varB(), varA())
);
}
abstract Var varA();
abstract Var varB();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/NotInternalFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#notInternalFragmentSet(VarProperty, Var)
*
* @author Felix Chapman
*/
@AutoValue
abstract class NotInternalFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.notInternal(varProperty(), var()));
}
abstract Var var();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/PlaysFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#plays(VarProperty, Var, Var, boolean)
*
* @author Felix Chapman
*/
@AutoValue
abstract class PlaysFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(
Fragments.outPlays(varProperty(), type(), role(), required()),
Fragments.inPlays(varProperty(), role(), type(), required())
);
}
abstract Var type();
abstract Var role();
abstract boolean required();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/RegexFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#regex(VarProperty, Var, String)
*
* @author Felix Chapman
*/
@AutoValue
abstract class RegexFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(Fragments.regex(varProperty(), attributeType(), regex()));
}
abstract Var attributeType();
abstract String regex();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/RelatesFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* @see EquivalentFragmentSets#relates(VarProperty, Var, Var)
*
* @author Felix Chapman
*/
@AutoValue
abstract class RelatesFragmentSet extends EquivalentFragmentSet {
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(
Fragments.outRelates(varProperty(), relationshipType(), role()),
Fragments.inRelates(varProperty(), role(), relationshipType())
);
}
abstract Var relationshipType();
abstract Var role();
}
|
0
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin
|
java-sources/ai/grakn/grakn-graql/1.4.3/ai/grakn/graql/internal/gremlin/sets/RolePlayerFragmentSet.java
|
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package ai.grakn.graql.internal.gremlin.sets;
import ai.grakn.concept.Concept;
import ai.grakn.concept.Label;
import ai.grakn.concept.RelationshipType;
import ai.grakn.concept.Role;
import ai.grakn.concept.SchemaConcept;
import ai.grakn.graql.Var;
import ai.grakn.graql.admin.VarProperty;
import ai.grakn.graql.internal.gremlin.EquivalentFragmentSet;
import ai.grakn.graql.internal.gremlin.fragment.Fragment;
import ai.grakn.graql.internal.gremlin.fragment.Fragments;
import ai.grakn.util.Schema;
import com.google.auto.value.AutoValue;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import java.util.Objects;
import javax.annotation.Nullable;
import java.util.Set;
import java.util.stream.Stream;
import static ai.grakn.util.CommonUtil.toImmutableSet;
import static java.util.stream.Collectors.toSet;
/**
* @see EquivalentFragmentSets#rolePlayer(VarProperty, Var, Var, Var, Var)
*
* @author Felix Chapman
*/
@AutoValue
abstract class RolePlayerFragmentSet extends EquivalentFragmentSet {
public static RolePlayerFragmentSet of(
VarProperty varProperty, Var relation, Var edge, Var rolePlayer, @Nullable Var role,
@Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relationTypeLabels
) {
return new AutoValue_RolePlayerFragmentSet(
varProperty, relation, edge, rolePlayer, role, roleLabels, relationTypeLabels
);
}
@Override
public final Set<Fragment> fragments() {
return ImmutableSet.of(
Fragments.inRolePlayer(varProperty(), rolePlayer(), edge(), relation(), role(), roleLabels(), relationshipTypeLabels()),
Fragments.outRolePlayer(varProperty(), relation(), edge(), rolePlayer(), role(), roleLabels(), relationshipTypeLabels())
);
}
abstract Var relation();
abstract Var edge();
abstract Var rolePlayer();
abstract @Nullable Var role();
abstract @Nullable ImmutableSet<Label> roleLabels();
abstract @Nullable ImmutableSet<Label> relationshipTypeLabels();
/**
* A query can use the role-type labels on a {@link Schema.EdgeLabel#ROLE_PLAYER} edge when the following criteria are met:
* <ol>
* <li>There is a {@link RolePlayerFragmentSet} {@code $r-[role-player:$e role:$R ...]->$p}
* <li>There is a {@link LabelFragmentSet} {@code $R[label:foo,bar]}
* </ol>
*
* When these criteria are met, the {@link RolePlayerFragmentSet} can be filtered to the indirect sub-types of
* {@code foo} and {@code bar} and will no longer need to navigate to the {@link Role} directly:
* <p>
* {@code $r-[role-player:$e roles:foo,bar ...]->$p}
* <p>
* In the special case where the role is specified as the meta {@code role}, no labels are added and the {@link Role}
* variable is detached from the {@link Schema.EdgeLabel#ROLE_PLAYER} edge.
* <p>
* However, we must still retain the {@link LabelFragmentSet} because it is possible it is selected as a result or
* referred to elsewhere in the query.
*/
static final FragmentSetOptimisation ROLE_OPTIMISATION = (fragmentSets, tx) -> {
Iterable<RolePlayerFragmentSet> rolePlayers =
EquivalentFragmentSets.fragmentSetOfType(RolePlayerFragmentSet.class, fragmentSets)::iterator;
for (RolePlayerFragmentSet rolePlayer : rolePlayers) {
Var roleVar = rolePlayer.role();
if (roleVar == null) continue;
@Nullable LabelFragmentSet roleLabel = EquivalentFragmentSets.labelOf(roleVar, fragmentSets);
if (roleLabel == null) continue;
@Nullable RolePlayerFragmentSet newRolePlayer = null;
if (roleLabel.labels().equals(ImmutableSet.of(Schema.MetaSchema.ROLE.getLabel()))) {
newRolePlayer = rolePlayer.removeRoleVar();
} else {
Set<SchemaConcept> concepts = roleLabel.labels().stream()
.map(tx::<SchemaConcept>getSchemaConcept)
.collect(toSet());
if (concepts.stream().allMatch(schemaConcept -> schemaConcept != null && schemaConcept.isRole())) {
Stream<Role> roles = concepts.stream().map(Concept::asRole);
newRolePlayer = rolePlayer.substituteRoleLabel(roles);
}
}
if (newRolePlayer != null) {
fragmentSets.remove(rolePlayer);
fragmentSets.add(newRolePlayer);
return true;
}
}
return false;
};
/**
* For traversals associated with implicit relations (either via the has keyword or directly using the implicit relation):
*
* - expands the roles and relation types to include relevant hierarchies
* - as we have transaction information here, we additionally filter the non-relevant variant between key- and has- attribute options.
*
*/
static final FragmentSetOptimisation IMPLICIT_RELATION_OPTIMISATION = (fragmentSets, tx) -> {
Iterable<RolePlayerFragmentSet> rolePlayers =
EquivalentFragmentSets.fragmentSetOfType(RolePlayerFragmentSet.class, fragmentSets)::iterator;
for (RolePlayerFragmentSet rolePlayer : rolePlayers) {
@Nullable RolePlayerFragmentSet newRolePlayer = null;
@Nullable ImmutableSet<Label> relLabels = rolePlayer.relationshipTypeLabels();
@Nullable ImmutableSet<Label> roleLabels = rolePlayer.roleLabels();
if(relLabels == null || roleLabels == null) continue;
Set<RelationshipType> relTypes = relLabels.stream()
.map(tx::<SchemaConcept>getSchemaConcept)
.filter(Objects::nonNull)
.filter(Concept::isRelationshipType)
.map(Concept::asRelationshipType)
.collect(toSet());
Set<Role> roles = roleLabels.stream()
.map(tx::<SchemaConcept>getSchemaConcept)
.filter(Objects::nonNull)
.filter(Concept::isRole)
.map(Concept::asRole)
.collect(toSet());
if (Stream.concat(relTypes.stream(), roles.stream()).allMatch(SchemaConcept::isImplicit)) {
newRolePlayer = rolePlayer.substituteLabels(roles, relTypes);
}
if (newRolePlayer != null && !newRolePlayer.equals(rolePlayer)) {
fragmentSets.remove(rolePlayer);
fragmentSets.add(newRolePlayer);
return true;
}
}
return false;
};
/**
* A query can use the {@link RelationshipType} {@link Label}s on a {@link Schema.EdgeLabel#ROLE_PLAYER} edge when the following criteria are met:
* <ol>
* <li>There is a {@link RolePlayerFragmentSet} {@code $r-[role-player:$e ...]->$p}
* without any {@link RelationshipType} {@link Label}s specified
* <li>There is a {@link IsaFragmentSet} {@code $r-[isa]->$R}
* <li>There is a {@link LabelFragmentSet} {@code $R[label:foo,bar]}
* </ol>
*
* When these criteria are met, the {@link RolePlayerFragmentSet} can be filtered to the types
* {@code foo} and {@code bar}.
* <p>
* {@code $r-[role-player:$e rels:foo]->$p}
* <p>
*
* However, we must still retain the {@link LabelFragmentSet} because it is possible it is selected as a result or
* referred to elsewhere in the query.
* <p>
* We also keep the {@link IsaFragmentSet}, although the results will still be correct without it. This is because
* it can help with performance: there are some instances where it makes sense to navigate from the {@link RelationshipType}
* {@code foo} to all instances. In order to do that, the {@link IsaFragmentSet} must be present.
*/
static final FragmentSetOptimisation RELATION_TYPE_OPTIMISATION = (fragmentSets, graph) -> {
Iterable<RolePlayerFragmentSet> rolePlayers =
EquivalentFragmentSets.fragmentSetOfType(RolePlayerFragmentSet.class, fragmentSets)::iterator;
for (RolePlayerFragmentSet rolePlayer : rolePlayers) {
if (rolePlayer.relationshipTypeLabels() != null) continue;
@Nullable IsaFragmentSet isa = EquivalentFragmentSets.typeInformationOf(rolePlayer.relation(), fragmentSets);
if (isa == null) continue;
@Nullable LabelFragmentSet relationLabel = EquivalentFragmentSets.labelOf(isa.type(), fragmentSets);
if (relationLabel == null) continue;
Stream<SchemaConcept> concepts =
relationLabel.labels().stream().map(graph::<SchemaConcept>getSchemaConcept);
if (concepts.allMatch(schemaConcept -> schemaConcept != null && schemaConcept.isRelationshipType())) {
fragmentSets.remove(rolePlayer);
fragmentSets.add(rolePlayer.addRelationshipTypeLabels(relationLabel.labels()));
return true;
}
}
return false;
};
private RolePlayerFragmentSet substituteLabels(Set<Role> roles, Set<RelationshipType> relTypes){
ImmutableSet<Label> newRoleTypeLabels = relTypes != null?
relTypes.stream().flatMap(RelationshipType::subs).map(SchemaConcept::label).collect(toImmutableSet()) :
null;
ImmutableSet<Label> newRoleLabels = roles != null?
roles.stream().flatMap(Role::subs).map(SchemaConcept::label).collect(toImmutableSet()) :
null;
return new AutoValue_RolePlayerFragmentSet(
varProperty(), relation(), edge(), rolePlayer(), null,
newRoleLabels!= null? newRoleLabels : roleLabels(),
newRoleTypeLabels != null? newRoleTypeLabels : relationshipTypeLabels()
);
}
/**
* NB: doesn't allow overwrites
* Apply an optimisation where we check the {@link Role} property instead of navigating to the {@link Role} directly.
* @param roles the role-player must link to any of these (or their sub-types)
* @return a new {@link RolePlayerFragmentSet} with the same properties excepting role-types
*/
private RolePlayerFragmentSet substituteRoleLabel(Stream<Role> roles) {
Preconditions.checkNotNull(this.role());
Preconditions.checkState(roleLabels() == null);
ImmutableSet<Label> newRoleLabels =
roles.flatMap(Role::subs).map(SchemaConcept::label).collect(toImmutableSet());
return new AutoValue_RolePlayerFragmentSet(
varProperty(), relation(), edge(), rolePlayer(), null, newRoleLabels, relationshipTypeLabels()
);
}
/**
* NB: doesn't allow overwrites
* Apply an optimisation where we check the {@link RelationshipType} property.
* @param relTypeLabels the role-player fragment must link to any of these (not including sub-types)
* @return a new {@link RolePlayerFragmentSet} with the same properties excepting relation-type labels
*/
private RolePlayerFragmentSet addRelationshipTypeLabels(ImmutableSet<Label> relTypeLabels) {
Preconditions.checkState(relationshipTypeLabels() == null);
return new AutoValue_RolePlayerFragmentSet(
varProperty(),
relation(), edge(), rolePlayer(), role(), roleLabels(), relTypeLabels
);
}
/**
* Remove any specified role variable
*/
private RolePlayerFragmentSet removeRoleVar() {
Preconditions.checkNotNull(role());
return new AutoValue_RolePlayerFragmentSet(
varProperty(), relation(), edge(), rolePlayer(), null, roleLabels(), relationshipTypeLabels()
);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.