XForms/同义词集编辑器
外观
< XForms
您希望将同义词集与单个业务术语相关联。同义词集是一组具有相似含义或相似语义的术语。它们在称为同义词集的结构中分组在一起。一个术语只能与一个同义词集相关联。
这些工具通常用于创建企业级受控词汇表的过程。这些词汇表用于以一致的方式识别数据元素或表达跨多个组织的业务规则。
在这个程序中,我们将有一个实例具有初始同义词集。我们将有一个按钮,使用 switch/case 显示替代同义词。当您选择新的同义词集时,它将把所选同义词集树复制到所选同义词集中并关闭 case。
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events" >
<head>
<title>Test of XForm to Associate Synonym Set to Business Term</title>
<style type="text/css">
@namespace xf url("http://www.w3.org/2002/xforms");
body {font-family:Helvetica, sans-serif}
.preferred {font-weight:bold;}
.synonym xf|repeat * {display:inline}
.url {color: blue; text-decoration:underline; margin: 0 2px;}
.syn-list {background-color: sliver;}
</style>
<xf:model>
<xf:instance xmlns="" id="current-synset">
<SynSet>
<synset-id>2</synset-id>
<synonym>
<preferred>false</preferred>
<syn-name>Middle Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Central Item</syn-name>
</synonym>
<synonym>
<preferred>true</preferred>
<syn-name>Second Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Following Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>After First Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Following Item</syn-name>
</synonym>
</SynSet>
</xf:instance>
<xf:instance xmlns="" id="synonym-sets">
<SynSets>
<SynSet>
<synset-id>1</synset-id>
<synonym>
<preferred>false</preferred>
<syn-name>Origin Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>First Item</syn-name>
</synonym>
<synonym>
<preferred>true</preferred>
<syn-name>Initial Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Stat Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Begin Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Originating Item</syn-name>
</synonym>
</SynSet>
<SynSet>
<synset-id>2</synset-id>
<synonym>
<preferred>false</preferred>
<syn-name>Middle Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Central Item</syn-name>
</synonym>
<synonym>
<preferred>true</preferred>
<syn-name>Second Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Following Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>After First Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Following Item</syn-name>
</synonym>
</SynSet>
<SynSet>
<synset-id>3</synset-id>
<synonym>
<preferred>false</preferred>
<syn-name>Final Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Ending Item</syn-name>
</synonym>
<synonym>
<preferred>true</preferred>
<syn-name>Last Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>End Item</syn-name>
</synonym>
<synonym>
<preferred>false</preferred>
<syn-name>Tail Item</syn-name>
</synonym>
</SynSet>
</SynSets>
</xf:instance>
<!-- the URL that the user selected and is executed in the load -->
<xf:instance xmlns="" id="URL-container">
<URL/>
</xf:instance>
</xf:model>
</head>
<body>
<h3>Test of XForm to Associate Synonym Set to Term</h3>
<xf:group class="synonym">
<xf:label class="group-label">Synonyms for This Term:</xf:label>
<xf:repeat nodeset="instance('current-synset')/synonym" id="synonym-repeat">
<xf:trigger appearance="minimal" class="url">
<xf:label>
<xf:group ref=".[preferred='true']">
<xf:output ref="syn-name" class="preferred"/>
</xf:group>
<xf:group ref=".[preferred='false']">
<xf:output ref="syn-name"/>
</xf:group>
</xf:label>
<xf:hint>
<xf:output ref="syn-name"/>
</xf:hint>
<!-- we build a URI and load it if the user clicks on a link -->
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="instance('URL-container')" value="concat('http://www.example.com/view-term.xq?name=', instance('current-synset')/synonym[index('synonym-repeat')=position()]/syn-name)"/>
<xf:load ref="instance('URL-container')"/>
</xf:action>
</xf:trigger>
</xf:repeat>
<xf:switch>
<xf:case id="init">
<xf:trigger>
<xf:label>Change Synonym Set</xf:label>
<xf:toggle case="list-synsets" ev:event="DOMActivate"/>
</xf:trigger>
</xf:case>
<xf:case id="list-synsets">
<h3>Set New Synonym Set:</h3>
<xf:repeat nodeset="instance('synonym-sets')/SynSet" id="set-repeat">
<xf:trigger>
<xf:label>Set</xf:label>
<xf:action ev:event="DOMActivate">
<xf:insert nodeset="instance('current-synset')"
origin="instance('synonym-sets')/SynSet[index('set-repeat')]" />
<xf:toggle case="init" />
</xf:action>
</xf:trigger>
<xf:repeat nodeset="synonym">
<xf:trigger appearance="minimal" class="url">
<xf:label>
<xf:group ref=".[preferred='true']">
<xf:output ref="syn-name" class="preferred"/>
</xf:group>
<xf:group ref=".[preferred='false']">
<xf:output ref="syn-name"/>
</xf:group>
</xf:label>
<!-- we build a URI and load it if the user clicks on a link -->
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="instance('URL-container')"
value="concat('http://www.example.com/view-term.xq?name=', instance('current-synset')/synonym[index('synonym-repeat')=position()]/syn-name)"/>
<xf:load ref="instance('URL-container')"/>
</xf:action>
</xf:trigger>
</xf:repeat>
<br/>
</xf:repeat>
<xf:trigger>
<xf:label>Close Synonym Sets List</xf:label>
<xf:toggle case="init" ev:event="DOMActivate"/>
</xf:trigger>
</xf:case>
</xf:switch>
</xf:group>
</body>
</html>