1 package SQL::Translator::XMI::Parser::V12;
3 # -------------------------------------------------------------------
4 # $Id: V12.pm,v 1.6 2003-10-06 15:06:20 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.6 $ =~ /(\d+)\.(\d+)/;
36 use base qw(SQL::Translator::XMI::Parser);
40 $spec12->{taggedValue} = {
41 name => "taggedValue",
42 plural => "taggedValues",
43 default_path => '//UML:TaggedValue[@xmi.id]',
44 attrib_data => [qw/isSpecification/],
48 path => 'UML:TaggedValue.dataValue/text()',
52 path => 'xmiDeref(UML:TaggedValue.type/UML:TagDefinition)/@name',
61 default_path => '//UML:Class[@xmi.id]',
63 [qw/name visibility isSpecification isRoot isLeaf isAbstract isActive/],
67 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
74 # name in data returned
75 path => "UML:Classifier.feature/UML:Attribute",
77 # Points to class in spec. get_attributes() called to parse it and
78 # adds filter_attributes to the args for get_classes().
80 # How many we get back. Use '1' for 1 and '*' for lots.
81 # TODO If not set then decide depening on the return?
85 path => "UML:Classifier.feature/UML:Operation",
90 name => "taggedValues",
91 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
92 class => "taggedValue",
95 # Add a _map_taggedValues to the data. Its a hash of the name data
96 # which refs the normal list of kids
99 name => "associationEnds",
100 path => '//UML:AssociationEnd.participant/UML:Class[@xmi.idref="${xmi.id}"]/../..',
101 # ${xmi.id} is a variable sub from the data defined for this thing.
102 # Not standard XPath! Done in the get sub
103 class => "AssociationEnd",
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',
122 name => "initialValue",
123 path => 'UML:Attribute.initialValue/UML:Expression/@body',
128 name => "taggedValues",
129 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
130 class => "taggedValue",
136 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)',
143 $spec12->{dataType} = {
145 plural => "datatypes",
147 default_path => '//UML:DataType[@xmi.id]',
149 [qw/name visibility isSpecification isRoot isLeaf isAbstract/],
152 name => "stereotype",
153 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
159 name => "taggedValues",
160 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
161 class => "taggedValue",
170 $spec12->{operation} = {
172 plural => "operations",
173 default_path => '//UML:Classifier.feature/UML:Operation[@xmi.id]',
175 [qw/name visibility isSpecification ownerScope isQuery
176 concurrency isRoot isLeaf isAbstract/],
179 name => "stereotype",
180 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
186 name => "parameters",
187 path => "UML:BehavioralFeature.parameter/UML:Parameter",
188 class => "parameter",
192 name => "taggedValues",
193 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
194 class => "taggedValue",
201 $spec12->{parameter} = {
203 plural => "parameters",
204 default_path => '//UML:Parameter[@xmi.id]',
205 attrib_data => [qw/name isSpecification kind/],
208 name => "stereotype",
209 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
214 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name',
219 $spec12->{association} = {
220 name => "association",
221 plural => "associations",
223 default_path => '//UML:Association[@xmi.id]',
224 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
227 name => "stereotype",
228 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
234 name => "associationEnds",
235 path => "UML:Association.connection/UML:AssociationEnd",
236 class => "AssociationEnd",
242 $spec12->{AssociationEnd} = {
245 default_path => '//UML:AssociationEnd',
246 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
249 name => "stereotype",
250 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
255 path => 'xmiDeref(UML:AssociationEnd.participant/UML:Class)/@name',
261 name => "association",
263 class => "association",
267 name => "participant",
268 path => "xmiDeref(UML:AssociationEnd.participant/UML:Class)",
273 name => "multiplicity",
274 #path => "xmiDeref(UML:AssociationEnd.multiplicity/UML:Multiplicity)",
275 path => 'UML:AssociationEnd.multiplicity/UML:Multiplicity',
276 class => "multiplicity",
282 $spec12->{multiplicity} = {
283 name => "multiplicity",
284 plural => "multiplicities",
285 default_path => '//UML:Multiplicity[@xmi.id]',
286 attrib_data => [qw//],
289 name => "rangeLower",
290 path => 'xmiDeref(UML:Multiplicity.range/UML:MultiplicityRange)/@lower',
293 name => "rangeUpper",
294 path => 'xmiDeref(UML:Multiplicity.range/UML:MultiplicityRange)/@upper',
299 # Set the spec and have the get_* methods generated
300 __PACKAGE__->XmiSpec($spec12);
303 1; #===========================================================================
319 =head1 VERSION HISTORY
323 grommit <mark.addison@itn.co.uk>