# 22. Virtuoso Functions Guide - id

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
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 Server & Internet
XML
XPATH & XQUERY
and
append
assign
avg
boolean
ceiling
concat
contains
count
create-attribute
create-comment
create-element
create-pi
current
distinct
doc
document
document-literal
empty
ends-with
every
except
false
filter
floor
fn:collection
for
format-number
function-available
generate-id
id
if
intersect
is_after()
is_before()
key
lang
last
let
list()
local-name
max
min
name
namespace-uri
normalize-space
not
number
or
position
processxquery
processxslt
processxsql
progn()
replace()
round
serialize
shallow
some
starts-with
string
string-length
substring
substring-after
substring-before
sum
system-property
text_contains()
translate
true
tuple()
union
unordered
unparsed-entity-uri
urlify
xmlview
Functions Index

## id

Returns an entities whose ID attributes are in the given list
sequence id ( ids any);
Description

The function gets a list of strings, where every string is a list of IDs delimited by whitespace characters. For every listed ID, the function checks if the document that contains the context entity also contains an entity with such ID; if the entity with the listed ID exists, it is added into the sequence.

To avoid searches of every ID inside the whole document, the function uses "ID cache" that is created if "IdCache=ENABLE" DTD configuration option is specified in the call of function that parses the XML document. In some cases, it is possible to build such cache on demand if it is not built by a parser, but it consumes time and in any case it requires the saved DTD information from the XML parser, so the parser should be specially configured anyway.

Note that any attribute of types ID, IDREF or IDREFS is a good input string for the function id(). So while XQuery "pointer operator" is not available in XPath expression, the id() function is a good replacement for it.

Parameters
ids – The list of strings that consist of IDs
Return Types

Errors

The function ignores any sort of syntax errors on input.

Examples
List errors in census data

List every person who is not a spouse of his own spouse.

    document ("census.xml")//person[@spouse and not (. = id (id (@spouse)/person/@spouse)]

See Also

document()