[great-users] RE: Translator

Zsolt Kalmar kalmar at isis.vanderbilt.edu
Tue Sep 27 17:02:34 CDT 2005


Sorry. It not finished.

You will see something like this in the main file of the generated code
(it is a working sample from our previous projects ESML2PRISM ) 

 

 

            try

            {

                        std::vector< Udm::StaticDataNetworkSpecifier>
dnsvec;

                        // Open ESML r

                        Udm::SmartDataNetwork sdnESML_836(
ESML::diagram);

                        sdnESML_836.OpenExisting( ifr.getFileName(
"ESML"), UseXSD()( ifr.getFileName( "ESML")) ? ifr.getXsdName( "ESML") :
"ESML", Udm::CHANGES_LOST_DEFAULT);

                        Udm::StaticDataNetworkSpecifier sdns_ESML_837(
ifr.getFileName( "ESML"), &sdnESML_836);

                        dnsvec.push_back( sdns_ESML_837);

                        // Open PRISM w

                        Udm::SmartDataNetwork sdnPRISM_833(
PRISM::diagram);

                        sdnPRISM_833.CreateNew( ifr.getFileName(
"PRISM"), UseXSD()( ifr.getFileName( "PRISM")) ? ifr.getXsdName(
"PRISM") : "PRISM", PRISM::ESCM::meta, Udm::CHANGES_LOST_DEFAULT);

                        Udm::StaticDataNetworkSpecifier sdns_PRISM_834(
ifr.getFileName( "PRISM"), &sdnPRISM_833);

                        dnsvec.push_back( sdns_PRISM_834);

                        // Create the project

                        Udm::StaticUdmProject prj( dnsvec,
ESML2PRISMRules::diagram);

                        Udm::DataNetwork& eSML_ref_838=
prj.GetDataNetwork( ifr.getFileName( "ESML"));

                        Udm::DataNetwork& pRISM_ref_835=
prj.GetDataNetwork( ifr.getFileName( "PRISM"));

                        Packets_t eSCMIns_1;

                        Packets_t eSMLs_3;

                        // get objects from DNs

                        PRISM::ESCM rootPRISM_839= PRISM::ESCM::Cast(
pRISM_ref_835.GetRootObject());

                        eSCMIns_1.push_back( rootPRISM_839);

                        ESML::RootFolder rootESML_83a=
ESML::RootFolder::Cast( eSML_ref_838.GetRootObject());

                        eSMLs_3.push_back( rootESML_83a);

                        // transformation

                        ESML2PRISM_0 eSML2PRISM_0;

                        eSML2PRISM_0( eSCMIns_1, eSMLs_3);

                        // Close the project

                        prj.Close();

                        // Close ESML r

                        sdnESML_836.CloseNoUpdate();

                        // Close PRISM w

                        sdnPRISM_833.CloseWithUpdate();

            }

 

You need to take out the code snippets which invokes the transformation
and adjust it to OTIF receiver's notify method:

 

 

  void notify(const char *name, const char *version, const char
*remarks, const unsigned long numOfDocs) 

  {

 

    std::string fromID("from");

    std::string toID("to");

 

    std::vector< Udm::StaticDataNetworkSpecifier> dnsvec;

 

                        Udm::StaticDataNetworkSpecifier
sdns_ESML_847(fromID , fromDN);

                        dnsvec.push_back( sdns_ESML_847);

 

                        Udm::StaticDataNetworkSpecifier
sdns_PRISM_844(toID , toDN);

                        dnsvec.push_back( sdns_PRISM_844);

 

                        // Create the project

                        Udm::StaticUdmProject prj( dnsvec,
ESML2PRISMRules::diagram);

 

                        Udm::DataNetwork& eSML_ref_848=
prj.GetDataNetwork( fromID);

                        Udm::DataNetwork& pRISM_ref_845=
prj.GetDataNetwork( toID);

 

                        Packets_t eSMLs_1;

                        Packets_t eSCMIns_3;

                        // get objects from DNs

                        PRISM::ESCM rootPRISM_849= PRISM::ESCM::Cast(
pRISM_ref_845.GetRootObject());

                        eSCMIns_3.push_back( rootPRISM_849);

                        ESML::RootFolder rootESML_84a=
ESML::RootFolder::Cast( eSML_ref_848.GetRootObject());

                        eSMLs_1.push_back( rootESML_84a);

                        // transformation

                        ESML2PRISM_0 eSML2PRISM_0;

                        eSML2PRISM_0( eSCMIns_3, eSMLs_1);

 

                        // Close the project

                        prj.Close();

            publish(name, version, "After the ESML->PRISM translation");

 

            }

 

HTH,

zsolt

  _____  

From: Zsolt Kalmar 
Sent: Tuesday, September 27, 2005 3:57 PM
To: 'Naiser, Samuel L'
Cc: great-users
Subject: RE: Translator

 

I see.

First you need to generate a code from your Hops2HopsUML translator code
using Great Code Generator. All your great issues will be answered on
our great mailing list

great-users at list.isis.vanderbilt.edu

Make sure that your generated translator works by testing it from
command line.

 

I suggest first writing a dummy translator by hand and make it work in
OTIF framework then you need to put 

 

 

 

 

  _____  

From: Naiser, Samuel L [mailto:samuel.l.naiser at lmco.com] 
Sent: Tuesday, September 27, 2005 12:29 PM
To: Zsolt Kalmar
Subject: RE: Translator

 

We are planning having several different application which generate data

needed by other applications share that data.  Generally, the data will

be exported in xml and transformed/converted to another form that the

receiving application can use.  That is, export xml and transform it
into

different objects that can be imported into GME.  Maybe export xml and

convert it into a format for an Excel spreadsheet.  We haven't defined

all of the interactions yet.  My job is to understand your tools and

create examples to prove that we can use them.

My task was to build a front end application that we can use to model

the onboard processors and networks on an aircraft and using this

model, create a set of tasks/subtasks along with message traffic that
will be 

assigned to specific processors.  Part of this task is to use what I
have 

send you, Hops, that is created by another application.  This defines

the network connection between Processor(a) and Processor(b).  Also,

there is another set of data that defines the message traffic and lists

the hops needed to get the message from Processor(a) to Processor(b).

after importing this information into our GME model, I have written an

interpreter that converts those GME Objects into a file of information

that can be read by an RMA Analyzer tool and determine the
schedulability

of the Tasks/Subtasks, and thus the system.

In my case, what I sent you, Hops.mga represents the xml that we will

use as input.  HopsFolder.mga is the GME model which represents the

GME objects that I will use to represent the Hops in my GME Model.

Hops2HopsGME is the transformation from Hops objects to HopsFolder

Objects.  After thinking, in this instance, I can just convert from one

type of object to another and save as xml to be imported by GME.  But,

I do not know about future requirements.

I hope this helps - my main concern now is converting the input object

to the output object, not the same.

I hope this helps with your understanding.

Thank you,

Sam 

 

  _____  

From: Zsolt Kalmar [mailto:kalmar at isis.vanderbilt.edu] 
Sent: Tuesday, September 27, 2005 9:19 AM
To: Naiser, Samuel L
Subject: RE: Translator

 

Hi,

Could you share with me the big picture? What is the purpose of your
transformation?

What should be the input and the output meta models?

If they are semantically same just in different format (eg. Gme meta
format to UML meta format) does not need Great (nor OTIF).

Thanks,

zsolt

 

 

  _____  

From: Naiser, Samuel L [mailto:samuel.l.naiser at lmco.com] 
Sent: Tuesday, September 27, 2005 7:52 AM
To: Zsolt Kalmar
Subject: Translator

 

I have enclosed the three scenarios necessary to convert the Hops xml 

to a new representation in GME.  I am at a loss how to construct the

Translator to take the xml input and convert it to new objects and

save it as a GME .mga file.

I have attached the .mga, .cpp, .h, and .xsd for what I think will
define

the publish, translate, and receive functions.  I am not sure of the 

Hops2HopsUML.mga.  It is just what was defined in the GReAT

transformation  and interpreted by the UML2UDM/XML Interpreter.

I am not sure how to handle that metamodel.

If you have any examples that do what I am trying to do, that would

be very helpful.  I think that one can create a translator just using
the

.cpp and .h from GReAT, but I am not sure how to code the interface.

The example in the Usage Guide does the transformation manually,

I think.

Any assistance will be appreciated.

Thank you,

Sam

 

Samuel L Naiser

Lockheed Martin Aeronautics

samuel.l.naiser at lmco.com

Office:  817-935-3839

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/great-users/attachments/20050927/05ef2b58/attachment.htm


More information about the great-users mailing list