Meta-level queries
Hawk extends the regular EOL facilities to be able to query the metamodels registered within the instance:
Model.fileslists all the files indexed by Hawk (may be limited through the context).Model.getFileOf(obj)retrieves the first file containing the objectobj.Model.getFilesOf(obj)retrieves all the files containing the objectobj.Model.getProxies(repositoryPrefix)lists all the proxy reference lists for files in repositories matching the specified prefix.Model.getTypeOf(obj)retrieves the type of the objectobj.Model.metamodelslists all the metamodels registered in Hawk (EPackageinstances for EMF).Model.proxieslists all the proxy reference lists present in the graph. Each proxy reference list is a collection of the unresolved references from a model element node to the elements of a particular file. For details, please consult the advanced properties page.Model.typeslists all the types registered in Hawk (EClassinstances for EMF).
Metamodels¶
For a metamodel mm, these attributes are available:
mm.dependencieslists the metamodels this metamodel depends on (usually at least the Ecore metamodel for EMF-based metamodels).mm.metamodelTypeis the type of metamodel that was registered.mm.nodereturns the underlyingIGraphNode.mm.resourceretrieves the original string representation for this metamodel (the original.ecorefile for EMF).mm.typeslists the types defined in this metamodel.mm.uriis the namespace URI of the metamodel.
Types¶
For a type t, these attributes are available:
t.allSubtypes(since 2.3.0) lists all direct and indirect subtypes of the type.t.allSupertypes(since 2.3.0) lists all direct and indirect supertypes of the type.t.allretrieves all instances of that type efficiently (includes subtypes).t.attributeslists the attributes of the type, as slots (see below).t.featureslists the attributes and references of the type.t.metamodelretrieves the metamodel that defines the type.t.nameretrieves the name of the type.t.nodereturns the underlyingIGraphNode.t.referenceslists the references of the type, as slots.
Slots¶
For a slot sl, these attributes are available:
sl.instanceTypeName(since 2.3.0): name of the Java instance type for values of this slot.sl.isAttribute: true if and only if this is an attribute slot.sl.isMany: true if and only if this is a multi-valued slot.sl.isOrdered: true if and only if the values should follow some order.sl.isReference: true if and only if this is a reference slot.sl.isUnique: true if and only if the value for this slot should be unique within its model.sl.name: name of the slot.sl.type(since 2.3.0): for reference slots, returns the type of the target(s).nullfor attribute slots.
Files¶
For a file f, these attributes are available:
f.contents: returns all the model elements in the file.f.node: returns the underlyingIGraphNode.f.path: returns the path of the file within the repository (e.g./input.xmi).f.repository: returns the URL of the repository (e.g.file:///home/myuser/models).f.roots: returns the root model elements in the file.