Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RusDavies

Pages: [1] 2
1
General Board / Re: SQL pivot
« on: February 18, 2016, 04:53:38 am »
Ho ho!  Yeap, that's what I needed, perfect.  Thanks Geert.

2
General Board / SQL pivot
« on: February 18, 2016, 03:53:55 am »
Hello.
In a EAP repository, I have a bunch of TOGAF stakeholders defined.  Each has various tagged values.   I want to make a nice little ModelView for a dashboard out of that information.

So, I've started with a query, as follows:
Code: [Select]
SELECT o.Object_ID, o.Name, tag.Property, tag.Value
FROM (t_object o INNER JOIN t_objectproperties tag ON o.Object_ID = tag.Object_ID)
WHERE o.Stereotype = "Stakeholder"
AND tag.Property IN ("Class", "CurrentCommitment", "LevelOfInterest", "Power", "RequiredSupport")

That gets me a list of properties vs stakeholders, with one property per row, something like this:
Object_IDNamePropertyValue
123CEOClassHigh
123CEOPowerKeep Satisfied
123CEOLevelOfInterestHigh
124CIOClassHigh
124CIOPowerKeep Satisfied
124CIOLevelOfInterestHigh


But what I want is one row per stakeholder, like this:
Object_IDNameClassPowerLevelOfInterest
123CEOHighKeep SatisfiedHigh
124CIOHighKeep SatisfiedHigh

So, clearly, I need to pivot the data.  Doing so *should* be trivial.

Various errors received when goofing around suggest EA to be using the Microsoft Jet Database Engine under the hood.  Therefore, this is how I expect to pivot the data:

Code: [Select]
TRANSFORM First(tag.Value)
SELECT o.Object_ID, o.Name, tag.Property, tag.Value
FROM (t_object o INNER JOIN t_objectproperties tag ON o.Object_ID = tag.Object_ID)
WHERE o.Stereotype = "Stakeholder"
AND tag.Property IN ("Class", "CurrentCommitment", "LevelOfInterest", "Power", "RequiredSupport")
GROUP BY o.Object_ID, o.Name
PIVOT tag.Property

But, when I run this query, the result is nothing.  Nada.  I don't receive any errors, yet it doesn't do anything.  In fact, it doesn't even clear the output from any previous successful query. 

So, what am I doing wrong?  Is my SQL way off?  Or is EA limited in some way? And in either case, why no error?

UPDATE: I see from the "Inside Enterprise Architect" book sample from LeanPub, that "[The SQL Editor window] accepts only SELECT statements. Any other SQL (like e.g. UPDATE) is silently ignored!".   Is the issue then that my query begins with TRANSFORM, rather than SELECT? 

UPDATE 2:   I was proofing my SQL via the SQL Scratch Pad of the Project Search Tool, where it could be saved without error but failed to run.  However, if the same query is used in the source for an actual ModelView, then saving the query generates the error "Unable to save Model View Data, invalid Custom SQL. Only Select statements are supported."   It seems then that the issue is indeed the use of the Transform construct, (together with EA being inconsistent about error reporting).   Therefore, how does one perform a pivot in EA?  Does this mean I now have to create (maintain/distribute/etc) a whole Search-Addin to perform what should be a trivial pivot?

3
General Board / Re: Task pane in 12.1
« on: February 06, 2016, 05:31:55 am »
Thanks for the reply.  Makes sense.  Will check out the suggested documentation. 

4
General Board / Task pane in 12.1
« on: February 05, 2016, 07:27:27 am »
Hello.

I'm using the TOGAF 3.0 MDG AddIn, with version 12.1 of EA. 

In the help for the TOGAF addin, section 3.7 talks about TOGAF tasks available via the Task Pane. 

In earlier versions of EA, the tasks pane was opened from the menu "View | Other Project Tools | Tasks Pane", or using the key combination CTRL+SHIFT+9 .   However, in version 12.1, there is no such menu item, and that key combination does nothing(*).  Moreover, I can't find any mention of task panes in the documentation for EA 12.1. 

So, does anyone know, has the tasks pane feature been removed?  If not, how do one access it?   Otherwise, how does one make use of the tasks in the TOGAF 3.0 plugin? 

Thanks,

Russell

(*) Actually, it caused me to try again, several times, and then frown deeply, but I doubt this is a designed behaviour.

5
General Board / Re: Shape script not expanding #<property name># macros
« on: January 27, 2016, 07:32:01 am »
Thanks for the reply qwerty. 

It's starting to feel as if Shape Script was a born as a half-hearted effort after a particularly heavy night on the sauce.   

Will file the macro non-expansion as a bug.

6
General Board / Shape script not expanding #<property name># macros
« on: January 27, 2016, 02:51:08 am »
Hello.

Although I've been using EA heavily since about 2004, I'm still fairly new to the horrors of Shape Script. So, if this is silly question, please forgive me.

As I understand it, Shape Script has the capability to expand properties and tags into strings, using the #<property name># notation.  So, for example, if I want to print out the name of an image that is semantically associated with a stereotype, I might do something like this:

Code: [Select]
print("#stereotype#.emf");

If my stereotype is "bob", then the above prints out "bob.emf".  Marvellous.   

What if I then want to display the image?  Let's say our stereotype is again "bob", and I've already imported an image named "bob.emf".  I kind of expected this to work:

Code: [Select]
image("#stereotype#.emf", 0, 0, 100, 100);

And drum roll..... and nothing.  Nada.  Squat.  Not even a rude message.  The image simply isn't displayed.

So, my question is, why not?  Is my expectation all wrong?  For example, is the macro expansion performed by the print function itself, but not by the image function, rather than by some pre-parser?

Thanks.




7
Perhaps I'm missing some subtly of the suggestion, but what does one gain by replacing the existing Sparx ArchiMate profile entirely?  It contains features that are useful.  Why re-invent all those features, only to gain an extra c. 5% (in my case)? Isn't extending existing types the whole point of UML extensibility?  What am I missing here?

From my perspective, a fresh start doesn't seem to solve the problem that I have here, which is how to override the decorations of underlying stereotypes.  That's a generic issue of how Enterprise Architect behaves, and not tied specifically to ArchiMate 2.  Perhaps you have an alternative implementation strategy that works around the restrictions I'm hitting? 

As an aside, assuming one did fire up a new ArchiMate implementation, one reason not to create a GitHub repository (for example) for such a project is because the paths for icon assets used by the profile helpers and MDG generator are absolute, rather than relative.  That's a royal PITA for sharing a MDG project between developers.  I'd want a solution to that before my right eye starts twitching too. 

8
LOL, that's a clever way of getting the ShapeScript, Glassboy.  As it happened, I went a more painful route, by writing a bash script to suck all of the ShapeScript from an MDG file.  In case any one else finds it useful, here it is.

Code: [Select]
#!/bin/bash

function Error() {
  printf "ERROR: $1.\n" 1>&2 && exit 1
}

[ -z "$1" ] && Error "Incorrect number of params."
[ ! -e "$1" ] && Error "Source file doesn't exist."

XPATHBASE="/MDG.Technology/UMLProfiles/UMLProfile/Content/Stereotypes/Stereotype"
TARGETDIR="${1%.xml}_ShapeScripts"

MTS=$(xmlstarlet sel -T -t -v "${XPATHBASE}/@metatype" $1)

[ -z "$MTS" ] && Error "No metatypes found in source file."

mkdir -p ${TARGETDIR}

for MT in ${MTS}
do
  printf "\n\n=====================\nExtracting ShapeScript for metatype=${MT}\n"
  xmlstarlet sel -t -v "${XPATHBASE}[@metatype='${MT}']/Image[1]" $1 | \
    base64 -i -d | \
    funzip | \
    tr -d '\000' | \
    tee ${TARGETDIR}/${MT}.ShapeScript
done

exit 0

In other news, here's what I've discovered so far:

1) ShapeScript is awful. Quite possibly the work of the Devil himself.

2) DrawNativeShape() doesn't help.  It simply renders the Native type.  If I then add anything after that call, it gets painted on top. 

3) Having extracted the ShapeScript for ArchiMate 2 Node, the decoration method is decoration node { ... }.  However, adding a decoration method with the same name to my extension doesn't override the original.  Instead, both get rendered. This is not consistent with the behaviour of shape main { ... }, which does get overridden. 

4) If I add yet another stereotype between the ArchiMate 2 Node stereotype and my own, then the decoration isn't rendered.  I don't consider this a solution, since I don't understand why.   

5) Flipping the "Rectangular notation" flag in effect removes the cube, per it's condition rendering in the ShapeScript for the Node.  I also don't consider this a solution.

Any more thoughts?

9
Thanks for the reply. 

If no one else provides an answer here, then I'll look into filing a feature request.

10
Thanks for the replies. 

These both seem like excellent ideas.  I'll give them a try, and update accordingly. 

Already, my eye is twitching less. 

11
Thanks for the reply.

Indeed, the path is not an issue for distributing the MDG. 

However, my concern is instead about sharing the development activity for the MDG amongst multiple developers.  In that case, the absolute path does cause problems.

12
I'm creating a new UML profile, in which I extend an Archimate2 Node to create a new stereotype.

Normally, a bare ArchiMate2 Node renders with a little cube as a decoration in the top right of its image.  I'm sure it's very pretty, if you like that kind of thing.

Frankly, I don't like it.  It causes my left eye to twitch with rage.  So, in my extended version, I no longer want that decoration to be rendered.  To that end, I've added a shape script, as follows (where AwesomeNode.emf" is an imported image):

  1  shape main{
  2      image("AwesomeNode.emf", 0, 0, 100, 100);
  3   }
  4
  5  shape label{
  6      setOrigin("SW", 0, 0);
  7      println("#NAME#");
  8  }
  9
10  decoration KillTheCube{
11  }

That renders my little EMF nicely, and adds a label.  However, unsurprisingly, it doesn't in fact kill the cube. 

So, what am I doing wrong?  How do I do it properly?

Perhaps, If the cube in the ArchiMate2 Node type is being rendered by a decoration method which needs to be overridden, then the name of the decoration function matters.  Is that how it works?  If so, how would I discover the required name?  Otherwise, how do I get rid of the little cube?

I'm rapidly running out of eye-twitch pills, so I'll happily send a Mars Bar to anyone who can help me! 

13
I need some help with icons for profile stereotypes.

I'm creating a new UML profile.  The project consists of an EAP file, together with an assets folder containing various bitmaps.  For each new stereotype, I assign a bitmap to icon attribute.  However, Enterprise Architect seems to require an absolute path in the icon field.  (In fact, the related profile helper states as much).

Using absolute paths is generally not good practice. In my case, doing so creates headaches when sharing the project and associated assets with other developers (e.g. via git).

I see that a mechanisms exists, via "Tools -> Local Directories and Paths", to associate root paths with IDs, for certain object types.  That mechanism doesn't seem to apply to the Icon field of profile stereotypes. 

The use of relative paths seems like such a basic requirement, I fear I must be missing some obvious trick. 

So, does anyone know how to have EA successfully use a relative path for the icon field of profile stereotypes?

14
Hi.  

I've been using the Enterprise version of EA for a couple of years.  I'm very happy with it.  However, there is one aspect that perpetually drives me nuts, which is how to apply the same property change to multiple elements at once.  

For example, let's say I have branch of hierarchical packages, each containing many (for example) classes.  The "status" of all the contained classes is initially "Mandatory".  Now say I've just finished running a set of unit tests against my package branch and want to set all of the covered classes as "validated".  

As it currently stands, I have to go to each element in turn, open its properties and change its status field.  This is OK when applying the change to a small number of elements, but is terribly tedious once hundreds or thousands of elements are involved.  Frankly, I end up just not making the changes, which kind of defeats the point of maintaining a status field.

What I'd like to be able to do is select a bunch of elements in a diagram, and apply the same status change to all of them. Even better would be to apply such property changes recursively to all elements in an hierarchy of packages.  

Of course, the status field is just an example.  Another property field that is similarly drives me nuts is  "phase"... occasionally I move an entire package branch into a different phase.  Hiring a new person just to reset the phase attribute on all affected elements just isn't practical, so the Phase doesn't get updated, which introduces inconsistency and effectively renders the phase attribute as useless.  

If the Sparx guys could see their way clear to adding this feature, then I'll buy the whole team a Mars bar each!

Thanks,

Russell

15
Suggestions and Requests / Re: Code engineering support for WSDL, IDL
« on: August 15, 2004, 04:07:38 pm »
Would also love to see mechanisms for automatically generating WSDL from a given interface and parameters.

Pages: [1] 2