-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation cannot handle asserted relations with inferred assets #44
Comments
…irectly encoded links are not overwritten. Addresses #44.
I have implemented a fix for the crash caused by asserted relationships involving inferred assets, which was caused by a quirk of the Jena library used to get resources from the model. The Model.getResource(URI) method now behaves in the same as the Model.createResource(URI) method, as that now returns the existing resource if defined in the model. What nobody considered is that this means getResource(URI) now returns an empty Resource object and not (null) if the URI is not yet defined in the model. My test case uses a single IoT Sensor (see attached). The test is to import this model and validate. The inference patterns create an onboard Process that creates the output Data, but do not assume the output is stored on the Sensor. Once this has been done, it is possible to manually add a 'Sensor-stores-Data' relationship to the inferred Data asset, and it should be possible to revalidate and get an inferred serialised DataCopy on the sensor. Unfortunately, this test case is affected by a KB issue Spyderisk/domain-network#23, whereby the stores relationship leads to a second inferred process, which should for consistency be related to the first. So the test produces an unexpected modelling error. In my opinion, the changes in system-modeller do address the issue here, and the test results are as expected given the unexpected effect from this KB error. |
The fix is on branch 44, but I haven't raised a pull request to merge this, pending cleaning up the knowledge based so the results of the test can be checked manually. |
Sometimes a user may wish to assert a relationship in which one or both assets is inferred.
As an example, consider a system containing a Process that receives (i.e., is sent) data from an IoT Sensor. A second Process uses the first to access the sensor data, but does not itself communicate directly with the Sensor. The sensor data here is an inferred Data asset. There is no way to infer the relationship of the second Process to this Data, so the user would need to assert this relationship.
System modeller supports the addition of such a relationship. One can create the model without that relationship, validate to generate the inferred Data asset, then add the relationship between this and the second Process.
However, revalidating after this extra relationship has been added fails. This is because system modeller finds the asserted relationship and tries to deduce its cardinality constraints. This is done for inferred relationships when they are added, by which time both ends must exist. But for asserted relationships it has to be done separately, and at present it is done at the start.
This fails because inferred assets are deleted at the start of validation, so one end of the asserted relationship is missing.
What we need is either (a) a way to defer adding cardinality constraints to an asserted relationship if one or both ends is inferred until the inferred asset(s) have been added, or (b) a way to add cardinality constraints later, after completion of all inferences.
The text was updated successfully, but these errors were encountered: