Here's a script that was previously posted that seems to do
at least part of what you want (note, I have not tested this).
------------------------------------------------------------------
' ListUnusedElements.ebs
'
' (c) 1998, Huseyin Angay for Software Engineered Ltd.
'
' Lists the model elements that appear in the repository but not on
diagrams.
Function isItemViewInDiagram( ByVal theItem As RoseItem, ByVal theDiagram As
ClassDiagram ) As Boolean
If theDiagram.GetViewFrom( theItem ) Is Nothing Then
isItemViewInDiagram = False
Else
isItemViewInDiagram = True
End If
End Function
Function isItemViewInPackage ( ByVal theItem As RoseItem, ByVal thePackage
As Category ) As Boolean
Dim theDiagram As ClassDiagram
' Check whether the item appears in the package's diagrams
For n% = 1 To thePackage.ClassDiagrams.Count
Set theDiagram = thePackage.ClassDiagrams.GetAt( n% )
If isItemViewInDiagram( theItem, theDiagram ) Then
isItemViewInPackage = True
Exit Function
End If
Next
' Check whether the item appears in the package's use case local
diagrams
Dim theUseCase As UseCase
For i% = 1 To thePackage.UseCases.Count
Set theUseCase = thePackage.UseCases.GetAt( i% )
For n% = 1 To theUseCase.ClassDiagrams.Count
Set theDiagram = theUseCase.ClassDiagrams.GetAt( n%
)
If isItemViewInDiagram( theItem, theDiagram ) Then
isItemViewInPackage = True
Exit Function
End If
Next
Next
' The item is not in any of these diagrams, so it must be unused
isItemViewInPackage = False
End Function
Function isUsed( ByVal theItem As RoseItem, ByVal allPackages As
CategoryCollection ) As Boolean
Dim thePackage As Category
For n% = 1 To allPackages.count
Set thePackage = allPackages.GetAt( n% )
If isItemViewInPackage( theItem, thePackage ) Then
isUsed = true
Exit Function
End If
Next
isUsed = False
End Function
Sub checkUseCases ( ByVal allUseCases As UseCaseCollection, ByVal
allPackages As CategoryCollection )
Dim theUseCase As UseCase
Print "### USE CASES ###"
For n% = 1 To allUseCases.count
Set theUseCase = allUseCases.GetAt( n% )
If Not isUsed( theUseCase, allPackages ) Then
Print theUseCase.Name
Print " Item is not used"
End If
Next
End Sub
Sub checkClasses ( ByVal allClasses As ClassCollection, ByVal allPackages As
CategoryCollection )
Dim theClass As Class
Print "### CLASSES ###"
For n% = 1 To allClasses.count
Set theClass = allClasses.GetAt( n% )
If Not isUsed( theClass, allPackages ) Then
Print theClass.Name
Print " Item is not used"
End If
Next
End Sub
Sub checkAssociations ( ByVal associations As AssociationCollection, ByVal
allPackages As CategoryCollection )
Dim theAssociation As Association
Dim class1 As Class
Dim class2 As Class
Dim class1Name, class2Name As String
For n% = 1 To associations.count
Set theAssociation = associations.GetAt( n% )
If Not isUsed( theAssociation, allPackages ) Then
Set class1 = theAssociation.role1.class
If class1 Is Nothing Then
class1Name = "unknown class"
Else
class1Name = class1.Name
End If
Set class2 = theAssociation.role2.class
If class2 Is Nothing Then
class2Name = "unknown class"
Else
class2Name = class2.name
End If
Print theAssociation.Name, " between ", class1Name, "
and ", class2Name
Print " Item is not used"
End If
Next
End Sub
Sub Main
Dim allPackages As CategoryCollection
Dim allDiagrams, packageDiagrams As Collection
'Dim packageDiagrams As Collection
Dim aPackage As Category
ViewportClear
ViewportOpen
' Get all the packages in the system
Set allPackages = RoseApp.CurrentModel.GetAllCategories()
' Use cases
checkUseCases RoseApp.CurrentModel.GetAllUseCases(), allPackages
' Classes
checkClasses RoseApp.CurrentModel.GetAllClasses(), allPackages
Print "### ASSOCATIONS ###"
For n% = 1 To allPackages.count
Set aPackage = allPackages.GetAt( n% )
' Associations
checkAssociations aPackage.Associations, allPackages
Next
End Sub
------------------------------------------------------------------
Patrick Kennedy
Rational Support
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 6:55 AM
To: [EMAIL PROTECTED]
Subject: (ROSE) Model Checking
Hi,
Is there any way (tool, script, whatever) to find objects that do NOT
appear on any diagram anywhere in the system? Our model has changed
greatly recently and there are a lot of unnecessary objects (use-cases,
classes, associations etc.) floating around that I need to get rid of, but
don't know how without wasting a lot of man-hours doing it manually.
I also have in the model a couple of associations. I don't know where in
the model they belong, which diagram (if any) would be affected, etc. The
specification does not help in any way whatsoever. How can I find out what
they are for?
TIA,
Haydn
--
Haydn Robinson
Software Engineer
Sophos Anti-Virus
http://www.sophos.com
email : [EMAIL PROTECTED]
UK Support : +44 1235 559933
Direct Line: +44 1235 544090
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************