Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tigerstripe-dev] Using annotations....

Hi Steve,

Thank you for providing some feedback from practical standpoint. Yes, we understand limitations of URI (string)-based model, and some work is started to address your recomendation to provide annotable object type and probably other information (model object name, etc). Brief discussion started on this thread: ("...The problem I see here is Annotation concept lacks of Annotable object type information, and I'm afraid we may need it in near future..." and below). I'm going to provide a PoC for approach (3) for review this week.

As for querying for annotations of specific type, the idea is to support flexible Query API to allow querying for annotations based on their content, including annotation type. I'm very hope to have this API available later this week as well. 

Kind Regards,

----- Original Message -----
From: "Steve Jerman (stjerman)" <stjerman@xxxxxxxxx>
To: tigerstripe-dev@xxxxxxxxxxx
Sent: Tuesday, May 13, 2008 2:42:58 AM GMT +06:00 Almaty, Novosibirsk
Subject: [tigerstripe-dev] Using annotations....

So, I am trying to make use of the Annotations framework from Tigerstripe... 

I declared an OclConstraint annotation with 3 attributes (type, description and constraint). 

I then used the annotation from Tigerstripe in a plugin: 

#foreach ( $entity in $entities ) 


$entity.Name | $entity.getAnnotations ( "tigerstripe" ) 

#set ( $ocl = $entity.getAnnotations ( "tigerstripe" )) 

#foreach ( $o in $ocl ) 

-> $o.content.language 

-> $o.content.description 

-> $o.content.constraint 


This is hardly user friendly. Looking in the implementation of org.eclipse.tigerstripe.annotation.core . Annotation and org.eclipse.tigerstripe.workbench.internal.core.model .ArtifactComponent 

I see the following issues: 

1) Annotation just contains the URI of the annotated object and the annotation itself. There is no information about what the annotation is. What I actually want to do is something like: 

#set ( $anno = $entity.getAnnotations ( "tigerstripe" )) 

#foreach ( $a in $anno ) 

#if ( $a.type == "OclConstraint) 

-> $a.content.language 

-> $a.content.description 

-> $a.content.constraint 



2) I also want to get able to directly access an annotation: 

#set ( $ocl = $entity.getAnnotation ( "tigerstripe" , "OclConstraint" )) 

-> $ocl.language 

-> $ocl.description 

-> $ocl.constraint 

--> Should throw an exception if more than one defined... 

#set ( $ocls = $entity.getAnnotations ( "tigerstripe" , "OclConstraint" )) 

These should both return the annotation content, rather than the annotation itself. 

Recommended Fix: 

1) Add annotationType field to the Annoation object and populate it with the model object name (maybe need more that this? - the annotation URI?) 

2) Modify the methods in AbstractComponent as described above. 

I will raise bugzillas for this.. 

tigerstripe-dev mailing list

Back to the top