http://zorba.io/modules/data-cleaning/conversion

View as XML or JSON.

This library module provides data conversion functions for processing calendar dates, temporal values, currency values, units of measurement, location names and postal addresses.

The logic contained in this module is not specific to any particular XQuery implementation.

Function Summary

address-from-domain ($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the addresses associated to the name.

address-from-geocode ($lat as xs:double, $lon as xs:double) as xs:string*

Geospatial coordinates to placename converter, acting as a wrapper over the Yahoo! reverse geocoder service.

address-from-phone ($phone-number as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given phone number, returning a string for the address associated to the phone number.

address-from-user ($name as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given name, returning a sequence of strings for the addresses associated to the name.

currency-convert ($v as xs:double, $m1 as xs:string, $m2 as xs:string, $date as xs:string) as xs:double

Currency conversion function, acting as a wrapper over the WebService from the European Central Bank.

geocode-from-address ($q as xs:string*) as xs:double*

Placename to geospatial coordinates converter, acting as a wrapper over the Yahoo! geocoder service.

name-from-domain ($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the person or organization names associated to the name.

phone-from-address ($address as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given address, returning a sequence of strings for the phone number associated to the address.

phone-from-domain ($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the phone numbers associated to the name.

phone-from-user ($name as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given name, returning a sequence of strings for the phone numbers associated to the name.

unit-convert ($v as xs:double, $t as xs:string, $m1 as xs:string, $m2 as xs:string) as xs:double

Conversion function for units of measurement, acting as a wrapper over the CuppaIT WebService.

user-from-address ($address as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given address, returning a sequence of strings for the names associated to the address.

user-from-phone ($phone-number as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given phone number, returning a sequence of strings for the name associated to the phone number.

Variable Summary

Functions

address-from-domain#1

declare  function conversion:address-from-domain($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the addresses associated to the name.

Parameters

domain as xs:string

Returns

xs:string*
A sequence of strings for the addresses associated to the domain name.

Attention : This function is still not implemented.

address-from-geocode#2

declare  %an:nondeterministic function conversion:address-from-geocode($lat as xs:double, $lon as xs:double) as xs:string*

Geospatial coordinates to placename converter, acting as a wrapper over the Yahoo! reverse geocoder service.

Parameters

lat as xs:double
Geospatial latitude.
lon as xs:double
Geospatial longitude.

Returns

xs:string*
The sequence of strings corresponding to the different components (e.g., street, city, country, etc.) of the place name that corresponds to the input geospatial coordinates.

address-from-phone#1

declare  %an:nondeterministic function conversion:address-from-phone($phone-number as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given phone number, returning a string for the address associated to the phone number.

Parameters

phone-number as xs:string
A string with 10 digits corresponding to the phone number.

Returns

xs:string*
A string for the addresses associated to the phone number.

address-from-user#1

declare  %an:nondeterministic function conversion:address-from-user($name as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given name, returning a sequence of strings for the addresses associated to the name.

Parameters

name as xs:string
The name of person or organization.

Returns

xs:string*
A sequence of strings for the addresses associated to the name.

currency-convert#4

declare  %an:nondeterministic function conversion:currency-convert($v as xs:double, $m1 as xs:string, $m2 as xs:string, $date as xs:string) as xs:double

Currency conversion function, acting as a wrapper over the WebService from the European Central Bank.

WebService documentation at http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html

Parameters

v as xs:double
The amount we wish to convert.
m1 as xs:string
The source currency (e.g., "EUR").
m2 as xs:string
The target currency (e.g., "USD").
date as xs:string
The reference date.

Returns

xs:double
The value resulting from the conversion.

geocode-from-address#1

declare  %an:nondeterministic function conversion:geocode-from-address($q as xs:string*) as xs:double*

Placename to geospatial coordinates converter, acting as a wrapper over the Yahoo! geocoder service.

Parameters

q as xs:string
A sequence of strings corresponding to the different components (e.g., street, city, country, etc.) of the place name.

Returns

xs:double*
The pair of latitude and longitude coordinates associated with the input address.

name-from-domain#1

declare  function conversion:name-from-domain($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the person or organization names associated to the name.

Parameters

domain as xs:string

Returns

xs:string*
A sequence of strings for the person or organization names associated to the domain name.

Attention : This function is still not implemented.

phone-from-address#1

declare  %an:nondeterministic function conversion:phone-from-address($address as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given address, returning a sequence of strings for the phone number associated to the address.

Parameters

address as xs:string
A string corresponding to the address (ex: 5655 E Gaskill Rd, Willcox, AZ, US).

Returns

xs:string*
A sequence of strings for the phone number or organization's names associated to the address.

phone-from-domain#1

declare  function conversion:phone-from-domain($domain as xs:string) as xs:string*

Uses a whois service to discover information about a given domain name, returning a sequence of strings for the phone numbers associated to the name.

Parameters

domain as xs:string

Returns

xs:string*
A sequence of strings for the phone numbers associated to the domain name.

Attention : This function is still not implemented.

phone-from-user#1

declare  %an:nondeterministic function conversion:phone-from-user($name as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given name, returning a sequence of strings for the phone numbers associated to the name.

Parameters

name as xs:string
The name of person or organization.

Returns

xs:string*
A sequence of strings for the phone numbers associated to the name.

unit-convert#4

declare  %an:nondeterministic function conversion:unit-convert($v as xs:double, $t as xs:string, $m1 as xs:string, $m2 as xs:string) as xs:double

Conversion function for units of measurement, acting as a wrapper over the CuppaIT WebService.

Parameters

v as xs:double
The amount we wish to convert.
t as xs:string
The type of metric (e.g., "Distance")
m1 as xs:string
The source measurement unit metric (e.g., "meter")
m2 as xs:string
The target measurement unit metric (e.g., "mile")

Returns

xs:double
The value resulting from the conversion

user-from-address#1

declare  %an:nondeterministic function conversion:user-from-address($address as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given address, returning a sequence of strings for the names associated to the address.

Parameters

address as xs:string
A string corresponding to the address (ex: 5655 E Gaskill Rd, Willcox, AZ, US).

Returns

xs:string*
A sequence of strings for the person or organization's names associated to the address.

user-from-phone#1

declare  %an:nondeterministic function conversion:user-from-phone($phone-number as xs:string) as xs:string*

Uses a White-pages Web service to discover information about a given phone number, returning a sequence of strings for the name associated to the phone number.

Parameters

phone-number as xs:string
A string with 10 digits corresponding to the phone number.

Returns

xs:string*
A sequence of strings for the person or organization's name associated to the phone number.

Variables

$conversion:key as item()*

The key to be used when accessing the White Pages Web service