1 package SQL::Translator::XMI::Parser::V12;
3 # -------------------------------------------------------------------
4 # $Id: V12.pm,v 1.2 2003-10-01 17:45:47 grommit Exp $
5 # -------------------------------------------------------------------
6 # Copyright (C) 2003 Mark Addison <mark.addison@itn.co.uk>,
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; version 2.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # -------------------------------------------------------------------
27 SQL::Translator::XMI::Parser::V12 - Version 1.2 parser.
33 use vars qw/$VERSION/;
34 $VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
36 use base qw(SQL::Translator::XMI::Parser);
44 default_path => '//UML:Class[@xmi.id]',
46 [qw/name visibility isSpecification isRoot isLeaf isAbstract isActive/],
50 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
57 # name in data returned
58 path => "UML:Classifier.feature/UML:Attribute",
60 # Points to class in spec. get_attributes() called to parse it and
61 # adds filter_attributes to the args for get_classes().
63 # How many we get back. Use '1' for 1 and '*' for lots.
64 # TODO If not set then decide depening on the return?
68 path => "UML:Classifier.feature/UML:Operation",
73 name => "taggedValues",
74 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
75 class => "taggedValue",
78 # Add a _map_taggedValues to the data. Its a hash of the name data
79 # which refs the normal list of kids
82 name => "associationEnds",
83 path => '//UML:AssociationEnd.participant/UML:Class[@xmi.idref="${xmi.id}"]/../..',
84 # ${xmi.id} is a variable sub from the data defined for this thing.
85 # Not standard XPath! Done in the get sub
86 class => "AssociationEnd",
92 $spec12->{taggedValue} = {
93 name => "taggedValue",
94 plural => "taggedValues",
95 default_path => '//UML:TaggedValue[@xmi.id]',
96 attrib_data => [qw/isSpecification/],
100 path => 'UML:TaggedValue.dataValue/text()',
104 path => 'xmiDeref(UML:TaggedValue.type/UML:TagDefinition)/@name',
109 $spec12->{attribute} = {
111 plural => "attributes",
112 default_path => '//UML:Classifier.feature/UML:Attribute[@xmi.id]',
114 [qw/name visibility isSpecification ownerScope/],
117 name => "stereotype",
118 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
123 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name',
126 name => "initialValue",
127 path => 'UML:Attribute.initialValue/UML:Expression/@body',
132 name => "taggedValues",
133 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
134 class => "taggedValue",
141 $spec12->{operation} = {
143 plural => "operations",
144 default_path => '//UML:Classifier.feature/UML:Operation[@xmi.id]',
146 [qw/name visibility isSpecification ownerScope isQuery
147 concurrency isRoot isLeaf isAbstract/],
150 name => "stereotype",
151 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
157 name => "parameters",
158 path => "UML:BehavioralFeature.parameter/UML:Parameter",
159 class => "parameter",
163 name => "taggedValues",
164 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
165 class => "taggedValue",
172 $spec12->{parameter} = {
174 plural => "parameters",
175 default_path => '//UML:Parameter[@xmi.id]',
176 attrib_data => [qw/name isSpecification kind/],
179 name => "stereotype",
180 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
185 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name',
190 $spec12->{association} = {
191 name => "association",
192 plural => "associations",
194 default_path => '//UML:Association[@xmi.id]',
195 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
198 name => "stereotype",
199 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
206 path => "UML:Association.connection/UML:AssociationEnd",
207 class => "AssociationEnd",
213 $spec12->{AssociationEnd} = {
216 default_path => '//UML:AssociationEnd',
217 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
220 name => "stereotype",
221 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
226 path => 'xmiDeref(UML:AssociationEnd.participant/UML:Class)/@name',
232 name => "association",
234 class => "association",
238 name => "participant",
239 path => "xmiDeref(UML:AssociationEnd.participant/UML:Class)",
246 # Set the spec and have the get_* methods generated
247 __PACKAGE__->XmiSpec($spec12);
249 #-----------------------------------------------------------------------------
253 # print "HELLO 1.2\n";
254 # shift->SUPER::get_classes(@_);
257 1; #===========================================================================
273 =head1 VERSION HISTORY
277 grommit <mark.addison@itn.co.uk>