Ace::Model - Get information about AceDB models
use Ace; my $db = Ace->connect(-path=>'/usr/local/acedb/elegans'); my $model = $db->model('Author'); print $model; $name = $model->name; @tags = $model->tags; print "Paper is a valid tag" if $model->valid_tag('Paper');
This class is provided for access to AceDB class models. It provides the model in human-readable form, and does some limited but useful parsing on your behalf.
Ace::Model objects are obtained either by calling an Ace database handle's model() method to retrieve the model of a named class, or by calling an Ace::Object's model() method to retrieve the object's particular model.
$model = Ace::Model->new($model_data);
This is a constructor intended only for use by Ace and Ace::Object classes. It constructs a new Ace::Model object from the raw string data in models.wrm.
$name = $model->name;
This returns the class name for the model.
@tags = $model->tags;
This returns a list of all the valid tags in the model.
$boolean = $model->valid_tag($tag);
This returns true if the given tag is part of the model.
@path = $model->path($tag)
Returns the path to the indicated tag, returning a list of intermediate tags. For example, in the C elegans ?Locus model, the path for 'Compelementation_data" will return the list ('Type','Gene').
asString() returns the human-readable representation of the model with comments stripped out. Internally this method is called to automatically convert the model into a string when appropriate. You need only to start performing string operations on the model object in order to convert it into a string automatically:
print "Paper is unique" if $model=~/Paper ?Paper UNIQUE/;
Lincoln Stein <firstname.lastname@example.org> with extensive help from Jean Thierry-Mieg <email@example.com>
Copyright (c) 1997-1998, Lincoln D. Stein
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.