1 package SQL::Translator::XMI::Parser::V12;
3 # -------------------------------------------------------------------
4 # $Id: V12.pm,v 1.4 2003-10-03 18:07:13 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.4 $ =~ /(\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',
158 name => "taggedValues",
159 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
160 class => "taggedValue",
169 $spec12->{operation} = {
171 plural => "operations",
172 default_path => '//UML:Classifier.feature/UML:Operation[@xmi.id]',
174 [qw/name visibility isSpecification ownerScope isQuery
175 concurrency isRoot isLeaf isAbstract/],
178 name => "stereotype",
179 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
185 name => "parameters",
186 path => "UML:BehavioralFeature.parameter/UML:Parameter",
187 class => "parameter",
191 name => "taggedValues",
192 path => 'UML:ModelElement.taggedValue/UML:TaggedValue',
193 class => "taggedValue",
200 $spec12->{parameter} = {
202 plural => "parameters",
203 default_path => '//UML:Parameter[@xmi.id]',
204 attrib_data => [qw/name isSpecification kind/],
207 name => "stereotype",
208 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
213 path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name',
218 $spec12->{association} = {
219 name => "association",
220 plural => "associations",
222 default_path => '//UML:Association[@xmi.id]',
223 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
226 name => "stereotype",
227 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
234 path => "UML:Association.connection/UML:AssociationEnd",
235 class => "AssociationEnd",
241 $spec12->{AssociationEnd} = {
244 default_path => '//UML:AssociationEnd',
245 attrib_data => [qw/name visibility isSpecification isNavigable ordering aggregation targetScope changeability/],
248 name => "stereotype",
249 path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name',
254 path => 'xmiDeref(UML:AssociationEnd.participant/UML:Class)/@name',
260 name => "association",
262 class => "association",
266 name => "participant",
267 path => "xmiDeref(UML:AssociationEnd.participant/UML:Class)",
274 # Set the spec and have the get_* methods generated
275 __PACKAGE__->XmiSpec($spec12);
277 #-----------------------------------------------------------------------------
281 # print "HELLO 1.2\n";
282 # shift->SUPER::get_classes(@_);
285 1; #===========================================================================
301 =head1 VERSION HISTORY
305 grommit <mark.addison@itn.co.uk>