# Archetyping links

**URL:** <https://discourse.openehr.org/t/archetyping-links/14906>\
**Category:** Technical (archive)\
**Created:** [1 June 2009 13:44 UTC](https://discourse.openehr.org/t/archetyping-links/14906 "2009-06-01T13:44:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Karlsson](https://discourse.openehr.org/user_avatar/discourse.openehr.org/daniel_karlsson/32/3383_2.png) [@Daniel\_Karlsson](https://discourse.openehr.org/u/Daniel_Karlsson)\
**Post date:** [1 June 2009 13:44 UTC](https://discourse.openehr.org/t/archetyping-links/14906/1 "2009-06-01T13:44:49Z")

</div>

Dear Everyone,

what are the possibilites of constraining the LINK.target attribute  
(DV\_EHR\_UIR datatype) in an archetype? This was possible in earlier  
versions of the Ocean Archetype Editor (although its use never was clear  
to me). Let's say that I want to constrain a link from an archetype to  
only allow linkage to instances conforming a specific set of archetypes  
(e.g. allowing linkage only to Diagnosis-archetype instances for links  
with "complication of" meaning.) Is it allowed to use a regexp  
constraint on the DV\_EHR\_URI and include the archetype id? Is it  
guaranteed that the archetype id can be used in the path as in 11.2.3 in  
Architecture overview in run-time systems?

Regards,  
Daniel

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [2 June 2009 09:33 UTC](https://discourse.openehr.org/t/archetyping-links/14906/2 "2009-06-02T09:33:45Z")

</div>

Just want to be more specific about the questions (Daniel and I are  
working together on this issue), I created the ADL following the  
example from Daniel's post.

ELEMENT[at0002.1] matches { -- Diagnosis  
&nbsp;&nbsp;&nbsp;&nbsp;value matches {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DV\_CODED\_TEXT matches {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defining\_code matches {[ac0.1]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;links matches {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LINK[at0003.1] matches { -- complication of  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target matches {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DV\_EHR\_URI matches {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value matches  
{/content/items[openEHR-EHR-EVALUATION.diagnosis.v1]/}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;}  
}

The ADL is created manually, so it might not have the correct syntax.  
But you probably get the idea anyway.

The general question is if LINK is intended to be a runtime  
facilitator or something that could be used in design time  
(archetyping) as well?

Secondly, what's the status of tooling support, both in authoring  
environment (archetype editors) and runtime systems (querying for  
instance)?

Any feedback will be appreciated!

Cheers,  
Rong

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [2 June 2009 23:54 UTC](https://discourse.openehr.org/t/archetyping-links/14906/3 "2009-06-02T23:54:34Z")

</div>

Hi Rong,  
Ocean certainly has runtime support for LINKs. The Ocean Archetype Editor  
used to (and perhaps it is still there) have an initial implementation of  
constraining LINKs but it became unclear if this was viable, useful or  
appropriate. We tend to now think it is a template constrain if anything.

The common use cases we have used links is between compositions, whereas  
your example below tends to be a relative uri within the current  
compositions, which is quite legitimate but I want to ensure we consider the  
more general case. For absolute URIs, the URI pattern becomes difficult to  
determine because you have version specific URIs, relative version URIs  
(e.g. latest\_trunk\_version), and system specific URIs. In addition, your  
example assumes an exact understanding of the composition structure in which  
the target is located, i.e. that the diagnosis exists within some section.  
This is most likely not know at the time of creating the archetype with the  
LINK and likely to be variable. Wildcards and RegEx patterns can make this  
possible but start to get very complicated.

It is for these reasons that it became unclear how we can constrain the  
target URI in an archetype. I have considered some extensions to AQL to be  
able to query compositions that contain LINKs to specific object types. I  
would need to review these thoughts but from memory it was along the lines  
of the following.  
&nbsp;&nbsp;... CONTAINS LINK CONTAINS EVALUATION  
e[openEHR-EHR-EVALUATION.diagnosis.v1] ... WHERE e/...

The point here (and it may not be clear from my attempt to relate it to AQL)  
is that there may need to be some indirect constraint required for LINKs,  
i.e. something that does not physically exist in the current instance such  
as a constraint on the target URI, but something that makes a assertion  
about the real target of the URI.

I don't think there is an easy answer to these questions and only  
implementation and ongoing discussion is likely toi find viable solutions.

Heath

---

<div class="post-metadata">

**Author:** ![grahamegrieve](https://discourse.openehr.org/user_avatar/discourse.openehr.org/grahamegrieve/32/3602_2.png) [@grahamegrieve](https://discourse.openehr.org/u/grahamegrieve)\
**Post date:** [3 June 2009 00:15 UTC](https://discourse.openehr.org/t/archetyping-links/14906/4 "2009-06-03T00:15:24Z")

</div>

Hi Heath

Doesn't this imply that a URI's are like codes that are  
references to some concept - that there's the same interest  
in controlling the concepts that they point to, and  
a similar delegation of control as with terminologies (as  
in, early vs late binding, implementation provision issues)?

So that would suggest that the existing terminology stuff  
in archetypes and templates points towards a solution?

Grahame

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [10 June 2009 07:30 UTC](https://discourse.openehr.org/t/archetyping-links/14906/5 "2009-06-10T07:30:13Z")

</div>

Hi Heath,

Thanks for sharing the status of the tooling support and your thoughts on this.

I would say our use case for the link is also between compositions.  
For the reasons you mentioned, it would be nice to just use the  
archetypeId in the constraint for the value (URI) of the link. Then it  
starts to look like a mini query.

Cheers,  
Rong

---

<div class="post-metadata">

**Author:** ![Peter\_Gummer1](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/p/258eb7/32.png) [@Peter\_Gummer1](https://discourse.openehr.org/u/Peter_Gummer1)\
**Post date:** [10 June 2009 08:19 UTC](https://discourse.openehr.org/t/archetyping-links/14906/6 "2009-06-10T08:19:51Z")

</div>

Rong Chen wrote:

> I would say our use case for the link is also between compositions.  
> For the reasons you mentioned, it would be nice to just use the  
> archetypeId in the constraint for the value (URI) of the link. Then it  
> starts to look like a mini query.  
> &nbsp;&nbsp;  
> It starts looking like a kind of slot too, but whereas a slot has  
> aggregation semantics (i.e. the data in the slot is "owned" by the  
> containing archetype), a link is just an association. So maybe links  
> could use the same regular expression patterns that slots use.

- Peter

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [10 June 2009 09:57 UTC](https://discourse.openehr.org/t/archetyping-links/14906/7 "2009-06-10T09:57:57Z")

</div>

Yes, indeed! It's a choice between composition versus association.

Cheers,  
Rong

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [23 June 2009 00:00 UTC](https://discourse.openehr.org/t/archetyping-links/14906/8 "2009-06-23T00:00:16Z")

</div>

Hi Grahame,  
No, I don't think, not directly anyway. The URIs are based on paths which  
obviously utilise the archetype and node IDs from Archetypes, but each  
implementation of a particular archetyped concept may be in a different  
location within a composition (i.e. a different template) so the path part  
of the URI will be different. In addition, URIs are for a particular  
instance, more like an Instance identifier than a concept code. Therefore,  
the only things that I think can be used to constrain a EHR URI is meta-data  
about the target (rm\_type\_name, archetyped parent archetype ID, archetype  
path) rather than the runtime URI of the target itself. Perhaps this is  
what you meant.

Heath

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [23 June 2009 00:18 UTC](https://discourse.openehr.org/t/archetyping-links/14906/9 "2009-06-23T00:18:45Z")

</div>

Hmm, interesting idea.

H

---

<div class="post-metadata">

**Author:** ![grahamegrieve](https://discourse.openehr.org/user_avatar/discourse.openehr.org/grahamegrieve/32/3602_2.png) [@grahamegrieve](https://discourse.openehr.org/u/grahamegrieve)\
**Post date:** [23 June 2009 00:33 UTC](https://discourse.openehr.org/t/archetyping-links/14906/10 "2009-06-23T00:33:02Z")

</div>

yes, I meant properties of their targets as grounds  
for constraining them

Grahame
