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 - sousac

Pages: [1] 2
1
One of our team members is making use of the structured scenario result and state attributes within a use case.

These need to be included in the Use Case Details document but are not rendering when added to the template.

What I did was simply start with the standard Use Case Details document template and save it as a custom template. I then added the attributes within the existing structured scenario tags.  The content of the "result" simply won't render.

So the template has something like:

Quote
structured scenarios >
         {Scenario_Structured.Step}.{Scenario_Structured.Action}
               Uses:
                {Scenario_Structured.Uses}

               Result:
                {Scenario_Structured.Result}

< structured scenarios

Can't see any filters or other reasons the content would not be output in the template. Bug?

2
We have a model that we manage translations for in two languages but we have a requirement to provide the diagrams of our content in both languages to our audience.

In Sparx EA 15.2 and Prolaborate 4.x there doesn't seem to be language context capabilities for diagram content (i.e., show a specific language or allow a toggle when viewing a diagram) so I thought I would check with the community to see if I am missing something or this feature has not yet arrived.  The document generation also seems deficient when it comes to diagram content and multi-lingual capabilities.

We can accomplish, partially, what we need by maintaining two diagrams and - via scripting - conveying the second language in the alias of the elements/connectors (and then using the "show alias if available") but this limits our use of the alias for other purposes (e.g., abbreviations).

3
Suggestions and Requests / Always open diagram as relation matrix
« on: June 23, 2020, 01:41:34 pm »
The relation matrix is an excellent addition to the diagram view and, unlike the general model relationship matrix, is nicely confined (with ease) to the diagram.

It would be great if (a) the settings of the matrix that were altered were persisted (they reset upon each toggle) and (b) we could default the view of the diagram to this view.

4
Hi Sousac,

I am a newbie to SPARX. I have a similar requirement to build a data model for SAP HANA Database. Earlier we were using SAP power designer. I understand that SPARX does not support ODBC connection for SAP and HANA Database. Could you share your approach on how data model from SAP HANA database can be imported to SPARX. Thank you for your time.


PS - I can share my custom DDL templates for Hana if you need those.  Our goal was to simply generate basic DDL, FKs, and Unique Constraints (nothing more exotic). Happy to share them when I am back from vacation next week.

5
"I am a newbie to SPARX. I have a similar requirement to build a data model for SAP HANA Database. Earlier we were using SAP power designer. I understand that SPARX does not support ODBC connection for SAP and HANA Database. Could you share your approach on how data model from SAP HANA database can be imported to SPARX. Thank you for your time."

I haven't found a way to reverse engineer from SAP Hana, however, you might be able to if you can find a 32-bit ODBC driver.  In my case we were doing custom development so I only needed to generate DDL (not reverse engineer).

I extended Sparx to support basic SQL-based DDL for Hana and also generate entity and constraint declarations for Hana CDS.  This is done by adding a custom database to Sparx and then creating your own versions of the DDL templates. I started with the Sybase ones as a base.

6
Appreciate the insight as always Geert.

Cheers.

PS - I also noticed a flaw in my script for the tagged values that is only noticeable when using the auto color legend against the tag.  If I allow the script to simply add the tag without a value and permit the tagged value definition to assign its default value, the value isn't visible to the legend until it is changed via the UI (initialization issue it seems).  I altered the script to explicitly set the default value for the tag and this corrected the problem.

7
Thanks Geert,

The code creates a collection of elements and child elements on the object that was used as context. Tagged values are also required on the child elements. A composition connector, in addition to nesting is also required.

Capability
   Current State Assessment
      Tech Assessment
      Process Assessment
      etc.
   Target State
     Tech Assessment
     Process Assessment
     etc.

     


Code: [Select]
sub OnProjectBrowserScript()

' Get the type of element selected in the Project Browser
dim treeSelectedType
treeSelectedType = Repository.GetTreeSelectedItemType()

select case treeSelectedType

case otElement
' Code for when an element is selected
dim theCapability as EA.Element
set theCapability = Repository.GetTreeSelectedObject()
dim AssessmentName

If theCapability.Stereotype = "ArchiMate_Capability" then
AssessmentName = InputBox( "Entrez un nom pour la nouvelle évaluation.", "Create Assessment", "évaluation année 9999")
Call CreateAssessmentStructure(theCapability, AssessmentName)
else
Session.Prompt "Sélectionnez un élément de capacité pour exécuter ce script.", promptOK
end if

case else
' Error message
Session.Prompt "Sélectionnez un élément de capacité pour exécuter ce script.", promptOK

end select

end sub

' Creates an assessment structure
Sub CreateAssessmentStructure(capabilityElement, AssessmentName)
Dim CapabilityElements as EA.Collection
Dim newAssessment as EA.Element
Dim NewAssessmentElements as EA.Collection

Dim tecAssessment as EA.Element
Dim infAssessment as EA.Element
Dim prcAssessment as EA.Element
Dim savAssessment as EA.Element
Dim orgAssessment as EA.Element
Dim matAssessment as EA.Element

set CapabilityElements = capabilityElement.Elements
set newAssessment = CapabilityElements.AddNew(AssessmentName,"Class")
newAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
newAssessment.Update

' Add composition Relationship to the parent element
Call AddArchimateComposition(capabilityElement,newAssessment)

Set NewAssessmentElements = newAssessment.Elements
Set tecAssessment = NewAssessmentElements.AddNew("TEC","Class")
Set infAssessment = NewAssessmentElements.AddNew("INF","Class")
Set prcAssessment = NewAssessmentElements.AddNew("PRC","Class")
Set savAssessment = NewAssessmentElements.AddNew("SAV","Class")
Set orgAssessment = NewAssessmentElements.AddNew("ORG","Class")
Set matAssessment = NewAssessmentElements.AddNew("MAT","Class")

tecAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
infAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
prcAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
savAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
orgAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"
matAssessment.Stereotype = "Archimate3::ArchiMate_Assessment"

tecAssessment.Update
infAssessment.Update
prcAssessment.Update
savAssessment.Update
orgAssessment.Update
matAssessment.Update

Call AddTag(newAssessment,"Capability Assessment")
Call AddTag(tecAssessment,"Capability Assessment")
Call AddTag(infAssessment,"Capability Assessment")
Call AddTag(prcAssessment,"Capability Assessment")
Call AddTag(savAssessment,"Capability Assessment")
Call AddTag(orgAssessment,"Capability Assessment")
Call AddTag(matAssessment,"Capability Assessment")

Call AddArchimateComposition(newAssessment,tecAssessment)
Call AddArchimateComposition(newAssessment,infAssessment)
Call AddArchimateComposition(newAssessment,prcAssessment)
Call AddArchimateComposition(newAssessment,savAssessment)
Call AddArchimateComposition(newAssessment,orgAssessment)
Call AddArchimateComposition(newAssessment,matAssessment)

End Sub


' Adds a relationship of a specific type and stereotype
Sub AddArchimateComposition( Source, Target )
dim Conn as EA.Connector
dim ClientEnd as EA.ConnectorEnd

' ClientID = source end, SupplierID = target end
' source end is already set based on the element that owns the Connectors collection.  Only need to set SupplierID.
set conn = Source.Connectors.AddNew("", "Association")
Conn.StereoType = "Archimate3::ArchiMate_Composition"
Conn.SupplierID = target.ElementID
Conn.Update

' Establish the aggregation on the client End as Composite
set ClientEnd = Conn.ClientEnd
ClientEnd.Aggregation = 2
ClientEnd.Update

Source.Connectors.Refresh
Target.Connectors.Refresh
end sub

' Adds a tagged value to an element
sub AddTag(theElement, TagName)
Dim ElementTags as EA.Collection
Dim newTag as EA.TaggedValue

set ElementTags = theElement.TaggedValues
set newTag = ElementTags.AddNew(TagName,"")
newTag.Update

end sub

OnProjectBrowserScript

8
Automation Interface, Add-Ins and Tools / Re: CSV Import
« on: November 05, 2019, 01:14:57 pm »
Hi Piku,

That is an odd event to trigger an import on (why would you want to automatically import data when you've only created or changed the specification which tells you nothing about the readiness of the data for import?). 

Maybe let us know what you are trying to generally achieve and perhaps someone would have a suggestion.

9
I have written a script that creates a collection of child Archimate elements (nested) for the selected element, complete with tagged values, as well as relationships. The script performs as designed without any issues.

<Existing Element>
     3 x New Child Element (with tagged values and a relationship to its parent)
          6 x Sub-Child Elements for each (with tagged values and relationship to its parent)

Performance
On a local EAPX, the scrip runs in about 5 seconds or less (what I would expect). Over a wide area network to a repository via cloud connection, the same script takes about a minute to run (a factor of 12x slower).

The slowness seems to be due to the number of addNew and Update methods I am calling in the script (one can literally observe the items being created in the project browser at a snails pace).

General question, is there any general strategy to observe to limit the number of "save trips" back to the repository when creating a structure like the one depicted (ie., similar to the concept of a commit wrapper....create a bunch of data....commit once?)

10
Theory confirmed. Geert was very much correct but what I was noticing was related to the PK constraint and how FKs are created when drawing a new relationship.

Explanation
When a  PK is migrated as a new FK in a child table (upon creating a new relationship), Sparx uses the contents of the PK constraint to migrate/establish the FK.  It retains the type of each member column (parameters of the method) and uses that to establish the type of the newly established FK attributes added to the child table. This makes sense. My error was in assuming the parameter was merely a reference to the member column rather than a separately persisted item.

So when creating a script to convert to/from custom DBs, one has to iterate through and update all of the constraints (PK, AK, FK) and indexes to ensure all the references to the columns (including those within constraints and index parameters) have their types updated to the new data types as well.

Thanks Geert and Paolo, your thoughts/questions helped me solve it.

11
I don't think this is the crux of the issue as the problem materializes when a *new* relationship is added to the model after my script is run

Before Script
Primary Key of a table on SQL Server is of type Long
Existing relationships are in place with that table (i.e., it has one ore more parent-child relationships where it is the parent).

After Script
The table is now SAP Hana
The primary key and existing FKs are of type BIGINT (a Hana data type)
If I create a brand new table (Database set to SAP Hana)  and add a new relationship to the model in which the existing table is the parent, the resulting FK that is created is of type Long (the original data type that was present before the script).

As the relationship is net new, it seems unlikely that this is due to the existing relationship/FKs not being updated (unless Sparx examines existing FKs when creating net new relationships to new tables).

A more likely possibility is that the details of the migrated key is taken from the PK constraint of the table which is also storing the data type redundantly. This could make sense since the key to migrate is based on the members of the PK (in theory it could be a multi-part key).  Why it would also obtain data types from the PK would be odd.  Any thoughts on that hypothesis?

12
Thanks as usual Geert.

I had prepared a script to effectively convert tables from one platform (e.g., SQL Servere) to a custom DB (e.g., Hana) but am seeing some odd behaviour that I can't figure out.

The script flipped the GenType of the Element (table) to the new database and then set the Attribute.Type property to the new target datatype for that platform (which had been configured ahead of time in the repository).

The odd behaviour is seen when creating a new association/foreign key.

It seems that, although the type of the attributes were updated (e.g., from Long to BIGINT for my PKs for example), however, when the PK migrates as an FK it still carries its original type before the script was run (Long in this case) which was the original datatype.  Manually using the Sparx UI to change the PK type to a different value and then back to BIGINT solves the issue.

This would indicate that there is an additional property (in addition to Type) that needs to be updated by my script but I am at a loss to find it (I though maybe classifier but that doesn't seem to be used in this case).

13
Found it.  I had gone astray looking at custom properties when the "database product" is simply stored in the GenType property of the element.

14
We are working with databases that are not natively supported in Sparx 14 (e.g., SAP Hana).  A current shortcoming is that the "data type mapping" feature (to express equivalency of data types from one platform to another) does not work with databases that you have added yourself.  I've confirmed this "bug" with Sparx Support. 

Currently when you change the "database" of a table element from one platform to your own custom version, Sparx either maps everything to "varchar" or in the case of going from one custom DB to another custom DB, you lose the datatype and length/precision specifications.

To compensate, I wanted to write my own script to "convert table from database platform x to database platform y", however, I can't seem to find where the "Database" property is exposed in the EA Object Model.


Does anyone have a sample script to manipulate the extended properties associated with EA's data modeling extension (e.g., Database Platform)?

15
Thanks Geert.

So I would use a SQL snippet/fragment.

The SQL would join the tag, attribute, and object where the GUID stored in the tagged value = GUID of the referenced attribute.

Something along the lines of:

Select <expression to produce the name> from < join tag to attribute, join attribute to object > Where <attribute.GUID = tag.value>

Pages: [1] 2