UR::Ma...tadata(3pm)

πŸ“¦
version 0.470 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– UR::Manual::Metadata β€” the tea on metadata in UR πŸ’–

okay bestie, this is the UR::Manual::Metadata page from the User Contributed Perl Documentation β€” it's your backstage pass to all the metadata classes in UR. no gatekeeping, let's go πŸ’…


✨ SYNOPSIS ✨

use MyNamespace;
my $class_meta = MyNamespace::SomeClass->__meta__;
my @property_metas = $class_meta->direct_property_metas();
my @parent_class_metas = $class_meta->ancestry_class_metas();

my $table_obj = UR::DataSource::RDBMS::Table->get(
                table_name => $class_meta->table_name,
            );
my @column_objs = $table_obj->columns();

🌸 DESCRIPTION 🌸

So the UR system is out here creating and using a whole bunch of classes and objects to represent info about the many classes and objects in the system β€” and that, my love, is metadata. πŸ¦‹

Like, for every class there's an object (a class metadata object, if we're being fancy) that represents it. Every property in a class has metadata too. Same goes for the relationship between parent and child classes, and the relationships tangled up in delegated properties. And metadata about any database schemas your namespace knows about? Also tracked and stored. she does it all πŸ’…

These classes define an API for introspection and reflection β€” basically a way for the system to change itself while it's running β€” plus methods for tracking changes and applying those changes to files and databases. main character energy fr fr πŸ‘‘


πŸ”₯ APIs πŸ”₯

The metadata API is divided into 5 primary parts:

πŸŽ€ Defining Classes

The mechanism for defining class structure, including their properties and relationships. It handles creating accessor/mutator methods for you. (yes bestie, it writes them for you, we love a generous icon ✨)

The syntax for defining classes is detailed in the UR::Object::Type::Initializer page.

🫢 Objects Representing Classes, Properties, Relationships, etc.

UR Classes aren't just conceptual entities like a package name β€” nope, they have actual object instances representing them. no cap.

  • For every named class, you can get a UR::Object::Type instance with that "class_name".
  • Each property defined on that class has a UR::Object::Property with a matching "class_name" and "property_name" pair.
  • And the plot twist? Even those basic metadata classes have class, property and relationship metadata of their own. it's meta, it's recursive, it's giving inception πŸ’€

🌈 Schema Objects

If you use the ur update classes command-line tool to manage the linkage between your database schema(s) and class structure (it's not necessary, btw β€” you can also manage it by hand, do whatever feels right 🧚), then objects will also exist to represent the database entities. See also UR::DataSource::Meta

  • tables β†’ UR::DataSource::RDBMS::Table
  • columns β†’ UR::DataSource::RDBMS::TableColumn
  • Foreign key constraints β†’ UR::DataSource::RDBMS::FkConstraint and UR::DataSource::RDBMS::FkConstraintColumn
  • Primary key constraints β†’ UR::DataSource::RDBMS::PkConstraintColumn
  • Unique constraints β†’ UR::DataSource::RDBMS::UniqueConstraintColumn

πŸ’œ Namespaces, Contexts and Data Sources

Namespaces (UR::Namespace) collect and manage groups of related classes. A class can be a member of one Namespace, and in practice will live in a subdirectory under the Namespace module's name. πŸ“

Contexts (UR::Context) and Data Sources (UR::DataSource) provide a filtered view of the data that is reachable through the current Namespace.

πŸ“ Index, Change, Observer and other incidentals

And then there's everything else πŸ™ˆ

  • UR::Object::Index objects are created by the system to handle get() requests for non-ID parameters.
  • UR::Change objects represent a change in the system during a software transaction, such as an object's property changind value or creating a new instance of something.
  • UR::Observer objects manage the change subscription system, where the application can be notified of changes through callbacks. See also "create_subscription" in UR::Object.

ngl that's the whole vibe check. every class, every property, every relationship, every schema β€” all tracked, all introspectable, all iconic πŸ’–

mwah πŸ’‹ this was perl v5.32.1, dated 2022-01-17, straight from UR::Ma...tadata(3pm) β€” thanks for reading bestie, you ate 🫢✨

πŸ“¦ where this page comes from