Hi Johan,

Yes, it's a bug in the parser. Your patch will be committed into 
subversion repository.

And yes, TermBindingItem needs some a getter (only returns unmodifiable 
list of terms), so does QueryBindingItem. To be honest, the ontology 
part of archetype package hasn't been used much. So far, we haven't 
connected it to any external terminology service.

Thanks for the support and please keep the good work! :)

Cheers,
Rong

Johan Hjalmarsson wrote:
> Dear All,
> 
> I discovered that the openEHR java parser 1.0.1 didn't store the local 
> term code correctly in an TermBindingItem (it stored the external term 
> code (term_code()) in the local code's place). The attached patch 
> corrects this problem.
> 
> I think that a TermBindingItem should have getters, so I attached a 
> patch for this to.
> 
> Any comments?
> 
> Best regards,
> Johan Hjalmarsson
> 
> 
> ------------------------------------------------------------------------
> 
> Index: Z:/workspace/ADL_parser/src/javacc/adl.jj
> ===================================================================
> --- Z:/workspace/ADL_parser/src/javacc/adl.jj (revision 54)
> +++ Z:/workspace/ADL_parser/src/javacc/adl.jj (working copy)
> @@ -755,15 +755,16 @@
>  TermBindingItem term_binding_item() :
>  {
>    String code;
> +  String localCode;
>    List terms = new ArrayList();
>  }
>  {
>    <SYM_ITEMS> "("
>    (
>      LOOKAHEAD( local_code_value())
> -    code = local_code_value()
> +    localCode = local_code_value()
>    |
> -    code = local_code_path_value()
> +    localCode = local_code_path_value()
>    )
>    ")" <SYM_EQ> "<"
>      code = term_code() {
> @@ -774,7 +775,7 @@
>           }
>      )*
>    ">"
> -  { return new TermBindingItem(code, terms);; }
> +  { return new TermBindingItem(localCode, terms);; }
>  }
>  
>  QueryBindingItem query_binding_item() :
> 
> 
> ------------------------------------------------------------------------
> 
> Index: 
> Z:/workspace/ref_kernel_java/src/java/org/openehr/am/archetype/ontology/TermBindingItem.java
> ===================================================================
> --- 
> Z:/workspace/ref_kernel_java/src/java/org/openehr/am/archetype/ontology/TermBindingItem.java
>       (revision 13)
> +++ 
> Z:/workspace/ref_kernel_java/src/java/org/openehr/am/archetype/ontology/TermBindingItem.java
>       (working copy)
> @@ -28,6 +28,14 @@
>          super(code);
>          this.terms = terms;
>      }
> +    
> +    public List<String> getTerms() {
> +     return terms;
> +    }
> +    
> +    public String getCode() {
> +     return code;
> +    }
>  
>      List<String> terms;
>  }

-
If you have any questions about using this list,
please send a message to d.lloyd at openehr.org

Reply via email to