Example list persistent classes with name, type, primary key and foreign keys using %Dictionary

Primary tabs

Replies

Persistent classes:

SELECT Name
FROM %Dictionary.ClassDefinition_SubclassOf('%Persistent')

List properties and relationships (if you need subset - filter by parent - it's a class):

SELECT
parent,  Name, Cardinality, Collection, Id, _Identity,  Relationship, Type
FROM %Dictionary.CompiledProperty

Foreign keys:

SELECT
parent, Name, Properties, ReferencedClass, ReferencedKey
FROM %Dictionary.ForeignKeyDefinition

For everything %Dictionary.Compiled* - includes defined and inherited values, Definitions include only items defined in a current class.