X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FXMI%2FParser%2FV12.pm;h=4b1f7eb61ac50daa599649ceb14cb4796fe57639;hb=821a0fde221f5accf93e3f65efa77b5a6733cb5e;hp=f391f1572a79a2915f2496353e29c74df8aceca4;hpb=93f4a354f6e0a9c36ee6ce64da0600af974ffc05;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/XMI/Parser/V12.pm b/lib/SQL/Translator/XMI/Parser/V12.pm index f391f15..4b1f7eb 100644 --- a/lib/SQL/Translator/XMI/Parser/V12.pm +++ b/lib/SQL/Translator/XMI/Parser/V12.pm @@ -1,7 +1,7 @@ package SQL::Translator::XMI::Parser::V12; # ------------------------------------------------------------------- -# $Id: V12.pm,v 1.1 2003-09-29 12:02:36 grommit Exp $ +# $Id$ # ------------------------------------------------------------------- # Copyright (C) 2003 Mark Addison , # @@ -31,12 +31,29 @@ SQL::Translator::XMI::Parser::V12 - Version 1.2 parser. use strict; use 5.006_001; use vars qw/$VERSION/; -$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/; use base qw(SQL::Translator::XMI::Parser); my $spec12 = {}; +$spec12->{taggedValue} = { + name => "taggedValue", + plural => "taggedValues", + default_path => '//UML:TaggedValue[@xmi.id]', + attrib_data => [qw/isSpecification/], + path_data => [ + { + name => "dataValue", + path => 'UML:TaggedValue.dataValue/text()', + }, + { + name => "name", + path => 'xmiDeref(UML:TaggedValue.type/UML:TagDefinition)/@name', + }, + ], +}; + $spec12->{class} = { name => "class", plural => "classes", @@ -89,23 +106,6 @@ $spec12->{class} = { ], }; -$spec12->{taggedValue} = { - name => "taggedValue", - plural => "taggedValues", - default_path => '//UML:TaggedValue[@xmi.id]', - attrib_data => [qw/isSpecification/], - path_data => [ - { - name => "dataValue", - path => 'UML:TaggedValue.dataValue/text()', - }, - { - name => "name", - path => 'xmiDeref(UML:TaggedValue.type/UML:TagDefinition)/@name', - }, - ], -}; - $spec12->{attribute} = { name => "attribute", plural => "attributes", @@ -119,10 +119,6 @@ $spec12->{attribute} = { default => "", }, { - name => "datatype", - path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)/@name', - }, - { name => "initialValue", path => 'UML:Attribute.initialValue/UML:Expression/@body', }, @@ -135,9 +131,42 @@ $spec12->{attribute} = { multiplicity => "*", map => "name", }, + { + name => "dataType", + path => 'xmiDeref(UML:StructuralFeature.type/UML:DataType)', + class => "dataType", + multiplicity => "1", + }, ], }; +$spec12->{dataType} = { + name => "datatype", + plural => "datatypes", + isRoot => 1, + default_path => '//UML:DataType[@xmi.id]', + attrib_data => + [qw/name visibility isSpecification isRoot isLeaf isAbstract/], + path_data => [ + { + name => "stereotype", + path => 'xmiDeref(UML:ModelElement.stereotype/UML:Stereotype)/@name', + default => "", + }, + ], + kids => [ + { + name => "taggedValues", + path => 'UML:ModelElement.taggedValue/UML:TaggedValue', + class => "taggedValue", + multiplicity => "*", + map => "name", + }, + ], +}; + + + $spec12->{operation} = { name => "operation", plural => "operations", @@ -202,7 +231,7 @@ $spec12->{association} = { ], kids => [ { - name => "ends", + name => "associationEnds", path => "UML:Association.connection/UML:AssociationEnd", class => "AssociationEnd", multiplicity => "*", @@ -228,6 +257,12 @@ $spec12->{AssociationEnd} = { }, ], kids => [ + { + name => "association", + path => "../..", + class => "association", + multiplicity => "1", + }, { name => "participant", path => "xmiDeref(UML:AssociationEnd.participant/UML:Class)", @@ -235,24 +270,35 @@ $spec12->{AssociationEnd} = { multiplicity => "1", }, { - name => "association", - path => "../..", - class => "association", + name => "multiplicity", + #path => "xmiDeref(UML:AssociationEnd.multiplicity/UML:Multiplicity)", + path => 'UML:AssociationEnd.multiplicity/UML:Multiplicity', + class => "multiplicity", multiplicity => "1", }, ], }; +$spec12->{multiplicity} = { + name => "multiplicity", + plural => "multiplicities", + default_path => '//UML:Multiplicity[@xmi.id]', + attrib_data => [qw//], + path_data => [ + { + name => "rangeLower", + path => 'xmiDeref(UML:Multiplicity.range/UML:MultiplicityRange)/@lower', + }, + { + name => "rangeUpper", + path => 'xmiDeref(UML:Multiplicity.range/UML:MultiplicityRange)/@upper', + }, + ], +}; + # Set the spec and have the get_* methods generated __PACKAGE__->XmiSpec($spec12); -#----------------------------------------------------------------------------- - -# Test override -# sub get_classes { -# print "HELLO 1.2\n"; -# shift->SUPER::get_classes(@_); -# } 1; #===========================================================================