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 han‐
23 dle'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 par‐
25 ticular model.
26
28 new()
29
30 $model = Ace::Model->new($model_data);
31
32 This is a constructor intended only for use by Ace and Ace::Object
33 classes. It constructs a new Ace::Model object from the raw string
34 data in models.wrm.
35
36 name()
37
38 $name = $model->name;
39
40 This returns the class name for the model.
41
42 tags()
43
44 @tags = $model->tags;
45
46 This returns a list of all the valid tags in the model.
47
48 valid_tag()
49
50 $boolean = $model->valid_tag($tag);
51
52 This returns true if the given tag is part of the model.
53
54 path()
55
56 @path = $model->path($tag)
57
58 Returns the path to the indicated tag, returning a list of intermediate
59 tags. For example, in the C elegans ?Locus model, the path for 'Com‐
60 pelementation_data" will return the list ('Type','Gene').
61
62 asString()
63
64 print $model->asString;
65
66 asString() returns the human-readable representation of the model with
67 comments stripped out. Internally this method is called to automati‐
68 cally convert the model into a string when appropriate. You need only
69 to start performing string operations on the model object in order to
70 convert it into a string automatically:
71
72 print "Paper is unique" if $model=~/Paper ?Paper UNIQUE/;
73
75 Ace
76
78 Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-
79 Mieg <mieg@kaa.crbm.cnrs-mop.fr>
80
81 Copyright (c) 1997-1998, Lincoln D. Stein
82
83 This library is free software; you can redistribute it and/or modify it
84 under the same terms as Perl itself.
85
86
87
88perl v5.8.8 2001-02-20 Ace::Model(3)