This section uses the iModel Console to execute queries against the Stadium
sample iModel.
- Go to https://imodelconsole.bentley.com
- Select the project, then select an iModel then select a changeset
- Wait until the green button in the lower right says Run
There are two types of aspect, unique and multi. They are stored in independent tables and must be queried for independently.
-
Query for aspects in the iModel
SELECT * FROM bis.ElementMultiAspect
SELECT * FROM bis.ElementUniqueAspect
NOTE: The base aspect classes only have one property,
Element
it is a navigation property that points to the Element that owns the Aspect -
Query for aspects and the elements that own them
SELECT * FROM bis.ElementMultiAspect a JOIN bis.Element e ON e.ECInstanceId = a.Element.Id
-
Query for Element classes and the aspect classes applied to them
SELECT ec_classname(e.ECClassId) Element_Class, json_group_array(DISTINCT(ec_className(a.ECClassId))) Aspect_Classes FROM bis.Element e JOIN bis.ElementMultiAspect a ON a.Element.Id = e.ECInstanceId GROUP BY e.ECClassId
Queries like this that look for distinct classes are helpful when trying to determine the nature of the data in an iModel. Notice that
Generic.PhysicalObject
has the most aspect classes. -
Query for a specific Element and its aspects. This query uses the element selected by clicking on a glass section in the stadium.
SELECT * FROM bis.Element e JOIN bis.ElementMultiAspect a ON a.Element.Id = e.ECInstanceId WHERE e.ECInstanceId = 0x200000063de
-
Specialize query to get all properties
SELECT * FROM Generic.PhysicalObject e JOIN DgnCustomItemTypes_SS_Steel_Structure.GlassElementAspect a ON a.Element.Id = e.ECInstanceId JOIN bis.ExternalSourceAspect a2 ON a2.Element.Id = e.ECInstanceId WHERE e.ECInstanceId = 0x200000063de
Compare the properties selected to what is shown in Design Review.