
vec:vector( $values as xs:anyAtomicType ) as vec:vector
Returns a vector value.
xquery version "1.0-ml"; vec:vector((3.14, 1.59, 2.65)) => (A vector value representing the constructed vector) [ 3.14, 1.59, 2.65 ]
xquery version "1.0-ml";
(: string representation :)
vec:vector('[3.14, 1.59, 2.65]')
=> (A vector value representing the constructed vector)
[ 3.14, 1.59, 2.65 ]
(: There exists a JSON document 'pronethalol.json' in the database
that contains a vector generated by a classifier model.
'pronethalol.json' looks like this:
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
-0.03508576,
-0.011583557,
...,
-0.009329922,
0.0031751299,
-0.03169545
]
}]
}
:)
xquery version "1.0-ml";
vec:vector(fn:doc('pronethalol.json')//array-node('embedding'));
=> (A vector value representing the vector constructed by a JSON array node)
[ -0.0350858, -0.0115836, 0.0111236, -0.0191592, ..., -0.0121749, -0.00932992, 0.00317513, -0.0316955 ]