XQuery explorations


I'm playing around with XQuery, and am finding it to be quite powerful. Still getting my head around the FLWR syntax, and what I can do with that, but initial pokings are quite promising. Thanks a LOT to Leif and Jim at Bluestream for guiding me through the first steps. Their XStreamDB is quite a nice XML database, and handles XQuery natively.

Anyway, here's the query that has evolved from the first early steps. It pokes through the XML database for all documents that contain a element, and returns a set of elements describing some stuff I'll need to display the item in a search result page.

FOR  IN Root("RepositoryDB:LOM")
WHERE
	MATCH  USING [//*:langstring CONTAINS "biology"]
RETURN
	LET XQuery explorations := /*:lom/*:general/*:title/*:langstring/text()
	LET  := /*:lom/*:general/*:description/*:langstring/text()
	LET  :=/*:lom/*:technical/*:location/text()
	LET  := /*:lom/*:technical/*:format/text()
	LET  := GetDocumentId()
	LET  := /*:lom/*:lifecycle/*:contribute/*:centity/*:vcard/text()
	LET  := /*:lom/*:metametadata/*:contribute/*:centity/*:vcard/text()
RETURN

  {}
  {XQuery explorations}
  {}
  {}
  {}
  {}
  {}


See Also

comments powered by Disqus