1 package SQL::Translator::XMI::Parser::V12;
3 # -------------------------------------------------------------------
4 # $Id: V12.pm,v 1.3 2003-10-03 13:17:28 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.3 $ =~ /(\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',
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",
146 default_path => '//UML:DataType[@xmi.id]',
148 [qw/name visibility isSpecification isRoot isLeaf isAbstract/],
151 name => "stereotype",
152 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
160 $spec12->{operation} = {
162 plural => "operations",
163 default_path => '//UML:Classifier.feature/UML:Operation[@xmi.id]',
165 [qw/name visibility isSpecification ownerScope isQuery
166 concurrency isRoot isLeaf isAbstract/],
169 name => "stereotype",
170 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
176 name => "parameters",
177 path => "UML:BehavioralFeature.parameter/UML:Parameter",
178 class => "parameter",
182 name => "taggedValues",
183 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
184 class => "taggedValue",
191 $spec12->{parameter} = {
193 plural => "parameters",
194 default_path => '//UML:Parameter[@xmi.id]',
195 attrib_data => [qw/name isSpecification kind/],
198 name => "stereotype",
199 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
204 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name',
209 $spec12->{association} = {
210 name => "association",
211 plural => "associations",
213 default_path => '//UML:Association[@xmi.id]',
214 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
217 name => "stereotype",
218 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
225 path => "UML:Association.connection/UML:AssociationEnd",
226 class => "AssociationEnd",
232 $spec12->{AssociationEnd} = {
235 default_path => '//UML:AssociationEnd',
236 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
239 name => "stereotype",
240 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
245 path => 'xmiDeref(UML:AssociationEnd.participant/UML:Class)/@name',
251 name => "association",
253 class => "association",
257 name => "participant",
258 path => "xmiDeref(UML:AssociationEnd.participant/UML:Class)",
265 # Set the spec and have the get_* methods generated
266 __PACKAGE__->XmiSpec($spec12);
268 #-----------------------------------------------------------------------------
272 # print "HELLO 1.2\n";
273 # shift->SUPER::get_classes(@_);
276 1; #===========================================================================
292 =head1 VERSION HISTORY
296 grommit <mark.addison@itn.co.uk>