本文整理了Java中org.eclipse.viatra.query.runtime.api.ViatraQueryEngine.getScope()
方法的一些代码示例,展示了ViatraQueryEngine.getScope()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViatraQueryEngine.getScope()
方法的具体详情如下:
包路径:org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
类名称:ViatraQueryEngine
方法名:getScope
暂无
代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.transformation.runtime.debug
private ResourceSet[] getResources(ViatraQueryEngine engine) {
List<ResourceSet> retVal = new ArrayList<>();
if(engine != null){
QueryScope scope = engine.getScope();
if (scope instanceof EMFScope) {
for (Notifier notifier : ((EMFScope) scope).getScopeRoots()) {
if (notifier instanceof ResourceSet) {
retVal.add((ResourceSet) notifier);
}
}
}
return retVal.toArray(new ResourceSet[retVal.size()]);
}else{
return new ResourceSet[0];
}
}
代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.runtime
/**
* Provides access to the underlying EMF model index ({@link NavigationHelper}) from a VIATRA Query engine instantiated on an EMFScope
*
* @param engine an already existing VIATRA Query engine instantiated on an EMFScope
* @return the underlying EMF base index that indexes the contents of the EMF model
* @throws ViatraQueryRuntimeException if base index initialization fails
*/
public static NavigationHelper extractUnderlyingEMFIndex(ViatraQueryEngine engine) {
final QueryScope scope = engine.getScope();
if (scope instanceof EMFScope)
return ((EMFBaseIndexWrapper)AdvancedViatraQueryEngine.from(engine).getBaseIndex()).getNavigationHelper();
else throw new IllegalArgumentException("Cannot extract EMF base index from VIATRA Query engine instantiated on non-EMF scope " + scope);
}
代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.runtime
@Override
public Matcher getMatcher(ViatraQueryEngine engine) {
ensureInitializedInternal();
if (wrappedPQuery.getStatus() == PQueryStatus.ERROR) {
String errorMessages = wrappedPQuery.getPProblems().stream()
.map(input -> (input == null) ? "" : input.getShortMessage()).collect(Collectors.joining("\n"));
throw new ViatraQueryException(String.format("Erroneous query specification: %s %n %s", getFullyQualifiedName(), errorMessages),
"Cannot initialize matchers on erroneous query specifications.");
} else if (!engine.getScope().isCompatibleWithQueryScope(this.getPreferredScopeClass())) {
throw new ViatraQueryException(
String.format(
"Scope class incompatibility: the query %s is formulated over query scopes of class %s, "
+ " thus the query engine formulated over scope %s of class %s cannot evaluate it.",
this.getFullyQualifiedName(), this.getPreferredScopeClass().getCanonicalName(),
engine.getScope(), engine.getScope().getClass().getCanonicalName()),
"Incompatible scope classes of engine and query.");
}
return instantiate(engine);
}
内容来源于网络,如有侵权,请联系作者删除!