Welcome, Guest
Username: Password: Remember me

TOPIC: XML format description

XML format description 8 years 2 months ago #140

  • alexh
  • alexh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Hi,

looking at an example:

<runnableItems xsi:type="sw:LabelAccess" data="//@swModel/@labels.7" access="write"/>

and at the corresponding xsd:

<xsd:attribute name="data" type="xsd:string"/>

data is just a "xsd:string". It looks a bit like a XPath but it isn't. It's easy to deduce what it should mean but for proper support, it would be good to have a specification for it. What is the format for these paths indexing into the xml file?

Thx,
Alex
Last Edit: 8 years 2 months ago by alexh.
The administrator has disabled public write access.

XML format description 8 years 2 months ago #141

  • Zakir
  • Zakir's Avatar
  • OFFLINE
  • AMALTHEA Developer
  • Posts: 5
  • Thank you received: 1
  • Karma: 0
Hello Alex,

In EMF, one of the possibility of specifying the references is through URI fragments.

In the case following text specified by you : "//@swModel/@labels.7" , is a URI fragment.

For details about it, refer the below links:
Info: EMF Resouce class also has various methods, which take URI fragment as parameter and return the matching objects

e.g: Resource.getEObject(String uriFragment);
The administrator has disabled public write access.

XML format description 8 years 2 months ago #142

  • hama
  • hama's Avatar
  • OFFLINE
  • AMALTHEA Developer
  • Posts: 15
  • Thank you received: 6
  • Karma: 1
Hi Alex,

the new references are name-based.

A LabelAccess looks like:
<runnableItems
	xsi:type="sw:LabelAccess"
	data="VotedDecelerationRate?type=sw.Label"
	access="read"
	isBuffered="inherited"/>

We normally build a reference based on the name and the type of an object.

The method computeUniqueName() is implemented for every referable object and will return the corresponding string.

The default implementation (in xtend2) is:
(if (name.nullOrEmpty)
	"no-name"
else
	URLEncoder.encode(name, StandardCharsets.UTF_8.toString))
+ "?type="
+ eClass.EPackage.name
+ "."
+ eClass.name

Regards,
Harald
The administrator has disabled public write access.

XML format description 8 years 2 months ago #143

  • alexh
  • alexh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Hi Harald,

we want to output amxmi files from an existing C/C++ program. Therefore, we need to understand how to correctly construct references which will be accepted by amalthea. The xsd specifies the overall structure, but not how to encode references.

Is there a backward/forward compatible way of encoding references?

Thx,
Alex
Last Edit: 8 years 2 months ago by alexh.
The administrator has disabled public write access.

XML format description 8 years 2 months ago #144

  • hama
  • hama's Avatar
  • OFFLINE
  • AMALTHEA Developer
  • Posts: 15
  • Thank you received: 6
  • Karma: 1
Hi Alex,
Is there a backward/forward compatible way of encoding references?
The standard EMF way to encode references is still possible.
As long as you store your model in a single file you have all the possibilities.

We decided to define a strict scope (one folder) and name based references (without the file name) to allow extendibility: Multiple files can be copied to one folder and build one logical model.

The AMALTHEA examples (Wizard new... > examples... > AMALTHEA) are up to date. Take a look at the xml content to see further reference strings.

In general: If you have standard names (no blanks, no special characters) you can simply build references to e.g. a label as
NameOfTheLabel + "?type=sw.Label"

Regards,
Harald
The administrator has disabled public write access.

XML format description 8 years 2 months ago #145

  • alexh
  • alexh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Hi Harald,

I'm trying to import an amalthea file from a third party into the latest version (header of file:
<central:AMALTHEA xmi:version="2.0" xmlns:xmi="www.omg.org/XMI" xmlns:xsi="www.w3.org/2001/XMLSchema-instance" xmlns:central="www.amalthea.itea2.org/model/1.2.0/central" xmlns:common="www.amalthea.itea2.org/model/1.2.0/common" xmlns:hw="www.amalthea.itea2.org/model/1.2.0/hw" xmlns:mapping="www.amalthea.itea2.org/model/1.2.0/mapping" xmlns:os="www.amalthea.itea2.org/model/1.2.0/os" xmlns:stimuli="www.amalthea.itea2.org/model/1.2.0/stimuli" xmlns:sw="www.amalthea.itea2.org/model/1.2.0/sw">)

It is most likely from an older amalthea version. Is amalthea supposed to be able to handle older files? Is there some log output to get more detailed error info?

Currently I get an MsgBox saying that "The editor could not be opened because the file located at 'path' is either not a model file or a model file that is out of scope."

Thx,
Alex
Last Edit: 8 years 2 months ago by alexh. Reason: typo
The administrator has disabled public write access.

XML format description 8 years 2 months ago #146

  • alexh
  • alexh's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Ok, copying the new file header into the old file allowed me to import it. Apparently there are some unsupported elements in the old file. I looked into the examples (demo car etc.). It seems that specifically the mapping (variable to hardware model) has been changed.

From the examples I cannot infer how to map variables to specific memories in the new (current) file format. How is that achieved?

Thx,
Alex
The administrator has disabled public write access.

XML format description 8 years 2 months ago #148

  • Zakir
  • Zakir's Avatar
  • OFFLINE
  • AMALTHEA Developer
  • Posts: 5
  • Thank you received: 1
  • Karma: 0
Hello Alex,

I see that you want to load old AMALTHEA models (e.g: 1.0.3) using the latest AMALTHEA platform API's (e.g: 1.1.1).

This is not recommended directly, rather this is a topic for Model Migration. We are developing a utility to migrate AMALTHEA models from older versions to newer (e.g: 1.0.3 models can be converted to 1.1.0 or 1.1.1)

For details, refer to the following thread from previous post : http://amalthea-project.org/index.php/forum/fsupport/96-importing-a-model-from-version-1-0-3-in-1-1-1
The administrator has disabled public write access.
Time to create page: 0.080 seconds