1Ace::Model(3) User Contributed Perl Documentation Ace::Model(3)
2
3
4
6 Ace::Model - Get information about AceDB models
7
9 use Ace;
10 my $db = Ace->connect(-path=>'/usr/local/acedb/elegans');
11 my $model = $db->model('Author');
12 print $model;
13 $name = $model->name;
14 @tags = $model->tags;
15 print "Paper is a valid tag" if $model->valid_tag('Paper');
16
18 This class is provided for access to AceDB class models. It provides
19 the model in human-readable form, and does some limited but useful
20 parsing on your behalf.
21
22 Ace::Model objects are obtained either by calling an Ace database
23 handle's model() method to retrieve the model of a named class, or by
24 calling an Ace::Object's model() method to retrieve the object's
25 particular model.
26
28 new()
29 $model = Ace::Model->new($model_data);
30
31 This is a constructor intended only for use by Ace and Ace::Object
32 classes. It constructs a new Ace::Model object from the raw string
33 data in models.wrm.
34
35 name()
36 $name = $model->name;
37
38 This returns the class name for the model.
39
40 tags()
41 @tags = $model->tags;
42
43 This returns a list of all the valid tags in the model.
44
45 valid_tag()
46 $boolean = $model->valid_tag($tag);
47
48 This returns true if the given tag is part of the model.
49
50 path()
51 @path = $model->path($tag)
52
53 Returns the path to the indicated tag, returning a list of intermediate
54 tags. For example, in the C elegans ?Locus model, the path for
55 'Compelementation_data" will return the list ('Type','Gene').
56
57 asString()
58 print $model->asString;
59
60 asString() returns the human-readable representation of the model with
61 comments stripped out. Internally this method is called to
62 automatically convert the model into a string when appropriate. You
63 need only to start performing string operations on the model object in
64 order to convert it into a string automatically:
65
66 print "Paper is unique" if $model=~/Paper ?Paper UNIQUE/;
67
69 Ace
70
72 Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-
73 Mieg <mieg@kaa.crbm.cnrs-mop.fr>
74
75 Copyright (c) 1997-1998, Lincoln D. Stein
76
77 This library is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79
80
81
82perl v5.32.1 2021-01-26 Ace::Model(3)