importEssentialInstances.xsl / getEssentialInstanceContains

Post Reply
jszpyrka
Posts: 13
Joined: 06 Dec 2012, 11:28

Hello :)

Template

Code: Select all

<xsl:template match="node()" mode="ImportSimpleInstance">
contains some piece of code

Code: Select all

...
theInstance = getEssentialInstanceContains(
...
it causes some problem. Take the simple xml file with two simple_instances (order of them is important):
  • (id1, "concrete name with something")
  • (id2, "concrete name")
and import it: In repository You will have only one object with "concrete name with something" name and two external references id1 and id2.

Changing the code to

Code: Select all

theInstance = getEssentialInstance(
resolves the problem but maybe better is using getEssentialInstanceIgnoreCase method or (new method) getEssentialInstanceWithCase?

Best Regards
Jacek Szpyrka
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks for this, Jacek

Yes, the original idea with this template was to be quite fuzzy about how 'the same' element in two repositories should be identified. However, you have pointed out a very good case where this simply doesn't work.

Your suggestions are good to use alternative matching functions from standardFunctions.py.

I've just uploaded a new version of the import transform that uses a much more recent instance-finding function: EssentialGetInstance()

This function encodes a strategy that attempts to find the instance by:
- First the Protege instance ID (so instances that are shared across repositories can be kept in step)
- Second by a match on the external repository reference (which in this case is the Protege instance ID from the source data)
- Third by a precise match on the name, case-sensitive and complete matches only.
- If no instance is found by any of these matching strategies, then a new instance is created.

I've done some testing with your sample data, which I extended slightly to test importing instance slots (relationships) values and all seems to be working.

Jonathan
Essential Project Team
Post Reply