Variant (query directive)
(3 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
− | Gets the variant name with the specified type and version from the active column value of input. | + | Gets the variant name with the specified type and version from the active column value of input. You can leave out the version to get all variants of a type or both parameters to get all variants in the topic. |
+ | |||
+ | If you specify both the type and the version but no such variant exists, will return null. If you leave out one or both of them, will return an empty result if no matching variants are found. | ||
+ | |||
+ | If you don't specify the version parameter, then the version will be added as a column in the result row. If you don't specify the type either then that also will be added to the result row. | ||
== Constructor == | == Constructor == | ||
− | Variant( | + | Variant([TopicOperand type][,TopicOperand version]) |
== Examples == | == Examples == |
Latest revision as of 15:48, 29 November 2013
[edit] Description
Gets the variant name with the specified type and version from the active column value of input. You can leave out the version to get all variants of a type or both parameters to get all variants in the topic.
If you specify both the type and the version but no such variant exists, will return null. If you leave out one or both of them, will return an empty result if no matching variants are found.
If you don't specify the version parameter, then the version will be added as a column in the result row. If you don't specify the type either then that also will be added to the result row.
[edit] Constructor
Variant([TopicOperand type][,TopicOperand version])
[edit] Examples
Following example gets variant names of the input topic in various languages and joins them all together.
importPackage(org.wandora.query2); importPackage(org.wandora.topicmap); new Join( new Variant(XTMPSI.DISPLAY,XTMPSI.getLang("en")).as("#en"), new Variant(XTMPSI.DISPLAY,XTMPSI.getLang("fi")).as("#fi"), new Variant(XTMPSI.DISPLAY,XTMPSI.getLang("se")).as("#se"), new Variant(XTMPSI.DISPLAY,XTMPSI.getLang("it")).as("#it") )