www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
aref
aset
concat
concatenate
dvector
get_keyword
get_keyword_ucase
gvector_digit_sort
gvector_sort
isarray
make_array
position
rowvector_digit_sort
serialize
split_and_decode
tree_md5
vector
vector_concat
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

get_keyword

Find a value in keyword vector
get_keyword ( keyword any, searched_array vector, [default any], [no_copy integer]);
Description

get_keyword performs a case sensitive seek for the occurrence of keyword from each even position of searched_array. If found,this returns the element following the occurrence of the keyword. If the keyword is not found this returns the default argument or NULL if the default is not supplied.

Parameters
keyword – String key value to be searched in the searched_array at even positions.
searched_array – An array of even length to be searched. Each even position is a string to search. Each odd position can be any value that may then be returned.
default – Any data to be returned if keyword is not matched in the searched_array.
no_copy – By default no_copy is false (0). If passed as true (non-zero integer) then the element to return is the original content of the array and the place in the array from which the element came gets set to 0. This must in some cases be true, for example when the data being retrieved is not copyable, as in the case of a string output. While the default behavior is to return a copy of the element get_keyword will return the element itself and then set the place from which the element was retrieved to 0 if this argument is true.
Errors

Parameter data type checking errors

SQL Code Error Message Virtuoso Code
22023 get_keyword expects a vector of even length, not of length <n> SR057

Return Values

get_keyword returns the matched data if it is found. Otherwise it returns the default. When no default is defined, NULL is returned.

Examples
Sample calls
get_keyword(2,vector(1,'primero',2,'segundo',
	3,'tercero'),NULL)		-> segundo
get_keyword('tercero',vector('primero',1,'segundo',
	2,'tercero',3), 'NOT FOUND!'))	-> 3

x := vector ('a', 2);
y := get_keyword ('a', x, -1, 1);
The first call returns 2
y := get_keyword ('a', x, -1, 1);
the second call returns 0 as the data was set to 0 by the previous call.
See Also

get_keyword_ucase