Bug 449142 - Introduce file I/O operations
Summary: Introduce file I/O operations
Status: NEW
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 396543
  Show dependency tree
 
Reported: 2014-10-29 03:41 EDT by Ed Willink CLA
Modified: 2018-05-11 07:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2014-10-29 03:41:12 EDT
From Bug 396543.

File I/O seems horrible, but the handling of multiple input and output models programmatically is currently awkward. I have had to recommend use of a spurious top level container of models. Provision of an 'initial' load of a model variable from an external file, relative to a invocation context, and a 'final' save of a model variable again to a file relative to an invocation context would be useful for debugging and general multi-input/output scenarios. If the saved model happens to be a String then you have MtoT file I/O.

First suggestion, something like

transformation MyTx(in inFiles : Folder, out outFiles : Folder);


var myModel : MyModel := inFiles("my/Input.dat");

outFiles("my/Output.dat") := ....

Folder is a new built in type perhaps with some helper functions such as files(), folders().

Some semantics.

a load failure may throw an Exception.

load and save occur just once. Repeated loads share the one load. Repeated saves throw an Exception. i.e no anarchic update/append. But a single load-recompute-save is permitted.

all saves occur after all resolves have happened, i.e. pretty much as QVTo exits. No saves occur for a premature exit.
Comment 1 Sergey Boyko CLA 2014-10-29 05:32:23 EDT
(In reply to Ed Willink from comment #0)
> From Bug 396543.
> 
> File I/O seems horrible, but the handling of multiple input and output
> models programmatically is currently awkward. I have had to recommend use of
> a spurious top level container of models. Provision of an 'initial' load of
> a model variable from an external file, relative to a invocation context,
> and a 'final' save of a model variable again to a file relative to an
> invocation context would be useful for debugging and general
> multi-input/output scenarios. If the saved model happens to be a String then
> you have MtoT file I/O.
> 
> First suggestion, something like
> 
> transformation MyTx(in inFiles : Folder, out outFiles : Folder);
> 
> 
> var myModel : MyModel := inFiles("my/Input.dat");
> 
> outFiles("my/Output.dat") := ....
> 
> Folder is a new built in type perhaps with some helper functions such as
> files(), folders().
> 
> Some semantics.
> 
> a load failure may throw an Exception.
> 
> load and save occur just once. Repeated loads share the one load. Repeated
> saves throw an Exception. i.e no anarchic update/append. But a single
> load-recompute-save is permitted.
> 
> all saves occur after all resolves have happened, i.e. pretty much as QVTo
> exits. No saves occur for a premature exit.

Hi Ed,

Proposal looks reasonable. Also it correlates with Bug 295193.

As for implementation details I don't see necessity in providing any built-in types/functions. Blackbox library extension solves described scenario. 'Folder' type will be simplified to regular String.
Comment 2 Ed Willink CLA 2014-10-29 08:02:20 EDT
I don't know enough about blackboxes to see how they can help.

I think a built-in type is needed to signal in the Transformation signature that the parameter corresponds to a hierarchical node in some repository (typically a filesystem folder).

A library type is sufficient to allow programmatic traversal

inFiles.files()->forAll(file : String | ....)
Comment 3 Ed Willink CLA 2018-05-11 07:16:10 EDT
(In reply to Ed Willink from comment #0)
> If the saved model happens to be a String then you have MtoT file I/O.

Yes, but a rather different issue to multi-file I/O. See Bug 534575 for a much simpler approach to supporting transformation in the XML and Text technology spaces.