aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kris7topher@gmail.com>2019-04-15 16:23:19 +0200
committerLibravatar Kristóf Marussy <kris7topher@gmail.com>2019-04-15 16:23:19 +0200
commit2531cfb60d747c261a20201415728beb0e24ab9b (patch)
tree0d7a242c674d735879e8c017bda7212e7ad02df2 /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme
parentMake diversity checking work with optimization (diff)
downloadVIATRA-Generator-2531cfb60d747c261a20201415728beb0e24ab9b.tar.gz
VIATRA-Generator-2531cfb60d747c261a20201415728beb0e24ab9b.tar.zst
VIATRA-Generator-2531cfb60d747c261a20201415728beb0e24ab9b.zip
Satellite constellation case study WIP
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme')
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore16
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java579
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLoop.java557
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java573
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java586
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java582
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java574
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java575
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java548
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java163
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java600
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java576
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java570
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore15
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AtLeastTwoInterferometryPayloads.java138
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java140
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java138
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java140
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java138
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java138
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/DirectCommunicationLink.java162
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/GroundStationNetwork.java127
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectCommunicationLink.java134
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java105
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java127
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithInterferometryPayload.java149
26 files changed, 8150 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore
new file mode 100644
index 00000000..29459700
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/.gitignore
@@ -0,0 +1,16 @@
1/.SatelliteQueries.java._trace
2/.NoLinkToGroundStation.java._trace
3/.CommunicationLoop.java._trace
4/.SingleInterferometryPayload.java._trace
5/.NoInterferometryPayload.java._trace
6/.NotENoughInterferometryPayloads.java._trace
7/.NotEnoughInterferometryPayloads.java._trace
8/.UhfAntennaGainNotLow.java._trace
9/.XAntennaGainNotMedium.java._trace
10/.KaAntennaGainLow.java._trace
11/.IncompatibleSourceAndTarget.java._trace
12/.IncompatibleSourceAndTargetBand.java._trace
13/.IncompatibleSourceAndTargetGain.java._trace
14/.CubeSatWithKaAntenna.java._trace
15/.ThreeUCubeSatWithNonUhfCrossLink.java._trace
16/.CommunicationLinkDoesNotStartAtContainingElement.java._trace
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java
new file mode 100644
index 00000000..dde3c20f
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLinkDoesNotStartAtContainingElement.java
@@ -0,0 +1,579 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * {@literal @}Constraint(severity = "error", key = {Link},
50 * message = "Communication links must start from the containing element.")
51 * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) {
52 * CommunicatingElement.communicationLink(Element, Link);
53 * DirectedCommunicationLink.source(Link, SourceComm);
54 * CommunicatingElement.commSubsystem(SourceElement, SourceComm);
55 * Element != SourceElement;
56 * }
57 * </pre></code>
58 *
59 * @see Matcher
60 * @see Match
61 *
62 */
63@SuppressWarnings("all")
64public final class CommunicationLinkDoesNotStartAtContainingElement extends BaseGeneratedEMFQuerySpecification<CommunicationLinkDoesNotStartAtContainingElement.Matcher> {
65 /**
66 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement pattern,
67 * to be used in conjunction with {@link Matcher}.
68 *
69 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
70 * Each instance is a (possibly partial) substitution of pattern parameters,
71 * usable to represent a match of the pattern in the result of a query,
72 * or to specify the bound (fixed) input parameters when issuing a query.
73 *
74 * @see Matcher
75 *
76 */
77 public static abstract class Match extends BasePatternMatch {
78 private DirectedCommunicationLink fLink;
79
80 private static List<String> parameterNames = makeImmutableList("Link");
81
82 private Match(final DirectedCommunicationLink pLink) {
83 this.fLink = pLink;
84 }
85
86 @Override
87 public Object get(final String parameterName) {
88 if ("Link".equals(parameterName)) return this.fLink;
89 return null;
90 }
91
92 public DirectedCommunicationLink getLink() {
93 return this.fLink;
94 }
95
96 @Override
97 public boolean set(final String parameterName, final Object newValue) {
98 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
99 if ("Link".equals(parameterName) ) {
100 this.fLink = (DirectedCommunicationLink) newValue;
101 return true;
102 }
103 return false;
104 }
105
106 public void setLink(final DirectedCommunicationLink pLink) {
107 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
108 this.fLink = pLink;
109 }
110
111 @Override
112 public String patternName() {
113 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement";
114 }
115
116 @Override
117 public List<String> parameterNames() {
118 return CommunicationLinkDoesNotStartAtContainingElement.Match.parameterNames;
119 }
120
121 @Override
122 public Object[] toArray() {
123 return new Object[]{fLink};
124 }
125
126 @Override
127 public CommunicationLinkDoesNotStartAtContainingElement.Match toImmutable() {
128 return isMutable() ? newMatch(fLink) : this;
129 }
130
131 @Override
132 public String prettyPrint() {
133 StringBuilder result = new StringBuilder();
134 result.append("\"Link\"=" + prettyPrintValue(fLink));
135 return result.toString();
136 }
137
138 @Override
139 public int hashCode() {
140 return Objects.hash(fLink);
141 }
142
143 @Override
144 public boolean equals(final Object obj) {
145 if (this == obj)
146 return true;
147 if (obj == null) {
148 return false;
149 }
150 if ((obj instanceof CommunicationLinkDoesNotStartAtContainingElement.Match)) {
151 CommunicationLinkDoesNotStartAtContainingElement.Match other = (CommunicationLinkDoesNotStartAtContainingElement.Match) obj;
152 return Objects.equals(fLink, other.fLink);
153 } else {
154 // this should be infrequent
155 if (!(obj instanceof IPatternMatch)) {
156 return false;
157 }
158 IPatternMatch otherSig = (IPatternMatch) obj;
159 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
160 }
161 }
162
163 @Override
164 public CommunicationLinkDoesNotStartAtContainingElement specification() {
165 return CommunicationLinkDoesNotStartAtContainingElement.instance();
166 }
167
168 /**
169 * Returns an empty, mutable match.
170 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
171 *
172 * @return the empty match.
173 *
174 */
175 public static CommunicationLinkDoesNotStartAtContainingElement.Match newEmptyMatch() {
176 return new Mutable(null);
177 }
178
179 /**
180 * Returns a mutable (partial) match.
181 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
182 *
183 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
184 * @return the new, mutable (partial) match object.
185 *
186 */
187 public static CommunicationLinkDoesNotStartAtContainingElement.Match newMutableMatch(final DirectedCommunicationLink pLink) {
188 return new Mutable(pLink);
189 }
190
191 /**
192 * Returns a new (partial) match.
193 * This can be used e.g. to call the matcher with a partial match.
194 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
195 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
196 * @return the (partial) match object.
197 *
198 */
199 public static CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) {
200 return new Immutable(pLink);
201 }
202
203 private static final class Mutable extends CommunicationLinkDoesNotStartAtContainingElement.Match {
204 Mutable(final DirectedCommunicationLink pLink) {
205 super(pLink);
206 }
207
208 @Override
209 public boolean isMutable() {
210 return true;
211 }
212 }
213
214 private static final class Immutable extends CommunicationLinkDoesNotStartAtContainingElement.Match {
215 Immutable(final DirectedCommunicationLink pLink) {
216 super(pLink);
217 }
218
219 @Override
220 public boolean isMutable() {
221 return false;
222 }
223 }
224 }
225
226 /**
227 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement pattern,
228 * providing pattern-specific query methods.
229 *
230 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
231 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
232 *
233 * <p>Matches of the pattern will be represented as {@link Match}.
234 *
235 * <p>Original source:
236 * <code><pre>
237 * {@literal @}Constraint(severity = "error", key = {Link},
238 * message = "Communication links must start from the containing element.")
239 * pattern communicationLinkDoesNotStartAtContainingElement(Link : DirectedCommunicationLink) {
240 * CommunicatingElement.communicationLink(Element, Link);
241 * DirectedCommunicationLink.source(Link, SourceComm);
242 * CommunicatingElement.commSubsystem(SourceElement, SourceComm);
243 * Element != SourceElement;
244 * }
245 * </pre></code>
246 *
247 * @see Match
248 * @see CommunicationLinkDoesNotStartAtContainingElement
249 *
250 */
251 public static class Matcher extends BaseMatcher<CommunicationLinkDoesNotStartAtContainingElement.Match> {
252 /**
253 * Initializes the pattern matcher within an existing VIATRA Query engine.
254 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
255 *
256 * @param engine the existing VIATRA Query engine in which this matcher will be created.
257 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
258 *
259 */
260 public static CommunicationLinkDoesNotStartAtContainingElement.Matcher on(final ViatraQueryEngine engine) {
261 // check if matcher already exists
262 Matcher matcher = engine.getExistingMatcher(querySpecification());
263 if (matcher == null) {
264 matcher = (Matcher)engine.getMatcher(querySpecification());
265 }
266 return matcher;
267 }
268
269 /**
270 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
271 * @return an initialized matcher
272 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
273 *
274 */
275 public static CommunicationLinkDoesNotStartAtContainingElement.Matcher create() {
276 return new Matcher();
277 }
278
279 private static final int POSITION_LINK = 0;
280
281 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CommunicationLinkDoesNotStartAtContainingElement.Matcher.class);
282
283 /**
284 * Initializes the pattern matcher within an existing VIATRA Query engine.
285 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
286 *
287 * @param engine the existing VIATRA Query engine in which this matcher will be created.
288 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
289 *
290 */
291 private Matcher() {
292 super(querySpecification());
293 }
294
295 /**
296 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
297 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
298 * @return matches represented as a Match object.
299 *
300 */
301 public Collection<CommunicationLinkDoesNotStartAtContainingElement.Match> getAllMatches(final DirectedCommunicationLink pLink) {
302 return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet());
303 }
304
305 /**
306 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
307 * </p>
308 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
309 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
310 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
311 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
312 * @return a stream of matches represented as a Match object.
313 *
314 */
315 public Stream<CommunicationLinkDoesNotStartAtContainingElement.Match> streamAllMatches(final DirectedCommunicationLink pLink) {
316 return rawStreamAllMatches(new Object[]{pLink});
317 }
318
319 /**
320 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
321 * Neither determinism nor randomness of selection is guaranteed.
322 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
323 * @return a match represented as a Match object, or null if no match is found.
324 *
325 */
326 public Optional<CommunicationLinkDoesNotStartAtContainingElement.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) {
327 return rawGetOneArbitraryMatch(new Object[]{pLink});
328 }
329
330 /**
331 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
332 * under any possible substitution of the unspecified parameters (if any).
333 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
334 * @return true if the input is a valid (partial) match of the pattern.
335 *
336 */
337 public boolean hasMatch(final DirectedCommunicationLink pLink) {
338 return rawHasMatch(new Object[]{pLink});
339 }
340
341 /**
342 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
343 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
344 * @return the number of pattern matches found.
345 *
346 */
347 public int countMatches(final DirectedCommunicationLink pLink) {
348 return rawCountMatches(new Object[]{pLink});
349 }
350
351 /**
352 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
353 * Neither determinism nor randomness of selection is guaranteed.
354 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
355 * @param processor the action that will process the selected match.
356 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
357 *
358 */
359 public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super CommunicationLinkDoesNotStartAtContainingElement.Match> processor) {
360 return rawForOneArbitraryMatch(new Object[]{pLink}, processor);
361 }
362
363 /**
364 * Returns a new (partial) match.
365 * This can be used e.g. to call the matcher with a partial match.
366 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
367 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
368 * @return the (partial) match object.
369 *
370 */
371 public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final DirectedCommunicationLink pLink) {
372 return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch(pLink);
373 }
374
375 /**
376 * Retrieve the set of values that occur in matches for Link.
377 * @return the Set of all values or empty set if there are no matches
378 *
379 */
380 protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) {
381 return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast);
382 }
383
384 /**
385 * Retrieve the set of values that occur in matches for Link.
386 * @return the Set of all values or empty set if there are no matches
387 *
388 */
389 public Set<DirectedCommunicationLink> getAllValuesOfLink() {
390 return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet());
391 }
392
393 /**
394 * Retrieve the set of values that occur in matches for Link.
395 * @return the Set of all values or empty set if there are no matches
396 *
397 */
398 public Stream<DirectedCommunicationLink> streamAllValuesOfLink() {
399 return rawStreamAllValuesOfLink(emptyArray());
400 }
401
402 @Override
403 protected CommunicationLinkDoesNotStartAtContainingElement.Match tupleToMatch(final Tuple t) {
404 try {
405 return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK));
406 } catch(ClassCastException e) {
407 LOGGER.error("Element(s) in tuple not properly typed!",e);
408 return null;
409 }
410 }
411
412 @Override
413 protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatch(final Object[] match) {
414 try {
415 return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]);
416 } catch(ClassCastException e) {
417 LOGGER.error("Element(s) in array not properly typed!",e);
418 return null;
419 }
420 }
421
422 @Override
423 protected CommunicationLinkDoesNotStartAtContainingElement.Match arrayToMatchMutable(final Object[] match) {
424 try {
425 return CommunicationLinkDoesNotStartAtContainingElement.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]);
426 } catch(ClassCastException e) {
427 LOGGER.error("Element(s) in array not properly typed!",e);
428 return null;
429 }
430 }
431
432 /**
433 * @return the singleton instance of the query specification of this pattern
434 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
435 *
436 */
437 public static IQuerySpecification<CommunicationLinkDoesNotStartAtContainingElement.Matcher> querySpecification() {
438 return CommunicationLinkDoesNotStartAtContainingElement.instance();
439 }
440 }
441
442 private CommunicationLinkDoesNotStartAtContainingElement() {
443 super(GeneratedPQuery.INSTANCE);
444 }
445
446 /**
447 * @return the singleton instance of the query specification
448 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
449 *
450 */
451 public static CommunicationLinkDoesNotStartAtContainingElement instance() {
452 try{
453 return LazyHolder.INSTANCE;
454 } catch (ExceptionInInitializerError err) {
455 throw processInitializerError(err);
456 }
457 }
458
459 @Override
460 protected CommunicationLinkDoesNotStartAtContainingElement.Matcher instantiate(final ViatraQueryEngine engine) {
461 return CommunicationLinkDoesNotStartAtContainingElement.Matcher.on(engine);
462 }
463
464 @Override
465 public CommunicationLinkDoesNotStartAtContainingElement.Matcher instantiate() {
466 return CommunicationLinkDoesNotStartAtContainingElement.Matcher.create();
467 }
468
469 @Override
470 public CommunicationLinkDoesNotStartAtContainingElement.Match newEmptyMatch() {
471 return CommunicationLinkDoesNotStartAtContainingElement.Match.newEmptyMatch();
472 }
473
474 @Override
475 public CommunicationLinkDoesNotStartAtContainingElement.Match newMatch(final Object... parameters) {
476 return CommunicationLinkDoesNotStartAtContainingElement.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink) parameters[0]);
477 }
478
479 /**
480 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement (visibility: PUBLIC, simpleName: CommunicationLinkDoesNotStartAtContainingElement, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
481 * <b>not</b> at the class load time of the outer class,
482 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement (visibility: PUBLIC, simpleName: CommunicationLinkDoesNotStartAtContainingElement, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
483 *
484 * <p> This workaround is required e.g. to support recursion.
485 *
486 */
487 private static class LazyHolder {
488 private static final CommunicationLinkDoesNotStartAtContainingElement INSTANCE = new CommunicationLinkDoesNotStartAtContainingElement();
489
490 /**
491 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
492 * This initialization order is required to support indirect recursion.
493 *
494 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
495 *
496 */
497 private static final Object STATIC_INITIALIZER = ensureInitialized();
498
499 public static Object ensureInitialized() {
500 INSTANCE.ensureInitializedInternal();
501 return null;
502 }
503 }
504
505 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
506 private static final CommunicationLinkDoesNotStartAtContainingElement.GeneratedPQuery INSTANCE = new GeneratedPQuery();
507
508 private final PParameter parameter_Link = new PParameter("Link", "hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT);
509
510 private final List<PParameter> parameters = Arrays.asList(parameter_Link);
511
512 private GeneratedPQuery() {
513 super(PVisibility.PUBLIC);
514 }
515
516 @Override
517 public String getFullyQualifiedName() {
518 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLinkDoesNotStartAtContainingElement";
519 }
520
521 @Override
522 public List<String> getParameterNames() {
523 return Arrays.asList("Link");
524 }
525
526 @Override
527 public List<PParameter> getParameters() {
528 return parameters;
529 }
530
531 @Override
532 public Set<PBody> doGetContainedBodies() {
533 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
534 Set<PBody> bodies = new LinkedHashSet<>();
535 {
536 PBody body = new PBody(this);
537 PVariable var_Link = body.getOrCreateVariableByName("Link");
538 PVariable var_Element = body.getOrCreateVariableByName("Element");
539 PVariable var_SourceComm = body.getOrCreateVariableByName("SourceComm");
540 PVariable var_SourceElement = body.getOrCreateVariableByName("SourceElement");
541 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
542 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
543 new ExportedParameter(body, var_Link, parameter_Link)
544 ));
545 // CommunicatingElement.communicationLink(Element, Link)
546 new TypeConstraint(body, Tuples.flatTupleOf(var_Element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
547 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
548 new TypeConstraint(body, Tuples.flatTupleOf(var_Element, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "communicationLink")));
549 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
550 new Equality(body, var__virtual_0_, var_Link);
551 // DirectedCommunicationLink.source(Link, SourceComm)
552 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
553 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
554 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source")));
555 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
556 new Equality(body, var__virtual_1_, var_SourceComm);
557 // CommunicatingElement.commSubsystem(SourceElement, SourceComm)
558 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceElement), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
559 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
560 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceElement, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
561 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
562 new Equality(body, var__virtual_2_, var_SourceComm);
563 // Element != SourceElement
564 new Inequality(body, var_Element, var_SourceElement);
565 bodies.add(body);
566 }
567 {
568 PAnnotation annotation = new PAnnotation("Constraint");
569 annotation.addAttribute("severity", "error");
570 annotation.addAttribute("key", Arrays.asList(new Object[] {
571 new ParameterReference("Link")
572 }));
573 annotation.addAttribute("message", "Communication links must start from the containing element.");
574 addAnnotation(annotation);
575 }
576 return bodies;
577 }
578 }
579}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLoop.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLoop.java
new file mode 100644
index 00000000..f5835baf
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CommunicationLoop.java
@@ -0,0 +1,557 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * // No communication loops may exist
49 * // No spacecraft may directly communicate with itself
50 *
51 * {@literal @}Constraint(severity = "error", key = {Element},
52 * message = "Communication loop.")
53 * pattern communicationLoop(Element : CommunicatingElement) {
54 * find indirectCommunicationLink(Element, Element);
55 * }
56 * </pre></code>
57 *
58 * @see Matcher
59 * @see Match
60 *
61 */
62@SuppressWarnings("all")
63public final class CommunicationLoop extends BaseGeneratedEMFQuerySpecification<CommunicationLoop.Matcher> {
64 /**
65 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop pattern,
66 * to be used in conjunction with {@link Matcher}.
67 *
68 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
69 * Each instance is a (possibly partial) substitution of pattern parameters,
70 * usable to represent a match of the pattern in the result of a query,
71 * or to specify the bound (fixed) input parameters when issuing a query.
72 *
73 * @see Matcher
74 *
75 */
76 public static abstract class Match extends BasePatternMatch {
77 private CommunicatingElement fElement;
78
79 private static List<String> parameterNames = makeImmutableList("Element");
80
81 private Match(final CommunicatingElement pElement) {
82 this.fElement = pElement;
83 }
84
85 @Override
86 public Object get(final String parameterName) {
87 if ("Element".equals(parameterName)) return this.fElement;
88 return null;
89 }
90
91 public CommunicatingElement getElement() {
92 return this.fElement;
93 }
94
95 @Override
96 public boolean set(final String parameterName, final Object newValue) {
97 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
98 if ("Element".equals(parameterName) ) {
99 this.fElement = (CommunicatingElement) newValue;
100 return true;
101 }
102 return false;
103 }
104
105 public void setElement(final CommunicatingElement pElement) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 this.fElement = pElement;
108 }
109
110 @Override
111 public String patternName() {
112 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop";
113 }
114
115 @Override
116 public List<String> parameterNames() {
117 return CommunicationLoop.Match.parameterNames;
118 }
119
120 @Override
121 public Object[] toArray() {
122 return new Object[]{fElement};
123 }
124
125 @Override
126 public CommunicationLoop.Match toImmutable() {
127 return isMutable() ? newMatch(fElement) : this;
128 }
129
130 @Override
131 public String prettyPrint() {
132 StringBuilder result = new StringBuilder();
133 result.append("\"Element\"=" + prettyPrintValue(fElement));
134 return result.toString();
135 }
136
137 @Override
138 public int hashCode() {
139 return Objects.hash(fElement);
140 }
141
142 @Override
143 public boolean equals(final Object obj) {
144 if (this == obj)
145 return true;
146 if (obj == null) {
147 return false;
148 }
149 if ((obj instanceof CommunicationLoop.Match)) {
150 CommunicationLoop.Match other = (CommunicationLoop.Match) obj;
151 return Objects.equals(fElement, other.fElement);
152 } else {
153 // this should be infrequent
154 if (!(obj instanceof IPatternMatch)) {
155 return false;
156 }
157 IPatternMatch otherSig = (IPatternMatch) obj;
158 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
159 }
160 }
161
162 @Override
163 public CommunicationLoop specification() {
164 return CommunicationLoop.instance();
165 }
166
167 /**
168 * Returns an empty, mutable match.
169 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
170 *
171 * @return the empty match.
172 *
173 */
174 public static CommunicationLoop.Match newEmptyMatch() {
175 return new Mutable(null);
176 }
177
178 /**
179 * Returns a mutable (partial) match.
180 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
181 *
182 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
183 * @return the new, mutable (partial) match object.
184 *
185 */
186 public static CommunicationLoop.Match newMutableMatch(final CommunicatingElement pElement) {
187 return new Mutable(pElement);
188 }
189
190 /**
191 * Returns a new (partial) match.
192 * This can be used e.g. to call the matcher with a partial match.
193 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
194 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
195 * @return the (partial) match object.
196 *
197 */
198 public static CommunicationLoop.Match newMatch(final CommunicatingElement pElement) {
199 return new Immutable(pElement);
200 }
201
202 private static final class Mutable extends CommunicationLoop.Match {
203 Mutable(final CommunicatingElement pElement) {
204 super(pElement);
205 }
206
207 @Override
208 public boolean isMutable() {
209 return true;
210 }
211 }
212
213 private static final class Immutable extends CommunicationLoop.Match {
214 Immutable(final CommunicatingElement pElement) {
215 super(pElement);
216 }
217
218 @Override
219 public boolean isMutable() {
220 return false;
221 }
222 }
223 }
224
225 /**
226 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop pattern,
227 * providing pattern-specific query methods.
228 *
229 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
230 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
231 *
232 * <p>Matches of the pattern will be represented as {@link Match}.
233 *
234 * <p>Original source:
235 * <code><pre>
236 * // No communication loops may exist
237 * // No spacecraft may directly communicate with itself
238 *
239 * {@literal @}Constraint(severity = "error", key = {Element},
240 * message = "Communication loop.")
241 * pattern communicationLoop(Element : CommunicatingElement) {
242 * find indirectCommunicationLink(Element, Element);
243 * }
244 * </pre></code>
245 *
246 * @see Match
247 * @see CommunicationLoop
248 *
249 */
250 public static class Matcher extends BaseMatcher<CommunicationLoop.Match> {
251 /**
252 * Initializes the pattern matcher within an existing VIATRA Query engine.
253 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
254 *
255 * @param engine the existing VIATRA Query engine in which this matcher will be created.
256 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
257 *
258 */
259 public static CommunicationLoop.Matcher on(final ViatraQueryEngine engine) {
260 // check if matcher already exists
261 Matcher matcher = engine.getExistingMatcher(querySpecification());
262 if (matcher == null) {
263 matcher = (Matcher)engine.getMatcher(querySpecification());
264 }
265 return matcher;
266 }
267
268 /**
269 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
270 * @return an initialized matcher
271 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
272 *
273 */
274 public static CommunicationLoop.Matcher create() {
275 return new Matcher();
276 }
277
278 private static final int POSITION_ELEMENT = 0;
279
280 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CommunicationLoop.Matcher.class);
281
282 /**
283 * Initializes the pattern matcher within an existing VIATRA Query engine.
284 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
285 *
286 * @param engine the existing VIATRA Query engine in which this matcher will be created.
287 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
288 *
289 */
290 private Matcher() {
291 super(querySpecification());
292 }
293
294 /**
295 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
296 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
297 * @return matches represented as a Match object.
298 *
299 */
300 public Collection<CommunicationLoop.Match> getAllMatches(final CommunicatingElement pElement) {
301 return rawStreamAllMatches(new Object[]{pElement}).collect(Collectors.toSet());
302 }
303
304 /**
305 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
306 * </p>
307 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
308 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
309 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
310 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
311 * @return a stream of matches represented as a Match object.
312 *
313 */
314 public Stream<CommunicationLoop.Match> streamAllMatches(final CommunicatingElement pElement) {
315 return rawStreamAllMatches(new Object[]{pElement});
316 }
317
318 /**
319 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
320 * Neither determinism nor randomness of selection is guaranteed.
321 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
322 * @return a match represented as a Match object, or null if no match is found.
323 *
324 */
325 public Optional<CommunicationLoop.Match> getOneArbitraryMatch(final CommunicatingElement pElement) {
326 return rawGetOneArbitraryMatch(new Object[]{pElement});
327 }
328
329 /**
330 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
331 * under any possible substitution of the unspecified parameters (if any).
332 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
333 * @return true if the input is a valid (partial) match of the pattern.
334 *
335 */
336 public boolean hasMatch(final CommunicatingElement pElement) {
337 return rawHasMatch(new Object[]{pElement});
338 }
339
340 /**
341 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
342 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
343 * @return the number of pattern matches found.
344 *
345 */
346 public int countMatches(final CommunicatingElement pElement) {
347 return rawCountMatches(new Object[]{pElement});
348 }
349
350 /**
351 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
354 * @param processor the action that will process the selected match.
355 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
356 *
357 */
358 public boolean forOneArbitraryMatch(final CommunicatingElement pElement, final Consumer<? super CommunicationLoop.Match> processor) {
359 return rawForOneArbitraryMatch(new Object[]{pElement}, processor);
360 }
361
362 /**
363 * Returns a new (partial) match.
364 * This can be used e.g. to call the matcher with a partial match.
365 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
366 * @param pElement the fixed value of pattern parameter Element, or null if not bound.
367 * @return the (partial) match object.
368 *
369 */
370 public CommunicationLoop.Match newMatch(final CommunicatingElement pElement) {
371 return CommunicationLoop.Match.newMatch(pElement);
372 }
373
374 /**
375 * Retrieve the set of values that occur in matches for Element.
376 * @return the Set of all values or empty set if there are no matches
377 *
378 */
379 protected Stream<CommunicatingElement> rawStreamAllValuesOfElement(final Object[] parameters) {
380 return rawStreamAllValues(POSITION_ELEMENT, parameters).map(CommunicatingElement.class::cast);
381 }
382
383 /**
384 * Retrieve the set of values that occur in matches for Element.
385 * @return the Set of all values or empty set if there are no matches
386 *
387 */
388 public Set<CommunicatingElement> getAllValuesOfElement() {
389 return rawStreamAllValuesOfElement(emptyArray()).collect(Collectors.toSet());
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for Element.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 public Stream<CommunicatingElement> streamAllValuesOfElement() {
398 return rawStreamAllValuesOfElement(emptyArray());
399 }
400
401 @Override
402 protected CommunicationLoop.Match tupleToMatch(final Tuple t) {
403 try {
404 return CommunicationLoop.Match.newMatch((CommunicatingElement) t.get(POSITION_ELEMENT));
405 } catch(ClassCastException e) {
406 LOGGER.error("Element(s) in tuple not properly typed!",e);
407 return null;
408 }
409 }
410
411 @Override
412 protected CommunicationLoop.Match arrayToMatch(final Object[] match) {
413 try {
414 return CommunicationLoop.Match.newMatch((CommunicatingElement) match[POSITION_ELEMENT]);
415 } catch(ClassCastException e) {
416 LOGGER.error("Element(s) in array not properly typed!",e);
417 return null;
418 }
419 }
420
421 @Override
422 protected CommunicationLoop.Match arrayToMatchMutable(final Object[] match) {
423 try {
424 return CommunicationLoop.Match.newMutableMatch((CommunicatingElement) match[POSITION_ELEMENT]);
425 } catch(ClassCastException e) {
426 LOGGER.error("Element(s) in array not properly typed!",e);
427 return null;
428 }
429 }
430
431 /**
432 * @return the singleton instance of the query specification of this pattern
433 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
434 *
435 */
436 public static IQuerySpecification<CommunicationLoop.Matcher> querySpecification() {
437 return CommunicationLoop.instance();
438 }
439 }
440
441 private CommunicationLoop() {
442 super(GeneratedPQuery.INSTANCE);
443 }
444
445 /**
446 * @return the singleton instance of the query specification
447 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
448 *
449 */
450 public static CommunicationLoop instance() {
451 try{
452 return LazyHolder.INSTANCE;
453 } catch (ExceptionInInitializerError err) {
454 throw processInitializerError(err);
455 }
456 }
457
458 @Override
459 protected CommunicationLoop.Matcher instantiate(final ViatraQueryEngine engine) {
460 return CommunicationLoop.Matcher.on(engine);
461 }
462
463 @Override
464 public CommunicationLoop.Matcher instantiate() {
465 return CommunicationLoop.Matcher.create();
466 }
467
468 @Override
469 public CommunicationLoop.Match newEmptyMatch() {
470 return CommunicationLoop.Match.newEmptyMatch();
471 }
472
473 @Override
474 public CommunicationLoop.Match newMatch(final Object... parameters) {
475 return CommunicationLoop.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement) parameters[0]);
476 }
477
478 /**
479 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop (visibility: PUBLIC, simpleName: CommunicationLoop, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
480 * <b>not</b> at the class load time of the outer class,
481 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop (visibility: PUBLIC, simpleName: CommunicationLoop, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
482 *
483 * <p> This workaround is required e.g. to support recursion.
484 *
485 */
486 private static class LazyHolder {
487 private static final CommunicationLoop INSTANCE = new CommunicationLoop();
488
489 /**
490 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
491 * This initialization order is required to support indirect recursion.
492 *
493 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
494 *
495 */
496 private static final Object STATIC_INITIALIZER = ensureInitialized();
497
498 public static Object ensureInitialized() {
499 INSTANCE.ensureInitializedInternal();
500 return null;
501 }
502 }
503
504 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
505 private static final CommunicationLoop.GeneratedPQuery INSTANCE = new GeneratedPQuery();
506
507 private final PParameter parameter_Element = new PParameter("Element", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT);
508
509 private final List<PParameter> parameters = Arrays.asList(parameter_Element);
510
511 private GeneratedPQuery() {
512 super(PVisibility.PUBLIC);
513 }
514
515 @Override
516 public String getFullyQualifiedName() {
517 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.communicationLoop";
518 }
519
520 @Override
521 public List<String> getParameterNames() {
522 return Arrays.asList("Element");
523 }
524
525 @Override
526 public List<PParameter> getParameters() {
527 return parameters;
528 }
529
530 @Override
531 public Set<PBody> doGetContainedBodies() {
532 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
533 Set<PBody> bodies = new LinkedHashSet<>();
534 {
535 PBody body = new PBody(this);
536 PVariable var_Element = body.getOrCreateVariableByName("Element");
537 new TypeConstraint(body, Tuples.flatTupleOf(var_Element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
538 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
539 new ExportedParameter(body, var_Element, parameter_Element)
540 ));
541 // find indirectCommunicationLink(Element, Element)
542 new PositivePatternCall(body, Tuples.flatTupleOf(var_Element, var_Element), IndirectCommunicationLink.instance().getInternalQueryRepresentation());
543 bodies.add(body);
544 }
545 {
546 PAnnotation annotation = new PAnnotation("Constraint");
547 annotation.addAttribute("severity", "error");
548 annotation.addAttribute("key", Arrays.asList(new Object[] {
549 new ParameterReference("Element")
550 }));
551 annotation.addAttribute("message", "Communication loop.");
552 addAnnotation(annotation);
553 }
554 return bodies;
555 }
556 }
557}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java
new file mode 100644
index 00000000..c15563ff
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/CubeSatWithKaAntenna.java
@@ -0,0 +1,573 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.emf.ecore.EDataType;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
30import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47
48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 *
51 * <p>Original source:
52 * <code><pre>
53 * // Only a Small Satellite can be configured with a Ka-band communication system
54 *
55 * {@literal @}Constraint(severity = "error", key = {Spacecraft},
56 * message = "Only a Small Satellite can be configured with a Ka-band communication system.")
57 * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) {
58 * CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka);
59 * neg find smallSat(Spacecraft);
60 * }
61 * </pre></code>
62 *
63 * @see Matcher
64 * @see Match
65 *
66 */
67@SuppressWarnings("all")
68public final class CubeSatWithKaAntenna extends BaseGeneratedEMFQuerySpecification<CubeSatWithKaAntenna.Matcher> {
69 /**
70 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna pattern,
71 * to be used in conjunction with {@link Matcher}.
72 *
73 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
74 * Each instance is a (possibly partial) substitution of pattern parameters,
75 * usable to represent a match of the pattern in the result of a query,
76 * or to specify the bound (fixed) input parameters when issuing a query.
77 *
78 * @see Matcher
79 *
80 */
81 public static abstract class Match extends BasePatternMatch {
82 private Spacecraft fSpacecraft;
83
84 private static List<String> parameterNames = makeImmutableList("Spacecraft");
85
86 private Match(final Spacecraft pSpacecraft) {
87 this.fSpacecraft = pSpacecraft;
88 }
89
90 @Override
91 public Object get(final String parameterName) {
92 if ("Spacecraft".equals(parameterName)) return this.fSpacecraft;
93 return null;
94 }
95
96 public Spacecraft getSpacecraft() {
97 return this.fSpacecraft;
98 }
99
100 @Override
101 public boolean set(final String parameterName, final Object newValue) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 if ("Spacecraft".equals(parameterName) ) {
104 this.fSpacecraft = (Spacecraft) newValue;
105 return true;
106 }
107 return false;
108 }
109
110 public void setSpacecraft(final Spacecraft pSpacecraft) {
111 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
112 this.fSpacecraft = pSpacecraft;
113 }
114
115 @Override
116 public String patternName() {
117 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna";
118 }
119
120 @Override
121 public List<String> parameterNames() {
122 return CubeSatWithKaAntenna.Match.parameterNames;
123 }
124
125 @Override
126 public Object[] toArray() {
127 return new Object[]{fSpacecraft};
128 }
129
130 @Override
131 public CubeSatWithKaAntenna.Match toImmutable() {
132 return isMutable() ? newMatch(fSpacecraft) : this;
133 }
134
135 @Override
136 public String prettyPrint() {
137 StringBuilder result = new StringBuilder();
138 result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft));
139 return result.toString();
140 }
141
142 @Override
143 public int hashCode() {
144 return Objects.hash(fSpacecraft);
145 }
146
147 @Override
148 public boolean equals(final Object obj) {
149 if (this == obj)
150 return true;
151 if (obj == null) {
152 return false;
153 }
154 if ((obj instanceof CubeSatWithKaAntenna.Match)) {
155 CubeSatWithKaAntenna.Match other = (CubeSatWithKaAntenna.Match) obj;
156 return Objects.equals(fSpacecraft, other.fSpacecraft);
157 } else {
158 // this should be infrequent
159 if (!(obj instanceof IPatternMatch)) {
160 return false;
161 }
162 IPatternMatch otherSig = (IPatternMatch) obj;
163 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
164 }
165 }
166
167 @Override
168 public CubeSatWithKaAntenna specification() {
169 return CubeSatWithKaAntenna.instance();
170 }
171
172 /**
173 * Returns an empty, mutable match.
174 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
175 *
176 * @return the empty match.
177 *
178 */
179 public static CubeSatWithKaAntenna.Match newEmptyMatch() {
180 return new Mutable(null);
181 }
182
183 /**
184 * Returns a mutable (partial) match.
185 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
186 *
187 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
188 * @return the new, mutable (partial) match object.
189 *
190 */
191 public static CubeSatWithKaAntenna.Match newMutableMatch(final Spacecraft pSpacecraft) {
192 return new Mutable(pSpacecraft);
193 }
194
195 /**
196 * Returns a new (partial) match.
197 * This can be used e.g. to call the matcher with a partial match.
198 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
199 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
200 * @return the (partial) match object.
201 *
202 */
203 public static CubeSatWithKaAntenna.Match newMatch(final Spacecraft pSpacecraft) {
204 return new Immutable(pSpacecraft);
205 }
206
207 private static final class Mutable extends CubeSatWithKaAntenna.Match {
208 Mutable(final Spacecraft pSpacecraft) {
209 super(pSpacecraft);
210 }
211
212 @Override
213 public boolean isMutable() {
214 return true;
215 }
216 }
217
218 private static final class Immutable extends CubeSatWithKaAntenna.Match {
219 Immutable(final Spacecraft pSpacecraft) {
220 super(pSpacecraft);
221 }
222
223 @Override
224 public boolean isMutable() {
225 return false;
226 }
227 }
228 }
229
230 /**
231 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna pattern,
232 * providing pattern-specific query methods.
233 *
234 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
235 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
236 *
237 * <p>Matches of the pattern will be represented as {@link Match}.
238 *
239 * <p>Original source:
240 * <code><pre>
241 * // Only a Small Satellite can be configured with a Ka-band communication system
242 *
243 * {@literal @}Constraint(severity = "error", key = {Spacecraft},
244 * message = "Only a Small Satellite can be configured with a Ka-band communication system.")
245 * pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) {
246 * CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka);
247 * neg find smallSat(Spacecraft);
248 * }
249 * </pre></code>
250 *
251 * @see Match
252 * @see CubeSatWithKaAntenna
253 *
254 */
255 public static class Matcher extends BaseMatcher<CubeSatWithKaAntenna.Match> {
256 /**
257 * Initializes the pattern matcher within an existing VIATRA Query engine.
258 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
259 *
260 * @param engine the existing VIATRA Query engine in which this matcher will be created.
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 *
263 */
264 public static CubeSatWithKaAntenna.Matcher on(final ViatraQueryEngine engine) {
265 // check if matcher already exists
266 Matcher matcher = engine.getExistingMatcher(querySpecification());
267 if (matcher == null) {
268 matcher = (Matcher)engine.getMatcher(querySpecification());
269 }
270 return matcher;
271 }
272
273 /**
274 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
275 * @return an initialized matcher
276 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
277 *
278 */
279 public static CubeSatWithKaAntenna.Matcher create() {
280 return new Matcher();
281 }
282
283 private static final int POSITION_SPACECRAFT = 0;
284
285 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CubeSatWithKaAntenna.Matcher.class);
286
287 /**
288 * Initializes the pattern matcher within an existing VIATRA Query engine.
289 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
290 *
291 * @param engine the existing VIATRA Query engine in which this matcher will be created.
292 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
293 *
294 */
295 private Matcher() {
296 super(querySpecification());
297 }
298
299 /**
300 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
301 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
302 * @return matches represented as a Match object.
303 *
304 */
305 public Collection<CubeSatWithKaAntenna.Match> getAllMatches(final Spacecraft pSpacecraft) {
306 return rawStreamAllMatches(new Object[]{pSpacecraft}).collect(Collectors.toSet());
307 }
308
309 /**
310 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
311 * </p>
312 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
313 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
314 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
315 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
316 * @return a stream of matches represented as a Match object.
317 *
318 */
319 public Stream<CubeSatWithKaAntenna.Match> streamAllMatches(final Spacecraft pSpacecraft) {
320 return rawStreamAllMatches(new Object[]{pSpacecraft});
321 }
322
323 /**
324 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
325 * Neither determinism nor randomness of selection is guaranteed.
326 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
327 * @return a match represented as a Match object, or null if no match is found.
328 *
329 */
330 public Optional<CubeSatWithKaAntenna.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft) {
331 return rawGetOneArbitraryMatch(new Object[]{pSpacecraft});
332 }
333
334 /**
335 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
336 * under any possible substitution of the unspecified parameters (if any).
337 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
338 * @return true if the input is a valid (partial) match of the pattern.
339 *
340 */
341 public boolean hasMatch(final Spacecraft pSpacecraft) {
342 return rawHasMatch(new Object[]{pSpacecraft});
343 }
344
345 /**
346 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
347 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
348 * @return the number of pattern matches found.
349 *
350 */
351 public int countMatches(final Spacecraft pSpacecraft) {
352 return rawCountMatches(new Object[]{pSpacecraft});
353 }
354
355 /**
356 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
357 * Neither determinism nor randomness of selection is guaranteed.
358 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
359 * @param processor the action that will process the selected match.
360 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
361 *
362 */
363 public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final Consumer<? super CubeSatWithKaAntenna.Match> processor) {
364 return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, processor);
365 }
366
367 /**
368 * Returns a new (partial) match.
369 * This can be used e.g. to call the matcher with a partial match.
370 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
371 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
372 * @return the (partial) match object.
373 *
374 */
375 public CubeSatWithKaAntenna.Match newMatch(final Spacecraft pSpacecraft) {
376 return CubeSatWithKaAntenna.Match.newMatch(pSpacecraft);
377 }
378
379 /**
380 * Retrieve the set of values that occur in matches for Spacecraft.
381 * @return the Set of all values or empty set if there are no matches
382 *
383 */
384 protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) {
385 return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast);
386 }
387
388 /**
389 * Retrieve the set of values that occur in matches for Spacecraft.
390 * @return the Set of all values or empty set if there are no matches
391 *
392 */
393 public Set<Spacecraft> getAllValuesOfSpacecraft() {
394 return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet());
395 }
396
397 /**
398 * Retrieve the set of values that occur in matches for Spacecraft.
399 * @return the Set of all values or empty set if there are no matches
400 *
401 */
402 public Stream<Spacecraft> streamAllValuesOfSpacecraft() {
403 return rawStreamAllValuesOfSpacecraft(emptyArray());
404 }
405
406 @Override
407 protected CubeSatWithKaAntenna.Match tupleToMatch(final Tuple t) {
408 try {
409 return CubeSatWithKaAntenna.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT));
410 } catch(ClassCastException e) {
411 LOGGER.error("Element(s) in tuple not properly typed!",e);
412 return null;
413 }
414 }
415
416 @Override
417 protected CubeSatWithKaAntenna.Match arrayToMatch(final Object[] match) {
418 try {
419 return CubeSatWithKaAntenna.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]);
420 } catch(ClassCastException e) {
421 LOGGER.error("Element(s) in array not properly typed!",e);
422 return null;
423 }
424 }
425
426 @Override
427 protected CubeSatWithKaAntenna.Match arrayToMatchMutable(final Object[] match) {
428 try {
429 return CubeSatWithKaAntenna.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]);
430 } catch(ClassCastException e) {
431 LOGGER.error("Element(s) in array not properly typed!",e);
432 return null;
433 }
434 }
435
436 /**
437 * @return the singleton instance of the query specification of this pattern
438 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
439 *
440 */
441 public static IQuerySpecification<CubeSatWithKaAntenna.Matcher> querySpecification() {
442 return CubeSatWithKaAntenna.instance();
443 }
444 }
445
446 private CubeSatWithKaAntenna() {
447 super(GeneratedPQuery.INSTANCE);
448 }
449
450 /**
451 * @return the singleton instance of the query specification
452 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
453 *
454 */
455 public static CubeSatWithKaAntenna instance() {
456 try{
457 return LazyHolder.INSTANCE;
458 } catch (ExceptionInInitializerError err) {
459 throw processInitializerError(err);
460 }
461 }
462
463 @Override
464 protected CubeSatWithKaAntenna.Matcher instantiate(final ViatraQueryEngine engine) {
465 return CubeSatWithKaAntenna.Matcher.on(engine);
466 }
467
468 @Override
469 public CubeSatWithKaAntenna.Matcher instantiate() {
470 return CubeSatWithKaAntenna.Matcher.create();
471 }
472
473 @Override
474 public CubeSatWithKaAntenna.Match newEmptyMatch() {
475 return CubeSatWithKaAntenna.Match.newEmptyMatch();
476 }
477
478 @Override
479 public CubeSatWithKaAntenna.Match newMatch(final Object... parameters) {
480 return CubeSatWithKaAntenna.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]);
481 }
482
483 /**
484 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna (visibility: PUBLIC, simpleName: CubeSatWithKaAntenna, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
485 * <b>not</b> at the class load time of the outer class,
486 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna (visibility: PUBLIC, simpleName: CubeSatWithKaAntenna, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
487 *
488 * <p> This workaround is required e.g. to support recursion.
489 *
490 */
491 private static class LazyHolder {
492 private static final CubeSatWithKaAntenna INSTANCE = new CubeSatWithKaAntenna();
493
494 /**
495 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
496 * This initialization order is required to support indirect recursion.
497 *
498 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
499 *
500 */
501 private static final Object STATIC_INITIALIZER = ensureInitialized();
502
503 public static Object ensureInitialized() {
504 INSTANCE.ensureInitializedInternal();
505 return null;
506 }
507 }
508
509 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
510 private static final CubeSatWithKaAntenna.GeneratedPQuery INSTANCE = new GeneratedPQuery();
511
512 private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT);
513
514 private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft);
515
516 private GeneratedPQuery() {
517 super(PVisibility.PUBLIC);
518 }
519
520 @Override
521 public String getFullyQualifiedName() {
522 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.cubeSatWithKaAntenna";
523 }
524
525 @Override
526 public List<String> getParameterNames() {
527 return Arrays.asList("Spacecraft");
528 }
529
530 @Override
531 public List<PParameter> getParameters() {
532 return parameters;
533 }
534
535 @Override
536 public Set<PBody> doGetContainedBodies() {
537 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
538 Set<PBody> bodies = new LinkedHashSet<>();
539 {
540 PBody body = new PBody(this);
541 PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft");
542 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
543 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
544 new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft)
545 ));
546 // CommunicatingElement.commSubsystem.band(Spacecraft, TransceiverBand::Ka)
547 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
548 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance());
549 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
550 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
551 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
552 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
553 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
554 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
555 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
556 new Equality(body, var__virtual_2_, var__virtual_0_);
557 // neg find smallSat(Spacecraft)
558 new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft), SmallSat.instance().getInternalQueryRepresentation());
559 bodies.add(body);
560 }
561 {
562 PAnnotation annotation = new PAnnotation("Constraint");
563 annotation.addAttribute("severity", "error");
564 annotation.addAttribute("key", Arrays.asList(new Object[] {
565 new ParameterReference("Spacecraft")
566 }));
567 annotation.addAttribute("message", "Only a Small Satellite can be configured with a Ka-band communication system.");
568 addAnnotation(annotation);
569 }
570 return bodies;
571 }
572 }
573}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java
new file mode 100644
index 00000000..4cacc34b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetBand.java
@@ -0,0 +1,586 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.emf.ecore.EDataType;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
30import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
45import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
46
47/**
48 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
49 *
50 * <p>Original source:
51 * <code><pre>
52 * // Source and target communication systems must be compatible.
53 *
54 * {@literal @}Constraint(severity = "error", key = {Link},
55 * message = "Two ends of a communication link must use the same band.")
56 * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) {
57 * DirectedCommunicationLink.source(Link, SourceSubsystem);
58 * DirectedCommunicationLink.target(Link, TargetSubsystem);
59 * CommSubsystem.band(SourceSubsystem, Band);
60 * neg find commSubsystemBand(TargetSubsystem, Band);
61 * }
62 * </pre></code>
63 *
64 * @see Matcher
65 * @see Match
66 *
67 */
68@SuppressWarnings("all")
69public final class IncompatibleSourceAndTargetBand extends BaseGeneratedEMFQuerySpecification<IncompatibleSourceAndTargetBand.Matcher> {
70 /**
71 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand pattern,
72 * to be used in conjunction with {@link Matcher}.
73 *
74 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
75 * Each instance is a (possibly partial) substitution of pattern parameters,
76 * usable to represent a match of the pattern in the result of a query,
77 * or to specify the bound (fixed) input parameters when issuing a query.
78 *
79 * @see Matcher
80 *
81 */
82 public static abstract class Match extends BasePatternMatch {
83 private DirectedCommunicationLink fLink;
84
85 private static List<String> parameterNames = makeImmutableList("Link");
86
87 private Match(final DirectedCommunicationLink pLink) {
88 this.fLink = pLink;
89 }
90
91 @Override
92 public Object get(final String parameterName) {
93 if ("Link".equals(parameterName)) return this.fLink;
94 return null;
95 }
96
97 public DirectedCommunicationLink getLink() {
98 return this.fLink;
99 }
100
101 @Override
102 public boolean set(final String parameterName, final Object newValue) {
103 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
104 if ("Link".equals(parameterName) ) {
105 this.fLink = (DirectedCommunicationLink) newValue;
106 return true;
107 }
108 return false;
109 }
110
111 public void setLink(final DirectedCommunicationLink pLink) {
112 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
113 this.fLink = pLink;
114 }
115
116 @Override
117 public String patternName() {
118 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand";
119 }
120
121 @Override
122 public List<String> parameterNames() {
123 return IncompatibleSourceAndTargetBand.Match.parameterNames;
124 }
125
126 @Override
127 public Object[] toArray() {
128 return new Object[]{fLink};
129 }
130
131 @Override
132 public IncompatibleSourceAndTargetBand.Match toImmutable() {
133 return isMutable() ? newMatch(fLink) : this;
134 }
135
136 @Override
137 public String prettyPrint() {
138 StringBuilder result = new StringBuilder();
139 result.append("\"Link\"=" + prettyPrintValue(fLink));
140 return result.toString();
141 }
142
143 @Override
144 public int hashCode() {
145 return Objects.hash(fLink);
146 }
147
148 @Override
149 public boolean equals(final Object obj) {
150 if (this == obj)
151 return true;
152 if (obj == null) {
153 return false;
154 }
155 if ((obj instanceof IncompatibleSourceAndTargetBand.Match)) {
156 IncompatibleSourceAndTargetBand.Match other = (IncompatibleSourceAndTargetBand.Match) obj;
157 return Objects.equals(fLink, other.fLink);
158 } else {
159 // this should be infrequent
160 if (!(obj instanceof IPatternMatch)) {
161 return false;
162 }
163 IPatternMatch otherSig = (IPatternMatch) obj;
164 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
165 }
166 }
167
168 @Override
169 public IncompatibleSourceAndTargetBand specification() {
170 return IncompatibleSourceAndTargetBand.instance();
171 }
172
173 /**
174 * Returns an empty, mutable match.
175 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
176 *
177 * @return the empty match.
178 *
179 */
180 public static IncompatibleSourceAndTargetBand.Match newEmptyMatch() {
181 return new Mutable(null);
182 }
183
184 /**
185 * Returns a mutable (partial) match.
186 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
187 *
188 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
189 * @return the new, mutable (partial) match object.
190 *
191 */
192 public static IncompatibleSourceAndTargetBand.Match newMutableMatch(final DirectedCommunicationLink pLink) {
193 return new Mutable(pLink);
194 }
195
196 /**
197 * Returns a new (partial) match.
198 * This can be used e.g. to call the matcher with a partial match.
199 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
200 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
201 * @return the (partial) match object.
202 *
203 */
204 public static IncompatibleSourceAndTargetBand.Match newMatch(final DirectedCommunicationLink pLink) {
205 return new Immutable(pLink);
206 }
207
208 private static final class Mutable extends IncompatibleSourceAndTargetBand.Match {
209 Mutable(final DirectedCommunicationLink pLink) {
210 super(pLink);
211 }
212
213 @Override
214 public boolean isMutable() {
215 return true;
216 }
217 }
218
219 private static final class Immutable extends IncompatibleSourceAndTargetBand.Match {
220 Immutable(final DirectedCommunicationLink pLink) {
221 super(pLink);
222 }
223
224 @Override
225 public boolean isMutable() {
226 return false;
227 }
228 }
229 }
230
231 /**
232 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand pattern,
233 * providing pattern-specific query methods.
234 *
235 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
236 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
237 *
238 * <p>Matches of the pattern will be represented as {@link Match}.
239 *
240 * <p>Original source:
241 * <code><pre>
242 * // Source and target communication systems must be compatible.
243 *
244 * {@literal @}Constraint(severity = "error", key = {Link},
245 * message = "Two ends of a communication link must use the same band.")
246 * pattern incompatibleSourceAndTargetBand(Link : DirectedCommunicationLink) {
247 * DirectedCommunicationLink.source(Link, SourceSubsystem);
248 * DirectedCommunicationLink.target(Link, TargetSubsystem);
249 * CommSubsystem.band(SourceSubsystem, Band);
250 * neg find commSubsystemBand(TargetSubsystem, Band);
251 * }
252 * </pre></code>
253 *
254 * @see Match
255 * @see IncompatibleSourceAndTargetBand
256 *
257 */
258 public static class Matcher extends BaseMatcher<IncompatibleSourceAndTargetBand.Match> {
259 /**
260 * Initializes the pattern matcher within an existing VIATRA Query engine.
261 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
262 *
263 * @param engine the existing VIATRA Query engine in which this matcher will be created.
264 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
265 *
266 */
267 public static IncompatibleSourceAndTargetBand.Matcher on(final ViatraQueryEngine engine) {
268 // check if matcher already exists
269 Matcher matcher = engine.getExistingMatcher(querySpecification());
270 if (matcher == null) {
271 matcher = (Matcher)engine.getMatcher(querySpecification());
272 }
273 return matcher;
274 }
275
276 /**
277 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
278 * @return an initialized matcher
279 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
280 *
281 */
282 public static IncompatibleSourceAndTargetBand.Matcher create() {
283 return new Matcher();
284 }
285
286 private static final int POSITION_LINK = 0;
287
288 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncompatibleSourceAndTargetBand.Matcher.class);
289
290 /**
291 * Initializes the pattern matcher within an existing VIATRA Query engine.
292 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
293 *
294 * @param engine the existing VIATRA Query engine in which this matcher will be created.
295 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
296 *
297 */
298 private Matcher() {
299 super(querySpecification());
300 }
301
302 /**
303 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
304 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
305 * @return matches represented as a Match object.
306 *
307 */
308 public Collection<IncompatibleSourceAndTargetBand.Match> getAllMatches(final DirectedCommunicationLink pLink) {
309 return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet());
310 }
311
312 /**
313 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
314 * </p>
315 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
316 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
317 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
318 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
319 * @return a stream of matches represented as a Match object.
320 *
321 */
322 public Stream<IncompatibleSourceAndTargetBand.Match> streamAllMatches(final DirectedCommunicationLink pLink) {
323 return rawStreamAllMatches(new Object[]{pLink});
324 }
325
326 /**
327 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
328 * Neither determinism nor randomness of selection is guaranteed.
329 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
330 * @return a match represented as a Match object, or null if no match is found.
331 *
332 */
333 public Optional<IncompatibleSourceAndTargetBand.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) {
334 return rawGetOneArbitraryMatch(new Object[]{pLink});
335 }
336
337 /**
338 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
339 * under any possible substitution of the unspecified parameters (if any).
340 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
341 * @return true if the input is a valid (partial) match of the pattern.
342 *
343 */
344 public boolean hasMatch(final DirectedCommunicationLink pLink) {
345 return rawHasMatch(new Object[]{pLink});
346 }
347
348 /**
349 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
350 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
351 * @return the number of pattern matches found.
352 *
353 */
354 public int countMatches(final DirectedCommunicationLink pLink) {
355 return rawCountMatches(new Object[]{pLink});
356 }
357
358 /**
359 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
360 * Neither determinism nor randomness of selection is guaranteed.
361 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
362 * @param processor the action that will process the selected match.
363 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
364 *
365 */
366 public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super IncompatibleSourceAndTargetBand.Match> processor) {
367 return rawForOneArbitraryMatch(new Object[]{pLink}, processor);
368 }
369
370 /**
371 * Returns a new (partial) match.
372 * This can be used e.g. to call the matcher with a partial match.
373 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
374 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
375 * @return the (partial) match object.
376 *
377 */
378 public IncompatibleSourceAndTargetBand.Match newMatch(final DirectedCommunicationLink pLink) {
379 return IncompatibleSourceAndTargetBand.Match.newMatch(pLink);
380 }
381
382 /**
383 * Retrieve the set of values that occur in matches for Link.
384 * @return the Set of all values or empty set if there are no matches
385 *
386 */
387 protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) {
388 return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast);
389 }
390
391 /**
392 * Retrieve the set of values that occur in matches for Link.
393 * @return the Set of all values or empty set if there are no matches
394 *
395 */
396 public Set<DirectedCommunicationLink> getAllValuesOfLink() {
397 return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet());
398 }
399
400 /**
401 * Retrieve the set of values that occur in matches for Link.
402 * @return the Set of all values or empty set if there are no matches
403 *
404 */
405 public Stream<DirectedCommunicationLink> streamAllValuesOfLink() {
406 return rawStreamAllValuesOfLink(emptyArray());
407 }
408
409 @Override
410 protected IncompatibleSourceAndTargetBand.Match tupleToMatch(final Tuple t) {
411 try {
412 return IncompatibleSourceAndTargetBand.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK));
413 } catch(ClassCastException e) {
414 LOGGER.error("Element(s) in tuple not properly typed!",e);
415 return null;
416 }
417 }
418
419 @Override
420 protected IncompatibleSourceAndTargetBand.Match arrayToMatch(final Object[] match) {
421 try {
422 return IncompatibleSourceAndTargetBand.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]);
423 } catch(ClassCastException e) {
424 LOGGER.error("Element(s) in array not properly typed!",e);
425 return null;
426 }
427 }
428
429 @Override
430 protected IncompatibleSourceAndTargetBand.Match arrayToMatchMutable(final Object[] match) {
431 try {
432 return IncompatibleSourceAndTargetBand.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]);
433 } catch(ClassCastException e) {
434 LOGGER.error("Element(s) in array not properly typed!",e);
435 return null;
436 }
437 }
438
439 /**
440 * @return the singleton instance of the query specification of this pattern
441 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
442 *
443 */
444 public static IQuerySpecification<IncompatibleSourceAndTargetBand.Matcher> querySpecification() {
445 return IncompatibleSourceAndTargetBand.instance();
446 }
447 }
448
449 private IncompatibleSourceAndTargetBand() {
450 super(GeneratedPQuery.INSTANCE);
451 }
452
453 /**
454 * @return the singleton instance of the query specification
455 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
456 *
457 */
458 public static IncompatibleSourceAndTargetBand instance() {
459 try{
460 return LazyHolder.INSTANCE;
461 } catch (ExceptionInInitializerError err) {
462 throw processInitializerError(err);
463 }
464 }
465
466 @Override
467 protected IncompatibleSourceAndTargetBand.Matcher instantiate(final ViatraQueryEngine engine) {
468 return IncompatibleSourceAndTargetBand.Matcher.on(engine);
469 }
470
471 @Override
472 public IncompatibleSourceAndTargetBand.Matcher instantiate() {
473 return IncompatibleSourceAndTargetBand.Matcher.create();
474 }
475
476 @Override
477 public IncompatibleSourceAndTargetBand.Match newEmptyMatch() {
478 return IncompatibleSourceAndTargetBand.Match.newEmptyMatch();
479 }
480
481 @Override
482 public IncompatibleSourceAndTargetBand.Match newMatch(final Object... parameters) {
483 return IncompatibleSourceAndTargetBand.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink) parameters[0]);
484 }
485
486 /**
487 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
488 * <b>not</b> at the class load time of the outer class,
489 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
490 *
491 * <p> This workaround is required e.g. to support recursion.
492 *
493 */
494 private static class LazyHolder {
495 private static final IncompatibleSourceAndTargetBand INSTANCE = new IncompatibleSourceAndTargetBand();
496
497 /**
498 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
499 * This initialization order is required to support indirect recursion.
500 *
501 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
502 *
503 */
504 private static final Object STATIC_INITIALIZER = ensureInitialized();
505
506 public static Object ensureInitialized() {
507 INSTANCE.ensureInitializedInternal();
508 return null;
509 }
510 }
511
512 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
513 private static final IncompatibleSourceAndTargetBand.GeneratedPQuery INSTANCE = new GeneratedPQuery();
514
515 private final PParameter parameter_Link = new PParameter("Link", "hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT);
516
517 private final List<PParameter> parameters = Arrays.asList(parameter_Link);
518
519 private GeneratedPQuery() {
520 super(PVisibility.PUBLIC);
521 }
522
523 @Override
524 public String getFullyQualifiedName() {
525 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetBand";
526 }
527
528 @Override
529 public List<String> getParameterNames() {
530 return Arrays.asList("Link");
531 }
532
533 @Override
534 public List<PParameter> getParameters() {
535 return parameters;
536 }
537
538 @Override
539 public Set<PBody> doGetContainedBodies() {
540 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
541 Set<PBody> bodies = new LinkedHashSet<>();
542 {
543 PBody body = new PBody(this);
544 PVariable var_Link = body.getOrCreateVariableByName("Link");
545 PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem");
546 PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem");
547 PVariable var_Band = body.getOrCreateVariableByName("Band");
548 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
549 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
550 new ExportedParameter(body, var_Link, parameter_Link)
551 ));
552 // DirectedCommunicationLink.source(Link, SourceSubsystem)
553 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
554 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
555 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source")));
556 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
557 new Equality(body, var__virtual_0_, var_SourceSubsystem);
558 // DirectedCommunicationLink.target(Link, TargetSubsystem)
559 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
560 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
561 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target")));
562 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
563 new Equality(body, var__virtual_1_, var_TargetSubsystem);
564 // CommSubsystem.band(SourceSubsystem, Band)
565 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
566 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
567 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
568 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
569 new Equality(body, var__virtual_2_, var_Band);
570 // neg find commSubsystemBand(TargetSubsystem, Band)
571 new NegativePatternCall(body, Tuples.flatTupleOf(var_TargetSubsystem, var_Band), CommSubsystemBand.instance().getInternalQueryRepresentation());
572 bodies.add(body);
573 }
574 {
575 PAnnotation annotation = new PAnnotation("Constraint");
576 annotation.addAttribute("severity", "error");
577 annotation.addAttribute("key", Arrays.asList(new Object[] {
578 new ParameterReference("Link")
579 }));
580 annotation.addAttribute("message", "Two ends of a communication link must use the same band.");
581 addAnnotation(annotation);
582 }
583 return bodies;
584 }
585 }
586}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java
new file mode 100644
index 00000000..3f247613
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/IncompatibleSourceAndTargetGain.java
@@ -0,0 +1,582 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.emf.ecore.EDataType;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
30import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
45import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
46
47/**
48 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
49 *
50 * <p>Original source:
51 * <code><pre>
52 * {@literal @}Constraint(severity = "error", key = {Link},
53 * message = "Two ends of a communication link must use the same antenna gain.")
54 * pattern incompatibleSourceAndTargetGain(Link : DirectedCommunicationLink) {
55 * DirectedCommunicationLink.source(Link, SourceSubsystem);
56 * DirectedCommunicationLink.target(Link, TargetSubsystem);
57 * CommSubsystem.gain(SourceSubsystem, Gain);
58 * neg find commSubsystemGain(TargetSubsystem, Gain);
59 * }
60 * </pre></code>
61 *
62 * @see Matcher
63 * @see Match
64 *
65 */
66@SuppressWarnings("all")
67public final class IncompatibleSourceAndTargetGain extends BaseGeneratedEMFQuerySpecification<IncompatibleSourceAndTargetGain.Matcher> {
68 /**
69 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain pattern,
70 * to be used in conjunction with {@link Matcher}.
71 *
72 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
73 * Each instance is a (possibly partial) substitution of pattern parameters,
74 * usable to represent a match of the pattern in the result of a query,
75 * or to specify the bound (fixed) input parameters when issuing a query.
76 *
77 * @see Matcher
78 *
79 */
80 public static abstract class Match extends BasePatternMatch {
81 private DirectedCommunicationLink fLink;
82
83 private static List<String> parameterNames = makeImmutableList("Link");
84
85 private Match(final DirectedCommunicationLink pLink) {
86 this.fLink = pLink;
87 }
88
89 @Override
90 public Object get(final String parameterName) {
91 if ("Link".equals(parameterName)) return this.fLink;
92 return null;
93 }
94
95 public DirectedCommunicationLink getLink() {
96 return this.fLink;
97 }
98
99 @Override
100 public boolean set(final String parameterName, final Object newValue) {
101 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
102 if ("Link".equals(parameterName) ) {
103 this.fLink = (DirectedCommunicationLink) newValue;
104 return true;
105 }
106 return false;
107 }
108
109 public void setLink(final DirectedCommunicationLink pLink) {
110 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
111 this.fLink = pLink;
112 }
113
114 @Override
115 public String patternName() {
116 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain";
117 }
118
119 @Override
120 public List<String> parameterNames() {
121 return IncompatibleSourceAndTargetGain.Match.parameterNames;
122 }
123
124 @Override
125 public Object[] toArray() {
126 return new Object[]{fLink};
127 }
128
129 @Override
130 public IncompatibleSourceAndTargetGain.Match toImmutable() {
131 return isMutable() ? newMatch(fLink) : this;
132 }
133
134 @Override
135 public String prettyPrint() {
136 StringBuilder result = new StringBuilder();
137 result.append("\"Link\"=" + prettyPrintValue(fLink));
138 return result.toString();
139 }
140
141 @Override
142 public int hashCode() {
143 return Objects.hash(fLink);
144 }
145
146 @Override
147 public boolean equals(final Object obj) {
148 if (this == obj)
149 return true;
150 if (obj == null) {
151 return false;
152 }
153 if ((obj instanceof IncompatibleSourceAndTargetGain.Match)) {
154 IncompatibleSourceAndTargetGain.Match other = (IncompatibleSourceAndTargetGain.Match) obj;
155 return Objects.equals(fLink, other.fLink);
156 } else {
157 // this should be infrequent
158 if (!(obj instanceof IPatternMatch)) {
159 return false;
160 }
161 IPatternMatch otherSig = (IPatternMatch) obj;
162 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
163 }
164 }
165
166 @Override
167 public IncompatibleSourceAndTargetGain specification() {
168 return IncompatibleSourceAndTargetGain.instance();
169 }
170
171 /**
172 * Returns an empty, mutable match.
173 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
174 *
175 * @return the empty match.
176 *
177 */
178 public static IncompatibleSourceAndTargetGain.Match newEmptyMatch() {
179 return new Mutable(null);
180 }
181
182 /**
183 * Returns a mutable (partial) match.
184 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
185 *
186 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
187 * @return the new, mutable (partial) match object.
188 *
189 */
190 public static IncompatibleSourceAndTargetGain.Match newMutableMatch(final DirectedCommunicationLink pLink) {
191 return new Mutable(pLink);
192 }
193
194 /**
195 * Returns a new (partial) match.
196 * This can be used e.g. to call the matcher with a partial match.
197 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
198 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
199 * @return the (partial) match object.
200 *
201 */
202 public static IncompatibleSourceAndTargetGain.Match newMatch(final DirectedCommunicationLink pLink) {
203 return new Immutable(pLink);
204 }
205
206 private static final class Mutable extends IncompatibleSourceAndTargetGain.Match {
207 Mutable(final DirectedCommunicationLink pLink) {
208 super(pLink);
209 }
210
211 @Override
212 public boolean isMutable() {
213 return true;
214 }
215 }
216
217 private static final class Immutable extends IncompatibleSourceAndTargetGain.Match {
218 Immutable(final DirectedCommunicationLink pLink) {
219 super(pLink);
220 }
221
222 @Override
223 public boolean isMutable() {
224 return false;
225 }
226 }
227 }
228
229 /**
230 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain pattern,
231 * providing pattern-specific query methods.
232 *
233 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
234 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
235 *
236 * <p>Matches of the pattern will be represented as {@link Match}.
237 *
238 * <p>Original source:
239 * <code><pre>
240 * {@literal @}Constraint(severity = "error", key = {Link},
241 * message = "Two ends of a communication link must use the same antenna gain.")
242 * pattern incompatibleSourceAndTargetGain(Link : DirectedCommunicationLink) {
243 * DirectedCommunicationLink.source(Link, SourceSubsystem);
244 * DirectedCommunicationLink.target(Link, TargetSubsystem);
245 * CommSubsystem.gain(SourceSubsystem, Gain);
246 * neg find commSubsystemGain(TargetSubsystem, Gain);
247 * }
248 * </pre></code>
249 *
250 * @see Match
251 * @see IncompatibleSourceAndTargetGain
252 *
253 */
254 public static class Matcher extends BaseMatcher<IncompatibleSourceAndTargetGain.Match> {
255 /**
256 * Initializes the pattern matcher within an existing VIATRA Query engine.
257 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
258 *
259 * @param engine the existing VIATRA Query engine in which this matcher will be created.
260 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
261 *
262 */
263 public static IncompatibleSourceAndTargetGain.Matcher on(final ViatraQueryEngine engine) {
264 // check if matcher already exists
265 Matcher matcher = engine.getExistingMatcher(querySpecification());
266 if (matcher == null) {
267 matcher = (Matcher)engine.getMatcher(querySpecification());
268 }
269 return matcher;
270 }
271
272 /**
273 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
274 * @return an initialized matcher
275 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
276 *
277 */
278 public static IncompatibleSourceAndTargetGain.Matcher create() {
279 return new Matcher();
280 }
281
282 private static final int POSITION_LINK = 0;
283
284 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncompatibleSourceAndTargetGain.Matcher.class);
285
286 /**
287 * Initializes the pattern matcher within an existing VIATRA Query engine.
288 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
289 *
290 * @param engine the existing VIATRA Query engine in which this matcher will be created.
291 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
292 *
293 */
294 private Matcher() {
295 super(querySpecification());
296 }
297
298 /**
299 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
300 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
301 * @return matches represented as a Match object.
302 *
303 */
304 public Collection<IncompatibleSourceAndTargetGain.Match> getAllMatches(final DirectedCommunicationLink pLink) {
305 return rawStreamAllMatches(new Object[]{pLink}).collect(Collectors.toSet());
306 }
307
308 /**
309 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
310 * </p>
311 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
312 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
313 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
314 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
315 * @return a stream of matches represented as a Match object.
316 *
317 */
318 public Stream<IncompatibleSourceAndTargetGain.Match> streamAllMatches(final DirectedCommunicationLink pLink) {
319 return rawStreamAllMatches(new Object[]{pLink});
320 }
321
322 /**
323 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
324 * Neither determinism nor randomness of selection is guaranteed.
325 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
326 * @return a match represented as a Match object, or null if no match is found.
327 *
328 */
329 public Optional<IncompatibleSourceAndTargetGain.Match> getOneArbitraryMatch(final DirectedCommunicationLink pLink) {
330 return rawGetOneArbitraryMatch(new Object[]{pLink});
331 }
332
333 /**
334 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
335 * under any possible substitution of the unspecified parameters (if any).
336 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
337 * @return true if the input is a valid (partial) match of the pattern.
338 *
339 */
340 public boolean hasMatch(final DirectedCommunicationLink pLink) {
341 return rawHasMatch(new Object[]{pLink});
342 }
343
344 /**
345 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
346 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
347 * @return the number of pattern matches found.
348 *
349 */
350 public int countMatches(final DirectedCommunicationLink pLink) {
351 return rawCountMatches(new Object[]{pLink});
352 }
353
354 /**
355 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
356 * Neither determinism nor randomness of selection is guaranteed.
357 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
358 * @param processor the action that will process the selected match.
359 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
360 *
361 */
362 public boolean forOneArbitraryMatch(final DirectedCommunicationLink pLink, final Consumer<? super IncompatibleSourceAndTargetGain.Match> processor) {
363 return rawForOneArbitraryMatch(new Object[]{pLink}, processor);
364 }
365
366 /**
367 * Returns a new (partial) match.
368 * This can be used e.g. to call the matcher with a partial match.
369 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
370 * @param pLink the fixed value of pattern parameter Link, or null if not bound.
371 * @return the (partial) match object.
372 *
373 */
374 public IncompatibleSourceAndTargetGain.Match newMatch(final DirectedCommunicationLink pLink) {
375 return IncompatibleSourceAndTargetGain.Match.newMatch(pLink);
376 }
377
378 /**
379 * Retrieve the set of values that occur in matches for Link.
380 * @return the Set of all values or empty set if there are no matches
381 *
382 */
383 protected Stream<DirectedCommunicationLink> rawStreamAllValuesOfLink(final Object[] parameters) {
384 return rawStreamAllValues(POSITION_LINK, parameters).map(DirectedCommunicationLink.class::cast);
385 }
386
387 /**
388 * Retrieve the set of values that occur in matches for Link.
389 * @return the Set of all values or empty set if there are no matches
390 *
391 */
392 public Set<DirectedCommunicationLink> getAllValuesOfLink() {
393 return rawStreamAllValuesOfLink(emptyArray()).collect(Collectors.toSet());
394 }
395
396 /**
397 * Retrieve the set of values that occur in matches for Link.
398 * @return the Set of all values or empty set if there are no matches
399 *
400 */
401 public Stream<DirectedCommunicationLink> streamAllValuesOfLink() {
402 return rawStreamAllValuesOfLink(emptyArray());
403 }
404
405 @Override
406 protected IncompatibleSourceAndTargetGain.Match tupleToMatch(final Tuple t) {
407 try {
408 return IncompatibleSourceAndTargetGain.Match.newMatch((DirectedCommunicationLink) t.get(POSITION_LINK));
409 } catch(ClassCastException e) {
410 LOGGER.error("Element(s) in tuple not properly typed!",e);
411 return null;
412 }
413 }
414
415 @Override
416 protected IncompatibleSourceAndTargetGain.Match arrayToMatch(final Object[] match) {
417 try {
418 return IncompatibleSourceAndTargetGain.Match.newMatch((DirectedCommunicationLink) match[POSITION_LINK]);
419 } catch(ClassCastException e) {
420 LOGGER.error("Element(s) in array not properly typed!",e);
421 return null;
422 }
423 }
424
425 @Override
426 protected IncompatibleSourceAndTargetGain.Match arrayToMatchMutable(final Object[] match) {
427 try {
428 return IncompatibleSourceAndTargetGain.Match.newMutableMatch((DirectedCommunicationLink) match[POSITION_LINK]);
429 } catch(ClassCastException e) {
430 LOGGER.error("Element(s) in array not properly typed!",e);
431 return null;
432 }
433 }
434
435 /**
436 * @return the singleton instance of the query specification of this pattern
437 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
438 *
439 */
440 public static IQuerySpecification<IncompatibleSourceAndTargetGain.Matcher> querySpecification() {
441 return IncompatibleSourceAndTargetGain.instance();
442 }
443 }
444
445 private IncompatibleSourceAndTargetGain() {
446 super(GeneratedPQuery.INSTANCE);
447 }
448
449 /**
450 * @return the singleton instance of the query specification
451 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
452 *
453 */
454 public static IncompatibleSourceAndTargetGain instance() {
455 try{
456 return LazyHolder.INSTANCE;
457 } catch (ExceptionInInitializerError err) {
458 throw processInitializerError(err);
459 }
460 }
461
462 @Override
463 protected IncompatibleSourceAndTargetGain.Matcher instantiate(final ViatraQueryEngine engine) {
464 return IncompatibleSourceAndTargetGain.Matcher.on(engine);
465 }
466
467 @Override
468 public IncompatibleSourceAndTargetGain.Matcher instantiate() {
469 return IncompatibleSourceAndTargetGain.Matcher.create();
470 }
471
472 @Override
473 public IncompatibleSourceAndTargetGain.Match newEmptyMatch() {
474 return IncompatibleSourceAndTargetGain.Match.newEmptyMatch();
475 }
476
477 @Override
478 public IncompatibleSourceAndTargetGain.Match newMatch(final Object... parameters) {
479 return IncompatibleSourceAndTargetGain.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink) parameters[0]);
480 }
481
482 /**
483 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
484 * <b>not</b> at the class load time of the outer class,
485 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain (visibility: PUBLIC, simpleName: IncompatibleSourceAndTargetGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
486 *
487 * <p> This workaround is required e.g. to support recursion.
488 *
489 */
490 private static class LazyHolder {
491 private static final IncompatibleSourceAndTargetGain INSTANCE = new IncompatibleSourceAndTargetGain();
492
493 /**
494 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
495 * This initialization order is required to support indirect recursion.
496 *
497 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
498 *
499 */
500 private static final Object STATIC_INITIALIZER = ensureInitialized();
501
502 public static Object ensureInitialized() {
503 INSTANCE.ensureInitializedInternal();
504 return null;
505 }
506 }
507
508 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
509 private static final IncompatibleSourceAndTargetGain.GeneratedPQuery INSTANCE = new GeneratedPQuery();
510
511 private final PParameter parameter_Link = new PParameter("Link", "hu.bme.mit.inf.dslreasoner.domains.satellite.DirectedCommunicationLink", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "DirectedCommunicationLink")), PParameterDirection.INOUT);
512
513 private final List<PParameter> parameters = Arrays.asList(parameter_Link);
514
515 private GeneratedPQuery() {
516 super(PVisibility.PUBLIC);
517 }
518
519 @Override
520 public String getFullyQualifiedName() {
521 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.incompatibleSourceAndTargetGain";
522 }
523
524 @Override
525 public List<String> getParameterNames() {
526 return Arrays.asList("Link");
527 }
528
529 @Override
530 public List<PParameter> getParameters() {
531 return parameters;
532 }
533
534 @Override
535 public Set<PBody> doGetContainedBodies() {
536 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
537 Set<PBody> bodies = new LinkedHashSet<>();
538 {
539 PBody body = new PBody(this);
540 PVariable var_Link = body.getOrCreateVariableByName("Link");
541 PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem");
542 PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem");
543 PVariable var_Gain = body.getOrCreateVariableByName("Gain");
544 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
545 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
546 new ExportedParameter(body, var_Link, parameter_Link)
547 ));
548 // DirectedCommunicationLink.source(Link, SourceSubsystem)
549 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
550 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
551 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source")));
552 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
553 new Equality(body, var__virtual_0_, var_SourceSubsystem);
554 // DirectedCommunicationLink.target(Link, TargetSubsystem)
555 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
556 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
557 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target")));
558 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
559 new Equality(body, var__virtual_1_, var_TargetSubsystem);
560 // CommSubsystem.gain(SourceSubsystem, Gain)
561 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
562 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
563 new TypeConstraint(body, Tuples.flatTupleOf(var_SourceSubsystem, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain")));
564 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
565 new Equality(body, var__virtual_2_, var_Gain);
566 // neg find commSubsystemGain(TargetSubsystem, Gain)
567 new NegativePatternCall(body, Tuples.flatTupleOf(var_TargetSubsystem, var_Gain), CommSubsystemGain.instance().getInternalQueryRepresentation());
568 bodies.add(body);
569 }
570 {
571 PAnnotation annotation = new PAnnotation("Constraint");
572 annotation.addAttribute("severity", "error");
573 annotation.addAttribute("key", Arrays.asList(new Object[] {
574 new ParameterReference("Link")
575 }));
576 annotation.addAttribute("message", "Two ends of a communication link must use the same antenna gain.");
577 addAnnotation(annotation);
578 }
579 return bodies;
580 }
581 }
582}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java
new file mode 100644
index 00000000..18f6c32f
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/KaAntennaGainLow.java
@@ -0,0 +1,574 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.EDataType;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
42import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
44import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
45
46/**
47 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
48 *
49 * <p>Original source:
50 * <code><pre>
51 * // Ka-band transmitters may only be combined with a medium or high gain antenna
52 *
53 * {@literal @}Constraint(severity = "error", key = {Comm},
54 * message = "Ka-band transceiver must be combined with a medium or high gain antenna.")
55 * pattern kaAntennaGainLow(Comm : CommSubsystem) {
56 * CommSubsystem.band(Comm, TransceiverBand::Ka);
57 * CommSubsystem.gain(Comm, AntennaGain::LOW);
58 * }
59 * </pre></code>
60 *
61 * @see Matcher
62 * @see Match
63 *
64 */
65@SuppressWarnings("all")
66public final class KaAntennaGainLow extends BaseGeneratedEMFQuerySpecification<KaAntennaGainLow.Matcher> {
67 /**
68 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow pattern,
69 * to be used in conjunction with {@link Matcher}.
70 *
71 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
72 * Each instance is a (possibly partial) substitution of pattern parameters,
73 * usable to represent a match of the pattern in the result of a query,
74 * or to specify the bound (fixed) input parameters when issuing a query.
75 *
76 * @see Matcher
77 *
78 */
79 public static abstract class Match extends BasePatternMatch {
80 private CommSubsystem fComm;
81
82 private static List<String> parameterNames = makeImmutableList("Comm");
83
84 private Match(final CommSubsystem pComm) {
85 this.fComm = pComm;
86 }
87
88 @Override
89 public Object get(final String parameterName) {
90 if ("Comm".equals(parameterName)) return this.fComm;
91 return null;
92 }
93
94 public CommSubsystem getComm() {
95 return this.fComm;
96 }
97
98 @Override
99 public boolean set(final String parameterName, final Object newValue) {
100 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
101 if ("Comm".equals(parameterName) ) {
102 this.fComm = (CommSubsystem) newValue;
103 return true;
104 }
105 return false;
106 }
107
108 public void setComm(final CommSubsystem pComm) {
109 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
110 this.fComm = pComm;
111 }
112
113 @Override
114 public String patternName() {
115 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow";
116 }
117
118 @Override
119 public List<String> parameterNames() {
120 return KaAntennaGainLow.Match.parameterNames;
121 }
122
123 @Override
124 public Object[] toArray() {
125 return new Object[]{fComm};
126 }
127
128 @Override
129 public KaAntennaGainLow.Match toImmutable() {
130 return isMutable() ? newMatch(fComm) : this;
131 }
132
133 @Override
134 public String prettyPrint() {
135 StringBuilder result = new StringBuilder();
136 result.append("\"Comm\"=" + prettyPrintValue(fComm));
137 return result.toString();
138 }
139
140 @Override
141 public int hashCode() {
142 return Objects.hash(fComm);
143 }
144
145 @Override
146 public boolean equals(final Object obj) {
147 if (this == obj)
148 return true;
149 if (obj == null) {
150 return false;
151 }
152 if ((obj instanceof KaAntennaGainLow.Match)) {
153 KaAntennaGainLow.Match other = (KaAntennaGainLow.Match) obj;
154 return Objects.equals(fComm, other.fComm);
155 } else {
156 // this should be infrequent
157 if (!(obj instanceof IPatternMatch)) {
158 return false;
159 }
160 IPatternMatch otherSig = (IPatternMatch) obj;
161 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
162 }
163 }
164
165 @Override
166 public KaAntennaGainLow specification() {
167 return KaAntennaGainLow.instance();
168 }
169
170 /**
171 * Returns an empty, mutable match.
172 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
173 *
174 * @return the empty match.
175 *
176 */
177 public static KaAntennaGainLow.Match newEmptyMatch() {
178 return new Mutable(null);
179 }
180
181 /**
182 * Returns a mutable (partial) match.
183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
184 *
185 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
186 * @return the new, mutable (partial) match object.
187 *
188 */
189 public static KaAntennaGainLow.Match newMutableMatch(final CommSubsystem pComm) {
190 return new Mutable(pComm);
191 }
192
193 /**
194 * Returns a new (partial) match.
195 * This can be used e.g. to call the matcher with a partial match.
196 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
197 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
198 * @return the (partial) match object.
199 *
200 */
201 public static KaAntennaGainLow.Match newMatch(final CommSubsystem pComm) {
202 return new Immutable(pComm);
203 }
204
205 private static final class Mutable extends KaAntennaGainLow.Match {
206 Mutable(final CommSubsystem pComm) {
207 super(pComm);
208 }
209
210 @Override
211 public boolean isMutable() {
212 return true;
213 }
214 }
215
216 private static final class Immutable extends KaAntennaGainLow.Match {
217 Immutable(final CommSubsystem pComm) {
218 super(pComm);
219 }
220
221 @Override
222 public boolean isMutable() {
223 return false;
224 }
225 }
226 }
227
228 /**
229 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow pattern,
230 * providing pattern-specific query methods.
231 *
232 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
233 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
234 *
235 * <p>Matches of the pattern will be represented as {@link Match}.
236 *
237 * <p>Original source:
238 * <code><pre>
239 * // Ka-band transmitters may only be combined with a medium or high gain antenna
240 *
241 * {@literal @}Constraint(severity = "error", key = {Comm},
242 * message = "Ka-band transceiver must be combined with a medium or high gain antenna.")
243 * pattern kaAntennaGainLow(Comm : CommSubsystem) {
244 * CommSubsystem.band(Comm, TransceiverBand::Ka);
245 * CommSubsystem.gain(Comm, AntennaGain::LOW);
246 * }
247 * </pre></code>
248 *
249 * @see Match
250 * @see KaAntennaGainLow
251 *
252 */
253 public static class Matcher extends BaseMatcher<KaAntennaGainLow.Match> {
254 /**
255 * Initializes the pattern matcher within an existing VIATRA Query engine.
256 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
257 *
258 * @param engine the existing VIATRA Query engine in which this matcher will be created.
259 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
260 *
261 */
262 public static KaAntennaGainLow.Matcher on(final ViatraQueryEngine engine) {
263 // check if matcher already exists
264 Matcher matcher = engine.getExistingMatcher(querySpecification());
265 if (matcher == null) {
266 matcher = (Matcher)engine.getMatcher(querySpecification());
267 }
268 return matcher;
269 }
270
271 /**
272 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
273 * @return an initialized matcher
274 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
275 *
276 */
277 public static KaAntennaGainLow.Matcher create() {
278 return new Matcher();
279 }
280
281 private static final int POSITION_COMM = 0;
282
283 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(KaAntennaGainLow.Matcher.class);
284
285 /**
286 * Initializes the pattern matcher within an existing VIATRA Query engine.
287 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
288 *
289 * @param engine the existing VIATRA Query engine in which this matcher will be created.
290 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
291 *
292 */
293 private Matcher() {
294 super(querySpecification());
295 }
296
297 /**
298 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
299 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
300 * @return matches represented as a Match object.
301 *
302 */
303 public Collection<KaAntennaGainLow.Match> getAllMatches(final CommSubsystem pComm) {
304 return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet());
305 }
306
307 /**
308 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
309 * </p>
310 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
311 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
312 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
313 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
314 * @return a stream of matches represented as a Match object.
315 *
316 */
317 public Stream<KaAntennaGainLow.Match> streamAllMatches(final CommSubsystem pComm) {
318 return rawStreamAllMatches(new Object[]{pComm});
319 }
320
321 /**
322 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
323 * Neither determinism nor randomness of selection is guaranteed.
324 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
325 * @return a match represented as a Match object, or null if no match is found.
326 *
327 */
328 public Optional<KaAntennaGainLow.Match> getOneArbitraryMatch(final CommSubsystem pComm) {
329 return rawGetOneArbitraryMatch(new Object[]{pComm});
330 }
331
332 /**
333 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
334 * under any possible substitution of the unspecified parameters (if any).
335 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
336 * @return true if the input is a valid (partial) match of the pattern.
337 *
338 */
339 public boolean hasMatch(final CommSubsystem pComm) {
340 return rawHasMatch(new Object[]{pComm});
341 }
342
343 /**
344 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
345 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
346 * @return the number of pattern matches found.
347 *
348 */
349 public int countMatches(final CommSubsystem pComm) {
350 return rawCountMatches(new Object[]{pComm});
351 }
352
353 /**
354 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
355 * Neither determinism nor randomness of selection is guaranteed.
356 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
357 * @param processor the action that will process the selected match.
358 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
359 *
360 */
361 public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super KaAntennaGainLow.Match> processor) {
362 return rawForOneArbitraryMatch(new Object[]{pComm}, processor);
363 }
364
365 /**
366 * Returns a new (partial) match.
367 * This can be used e.g. to call the matcher with a partial match.
368 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
369 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
370 * @return the (partial) match object.
371 *
372 */
373 public KaAntennaGainLow.Match newMatch(final CommSubsystem pComm) {
374 return KaAntennaGainLow.Match.newMatch(pComm);
375 }
376
377 /**
378 * Retrieve the set of values that occur in matches for Comm.
379 * @return the Set of all values or empty set if there are no matches
380 *
381 */
382 protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) {
383 return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast);
384 }
385
386 /**
387 * Retrieve the set of values that occur in matches for Comm.
388 * @return the Set of all values or empty set if there are no matches
389 *
390 */
391 public Set<CommSubsystem> getAllValuesOfComm() {
392 return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet());
393 }
394
395 /**
396 * Retrieve the set of values that occur in matches for Comm.
397 * @return the Set of all values or empty set if there are no matches
398 *
399 */
400 public Stream<CommSubsystem> streamAllValuesOfComm() {
401 return rawStreamAllValuesOfComm(emptyArray());
402 }
403
404 @Override
405 protected KaAntennaGainLow.Match tupleToMatch(final Tuple t) {
406 try {
407 return KaAntennaGainLow.Match.newMatch((CommSubsystem) t.get(POSITION_COMM));
408 } catch(ClassCastException e) {
409 LOGGER.error("Element(s) in tuple not properly typed!",e);
410 return null;
411 }
412 }
413
414 @Override
415 protected KaAntennaGainLow.Match arrayToMatch(final Object[] match) {
416 try {
417 return KaAntennaGainLow.Match.newMatch((CommSubsystem) match[POSITION_COMM]);
418 } catch(ClassCastException e) {
419 LOGGER.error("Element(s) in array not properly typed!",e);
420 return null;
421 }
422 }
423
424 @Override
425 protected KaAntennaGainLow.Match arrayToMatchMutable(final Object[] match) {
426 try {
427 return KaAntennaGainLow.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]);
428 } catch(ClassCastException e) {
429 LOGGER.error("Element(s) in array not properly typed!",e);
430 return null;
431 }
432 }
433
434 /**
435 * @return the singleton instance of the query specification of this pattern
436 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
437 *
438 */
439 public static IQuerySpecification<KaAntennaGainLow.Matcher> querySpecification() {
440 return KaAntennaGainLow.instance();
441 }
442 }
443
444 private KaAntennaGainLow() {
445 super(GeneratedPQuery.INSTANCE);
446 }
447
448 /**
449 * @return the singleton instance of the query specification
450 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
451 *
452 */
453 public static KaAntennaGainLow instance() {
454 try{
455 return LazyHolder.INSTANCE;
456 } catch (ExceptionInInitializerError err) {
457 throw processInitializerError(err);
458 }
459 }
460
461 @Override
462 protected KaAntennaGainLow.Matcher instantiate(final ViatraQueryEngine engine) {
463 return KaAntennaGainLow.Matcher.on(engine);
464 }
465
466 @Override
467 public KaAntennaGainLow.Matcher instantiate() {
468 return KaAntennaGainLow.Matcher.create();
469 }
470
471 @Override
472 public KaAntennaGainLow.Match newEmptyMatch() {
473 return KaAntennaGainLow.Match.newEmptyMatch();
474 }
475
476 @Override
477 public KaAntennaGainLow.Match newMatch(final Object... parameters) {
478 return KaAntennaGainLow.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem) parameters[0]);
479 }
480
481 /**
482 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow (visibility: PUBLIC, simpleName: KaAntennaGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
483 * <b>not</b> at the class load time of the outer class,
484 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow (visibility: PUBLIC, simpleName: KaAntennaGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
485 *
486 * <p> This workaround is required e.g. to support recursion.
487 *
488 */
489 private static class LazyHolder {
490 private static final KaAntennaGainLow INSTANCE = new KaAntennaGainLow();
491
492 /**
493 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
494 * This initialization order is required to support indirect recursion.
495 *
496 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
497 *
498 */
499 private static final Object STATIC_INITIALIZER = ensureInitialized();
500
501 public static Object ensureInitialized() {
502 INSTANCE.ensureInitializedInternal();
503 return null;
504 }
505 }
506
507 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
508 private static final KaAntennaGainLow.GeneratedPQuery INSTANCE = new GeneratedPQuery();
509
510 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
511
512 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
513
514 private GeneratedPQuery() {
515 super(PVisibility.PUBLIC);
516 }
517
518 @Override
519 public String getFullyQualifiedName() {
520 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.kaAntennaGainLow";
521 }
522
523 @Override
524 public List<String> getParameterNames() {
525 return Arrays.asList("Comm");
526 }
527
528 @Override
529 public List<PParameter> getParameters() {
530 return parameters;
531 }
532
533 @Override
534 public Set<PBody> doGetContainedBodies() {
535 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
536 Set<PBody> bodies = new LinkedHashSet<>();
537 {
538 PBody body = new PBody(this);
539 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
540 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
541 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
542 new ExportedParameter(body, var_Comm, parameter_Comm)
543 ));
544 // CommSubsystem.band(Comm, TransceiverBand::Ka)
545 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
546 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "Ka").getInstance());
547 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
548 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
549 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
550 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
551 new Equality(body, var__virtual_1_, var__virtual_0_);
552 // CommSubsystem.gain(Comm, AntennaGain::LOW)
553 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
554 new ConstantValue(body, var__virtual_2_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "LOW").getInstance());
555 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
556 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
557 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain")));
558 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
559 new Equality(body, var__virtual_3_, var__virtual_2_);
560 bodies.add(body);
561 }
562 {
563 PAnnotation annotation = new PAnnotation("Constraint");
564 annotation.addAttribute("severity", "error");
565 annotation.addAttribute("key", Arrays.asList(new Object[] {
566 new ParameterReference("Comm")
567 }));
568 annotation.addAttribute("message", "Ka-band transceiver must be combined with a medium or high gain antenna.");
569 addAnnotation(annotation);
570 }
571 return bodies;
572 }
573 }
574}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java
new file mode 100644
index 00000000..598f3a6b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NoLinkToGroundStation.java
@@ -0,0 +1,575 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
42import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
43import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
44
45/**
46 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
47 *
48 * <p>Original source:
49 * <code><pre>
50 * // All spacecraft must have some communication path to the ground station
51 *
52 * {@literal @}Constraint(severity = "error", key = {Spacecraft},
53 * message = "Spacecraft has no communication path to the ground station.")
54 * pattern noLinkToGroundStation(Spacecraft : Spacecraft) {
55 * ConstellationMission.groundStationNetwork(Mission, GroundStation);
56 * ConstellationMission.spacecraft(Mission, Spacecraft);
57 * neg find indirectCommunicationLink(Spacecraft, GroundStation);
58 * }
59 * </pre></code>
60 *
61 * @see Matcher
62 * @see Match
63 *
64 */
65@SuppressWarnings("all")
66public final class NoLinkToGroundStation extends BaseGeneratedEMFQuerySpecification<NoLinkToGroundStation.Matcher> {
67 /**
68 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation pattern,
69 * to be used in conjunction with {@link Matcher}.
70 *
71 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
72 * Each instance is a (possibly partial) substitution of pattern parameters,
73 * usable to represent a match of the pattern in the result of a query,
74 * or to specify the bound (fixed) input parameters when issuing a query.
75 *
76 * @see Matcher
77 *
78 */
79 public static abstract class Match extends BasePatternMatch {
80 private Spacecraft fSpacecraft;
81
82 private static List<String> parameterNames = makeImmutableList("Spacecraft");
83
84 private Match(final Spacecraft pSpacecraft) {
85 this.fSpacecraft = pSpacecraft;
86 }
87
88 @Override
89 public Object get(final String parameterName) {
90 if ("Spacecraft".equals(parameterName)) return this.fSpacecraft;
91 return null;
92 }
93
94 public Spacecraft getSpacecraft() {
95 return this.fSpacecraft;
96 }
97
98 @Override
99 public boolean set(final String parameterName, final Object newValue) {
100 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
101 if ("Spacecraft".equals(parameterName) ) {
102 this.fSpacecraft = (Spacecraft) newValue;
103 return true;
104 }
105 return false;
106 }
107
108 public void setSpacecraft(final Spacecraft pSpacecraft) {
109 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
110 this.fSpacecraft = pSpacecraft;
111 }
112
113 @Override
114 public String patternName() {
115 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation";
116 }
117
118 @Override
119 public List<String> parameterNames() {
120 return NoLinkToGroundStation.Match.parameterNames;
121 }
122
123 @Override
124 public Object[] toArray() {
125 return new Object[]{fSpacecraft};
126 }
127
128 @Override
129 public NoLinkToGroundStation.Match toImmutable() {
130 return isMutable() ? newMatch(fSpacecraft) : this;
131 }
132
133 @Override
134 public String prettyPrint() {
135 StringBuilder result = new StringBuilder();
136 result.append("\"Spacecraft\"=" + prettyPrintValue(fSpacecraft));
137 return result.toString();
138 }
139
140 @Override
141 public int hashCode() {
142 return Objects.hash(fSpacecraft);
143 }
144
145 @Override
146 public boolean equals(final Object obj) {
147 if (this == obj)
148 return true;
149 if (obj == null) {
150 return false;
151 }
152 if ((obj instanceof NoLinkToGroundStation.Match)) {
153 NoLinkToGroundStation.Match other = (NoLinkToGroundStation.Match) obj;
154 return Objects.equals(fSpacecraft, other.fSpacecraft);
155 } else {
156 // this should be infrequent
157 if (!(obj instanceof IPatternMatch)) {
158 return false;
159 }
160 IPatternMatch otherSig = (IPatternMatch) obj;
161 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
162 }
163 }
164
165 @Override
166 public NoLinkToGroundStation specification() {
167 return NoLinkToGroundStation.instance();
168 }
169
170 /**
171 * Returns an empty, mutable match.
172 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
173 *
174 * @return the empty match.
175 *
176 */
177 public static NoLinkToGroundStation.Match newEmptyMatch() {
178 return new Mutable(null);
179 }
180
181 /**
182 * Returns a mutable (partial) match.
183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
184 *
185 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
186 * @return the new, mutable (partial) match object.
187 *
188 */
189 public static NoLinkToGroundStation.Match newMutableMatch(final Spacecraft pSpacecraft) {
190 return new Mutable(pSpacecraft);
191 }
192
193 /**
194 * Returns a new (partial) match.
195 * This can be used e.g. to call the matcher with a partial match.
196 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
197 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
198 * @return the (partial) match object.
199 *
200 */
201 public static NoLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) {
202 return new Immutable(pSpacecraft);
203 }
204
205 private static final class Mutable extends NoLinkToGroundStation.Match {
206 Mutable(final Spacecraft pSpacecraft) {
207 super(pSpacecraft);
208 }
209
210 @Override
211 public boolean isMutable() {
212 return true;
213 }
214 }
215
216 private static final class Immutable extends NoLinkToGroundStation.Match {
217 Immutable(final Spacecraft pSpacecraft) {
218 super(pSpacecraft);
219 }
220
221 @Override
222 public boolean isMutable() {
223 return false;
224 }
225 }
226 }
227
228 /**
229 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation pattern,
230 * providing pattern-specific query methods.
231 *
232 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
233 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
234 *
235 * <p>Matches of the pattern will be represented as {@link Match}.
236 *
237 * <p>Original source:
238 * <code><pre>
239 * // All spacecraft must have some communication path to the ground station
240 *
241 * {@literal @}Constraint(severity = "error", key = {Spacecraft},
242 * message = "Spacecraft has no communication path to the ground station.")
243 * pattern noLinkToGroundStation(Spacecraft : Spacecraft) {
244 * ConstellationMission.groundStationNetwork(Mission, GroundStation);
245 * ConstellationMission.spacecraft(Mission, Spacecraft);
246 * neg find indirectCommunicationLink(Spacecraft, GroundStation);
247 * }
248 * </pre></code>
249 *
250 * @see Match
251 * @see NoLinkToGroundStation
252 *
253 */
254 public static class Matcher extends BaseMatcher<NoLinkToGroundStation.Match> {
255 /**
256 * Initializes the pattern matcher within an existing VIATRA Query engine.
257 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
258 *
259 * @param engine the existing VIATRA Query engine in which this matcher will be created.
260 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
261 *
262 */
263 public static NoLinkToGroundStation.Matcher on(final ViatraQueryEngine engine) {
264 // check if matcher already exists
265 Matcher matcher = engine.getExistingMatcher(querySpecification());
266 if (matcher == null) {
267 matcher = (Matcher)engine.getMatcher(querySpecification());
268 }
269 return matcher;
270 }
271
272 /**
273 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
274 * @return an initialized matcher
275 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
276 *
277 */
278 public static NoLinkToGroundStation.Matcher create() {
279 return new Matcher();
280 }
281
282 private static final int POSITION_SPACECRAFT = 0;
283
284 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoLinkToGroundStation.Matcher.class);
285
286 /**
287 * Initializes the pattern matcher within an existing VIATRA Query engine.
288 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
289 *
290 * @param engine the existing VIATRA Query engine in which this matcher will be created.
291 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
292 *
293 */
294 private Matcher() {
295 super(querySpecification());
296 }
297
298 /**
299 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
300 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
301 * @return matches represented as a Match object.
302 *
303 */
304 public Collection<NoLinkToGroundStation.Match> getAllMatches(final Spacecraft pSpacecraft) {
305 return rawStreamAllMatches(new Object[]{pSpacecraft}).collect(Collectors.toSet());
306 }
307
308 /**
309 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
310 * </p>
311 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
312 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
313 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
314 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
315 * @return a stream of matches represented as a Match object.
316 *
317 */
318 public Stream<NoLinkToGroundStation.Match> streamAllMatches(final Spacecraft pSpacecraft) {
319 return rawStreamAllMatches(new Object[]{pSpacecraft});
320 }
321
322 /**
323 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
324 * Neither determinism nor randomness of selection is guaranteed.
325 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
326 * @return a match represented as a Match object, or null if no match is found.
327 *
328 */
329 public Optional<NoLinkToGroundStation.Match> getOneArbitraryMatch(final Spacecraft pSpacecraft) {
330 return rawGetOneArbitraryMatch(new Object[]{pSpacecraft});
331 }
332
333 /**
334 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
335 * under any possible substitution of the unspecified parameters (if any).
336 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
337 * @return true if the input is a valid (partial) match of the pattern.
338 *
339 */
340 public boolean hasMatch(final Spacecraft pSpacecraft) {
341 return rawHasMatch(new Object[]{pSpacecraft});
342 }
343
344 /**
345 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
346 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
347 * @return the number of pattern matches found.
348 *
349 */
350 public int countMatches(final Spacecraft pSpacecraft) {
351 return rawCountMatches(new Object[]{pSpacecraft});
352 }
353
354 /**
355 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
356 * Neither determinism nor randomness of selection is guaranteed.
357 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
358 * @param processor the action that will process the selected match.
359 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
360 *
361 */
362 public boolean forOneArbitraryMatch(final Spacecraft pSpacecraft, final Consumer<? super NoLinkToGroundStation.Match> processor) {
363 return rawForOneArbitraryMatch(new Object[]{pSpacecraft}, processor);
364 }
365
366 /**
367 * Returns a new (partial) match.
368 * This can be used e.g. to call the matcher with a partial match.
369 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
370 * @param pSpacecraft the fixed value of pattern parameter Spacecraft, or null if not bound.
371 * @return the (partial) match object.
372 *
373 */
374 public NoLinkToGroundStation.Match newMatch(final Spacecraft pSpacecraft) {
375 return NoLinkToGroundStation.Match.newMatch(pSpacecraft);
376 }
377
378 /**
379 * Retrieve the set of values that occur in matches for Spacecraft.
380 * @return the Set of all values or empty set if there are no matches
381 *
382 */
383 protected Stream<Spacecraft> rawStreamAllValuesOfSpacecraft(final Object[] parameters) {
384 return rawStreamAllValues(POSITION_SPACECRAFT, parameters).map(Spacecraft.class::cast);
385 }
386
387 /**
388 * Retrieve the set of values that occur in matches for Spacecraft.
389 * @return the Set of all values or empty set if there are no matches
390 *
391 */
392 public Set<Spacecraft> getAllValuesOfSpacecraft() {
393 return rawStreamAllValuesOfSpacecraft(emptyArray()).collect(Collectors.toSet());
394 }
395
396 /**
397 * Retrieve the set of values that occur in matches for Spacecraft.
398 * @return the Set of all values or empty set if there are no matches
399 *
400 */
401 public Stream<Spacecraft> streamAllValuesOfSpacecraft() {
402 return rawStreamAllValuesOfSpacecraft(emptyArray());
403 }
404
405 @Override
406 protected NoLinkToGroundStation.Match tupleToMatch(final Tuple t) {
407 try {
408 return NoLinkToGroundStation.Match.newMatch((Spacecraft) t.get(POSITION_SPACECRAFT));
409 } catch(ClassCastException e) {
410 LOGGER.error("Element(s) in tuple not properly typed!",e);
411 return null;
412 }
413 }
414
415 @Override
416 protected NoLinkToGroundStation.Match arrayToMatch(final Object[] match) {
417 try {
418 return NoLinkToGroundStation.Match.newMatch((Spacecraft) match[POSITION_SPACECRAFT]);
419 } catch(ClassCastException e) {
420 LOGGER.error("Element(s) in array not properly typed!",e);
421 return null;
422 }
423 }
424
425 @Override
426 protected NoLinkToGroundStation.Match arrayToMatchMutable(final Object[] match) {
427 try {
428 return NoLinkToGroundStation.Match.newMutableMatch((Spacecraft) match[POSITION_SPACECRAFT]);
429 } catch(ClassCastException e) {
430 LOGGER.error("Element(s) in array not properly typed!",e);
431 return null;
432 }
433 }
434
435 /**
436 * @return the singleton instance of the query specification of this pattern
437 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
438 *
439 */
440 public static IQuerySpecification<NoLinkToGroundStation.Matcher> querySpecification() {
441 return NoLinkToGroundStation.instance();
442 }
443 }
444
445 private NoLinkToGroundStation() {
446 super(GeneratedPQuery.INSTANCE);
447 }
448
449 /**
450 * @return the singleton instance of the query specification
451 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
452 *
453 */
454 public static NoLinkToGroundStation instance() {
455 try{
456 return LazyHolder.INSTANCE;
457 } catch (ExceptionInInitializerError err) {
458 throw processInitializerError(err);
459 }
460 }
461
462 @Override
463 protected NoLinkToGroundStation.Matcher instantiate(final ViatraQueryEngine engine) {
464 return NoLinkToGroundStation.Matcher.on(engine);
465 }
466
467 @Override
468 public NoLinkToGroundStation.Matcher instantiate() {
469 return NoLinkToGroundStation.Matcher.create();
470 }
471
472 @Override
473 public NoLinkToGroundStation.Match newEmptyMatch() {
474 return NoLinkToGroundStation.Match.newEmptyMatch();
475 }
476
477 @Override
478 public NoLinkToGroundStation.Match newMatch(final Object... parameters) {
479 return NoLinkToGroundStation.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft) parameters[0]);
480 }
481
482 /**
483 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation (visibility: PUBLIC, simpleName: NoLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
484 * <b>not</b> at the class load time of the outer class,
485 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation (visibility: PUBLIC, simpleName: NoLinkToGroundStation, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
486 *
487 * <p> This workaround is required e.g. to support recursion.
488 *
489 */
490 private static class LazyHolder {
491 private static final NoLinkToGroundStation INSTANCE = new NoLinkToGroundStation();
492
493 /**
494 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
495 * This initialization order is required to support indirect recursion.
496 *
497 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
498 *
499 */
500 private static final Object STATIC_INITIALIZER = ensureInitialized();
501
502 public static Object ensureInitialized() {
503 INSTANCE.ensureInitializedInternal();
504 return null;
505 }
506 }
507
508 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
509 private static final NoLinkToGroundStation.GeneratedPQuery INSTANCE = new GeneratedPQuery();
510
511 private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT);
512
513 private final List<PParameter> parameters = Arrays.asList(parameter_Spacecraft);
514
515 private GeneratedPQuery() {
516 super(PVisibility.PUBLIC);
517 }
518
519 @Override
520 public String getFullyQualifiedName() {
521 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.noLinkToGroundStation";
522 }
523
524 @Override
525 public List<String> getParameterNames() {
526 return Arrays.asList("Spacecraft");
527 }
528
529 @Override
530 public List<PParameter> getParameters() {
531 return parameters;
532 }
533
534 @Override
535 public Set<PBody> doGetContainedBodies() {
536 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
537 Set<PBody> bodies = new LinkedHashSet<>();
538 {
539 PBody body = new PBody(this);
540 PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft");
541 PVariable var_Mission = body.getOrCreateVariableByName("Mission");
542 PVariable var_GroundStation = body.getOrCreateVariableByName("GroundStation");
543 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
544 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
545 new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft)
546 ));
547 // ConstellationMission.groundStationNetwork(Mission, GroundStation)
548 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission")));
549 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
550 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "groundStationNetwork")));
551 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork")));
552 new Equality(body, var__virtual_0_, var_GroundStation);
553 // ConstellationMission.spacecraft(Mission, Spacecraft)
554 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission")));
555 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
556 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft")));
557 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
558 new Equality(body, var__virtual_1_, var_Spacecraft);
559 // neg find indirectCommunicationLink(Spacecraft, GroundStation)
560 new NegativePatternCall(body, Tuples.flatTupleOf(var_Spacecraft, var_GroundStation), IndirectCommunicationLink.instance().getInternalQueryRepresentation());
561 bodies.add(body);
562 }
563 {
564 PAnnotation annotation = new PAnnotation("Constraint");
565 annotation.addAttribute("severity", "error");
566 annotation.addAttribute("key", Arrays.asList(new Object[] {
567 new ParameterReference("Spacecraft")
568 }));
569 annotation.addAttribute("message", "Spacecraft has no communication path to the ground station.");
570 addAnnotation(annotation);
571 }
572 return bodies;
573 }
574 }
575}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java
new file mode 100644
index 00000000..39af9d5b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/NotEnoughInterferometryPayloads.java
@@ -0,0 +1,548 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
39import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
40
41/**
42 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
43 *
44 * <p>Original source:
45 * <code><pre>
46 * // At least two spacecraft must have the interferometry payload configured
47 *
48 * //{@literal @}Constraint(severity = "error", key = {Mission},
49 * // message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
50 * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) {
51 * InterferometryMission(Mission);
52 * neg find atLeastTwoInterferometryPayloads(Mission);
53 * }
54 * </pre></code>
55 *
56 * @see Matcher
57 * @see Match
58 *
59 */
60@SuppressWarnings("all")
61public final class NotEnoughInterferometryPayloads extends BaseGeneratedEMFQuerySpecification<NotEnoughInterferometryPayloads.Matcher> {
62 /**
63 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads pattern,
64 * to be used in conjunction with {@link Matcher}.
65 *
66 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
67 * Each instance is a (possibly partial) substitution of pattern parameters,
68 * usable to represent a match of the pattern in the result of a query,
69 * or to specify the bound (fixed) input parameters when issuing a query.
70 *
71 * @see Matcher
72 *
73 */
74 public static abstract class Match extends BasePatternMatch {
75 private InterferometryMission fMission;
76
77 private static List<String> parameterNames = makeImmutableList("Mission");
78
79 private Match(final InterferometryMission pMission) {
80 this.fMission = pMission;
81 }
82
83 @Override
84 public Object get(final String parameterName) {
85 if ("Mission".equals(parameterName)) return this.fMission;
86 return null;
87 }
88
89 public InterferometryMission getMission() {
90 return this.fMission;
91 }
92
93 @Override
94 public boolean set(final String parameterName, final Object newValue) {
95 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
96 if ("Mission".equals(parameterName) ) {
97 this.fMission = (InterferometryMission) newValue;
98 return true;
99 }
100 return false;
101 }
102
103 public void setMission(final InterferometryMission pMission) {
104 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
105 this.fMission = pMission;
106 }
107
108 @Override
109 public String patternName() {
110 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads";
111 }
112
113 @Override
114 public List<String> parameterNames() {
115 return NotEnoughInterferometryPayloads.Match.parameterNames;
116 }
117
118 @Override
119 public Object[] toArray() {
120 return new Object[]{fMission};
121 }
122
123 @Override
124 public NotEnoughInterferometryPayloads.Match toImmutable() {
125 return isMutable() ? newMatch(fMission) : this;
126 }
127
128 @Override
129 public String prettyPrint() {
130 StringBuilder result = new StringBuilder();
131 result.append("\"Mission\"=" + prettyPrintValue(fMission));
132 return result.toString();
133 }
134
135 @Override
136 public int hashCode() {
137 return Objects.hash(fMission);
138 }
139
140 @Override
141 public boolean equals(final Object obj) {
142 if (this == obj)
143 return true;
144 if (obj == null) {
145 return false;
146 }
147 if ((obj instanceof NotEnoughInterferometryPayloads.Match)) {
148 NotEnoughInterferometryPayloads.Match other = (NotEnoughInterferometryPayloads.Match) obj;
149 return Objects.equals(fMission, other.fMission);
150 } else {
151 // this should be infrequent
152 if (!(obj instanceof IPatternMatch)) {
153 return false;
154 }
155 IPatternMatch otherSig = (IPatternMatch) obj;
156 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
157 }
158 }
159
160 @Override
161 public NotEnoughInterferometryPayloads specification() {
162 return NotEnoughInterferometryPayloads.instance();
163 }
164
165 /**
166 * Returns an empty, mutable match.
167 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
168 *
169 * @return the empty match.
170 *
171 */
172 public static NotEnoughInterferometryPayloads.Match newEmptyMatch() {
173 return new Mutable(null);
174 }
175
176 /**
177 * Returns a mutable (partial) match.
178 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
179 *
180 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
181 * @return the new, mutable (partial) match object.
182 *
183 */
184 public static NotEnoughInterferometryPayloads.Match newMutableMatch(final InterferometryMission pMission) {
185 return new Mutable(pMission);
186 }
187
188 /**
189 * Returns a new (partial) match.
190 * This can be used e.g. to call the matcher with a partial match.
191 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
192 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
193 * @return the (partial) match object.
194 *
195 */
196 public static NotEnoughInterferometryPayloads.Match newMatch(final InterferometryMission pMission) {
197 return new Immutable(pMission);
198 }
199
200 private static final class Mutable extends NotEnoughInterferometryPayloads.Match {
201 Mutable(final InterferometryMission pMission) {
202 super(pMission);
203 }
204
205 @Override
206 public boolean isMutable() {
207 return true;
208 }
209 }
210
211 private static final class Immutable extends NotEnoughInterferometryPayloads.Match {
212 Immutable(final InterferometryMission pMission) {
213 super(pMission);
214 }
215
216 @Override
217 public boolean isMutable() {
218 return false;
219 }
220 }
221 }
222
223 /**
224 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads pattern,
225 * providing pattern-specific query methods.
226 *
227 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
228 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
229 *
230 * <p>Matches of the pattern will be represented as {@link Match}.
231 *
232 * <p>Original source:
233 * <code><pre>
234 * // At least two spacecraft must have the interferometry payload configured
235 *
236 * //{@literal @}Constraint(severity = "error", key = {Mission},
237 * // message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.")
238 * pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) {
239 * InterferometryMission(Mission);
240 * neg find atLeastTwoInterferometryPayloads(Mission);
241 * }
242 * </pre></code>
243 *
244 * @see Match
245 * @see NotEnoughInterferometryPayloads
246 *
247 */
248 public static class Matcher extends BaseMatcher<NotEnoughInterferometryPayloads.Match> {
249 /**
250 * Initializes the pattern matcher within an existing VIATRA Query engine.
251 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
252 *
253 * @param engine the existing VIATRA Query engine in which this matcher will be created.
254 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
255 *
256 */
257 public static NotEnoughInterferometryPayloads.Matcher on(final ViatraQueryEngine engine) {
258 // check if matcher already exists
259 Matcher matcher = engine.getExistingMatcher(querySpecification());
260 if (matcher == null) {
261 matcher = (Matcher)engine.getMatcher(querySpecification());
262 }
263 return matcher;
264 }
265
266 /**
267 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
268 * @return an initialized matcher
269 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
270 *
271 */
272 public static NotEnoughInterferometryPayloads.Matcher create() {
273 return new Matcher();
274 }
275
276 private static final int POSITION_MISSION = 0;
277
278 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotEnoughInterferometryPayloads.Matcher.class);
279
280 /**
281 * Initializes the pattern matcher within an existing VIATRA Query engine.
282 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
283 *
284 * @param engine the existing VIATRA Query engine in which this matcher will be created.
285 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
286 *
287 */
288 private Matcher() {
289 super(querySpecification());
290 }
291
292 /**
293 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
294 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
295 * @return matches represented as a Match object.
296 *
297 */
298 public Collection<NotEnoughInterferometryPayloads.Match> getAllMatches(final InterferometryMission pMission) {
299 return rawStreamAllMatches(new Object[]{pMission}).collect(Collectors.toSet());
300 }
301
302 /**
303 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
304 * </p>
305 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
306 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
307 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
308 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
309 * @return a stream of matches represented as a Match object.
310 *
311 */
312 public Stream<NotEnoughInterferometryPayloads.Match> streamAllMatches(final InterferometryMission pMission) {
313 return rawStreamAllMatches(new Object[]{pMission});
314 }
315
316 /**
317 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
318 * Neither determinism nor randomness of selection is guaranteed.
319 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
320 * @return a match represented as a Match object, or null if no match is found.
321 *
322 */
323 public Optional<NotEnoughInterferometryPayloads.Match> getOneArbitraryMatch(final InterferometryMission pMission) {
324 return rawGetOneArbitraryMatch(new Object[]{pMission});
325 }
326
327 /**
328 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
329 * under any possible substitution of the unspecified parameters (if any).
330 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
331 * @return true if the input is a valid (partial) match of the pattern.
332 *
333 */
334 public boolean hasMatch(final InterferometryMission pMission) {
335 return rawHasMatch(new Object[]{pMission});
336 }
337
338 /**
339 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
340 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
341 * @return the number of pattern matches found.
342 *
343 */
344 public int countMatches(final InterferometryMission pMission) {
345 return rawCountMatches(new Object[]{pMission});
346 }
347
348 /**
349 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
350 * Neither determinism nor randomness of selection is guaranteed.
351 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
352 * @param processor the action that will process the selected match.
353 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
354 *
355 */
356 public boolean forOneArbitraryMatch(final InterferometryMission pMission, final Consumer<? super NotEnoughInterferometryPayloads.Match> processor) {
357 return rawForOneArbitraryMatch(new Object[]{pMission}, processor);
358 }
359
360 /**
361 * Returns a new (partial) match.
362 * This can be used e.g. to call the matcher with a partial match.
363 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
364 * @param pMission the fixed value of pattern parameter Mission, or null if not bound.
365 * @return the (partial) match object.
366 *
367 */
368 public NotEnoughInterferometryPayloads.Match newMatch(final InterferometryMission pMission) {
369 return NotEnoughInterferometryPayloads.Match.newMatch(pMission);
370 }
371
372 /**
373 * Retrieve the set of values that occur in matches for Mission.
374 * @return the Set of all values or empty set if there are no matches
375 *
376 */
377 protected Stream<InterferometryMission> rawStreamAllValuesOfMission(final Object[] parameters) {
378 return rawStreamAllValues(POSITION_MISSION, parameters).map(InterferometryMission.class::cast);
379 }
380
381 /**
382 * Retrieve the set of values that occur in matches for Mission.
383 * @return the Set of all values or empty set if there are no matches
384 *
385 */
386 public Set<InterferometryMission> getAllValuesOfMission() {
387 return rawStreamAllValuesOfMission(emptyArray()).collect(Collectors.toSet());
388 }
389
390 /**
391 * Retrieve the set of values that occur in matches for Mission.
392 * @return the Set of all values or empty set if there are no matches
393 *
394 */
395 public Stream<InterferometryMission> streamAllValuesOfMission() {
396 return rawStreamAllValuesOfMission(emptyArray());
397 }
398
399 @Override
400 protected NotEnoughInterferometryPayloads.Match tupleToMatch(final Tuple t) {
401 try {
402 return NotEnoughInterferometryPayloads.Match.newMatch((InterferometryMission) t.get(POSITION_MISSION));
403 } catch(ClassCastException e) {
404 LOGGER.error("Element(s) in tuple not properly typed!",e);
405 return null;
406 }
407 }
408
409 @Override
410 protected NotEnoughInterferometryPayloads.Match arrayToMatch(final Object[] match) {
411 try {
412 return NotEnoughInterferometryPayloads.Match.newMatch((InterferometryMission) match[POSITION_MISSION]);
413 } catch(ClassCastException e) {
414 LOGGER.error("Element(s) in array not properly typed!",e);
415 return null;
416 }
417 }
418
419 @Override
420 protected NotEnoughInterferometryPayloads.Match arrayToMatchMutable(final Object[] match) {
421 try {
422 return NotEnoughInterferometryPayloads.Match.newMutableMatch((InterferometryMission) match[POSITION_MISSION]);
423 } catch(ClassCastException e) {
424 LOGGER.error("Element(s) in array not properly typed!",e);
425 return null;
426 }
427 }
428
429 /**
430 * @return the singleton instance of the query specification of this pattern
431 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
432 *
433 */
434 public static IQuerySpecification<NotEnoughInterferometryPayloads.Matcher> querySpecification() {
435 return NotEnoughInterferometryPayloads.instance();
436 }
437 }
438
439 private NotEnoughInterferometryPayloads() {
440 super(GeneratedPQuery.INSTANCE);
441 }
442
443 /**
444 * @return the singleton instance of the query specification
445 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
446 *
447 */
448 public static NotEnoughInterferometryPayloads instance() {
449 try{
450 return LazyHolder.INSTANCE;
451 } catch (ExceptionInInitializerError err) {
452 throw processInitializerError(err);
453 }
454 }
455
456 @Override
457 protected NotEnoughInterferometryPayloads.Matcher instantiate(final ViatraQueryEngine engine) {
458 return NotEnoughInterferometryPayloads.Matcher.on(engine);
459 }
460
461 @Override
462 public NotEnoughInterferometryPayloads.Matcher instantiate() {
463 return NotEnoughInterferometryPayloads.Matcher.create();
464 }
465
466 @Override
467 public NotEnoughInterferometryPayloads.Match newEmptyMatch() {
468 return NotEnoughInterferometryPayloads.Match.newEmptyMatch();
469 }
470
471 @Override
472 public NotEnoughInterferometryPayloads.Match newMatch(final Object... parameters) {
473 return NotEnoughInterferometryPayloads.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission) parameters[0]);
474 }
475
476 /**
477 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads (visibility: PUBLIC, simpleName: NotEnoughInterferometryPayloads, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
478 * <b>not</b> at the class load time of the outer class,
479 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads (visibility: PUBLIC, simpleName: NotEnoughInterferometryPayloads, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
480 *
481 * <p> This workaround is required e.g. to support recursion.
482 *
483 */
484 private static class LazyHolder {
485 private static final NotEnoughInterferometryPayloads INSTANCE = new NotEnoughInterferometryPayloads();
486
487 /**
488 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
489 * This initialization order is required to support indirect recursion.
490 *
491 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
492 *
493 */
494 private static final Object STATIC_INITIALIZER = ensureInitialized();
495
496 public static Object ensureInitialized() {
497 INSTANCE.ensureInitializedInternal();
498 return null;
499 }
500 }
501
502 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
503 private static final NotEnoughInterferometryPayloads.GeneratedPQuery INSTANCE = new GeneratedPQuery();
504
505 private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT);
506
507 private final List<PParameter> parameters = Arrays.asList(parameter_Mission);
508
509 private GeneratedPQuery() {
510 super(PVisibility.PUBLIC);
511 }
512
513 @Override
514 public String getFullyQualifiedName() {
515 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.notEnoughInterferometryPayloads";
516 }
517
518 @Override
519 public List<String> getParameterNames() {
520 return Arrays.asList("Mission");
521 }
522
523 @Override
524 public List<PParameter> getParameters() {
525 return parameters;
526 }
527
528 @Override
529 public Set<PBody> doGetContainedBodies() {
530 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
531 Set<PBody> bodies = new LinkedHashSet<>();
532 {
533 PBody body = new PBody(this);
534 PVariable var_Mission = body.getOrCreateVariableByName("Mission");
535 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission")));
536 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
537 new ExportedParameter(body, var_Mission, parameter_Mission)
538 ));
539 // InterferometryMission(Mission)
540 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission")));
541 // neg find atLeastTwoInterferometryPayloads(Mission)
542 new NegativePatternCall(body, Tuples.flatTupleOf(var_Mission), AtLeastTwoInterferometryPayloads.instance().getInternalQueryRepresentation());
543 bodies.add(body);
544 }
545 return bodies;
546 }
547 }
548}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java
new file mode 100644
index 00000000..d4d72391
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.java
@@ -0,0 +1,163 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop;
8import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna;
9import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand;
10import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain;
11import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow;
12import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation;
13import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads;
14import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink;
15import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow;
16import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium;
17import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
18import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
19
20/**
21 * A pattern group formed of all public patterns defined in SatelliteQueries.vql.
22 *
23 * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
24 * a VIATRA Query engine for matching all patterns originally defined in file SatelliteQueries.vql,
25 * in order to achieve better performance than one-by-one on-demand matcher initialization.
26 *
27 * <p> From package hu.bme.mit.inf.dslreasoner.domains.satellite.queries, the group contains the definition of the following patterns: <ul>
28 * <li>communicationLinkDoesNotStartAtContainingElement</li>
29 * <li>notEnoughInterferometryPayloads</li>
30 * <li>noLinkToGroundStation</li>
31 * <li>communicationLoop</li>
32 * <li>incompatibleSourceAndTargetBand</li>
33 * <li>incompatibleSourceAndTargetGain</li>
34 * <li>uhfAntennaGainNotLow</li>
35 * <li>xAntennaGainNotMedium</li>
36 * <li>kaAntennaGainLow</li>
37 * <li>threeUCubeSatWithNonUhfCrossLink</li>
38 * <li>cubeSatWithKaAntenna</li>
39 * </ul>
40 *
41 * @see IQueryGroup
42 *
43 */
44@SuppressWarnings("all")
45public final class SatelliteQueries extends BaseGeneratedPatternGroup {
46 /**
47 * Access the pattern group.
48 *
49 * @return the singleton instance of the group
50 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
51 *
52 */
53 public static SatelliteQueries instance() {
54 if (INSTANCE == null) {
55 INSTANCE = new SatelliteQueries();
56 }
57 return INSTANCE;
58 }
59
60 private static SatelliteQueries INSTANCE;
61
62 private SatelliteQueries() {
63 querySpecifications.add(CommunicationLinkDoesNotStartAtContainingElement.instance());
64 querySpecifications.add(NotEnoughInterferometryPayloads.instance());
65 querySpecifications.add(NoLinkToGroundStation.instance());
66 querySpecifications.add(CommunicationLoop.instance());
67 querySpecifications.add(IncompatibleSourceAndTargetBand.instance());
68 querySpecifications.add(IncompatibleSourceAndTargetGain.instance());
69 querySpecifications.add(UhfAntennaGainNotLow.instance());
70 querySpecifications.add(XAntennaGainNotMedium.instance());
71 querySpecifications.add(KaAntennaGainLow.instance());
72 querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance());
73 querySpecifications.add(CubeSatWithKaAntenna.instance());
74 }
75
76 public CommunicationLinkDoesNotStartAtContainingElement getCommunicationLinkDoesNotStartAtContainingElement() {
77 return CommunicationLinkDoesNotStartAtContainingElement.instance();
78 }
79
80 public CommunicationLinkDoesNotStartAtContainingElement.Matcher getCommunicationLinkDoesNotStartAtContainingElement(final ViatraQueryEngine engine) {
81 return CommunicationLinkDoesNotStartAtContainingElement.Matcher.on(engine);
82 }
83
84 public NotEnoughInterferometryPayloads getNotEnoughInterferometryPayloads() {
85 return NotEnoughInterferometryPayloads.instance();
86 }
87
88 public NotEnoughInterferometryPayloads.Matcher getNotEnoughInterferometryPayloads(final ViatraQueryEngine engine) {
89 return NotEnoughInterferometryPayloads.Matcher.on(engine);
90 }
91
92 public NoLinkToGroundStation getNoLinkToGroundStation() {
93 return NoLinkToGroundStation.instance();
94 }
95
96 public NoLinkToGroundStation.Matcher getNoLinkToGroundStation(final ViatraQueryEngine engine) {
97 return NoLinkToGroundStation.Matcher.on(engine);
98 }
99
100 public CommunicationLoop getCommunicationLoop() {
101 return CommunicationLoop.instance();
102 }
103
104 public CommunicationLoop.Matcher getCommunicationLoop(final ViatraQueryEngine engine) {
105 return CommunicationLoop.Matcher.on(engine);
106 }
107
108 public IncompatibleSourceAndTargetBand getIncompatibleSourceAndTargetBand() {
109 return IncompatibleSourceAndTargetBand.instance();
110 }
111
112 public IncompatibleSourceAndTargetBand.Matcher getIncompatibleSourceAndTargetBand(final ViatraQueryEngine engine) {
113 return IncompatibleSourceAndTargetBand.Matcher.on(engine);
114 }
115
116 public IncompatibleSourceAndTargetGain getIncompatibleSourceAndTargetGain() {
117 return IncompatibleSourceAndTargetGain.instance();
118 }
119
120 public IncompatibleSourceAndTargetGain.Matcher getIncompatibleSourceAndTargetGain(final ViatraQueryEngine engine) {
121 return IncompatibleSourceAndTargetGain.Matcher.on(engine);
122 }
123
124 public UhfAntennaGainNotLow getUhfAntennaGainNotLow() {
125 return UhfAntennaGainNotLow.instance();
126 }
127
128 public UhfAntennaGainNotLow.Matcher getUhfAntennaGainNotLow(final ViatraQueryEngine engine) {
129 return UhfAntennaGainNotLow.Matcher.on(engine);
130 }
131
132 public XAntennaGainNotMedium getXAntennaGainNotMedium() {
133 return XAntennaGainNotMedium.instance();
134 }
135
136 public XAntennaGainNotMedium.Matcher getXAntennaGainNotMedium(final ViatraQueryEngine engine) {
137 return XAntennaGainNotMedium.Matcher.on(engine);
138 }
139
140 public KaAntennaGainLow getKaAntennaGainLow() {
141 return KaAntennaGainLow.instance();
142 }
143
144 public KaAntennaGainLow.Matcher getKaAntennaGainLow(final ViatraQueryEngine engine) {
145 return KaAntennaGainLow.Matcher.on(engine);
146 }
147
148 public ThreeUCubeSatWithNonUhfCrossLink getThreeUCubeSatWithNonUhfCrossLink() {
149 return ThreeUCubeSatWithNonUhfCrossLink.instance();
150 }
151
152 public ThreeUCubeSatWithNonUhfCrossLink.Matcher getThreeUCubeSatWithNonUhfCrossLink(final ViatraQueryEngine engine) {
153 return ThreeUCubeSatWithNonUhfCrossLink.Matcher.on(engine);
154 }
155
156 public CubeSatWithKaAntenna getCubeSatWithKaAntenna() {
157 return CubeSatWithKaAntenna.instance();
158 }
159
160 public CubeSatWithKaAntenna.Matcher getCubeSatWithKaAntenna(final ViatraQueryEngine engine) {
161 return CubeSatWithKaAntenna.Matcher.on(engine);
162 }
163}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java
new file mode 100644
index 00000000..6408033b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/ThreeUCubeSatWithNonUhfCrossLink.java
@@ -0,0 +1,600 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf;
8import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork;
9import java.util.Arrays;
10import java.util.Collection;
11import java.util.LinkedHashSet;
12import java.util.List;
13import java.util.Objects;
14import java.util.Optional;
15import java.util.Set;
16import java.util.function.Consumer;
17import java.util.stream.Collectors;
18import java.util.stream.Stream;
19import org.apache.log4j.Logger;
20import org.eclipse.emf.ecore.EClass;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
42import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
44import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
45
46/**
47 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
48 *
49 * <p>Original source:
50 * <code><pre>
51 * // 3U CubeSats are assumed to only be able to downlink to Earth using an X-band trasmitter,
52 * // but cross-link using UHF
53 *
54 * {@literal @}Constraint(severity = "error", key = {Sat},
55 * message = "3U CubeSats can only cross-link using UHF.")
56 * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) {
57 * CommunicatingElement.commSubsystem(Sat, SourceComm);
58 * neg find commSubsystemBandUhf(SourceComm);
59 * DirectedCommunicationLink.source(Link, SourceComm);
60 * DirectedCommunicationLink.target(Link, TargetComm);
61 * CommunicatingElement.commSubsystem(Target, TargetComm);
62 * neg find groundStationNetwork(Target);
63 * }
64 * </pre></code>
65 *
66 * @see Matcher
67 * @see Match
68 *
69 */
70@SuppressWarnings("all")
71public final class ThreeUCubeSatWithNonUhfCrossLink extends BaseGeneratedEMFQuerySpecification<ThreeUCubeSatWithNonUhfCrossLink.Matcher> {
72 /**
73 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink pattern,
74 * to be used in conjunction with {@link Matcher}.
75 *
76 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
77 * Each instance is a (possibly partial) substitution of pattern parameters,
78 * usable to represent a match of the pattern in the result of a query,
79 * or to specify the bound (fixed) input parameters when issuing a query.
80 *
81 * @see Matcher
82 *
83 */
84 public static abstract class Match extends BasePatternMatch {
85 private CubeSat3U fSat;
86
87 private static List<String> parameterNames = makeImmutableList("Sat");
88
89 private Match(final CubeSat3U pSat) {
90 this.fSat = pSat;
91 }
92
93 @Override
94 public Object get(final String parameterName) {
95 if ("Sat".equals(parameterName)) return this.fSat;
96 return null;
97 }
98
99 public CubeSat3U getSat() {
100 return this.fSat;
101 }
102
103 @Override
104 public boolean set(final String parameterName, final Object newValue) {
105 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
106 if ("Sat".equals(parameterName) ) {
107 this.fSat = (CubeSat3U) newValue;
108 return true;
109 }
110 return false;
111 }
112
113 public void setSat(final CubeSat3U pSat) {
114 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
115 this.fSat = pSat;
116 }
117
118 @Override
119 public String patternName() {
120 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink";
121 }
122
123 @Override
124 public List<String> parameterNames() {
125 return ThreeUCubeSatWithNonUhfCrossLink.Match.parameterNames;
126 }
127
128 @Override
129 public Object[] toArray() {
130 return new Object[]{fSat};
131 }
132
133 @Override
134 public ThreeUCubeSatWithNonUhfCrossLink.Match toImmutable() {
135 return isMutable() ? newMatch(fSat) : this;
136 }
137
138 @Override
139 public String prettyPrint() {
140 StringBuilder result = new StringBuilder();
141 result.append("\"Sat\"=" + prettyPrintValue(fSat));
142 return result.toString();
143 }
144
145 @Override
146 public int hashCode() {
147 return Objects.hash(fSat);
148 }
149
150 @Override
151 public boolean equals(final Object obj) {
152 if (this == obj)
153 return true;
154 if (obj == null) {
155 return false;
156 }
157 if ((obj instanceof ThreeUCubeSatWithNonUhfCrossLink.Match)) {
158 ThreeUCubeSatWithNonUhfCrossLink.Match other = (ThreeUCubeSatWithNonUhfCrossLink.Match) obj;
159 return Objects.equals(fSat, other.fSat);
160 } else {
161 // this should be infrequent
162 if (!(obj instanceof IPatternMatch)) {
163 return false;
164 }
165 IPatternMatch otherSig = (IPatternMatch) obj;
166 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
167 }
168 }
169
170 @Override
171 public ThreeUCubeSatWithNonUhfCrossLink specification() {
172 return ThreeUCubeSatWithNonUhfCrossLink.instance();
173 }
174
175 /**
176 * Returns an empty, mutable match.
177 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
178 *
179 * @return the empty match.
180 *
181 */
182 public static ThreeUCubeSatWithNonUhfCrossLink.Match newEmptyMatch() {
183 return new Mutable(null);
184 }
185
186 /**
187 * Returns a mutable (partial) match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 *
190 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
191 * @return the new, mutable (partial) match object.
192 *
193 */
194 public static ThreeUCubeSatWithNonUhfCrossLink.Match newMutableMatch(final CubeSat3U pSat) {
195 return new Mutable(pSat);
196 }
197
198 /**
199 * Returns a new (partial) match.
200 * This can be used e.g. to call the matcher with a partial match.
201 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
202 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
203 * @return the (partial) match object.
204 *
205 */
206 public static ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) {
207 return new Immutable(pSat);
208 }
209
210 private static final class Mutable extends ThreeUCubeSatWithNonUhfCrossLink.Match {
211 Mutable(final CubeSat3U pSat) {
212 super(pSat);
213 }
214
215 @Override
216 public boolean isMutable() {
217 return true;
218 }
219 }
220
221 private static final class Immutable extends ThreeUCubeSatWithNonUhfCrossLink.Match {
222 Immutable(final CubeSat3U pSat) {
223 super(pSat);
224 }
225
226 @Override
227 public boolean isMutable() {
228 return false;
229 }
230 }
231 }
232
233 /**
234 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink pattern,
235 * providing pattern-specific query methods.
236 *
237 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
238 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
239 *
240 * <p>Matches of the pattern will be represented as {@link Match}.
241 *
242 * <p>Original source:
243 * <code><pre>
244 * // 3U CubeSats are assumed to only be able to downlink to Earth using an X-band trasmitter,
245 * // but cross-link using UHF
246 *
247 * {@literal @}Constraint(severity = "error", key = {Sat},
248 * message = "3U CubeSats can only cross-link using UHF.")
249 * pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) {
250 * CommunicatingElement.commSubsystem(Sat, SourceComm);
251 * neg find commSubsystemBandUhf(SourceComm);
252 * DirectedCommunicationLink.source(Link, SourceComm);
253 * DirectedCommunicationLink.target(Link, TargetComm);
254 * CommunicatingElement.commSubsystem(Target, TargetComm);
255 * neg find groundStationNetwork(Target);
256 * }
257 * </pre></code>
258 *
259 * @see Match
260 * @see ThreeUCubeSatWithNonUhfCrossLink
261 *
262 */
263 public static class Matcher extends BaseMatcher<ThreeUCubeSatWithNonUhfCrossLink.Match> {
264 /**
265 * Initializes the pattern matcher within an existing VIATRA Query engine.
266 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
267 *
268 * @param engine the existing VIATRA Query engine in which this matcher will be created.
269 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
270 *
271 */
272 public static ThreeUCubeSatWithNonUhfCrossLink.Matcher on(final ViatraQueryEngine engine) {
273 // check if matcher already exists
274 Matcher matcher = engine.getExistingMatcher(querySpecification());
275 if (matcher == null) {
276 matcher = (Matcher)engine.getMatcher(querySpecification());
277 }
278 return matcher;
279 }
280
281 /**
282 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
283 * @return an initialized matcher
284 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
285 *
286 */
287 public static ThreeUCubeSatWithNonUhfCrossLink.Matcher create() {
288 return new Matcher();
289 }
290
291 private static final int POSITION_SAT = 0;
292
293 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ThreeUCubeSatWithNonUhfCrossLink.Matcher.class);
294
295 /**
296 * Initializes the pattern matcher within an existing VIATRA Query engine.
297 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
298 *
299 * @param engine the existing VIATRA Query engine in which this matcher will be created.
300 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
301 *
302 */
303 private Matcher() {
304 super(querySpecification());
305 }
306
307 /**
308 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
309 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
310 * @return matches represented as a Match object.
311 *
312 */
313 public Collection<ThreeUCubeSatWithNonUhfCrossLink.Match> getAllMatches(final CubeSat3U pSat) {
314 return rawStreamAllMatches(new Object[]{pSat}).collect(Collectors.toSet());
315 }
316
317 /**
318 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
319 * </p>
320 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
321 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
322 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
323 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
324 * @return a stream of matches represented as a Match object.
325 *
326 */
327 public Stream<ThreeUCubeSatWithNonUhfCrossLink.Match> streamAllMatches(final CubeSat3U pSat) {
328 return rawStreamAllMatches(new Object[]{pSat});
329 }
330
331 /**
332 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
333 * Neither determinism nor randomness of selection is guaranteed.
334 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
335 * @return a match represented as a Match object, or null if no match is found.
336 *
337 */
338 public Optional<ThreeUCubeSatWithNonUhfCrossLink.Match> getOneArbitraryMatch(final CubeSat3U pSat) {
339 return rawGetOneArbitraryMatch(new Object[]{pSat});
340 }
341
342 /**
343 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
344 * under any possible substitution of the unspecified parameters (if any).
345 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
346 * @return true if the input is a valid (partial) match of the pattern.
347 *
348 */
349 public boolean hasMatch(final CubeSat3U pSat) {
350 return rawHasMatch(new Object[]{pSat});
351 }
352
353 /**
354 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
355 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
356 * @return the number of pattern matches found.
357 *
358 */
359 public int countMatches(final CubeSat3U pSat) {
360 return rawCountMatches(new Object[]{pSat});
361 }
362
363 /**
364 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
365 * Neither determinism nor randomness of selection is guaranteed.
366 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
367 * @param processor the action that will process the selected match.
368 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
369 *
370 */
371 public boolean forOneArbitraryMatch(final CubeSat3U pSat, final Consumer<? super ThreeUCubeSatWithNonUhfCrossLink.Match> processor) {
372 return rawForOneArbitraryMatch(new Object[]{pSat}, processor);
373 }
374
375 /**
376 * Returns a new (partial) match.
377 * This can be used e.g. to call the matcher with a partial match.
378 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
379 * @param pSat the fixed value of pattern parameter Sat, or null if not bound.
380 * @return the (partial) match object.
381 *
382 */
383 public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final CubeSat3U pSat) {
384 return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch(pSat);
385 }
386
387 /**
388 * Retrieve the set of values that occur in matches for Sat.
389 * @return the Set of all values or empty set if there are no matches
390 *
391 */
392 protected Stream<CubeSat3U> rawStreamAllValuesOfSat(final Object[] parameters) {
393 return rawStreamAllValues(POSITION_SAT, parameters).map(CubeSat3U.class::cast);
394 }
395
396 /**
397 * Retrieve the set of values that occur in matches for Sat.
398 * @return the Set of all values or empty set if there are no matches
399 *
400 */
401 public Set<CubeSat3U> getAllValuesOfSat() {
402 return rawStreamAllValuesOfSat(emptyArray()).collect(Collectors.toSet());
403 }
404
405 /**
406 * Retrieve the set of values that occur in matches for Sat.
407 * @return the Set of all values or empty set if there are no matches
408 *
409 */
410 public Stream<CubeSat3U> streamAllValuesOfSat() {
411 return rawStreamAllValuesOfSat(emptyArray());
412 }
413
414 @Override
415 protected ThreeUCubeSatWithNonUhfCrossLink.Match tupleToMatch(final Tuple t) {
416 try {
417 return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) t.get(POSITION_SAT));
418 } catch(ClassCastException e) {
419 LOGGER.error("Element(s) in tuple not properly typed!",e);
420 return null;
421 }
422 }
423
424 @Override
425 protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatch(final Object[] match) {
426 try {
427 return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((CubeSat3U) match[POSITION_SAT]);
428 } catch(ClassCastException e) {
429 LOGGER.error("Element(s) in array not properly typed!",e);
430 return null;
431 }
432 }
433
434 @Override
435 protected ThreeUCubeSatWithNonUhfCrossLink.Match arrayToMatchMutable(final Object[] match) {
436 try {
437 return ThreeUCubeSatWithNonUhfCrossLink.Match.newMutableMatch((CubeSat3U) match[POSITION_SAT]);
438 } catch(ClassCastException e) {
439 LOGGER.error("Element(s) in array not properly typed!",e);
440 return null;
441 }
442 }
443
444 /**
445 * @return the singleton instance of the query specification of this pattern
446 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
447 *
448 */
449 public static IQuerySpecification<ThreeUCubeSatWithNonUhfCrossLink.Matcher> querySpecification() {
450 return ThreeUCubeSatWithNonUhfCrossLink.instance();
451 }
452 }
453
454 private ThreeUCubeSatWithNonUhfCrossLink() {
455 super(GeneratedPQuery.INSTANCE);
456 }
457
458 /**
459 * @return the singleton instance of the query specification
460 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
461 *
462 */
463 public static ThreeUCubeSatWithNonUhfCrossLink instance() {
464 try{
465 return LazyHolder.INSTANCE;
466 } catch (ExceptionInInitializerError err) {
467 throw processInitializerError(err);
468 }
469 }
470
471 @Override
472 protected ThreeUCubeSatWithNonUhfCrossLink.Matcher instantiate(final ViatraQueryEngine engine) {
473 return ThreeUCubeSatWithNonUhfCrossLink.Matcher.on(engine);
474 }
475
476 @Override
477 public ThreeUCubeSatWithNonUhfCrossLink.Matcher instantiate() {
478 return ThreeUCubeSatWithNonUhfCrossLink.Matcher.create();
479 }
480
481 @Override
482 public ThreeUCubeSatWithNonUhfCrossLink.Match newEmptyMatch() {
483 return ThreeUCubeSatWithNonUhfCrossLink.Match.newEmptyMatch();
484 }
485
486 @Override
487 public ThreeUCubeSatWithNonUhfCrossLink.Match newMatch(final Object... parameters) {
488 return ThreeUCubeSatWithNonUhfCrossLink.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U) parameters[0]);
489 }
490
491 /**
492 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink (visibility: PUBLIC, simpleName: ThreeUCubeSatWithNonUhfCrossLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
493 * <b>not</b> at the class load time of the outer class,
494 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink (visibility: PUBLIC, simpleName: ThreeUCubeSatWithNonUhfCrossLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
495 *
496 * <p> This workaround is required e.g. to support recursion.
497 *
498 */
499 private static class LazyHolder {
500 private static final ThreeUCubeSatWithNonUhfCrossLink INSTANCE = new ThreeUCubeSatWithNonUhfCrossLink();
501
502 /**
503 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
504 * This initialization order is required to support indirect recursion.
505 *
506 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
507 *
508 */
509 private static final Object STATIC_INITIALIZER = ensureInitialized();
510
511 public static Object ensureInitialized() {
512 INSTANCE.ensureInitializedInternal();
513 return null;
514 }
515 }
516
517 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
518 private static final ThreeUCubeSatWithNonUhfCrossLink.GeneratedPQuery INSTANCE = new GeneratedPQuery();
519
520 private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.CubeSat3U", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CubeSat3U")), PParameterDirection.INOUT);
521
522 private final List<PParameter> parameters = Arrays.asList(parameter_Sat);
523
524 private GeneratedPQuery() {
525 super(PVisibility.PUBLIC);
526 }
527
528 @Override
529 public String getFullyQualifiedName() {
530 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.threeUCubeSatWithNonUhfCrossLink";
531 }
532
533 @Override
534 public List<String> getParameterNames() {
535 return Arrays.asList("Sat");
536 }
537
538 @Override
539 public List<PParameter> getParameters() {
540 return parameters;
541 }
542
543 @Override
544 public Set<PBody> doGetContainedBodies() {
545 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
546 Set<PBody> bodies = new LinkedHashSet<>();
547 {
548 PBody body = new PBody(this);
549 PVariable var_Sat = body.getOrCreateVariableByName("Sat");
550 PVariable var_SourceComm = body.getOrCreateVariableByName("SourceComm");
551 PVariable var_Link = body.getOrCreateVariableByName("Link");
552 PVariable var_TargetComm = body.getOrCreateVariableByName("TargetComm");
553 PVariable var_Target = body.getOrCreateVariableByName("Target");
554 new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CubeSat3U")));
555 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
556 new ExportedParameter(body, var_Sat, parameter_Sat)
557 ));
558 // CommunicatingElement.commSubsystem(Sat, SourceComm)
559 new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
560 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
561 new TypeConstraint(body, Tuples.flatTupleOf(var_Sat, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
562 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
563 new Equality(body, var__virtual_0_, var_SourceComm);
564 // neg find commSubsystemBandUhf(SourceComm)
565 new NegativePatternCall(body, Tuples.flatTupleOf(var_SourceComm), CommSubsystemBandUhf.instance().getInternalQueryRepresentation());
566 // DirectedCommunicationLink.source(Link, SourceComm)
567 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
568 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
569 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source")));
570 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
571 new Equality(body, var__virtual_1_, var_SourceComm);
572 // DirectedCommunicationLink.target(Link, TargetComm)
573 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
574 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
575 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target")));
576 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
577 new Equality(body, var__virtual_2_, var_TargetComm);
578 // CommunicatingElement.commSubsystem(Target, TargetComm)
579 new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
580 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
581 new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
582 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
583 new Equality(body, var__virtual_3_, var_TargetComm);
584 // neg find groundStationNetwork(Target)
585 new NegativePatternCall(body, Tuples.flatTupleOf(var_Target), GroundStationNetwork.instance().getInternalQueryRepresentation());
586 bodies.add(body);
587 }
588 {
589 PAnnotation annotation = new PAnnotation("Constraint");
590 annotation.addAttribute("severity", "error");
591 annotation.addAttribute("key", Arrays.asList(new Object[] {
592 new ParameterReference("Sat")
593 }));
594 annotation.addAttribute("message", "3U CubeSats can only cross-link using UHF.");
595 addAnnotation(annotation);
596 }
597 return bodies;
598 }
599 }
600}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java
new file mode 100644
index 00000000..62222ded
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/UhfAntennaGainNotLow.java
@@ -0,0 +1,576 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.emf.ecore.EDataType;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
30import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47
48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 *
51 * <p>Original source:
52 * <code><pre>
53 * // UHF-band transmitters may only be combined with a low gain antenna
54 *
55 * {@literal @}Constraint(severity = "error", key = {Comm},
56 * message = "UHF transceiver must be combined with a low gain antenna.")
57 * pattern uhfAntennaGainNotLow(Comm : CommSubsystem) {
58 * CommSubsystem.band(Comm, TransceiverBand::UHF);
59 * // VIATRA will fail to infer a type constraint for the virtual variable introduced
60 * // when an enum literal appears in a negative pattern call, so we use a helper pattern
61 * // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW);
62 * neg find commSubsystemGainLow(Comm);
63 * }
64 * </pre></code>
65 *
66 * @see Matcher
67 * @see Match
68 *
69 */
70@SuppressWarnings("all")
71public final class UhfAntennaGainNotLow extends BaseGeneratedEMFQuerySpecification<UhfAntennaGainNotLow.Matcher> {
72 /**
73 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow pattern,
74 * to be used in conjunction with {@link Matcher}.
75 *
76 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
77 * Each instance is a (possibly partial) substitution of pattern parameters,
78 * usable to represent a match of the pattern in the result of a query,
79 * or to specify the bound (fixed) input parameters when issuing a query.
80 *
81 * @see Matcher
82 *
83 */
84 public static abstract class Match extends BasePatternMatch {
85 private CommSubsystem fComm;
86
87 private static List<String> parameterNames = makeImmutableList("Comm");
88
89 private Match(final CommSubsystem pComm) {
90 this.fComm = pComm;
91 }
92
93 @Override
94 public Object get(final String parameterName) {
95 if ("Comm".equals(parameterName)) return this.fComm;
96 return null;
97 }
98
99 public CommSubsystem getComm() {
100 return this.fComm;
101 }
102
103 @Override
104 public boolean set(final String parameterName, final Object newValue) {
105 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
106 if ("Comm".equals(parameterName) ) {
107 this.fComm = (CommSubsystem) newValue;
108 return true;
109 }
110 return false;
111 }
112
113 public void setComm(final CommSubsystem pComm) {
114 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
115 this.fComm = pComm;
116 }
117
118 @Override
119 public String patternName() {
120 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow";
121 }
122
123 @Override
124 public List<String> parameterNames() {
125 return UhfAntennaGainNotLow.Match.parameterNames;
126 }
127
128 @Override
129 public Object[] toArray() {
130 return new Object[]{fComm};
131 }
132
133 @Override
134 public UhfAntennaGainNotLow.Match toImmutable() {
135 return isMutable() ? newMatch(fComm) : this;
136 }
137
138 @Override
139 public String prettyPrint() {
140 StringBuilder result = new StringBuilder();
141 result.append("\"Comm\"=" + prettyPrintValue(fComm));
142 return result.toString();
143 }
144
145 @Override
146 public int hashCode() {
147 return Objects.hash(fComm);
148 }
149
150 @Override
151 public boolean equals(final Object obj) {
152 if (this == obj)
153 return true;
154 if (obj == null) {
155 return false;
156 }
157 if ((obj instanceof UhfAntennaGainNotLow.Match)) {
158 UhfAntennaGainNotLow.Match other = (UhfAntennaGainNotLow.Match) obj;
159 return Objects.equals(fComm, other.fComm);
160 } else {
161 // this should be infrequent
162 if (!(obj instanceof IPatternMatch)) {
163 return false;
164 }
165 IPatternMatch otherSig = (IPatternMatch) obj;
166 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
167 }
168 }
169
170 @Override
171 public UhfAntennaGainNotLow specification() {
172 return UhfAntennaGainNotLow.instance();
173 }
174
175 /**
176 * Returns an empty, mutable match.
177 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
178 *
179 * @return the empty match.
180 *
181 */
182 public static UhfAntennaGainNotLow.Match newEmptyMatch() {
183 return new Mutable(null);
184 }
185
186 /**
187 * Returns a mutable (partial) match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 *
190 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
191 * @return the new, mutable (partial) match object.
192 *
193 */
194 public static UhfAntennaGainNotLow.Match newMutableMatch(final CommSubsystem pComm) {
195 return new Mutable(pComm);
196 }
197
198 /**
199 * Returns a new (partial) match.
200 * This can be used e.g. to call the matcher with a partial match.
201 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
202 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
203 * @return the (partial) match object.
204 *
205 */
206 public static UhfAntennaGainNotLow.Match newMatch(final CommSubsystem pComm) {
207 return new Immutable(pComm);
208 }
209
210 private static final class Mutable extends UhfAntennaGainNotLow.Match {
211 Mutable(final CommSubsystem pComm) {
212 super(pComm);
213 }
214
215 @Override
216 public boolean isMutable() {
217 return true;
218 }
219 }
220
221 private static final class Immutable extends UhfAntennaGainNotLow.Match {
222 Immutable(final CommSubsystem pComm) {
223 super(pComm);
224 }
225
226 @Override
227 public boolean isMutable() {
228 return false;
229 }
230 }
231 }
232
233 /**
234 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow pattern,
235 * providing pattern-specific query methods.
236 *
237 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
238 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
239 *
240 * <p>Matches of the pattern will be represented as {@link Match}.
241 *
242 * <p>Original source:
243 * <code><pre>
244 * // UHF-band transmitters may only be combined with a low gain antenna
245 *
246 * {@literal @}Constraint(severity = "error", key = {Comm},
247 * message = "UHF transceiver must be combined with a low gain antenna.")
248 * pattern uhfAntennaGainNotLow(Comm : CommSubsystem) {
249 * CommSubsystem.band(Comm, TransceiverBand::UHF);
250 * // VIATRA will fail to infer a type constraint for the virtual variable introduced
251 * // when an enum literal appears in a negative pattern call, so we use a helper pattern
252 * // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW);
253 * neg find commSubsystemGainLow(Comm);
254 * }
255 * </pre></code>
256 *
257 * @see Match
258 * @see UhfAntennaGainNotLow
259 *
260 */
261 public static class Matcher extends BaseMatcher<UhfAntennaGainNotLow.Match> {
262 /**
263 * Initializes the pattern matcher within an existing VIATRA Query engine.
264 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
265 *
266 * @param engine the existing VIATRA Query engine in which this matcher will be created.
267 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
268 *
269 */
270 public static UhfAntennaGainNotLow.Matcher on(final ViatraQueryEngine engine) {
271 // check if matcher already exists
272 Matcher matcher = engine.getExistingMatcher(querySpecification());
273 if (matcher == null) {
274 matcher = (Matcher)engine.getMatcher(querySpecification());
275 }
276 return matcher;
277 }
278
279 /**
280 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
281 * @return an initialized matcher
282 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
283 *
284 */
285 public static UhfAntennaGainNotLow.Matcher create() {
286 return new Matcher();
287 }
288
289 private static final int POSITION_COMM = 0;
290
291 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(UhfAntennaGainNotLow.Matcher.class);
292
293 /**
294 * Initializes the pattern matcher within an existing VIATRA Query engine.
295 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
296 *
297 * @param engine the existing VIATRA Query engine in which this matcher will be created.
298 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
299 *
300 */
301 private Matcher() {
302 super(querySpecification());
303 }
304
305 /**
306 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
307 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
308 * @return matches represented as a Match object.
309 *
310 */
311 public Collection<UhfAntennaGainNotLow.Match> getAllMatches(final CommSubsystem pComm) {
312 return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet());
313 }
314
315 /**
316 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
317 * </p>
318 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
319 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
320 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
321 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
322 * @return a stream of matches represented as a Match object.
323 *
324 */
325 public Stream<UhfAntennaGainNotLow.Match> streamAllMatches(final CommSubsystem pComm) {
326 return rawStreamAllMatches(new Object[]{pComm});
327 }
328
329 /**
330 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
331 * Neither determinism nor randomness of selection is guaranteed.
332 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
333 * @return a match represented as a Match object, or null if no match is found.
334 *
335 */
336 public Optional<UhfAntennaGainNotLow.Match> getOneArbitraryMatch(final CommSubsystem pComm) {
337 return rawGetOneArbitraryMatch(new Object[]{pComm});
338 }
339
340 /**
341 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
342 * under any possible substitution of the unspecified parameters (if any).
343 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
344 * @return true if the input is a valid (partial) match of the pattern.
345 *
346 */
347 public boolean hasMatch(final CommSubsystem pComm) {
348 return rawHasMatch(new Object[]{pComm});
349 }
350
351 /**
352 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
353 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
354 * @return the number of pattern matches found.
355 *
356 */
357 public int countMatches(final CommSubsystem pComm) {
358 return rawCountMatches(new Object[]{pComm});
359 }
360
361 /**
362 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
363 * Neither determinism nor randomness of selection is guaranteed.
364 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
365 * @param processor the action that will process the selected match.
366 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
367 *
368 */
369 public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super UhfAntennaGainNotLow.Match> processor) {
370 return rawForOneArbitraryMatch(new Object[]{pComm}, processor);
371 }
372
373 /**
374 * Returns a new (partial) match.
375 * This can be used e.g. to call the matcher with a partial match.
376 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
377 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
378 * @return the (partial) match object.
379 *
380 */
381 public UhfAntennaGainNotLow.Match newMatch(final CommSubsystem pComm) {
382 return UhfAntennaGainNotLow.Match.newMatch(pComm);
383 }
384
385 /**
386 * Retrieve the set of values that occur in matches for Comm.
387 * @return the Set of all values or empty set if there are no matches
388 *
389 */
390 protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) {
391 return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast);
392 }
393
394 /**
395 * Retrieve the set of values that occur in matches for Comm.
396 * @return the Set of all values or empty set if there are no matches
397 *
398 */
399 public Set<CommSubsystem> getAllValuesOfComm() {
400 return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet());
401 }
402
403 /**
404 * Retrieve the set of values that occur in matches for Comm.
405 * @return the Set of all values or empty set if there are no matches
406 *
407 */
408 public Stream<CommSubsystem> streamAllValuesOfComm() {
409 return rawStreamAllValuesOfComm(emptyArray());
410 }
411
412 @Override
413 protected UhfAntennaGainNotLow.Match tupleToMatch(final Tuple t) {
414 try {
415 return UhfAntennaGainNotLow.Match.newMatch((CommSubsystem) t.get(POSITION_COMM));
416 } catch(ClassCastException e) {
417 LOGGER.error("Element(s) in tuple not properly typed!",e);
418 return null;
419 }
420 }
421
422 @Override
423 protected UhfAntennaGainNotLow.Match arrayToMatch(final Object[] match) {
424 try {
425 return UhfAntennaGainNotLow.Match.newMatch((CommSubsystem) match[POSITION_COMM]);
426 } catch(ClassCastException e) {
427 LOGGER.error("Element(s) in array not properly typed!",e);
428 return null;
429 }
430 }
431
432 @Override
433 protected UhfAntennaGainNotLow.Match arrayToMatchMutable(final Object[] match) {
434 try {
435 return UhfAntennaGainNotLow.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]);
436 } catch(ClassCastException e) {
437 LOGGER.error("Element(s) in array not properly typed!",e);
438 return null;
439 }
440 }
441
442 /**
443 * @return the singleton instance of the query specification of this pattern
444 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
445 *
446 */
447 public static IQuerySpecification<UhfAntennaGainNotLow.Matcher> querySpecification() {
448 return UhfAntennaGainNotLow.instance();
449 }
450 }
451
452 private UhfAntennaGainNotLow() {
453 super(GeneratedPQuery.INSTANCE);
454 }
455
456 /**
457 * @return the singleton instance of the query specification
458 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
459 *
460 */
461 public static UhfAntennaGainNotLow instance() {
462 try{
463 return LazyHolder.INSTANCE;
464 } catch (ExceptionInInitializerError err) {
465 throw processInitializerError(err);
466 }
467 }
468
469 @Override
470 protected UhfAntennaGainNotLow.Matcher instantiate(final ViatraQueryEngine engine) {
471 return UhfAntennaGainNotLow.Matcher.on(engine);
472 }
473
474 @Override
475 public UhfAntennaGainNotLow.Matcher instantiate() {
476 return UhfAntennaGainNotLow.Matcher.create();
477 }
478
479 @Override
480 public UhfAntennaGainNotLow.Match newEmptyMatch() {
481 return UhfAntennaGainNotLow.Match.newEmptyMatch();
482 }
483
484 @Override
485 public UhfAntennaGainNotLow.Match newMatch(final Object... parameters) {
486 return UhfAntennaGainNotLow.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem) parameters[0]);
487 }
488
489 /**
490 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow (visibility: PUBLIC, simpleName: UhfAntennaGainNotLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
491 * <b>not</b> at the class load time of the outer class,
492 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow (visibility: PUBLIC, simpleName: UhfAntennaGainNotLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
493 *
494 * <p> This workaround is required e.g. to support recursion.
495 *
496 */
497 private static class LazyHolder {
498 private static final UhfAntennaGainNotLow INSTANCE = new UhfAntennaGainNotLow();
499
500 /**
501 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
502 * This initialization order is required to support indirect recursion.
503 *
504 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
505 *
506 */
507 private static final Object STATIC_INITIALIZER = ensureInitialized();
508
509 public static Object ensureInitialized() {
510 INSTANCE.ensureInitializedInternal();
511 return null;
512 }
513 }
514
515 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
516 private static final UhfAntennaGainNotLow.GeneratedPQuery INSTANCE = new GeneratedPQuery();
517
518 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
519
520 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
521
522 private GeneratedPQuery() {
523 super(PVisibility.PUBLIC);
524 }
525
526 @Override
527 public String getFullyQualifiedName() {
528 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.uhfAntennaGainNotLow";
529 }
530
531 @Override
532 public List<String> getParameterNames() {
533 return Arrays.asList("Comm");
534 }
535
536 @Override
537 public List<PParameter> getParameters() {
538 return parameters;
539 }
540
541 @Override
542 public Set<PBody> doGetContainedBodies() {
543 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
544 Set<PBody> bodies = new LinkedHashSet<>();
545 {
546 PBody body = new PBody(this);
547 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
548 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
549 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
550 new ExportedParameter(body, var_Comm, parameter_Comm)
551 ));
552 // CommSubsystem.band(Comm, TransceiverBand::UHF)
553 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
554 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance());
555 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
556 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
557 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
558 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
559 new Equality(body, var__virtual_1_, var__virtual_0_);
560 // // VIATRA will fail to infer a type constraint for the virtual variable introduced // when an enum literal appears in a negative pattern call, so we use a helper pattern // instead of neg find commSubsystemGain(Comm, AntennaGain::LOW); neg find commSubsystemGainLow(Comm)
561 new NegativePatternCall(body, Tuples.flatTupleOf(var_Comm), CommSubsystemGainLow.instance().getInternalQueryRepresentation());
562 bodies.add(body);
563 }
564 {
565 PAnnotation annotation = new PAnnotation("Constraint");
566 annotation.addAttribute("severity", "error");
567 annotation.addAttribute("key", Arrays.asList(new Object[] {
568 new ParameterReference("Comm")
569 }));
570 annotation.addAttribute("message", "UHF transceiver must be combined with a low gain antenna.");
571 addAnnotation(annotation);
572 }
573 return bodies;
574 }
575 }
576}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java
new file mode 100644
index 00000000..dbe6d26e
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/XAntennaGainNotMedium.java
@@ -0,0 +1,570 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.emf.ecore.EDataType;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
30import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
40import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
43import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
45import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
46import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
47
48/**
49 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
50 *
51 * <p>Original source:
52 * <code><pre>
53 * // X-band transmitters may only be combined with a medium gain antenna
54 *
55 * {@literal @}Constraint(severity = "error", key = {Comm},
56 * message = "X-band transceiver must be combined with a medium gain antenna.")
57 * pattern xAntennaGainNotMedium(Comm : CommSubsystem) {
58 * CommSubsystem.band(Comm, TransceiverBand::X);
59 * neg find commSubsystemGainMedium(Comm);
60 * }
61 * </pre></code>
62 *
63 * @see Matcher
64 * @see Match
65 *
66 */
67@SuppressWarnings("all")
68public final class XAntennaGainNotMedium extends BaseGeneratedEMFQuerySpecification<XAntennaGainNotMedium.Matcher> {
69 /**
70 * Pattern-specific match representation of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium pattern,
71 * to be used in conjunction with {@link Matcher}.
72 *
73 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
74 * Each instance is a (possibly partial) substitution of pattern parameters,
75 * usable to represent a match of the pattern in the result of a query,
76 * or to specify the bound (fixed) input parameters when issuing a query.
77 *
78 * @see Matcher
79 *
80 */
81 public static abstract class Match extends BasePatternMatch {
82 private CommSubsystem fComm;
83
84 private static List<String> parameterNames = makeImmutableList("Comm");
85
86 private Match(final CommSubsystem pComm) {
87 this.fComm = pComm;
88 }
89
90 @Override
91 public Object get(final String parameterName) {
92 if ("Comm".equals(parameterName)) return this.fComm;
93 return null;
94 }
95
96 public CommSubsystem getComm() {
97 return this.fComm;
98 }
99
100 @Override
101 public boolean set(final String parameterName, final Object newValue) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 if ("Comm".equals(parameterName) ) {
104 this.fComm = (CommSubsystem) newValue;
105 return true;
106 }
107 return false;
108 }
109
110 public void setComm(final CommSubsystem pComm) {
111 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
112 this.fComm = pComm;
113 }
114
115 @Override
116 public String patternName() {
117 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium";
118 }
119
120 @Override
121 public List<String> parameterNames() {
122 return XAntennaGainNotMedium.Match.parameterNames;
123 }
124
125 @Override
126 public Object[] toArray() {
127 return new Object[]{fComm};
128 }
129
130 @Override
131 public XAntennaGainNotMedium.Match toImmutable() {
132 return isMutable() ? newMatch(fComm) : this;
133 }
134
135 @Override
136 public String prettyPrint() {
137 StringBuilder result = new StringBuilder();
138 result.append("\"Comm\"=" + prettyPrintValue(fComm));
139 return result.toString();
140 }
141
142 @Override
143 public int hashCode() {
144 return Objects.hash(fComm);
145 }
146
147 @Override
148 public boolean equals(final Object obj) {
149 if (this == obj)
150 return true;
151 if (obj == null) {
152 return false;
153 }
154 if ((obj instanceof XAntennaGainNotMedium.Match)) {
155 XAntennaGainNotMedium.Match other = (XAntennaGainNotMedium.Match) obj;
156 return Objects.equals(fComm, other.fComm);
157 } else {
158 // this should be infrequent
159 if (!(obj instanceof IPatternMatch)) {
160 return false;
161 }
162 IPatternMatch otherSig = (IPatternMatch) obj;
163 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
164 }
165 }
166
167 @Override
168 public XAntennaGainNotMedium specification() {
169 return XAntennaGainNotMedium.instance();
170 }
171
172 /**
173 * Returns an empty, mutable match.
174 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
175 *
176 * @return the empty match.
177 *
178 */
179 public static XAntennaGainNotMedium.Match newEmptyMatch() {
180 return new Mutable(null);
181 }
182
183 /**
184 * Returns a mutable (partial) match.
185 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
186 *
187 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
188 * @return the new, mutable (partial) match object.
189 *
190 */
191 public static XAntennaGainNotMedium.Match newMutableMatch(final CommSubsystem pComm) {
192 return new Mutable(pComm);
193 }
194
195 /**
196 * Returns a new (partial) match.
197 * This can be used e.g. to call the matcher with a partial match.
198 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
199 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
200 * @return the (partial) match object.
201 *
202 */
203 public static XAntennaGainNotMedium.Match newMatch(final CommSubsystem pComm) {
204 return new Immutable(pComm);
205 }
206
207 private static final class Mutable extends XAntennaGainNotMedium.Match {
208 Mutable(final CommSubsystem pComm) {
209 super(pComm);
210 }
211
212 @Override
213 public boolean isMutable() {
214 return true;
215 }
216 }
217
218 private static final class Immutable extends XAntennaGainNotMedium.Match {
219 Immutable(final CommSubsystem pComm) {
220 super(pComm);
221 }
222
223 @Override
224 public boolean isMutable() {
225 return false;
226 }
227 }
228 }
229
230 /**
231 * Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium pattern,
232 * providing pattern-specific query methods.
233 *
234 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
235 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
236 *
237 * <p>Matches of the pattern will be represented as {@link Match}.
238 *
239 * <p>Original source:
240 * <code><pre>
241 * // X-band transmitters may only be combined with a medium gain antenna
242 *
243 * {@literal @}Constraint(severity = "error", key = {Comm},
244 * message = "X-band transceiver must be combined with a medium gain antenna.")
245 * pattern xAntennaGainNotMedium(Comm : CommSubsystem) {
246 * CommSubsystem.band(Comm, TransceiverBand::X);
247 * neg find commSubsystemGainMedium(Comm);
248 * }
249 * </pre></code>
250 *
251 * @see Match
252 * @see XAntennaGainNotMedium
253 *
254 */
255 public static class Matcher extends BaseMatcher<XAntennaGainNotMedium.Match> {
256 /**
257 * Initializes the pattern matcher within an existing VIATRA Query engine.
258 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
259 *
260 * @param engine the existing VIATRA Query engine in which this matcher will be created.
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 *
263 */
264 public static XAntennaGainNotMedium.Matcher on(final ViatraQueryEngine engine) {
265 // check if matcher already exists
266 Matcher matcher = engine.getExistingMatcher(querySpecification());
267 if (matcher == null) {
268 matcher = (Matcher)engine.getMatcher(querySpecification());
269 }
270 return matcher;
271 }
272
273 /**
274 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
275 * @return an initialized matcher
276 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
277 *
278 */
279 public static XAntennaGainNotMedium.Matcher create() {
280 return new Matcher();
281 }
282
283 private static final int POSITION_COMM = 0;
284
285 private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(XAntennaGainNotMedium.Matcher.class);
286
287 /**
288 * Initializes the pattern matcher within an existing VIATRA Query engine.
289 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
290 *
291 * @param engine the existing VIATRA Query engine in which this matcher will be created.
292 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
293 *
294 */
295 private Matcher() {
296 super(querySpecification());
297 }
298
299 /**
300 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
301 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
302 * @return matches represented as a Match object.
303 *
304 */
305 public Collection<XAntennaGainNotMedium.Match> getAllMatches(final CommSubsystem pComm) {
306 return rawStreamAllMatches(new Object[]{pComm}).collect(Collectors.toSet());
307 }
308
309 /**
310 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
311 * </p>
312 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
313 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
314 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
315 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
316 * @return a stream of matches represented as a Match object.
317 *
318 */
319 public Stream<XAntennaGainNotMedium.Match> streamAllMatches(final CommSubsystem pComm) {
320 return rawStreamAllMatches(new Object[]{pComm});
321 }
322
323 /**
324 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
325 * Neither determinism nor randomness of selection is guaranteed.
326 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
327 * @return a match represented as a Match object, or null if no match is found.
328 *
329 */
330 public Optional<XAntennaGainNotMedium.Match> getOneArbitraryMatch(final CommSubsystem pComm) {
331 return rawGetOneArbitraryMatch(new Object[]{pComm});
332 }
333
334 /**
335 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
336 * under any possible substitution of the unspecified parameters (if any).
337 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
338 * @return true if the input is a valid (partial) match of the pattern.
339 *
340 */
341 public boolean hasMatch(final CommSubsystem pComm) {
342 return rawHasMatch(new Object[]{pComm});
343 }
344
345 /**
346 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
347 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
348 * @return the number of pattern matches found.
349 *
350 */
351 public int countMatches(final CommSubsystem pComm) {
352 return rawCountMatches(new Object[]{pComm});
353 }
354
355 /**
356 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
357 * Neither determinism nor randomness of selection is guaranteed.
358 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
359 * @param processor the action that will process the selected match.
360 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
361 *
362 */
363 public boolean forOneArbitraryMatch(final CommSubsystem pComm, final Consumer<? super XAntennaGainNotMedium.Match> processor) {
364 return rawForOneArbitraryMatch(new Object[]{pComm}, processor);
365 }
366
367 /**
368 * Returns a new (partial) match.
369 * This can be used e.g. to call the matcher with a partial match.
370 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
371 * @param pComm the fixed value of pattern parameter Comm, or null if not bound.
372 * @return the (partial) match object.
373 *
374 */
375 public XAntennaGainNotMedium.Match newMatch(final CommSubsystem pComm) {
376 return XAntennaGainNotMedium.Match.newMatch(pComm);
377 }
378
379 /**
380 * Retrieve the set of values that occur in matches for Comm.
381 * @return the Set of all values or empty set if there are no matches
382 *
383 */
384 protected Stream<CommSubsystem> rawStreamAllValuesOfComm(final Object[] parameters) {
385 return rawStreamAllValues(POSITION_COMM, parameters).map(CommSubsystem.class::cast);
386 }
387
388 /**
389 * Retrieve the set of values that occur in matches for Comm.
390 * @return the Set of all values or empty set if there are no matches
391 *
392 */
393 public Set<CommSubsystem> getAllValuesOfComm() {
394 return rawStreamAllValuesOfComm(emptyArray()).collect(Collectors.toSet());
395 }
396
397 /**
398 * Retrieve the set of values that occur in matches for Comm.
399 * @return the Set of all values or empty set if there are no matches
400 *
401 */
402 public Stream<CommSubsystem> streamAllValuesOfComm() {
403 return rawStreamAllValuesOfComm(emptyArray());
404 }
405
406 @Override
407 protected XAntennaGainNotMedium.Match tupleToMatch(final Tuple t) {
408 try {
409 return XAntennaGainNotMedium.Match.newMatch((CommSubsystem) t.get(POSITION_COMM));
410 } catch(ClassCastException e) {
411 LOGGER.error("Element(s) in tuple not properly typed!",e);
412 return null;
413 }
414 }
415
416 @Override
417 protected XAntennaGainNotMedium.Match arrayToMatch(final Object[] match) {
418 try {
419 return XAntennaGainNotMedium.Match.newMatch((CommSubsystem) match[POSITION_COMM]);
420 } catch(ClassCastException e) {
421 LOGGER.error("Element(s) in array not properly typed!",e);
422 return null;
423 }
424 }
425
426 @Override
427 protected XAntennaGainNotMedium.Match arrayToMatchMutable(final Object[] match) {
428 try {
429 return XAntennaGainNotMedium.Match.newMutableMatch((CommSubsystem) match[POSITION_COMM]);
430 } catch(ClassCastException e) {
431 LOGGER.error("Element(s) in array not properly typed!",e);
432 return null;
433 }
434 }
435
436 /**
437 * @return the singleton instance of the query specification of this pattern
438 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
439 *
440 */
441 public static IQuerySpecification<XAntennaGainNotMedium.Matcher> querySpecification() {
442 return XAntennaGainNotMedium.instance();
443 }
444 }
445
446 private XAntennaGainNotMedium() {
447 super(GeneratedPQuery.INSTANCE);
448 }
449
450 /**
451 * @return the singleton instance of the query specification
452 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
453 *
454 */
455 public static XAntennaGainNotMedium instance() {
456 try{
457 return LazyHolder.INSTANCE;
458 } catch (ExceptionInInitializerError err) {
459 throw processInitializerError(err);
460 }
461 }
462
463 @Override
464 protected XAntennaGainNotMedium.Matcher instantiate(final ViatraQueryEngine engine) {
465 return XAntennaGainNotMedium.Matcher.on(engine);
466 }
467
468 @Override
469 public XAntennaGainNotMedium.Matcher instantiate() {
470 return XAntennaGainNotMedium.Matcher.create();
471 }
472
473 @Override
474 public XAntennaGainNotMedium.Match newEmptyMatch() {
475 return XAntennaGainNotMedium.Match.newEmptyMatch();
476 }
477
478 @Override
479 public XAntennaGainNotMedium.Match newMatch(final Object... parameters) {
480 return XAntennaGainNotMedium.Match.newMatch((hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem) parameters[0]);
481 }
482
483 /**
484 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium (visibility: PUBLIC, simpleName: XAntennaGainNotMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
485 * <b>not</b> at the class load time of the outer class,
486 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium (visibility: PUBLIC, simpleName: XAntennaGainNotMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
487 *
488 * <p> This workaround is required e.g. to support recursion.
489 *
490 */
491 private static class LazyHolder {
492 private static final XAntennaGainNotMedium INSTANCE = new XAntennaGainNotMedium();
493
494 /**
495 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
496 * This initialization order is required to support indirect recursion.
497 *
498 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
499 *
500 */
501 private static final Object STATIC_INITIALIZER = ensureInitialized();
502
503 public static Object ensureInitialized() {
504 INSTANCE.ensureInitializedInternal();
505 return null;
506 }
507 }
508
509 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
510 private static final XAntennaGainNotMedium.GeneratedPQuery INSTANCE = new GeneratedPQuery();
511
512 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
513
514 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
515
516 private GeneratedPQuery() {
517 super(PVisibility.PUBLIC);
518 }
519
520 @Override
521 public String getFullyQualifiedName() {
522 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.xAntennaGainNotMedium";
523 }
524
525 @Override
526 public List<String> getParameterNames() {
527 return Arrays.asList("Comm");
528 }
529
530 @Override
531 public List<PParameter> getParameters() {
532 return parameters;
533 }
534
535 @Override
536 public Set<PBody> doGetContainedBodies() {
537 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
538 Set<PBody> bodies = new LinkedHashSet<>();
539 {
540 PBody body = new PBody(this);
541 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
542 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
543 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
544 new ExportedParameter(body, var_Comm, parameter_Comm)
545 ));
546 // CommSubsystem.band(Comm, TransceiverBand::X)
547 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
548 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "X").getInstance());
549 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
550 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
551 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
552 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
553 new Equality(body, var__virtual_1_, var__virtual_0_);
554 // neg find commSubsystemGainMedium(Comm)
555 new NegativePatternCall(body, Tuples.flatTupleOf(var_Comm), CommSubsystemGainMedium.instance().getInternalQueryRepresentation());
556 bodies.add(body);
557 }
558 {
559 PAnnotation annotation = new PAnnotation("Constraint");
560 annotation.addAttribute("severity", "error");
561 annotation.addAttribute("key", Arrays.asList(new Object[] {
562 new ParameterReference("Comm")
563 }));
564 annotation.addAttribute("message", "X-band transceiver must be combined with a medium gain antenna.");
565 addAnnotation(annotation);
566 }
567 return bodies;
568 }
569 }
570}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore
new file mode 100644
index 00000000..b3aca298
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/.gitignore
@@ -0,0 +1,15 @@
1/.CommunicationLink.java._trace
2/.SatelliteQueriesAll.java._trace
3/.IndirectCommunicationLink.java._trace
4/.DirectCommunicationLink.java._trace
5/.SpacecraftWithInterferometryPayload.java._trace
6/.SingleInterferometryPayload.java._trace
7/.AtLeastTwoInterferometryPayloads.java._trace
8/.DirectCommunicationLink2.java._trace
9/.CommSubsystemBand.java._trace
10/.CommSubsystemGain.java._trace
11/.GroundStationNetwork.java._trace
12/.SmallSat.java._trace
13/.CommSubsystemGainLow.java._trace
14/.CommSubsystemGainMedium.java._trace
15/.CommSubsystemBandUhf.java._trace
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AtLeastTwoInterferometryPayloads.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AtLeastTwoInterferometryPayloads.java
new file mode 100644
index 00000000..d560ac93
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/AtLeastTwoInterferometryPayloads.java
@@ -0,0 +1,138 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload;
7import java.util.Arrays;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Set;
11import org.eclipse.emf.ecore.EClass;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
17import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
19import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
22import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
25import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
26
27/**
28 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
29 *
30 * <p>Original source:
31 * <code><pre>
32 * private pattern atLeastTwoInterferometryPayloads(Mission : InterferometryMission) {
33 * find spacecraftWithInterferometryPayload(Mission, Spacecraft1);
34 * find spacecraftWithInterferometryPayload(Mission, Spacecraft2);
35 * Spacecraft1 != Spacecraft2;
36 * }
37 * </pre></code>
38 *
39 * @see GenericPatternMatcher
40 * @see GenericPatternMatch
41 *
42 */
43@SuppressWarnings("all")
44public final class AtLeastTwoInterferometryPayloads extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
45 private AtLeastTwoInterferometryPayloads() {
46 super(GeneratedPQuery.INSTANCE);
47 }
48
49 /**
50 * @return the singleton instance of the query specification
51 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
52 *
53 */
54 public static AtLeastTwoInterferometryPayloads instance() {
55 try{
56 return LazyHolder.INSTANCE;
57 } catch (ExceptionInInitializerError err) {
58 throw processInitializerError(err);
59 }
60 }
61
62 /**
63 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads (visibility: PUBLIC, simpleName: AtLeastTwoInterferometryPayloads, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
64 * <b>not</b> at the class load time of the outer class,
65 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads (visibility: PUBLIC, simpleName: AtLeastTwoInterferometryPayloads, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
66 *
67 * <p> This workaround is required e.g. to support recursion.
68 *
69 */
70 private static class LazyHolder {
71 private static final AtLeastTwoInterferometryPayloads INSTANCE = new AtLeastTwoInterferometryPayloads();
72
73 /**
74 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
75 * This initialization order is required to support indirect recursion.
76 *
77 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
78 *
79 */
80 private static final Object STATIC_INITIALIZER = ensureInitialized();
81
82 public static Object ensureInitialized() {
83 INSTANCE.ensureInitializedInternal();
84 return null;
85 }
86 }
87
88 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
89 private static final AtLeastTwoInterferometryPayloads.GeneratedPQuery INSTANCE = new GeneratedPQuery();
90
91 private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.InterferometryMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "InterferometryMission")), PParameterDirection.INOUT);
92
93 private final List<PParameter> parameters = Arrays.asList(parameter_Mission);
94
95 private GeneratedPQuery() {
96 super(PVisibility.PRIVATE);
97 }
98
99 @Override
100 public String getFullyQualifiedName() {
101 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.atLeastTwoInterferometryPayloads";
102 }
103
104 @Override
105 public List<String> getParameterNames() {
106 return Arrays.asList("Mission");
107 }
108
109 @Override
110 public List<PParameter> getParameters() {
111 return parameters;
112 }
113
114 @Override
115 public Set<PBody> doGetContainedBodies() {
116 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
117 Set<PBody> bodies = new LinkedHashSet<>();
118 {
119 PBody body = new PBody(this);
120 PVariable var_Mission = body.getOrCreateVariableByName("Mission");
121 PVariable var_Spacecraft1 = body.getOrCreateVariableByName("Spacecraft1");
122 PVariable var_Spacecraft2 = body.getOrCreateVariableByName("Spacecraft2");
123 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryMission")));
124 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
125 new ExportedParameter(body, var_Mission, parameter_Mission)
126 ));
127 // find spacecraftWithInterferometryPayload(Mission, Spacecraft1)
128 new PositivePatternCall(body, Tuples.flatTupleOf(var_Mission, var_Spacecraft1), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation());
129 // find spacecraftWithInterferometryPayload(Mission, Spacecraft2)
130 new PositivePatternCall(body, Tuples.flatTupleOf(var_Mission, var_Spacecraft2), SpacecraftWithInterferometryPayload.instance().getInternalQueryRepresentation());
131 // Spacecraft1 != Spacecraft2
132 new Inequality(body, var_Spacecraft1, var_Spacecraft2);
133 bodies.add(body);
134 }
135 return bodies;
136 }
137 }
138}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java
new file mode 100644
index 00000000..a0009587
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBand.java
@@ -0,0 +1,140 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.emf.ecore.EDataType;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
16import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
17import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
18import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
19import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
25import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
26import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
27
28/**
29 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
30 *
31 * <p>Original source:
32 * <code><pre>
33 * private pattern commSubsystemBand(Comm : CommSubsystem, Band : TransceiverBand) {
34 * CommSubsystem.band(Comm, Band);
35 * }
36 * </pre></code>
37 *
38 * @see GenericPatternMatcher
39 * @see GenericPatternMatch
40 *
41 */
42@SuppressWarnings("all")
43public final class CommSubsystemBand extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
44 private CommSubsystemBand() {
45 super(GeneratedPQuery.INSTANCE);
46 }
47
48 /**
49 * @return the singleton instance of the query specification
50 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
51 *
52 */
53 public static CommSubsystemBand instance() {
54 try{
55 return LazyHolder.INSTANCE;
56 } catch (ExceptionInInitializerError err) {
57 throw processInitializerError(err);
58 }
59 }
60
61 /**
62 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand (visibility: PUBLIC, simpleName: CommSubsystemBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
63 * <b>not</b> at the class load time of the outer class,
64 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand (visibility: PUBLIC, simpleName: CommSubsystemBand, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
65 *
66 * <p> This workaround is required e.g. to support recursion.
67 *
68 */
69 private static class LazyHolder {
70 private static final CommSubsystemBand INSTANCE = new CommSubsystemBand();
71
72 /**
73 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
74 * This initialization order is required to support indirect recursion.
75 *
76 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
77 *
78 */
79 private static final Object STATIC_INITIALIZER = ensureInitialized();
80
81 public static Object ensureInitialized() {
82 INSTANCE.ensureInitializedInternal();
83 return null;
84 }
85 }
86
87 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
88 private static final CommSubsystemBand.GeneratedPQuery INSTANCE = new GeneratedPQuery();
89
90 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
91
92 private final PParameter parameter_Band = new PParameter("Band", "hu.bme.mit.inf.dslreasoner.domains.satellite.TransceiverBand", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "TransceiverBand")), PParameterDirection.INOUT);
93
94 private final List<PParameter> parameters = Arrays.asList(parameter_Comm, parameter_Band);
95
96 private GeneratedPQuery() {
97 super(PVisibility.PRIVATE);
98 }
99
100 @Override
101 public String getFullyQualifiedName() {
102 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemBand";
103 }
104
105 @Override
106 public List<String> getParameterNames() {
107 return Arrays.asList("Comm","Band");
108 }
109
110 @Override
111 public List<PParameter> getParameters() {
112 return parameters;
113 }
114
115 @Override
116 public Set<PBody> doGetContainedBodies() {
117 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
118 Set<PBody> bodies = new LinkedHashSet<>();
119 {
120 PBody body = new PBody(this);
121 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
122 PVariable var_Band = body.getOrCreateVariableByName("Band");
123 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
124 new TypeConstraint(body, Tuples.flatTupleOf(var_Band), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
125 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
126 new ExportedParameter(body, var_Comm, parameter_Comm),
127 new ExportedParameter(body, var_Band, parameter_Band)
128 ));
129 // CommSubsystem.band(Comm, Band)
130 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
131 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
132 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
133 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
134 new Equality(body, var__virtual_0_, var_Band);
135 bodies.add(body);
136 }
137 return bodies;
138 }
139 }
140}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java
new file mode 100644
index 00000000..51175ce3
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemBandUhf.java
@@ -0,0 +1,138 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.emf.ecore.EDataType;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
16import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
17import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
18import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
19import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
23import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
25import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
26import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
27import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
28
29/**
30 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
31 *
32 * <p>Original source:
33 * <code><pre>
34 * private pattern commSubsystemBandUhf(Comm : CommSubsystem) {
35 * CommSubsystem.band(Comm, TransceiverBand::UHF);
36 * }
37 * </pre></code>
38 *
39 * @see GenericPatternMatcher
40 * @see GenericPatternMatch
41 *
42 */
43@SuppressWarnings("all")
44public final class CommSubsystemBandUhf extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
45 private CommSubsystemBandUhf() {
46 super(GeneratedPQuery.INSTANCE);
47 }
48
49 /**
50 * @return the singleton instance of the query specification
51 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
52 *
53 */
54 public static CommSubsystemBandUhf instance() {
55 try{
56 return LazyHolder.INSTANCE;
57 } catch (ExceptionInInitializerError err) {
58 throw processInitializerError(err);
59 }
60 }
61
62 /**
63 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf (visibility: PUBLIC, simpleName: CommSubsystemBandUhf, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
64 * <b>not</b> at the class load time of the outer class,
65 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf (visibility: PUBLIC, simpleName: CommSubsystemBandUhf, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
66 *
67 * <p> This workaround is required e.g. to support recursion.
68 *
69 */
70 private static class LazyHolder {
71 private static final CommSubsystemBandUhf INSTANCE = new CommSubsystemBandUhf();
72
73 /**
74 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
75 * This initialization order is required to support indirect recursion.
76 *
77 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
78 *
79 */
80 private static final Object STATIC_INITIALIZER = ensureInitialized();
81
82 public static Object ensureInitialized() {
83 INSTANCE.ensureInitializedInternal();
84 return null;
85 }
86 }
87
88 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
89 private static final CommSubsystemBandUhf.GeneratedPQuery INSTANCE = new GeneratedPQuery();
90
91 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
92
93 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
94
95 private GeneratedPQuery() {
96 super(PVisibility.PRIVATE);
97 }
98
99 @Override
100 public String getFullyQualifiedName() {
101 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemBandUhf";
102 }
103
104 @Override
105 public List<String> getParameterNames() {
106 return Arrays.asList("Comm");
107 }
108
109 @Override
110 public List<PParameter> getParameters() {
111 return parameters;
112 }
113
114 @Override
115 public Set<PBody> doGetContainedBodies() {
116 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
117 Set<PBody> bodies = new LinkedHashSet<>();
118 {
119 PBody body = new PBody(this);
120 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
122 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
123 new ExportedParameter(body, var_Comm, parameter_Comm)
124 ));
125 // CommSubsystem.band(Comm, TransceiverBand::UHF)
126 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
127 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "TransceiverBand", "UHF").getInstance());
128 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
129 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
130 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "band")));
131 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "TransceiverBand")));
132 new Equality(body, var__virtual_1_, var__virtual_0_);
133 bodies.add(body);
134 }
135 return bodies;
136 }
137 }
138}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java
new file mode 100644
index 00000000..e2e0e2a1
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGain.java
@@ -0,0 +1,140 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.emf.ecore.EDataType;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
16import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
17import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
18import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
19import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
25import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
26import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
27
28/**
29 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
30 *
31 * <p>Original source:
32 * <code><pre>
33 * private pattern commSubsystemGain(Comm : CommSubsystem, Gain : AntennaGain) {
34 * CommSubsystem.gain(Comm, Gain);
35 * }
36 * </pre></code>
37 *
38 * @see GenericPatternMatcher
39 * @see GenericPatternMatch
40 *
41 */
42@SuppressWarnings("all")
43public final class CommSubsystemGain extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
44 private CommSubsystemGain() {
45 super(GeneratedPQuery.INSTANCE);
46 }
47
48 /**
49 * @return the singleton instance of the query specification
50 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
51 *
52 */
53 public static CommSubsystemGain instance() {
54 try{
55 return LazyHolder.INSTANCE;
56 } catch (ExceptionInInitializerError err) {
57 throw processInitializerError(err);
58 }
59 }
60
61 /**
62 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain (visibility: PUBLIC, simpleName: CommSubsystemGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
63 * <b>not</b> at the class load time of the outer class,
64 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain (visibility: PUBLIC, simpleName: CommSubsystemGain, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
65 *
66 * <p> This workaround is required e.g. to support recursion.
67 *
68 */
69 private static class LazyHolder {
70 private static final CommSubsystemGain INSTANCE = new CommSubsystemGain();
71
72 /**
73 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
74 * This initialization order is required to support indirect recursion.
75 *
76 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
77 *
78 */
79 private static final Object STATIC_INITIALIZER = ensureInitialized();
80
81 public static Object ensureInitialized() {
82 INSTANCE.ensureInitializedInternal();
83 return null;
84 }
85 }
86
87 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
88 private static final CommSubsystemGain.GeneratedPQuery INSTANCE = new GeneratedPQuery();
89
90 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
91
92 private final PParameter parameter_Gain = new PParameter("Gain", "hu.bme.mit.inf.dslreasoner.domains.satellite.AntennaGain", new EDataTypeInSlotsKey((EDataType)getClassifierLiteralSafe("http://www.example.org/satellite", "AntennaGain")), PParameterDirection.INOUT);
93
94 private final List<PParameter> parameters = Arrays.asList(parameter_Comm, parameter_Gain);
95
96 private GeneratedPQuery() {
97 super(PVisibility.PRIVATE);
98 }
99
100 @Override
101 public String getFullyQualifiedName() {
102 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGain";
103 }
104
105 @Override
106 public List<String> getParameterNames() {
107 return Arrays.asList("Comm","Gain");
108 }
109
110 @Override
111 public List<PParameter> getParameters() {
112 return parameters;
113 }
114
115 @Override
116 public Set<PBody> doGetContainedBodies() {
117 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
118 Set<PBody> bodies = new LinkedHashSet<>();
119 {
120 PBody body = new PBody(this);
121 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
122 PVariable var_Gain = body.getOrCreateVariableByName("Gain");
123 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
124 new TypeConstraint(body, Tuples.flatTupleOf(var_Gain), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
125 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
126 new ExportedParameter(body, var_Comm, parameter_Comm),
127 new ExportedParameter(body, var_Gain, parameter_Gain)
128 ));
129 // CommSubsystem.gain(Comm, Gain)
130 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
131 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
132 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain")));
133 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
134 new Equality(body, var__virtual_0_, var_Gain);
135 bodies.add(body);
136 }
137 return bodies;
138 }
139 }
140}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java
new file mode 100644
index 00000000..04ee67da
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainLow.java
@@ -0,0 +1,138 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.emf.ecore.EDataType;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
16import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
17import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
18import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
19import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
23import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
25import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
26import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
27import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
28
29/**
30 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
31 *
32 * <p>Original source:
33 * <code><pre>
34 * private pattern commSubsystemGainLow(Comm : CommSubsystem) {
35 * CommSubsystem.gain(Comm, AntennaGain::LOW);
36 * }
37 * </pre></code>
38 *
39 * @see GenericPatternMatcher
40 * @see GenericPatternMatch
41 *
42 */
43@SuppressWarnings("all")
44public final class CommSubsystemGainLow extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
45 private CommSubsystemGainLow() {
46 super(GeneratedPQuery.INSTANCE);
47 }
48
49 /**
50 * @return the singleton instance of the query specification
51 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
52 *
53 */
54 public static CommSubsystemGainLow instance() {
55 try{
56 return LazyHolder.INSTANCE;
57 } catch (ExceptionInInitializerError err) {
58 throw processInitializerError(err);
59 }
60 }
61
62 /**
63 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow (visibility: PUBLIC, simpleName: CommSubsystemGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
64 * <b>not</b> at the class load time of the outer class,
65 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow (visibility: PUBLIC, simpleName: CommSubsystemGainLow, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
66 *
67 * <p> This workaround is required e.g. to support recursion.
68 *
69 */
70 private static class LazyHolder {
71 private static final CommSubsystemGainLow INSTANCE = new CommSubsystemGainLow();
72
73 /**
74 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
75 * This initialization order is required to support indirect recursion.
76 *
77 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
78 *
79 */
80 private static final Object STATIC_INITIALIZER = ensureInitialized();
81
82 public static Object ensureInitialized() {
83 INSTANCE.ensureInitializedInternal();
84 return null;
85 }
86 }
87
88 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
89 private static final CommSubsystemGainLow.GeneratedPQuery INSTANCE = new GeneratedPQuery();
90
91 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
92
93 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
94
95 private GeneratedPQuery() {
96 super(PVisibility.PRIVATE);
97 }
98
99 @Override
100 public String getFullyQualifiedName() {
101 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGainLow";
102 }
103
104 @Override
105 public List<String> getParameterNames() {
106 return Arrays.asList("Comm");
107 }
108
109 @Override
110 public List<PParameter> getParameters() {
111 return parameters;
112 }
113
114 @Override
115 public Set<PBody> doGetContainedBodies() {
116 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
117 Set<PBody> bodies = new LinkedHashSet<>();
118 {
119 PBody body = new PBody(this);
120 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
122 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
123 new ExportedParameter(body, var_Comm, parameter_Comm)
124 ));
125 // CommSubsystem.gain(Comm, AntennaGain::LOW)
126 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
127 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "LOW").getInstance());
128 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
129 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
130 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain")));
131 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
132 new Equality(body, var__virtual_1_, var__virtual_0_);
133 bodies.add(body);
134 }
135 return bodies;
136 }
137 }
138}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java
new file mode 100644
index 00000000..4b3bc03b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/CommSubsystemGainMedium.java
@@ -0,0 +1,138 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.emf.ecore.EDataType;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
16import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
17import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
18import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
19import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
21import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
23import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
24import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
25import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
26import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
27import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
28
29/**
30 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
31 *
32 * <p>Original source:
33 * <code><pre>
34 * private pattern commSubsystemGainMedium(Comm : CommSubsystem) {
35 * CommSubsystem.gain(Comm, AntennaGain::MEDIUM);
36 * }
37 * </pre></code>
38 *
39 * @see GenericPatternMatcher
40 * @see GenericPatternMatch
41 *
42 */
43@SuppressWarnings("all")
44public final class CommSubsystemGainMedium extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
45 private CommSubsystemGainMedium() {
46 super(GeneratedPQuery.INSTANCE);
47 }
48
49 /**
50 * @return the singleton instance of the query specification
51 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
52 *
53 */
54 public static CommSubsystemGainMedium instance() {
55 try{
56 return LazyHolder.INSTANCE;
57 } catch (ExceptionInInitializerError err) {
58 throw processInitializerError(err);
59 }
60 }
61
62 /**
63 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium (visibility: PUBLIC, simpleName: CommSubsystemGainMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
64 * <b>not</b> at the class load time of the outer class,
65 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium (visibility: PUBLIC, simpleName: CommSubsystemGainMedium, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
66 *
67 * <p> This workaround is required e.g. to support recursion.
68 *
69 */
70 private static class LazyHolder {
71 private static final CommSubsystemGainMedium INSTANCE = new CommSubsystemGainMedium();
72
73 /**
74 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
75 * This initialization order is required to support indirect recursion.
76 *
77 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
78 *
79 */
80 private static final Object STATIC_INITIALIZER = ensureInitialized();
81
82 public static Object ensureInitialized() {
83 INSTANCE.ensureInitializedInternal();
84 return null;
85 }
86 }
87
88 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
89 private static final CommSubsystemGainMedium.GeneratedPQuery INSTANCE = new GeneratedPQuery();
90
91 private final PParameter parameter_Comm = new PParameter("Comm", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
92
93 private final List<PParameter> parameters = Arrays.asList(parameter_Comm);
94
95 private GeneratedPQuery() {
96 super(PVisibility.PRIVATE);
97 }
98
99 @Override
100 public String getFullyQualifiedName() {
101 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.commSubsystemGainMedium";
102 }
103
104 @Override
105 public List<String> getParameterNames() {
106 return Arrays.asList("Comm");
107 }
108
109 @Override
110 public List<PParameter> getParameters() {
111 return parameters;
112 }
113
114 @Override
115 public Set<PBody> doGetContainedBodies() {
116 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
117 Set<PBody> bodies = new LinkedHashSet<>();
118 {
119 PBody body = new PBody(this);
120 PVariable var_Comm = body.getOrCreateVariableByName("Comm");
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
122 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
123 new ExportedParameter(body, var_Comm, parameter_Comm)
124 ));
125 // CommSubsystem.gain(Comm, AntennaGain::MEDIUM)
126 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
127 new ConstantValue(body, var__virtual_0_, getEnumLiteral("http://www.example.org/satellite", "AntennaGain", "MEDIUM").getInstance());
128 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
129 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
130 new TypeConstraint(body, Tuples.flatTupleOf(var_Comm, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommSubsystem", "gain")));
131 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.example.org/satellite", "AntennaGain")));
132 new Equality(body, var__virtual_1_, var__virtual_0_);
133 bodies.add(body);
134 }
135 return bodies;
136 }
137 }
138}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/DirectCommunicationLink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/DirectCommunicationLink.java
new file mode 100644
index 00000000..d6f5c53b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/DirectCommunicationLink.java
@@ -0,0 +1,162 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
13import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
14import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
15import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
17import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
19import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
21import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
24import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
25
26/**
27 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
28 *
29 * <p>Original source:
30 * <code><pre>
31 * private pattern directCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) {
32 * DirectedCommunicationLink.source(Link, SourceSubsystem);
33 * DirectedCommunicationLink.target(Link, TargetSubsystem);
34 * CommunicatingElement.commSubsystem(Source, SourceSubsystem);
35 * CommunicatingElement.commSubsystem(Target, TargetSubsystem);
36 * }
37 * </pre></code>
38 *
39 * @see GenericPatternMatcher
40 * @see GenericPatternMatch
41 *
42 */
43@SuppressWarnings("all")
44public final class DirectCommunicationLink extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
45 private DirectCommunicationLink() {
46 super(GeneratedPQuery.INSTANCE);
47 }
48
49 /**
50 * @return the singleton instance of the query specification
51 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
52 *
53 */
54 public static DirectCommunicationLink instance() {
55 try{
56 return LazyHolder.INSTANCE;
57 } catch (ExceptionInInitializerError err) {
58 throw processInitializerError(err);
59 }
60 }
61
62 /**
63 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink (visibility: PUBLIC, simpleName: DirectCommunicationLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
64 * <b>not</b> at the class load time of the outer class,
65 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink (visibility: PUBLIC, simpleName: DirectCommunicationLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
66 *
67 * <p> This workaround is required e.g. to support recursion.
68 *
69 */
70 private static class LazyHolder {
71 private static final DirectCommunicationLink INSTANCE = new DirectCommunicationLink();
72
73 /**
74 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
75 * This initialization order is required to support indirect recursion.
76 *
77 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
78 *
79 */
80 private static final Object STATIC_INITIALIZER = ensureInitialized();
81
82 public static Object ensureInitialized() {
83 INSTANCE.ensureInitializedInternal();
84 return null;
85 }
86 }
87
88 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
89 private static final DirectCommunicationLink.GeneratedPQuery INSTANCE = new GeneratedPQuery();
90
91 private final PParameter parameter_Source = new PParameter("Source", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT);
92
93 private final PParameter parameter_Target = new PParameter("Target", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT);
94
95 private final List<PParameter> parameters = Arrays.asList(parameter_Source, parameter_Target);
96
97 private GeneratedPQuery() {
98 super(PVisibility.PRIVATE);
99 }
100
101 @Override
102 public String getFullyQualifiedName() {
103 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.directCommunicationLink";
104 }
105
106 @Override
107 public List<String> getParameterNames() {
108 return Arrays.asList("Source","Target");
109 }
110
111 @Override
112 public List<PParameter> getParameters() {
113 return parameters;
114 }
115
116 @Override
117 public Set<PBody> doGetContainedBodies() {
118 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
119 Set<PBody> bodies = new LinkedHashSet<>();
120 {
121 PBody body = new PBody(this);
122 PVariable var_Source = body.getOrCreateVariableByName("Source");
123 PVariable var_Target = body.getOrCreateVariableByName("Target");
124 PVariable var_Link = body.getOrCreateVariableByName("Link");
125 PVariable var_SourceSubsystem = body.getOrCreateVariableByName("SourceSubsystem");
126 PVariable var_TargetSubsystem = body.getOrCreateVariableByName("TargetSubsystem");
127 new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
128 new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
129 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
130 new ExportedParameter(body, var_Source, parameter_Source),
131 new ExportedParameter(body, var_Target, parameter_Target)
132 ));
133 // DirectedCommunicationLink.source(Link, SourceSubsystem)
134 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
135 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
136 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "source")));
137 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
138 new Equality(body, var__virtual_0_, var_SourceSubsystem);
139 // DirectedCommunicationLink.target(Link, TargetSubsystem)
140 new TypeConstraint(body, Tuples.flatTupleOf(var_Link), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "DirectedCommunicationLink")));
141 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
142 new TypeConstraint(body, Tuples.flatTupleOf(var_Link, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "DirectedCommunicationLink", "target")));
143 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
144 new Equality(body, var__virtual_1_, var_TargetSubsystem);
145 // CommunicatingElement.commSubsystem(Source, SourceSubsystem)
146 new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
147 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
148 new TypeConstraint(body, Tuples.flatTupleOf(var_Source, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
149 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
150 new Equality(body, var__virtual_2_, var_SourceSubsystem);
151 // CommunicatingElement.commSubsystem(Target, TargetSubsystem)
152 new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
153 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
154 new TypeConstraint(body, Tuples.flatTupleOf(var_Target, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "CommunicatingElement", "commSubsystem")));
155 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
156 new Equality(body, var__virtual_3_, var_TargetSubsystem);
157 bodies.add(body);
158 }
159 return bodies;
160 }
161 }
162}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/GroundStationNetwork.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/GroundStationNetwork.java
new file mode 100644
index 00000000..93b1a01b
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/GroundStationNetwork.java
@@ -0,0 +1,127 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
13import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
14import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
15import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
17import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
19import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
20import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
21import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
22import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
23
24/**
25 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
26 *
27 * <p>Original source:
28 * <code><pre>
29 * private pattern groundStationNetwork(Network : GroundStationNetwork) {
30 * GroundStationNetwork(Network);
31 * }
32 * </pre></code>
33 *
34 * @see GenericPatternMatcher
35 * @see GenericPatternMatch
36 *
37 */
38@SuppressWarnings("all")
39public final class GroundStationNetwork extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
40 private GroundStationNetwork() {
41 super(GeneratedPQuery.INSTANCE);
42 }
43
44 /**
45 * @return the singleton instance of the query specification
46 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
47 *
48 */
49 public static GroundStationNetwork instance() {
50 try{
51 return LazyHolder.INSTANCE;
52 } catch (ExceptionInInitializerError err) {
53 throw processInitializerError(err);
54 }
55 }
56
57 /**
58 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork (visibility: PUBLIC, simpleName: GroundStationNetwork, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
59 * <b>not</b> at the class load time of the outer class,
60 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork (visibility: PUBLIC, simpleName: GroundStationNetwork, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
61 *
62 * <p> This workaround is required e.g. to support recursion.
63 *
64 */
65 private static class LazyHolder {
66 private static final GroundStationNetwork INSTANCE = new GroundStationNetwork();
67
68 /**
69 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
70 * This initialization order is required to support indirect recursion.
71 *
72 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
73 *
74 */
75 private static final Object STATIC_INITIALIZER = ensureInitialized();
76
77 public static Object ensureInitialized() {
78 INSTANCE.ensureInitializedInternal();
79 return null;
80 }
81 }
82
83 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
84 private static final GroundStationNetwork.GeneratedPQuery INSTANCE = new GeneratedPQuery();
85
86 private final PParameter parameter_Network = new PParameter("Network", "hu.bme.mit.inf.dslreasoner.domains.satellite.GroundStationNetwork", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "GroundStationNetwork")), PParameterDirection.INOUT);
87
88 private final List<PParameter> parameters = Arrays.asList(parameter_Network);
89
90 private GeneratedPQuery() {
91 super(PVisibility.PRIVATE);
92 }
93
94 @Override
95 public String getFullyQualifiedName() {
96 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.groundStationNetwork";
97 }
98
99 @Override
100 public List<String> getParameterNames() {
101 return Arrays.asList("Network");
102 }
103
104 @Override
105 public List<PParameter> getParameters() {
106 return parameters;
107 }
108
109 @Override
110 public Set<PBody> doGetContainedBodies() {
111 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
112 Set<PBody> bodies = new LinkedHashSet<>();
113 {
114 PBody body = new PBody(this);
115 PVariable var_Network = body.getOrCreateVariableByName("Network");
116 new TypeConstraint(body, Tuples.flatTupleOf(var_Network), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork")));
117 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
118 new ExportedParameter(body, var_Network, parameter_Network)
119 ));
120 // GroundStationNetwork(Network)
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Network), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "GroundStationNetwork")));
122 bodies.add(body);
123 }
124 return bodies;
125 }
126 }
127}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectCommunicationLink.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectCommunicationLink.java
new file mode 100644
index 00000000..6d5e475c
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/IndirectCommunicationLink.java
@@ -0,0 +1,134 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink;
7import java.util.Arrays;
8import java.util.LinkedHashSet;
9import java.util.List;
10import java.util.Set;
11import org.eclipse.emf.ecore.EClass;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
13import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
14import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
15import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
17import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
19import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
21import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
24import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
25
26/**
27 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
28 *
29 * <p>Original source:
30 * <code><pre>
31 * private pattern indirectCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) {
32 * find directCommunicationLink+(Source, Target);
33 * }
34 * </pre></code>
35 *
36 * @see GenericPatternMatcher
37 * @see GenericPatternMatch
38 *
39 */
40@SuppressWarnings("all")
41public final class IndirectCommunicationLink extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
42 private IndirectCommunicationLink() {
43 super(GeneratedPQuery.INSTANCE);
44 }
45
46 /**
47 * @return the singleton instance of the query specification
48 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
49 *
50 */
51 public static IndirectCommunicationLink instance() {
52 try{
53 return LazyHolder.INSTANCE;
54 } catch (ExceptionInInitializerError err) {
55 throw processInitializerError(err);
56 }
57 }
58
59 /**
60 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink (visibility: PUBLIC, simpleName: IndirectCommunicationLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
61 * <b>not</b> at the class load time of the outer class,
62 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink (visibility: PUBLIC, simpleName: IndirectCommunicationLink, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
63 *
64 * <p> This workaround is required e.g. to support recursion.
65 *
66 */
67 private static class LazyHolder {
68 private static final IndirectCommunicationLink INSTANCE = new IndirectCommunicationLink();
69
70 /**
71 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
72 * This initialization order is required to support indirect recursion.
73 *
74 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
75 *
76 */
77 private static final Object STATIC_INITIALIZER = ensureInitialized();
78
79 public static Object ensureInitialized() {
80 INSTANCE.ensureInitializedInternal();
81 return null;
82 }
83 }
84
85 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
86 private static final IndirectCommunicationLink.GeneratedPQuery INSTANCE = new GeneratedPQuery();
87
88 private final PParameter parameter_Source = new PParameter("Source", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT);
89
90 private final PParameter parameter_Target = new PParameter("Target", "hu.bme.mit.inf.dslreasoner.domains.satellite.CommunicatingElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommunicatingElement")), PParameterDirection.INOUT);
91
92 private final List<PParameter> parameters = Arrays.asList(parameter_Source, parameter_Target);
93
94 private GeneratedPQuery() {
95 super(PVisibility.PRIVATE);
96 }
97
98 @Override
99 public String getFullyQualifiedName() {
100 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.indirectCommunicationLink";
101 }
102
103 @Override
104 public List<String> getParameterNames() {
105 return Arrays.asList("Source","Target");
106 }
107
108 @Override
109 public List<PParameter> getParameters() {
110 return parameters;
111 }
112
113 @Override
114 public Set<PBody> doGetContainedBodies() {
115 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
116 Set<PBody> bodies = new LinkedHashSet<>();
117 {
118 PBody body = new PBody(this);
119 PVariable var_Source = body.getOrCreateVariableByName("Source");
120 PVariable var_Target = body.getOrCreateVariableByName("Target");
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
122 new TypeConstraint(body, Tuples.flatTupleOf(var_Target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommunicatingElement")));
123 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
124 new ExportedParameter(body, var_Source, parameter_Source),
125 new ExportedParameter(body, var_Target, parameter_Target)
126 ));
127 // find directCommunicationLink+(Source, Target)
128 new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_Source, var_Target), DirectCommunicationLink.instance().getInternalQueryRepresentation());
129 bodies.add(body);
130 }
131 return bodies;
132 }
133 }
134}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java
new file mode 100644
index 00000000..7f1be700
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SatelliteQueriesAll.java
@@ -0,0 +1,105 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLinkDoesNotStartAtContainingElement;
7import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CommunicationLoop;
8import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.CubeSatWithKaAntenna;
9import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetBand;
10import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.IncompatibleSourceAndTargetGain;
11import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.KaAntennaGainLow;
12import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NoLinkToGroundStation;
13import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.NotEnoughInterferometryPayloads;
14import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.ThreeUCubeSatWithNonUhfCrossLink;
15import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.UhfAntennaGainNotLow;
16import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.XAntennaGainNotMedium;
17import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.AtLeastTwoInterferometryPayloads;
18import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBand;
19import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemBandUhf;
20import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGain;
21import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainLow;
22import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.CommSubsystemGainMedium;
23import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.DirectCommunicationLink;
24import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.GroundStationNetwork;
25import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.IndirectCommunicationLink;
26import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat;
27import hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload;
28import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
29
30/**
31 * A pattern group formed of all patterns defined in SatelliteQueries.vql.
32 *
33 * <p>A private group that includes private patterns as well. Only intended use case is for pattern testing.
34 *
35 * <p> From package hu.bme.mit.inf.dslreasoner.domains.satellite.queries, the group contains the definition of the following patterns: <ul>
36 * <li>communicationLinkDoesNotStartAtContainingElement</li>
37 * <li>notEnoughInterferometryPayloads</li>
38 * <li>atLeastTwoInterferometryPayloads</li>
39 * <li>spacecraftWithInterferometryPayload</li>
40 * <li>noLinkToGroundStation</li>
41 * <li>communicationLoop</li>
42 * <li>indirectCommunicationLink</li>
43 * <li>directCommunicationLink</li>
44 * <li>incompatibleSourceAndTargetBand</li>
45 * <li>commSubsystemBand</li>
46 * <li>incompatibleSourceAndTargetGain</li>
47 * <li>commSubsystemGain</li>
48 * <li>uhfAntennaGainNotLow</li>
49 * <li>commSubsystemGainLow</li>
50 * <li>xAntennaGainNotMedium</li>
51 * <li>commSubsystemGainMedium</li>
52 * <li>kaAntennaGainLow</li>
53 * <li>threeUCubeSatWithNonUhfCrossLink</li>
54 * <li>commSubsystemBandUhf</li>
55 * <li>groundStationNetwork</li>
56 * <li>cubeSatWithKaAntenna</li>
57 * <li>smallSat</li>
58 * </ul>
59 *
60 * @see IQueryGroup
61 *
62 */
63@SuppressWarnings("all")
64public final class SatelliteQueriesAll extends BaseGeneratedPatternGroup {
65 /**
66 * Access the pattern group.
67 *
68 * @return the singleton instance of the group
69 * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
70 *
71 */
72 public static SatelliteQueriesAll instance() {
73 if (INSTANCE == null) {
74 INSTANCE = new SatelliteQueriesAll();
75 }
76 return INSTANCE;
77 }
78
79 private static SatelliteQueriesAll INSTANCE;
80
81 private SatelliteQueriesAll() {
82 querySpecifications.add(CommunicationLinkDoesNotStartAtContainingElement.instance());
83 querySpecifications.add(NotEnoughInterferometryPayloads.instance());
84 querySpecifications.add(AtLeastTwoInterferometryPayloads.instance());
85 querySpecifications.add(SpacecraftWithInterferometryPayload.instance());
86 querySpecifications.add(NoLinkToGroundStation.instance());
87 querySpecifications.add(CommunicationLoop.instance());
88 querySpecifications.add(IndirectCommunicationLink.instance());
89 querySpecifications.add(DirectCommunicationLink.instance());
90 querySpecifications.add(IncompatibleSourceAndTargetBand.instance());
91 querySpecifications.add(CommSubsystemBand.instance());
92 querySpecifications.add(IncompatibleSourceAndTargetGain.instance());
93 querySpecifications.add(CommSubsystemGain.instance());
94 querySpecifications.add(UhfAntennaGainNotLow.instance());
95 querySpecifications.add(CommSubsystemGainLow.instance());
96 querySpecifications.add(XAntennaGainNotMedium.instance());
97 querySpecifications.add(CommSubsystemGainMedium.instance());
98 querySpecifications.add(KaAntennaGainLow.instance());
99 querySpecifications.add(ThreeUCubeSatWithNonUhfCrossLink.instance());
100 querySpecifications.add(CommSubsystemBandUhf.instance());
101 querySpecifications.add(GroundStationNetwork.instance());
102 querySpecifications.add(CubeSatWithKaAntenna.instance());
103 querySpecifications.add(SmallSat.instance());
104 }
105}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java
new file mode 100644
index 00000000..252db290
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SmallSat.java
@@ -0,0 +1,127 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
13import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
14import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
15import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
17import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
19import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
20import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
21import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
22import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
23
24/**
25 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
26 *
27 * <p>Original source:
28 * <code><pre>
29 * private pattern smallSat(Sat : SmallSat) {
30 * SmallSat(Sat);
31 * }
32 * </pre></code>
33 *
34 * @see GenericPatternMatcher
35 * @see GenericPatternMatch
36 *
37 */
38@SuppressWarnings("all")
39public final class SmallSat extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
40 private SmallSat() {
41 super(GeneratedPQuery.INSTANCE);
42 }
43
44 /**
45 * @return the singleton instance of the query specification
46 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
47 *
48 */
49 public static SmallSat instance() {
50 try{
51 return LazyHolder.INSTANCE;
52 } catch (ExceptionInInitializerError err) {
53 throw processInitializerError(err);
54 }
55 }
56
57 /**
58 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
59 * <b>not</b> at the class load time of the outer class,
60 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat (visibility: PUBLIC, simpleName: SmallSat, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SmallSat, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
61 *
62 * <p> This workaround is required e.g. to support recursion.
63 *
64 */
65 private static class LazyHolder {
66 private static final SmallSat INSTANCE = new SmallSat();
67
68 /**
69 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
70 * This initialization order is required to support indirect recursion.
71 *
72 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
73 *
74 */
75 private static final Object STATIC_INITIALIZER = ensureInitialized();
76
77 public static Object ensureInitialized() {
78 INSTANCE.ensureInitializedInternal();
79 return null;
80 }
81 }
82
83 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
84 private static final SmallSat.GeneratedPQuery INSTANCE = new GeneratedPQuery();
85
86 private final PParameter parameter_Sat = new PParameter("Sat", "hu.bme.mit.inf.dslreasoner.domains.satellite.SmallSat", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "SmallSat")), PParameterDirection.INOUT);
87
88 private final List<PParameter> parameters = Arrays.asList(parameter_Sat);
89
90 private GeneratedPQuery() {
91 super(PVisibility.PRIVATE);
92 }
93
94 @Override
95 public String getFullyQualifiedName() {
96 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.smallSat";
97 }
98
99 @Override
100 public List<String> getParameterNames() {
101 return Arrays.asList("Sat");
102 }
103
104 @Override
105 public List<PParameter> getParameters() {
106 return parameters;
107 }
108
109 @Override
110 public Set<PBody> doGetContainedBodies() {
111 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
112 Set<PBody> bodies = new LinkedHashSet<>();
113 {
114 PBody body = new PBody(this);
115 PVariable var_Sat = body.getOrCreateVariableByName("Sat");
116 new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat")));
117 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
118 new ExportedParameter(body, var_Sat, parameter_Sat)
119 ));
120 // SmallSat(Sat)
121 new TypeConstraint(body, Tuples.flatTupleOf(var_Sat), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "SmallSat")));
122 bodies.add(body);
123 }
124 return bodies;
125 }
126 }
127}
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithInterferometryPayload.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithInterferometryPayload.java
new file mode 100644
index 00000000..f8e6ca4f
--- /dev/null
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/internal/SpacecraftWithInterferometryPayload.java
@@ -0,0 +1,149 @@
1/**
2 * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
3 */
4package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
5
6import java.util.Arrays;
7import java.util.LinkedHashSet;
8import java.util.List;
9import java.util.Set;
10import org.eclipse.emf.ecore.EClass;
11import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
12import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher;
13import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
14import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
15import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
16import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
17import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
18import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
19import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
20import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
21import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
22import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
23import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
24import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
25
26/**
27 * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
28 *
29 * <p>Original source:
30 * <code><pre>
31 * private pattern spacecraftWithInterferometryPayload(Mission : ConstellationMission, Spacecraft : Spacecraft) {
32 * ConstellationMission.spacecraft(Mission, Spacecraft);
33 * Spacecraft.payload(Spacecraft, Payload);
34 * InterferometryPayload(Payload);
35 * }
36 * </pre></code>
37 *
38 * @see GenericPatternMatcher
39 * @see GenericPatternMatch
40 *
41 */
42@SuppressWarnings("all")
43public final class SpacecraftWithInterferometryPayload extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
44 private SpacecraftWithInterferometryPayload() {
45 super(GeneratedPQuery.INSTANCE);
46 }
47
48 /**
49 * @return the singleton instance of the query specification
50 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
51 *
52 */
53 public static SpacecraftWithInterferometryPayload instance() {
54 try{
55 return LazyHolder.INSTANCE;
56 } catch (ExceptionInInitializerError err) {
57 throw processInitializerError(err);
58 }
59 }
60
61 /**
62 * Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload (visibility: PUBLIC, simpleName: SpacecraftWithInterferometryPayload, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
63 * <b>not</b> at the class load time of the outer class,
64 * but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload (visibility: PUBLIC, simpleName: SpacecraftWithInterferometryPayload, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.SpacecraftWithInterferometryPayload, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
65 *
66 * <p> This workaround is required e.g. to support recursion.
67 *
68 */
69 private static class LazyHolder {
70 private static final SpacecraftWithInterferometryPayload INSTANCE = new SpacecraftWithInterferometryPayload();
71
72 /**
73 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
74 * This initialization order is required to support indirect recursion.
75 *
76 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
77 *
78 */
79 private static final Object STATIC_INITIALIZER = ensureInitialized();
80
81 public static Object ensureInitialized() {
82 INSTANCE.ensureInitializedInternal();
83 return null;
84 }
85 }
86
87 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
88 private static final SpacecraftWithInterferometryPayload.GeneratedPQuery INSTANCE = new GeneratedPQuery();
89
90 private final PParameter parameter_Mission = new PParameter("Mission", "hu.bme.mit.inf.dslreasoner.domains.satellite.ConstellationMission", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "ConstellationMission")), PParameterDirection.INOUT);
91
92 private final PParameter parameter_Spacecraft = new PParameter("Spacecraft", "hu.bme.mit.inf.dslreasoner.domains.satellite.Spacecraft", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "Spacecraft")), PParameterDirection.INOUT);
93
94 private final List<PParameter> parameters = Arrays.asList(parameter_Mission, parameter_Spacecraft);
95
96 private GeneratedPQuery() {
97 super(PVisibility.PRIVATE);
98 }
99
100 @Override
101 public String getFullyQualifiedName() {
102 return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.spacecraftWithInterferometryPayload";
103 }
104
105 @Override
106 public List<String> getParameterNames() {
107 return Arrays.asList("Mission","Spacecraft");
108 }
109
110 @Override
111 public List<PParameter> getParameters() {
112 return parameters;
113 }
114
115 @Override
116 public Set<PBody> doGetContainedBodies() {
117 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
118 Set<PBody> bodies = new LinkedHashSet<>();
119 {
120 PBody body = new PBody(this);
121 PVariable var_Mission = body.getOrCreateVariableByName("Mission");
122 PVariable var_Spacecraft = body.getOrCreateVariableByName("Spacecraft");
123 PVariable var_Payload = body.getOrCreateVariableByName("Payload");
124 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission")));
125 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
126 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
127 new ExportedParameter(body, var_Mission, parameter_Mission),
128 new ExportedParameter(body, var_Spacecraft, parameter_Spacecraft)
129 ));
130 // ConstellationMission.spacecraft(Mission, Spacecraft)
131 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "ConstellationMission")));
132 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
133 new TypeConstraint(body, Tuples.flatTupleOf(var_Mission, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "ConstellationMission", "spacecraft")));
134 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
135 new Equality(body, var__virtual_0_, var_Spacecraft);
136 // Spacecraft.payload(Spacecraft, Payload)
137 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Spacecraft")));
138 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
139 new TypeConstraint(body, Tuples.flatTupleOf(var_Spacecraft, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/satellite", "Spacecraft", "payload")));
140 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "Payload")));
141 new Equality(body, var__virtual_1_, var_Payload);
142 // InterferometryPayload(Payload)
143 new TypeConstraint(body, Tuples.flatTupleOf(var_Payload), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "InterferometryPayload")));
144 bodies.add(body);
145 }
146 return bodies;
147 }
148 }
149}