如何制作一个dxl属性,如果单词“要”一词。在另一个属性中存在于IBM理性门中?
如果在另一个属性(称为“ text”)中存在单词“将“”“将“”单词“”存在,则试图制作DXL boolean属性(称为“是要求?”),否则为false。
在门模块上的编辑模式中,我单击“编辑” - >属性 - > “需要吗?” - >编辑... - >检查DXL属性 - >浏览... - >新,编写代码 - >好的,关闭所有窗口,工具 - >刷新DXL属性
Object o
for o in current Module do{
if((o."Text") contains "shall")
{
o."Is Requirement?" = "True"
}
else
{
o."Is Requirement?" = "False"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的几个方面:
obj
中可用,该属性可在attrdxlname 。 DXL属性中的对象也没有循环,也没有DXL布局列中的循环。
包含
具有签名int contains(buffer b,string word,int offset)
,它在缓冲区而不是在字符串上运行。您可能要使用bool findplaintext(字符串s,string sub,int& offset,int& length,bool matchcase [,bool reverse])
o。“ text” 将返回对象引用。但是您想检查属性的内容。要获取字符串属性的内容,您必须将对象引用引入字符串,例如,将引用与字符串相连。您可以使用
obj。“ text”“”
。这更改了您的代码,以
记住您的DXL属性的类型必须是布尔值才能使您工作的。
最后但并非最不重要的一点:您确定您的状况“包含文本应”就足够了吗?那所有包含“应”的单词()? Internet中某个地方有一些有关此主题的线程。搜索“需求DXL应浅”。而且:“会足够”吗?那“可能”,“应该”,“必须”呢?
Several aspects here:
obj
, the attribute is available inattrDXLName
. There is no loop over objects neither in DXL attributes nor in DXL layout columns.contains
has the signatureint contains(Buffer b, string word, int offset)
, it operates on a Buffer, not on a string. You probably want to usebool findPlainText(string s, string sub, int &offset, int &length, bool matchCase[, bool reverse])
o."Text"
will return an object reference. But you want to check the content of the attribute. To get the content of a string attribute, you have to cast the object reference to string, e.g. by concatenating the reference with a string. You can useobj."Text" ""
.This changes your code to
Remember that the type of your DXL attribute must be boolean for this to work.
And last but not least: Are you sure that your condition "Text contains shall" is sufficient? What about all the words that contain "shall" (https://www.thefreedictionary.com/words-containing-shall)? There are some threads about this topic somewhere in the internet. Search for "Requirement DXL shall shallow". And: is "shall" enough? What about "may", "should", "must"?