eclipse-basyx / basyx-python-sdk

MIT License
59 stars 27 forks source link

adapter.aasx: resolution of `file://` references #72

Open jkhsjdhjs opened 1 year ago

jkhsjdhjs commented 1 year ago

When loading an AASX file, the aasx checks all submodels for File elements and tries to resolve the referenced files relative to the aasx container root. In Version 2.0, a document named TestFile.pdf in the AASX packages root would be referenced by a File element via the path /TestFile.pdf. Since version 3.0, the schemata prohibit values like /TestFile.pdf and require the file:// protocol to be used, e.g. file:///TestFile.pdf. The problem is that File also supports remote references to files, for example via https://. This isn't allowed by the new schemata.

We should discuss whether the restrictions imposed by the schemata are actually correct, and if so, change the aasx adapter and examples accordingly.

See also: https://github.com/eclipse-basyx/basyx-python-sdk/blob/8304c2ad14f132c9d84b5b1d5185276b34fcc635/basyx/aas/examples/data/example_aas.py#L453 https://github.com/eclipse-basyx/basyx-python-sdk/blob/8304c2ad14f132c9d84b5b1d5185276b34fcc635/basyx/aas/examples/data/example_aas.py#L470-L471 https://github.com/eclipse-basyx/basyx-python-sdk/blob/8304c2ad14f132c9d84b5b1d5185276b34fcc635/basyx/aas/adapter/aasx.py#L233-L259

s-heppner commented 1 year ago

Actually, I believe this may be a problem with the specification. In Part 5 Package File Format, it is specified that Submodels should reference supplementary AASX-files via a "relative URI" in the File SubmodelElement.

s-heppner commented 1 year ago

Some further research proves constraint that the file:// prefix is mandatory in the PathType is wrong: PathType Definition. Therefore, it would appear that the schemata is wrong here. I'll look into it.

s-heppner commented 1 year ago

I opened an Issue at aas-core.

s-heppner commented 1 year ago

RFC 8089 may not allow for relative paths, have you tried to start with a . though?

jkhsjdhjs commented 1 year ago

Thanks for the investigation!

RFC 8089 may not allow for relative paths, have you tried to start with a . though?

I haven't tried that yet, but /TestFile.pdf looks more like an absolute path to me anyways, where / is the root of the AASX package.

s-heppner commented 11 months ago

As an ugly temporary fix, so that AASX-packages can used, we decided to remove the regex check from the schemata. We need to document this though and revert these changes with the upcoming spec fix.