f6449dc1c851888164e5b82e78567a6cd6e79e96
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / XMI / Parser / V10.pm
1 package SQL::Translator::XMI::Parser::V10;
2
3 # -------------------------------------------------------------------
4 # $Id: V10.pm,v 1.1 2003-09-29 12:02:36 grommit Exp $
5 # -------------------------------------------------------------------
6 # Copyright (C) 2003 Mark Addison <mark.addison@itn.co.uk>,
7 #
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.
11 #
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.
16 #
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
20 # 02111-1307  USA
21 # -------------------------------------------------------------------
22
23 =pod
24
25 =head1 NAME
26
27 SQL::Translator::XMI::Parser::V10 - Version 1.0 parser.
28
29 =cut
30
31 use strict;
32 use 5.006_001;
33 use vars qw/$VERSION/;
34 $VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/;
35
36 use base qw(SQL::Translator::XMI::Parser);
37
38 my $spec10 = {};
39
40 $spec10->{class} = {
41     name   => "class",
42     plural => "classes",
43         isRoot  => 1,
44     default_path => '//Foundation.Core.Class[@xmi.id]',
45     attrib_data => [],
46     path_data => [
47         { 
48             name  => "name",
49             path  => 'Foundation.Core.ModelElement.name/text()',
50         },
51         { 
52             name => "visibility",
53             path => 'Foundation.Core.ModelElement.visibility/@xmi.value',
54         },
55         { 
56             name => "isSpecification",
57             path => 'Foundation.Core.ModelElement.isSpecification/@xmi.value',
58         },
59         { 
60             name => "isRoot",
61             path => 'Foundation.Core.GeneralizableElement.isRoot/@xmi.value',
62         },
63         { 
64             name => "isLeaf",
65             path => 'Foundation.Core.GeneralizableElement.isLeaf/@xmi.value',
66         },
67         { 
68             name => "isAbstract",
69             path => 'Foundation.Core.GeneralizableElement.isAbstract/@xmi.value',
70         },
71         { 
72             name => "isActive",
73             path => 'Foundation.Core.Class.isActive/@xmi.value',
74         },
75     ],
76     kids => [
77             { 
78             name  => "attributes",
79             path  => 
80                 'Foundation.Core.Classifier.feature/Foundation.Core.Attribute',
81             class => "attribute", 
82             multiplicity => "*",
83         },
84     #    { 
85     #        name  => "operations",
86     #        path  => "UML:Classifier.feature/UML:Operation",
87     #        class => "operation", 
88     #        multiplicity => "*",
89     #    },
90     ],
91 };
92
93 $spec10->{attribute} = {
94     name => "attribute",
95     plural => "attributes",
96     default_path => '//Foundation.Core.Attribute[@xmi.id]',
97     path_data => [
98         { 
99             name  => "name",
100             path  => 'Foundation.Core.ModelElement.name/text()',
101         },
102         { 
103             name => "visibility",
104             path => 'Foundation.Core.ModelElement.visibility/@xmi.value',
105         },
106         { 
107             name => "isSpecification",
108             path => 'Foundation.Core.ModelElement.isSpecification/@xmi.value',
109         },
110         { 
111             name => "ownerScope",
112             path => 'Foundation.Core.Feature.ownerScope/@xmi.value',
113         },
114                 { 
115             name  => "initialValue",
116             path  => 'Foundation.Core.Attribute.initialValue/Foundation.Data_Types.Expression/Foundation.Data_Types.Expression.body/text()',
117         },
118                 #{ 
119         #    name  => "datatype",
120         #    path  => 'xmiDeref(Foundation.Core.StructuralFeature.type/Foundation.Core.Classifier)/Foundation.Core.DataType/Foundation.Core.ModelElement.name/text()',
121         #},
122     ],
123 };
124
125 __PACKAGE__->XmiSpec($spec10);
126
127 #-----------------------------------------------------------------------------
128
129 sub get_classes {
130         print "******************* HELLO 1.0 ********************\n";
131         shift->_get_classes(@_);
132 }
133
134 1; #===========================================================================
135
136 __END__
137
138 =head1 SYNOPSIS
139
140 =head1 DESCRIPTION
141
142 =head1 SEE ALSO
143
144 perl(1).
145
146 =head1 TODO
147
148 =head1 BUGS
149
150 =head1 VERSION HISTORY
151
152 =head1 AUTHOR
153
154 grommit <mark.addison@itn.co.uk>
155
156 =head1 LICENSE
157
158 This package is free software and is provided "as is" without express or
159 implied warranty. It may be used, redistributed and/or modified under the
160 terms of either;
161
162 a) the Perl Artistic License.
163
164 See F<http://www.perl.com/perl/misc/Artistic.html>
165
166 b) the terms of the GNU General Public License as published by the Free Software
167 Foundation; either version 1, or (at your option) any later version.
168
169 =cut