# constraint binding error

**URL:** <https://discourse.openehr.org/t/constraint-binding-error/15051>\
**Category:** Technical (archive)\
**Created:** [18 February 2011 13:31 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051 "2011-02-18T13:31:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cati\_Martinez](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@Cati\_Martinez](https://discourse.openehr.org/u/Cati_Martinez)\
**Post date:** [18 February 2011 13:31 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/1 "2011-02-18T13:31:20Z")

</div>

Hello,

somebody knows which is the correct type of a constraint binding? In  
all the examples I have checked and in the ADL grammar (adl.jj), it is  
specified by using an URL.

for instance:

[“ac0001”] = \<[http://terminology.org?query\_id=12345&gt](http://terminology.org?query_id=12345&gt);

but I have seen in other archetypes something like this:

["ac0001"] = \<[CONSULTA::1]\>

The ADL parser throws an error with this last one. is it right?

Thanks!!

---

<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:** [18 February 2011 13:37 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/2 "2011-02-18T13:37:26Z")

</div>

Cati Martínez wrote:

> ["ac0001"] = \<[CONSULTA::1]\>
> 
> The ADL parser throws an error with this last one. is it right?

Hi Cati,

That last one is not a valid constraint binding. It has to be a valid  
URI.

- Peter

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 00:42 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/3 "2011-02-21T00:42:52Z")

</div>

I know it is on ADL specs, but why limit it to an URI? Second approach  
could also be used to identify a subset

I understand the URI need, but I can think more than one occasion  
where you have a defined termset and no URI for it

---

<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:** [21 February 2011 00:56 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/4 "2011-02-21T00:56:11Z")

</div>

Diego Boscá wrote:

> I know it is on ADL specs, but why limit it to an URI? Second approach  
> could also be used to identify a subset

The URI approach is able to specify subsets, Diego. Here is an  
example, generated by the current Archetype Editor beta release  
(available from [http://www.openehr.org/svn/knowledge\_tools\_dotnet/TRUNK/ArchetypeEditor/Help/index.html](http://www.openehr.org/svn/knowledge_tools_dotnet/TRUNK/ArchetypeEditor/Help/index.html))  
:

&nbsp;&nbsp;constraint\_bindings = \<  
&nbsp;&nbsp;&nbsp;&nbsp;["Snomed"] = \<  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;items = \<  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;["ac0001"] = \<terminology:Snomed/2002?subset=DrugForm\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\>  
&nbsp;&nbsp;&nbsp;&nbsp;\>  
&nbsp;&nbsp;\>

- Peter

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 01:14 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/5 "2011-02-21T01:14:51Z")

</div>

If that is the valid way of defining in an URI form, it is  
undocumented. the example should be put on the ADL specs.

And again not that difficult to support both kind of bindings. In my  
opinion, \<ORGANIZATIONXXXXX::DrugFormSubset\> is way more human  
readable and needs the same degree of 'computer interpretation' than  
the URI \<terminology:...\>

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [21 February 2011 01:47 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/6 "2011-02-21T01:47:30Z")

</div>

Hi Peter, Diego,

I think the URI way to define constraint bindings can be ambiguous and hide some semantics needed to understand where to find the terminology terms and codes.  
Please correct me if I’m wrong:

One archetype can have this: [“ac0001”] = terminology:Snomed/2002?subset=DrugForm  
And another this: [“ac0001”] = terminology:Snomed/2002?s=DrugForm

So, how can a machine know the difference or equivalency of both URIs? (URIs are universal, but not a unique way to identify a terminology or a subset).  
How can we agree on use one URI or the other in global archetypes?  
Do we need a centralized terminology/subset URI repository?

What do you think?

---

<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:** [21 February 2011 02:04 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/7 "2011-02-21T02:04:23Z")

</div>

Diego Boscá wrote:

> And again not that difficult to support both kind of bindings. In my  
> opinion, \<ORGANIZATIONXXXXX::DrugFormSubset\> is way more human  
> readable and needs the same degree of 'computer interpretation' than  
> the URI \<terminology:...\>

I would agree that the \<TERMINOLOGY::subset\> form may be more legible  
to humans.

For computer interpretation, however, it would be a big problem. How  
would an ADL parser know whether the value of the constraint binding  
was a URI or not?

The ADL ontology section is a serialisation of the ontology AOM. Page  
78 of [http://www.openehr.org/svn/specification/TRUNK/publishing/architecture/am/aom1.5.pdf](http://www.openehr.org/svn/specification/TRUNK/publishing/architecture/am/aom1.5.pdf)  
&nbsp;&nbsp;specifies that the ARCHETYPE\_ONTOLOGY class's constraint\_bindings  
attribute contains DV\_URI objects. This proposed \<TERMINOLOGY::subset\>  
form is not a serialisation of a DV\_URI, so the specification would  
have to be changed somehow or other. I doubt that the resulting  
serialisation would be the just a matter of putting a  
\<TERMINOLOGY::subset\> where currently we have a URI. There would have  
to be some way of identifying whether it's a DV\_URI or not. This would  
complicate the ADL, probably not making it so nice for humans to read  
after all.

But supposing that this did get done, and the ADL parsers were able to  
differentiate whether it's a DV\_URI or not. We still wouldn't have  
solved all of the problems for computer interpretation, because all  
tools which currently know how to deal with DV\_URIs in the constraint  
bindings would now have to cope with the possibility of some other  
class of object. Not only would software that is currently working  
have to be upgraded, the resulting software would be somewhat more  
complicated than it is today.

- Peter

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 02:05 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/8 "2011-02-21T02:05:42Z")

</div>

I think the same, Pablo

Another thing, why use a slash ('/') between terminology and version?  
why don't use URI modifiers for that also?  
\<terminology:Snomed?v=2002?s=Drugs\>  
or sub-subsets  
\<terminology:Snomed?v=2002?s=Drugs?ss=antiallergenic\>  
and we have also to deal with spaces!  
\<terminology:Snomed?v=2002?s=Antiallergenic drugs (product)\>

---

<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:** [21 February 2011 02:16 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/9 "2011-02-21T02:16:35Z")

</div>

pablo pazos wrote:

> I think the URI way to define constraint bindings can be ambiguous  
> and hide some semantics needed to understand where to find the  
> terminology terms and codes.  
> Please correct me if I'm wrong:
> 
> One archetype can have this: ["ac0001"] = \<terminology:Snomed/2002?  
> subset=DrugForm\>  
> And another this: ["ac0001"] = \<terminology:Snomed/2002?s=DrugForm\>

The latest Archetype Editor beta release that I mentioned before would  
output the first one. It wouldn't know that s=DrugForm is supposed to  
be a subset in the second one.

As Diego mentioned before, this needs to be documented in a  
specification somewhere. I don't write the specs, though, so I'm not  
sure where that would be 😉

- Peter

---

<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:** [21 February 2011 02:22 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/10 "2011-02-21T02:22:16Z")

</div>

Diego Boscá wrote:

> and we have also to deal with spaces!  
> \<terminology:Snomed?v=2002?s=Antiallergenic drugs (product)\>

Spaces are illegal in URIs. The correct form for the subset would be:

&nbsp;&nbsp;subset=Antiallergenic%20drugs%20(product)

- Peter

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 02:24 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/11 "2011-02-21T02:24:25Z")

</div>

That was my point, that was a real Snomed attribute, with the spaces.  
The result is even more unreadable

---

<div class="post-metadata">

**Author:** ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)\
**Post date:** [21 February 2011 02:28 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/12 "2011-02-21T02:28:36Z")

</div>

I'm confused as to whether the intention here was really URI, URL or  
URN?

My understanding was that the use of DV\_URI for term binding in archetypes was  
more in the vein of global identification of resources (more URN)  
rather than actually telling the software how to get to the resource  
(ala URL).

So I imagined that each EHR implementation would need to somehow  
have a lookup table from terminology resources -\> actual terminology  
resource access mechanism. I mean, you can't actually use the  
terminology reference as an actual URL and do a GET on it? What is  
the return value? In the absence of an agreed terminology service  
layer definition within openEHR I can't see how that could possibly work.

So that is why I thought that they would be more along the lines of

["ac0001"] = \<[urn:fdc:nehta.gov.au:2010:ctppconcepts]\>

or (in URL format, but clearly not an actual web location)

["ac0001"] = \<[[http://nehta.gov.au/cttpconcepts\](http://nehta.gov.au/cttpconcepts%5C)]\>

So to answer Pablo's question

> So, how can a machine know the difference or  
> equivalency of both URIs? (URIs are universal, but  
> not a unique way to identify a terminology or a subset).

They are equivalent if the canonical form of the URI is equivalent.  
If the archetype is published globally, then the URI needs to  
globally unique and every implementation that wants to deal  
with the archetype will need to have a mechanism for turning  
the globally unique URI into an real actual terminology set.

I don't think implementations are meant to be looking inside the  
URI to try to extract parameters, subsets etc. If they are then  
we are at least one entire specification short of implementing  
archetypes..

Andrew

---

<div class="post-metadata">

**Author:** ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)\
**Post date:** [21 February 2011 02:42 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/13 "2011-02-21T02:42:31Z")

</div>

Just to clarify some more, my contention is that you cannot  
look inside a arbitrary URI to pick out values without  
looking at the formal 'scheme' dependent spec.

So in the case of a 'http' URI, we can read the spec and know  
what the bits mean - \_for the purposes of fetching data  
from web servers using HTTP\_. I can't imagine how that  
is possibly what is intended by putting a URI into an  
archetype - we can't seriously be suggesting that everyone  
who uses the archetype is all going to be descending on  
some poor webserver named in the URL and fetching data  
in some arbitrary format?

So if you want a URI scheme that has identifiable bits  
for snomed queries etc, someone needs to specify a

urn:snomed:xxxx,yyyy,zzzz

spec. If not, all you can do is compare URI's for equality  
and assume there is some external mechanism for saying  
what the URI actually means.

Andrew

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 02:50 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/14 "2011-02-21T02:50:46Z")

</div>

and also, binding to URL seems like a bad decision for archetype  
maintainability

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [21 February 2011 03:15 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/15 "2011-02-21T03:15:34Z")

</div>

(just to clarify) I know that constraint bindings URIs are not actual working URIs that you can get a-la HTTP, I understand that here they are used as identifiers, that with a mapping somewhere, our system can access the real terminology source.

With the centralized service I meant not to get the content of the terminology, instead get the global and unique terminologies identifiers for use in archetypes, so for each terminology and subset we will have only one id (URI/URN). We can have a mapping to an OID too (other global identifier, less human friendly but works).

The problems are:

- we need some way to define/specify what is the canonical form of a URI/URN, we must agree in a terminology of names (of terminologies :D) and subsets.
- Snomed is the same as SNOMED? or ICD10 is the same as ICD 10 or CIE 10 (CIE = ICD in spanish)?
- we cannot rely of one tool implementation to take a decision that is not in the specs: other tools can make different decision, so, generated archetype will be inconsistent.

---

<div class="post-metadata">

**Author:** ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)\
**Post date:** [21 February 2011 03:28 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/16 "2011-02-21T03:28:46Z")

</div>

> - we need some way to define/specify what is the canonical form of a  
> URI/URN, we must agree in a terminology of names (of terminologies :D) and  
> subsets.  
> - Snomed is the same as SNOMED? or ICD10 is the same as ICD 10 or CIE 10  
> (CIE = ICD in spanish)?  
> - we cannot rely of one tool implementation to take a decision that is not  
> in the specs: other tools can make different decision, so, generated  
> archetype will be inconsistent.

Yes - agree totally. I think the spec at various points says that the UMLS  
terminology identifier name should be used, but I don't think this is  
clarity enough - UMLS  
is a bit haphazard with how they name things.

Would like to see an agreed upon list of canonical URI/URN for the  
terminology bindings that people are using in practice with real  
current terminology sources so that we can get some harmonization.

Andrew

---

<div class="post-metadata">

**Author:** ![yampeku](https://discourse.openehr.org/user_avatar/discourse.openehr.org/yampeku/32/25_2.png) [@yampeku](https://discourse.openehr.org/u/yampeku)\
**Post date:** [21 February 2011 03:31 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/17 "2011-02-21T03:31:15Z")

</div>

And just as a comment, in the ADL 1.4 specs the example shows a URL.  
Maybe should be better if a URN was shown

---

<div class="post-metadata">

**Author:** ![michael.lawley](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@michael.lawley](https://discourse.openehr.org/u/michael.lawley)\
**Post date:** [21 February 2011 03:46 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/18 "2011-02-21T03:46:43Z")

</div>

Surely spaces should not be an issue here as these strings do not really identify anything. Instead, one should be using SCTIDs as in:  
terminology:Snomed?v=2002?s=135394005

Further issues include:

\* the version should be specified using an ISO 8601 basic representation of YYYYMMDD (or YYYYMMDDThhmmss Z for development versions),  
\* "Snomed" is insufficient - is this the International release, or SNOMED CT-AU or ... My understanding of Release Format 2 (see 7.4.4.13 in the Technical Implementation Guide) indicates that the moduleId (also an SCTID) is the appropriate thing to use, and  
\* one may also (almost always) wish to use a ReferenceSet for terminology binding. These are also designated by an SCTID (and would require a moduleId and version as well)

This would then give us something like:

&nbsp;&nbsp;&nbsp;&nbsp;terminology:SNOMED?m=32506021000036107&v=20101130&s=135394005

Diego Boscá wrote:

> and we have also to deal with spaces!  
> \<terminology:Snomed?v=2002?s=Antiallergenic drugs (product)\>

Spaces are illegal in URIs. The correct form for the subset would be:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subset=Antiallergenic%20drugs%20(product)

- Peter

---

<div class="post-metadata">

**Author:** ![pablo](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pablo/32/3505_2.png) [@pablo](https://discourse.openehr.org/u/pablo)\
**Post date:** [21 February 2011 04:14 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/19 "2011-02-21T04:14:47Z")

</div>

Hi Michael,

Not every terminology version is a date. In ICD 10, the version is “10”. I think the version to be a valid date is not a problem here.

---

<div class="post-metadata">

**Author:** ![michael.lawley](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@michael.lawley](https://discourse.openehr.org/u/michael.lawley)\
**Post date:** [21 February 2011 04:27 UTC](https://discourse.openehr.org/t/constraint-binding-error/15051/20 "2011-02-21T04:27:04Z")

</div>

Indeed, in Australia, it would be ICD-10-AM but the version would correspond to the particular "Edition" you're using. Hence my example URI still included the string SNOMED so that one knows how to interpret the v=, s=, m= elements. Clearly every standard terminology is going to have it's own mechanisms for indicating versions, etc.

But in this instance, my real point was that SCTIDs need to be used rather than terms.

michael

[Next page](https://discourse.openehr.org/t/constraint-binding-error/15051.md?page=2)
