Category Archives: Uncategorized

The 4 Flavors of The Internet of Things

Originally posted on What's The Big Data?:

Internet-of-Things-cisco-csco-stockTwo years ago, Fast Company reported on the “great tech war” of the four leading horsemen of the Internet–Facebook, Amazon, Google, and Apple (let’s call them the FAGA Four).  The race for Internet dominance has intensified since then, with Amazon pitting the Kindle Fire against the iPad and Google responding to Facebook with Google+.  Each of these four companies has moved from its base to capture more social, mobile, local, delivery, advertising, devices, and design dominions.

Even their emergent competition for the enterprise IT market has intensified lately, when Google introduced its Compute Engine and slashed the prices for its cloud services. Looks like it finally decided to make a more serious attempt to diversify from the $0.5 trillion global advertising market—where it gets almost all of its revenues—to the $3.7 trillion IT market. Facebook is the only one of the “Gang of Four” (Eric Schmidt’s term) that…

View original 1,070 more words

Open Source Data Science Masters Curriculum

A list of excellent Open Source resources to build a Data Science curriculum for self-study learners:

Open Source Data Science Masters Curriculum.

Online Data Science Book Club

Originally posted on Data Science 101:

An online data science book club is being formed.  The group will be discussing a collection of books from O’Reilly.

View original

Which Programming Language Should I Learn First?

Interesting article for whoever wants to embark on a journey of coding delights. My personal opinion is that Python is probably the best programming language to get started, although I was first exposed to programming with Prolog. Well, I can proudly say: “I survived”!

Link to the Article:

Which Programming Language Should I Learn First?.

XQuery Functions and Accessors for URIs

There are a number of Accessors and Functions  for manipulating and outputting URIs as described in XPath and XQuery Data Model :

fn:base-uri The base URI of a node
fn:document-uri The URI of a document
fn:encode-for-uri Encodes reserved characters for use in the path of a URI
fn:escape-html-uri Escapes all characters except printable ASCII characters
fn:iri-to-uri Converts an IRI into a URI
fn:resolve-uri Resolves a relative URI to a base URI, returning an absolute URI
fn:static-base-uri The base URI from the static context


Fn:base-uri returns the base URI for a specified node.  If the node is part of a document and its base-uri attribute is not explicitly set, fn:base-uri  defaults to the base URI of the document node.

Fn:base-uri  - Signature-

fn:base-uri() as xs:anyURI?

fn:base-uri($arg as node()?) as xs:anyURI?

The zero-argument version of the function returns the base URI of the context node and it is equivalent to calling fn:base-uri(.) The single-argument version of the function follows the below rules:

  • If $arg is the empty sequence, the function returns an empty sequence.
  • Otherwise, the function returns the value of the dm:base-uri accessor applied to the node $arg.

Fn:base-uri -Examples- 

Assume that $foo = ‘’

Input:  base-uri($foo)

Ouput: ‘’


Fn:document-uri takes  a document node and returns the absolute URI associated with it. It is, in fact, the inverse of fn:doc, which returns a document node based on an absolute URI.

Fn:document-uri  - Signature -

Fn:document-uri($arg as node()?) as xs:anyURI?

If $arg is empty, it returns an empty sequence.

Fn:document-uri -Examples-

Assume that $foo=’doc(’

Input:  document-uri($foo)

Output: ‘’


Fn:encode-for-uri encodes reserved characters for use in the path of a URI. URIs require some characters (ASCII and non-ASCII) to be escaped  with their hexadecimal Unicode code point preceded by the percentage sign (%). All characters can be escaped, exception made for the following:

  • letters a through z and A through Z
  • digits 0 through 9
  • hyphen (-), underscore (_), period (.), tilde (~)

Fn:encode-for-uri -Signature-

fn:encode-for-uri($uri-part as xs:string?) as xs:string

If $uri-part is an empty sequence, it returns a zero-length string.

Fn:encode-for-uri – Examples-

Input: concat("", 

Output: ""


Fn:escape-html-uri escapes all characters, except made for printable US-ASCII coded character set. The function enables HTML user agents to handle attribute values that expect URIs, by replacing each character with an escape sequence.

Fn:encode-html-uri -Signature-

The escape sequence takes the form of: %fn:escape-html-uri($uri as xs:string?) as xs:string

Fn:encode-html-uri -Examples-

Input:  escape-html-uri('ésumé.html')

Output:  ''


Fn:iri-to-uri transforms a xs:string containing an IRI into a URI. This function replaces each special character with an escape sequence in the form %xx, where xx is two hexadecimal digits (in uppercase) representing the character in UTF-8.

Fn:iri-to-uri -Signature-

fn:iri-to-uri($iri as xs:string?) as xs:string

All characters except the following are escaped:

  • Letters a through z and A through Z
  • Digits 0 through 9
  • Hyphen (-), underscore (_), period (.), exclamation point (!), tilde (~), asterisk (*), apostrophe(‘), parentheses (‘(‘ and ‘)’) and hash mark (#)
  • Semicolon (;), forward slash (/), question mark (?), colon (:), at sign (@), ampersand (&), equals sign (=), plus sign (+), dollar sign ($), comma (,), square brackets (‘[' and ']‘), and percent sign (%).

If only a specific part of a UR needs to escapedI (as opposed to an entire URI), it is recommended to use the function fn:encode-for-uri .

Fn:iri-to-uri – Examples-

Input:  fn:iri-to-uri ("")



Fn:resolve-uri  returns an absolute URI by taking a base URI ($base) and a relative($relative) URI as arguments. In case $base is not provided, then the  the base URI of the static context is used. The main difference between $base and $relative is detailed here

Fn:resolve-uri -Signature-

fn:resolve-uri($relative as xs:string?) as xs:anyURI?
fn:resolve-uri($relative as xs:string?$base as xs:string) as xs:anyURI?

Fn:resolve-uri -Examples-

Input: fn:resolve-uri('test', '')



Fn:static-base-uri returns the base URI of the static context.  The static context of an expression is the information that is available during static analysis of the expression, prior to its evaluation. If the base URI is undefined, an empty sequence is returned.


  • XQuery 1.0 and XPath 2.0 Functions and Operators (Second Edition),  W3C Recommendation 14 December 2010. Available at:
  • XQuery, Priscilla Walmsley,  O’Reilly Media, 2007
  • Michael Kay, XSLT 2.0 and XPath 2.0 Programmer’s Reference (Programmer to Programmer), Wrox; 4 edition, 2008IETF.
  • RFC 3987: Internationalized Resource Identifiers (IRIs). Available at: Developer Network XPath:
  • XQuery Library:

Get every new post delivered to your Inbox.

Join 53 other followers

%d bloggers like this: