Hi guys, |
Re: Hi all - some help on this function?
It might be necessary to have the source module opened exclusively, I am not sure about this. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Hi all - some help on this function? You should routinely use the optional Mandatory flag, the 2nd bool parameter first is "overrideable" and the 2nd "mandatory", both cannot be true. "f" must be the folder housing the source module; I think this will work: .... string NameSource = "/MyProject/MyFolder/MyModule" .... Folder fldSource = folder(module(NameSource)) Create the link-module first. The "create" embedded here looks suspicious, doesn't have enough parameters and in any case is silly to tack on a 'create' in the middle of this function; why not also create the Source or Target formal modules? Make sure you can create these LinkSetPairings using the GUI and understand what they are doing before attempting to manage the synonym LinkModuleDescriptors in DXL.
|
Re: Hi all - some help on this function? llandale - Thu Feb 10 12:30:35 EST 2011
string SourceName = "/New ResMed Project/1. IP Reqts/MRD" string TargetName = "/New ResMed Project/1. IP Reqts/MANF" Folder fldSource = folder("/New ResMed Project/1. IP Reqts") string LinkName = "/New ResMed Project/Satisfies" addLinkModuleDescriptor(fldSource,SourceName,TargetName,true,LinkName) {/code} Hi thanks for the replies' I've been trying this little snippet a while already and it keeps saying I have incorrect input parameters into addLinkModuleDescriptor. Can anyone spot what I've done wrong? I can't. By the way, Louie, Folder fldSource = folder(module(SourceName)) doesn't work; it says wrong argument or something. The manual says the input is Item ItemRef_ ... Any clues? Thanks, ToODiff |
Re: Hi all - some help on this function? TooDifficult - Thu Feb 10 18:24:26 EST 2011
The declaration syntax for the addLinkModuleDescriptor function is as follows.
string addLinkModuleDescriptor(Folder f,
string source,
string target,
bool overrideable,
[bool mandatory, ]
string linkmod,
string desc)
Paul Miller
|
Re: Hi all - some help on this function? SystemAdmin - Thu Feb 10 19:02:14 EST 2011
The declaration syntax for the addLinkModuleDescriptor function is as follows.
string addLinkModuleDescriptor(Folder f,
string source,
string target,
bool overrideable,
[bool mandatory, ]
string linkmod,
string desc)
Paul Miller
Thanks Paul, I'll try it out now. So everything in the code that's [ ] is optional yeah? Yeah, lol I just realized. the closing slash has almost become instinctive TooDiff |
Re: Hi all - some help on this function? TooDifficult - Thu Feb 10 21:22:07 EST 2011
....So everything in the code that's [ ] is optional yeah?.. - yep, sure is, this is the usual convention for something that is optional within the syntax of a definition for most things, particularly code.
addLinkModuleDescriptor(fldSource,SourceName,TargetName,false,true,LinkName,"")
Paul Miller
|
Re: Hi all - some help on this function? SystemAdmin - Thu Feb 10 21:41:41 EST 2011
....So everything in the code that's [ ] is optional yeah?.. - yep, sure is, this is the usual convention for something that is optional within the syntax of a definition for most things, particularly code.
addLinkModuleDescriptor(fldSource,SourceName,TargetName,false,true,LinkName,"")
Paul Miller
Hi Paul,
string SourceName = "/New ResMed Project/1. IP Reqts/MRD"
string TargetName = "/New ResMed Project/1. IP Reqts/MANF"
Folder fldSource = folder("/New ResMed Project/1. IP Reqts")
string LinkName = "/New ResMed Project/Satisfies"
addLinkModuleDescriptor(fldSource,SourceName,TargetName,false,true,LinkName,"")
|
Re: Hi all - some help on this function? TooDifficult - Thu Feb 10 22:06:58 EST 2011
Hi Paul,
string SourceName = "/New ResMed Project/1. IP Reqts/MRD"
string TargetName = "/New ResMed Project/1. IP Reqts/MANF"
Folder fldSource = folder("/New ResMed Project/1. IP Reqts")
string LinkName = "/New ResMed Project/Satisfies"
addLinkModuleDescriptor(fldSource,SourceName,TargetName,false,true,LinkName,"")
No - these are known as linksets The authors of DXL have not been very kind with the way in which they have names some functions. Link Module Desriptors (LMD's) is one of them - a better name might have been Linkset Pair Rules (LPR). As Louie pointed out in an earlier post - it might be a good idea to play around with LMD's as they are used via the DOORS client GUI. Open up a formal module, select File > Module Properties and look for the "Linksets" tab (another poorly assigned name). This is where a user can view, add & modify linkset pair rules - rules that define what target modules this module is allowed to link with and where the link data should be stored when a link is created. DXL LMD's create these linkset pair rules - now here is where it gets a bit weird - even though the client GUI suggests that these linkset pair rules are defined as part of a formal module, the actual LMD data is stored as meta data in the parent folder of that formal module - I don't know why - other folk may have the answer to the universe on this one - this is why you need to identify the folder of that has the source formal module in the DXL LMD function call. BTW - after a LMD has been configured, if any of the modules defined in a LMD (source, target, link) is moved to another folder by a user - the LMD data is automatically revised by DOORS to reflect the move. Paul Miller Melbourne, Australia |
Re: Hi all - some help on this function? TooDifficult - Thu Feb 10 22:06:58 EST 2011
Hi Paul,
string SourceName = "/New ResMed Project/1. IP Reqts/MRD"
string TargetName = "/New ResMed Project/1. IP Reqts/MANF"
Folder fldSource = folder("/New ResMed Project/1. IP Reqts")
string LinkName = "/New ResMed Project/Satisfies"
addLinkModuleDescriptor(fldSource,SourceName,TargetName,false,true,LinkName,"")
Because of that, I've started putting extra checks in my scripts: .... Module g_mOriginal = current .... if (null g_mOriginal or type(g_mOriginal) != "Formal") ack error and halt. However, opening a link module doesn't do much good; each "Object" corresponds to a link set and the attributes are boring, just telling you the name of source and target modules. When you addLinkModuleDescriptor, you can verify with the GUI by looking at the properties sheet of the open Source module. Perhaps check modules: if (!module(SourceName) or !module(TargetName) or !module(LinkName)) ack error and return May be a little better if you CALCULATE the folder housing the source module: Folder fldSource = getParentFolder(module(SourceName)) I wonder if you are confusing a "LinkSet Pairing" as seen in the module properties, with an actual "LinkSet" as seen inside a Link Module. You can indeed define an LSP in an existing link module that has that linkset, but if that linkset doesn't exist the LSP is just fine, then linkset will get created when you actually attempt to create a link.
Confusing, yes. Again, be the 3 year old, "cool". |
Re: Hi all - some help on this function? llandale - Fri Feb 11 15:56:15 EST 2011
Confusing, yes. Again, be the 3 year old, "cool". Paul: Yeah I get it now. I think I forgot what an LMD was prior to this. So you can do two things with this: set the default LinkMod that the two modules Source and Target can take linking rules from. You can also define what module links to what. So even though there's the option of adding many many LMDs to one source module, does it mean you have to create a different LMD for a different type of link? Let's say module A links to B via the Satisfies link module, and this would maintain that every link described in this module is an 'A satisfies B' link. By convention, would I create another LMD if I wanted to describe a pairing with 'A verifies C'? This would ensure that the source A and target C will look to the Verifies link module for their linker descriptions and also maintain that every link in this module is an 'A verifies B' link. Or would I store both of them in the same LMD? To me this doesn't make sense anyway because I would be mixing the verifies together with satisfies and assuming both of them have the same linking structures in each link module. Louie: I think I did confuse the linkset with the linkset pairing. I also did see the getParentFolder function in the manual and thought of using it. I think I will implement it. Since it's a template I'm making, I would indeed want to create an LSP beforehand, so that every 'wrong' link from an arbitrary user would be rejected. I'll give the coding a shot and see what I get up to. TooDiff |
Re: Hi all - some help on this function? TooDifficult - Sun Feb 13 20:47:35 EST 2011 OK, you have to create an LMD between two modules. A and B. Once you have created an LMD that 'describes' what target module to aim at and with what link module, it will record it as ONE of the entries in the linkset pairings. Being one of the entries, it does seem you can create more. Now, on a separate level, you create a link module that has as ONE of the entries, the specific direction(s) that A can link to B. Being one of the entries, again, it looks like you can create more of the same type of entries. Problem 1: When you do create more Linkset pairings or LMDs inside the Module Properties, this is like saying for a given source A and target B, I am setting down different link modules that I want you to base your new links on. Is that logical? So first I mark it with an LMD saying A Satisfies B - using the 'satisfies' link module. Then I mark it again using the 'verifies' module, with A Verifies B. Does this make sense? It's like you're overwriting it. So am I correct in thinking the main use of LMDs' extra entries is to control what link modules govern links between a given source A and an arbitrary target B (chosen by user?) E.g., I say Satisfies is to be used between A and B but in another entrY I say that Verifies is to be used between B and C. This seems to make more sense? Problem 2: Within the link module what you are doing is defining link directions - as well as actual links if you wish. So we create a module linkset saying A ---> B in that specific direction. If this link module has a whole lot of other linksets saying B--->C, D---->E, is it actually sensible to place them here? The link module is called satisfies and the arrow directions between each module linkset show this behaviour as well. Do you bunch everything into one link module or create different link modules for different pairings of modules (this latter choice will result in so so so many link modules) Thanks, TooDiff |
Re: Hi all - some help on this function? TooDifficult - Sun Feb 13 23:24:16 EST 2011
So am I correct in thinking the main use of LMDs' extra entries is to control what link modules govern links between a given source A and an arbitrary target B (chosen by user?)
I meant for a series of Bs with one fixed A. Basically I could create B to Z target modules and link them all up using the LMD inside the fixed A, with each of the 25 entries saying what link module I want the system to use with which target module. |
Re: Hi all - some help on this function? TooDifficult - Sun Feb 13 23:28:47 EST 2011
So am I correct in thinking the main use of LMDs' extra entries is to control what link modules govern links between a given source A and an arbitrary target B (chosen by user?)
I meant for a series of Bs with one fixed A. Basically I could create B to Z target modules and link them all up using the LMD inside the fixed A, with each of the 25 entries saying what link module I want the system to use with which target module. I think you're starting to see the light - but just in case - here's a once only offer for you and others - I have attached a PDF extract of some DOORS training material that I created some time ago on the topic of linking and linkset pair rules - I have permission to publish this extract from a company that I have done some contracting work for (company logo removed to avoid gratuitous advertising). See if this helps your understanding of LMD's as a feature of DOORS - once you fully understand the concept, then applying the DXL may be easier. Paul Miller Melbourne, Australia Attachments attachment_14582315_DOORSTrainingExtract-LMDs.pdf |
Re: Hi all - some help on this function? SystemAdmin - Mon Feb 14 04:29:35 EST 2011 Paul Miller Melbourne, Australia I guess it's more ideal to have a bunch of different link modules that each govern linking between just 2 modules. Now I just have to try and translate that into code. So a linkset (the drop down in the link module) is the one that specifies linking direction right? Thanks, TooDiiff |
Re: Hi all - some help on this function? TooDifficult - Mon Feb 14 17:01:07 EST 2011 Yes. Each linkset in a Link Module is dedicated to managing the mapping of links between objects in a source module and objects in a target module (a linkset pair). Have a go at selecting one one of these linksets in a link module and have a look at the amazing primitive retro graphics - what you will see is a linking matrix where objects in the source module are the rows and objects in the target module are the columns - back in the good old days - links could only be created inside one of these dinosaurs. You had to hunt down the source object, hunt down the target object, the intersection of the blue highlighted row & column marker represented the connection of the two objects, a RH mouse click would allow you to instantiate a link between the two - an instantiated link is displayed as a dark blue cell. Thankfully, these days we have drag-n-drop linking available to us but you still need to define how these drag-n-drop links will be managed. Linkset pair rules (or LMD's in the DXL vernacular) are the way to go about this. Paul Miller Melbourne, Australia |
Re: Hi all - some help on this function? TooDifficult - Mon Feb 14 17:01:07 EST 2011 So you see, link modules define where links are and who has access to them, link pairing restrictions define, which links can be created. Unfortunately most of the time we do not want to change the link module or restrictions but just have a static link setup. So in this static case, would Telelogic not have created this unfortunate "Default Link Module" setting there would probably be no need for link pairing restrictions (provided, that the module knew the linksets that exist for it). Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Hi all - some help on this function? Mathias Mamsch - Tue Feb 15 03:53:49 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS Are you referring to how the linkset pairs under Linkset in the Module Properties seems to have the same function as a linkset direction restriction? Because the function for a Link Module Descriptor takes the input source and target, which sort of indicates that there is some kind of direction restriction. Otherwise it would just take 2 arbitrary module inputs and let the linksets determine linkage direction. In fact at all levels of linking (LMD, linkset pair, linkset) the functions take source and target. Which of these functions actually use the source and target for what they are, rather than just accepting two modules that the user defines and calling them source and target? TooDiff |
Re: Hi all - some help on this function? TooDifficult - Tue Feb 15 19:48:51 EST 2011
void Create_LinkMod()
{
//Create link modules here
Satisfies = create("/New ResMed Project/Satisfies","Links that satisfy -",manyToMany,true)
close(Satisfies,false)
Verifies = create("/New ResMed Project/Verifies","Links that verify - ",manyToMany,true)
close(Verifies,false)
Validates = create("/New ResMed Project/Validates","Links that validate -",manyToMany,true)
close(Validates,false)
//Module References = create("References","Links that reference -",manyToMany,true)
//close(References,false)
//Module Testable = create("Testable","Links tested by -",manyToMany,true)
//close(Testable,false)
}
void Create_LinksetPairings()
{
//Links using Satisfies LM to link
addLinkModuleDescriptor(f2,FG_SYS,REG,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,MRD,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,CRD,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,SRVC,false,true,"/New ResMed Project/Satisfies","")
}
void Create_Linkset()
{
//Linksets to define direction
*create(Satisfies,FG_SYS,REG)*
}
Create_LinkMod()
Create_LinksetPairings()
Create_Linkset()
|
Re: Hi all - some help on this function? TooDifficult - Tue Feb 15 19:58:19 EST 2011
void Create_LinkMod()
{
//Create link modules here
Satisfies = create("/New ResMed Project/Satisfies","Links that satisfy -",manyToMany,true)
close(Satisfies,false)
Verifies = create("/New ResMed Project/Verifies","Links that verify - ",manyToMany,true)
close(Verifies,false)
Validates = create("/New ResMed Project/Validates","Links that validate -",manyToMany,true)
close(Validates,false)
//Module References = create("References","Links that reference -",manyToMany,true)
//close(References,false)
//Module Testable = create("Testable","Links tested by -",manyToMany,true)
//close(Testable,false)
}
void Create_LinksetPairings()
{
//Links using Satisfies LM to link
addLinkModuleDescriptor(f2,FG_SYS,REG,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,MRD,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,CRD,false,true,"/New ResMed Project/Satisfies","")
addLinkModuleDescriptor(f2,FG_SYS,SRVC,false,true,"/New ResMed Project/Satisfies","")
}
void Create_Linkset()
{
//Linksets to define direction
*create(Satisfies,FG_SYS,REG)*
}
Create_LinkMod()
Create_LinksetPairings()
Create_Linkset()
In function Create_LinkMod(), you are closing the link modules after they have been created. That's OK and good practice, but once you have closed a module, as far as I know, the handle to the module is also lost, so for example, the Module variable "Satisfies" is = null after the close. Louie and Mathias might have a more accurate way of describing this.
void Create_Linkset()
{
Satisfies = edit("/New ResMed Project/Satisfies",false) //Open Link module "Satisfies" in edit mode, a handle to this module is passed to the Module variable "Satisfies"
create(Satisfies,FG_SYS,REG) //Add a new linkset
save Satisfies //Save the link module to save the new linkset
close(Satisfies,false) //Close the opened link module
}
Paul Miller
|
Re: Hi all - some help on this function? SystemAdmin - Tue Feb 15 22:19:38 EST 2011
In function Create_LinkMod(), you are closing the link modules after they have been created. That's OK and good practice, but once you have closed a module, as far as I know, the handle to the module is also lost, so for example, the Module variable "Satisfies" is = null after the close. Louie and Mathias might have a more accurate way of describing this.
void Create_Linkset()
{
Satisfies = edit("/New ResMed Project/Satisfies",false) //Open Link module "Satisfies" in edit mode, a handle to this module is passed to the Module variable "Satisfies"
create(Satisfies,FG_SYS,REG) //Add a new linkset
save Satisfies //Save the link module to save the new linkset
close(Satisfies,false) //Close the opened link module
}
Paul Miller
Thanks, TooDiff |
Re: Hi all - some help on this function? SystemAdmin - Tue Feb 15 22:19:38 EST 2011
In function Create_LinkMod(), you are closing the link modules after they have been created. That's OK and good practice, but once you have closed a module, as far as I know, the handle to the module is also lost, so for example, the Module variable "Satisfies" is = null after the close. Louie and Mathias might have a more accurate way of describing this.
void Create_Linkset()
{
Satisfies = edit("/New ResMed Project/Satisfies",false) //Open Link module "Satisfies" in edit mode, a handle to this module is passed to the Module variable "Satisfies"
create(Satisfies,FG_SYS,REG) //Add a new linkset
save Satisfies //Save the link module to save the new linkset
close(Satisfies,false) //Close the opened link module
}
Paul Miller
Sadly the 'Module' handle is not set to null when the module is closed, it just points to de-allocated memory that still looks like a 'Module'. Using a closed 'Module' handle often works, sort of, but eventually will lead to exception violations. YOU must insure you don't use a Handle after the module is closed.
for all items
{ if its not a module continue
Module mod = open
deal with mod
close(mod)
}
bool CloseMod(Module &mod)
{ if (null mod) return(true)
noError()
close(mod, false) // no save
string ErrMess = lastError()
if (!null ErrMess) //
return (false)
mod = null
return(true)
}
|
Re: Hi all - some help on this function? llandale - Wed Feb 16 13:20:47 EST 2011
Sadly the 'Module' handle is not set to null when the module is closed, it just points to de-allocated memory that still looks like a 'Module'. Using a closed 'Module' handle often works, sort of, but eventually will lead to exception violations. YOU must insure you don't use a Handle after the module is closed.
for all items
{ if its not a module continue
Module mod = open
deal with mod
close(mod)
}
bool CloseMod(Module &mod)
{ if (null mod) return(true)
noError()
close(mod, false) // no save
string ErrMess = lastError()
if (!null ErrMess) //
return (false)
mod = null
return(true)
}
OK, I'll try using that close function. By the way, up to the point where I create a linkset (after rearranging the close to occur after the linksets have been added), I can see the pairings inside the link module but not the grid. Is this an issue? Do grids only exist after you create a link? So top I see Source/target and bottom I see source/target (didn't check which was which), but they are only words have no grid in between them. Thanks, TooDiff |
Re: Hi all - some help on this function? TooDifficult - Wed Feb 16 18:53:25 EST 2011 Attachments attachment_14583885_linkissue.JPG |
Re: Hi all - some help on this function? TooDifficult - Wed Feb 16 18:55:14 EST 2011 Thanks anyway guys! Lol TooDiff |