Class EMFQueryMetaContext
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext
-
- org.eclipse.viatra.query.runtime.emf.EMFQueryMetaContext
-
- All Implemented Interfaces:
IQueryMetaContext
public final class EMFQueryMetaContext extends AbstractQueryMetaContext
The meta context information for EMF scopes.The runtime context may specialize answers with a given scope. In a static context, a conservative default version (
DEFAULT) can be used instead.TODO generics?
-
-
Field Summary
Fields Modifier and Type Field Description static EMFQueryMetaContextDEFAULTDefault static instance that only makes conservative assumptions that are valid for anyEMFScope(but not if objects are used).static EMFQueryMetaContextDEFAULT_SURROGATEDefault static instance that only makes conservative assumptions that are valid for any scope, even with surrogate objects.
-
Constructor Summary
Constructors Constructor Description EMFQueryMetaContext(EMFScope scope)Instantiates a specialized meta information that is aware of scope-specific details.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanLeadOutOfScope(org.eclipse.emf.ecore.EReference reference)Tells whether the given reference may lead out of scope.booleancanLeadOutOfScope(IInputKey key)Tells whether the givenIInputKeyis an edge and may lead out of scope.voidensureValidKey(IInputKey key)org.eclipse.emf.ecore.EReferencefeatureOpposite(org.eclipse.emf.ecore.EStructuralFeature typeObject)org.eclipse.emf.ecore.EClassfeatureSourceType(org.eclipse.emf.ecore.EStructuralFeature feature)org.eclipse.emf.ecore.EClassifierfeatureTargetType(org.eclipse.emf.ecore.EStructuralFeature typeObject)java.util.Map<InputKeyImplication,java.util.Set<InputKeyImplication>>getConditionalImplications(IInputKey implyingKey)Returns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys).java.util.Map<java.util.Set<java.lang.Integer>,java.util.Set<java.lang.Integer>>getFunctionalDependencies(IInputKey key)Returns functional dependencies of the input key expressed in terms of column indices.java.util.Collection<InputKeyImplication>getImplications(IInputKey implyingKey)Returns known direct implications, e.g.EClassTransitiveInstancesKeygetSourceTypeKey(EStructuralFeatureInstancesKey key)java.util.Comparator<IInputKey>getSuggestedEliminationOrdering()For query normalizing, this is the order suggested for trying to eliminate input keys.IInputKeygetTargetTypeKey(EStructuralFeatureInstancesKey key)java.util.Collection<InputKeyImplication>getWeakenedAlternatives(IInputKey implyingKey)Returns a set of implications (weakened alternatives), with a suggestion for the query planner that satisfying them first may help in satisfying the implying key.voidillegalInputKey(IInputKey key)booleanisEnumerable(IInputKey key)Returns true iff instance tuples of the given key can be enumerated.booleanisFeatureMultiplicityOneTo(org.eclipse.emf.ecore.EStructuralFeature typeObject)booleanisFeatureMultiplicityToOne(org.eclipse.emf.ecore.EStructuralFeature feature)static booleanisFeatureOneToMultiplicity(org.eclipse.emf.ecore.EStructuralFeature typeObject)static booleanisFeatureToOneMultiplicity(org.eclipse.emf.ecore.EStructuralFeature feature)booleanisStateless(IInputKey key)Returns true iff the set of instance tuples of the given key is immutable.-
Methods inherited from class org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext
getPosetComparator, isPosetKey
-
-
-
-
Field Detail
-
DEFAULT
public static final EMFQueryMetaContext DEFAULT
Default static instance that only makes conservative assumptions that are valid for anyEMFScope(but not if objects are used).- Since:
- 1.6
-
DEFAULT_SURROGATE
public static final EMFQueryMetaContext DEFAULT_SURROGATE
Default static instance that only makes conservative assumptions that are valid for any scope, even with surrogate objects. Unscoped types are used for inference, but not emitted as replacement candidates, as they cannot be checked at runtime.- Since:
- 2.1
-
-
Constructor Detail
-
EMFQueryMetaContext
public EMFQueryMetaContext(EMFScope scope)
Instantiates a specialized meta information that is aware of scope-specific details.- Since:
- 2.1
-
-
Method Detail
-
isEnumerable
public boolean isEnumerable(IInputKey key)
Description copied from interface:IQueryMetaContextReturns true iff instance tuples of the given key can be enumerated.If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general.
Equivalent to
IInputKey.isEnumerable().
-
canLeadOutOfScope
public boolean canLeadOutOfScope(IInputKey key)
Description copied from interface:IQueryMetaContextTells whether the givenIInputKeyis an edge and may lead out of scope.- Specified by:
canLeadOutOfScopein interfaceIQueryMetaContext- Overrides:
canLeadOutOfScopein classAbstractQueryMetaContext
-
canLeadOutOfScope
public boolean canLeadOutOfScope(org.eclipse.emf.ecore.EReference reference)
Tells whether the given reference may lead out of scope.- Since:
- 2.1
-
isStateless
public boolean isStateless(IInputKey key)
Description copied from interface:IQueryMetaContextReturns true iff the set of instance tuples of the given key is immutable.If false, the runtime provides notifications upon change.
-
getFunctionalDependencies
public java.util.Map<java.util.Set<java.lang.Integer>,java.util.Set<java.lang.Integer>> getFunctionalDependencies(IInputKey key)
Description copied from interface:IQueryMetaContextReturns functional dependencies of the input key expressed in terms of column indices.Each entry of the map is a functional dependency rule, where the entry key specifies source columns and the entry value specifies target columns.
-
getSourceTypeKey
public EClassTransitiveInstancesKey getSourceTypeKey(EStructuralFeatureInstancesKey key)
- Since:
- 2.1
-
getTargetTypeKey
public IInputKey getTargetTypeKey(EStructuralFeatureInstancesKey key)
- Since:
- 2.1
-
getImplications
public java.util.Collection<InputKeyImplication> getImplications(IInputKey implyingKey)
Description copied from interface:IQueryMetaContextReturns known direct implications, e.g. edge supertypes, edge opposites, node type constraints, etc.Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys.
-
getConditionalImplications
public java.util.Map<InputKeyImplication,java.util.Set<InputKeyImplication>> getConditionalImplications(IInputKey implyingKey)
Description copied from interface:IQueryMetaContextReturns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys). For example, a "type x, unscoped" input key may imply the "type x, in scope" input key under the condition of the input key "x is in scope"Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys (either as the implying key or as the additional condition).
Note that symmetry is not required, i.e. the additional conditions do not have to list the same conditional implication.
- Specified by:
getConditionalImplicationsin interfaceIQueryMetaContext- Overrides:
getConditionalImplicationsin classAbstractQueryMetaContext- Returns:
- multi-map, where the keys are additional conditions and the values are input key implications jointly implied by the condition and the given implying key.
-
getWeakenedAlternatives
public java.util.Collection<InputKeyImplication> getWeakenedAlternatives(IInputKey implyingKey)
Description copied from interface:IQueryMetaContextReturns a set of implications (weakened alternatives), with a suggestion for the query planner that satisfying them first may help in satisfying the implying key.Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys.
Must follow directly or transitively from implications of
IQueryMetaContext.getImplications(IInputKey).- Specified by:
getWeakenedAlternativesin interfaceIQueryMetaContext- Overrides:
getWeakenedAlternativesin classAbstractQueryMetaContext
-
ensureValidKey
public void ensureValidKey(IInputKey key)
-
illegalInputKey
public void illegalInputKey(IInputKey key)
-
isFeatureMultiplicityToOne
public boolean isFeatureMultiplicityToOne(org.eclipse.emf.ecore.EStructuralFeature feature)
-
isFeatureMultiplicityOneTo
public boolean isFeatureMultiplicityOneTo(org.eclipse.emf.ecore.EStructuralFeature typeObject)
-
isFeatureToOneMultiplicity
public static boolean isFeatureToOneMultiplicity(org.eclipse.emf.ecore.EStructuralFeature feature)
- Since:
- 2.9
-
isFeatureOneToMultiplicity
public static boolean isFeatureOneToMultiplicity(org.eclipse.emf.ecore.EStructuralFeature typeObject)
- Since:
- 2.9
-
featureSourceType
public org.eclipse.emf.ecore.EClass featureSourceType(org.eclipse.emf.ecore.EStructuralFeature feature)
-
featureTargetType
public org.eclipse.emf.ecore.EClassifier featureTargetType(org.eclipse.emf.ecore.EStructuralFeature typeObject)
-
featureOpposite
public org.eclipse.emf.ecore.EReference featureOpposite(org.eclipse.emf.ecore.EStructuralFeature typeObject)
-
getSuggestedEliminationOrdering
public java.util.Comparator<IInputKey> getSuggestedEliminationOrdering()
Description copied from interface:IQueryMetaContextFor query normalizing, this is the order suggested for trying to eliminate input keys.- Specified by:
getSuggestedEliminationOrderingin interfaceIQueryMetaContext- Overrides:
getSuggestedEliminationOrderingin classAbstractQueryMetaContext
-
-