diff --git a/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/DoubleValueVariationClause.java b/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/DoubleValueVariationClause.java new file mode 100644 index 0000000000000000000000000000000000000000..202a66e31f1d71a988fd41994c0aa1b916c87f76 --- /dev/null +++ b/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/DoubleValueVariationClause.java @@ -0,0 +1,67 @@ +/** + * ============================================== + * DQL : Descartes Query Language + * ============================================== + * + * (c) Copyright 2014-2016, by Juergen Walter, Fabian Gorsler, Fabian Brosig and other contributors. + * + * Project Info: http://descartes.tools/dql + * + * All rights reserved. This software is made available under the terms of the + * Eclipse Public License (EPL) v1.0 as published by the Eclipse Foundation + * http://www.eclipse.org/legal/epl-v10.html + * + * This software 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 Eclipse Public License (EPL) + * for more details. + * + * You should have received a copy of the Eclipse Public License (EPL) + * along with this software; if not visit http://www.eclipse.org or write to + * Eclipse Foundation, Inc., 308 SW First Avenue, Suite 110, Portland, 97204 USA + * Email: license (at) eclipse.org + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + */ +package tools.descartes.dql.lang.descartesQL; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Double Value Variation Clause</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link tools.descartes.dql.lang.descartesQL.DoubleValueVariationClause#getValue <em>Value</em>}</li> + * </ul> + * + * @see tools.descartes.dql.lang.descartesQL.DescartesQLPackage#getDoubleValueVariationClause() + * @model + * @generated + */ +public interface DoubleValueVariationClause extends EObject +{ + /** + * Returns the value of the '<em><b>Value</b></em>' attribute list. + * The list contents are of type {@link java.lang.Double}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute list. + * @see tools.descartes.dql.lang.descartesQL.DescartesQLPackage#getDoubleValueVariationClause_Value() + * @model unique="false" + * @generated + */ + EList<Double> getValue(); + +} // DoubleValueVariationClause diff --git a/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/impl/DoubleValueVariationClauseImpl.java b/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/impl/DoubleValueVariationClauseImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e4d23b07eb2bcbb3fcba283ba1fbec89b5e71c02 --- /dev/null +++ b/lang/tools.descartes.dql.lang/src-gen/tools/descartes/dql/lang/descartesQL/impl/DoubleValueVariationClauseImpl.java @@ -0,0 +1,187 @@ +/** + * ============================================== + * DQL : Descartes Query Language + * ============================================== + * + * (c) Copyright 2014-2016, by Juergen Walter, Fabian Gorsler, Fabian Brosig and other contributors. + * + * Project Info: http://descartes.tools/dql + * + * All rights reserved. This software is made available under the terms of the + * Eclipse Public License (EPL) v1.0 as published by the Eclipse Foundation + * http://www.eclipse.org/legal/epl-v10.html + * + * This software 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 Eclipse Public License (EPL) + * for more details. + * + * You should have received a copy of the Eclipse Public License (EPL) + * along with this software; if not visit http://www.eclipse.org or write to + * Eclipse Foundation, Inc., 308 SW First Avenue, Suite 110, Portland, 97204 USA + * Email: license (at) eclipse.org + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + */ +package tools.descartes.dql.lang.descartesQL.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EDataTypeEList; + +import tools.descartes.dql.lang.descartesQL.DescartesQLPackage; +import tools.descartes.dql.lang.descartesQL.DoubleValueVariationClause; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Double Value Variation Clause</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link tools.descartes.dql.lang.descartesQL.impl.DoubleValueVariationClauseImpl#getValue <em>Value</em>}</li> + * </ul> + * + * @generated + */ +public class DoubleValueVariationClauseImpl extends MinimalEObjectImpl.Container implements DoubleValueVariationClause +{ + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected EList<Double> value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected DoubleValueVariationClauseImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return DescartesQLPackage.Literals.DOUBLE_VALUE_VARIATION_CLAUSE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Double> getValue() + { + if (value == null) + { + value = new EDataTypeEList<Double>(Double.class, this, DescartesQLPackage.DOUBLE_VALUE_VARIATION_CLAUSE__VALUE); + } + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case DescartesQLPackage.DOUBLE_VALUE_VARIATION_CLAUSE__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case DescartesQLPackage.DOUBLE_VALUE_VARIATION_CLAUSE__VALUE: + getValue().clear(); + getValue().addAll((Collection<? extends Double>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case DescartesQLPackage.DOUBLE_VALUE_VARIATION_CLAUSE__VALUE: + getValue().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case DescartesQLPackage.DOUBLE_VALUE_VARIATION_CLAUSE__VALUE: + return value != null && !value.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); + result.append(value); + result.append(')'); + return result.toString(); + } + +} //DoubleValueVariationClauseImpl diff --git a/lang/tools.descartes.dql.lang/src/tools/descartes/dql/lang/DescartesQL2.xtext b/lang/tools.descartes.dql.lang/src/tools/descartes/dql/lang/DescartesQL2.xtext new file mode 100644 index 0000000000000000000000000000000000000000..50ad1aa50a1cec5b1a90c24650460a3d91744afd --- /dev/null +++ b/lang/tools.descartes.dql.lang/src/tools/descartes/dql/lang/DescartesQL2.xtext @@ -0,0 +1,413 @@ +grammar tools.descartes.dql.lang.DescartesQL with org.eclipse.xtext.common.Terminals + +generate descartesQL "http://www.descartes.tools/dql/lang/DescartesQL" +import "http://www.eclipse.org/emf/2002/Ecore" as ecore + +// @THESIS +DescartesQL: + query=(ModelStructureQuery | PerformanceMetricsQuery | PerformanceIssueQuery | ConnectorCapabilityQuery | WhatIfQuery + | Goal) + ';'; + +Goal: + queryType=('ENSURE' | 'MONITOR') slaQuery=SlaQuery sloQuery=SloQuery (constraintClause=ConstraintClause)? (dofClause=DoFClause)? (forClause=ForClause)? usingClause=UsingClause; + +SlaQuery: + type='AGREEMENTS' slas+=Sla (',' slas+=Sla)*; + +SloQuery: + type='GOALS' slos+=Slo (',' slos+=Slo)*; + +Sla: + name=ID 'CONTAINS' '(' weightedSlo+=WeightedSlo (',' weightedSlo+=WeightedSlo)* ')'; + +Slo: // CPU,Service,Memory... . Metric . statistic Type + name=ID ':' metricClauseType=MetricClauseType comparator=Comparator value=VariableValue (fuz=Fuzziness)? + (pen=Penalty)?; + +WeightedSlo: + slo=[Slo] ('*' weight=INT)?; + +Fuzziness: + type='FUZZINESS' deviation=VariableValue; + +Penalty: + type='PENALTY' value=DOUBLE currency=Currency (violation=Violation)?; + +Violation: + 'PER' amount=INT 'VIOLATIONS'; + +enum Comparator: + less='<' | lessEqual='<=' | greater='>' | greaterEqual='>=' | equal='=='; + +enum Currency: + euro='EUR' | usDollar='USD'; + + // @THESIS +ModelStructureQuery: + ListQuery; + + // @THESIS +PerformanceMetricsQuery: + SelectQuery; + + // @THESIS +PerformanceIssueQuery: + DetectQuery; + +ConnectorCapabilityQuery: +// TODO: Queries from this class are not yet implemented. The intention of this class is to expose connector-dependent information through the query interface, e.g. for documentation purposes. + GetQuery; + + // @THESIS +ListQuery: + 'LIST' queryType=(ListEntitiesQuery | ListMetricsQuery | ListDoFQuery) + (filterClause=FilterClause)? usingClause=UsingClause; + +GetQuery: + 'GET' queryTape=(GetExplorationStrategiesQuery | GetTimeUnitsQuery | GetConstraintsQuery) usingClause=UsingClause; + +GetConstraintsQuery: + mode="CONSTRAINTS"; + +GetExplorationStrategiesQuery: + mode="EXPLORATION STRATEGIES"; + +GetTimeUnitsQuery: + mode="TIME UNITS"; + + // @THESIS +ListDoFQuery: + mode="DOF" (withClause=WithClause)?; + + // @THESIS +ListEntitiesQuery: + mode='ENTITIES'; + + // @THESIS +ListMetricsQuery: + mode='METRICS' '(' entityReferenceClause=EntityReferenceClause ')'; + + // @THESIS +SelectQuery: + 'SELECT' metricReferenceClauses=MetricReferenceClauses (constraintClause=ConstraintClause)? (dofClause=DoFClause)? + forClause=ForClause usingClause=UsingClause (observeClause=ObserveClause)?; + + // @THESIS +MetricReferenceClauses: + metricClauseTypes+=MetricClauseType (',' metricClauseTypes+=MetricClauseType)*; + + // @THESIS +MetricClauseType: + MetricClause | AggregateMetricClause; + + // @THESIS +DetectQuery: + 'DETECT' queryType=(DetectBottlenecksQuery); + + // @THESIS +DetectBottlenecksQuery: + 'BOTTLENECKS' dofClause=DoFClause usingClause=UsingClause; + + /* + * Clause to specify a constraint on the model solver + */ +// @THESIS +ConstraintClause: + 'CONSTRAINED AS' type=STRING; + + /* + * Clause for expressing DoF + */ +// @THESIS +DoFClause: + mode='EVALUATE DOF' (varyingClause=VaryingClause)? (explorationStrategy=ExplorationStrategyClause)? + (constraintClause=ConstraintClause)? (withClause=WithClause)?; + /* + * Rule to specify an exploration strategy + */ +// @THESIS +ExplorationStrategyClause: + mode='GUIDED BY' name=STRING (parameterClause=ConfigurationPropertiesClause)?; + + // @THESIS +ConfigurationPropertiesClause: + mode1='[' properties+=ConfigurationPropertyClause (',' properties+=ConfigurationPropertyClause)* mode2=']'; + + // @THESIS +ConfigurationPropertyClause: + key+=ID ('.' key+=ID)* '=' value=STRING; + + // @THESIS +DoFVariationClause: + mode1='<' variation=(IntervalVariationClause | ValueVariationClause | DoubleValueVariationClause) mode2='>'; + + // @THESIS +ValueVariationClause: + value+= (INT) (',' value+=INT)*; + +// DOUBLE +DoubleValueVariationClause: + value+= (DOUBLE) (',' value+=DOUBLE)*; + + + // @THESIS +IntervalVariationClause: + start=INT '..' end=INT 'BY' step=INT; + + /* + * Clause to define which DoF to vary + */ +// @THESIS +VaryingClause: + mode='VARYING' dofReferences+=DoFReference (',' dofReferences+=DoFReference)*; + + /* + * Rule to reference DoF model entities + */ +// @THESIS +DoFReference: + doFIdentifier=STRING (doFAliasClause=AliasClause)? (doFVariationClause=(ConfigurationPropertiesClause | + DoFVariationClause))?; + + /* + * Clause to reference multiple metrics + */ +// @THESIS +MetricClause: + metricReference=MetricReference; + + // @THESIS +AggregateMetricClause: + function=StatisticalAggregateType '(' metrics=(MetricStarClause | MetricClauses) ')' + (properties=ConfigurationPropertiesClause)?; + + // @THESIS +MetricClauses: + metrics+=MetricClause (',' metrics+=MetricClause)*; + + // @THESIS +MetricStarClause: + '*.' metricName=ID; + + /* + * Rule for referencing metrics bound to entities + */ +// @THESIS +MetricReference: + entityReference=ID (seperatorn="." navigationClause=NavigationClause)? separator='.' metricReference=ID + (separatorv="." statTypeReference=ID)?; + +NavigationClause: + ParentClause | ChildrenClause | FindClause; + +ChildrenClause: + content='children'; + +ParentClause: + content='parent'; + +FindClause: + start='find(' childName=STRING end=')'; + /* + * Clauses to build entity references in a query + */ +// @THESIS +ForClause: + mode='FOR' entityReferenceClause=EntityReferenceClause; + + // @THESIS +EntityReferenceClause: + entityReferences+=EntityReference (',' entityReferences+=EntityReference)*; + + /* + * Rules for referencing entities + */ +// @THESIS +EntityReference: + (type=ID)? identifier=STRING (alias=AliasClause)?; + + // @THESIS +AliasClause: + mode='AS' alias=ID; + + /* + * Clauses used for referencing model instances + */ +// @THESIS +UsingClause: + mode='USING' modelReference=ModelReferenceClause; + + // @THESIS +WithClause: + mode='WITH' modelReference=ModelReferenceClause; + + /* + * Rules for referencing a model instances + */ +// @THESIS +ModelReferenceClause: + family=ModelFamily '@' model=ModelLocation; + + // @THESIS +ModelFamily: + family=ID; + + // @THESIS +ModelLocation: + location=STRING; + + /* + * Rules for defining filters in ListQuery + */ +FilterClause: + mode='FILTERED BY' + filterConditions+=FilterConditionClause + (filterConjunctions+=FilterConjunction filterConditions+=FilterConditionClause)*; + +enum FilterConjunction: + AND='AND' | XOR='XOR' | OR='OR'; + +FilterConditionClause: + mode='CONDITION' '(' condition=FilterConditionType ',' value=FilterConditionValue ')'; + +FilterConditionValue: + value=STRING; + +enum FilterConditionType: + INSTANCEOF='INSTANCEOF' | CLASSREGEX='CLASSREGEX'; + + // @THESIS +ObserveClause: + mode='OBSERVE' observation=(ObservationClause) + (sampleClause=SampleClause)?; + + // @THESIS +ObservationClause: + ConnectorTimeUnitClause | ConnectorInstanceReferenceClause | ObserveRelativeClause | ObserveBetweenClause; + +/* Connector-dependent aggregation of values */ +// @THESIS +SampleClause: + mode='SAMPLED BY' durationClause+=(RelativeTimeDurationClause) (durationClause+=RelativeTimeDurationClause)*; + +/* Connector-dependent */ +// @THESIS +ConnectorTimeUnitClause: + count=INT timeIndicator=ID; + + // @THESIS +ConnectorInstanceReferenceClause: + type=ID identifier=STRING; + +/* Specialization of BETWEEN */ +// @THESIS +ObserveRelativeClause: + direction=ObserveRelativeDirectionType timeTarget=(AbsoluteTimeClause | RelativeTimeClause); + +/* Time-dependent (defined by DQL) */ +// @THESIS +ObserveBetweenClause: + mode1='BETWEEN' startingTime=(AbsoluteTimeClause | RelativeTimeWithSignClause) + mode2='AND' endingTime=(AbsoluteTimeClause | RelativeTimeWithSignClause); + + // @THESIS +RelativeTimeWithSignClause: + sign=RelativeTimeSignType timeClause=RelativeTimeClause; + +BetweenTimeClause: + AbsoluteTimeClause | RelativeTimeWithSignClause; + +TimeClause: + AbsoluteTimeClause | RelativeTimeClause; + + // @THESIS +AbsoluteTimeClause: + timeSpec=STRING; + + // @THESIS +RelativeTimeClause: + durationClause+=(RelativeTimeDurationClause) + (durationClause+=RelativeTimeDurationClause)*; + + // @THESIS +RelativeTimeDurationClause: + duration=INT timeModifier=TimeModifierType; + + // @THESIS +enum ObserveRelativeDirectionType: + SINCE='SINCE' | NEXT='NEXT'; + + // @THESIS +enum RelativeTimeSignType: + MINUS='-' | PLUS='+'; + + // @THESIS +enum TimeModifierType: + YEAR='y' | MONTH='m' | WEEK='w' | DAY='d' | HOUR='h' | MINUTE='M' | SECOND='s' | MILLISECOND='S'; + + // @THESIS +enum StatisticalAggregateType: + MIN='MIN' | MAX='MAX' | GEOMEAN='GEOMEAN' | N='N' | SUM='SUM' | SUMOFSQUARES='SUMOFSQUARES' | STDDEV='STDDEV' | + VAR='VAR' | PERCENTILE='PERCENTILE' | MEAN='MEAN'; + + /** + * Following lines of code are added during the Bachelor Thesis of Andreas Knapp at the University of Wuerzburg (Germany) to extend DQL with a "What if...?" feature + */ +// @BachelorThesis_AndreasKnapp +WhatIfQuery: + 'WHAT IF' whatIfVariation=WhatIfVariation ('SELECT' + metricReferenceClauses=MetricReferenceClauses forClause=ForClause)? + filteringClause=FilteringClause? deltaClause=DeltaClause? usingClause=UsingClause; + +DeltaClause: + 'DELTA'; + +WhatIfVariation: + whatIfVariationClause+=WhatIfVariationClause (',' whatIfVariationClause+=WhatIfVariationClause)*; + + // Filtering Clause for WhatIfQuery, filtering Values (other filtering then filtering for lists) +FilteringClause: + 'FILTERING' (filteringRule=FilteringRule | filteringStrategy=FilteringStrategy); //Mögliche Erweiterung mit "Filter-Subqueries" + +// Connectorimplemented filtering strategy +FilteringStrategy: + filteringStrategy=STRING; + + // User-defined ignoring for values. If % used, relativ value less then "value" are ignored, else absolut values +FilteringRule: + filteringValue=VariableValue modifier='%'?; + + // changeable values for WhatIfQuery +WhatIfVariationClause: + variationPoint=STRING values=WhatIfValueVariationClause; + + // Values can change like DoFVariationClauses (already exists) or like new ArithmeticClauses +WhatIfValueVariationClause: + '<' variationClause+=(IntervalVariationClause | ValueVariationClause | ArithmeticClause | VariationInstruction) + (',' variationClause+=(IntervalVariationClause | ValueVariationClause | ArithmeticClause | VariationInstruction)+)* + '>' + // DoFVariationClause already existing +; + +MultipleVariationInstruction: + '<' multiVariation+=VariationInstruction (',' multiVariation+=VariationInstruction)* '>'; + +VariationInstruction: + variation=ID ('(' argument=STRING ')'); + + // To enable things like 'var1' <ADD 10, ADD 10> +MultipleArithmeticClause: + '<' multiClause+=ArithmeticClause (',' multiClause+=ArithmeticClause)* '>'; + + // To add Valuechangeing like "MULTIPLY 2" for example double usercount on a server +ArithmeticClause: + mode=('ADD' | 'SUB' | 'MULTIPLY') value=VariableValue; + + // To Enable Integer and Double Values +VariableValue: + intValue=INT | doubleValue=DOUBLE; + +terminal DOUBLE returns ecore::EDouble: + ('0' | (('1'..'9') ('0'..'9')*)) ('.' ('0'..'9')+); +